mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-19 04:07:10 -04:00
Style: Move properties for ZS into separate class.
This commit is contained in:
parent
92c01bd2d3
commit
3086064795
@ -164,74 +164,74 @@ namespace MCGalaxy.Gui {
|
||||
public string FailureMessage { get; set; }
|
||||
|
||||
public void LoadFromServer() {
|
||||
ChangeLevels = ZombieGame.ChangeLevels;
|
||||
IgnoredLevelsList = String.Join(",", ZombieGame.IgnoredLevelList);
|
||||
LevelsList = String.Join(",", ZombieGame.LevelList);
|
||||
SaveLevelChanges = ZombieGame.SaveLevelBlockchanges;
|
||||
IgnorePersonalWorlds = ZombieGame.IgnorePersonalWorlds;
|
||||
ChangeLevels = ZombieGameProps.ChangeLevels;
|
||||
IgnoredLevelsList = String.Join(",", ZombieGameProps.IgnoredLevelList);
|
||||
LevelsList = String.Join(",", ZombieGameProps.LevelList);
|
||||
SaveLevelChanges = ZombieGameProps.SaveLevelBlockchanges;
|
||||
IgnorePersonalWorlds = ZombieGameProps.IgnorePersonalWorlds;
|
||||
|
||||
Pillaring = !ZombieGame.noPillaring;
|
||||
Respawning = !ZombieGame.noRespawn;
|
||||
SetMainLevel = ZombieGame.SetMainLevel;
|
||||
StartImmediately = ZombieGame.StartImmediately;
|
||||
Pillaring = !ZombieGameProps.NoPillaring;
|
||||
Respawning = !ZombieGameProps.NoRespawn;
|
||||
SetMainLevel = ZombieGameProps.SetMainLevel;
|
||||
StartImmediately = ZombieGameProps.StartImmediately;
|
||||
|
||||
MaxMoveDistance = ZombieGame.MaxMoveDistance;
|
||||
HitboxPrecision = ZombieGame.HitboxPrecision;
|
||||
IncludeMapInHeartbeat = ZombieGame.IncludeMapInHeartbeat;
|
||||
MaxMoveDistance = ZombieGameProps.MaxMoveDistance;
|
||||
HitboxPrecision = ZombieGameProps.HitboxPrecision;
|
||||
IncludeMapInHeartbeat = ZombieGameProps.IncludeMapInHeartbeat;
|
||||
|
||||
Name = ZombieGame.ZombieName;
|
||||
Model = ZombieGame.ZombieModel;
|
||||
InvisibilityDuration = ZombieGame.InvisibilityDuration;
|
||||
InvisibilityPotions = ZombieGame.InvisibilityPotions;
|
||||
ZInvisibilityDuration = ZombieGame.ZombieInvisibilityDuration;
|
||||
ZInvisibilityPotions = ZombieGame.ZombieInvisibilityPotions;
|
||||
Name = ZombieGameProps.ZombieName;
|
||||
Model = ZombieGameProps.ZombieModel;
|
||||
InvisibilityDuration = ZombieGameProps.InvisibilityDuration;
|
||||
InvisibilityPotions = ZombieGameProps.InvisibilityPotions;
|
||||
ZInvisibilityDuration = ZombieGameProps.ZombieInvisibilityDuration;
|
||||
ZInvisibilityPotions = ZombieGameProps.ZombieInvisibilityPotions;
|
||||
|
||||
Chance = ZombieGame.ReviveChance;
|
||||
InsufficientTime = ZombieGame.ReviveNoTime;
|
||||
InsufficientTimeMessage = ZombieGame.ReviveNoTimeMessage;
|
||||
ExpiryTime = ZombieGame.ReviveTooSlow;
|
||||
ExpiryTimeMessage = ZombieGame.ReviveTooSlowMessage;
|
||||
FailureMessage = ZombieGame.ReviveFailureMessage;
|
||||
SuccessMessage = ZombieGame.ReviveSuccessMessage;
|
||||
Chance = ZombieGameProps.ReviveChance;
|
||||
InsufficientTime = ZombieGameProps.ReviveNoTime;
|
||||
InsufficientTimeMessage = ZombieGameProps.ReviveNoTimeMessage;
|
||||
ExpiryTime = ZombieGameProps.ReviveTooSlow;
|
||||
ExpiryTimeMessage = ZombieGameProps.ReviveTooSlowMessage;
|
||||
FailureMessage = ZombieGameProps.ReviveFailureMessage;
|
||||
SuccessMessage = ZombieGameProps.ReviveSuccessMessage;
|
||||
}
|
||||
|
||||
public void ApplyToServer() {
|
||||
ZombieGame.ChangeLevels = ChangeLevels;
|
||||
ZombieGameProps.ChangeLevels = ChangeLevels;
|
||||
string list = IgnoredLevelsList.Replace(" ", "");
|
||||
if (list == "") ZombieGame.IgnoredLevelList = new List<string>();
|
||||
else ZombieGame.IgnoredLevelList = new List<string>(list.Replace(" ", "").Split(','));
|
||||
if (list == "") ZombieGameProps.IgnoredLevelList = new List<string>();
|
||||
else ZombieGameProps.IgnoredLevelList = new List<string>(list.Replace(" ", "").Split(','));
|
||||
|
||||
list = LevelsList.Replace(" ", "");
|
||||
if (list == "") ZombieGame.LevelList = new List<string>();
|
||||
else ZombieGame.LevelList = new List<string>(list.Replace(" ", "").Split(','));
|
||||
ZombieGame.SaveLevelBlockchanges = SaveLevelChanges;
|
||||
ZombieGame.IgnorePersonalWorlds = IgnorePersonalWorlds;
|
||||
if (list == "") ZombieGameProps.LevelList = new List<string>();
|
||||
else ZombieGameProps.LevelList = new List<string>(list.Replace(" ", "").Split(','));
|
||||
ZombieGameProps.SaveLevelBlockchanges = SaveLevelChanges;
|
||||
ZombieGameProps.IgnorePersonalWorlds = IgnorePersonalWorlds;
|
||||
|
||||
ZombieGame.noPillaring = !Pillaring;
|
||||
ZombieGame.noRespawn = !Respawning;
|
||||
ZombieGame.SetMainLevel = SetMainLevel;
|
||||
ZombieGame.StartImmediately = StartImmediately;
|
||||
ZombieGameProps.NoPillaring = !Pillaring;
|
||||
ZombieGameProps.NoRespawn = !Respawning;
|
||||
ZombieGameProps.SetMainLevel = SetMainLevel;
|
||||
ZombieGameProps.StartImmediately = StartImmediately;
|
||||
|
||||
ZombieGame.MaxMoveDistance = MaxMoveDistance;
|
||||
ZombieGame.HitboxPrecision = HitboxPrecision;
|
||||
ZombieGame.IncludeMapInHeartbeat = IncludeMapInHeartbeat;
|
||||
ZombieGameProps.MaxMoveDistance = MaxMoveDistance;
|
||||
ZombieGameProps.HitboxPrecision = HitboxPrecision;
|
||||
ZombieGameProps.IncludeMapInHeartbeat = IncludeMapInHeartbeat;
|
||||
|
||||
ZombieGame.ZombieName = Name.Trim();
|
||||
ZombieGame.ZombieModel = Model.Trim();
|
||||
if (ZombieGame.ZombieModel == "")
|
||||
ZombieGame.ZombieModel = "zombie";
|
||||
ZombieGame.InvisibilityDuration = InvisibilityDuration;
|
||||
ZombieGame.InvisibilityPotions = InvisibilityPotions;
|
||||
ZombieGame.ZombieInvisibilityDuration = ZInvisibilityDuration;
|
||||
ZombieGame.ZombieInvisibilityPotions = ZInvisibilityPotions;
|
||||
ZombieGameProps.ZombieName = Name.Trim();
|
||||
ZombieGameProps.ZombieModel = Model.Trim();
|
||||
if (ZombieGameProps.ZombieModel == "")
|
||||
ZombieGameProps.ZombieModel = "zombie";
|
||||
ZombieGameProps.InvisibilityDuration = InvisibilityDuration;
|
||||
ZombieGameProps.InvisibilityPotions = InvisibilityPotions;
|
||||
ZombieGameProps.ZombieInvisibilityDuration = ZInvisibilityDuration;
|
||||
ZombieGameProps.ZombieInvisibilityPotions = ZInvisibilityPotions;
|
||||
|
||||
ZombieGame.ReviveChance = Chance;
|
||||
ZombieGame.ReviveNoTime = InsufficientTime;
|
||||
ZombieGame.ReviveNoTimeMessage = InsufficientTimeMessage;
|
||||
ZombieGame.ReviveTooSlow = ExpiryTime;
|
||||
ZombieGame.ReviveTooSlowMessage = ExpiryTimeMessage;
|
||||
ZombieGame.ReviveFailureMessage = FailureMessage;
|
||||
ZombieGame.ReviveSuccessMessage = SuccessMessage;
|
||||
ZombieGameProps.ReviveChance = Chance;
|
||||
ZombieGameProps.ReviveNoTime = InsufficientTime;
|
||||
ZombieGameProps.ReviveNoTimeMessage = InsufficientTimeMessage;
|
||||
ZombieGameProps.ReviveTooSlow = ExpiryTime;
|
||||
ZombieGameProps.ReviveTooSlowMessage = ExpiryTimeMessage;
|
||||
ZombieGameProps.ReviveFailureMessage = FailureMessage;
|
||||
ZombieGameProps.ReviveSuccessMessage = SuccessMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ namespace MCGalaxy.Commands {
|
||||
static void HandleHitbox(Player p, string message, string[] args) {
|
||||
byte precision;
|
||||
if (args.Length == 1) {
|
||||
Player.Message(p, "Hitbox detection is currently &a" + ZombieGame.HitboxPrecision + " %Sunits apart.");
|
||||
Player.Message(p, "Hitbox detection is currently &a" + ZombieGameProps.HitboxPrecision + " %Sunits apart.");
|
||||
} else if (!byte.TryParse(args[1], out precision)) {
|
||||
Player.Message(p, "Hitbox detection must be an integer between 0 and 256.");
|
||||
} else {
|
||||
ZombieGame.HitboxPrecision = precision;
|
||||
ZombieGameProps.HitboxPrecision = precision;
|
||||
Player.Message(p, "Hitbox detection set to &a" + precision + " %Sunits apart.");
|
||||
SrvProperties.Save();
|
||||
}
|
||||
@ -116,11 +116,11 @@ namespace MCGalaxy.Commands {
|
||||
static void HandleMaxMove(Player p, string message, string[] args) {
|
||||
byte distance;
|
||||
if (args.Length == 1) {
|
||||
Player.Message(p, "Maxmium move distance is currently &a" + ZombieGame.MaxMoveDistance + " %Sunits apart.");
|
||||
Player.Message(p, "Maxmium move distance is currently &a" + ZombieGameProps.MaxMoveDistance + " %Sunits apart.");
|
||||
} else if (!byte.TryParse(args[1], out distance)) {
|
||||
Player.Message(p, "Maximum move distance must be an integer between 0 and 256.");
|
||||
} else {
|
||||
ZombieGame.MaxMoveDistance = distance;
|
||||
ZombieGameProps.MaxMoveDistance = distance;
|
||||
Player.Message(p, "Maximum move distance set to &a" + distance + " %Sunits apart.");
|
||||
SrvProperties.Save();
|
||||
}
|
||||
|
@ -43,27 +43,27 @@ namespace MCGalaxy.Eco {
|
||||
}
|
||||
|
||||
DateTime end = Server.zombie.RoundEnd;
|
||||
if (DateTime.UtcNow.AddSeconds(ZombieGame.ReviveNoTime) > end) {
|
||||
Player.Message(p, ZombieGame.ReviveNoTimeMessage); return;
|
||||
if (DateTime.UtcNow.AddSeconds(ZombieGameProps.ReviveNoTime) > end) {
|
||||
Player.Message(p, ZombieGameProps.ReviveNoTimeMessage); return;
|
||||
}
|
||||
int count = Server.zombie.Infected.Count;
|
||||
if (count < ZombieGame.ReviveFewZombies) {
|
||||
Player.Message(p, ZombieGame.ReviveFewZombiesMessage); return;
|
||||
if (count < ZombieGameProps.ReviveFewZombies) {
|
||||
Player.Message(p, ZombieGameProps.ReviveFewZombiesMessage); return;
|
||||
}
|
||||
if (p.Game.RevivesUsed >= ZombieGame.ReviveTimes) {
|
||||
if (p.Game.RevivesUsed >= ZombieGameProps.ReviveTimes) {
|
||||
Player.Message(p, "You cannot buy any more revive potions."); return;
|
||||
}
|
||||
if (p.Game.TimeInfected.AddSeconds(ZombieGame.ReviveTooSlow) < DateTime.UtcNow) {
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGame.ReviveTooSlowMessage); return;
|
||||
if (p.Game.TimeInfected.AddSeconds(ZombieGameProps.ReviveTooSlow) < DateTime.UtcNow) {
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGameProps.ReviveTooSlowMessage); return;
|
||||
}
|
||||
|
||||
int chance = new Random().Next(0, 101);
|
||||
if (chance <= ZombieGame.ReviveChance) {
|
||||
if (chance <= ZombieGameProps.ReviveChance) {
|
||||
Server.zombie.DisinfectPlayer(p);
|
||||
p.Game.RevivesUsed++;
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGame.ReviveSuccessMessage);
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGameProps.ReviveSuccessMessage);
|
||||
} else {
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGame.ReviveFailureMessage);
|
||||
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %S" + ZombieGameProps.ReviveFailureMessage);
|
||||
}
|
||||
Economy.MakePurchase(p, Price, "%3Revive:");
|
||||
}
|
||||
@ -72,8 +72,8 @@ namespace MCGalaxy.Eco {
|
||||
|
||||
protected internal override void OnStoreCommand(Player p) {
|
||||
base.OnStoreCommand(p);
|
||||
int time = ZombieGame.ReviveNoTime, expiry = ZombieGame.ReviveTooSlow;
|
||||
int potions = ZombieGame.ReviveTimes;
|
||||
int time = ZombieGameProps.ReviveNoTime, expiry = ZombieGameProps.ReviveTooSlow;
|
||||
int potions = ZombieGameProps.ReviveTimes;
|
||||
Player.Message(p, "%T/buy " + Name);
|
||||
Player.Message(p, "%HCannot be used in the last &a" + time + " %Hseconds of a round.");
|
||||
Player.Message(p, "%HCan only be used within &a" + expiry + " %Hseconds after being infected.");
|
||||
|
@ -169,8 +169,8 @@ namespace MCGalaxy.Eco {
|
||||
}
|
||||
|
||||
public override string Name { get { return "Invisibility"; } }
|
||||
protected override int MaxPotions { get { return ZombieGame.InvisibilityPotions; } }
|
||||
protected override int Duration { get { return ZombieGame.InvisibilityDuration; } }
|
||||
protected override int MaxPotions { get { return ZombieGameProps.InvisibilityPotions; } }
|
||||
protected override int Duration { get { return ZombieGameProps.InvisibilityDuration; } }
|
||||
protected override bool ForHumans { get { return true; } }
|
||||
}
|
||||
|
||||
@ -182,8 +182,8 @@ namespace MCGalaxy.Eco {
|
||||
}
|
||||
|
||||
public override string Name { get { return "ZombieInvisibility"; } }
|
||||
protected override int MaxPotions { get { return ZombieGame.ZombieInvisibilityPotions; } }
|
||||
protected override int Duration { get { return ZombieGame.ZombieInvisibilityDuration; } }
|
||||
protected override int MaxPotions { get { return ZombieGameProps.ZombieInvisibilityPotions; } }
|
||||
protected override int Duration { get { return ZombieGameProps.ZombieInvisibilityDuration; } }
|
||||
protected override bool ForHumans { get { return false; } }
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Games.ZS {
|
||||
|
||||
internal static void ChooseNextLevel(ZombieGame game) {
|
||||
if (game.QueuedLevel != null) { game.ChangeLevel(game.QueuedLevel); return; }
|
||||
if (!ZombieGame.ChangeLevels) return;
|
||||
if (!ZombieGameProps.ChangeLevels) return;
|
||||
|
||||
try {
|
||||
List<string> levels = GetCandidateLevels();
|
||||
@ -102,11 +102,11 @@ namespace MCGalaxy.Games.ZS {
|
||||
/// <summary> Returns a list of maps that can be used for a round of zombie survival. </summary>
|
||||
/// <returns> null if not enough levels are available, otherwise the list of levels. </returns>
|
||||
internal static List<string> GetCandidateLevels() {
|
||||
List<string> maps = ZombieGame.LevelList.Count > 0 ? ZombieGame.LevelList : GetAllMaps();
|
||||
foreach (string ignore in ZombieGame.IgnoredLevelList)
|
||||
List<string> maps = ZombieGameProps.LevelList.Count > 0 ? ZombieGameProps.LevelList : GetAllMaps();
|
||||
foreach (string ignore in ZombieGameProps.IgnoredLevelList)
|
||||
maps.Remove(ignore);
|
||||
|
||||
bool useLevelList = ZombieGame.LevelList.Count > 0;
|
||||
bool useLevelList = ZombieGameProps.LevelList.Count > 0;
|
||||
if (maps.Count <= 2 && !useLevelList) {
|
||||
Server.s.Log("You must have more than 2 levels to change levels in Zombie Survival"); return null; }
|
||||
if (maps.Count <= 2 && useLevelList) {
|
||||
@ -120,7 +120,7 @@ namespace MCGalaxy.Games.ZS {
|
||||
string[] files = Directory.GetFiles("levels", "*.lvl");
|
||||
foreach (string file in files) {
|
||||
string name = Path.GetFileNameWithoutExtension(file);
|
||||
if (name.IndexOf('+') >= 0 && ZombieGame.IgnorePersonalWorlds)
|
||||
if (name.IndexOf('+') >= 0 && ZombieGameProps.IgnorePersonalWorlds)
|
||||
continue;
|
||||
maps.Add(name);
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ namespace MCGalaxy.Games {
|
||||
return;
|
||||
} else if (Status == ZombieGameStatus.InfiniteRounds) {
|
||||
DoRound();
|
||||
if (ChangeLevels) LevelPicker.ChooseNextLevel(this);
|
||||
if (ZombieGameProps.ChangeLevels)
|
||||
LevelPicker.ChooseNextLevel(this);
|
||||
} else if (Status == ZombieGameStatus.SingleRound) {
|
||||
DoRound();
|
||||
ResetState(); return;
|
||||
@ -61,7 +62,8 @@ namespace MCGalaxy.Games {
|
||||
ResetState(); return;
|
||||
} else {
|
||||
DoRound();
|
||||
if (ChangeLevels) LevelPicker.ChooseNextLevel(this);
|
||||
if (ZombieGameProps.ChangeLevels)
|
||||
LevelPicker.ChooseNextLevel(this);
|
||||
}
|
||||
} else if (Status == ZombieGameStatus.LastRound) {
|
||||
ResetState(); return;
|
||||
@ -149,11 +151,11 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
|
||||
void DoCoreGame(Random random) {
|
||||
Player[] alive = null;
|
||||
Player[] alive = Alive.Items;
|
||||
string lastTimespan = null;
|
||||
int lastTime = -1;
|
||||
|
||||
while ((alive = Alive.Items).Length > 0 && Running) {
|
||||
while (alive.Length > 0 && Running) {
|
||||
Player[] infected = Infected.Items;
|
||||
// Do round end.
|
||||
int seconds = (int)(RoundEnd - DateTime.UtcNow).TotalSeconds;
|
||||
@ -171,16 +173,17 @@ namespace MCGalaxy.Games {
|
||||
lastTimespan = timespan;
|
||||
}
|
||||
|
||||
int dist = ZombieGameProps.HitboxPrecision;
|
||||
foreach (Player pKiller in infected) {
|
||||
pKiller.Game.Infected = true;
|
||||
UpdatePlayerColor(pKiller, InfectCol);
|
||||
bool aliveChanged = false;
|
||||
|
||||
foreach (Player pAlive in alive) {
|
||||
UpdatePlayerColor(pAlive, pAlive.color);
|
||||
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|
||||
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|
||||
|| Math.Abs(pAlive.pos[2] - pKiller.pos[2]) > HitboxPrecision)
|
||||
continue;
|
||||
int dx = Math.Abs(pAlive.pos[0] - pKiller.pos[0]);
|
||||
int dy = Math.Abs(pAlive.pos[1] - pKiller.pos[1]);
|
||||
int dz = Math.Abs(pAlive.pos[2] - pKiller.pos[2]);
|
||||
if (dx > dist || dy > dist || dz > dist) continue;
|
||||
|
||||
if (!pAlive.Game.Infected && pKiller.Game.Infected && !pAlive.Game.Referee
|
||||
&& !pKiller.Game.Referee && pKiller != pAlive
|
||||
@ -189,7 +192,6 @@ namespace MCGalaxy.Games {
|
||||
{
|
||||
InfectPlayer(pAlive);
|
||||
pAlive.Game.LastInfecter = pKiller.name;
|
||||
aliveChanged = true;
|
||||
pAlive.Game.BlocksLeft = 25;
|
||||
|
||||
if (lastPlayerToInfect == pKiller.name) {
|
||||
@ -215,11 +217,12 @@ namespace MCGalaxy.Games {
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
}
|
||||
if (aliveChanged) alive = Alive.Items;
|
||||
alive = Alive.Items;
|
||||
}
|
||||
|
||||
CheckInvisibilityTime();
|
||||
Thread.Sleep(200);
|
||||
alive = Alive.Items;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,9 @@ namespace MCGalaxy.Games {
|
||||
public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
||||
byte rotX, byte rotY) {
|
||||
if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
||||
if (!p.Game.Referee && noRespawn) {
|
||||
if (Math.Abs(p.pos[0] - x) >= MaxMoveDistance || Math.Abs(p.pos[2] - z) >= MaxMoveDistance) {
|
||||
if (!p.Game.Referee && ZombieGameProps.NoRespawn) {
|
||||
int dx = Math.Abs(p.pos[0] - x), dz = Math.Abs(p.pos[2] - z);
|
||||
if (dx >= ZombieGameProps.MaxMoveDistance || dz >= ZombieGameProps.MaxMoveDistance) {
|
||||
p.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]);
|
||||
return true;
|
||||
}
|
||||
@ -107,7 +108,7 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
|
||||
public override void PlayerJoinedServer(Player p) {
|
||||
if (!Running || ZombieGame.SetMainLevel) return;
|
||||
if (!Running || ZombieGameProps.SetMainLevel) return;
|
||||
Player.Message(p, "Zombie Survival is running! Type %T/g " + CurLevelName + " %Sto join.");
|
||||
}
|
||||
|
||||
@ -181,7 +182,7 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
|
||||
public override void OnHeartbeat(ref string name) {
|
||||
if (!Running || !IncludeMapInHeartbeat || CurLevelName == null) return;
|
||||
if (!Running || !ZombieGameProps.IncludeMapInHeartbeat || CurLevelName == null) return;
|
||||
name += " (" + CurLevelName + ")";
|
||||
}
|
||||
|
||||
@ -200,8 +201,8 @@ namespace MCGalaxy.Games {
|
||||
group = "&2Referees";
|
||||
} else if (p.Game.Infected) {
|
||||
group = "&cZombies";
|
||||
if (ZombieGame.ZombieName != "" && !dst.Game.Aka) {
|
||||
name = "&c" + ZombieGame.ZombieName;
|
||||
if (ZombieGameProps.ZombieName != "" && !dst.Game.Aka) {
|
||||
name = "&c" + ZombieGameProps.ZombieName;
|
||||
} else {
|
||||
name = "&c" + p.truename;
|
||||
}
|
||||
|
@ -44,14 +44,6 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> The maximum number of rounds that can be played before the game ends. </summary>
|
||||
public int MaxRounds = 0;
|
||||
|
||||
/// <summary> How precise collision detection is between alive and dead players. (Where 1 block = 32 units) </summary>
|
||||
[ConfigInt("zombie-hitbox-precision", "Zombie", null, 32)]
|
||||
public static int HitboxPrecision = 32;
|
||||
|
||||
/// <summary> The maximum distance a player is allowed to move between movement packets. </summary>
|
||||
[ConfigInt("zombie-maxmove-distance", "Zombie", null, 70)]
|
||||
public static int MaxMoveDistance = 70;
|
||||
|
||||
/// <summary> Current round status of the game. </summary>
|
||||
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
||||
|
||||
@ -88,6 +80,29 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> Name of the level queued to be used for the next round. </summary>
|
||||
public string QueuedLevel;
|
||||
|
||||
List<string> messages = new List<string>();
|
||||
|
||||
internal string lastLevel1 = "", lastLevel2 = "";
|
||||
internal int Level1Vote = 0, Level2Vote = 0, Level3Vote = 0;
|
||||
|
||||
string lastPlayerToInfect = "";
|
||||
int infectCombo = 0;
|
||||
public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>();
|
||||
|
||||
/// <summary> List of players who are in the lottery. </summary>
|
||||
public VolatileArray<string> Lottery = new VolatileArray<string>(false);
|
||||
}
|
||||
|
||||
public static class ZombieGameProps {
|
||||
|
||||
/// <summary> How precise collision detection is between alive and dead players. (Where 1 block = 32 units) </summary>
|
||||
[ConfigInt("zombie-hitbox-precision", "Zombie", null, 32)]
|
||||
public static int HitboxPrecision = 32;
|
||||
|
||||
/// <summary> The maximum distance a player is allowed to move between movement packets. </summary>
|
||||
[ConfigInt("zombie-maxmove-distance", "Zombie", null, 70)]
|
||||
public static int MaxMoveDistance = 70;
|
||||
|
||||
/// <summary> Whether the server's main level should be set to the current level at the end of each round. </summary>
|
||||
[ConfigBool("zombie-survival-only-server", "Zombie", null, false)]
|
||||
public static bool SetMainLevel;
|
||||
@ -107,13 +122,11 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> Whether the current level name should be shown in the heartbeats sent. </summary>
|
||||
[ConfigBool("zombie-map-inheartbeat", "Zombie", null, false)]
|
||||
public static bool IncludeMapInHeartbeat = false;
|
||||
|
||||
List<string> messages = new List<string>();
|
||||
|
||||
[ConfigBool("no-respawning-during-zombie", "Zombie", null, true)]
|
||||
public static bool noRespawn = true;
|
||||
public static bool NoRespawn = true;
|
||||
[ConfigBool("no-pillaring-during-zombie", "Zombie", null, true)]
|
||||
public static bool noPillaring = true;
|
||||
public static bool NoPillaring = true;
|
||||
[ConfigString("zombie-name-while-infected", "Zombie", null, "", true)]
|
||||
public static string ZombieName = "";
|
||||
[ConfigString("zombie-model-while-infected", "Zombie", null, "zombie")]
|
||||
@ -128,10 +141,7 @@ namespace MCGalaxy.Games {
|
||||
[ConfigInt("zombie-zinvisibility-potions", "Zombie", null, 4, 1)]
|
||||
public static int ZombieInvisibilityPotions = 4;
|
||||
[ConfigBool("enable-changing-levels", "Zombie", null, true)]
|
||||
public static bool ChangeLevels = true;
|
||||
[ConfigBool("zombie-awards", "Zombie", null, false)]
|
||||
public static bool UseAwards = false;
|
||||
|
||||
public static bool ChangeLevels = true;
|
||||
|
||||
[ConfigString("revive-notime-msg", "Revive", null,
|
||||
"It's too late. The humans do not have enough time left to make more revive potions.")]
|
||||
@ -165,8 +175,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
[ConfigString("revive-failure", "Revive", null, "tried using a revive potion. &cIt was not very effective..")]
|
||||
public static string ReviveFailureMessage = "tried using a revive potion. &cIt was not very effective..";
|
||||
|
||||
|
||||
|
||||
/// <summary> List of levels that are randomly picked for zombie survival.
|
||||
/// If this left blank, then all level files are picked from instead. </summary>
|
||||
[ConfigStringList("zombie-levels-list", "Zombie", null)]
|
||||
@ -175,15 +184,5 @@ namespace MCGalaxy.Games {
|
||||
/// <summary> List of levels that are never picked for zombie survival. </summary>
|
||||
[ConfigStringList("zombie-ignores-list", "Zombie", null)]
|
||||
public static List<string> IgnoredLevelList = new List<string>();
|
||||
|
||||
internal string lastLevel1 = "", lastLevel2 = "";
|
||||
internal int Level1Vote = 0, Level2Vote = 0, Level3Vote = 0;
|
||||
|
||||
string lastPlayerToInfect = "";
|
||||
int infectCombo = 0;
|
||||
public Dictionary<string, BountyData> Bounties = new Dictionary<string, BountyData>();
|
||||
|
||||
/// <summary> List of players who are in the lottery. </summary>
|
||||
public VolatileArray<string> Lottery = new VolatileArray<string>(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace MCGalaxy.Games {
|
||||
PlayerJoinedLevel(p, p.level, p.level);
|
||||
}
|
||||
|
||||
if (ZombieGame.SetMainLevel)
|
||||
if (ZombieGameProps.SetMainLevel)
|
||||
Server.mainLevel = CurLevel;
|
||||
return true;
|
||||
}
|
||||
@ -141,7 +141,7 @@ namespace MCGalaxy.Games {
|
||||
QueuedLevel = null;
|
||||
CmdLoad.LoadLevel(null, next);
|
||||
CurLevel = LevelInfo.Find(next);
|
||||
if (ZombieGame.SetMainLevel)
|
||||
if (ZombieGameProps.SetMainLevel)
|
||||
Server.mainLevel = CurLevel;
|
||||
|
||||
online = PlayerInfo.Online.Items;
|
||||
@ -243,9 +243,13 @@ namespace MCGalaxy.Games {
|
||||
|
||||
public bool IsZombieMap(string name) {
|
||||
if (!Running) return false;
|
||||
if (IgnorePersonalWorlds && name.IndexOf('+') >= 0) return false;
|
||||
if (IgnoredLevelList.CaselessContains(name)) return false;
|
||||
return LevelList.Count == 0 ? true : LevelList.CaselessContains(name);
|
||||
if (ZombieGameProps.IgnorePersonalWorlds && name.IndexOf('+') >= 0)
|
||||
return false;
|
||||
if (ZombieGameProps.IgnoredLevelList.CaselessContains(name))
|
||||
return false;
|
||||
|
||||
return ZombieGameProps.LevelList.Count == 0 ?
|
||||
true : ZombieGameProps.LevelList.CaselessContains(name);
|
||||
}
|
||||
|
||||
#region Database
|
||||
|
@ -233,7 +233,7 @@ namespace MCGalaxy {
|
||||
[ConfigString("Authors", "Game", null, "", true)]
|
||||
public string Authors = "";
|
||||
[ConfigBool("Pillaring", "Game", null, false)]
|
||||
public bool Pillaring = !ZombieGame.noPillaring;
|
||||
public bool Pillaring = !ZombieGameProps.NoPillaring;
|
||||
|
||||
[ConfigEnum("BuildType", "Game", null, BuildType.Normal, typeof(BuildType))]
|
||||
public BuildType BuildType = BuildType.Normal;
|
||||
|
@ -120,7 +120,7 @@ namespace MCGalaxy {
|
||||
/// saved to the BlockDB and .lvl files. </summary>
|
||||
public bool ShouldSaveChanges() {
|
||||
if (!saveLevel) return false;
|
||||
if (Server.zombie.Running && !ZombieGame.SaveLevelBlockchanges &&
|
||||
if (Server.zombie.Running && !ZombieGameProps.SaveLevelBlockchanges &&
|
||||
(name.CaselessEq(Server.zombie.CurLevelName)
|
||||
|| name.CaselessEq(Server.zombie.LastLevelName))) return false;
|
||||
if (Server.lava.active && Server.lava.HasMap(name)) return false;
|
||||
|
@ -86,8 +86,8 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
string name = p.truename, skinName = p.skinName;
|
||||
if (ZombieGame.ZombieName != "" && !dst.Game.Aka) {
|
||||
name = ZombieGame.ZombieName; skinName = name;
|
||||
if (ZombieGameProps.ZombieName != "" && !dst.Game.Aka) {
|
||||
name = ZombieGameProps.ZombieName; skinName = name;
|
||||
}
|
||||
|
||||
if (dst.hasExtList) {
|
||||
@ -97,7 +97,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
if (dst.hasChangeModel && id != 0xFF)
|
||||
dst.SendChangeModel(id, ZombieGame.ZombieModel);
|
||||
dst.SendChangeModel(id, ZombieGameProps.ZombieModel);
|
||||
}
|
||||
|
||||
/// <summary> Spawns this player to all other players, and spawns all others players to this player. </summary>
|
||||
|
@ -183,7 +183,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
void InitZombieSurvival() {
|
||||
if (!ZombieGame.StartImmediately) return;
|
||||
if (!ZombieGameProps.StartImmediately) return;
|
||||
try {
|
||||
Level oldMain = Server.mainLevel;
|
||||
Server.zombie.Start(ZombieGameStatus.InfiniteRounds, null, 0);
|
||||
|
@ -55,7 +55,7 @@ namespace MCGalaxy {
|
||||
|
||||
internal static ConfigElement[] serverConfig, levelConfig;
|
||||
public void Start() {
|
||||
serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGame));
|
||||
serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGameProps));
|
||||
levelConfig = ConfigElement.GetAll(typeof(Level));
|
||||
|
||||
#pragma warning disable 0618
|
||||
|
Loading…
x
Reference in New Issue
Block a user