mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 07:11:04 -04:00
Use Server.zombie.Running instead of ZombieModeOn, also fix joining a zombie level (not from transferring from the previous level) did not show a join messsage.
This commit is contained in:
parent
daa003db1e
commit
c253a84bf7
@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn || Server.lava.active; } }
|
public override bool Enabled { get { return Server.zombie.Running || Server.lava.active; } }
|
||||||
static char[] trimChars = {' '};
|
static char[] trimChars = {' '};
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn || Server.lava.active; } }
|
public override bool Enabled { get { return Server.zombie.Running || Server.lava.active; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (p == null) { MessageInGameOnly(p); return; }
|
if (p == null) { MessageInGameOnly(p); return; }
|
||||||
@ -49,7 +49,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn || Server.lava.active; } }
|
public override bool Enabled { get { return Server.zombie.Running || Server.lava.active; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (p == null) { MessageInGameOnly(p); return; }
|
if (p == null) { MessageInGameOnly(p); return; }
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdAlive() { }
|
public CmdAlive() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdBounties() { }
|
public CmdBounties() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -26,7 +26,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
string[] args = message.Split(' ');
|
string[] args = message.Split(' ');
|
||||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdDisInfect() { }
|
public CmdDisInfect() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands
|
|||||||
public override string type { get { return CommandTypes.Moderation; } }
|
public override string type { get { return CommandTypes.Moderation; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdEndRound() { }
|
public CmdEndRound() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Other; } }
|
public override string type { get { return CommandTypes.Other; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdFlipHead() { }
|
public CmdFlipHead() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Moderation; } }
|
public override string type { get { return CommandTypes.Moderation; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdHuman() { }
|
public CmdHuman() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdInfect() { }
|
public CmdInfect() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdInfected() { }
|
public CmdInfected() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands
|
|||||||
public override string type { get { return CommandTypes.Games; } }
|
public override string type { get { return CommandTypes.Games; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdQueue() { }
|
public CmdQueue() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public override string type { get { return CommandTypes.Moderation; } }
|
public override string type { get { return CommandTypes.Moderation; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
public override bool Enabled { get { return Server.zombie.Running; } }
|
||||||
public CmdReferee() { }
|
public CmdReferee() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void HandleStart(Player p, string message, string[] args) {
|
static void HandleStart(Player p, string message, string[] args) {
|
||||||
if (Server.zombie.Status != ZombieGameStatus.NotStarted) {
|
if (Server.zombie.Running) {
|
||||||
Player.SendMessage(p, "There is already a Zombie Survival game currently in progress."); return;
|
Player.SendMessage(p, "There is already a Zombie Survival game currently in progress."); return;
|
||||||
}
|
}
|
||||||
if (args.Length == 2) {
|
if (args.Length == 2) {
|
||||||
@ -75,7 +75,7 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void HandleStop(Player p, string message, string[] args) {
|
static void HandleStop(Player p, string message, string[] args) {
|
||||||
if (Server.zombie.Status == ZombieGameStatus.NotStarted) {
|
if (!Server.zombie.Running) {
|
||||||
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
|
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
|
||||||
}
|
}
|
||||||
Player.GlobalMessage("The current game of Zombie Survival will end this round!");
|
Player.GlobalMessage("The current game of Zombie Survival will end this round!");
|
||||||
@ -83,7 +83,7 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void HandleForceStop(Player p, string message, string[] args) {
|
static void HandleForceStop(Player p, string message, string[] args) {
|
||||||
if (Server.zombie.Status == ZombieGameStatus.NotStarted) {
|
if (!Server.zombie.Running) {
|
||||||
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
|
Player.SendMessage(p, "There is no Zombie Survival game currently in progress."); return;
|
||||||
}
|
}
|
||||||
Server.s.Log("Zombie Survival ended forcefully by " + p.name);
|
Server.s.Log("Zombie Survival ended forcefully by " + p.name);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using MCGalaxy.Games;
|
using MCGalaxy.Games;
|
||||||
|
|
||||||
@ -31,7 +31,8 @@ namespace MCGalaxy.Commands {
|
|||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
string time = DateTime.Now.ToString("HH:mm:ss"); //DateTime.Now.ToString();
|
string time = DateTime.Now.ToString("HH:mm:ss"); //DateTime.Now.ToString();
|
||||||
Player.SendMessage(p, "Server time is " + time);
|
Player.SendMessage(p, "Server time is " + time);
|
||||||
if (Server.zombie.Status != ZombieGameStatus.NotStarted) {
|
if (!Server.zombie.Running) return;
|
||||||
|
|
||||||
int delta = (int)(Server.zombie.RoundEnd - DateTime.UtcNow).TotalSeconds;
|
int delta = (int)(Server.zombie.RoundEnd - DateTime.UtcNow).TotalSeconds;
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round ends.");
|
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round ends.");
|
||||||
@ -41,7 +42,6 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round starts.");
|
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round starts.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.SendMessage(p, "/time - Shows the server time.");
|
Player.SendMessage(p, "/time - Shows the server time.");
|
||||||
|
@ -113,6 +113,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (File.Exists("text/lockdown/map/" + message.ToLower())) {
|
if (File.Exists("text/lockdown/map/" + message.ToLower())) {
|
||||||
Player.SendMessage(p, "The level " + message + " is locked."); return false;
|
Player.SendMessage(p, "The level " + message + " is locked."); return false;
|
||||||
}
|
}
|
||||||
|
if (!Server.zombie.PlayerCanJoinLevel(p, lvl, p.level)) return false;
|
||||||
|
|
||||||
p.Loading = true;
|
p.Loading = true;
|
||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
@ -153,8 +154,8 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static void CheckGamesJoin(Player p, Level oldLvl) {
|
internal static void CheckGamesJoin(Player p, Level oldLvl) {
|
||||||
Server.lava.PlayerJoinedLevel(p, oldLvl);
|
Server.lava.PlayerJoinedLevel(p, p.level, oldLvl);
|
||||||
Server.zombie.PlayerJoinedLevel(p, oldLvl);
|
Server.zombie.PlayerJoinedLevel(p, p.level, oldLvl);
|
||||||
|
|
||||||
if (p.inTNTwarsMap) p.canBuild = true;
|
if (p.inTNTwarsMap) p.canBuild = true;
|
||||||
TntWarsGame game = TntWarsGame.Find(p.level);
|
TntWarsGame game = TntWarsGame.Find(p.level);
|
||||||
|
@ -175,7 +175,7 @@ namespace MCGalaxy.Commands
|
|||||||
Server.voteKickVotesNeeded = 0;
|
Server.voteKickVotesNeeded = 0;
|
||||||
|
|
||||||
//Zombie
|
//Zombie
|
||||||
Server.ZombieModeOn = false;
|
Server.zombie.ResetState();
|
||||||
Server.startZombieModeOnStartup = false;
|
Server.startZombieModeOnStartup = false;
|
||||||
Server.zombie.noRespawn = true;
|
Server.zombie.noRespawn = true;
|
||||||
Server.zombie.noPillaring = true;
|
Server.zombie.noPillaring = true;
|
||||||
|
@ -21,30 +21,43 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
public abstract class IGame {
|
public abstract class IGame {
|
||||||
|
|
||||||
|
/// <summary> Returns whether this game handed the player manually placing a block. </summary>
|
||||||
public virtual bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
|
public virtual bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
|
||||||
byte action, byte tile, byte b) {
|
byte action, byte tile, byte b) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns whether this game handled the player moving to a new position. </summary>
|
||||||
public virtual bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
public virtual bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
||||||
byte rotX, byte rotY) {
|
byte rotX, byte rotY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns whether this game handled the player sending a chat message. </summary>
|
||||||
public virtual bool HandlesChatMessage(Player p, string message) {
|
public virtual bool HandlesChatMessage(Player p, string message) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Raised when a player joins the server. </summary>
|
||||||
public virtual void PlayerJoinedServer(Player p) { }
|
public virtual void PlayerJoinedServer(Player p) { }
|
||||||
|
|
||||||
|
/// <summary> Raised when a player leaves the server. </summary>
|
||||||
public virtual void PlayerLeftServer(Player p) { }
|
public virtual void PlayerLeftServer(Player p) { }
|
||||||
|
|
||||||
|
/// <summary> Raised when a player joins this game. </summary>
|
||||||
public virtual void PlayerJoinedGame(Player p) { }
|
public virtual void PlayerJoinedGame(Player p) { }
|
||||||
|
|
||||||
|
/// <summary> Raised when a player leaves this game. </summary>
|
||||||
public virtual void PlayerLeftGame(Player p) { }
|
public virtual void PlayerLeftGame(Player p) { }
|
||||||
|
|
||||||
public virtual void PlayerJoinedLevel(Player p, Level oldLvl) { }
|
/// <summary> Raised when a player moves to a different map/level. </summary>
|
||||||
|
public virtual void PlayerJoinedLevel(Player p, Level lvl, Level oldLvl) { }
|
||||||
|
|
||||||
|
public virtual bool PlayerCanJoinLevel(Player p, Level lvl, Level oldLvl) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> Raised when a player's money amount changes. </summary>
|
||||||
public virtual void PlayerMoneyChanged(Player p) { }
|
public virtual void PlayerMoneyChanged(Player p) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ namespace MCGalaxy.Games {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerJoinedLevel(Player p, Level oldLevl) {
|
public override void PlayerJoinedLevel(Player p, Level lvl, Level oldLevl) {
|
||||||
if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == p.level) {
|
if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == lvl) {
|
||||||
if (Server.lava.roundActive) {
|
if (Server.lava.roundActive) {
|
||||||
Server.lava.AnnounceRoundInfo(p);
|
Server.lava.AnnounceRoundInfo(p);
|
||||||
Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p);
|
Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p);
|
||||||
|
@ -39,7 +39,7 @@ namespace MCGalaxy.Games {
|
|||||||
RoundInProgress = false;
|
RoundInProgress = false;
|
||||||
RoundsDone++;
|
RoundsDone++;
|
||||||
|
|
||||||
if (Status == ZombieGameStatus.NotStarted) {
|
if (!Running) {
|
||||||
return;
|
return;
|
||||||
} else if (Status == ZombieGameStatus.InfiniteRounds) {
|
} else if (Status == ZombieGameStatus.InfiniteRounds) {
|
||||||
DoRound();
|
DoRound();
|
||||||
@ -61,7 +61,7 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoRound() {
|
void DoRound() {
|
||||||
if (Status == ZombieGameStatus.NotStarted) return;
|
if (!Running) return;
|
||||||
List<Player> players = DoRoundCountdown();
|
List<Player> players = DoRoundCountdown();
|
||||||
RoundInProgress = true;
|
RoundInProgress = true;
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
@ -91,7 +91,7 @@ namespace MCGalaxy.Games {
|
|||||||
UpdateAllPlayerStatus();
|
UpdateAllPlayerStatus();
|
||||||
DoCoreGame(random);
|
DoCoreGame(random);
|
||||||
|
|
||||||
if (Status == ZombieGameStatus.NotStarted) {
|
if (!Running) {
|
||||||
Status = ZombieGameStatus.LastRound; return;
|
Status = ZombieGameStatus.LastRound; return;
|
||||||
} else {
|
} else {
|
||||||
HandOutRewards();
|
HandOutRewards();
|
||||||
@ -112,19 +112,19 @@ namespace MCGalaxy.Games {
|
|||||||
while (true) {
|
while (true) {
|
||||||
RoundStart = DateTime.UtcNow.AddSeconds(30);
|
RoundStart = DateTime.UtcNow.AddSeconds(30);
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 30...");
|
CurLevel.ChatLevel("%4Round Start:%f 30...");
|
||||||
Thread.Sleep(20000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(20000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 10...");
|
CurLevel.ChatLevel("%4Round Start:%f 10...");
|
||||||
Thread.Sleep(10000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(10000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 5...");
|
CurLevel.ChatLevel("%4Round Start:%f 5...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 4...");
|
CurLevel.ChatLevel("%4Round Start:%f 4...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 3...");
|
CurLevel.ChatLevel("%4Round Start:%f 3...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 2...");
|
CurLevel.ChatLevel("%4Round Start:%f 2...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Running) return null;
|
||||||
CurLevel.ChatLevel("%4Round Start:%f 1...");
|
CurLevel.ChatLevel("%4Round Start:%f 1...");
|
||||||
Thread.Sleep(1000); if (!Server.ZombieModeOn) return null;
|
Thread.Sleep(1000); if (!Running) return null;
|
||||||
int nonRefPlayers = 0;
|
int nonRefPlayers = 0;
|
||||||
List<Player> players = new List<Player>();
|
List<Player> players = new List<Player>();
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EndRound(object sender, ElapsedEventArgs e) {
|
void EndRound(object sender, ElapsedEventArgs e) {
|
||||||
if (Status == ZombieGameStatus.NotStarted) return;
|
if (!Running) return;
|
||||||
CurLevel.ChatLevel("%4Round End:%f 5"); Thread.Sleep(1000);
|
CurLevel.ChatLevel("%4Round End:%f 5"); Thread.Sleep(1000);
|
||||||
CurLevel.ChatLevel("%4Round End:%f 4"); Thread.Sleep(1000);
|
CurLevel.ChatLevel("%4Round End:%f 4"); Thread.Sleep(1000);
|
||||||
CurLevel.ChatLevel("%4Round End:%f 3"); Thread.Sleep(1000);
|
CurLevel.ChatLevel("%4Round End:%f 3"); Thread.Sleep(1000);
|
||||||
@ -256,7 +256,7 @@ namespace MCGalaxy.Games {
|
|||||||
RoundStart = DateTime.MinValue;
|
RoundStart = DateTime.MinValue;
|
||||||
RoundEnd = DateTime.MinValue;
|
RoundEnd = DateTime.MinValue;
|
||||||
Bounties.Clear();
|
Bounties.Clear();
|
||||||
if (Status == ZombieGameStatus.NotStarted) return;
|
if (!Running) return;
|
||||||
|
|
||||||
Player[] alive = Alive.Items;
|
Player[] alive = Alive.Items;
|
||||||
CurLevel.ChatLevel(Colors.lime + "The game has ended!");
|
CurLevel.ChatLevel(Colors.lime + "The game has ended!");
|
||||||
@ -364,9 +364,7 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
Level1Vote = 0; Level2Vote = 0; Level3Vote = 0;
|
Level1Vote = 0; Level2Vote = 0; Level3Vote = 0;
|
||||||
lastLevel1 = selectedLevel1; lastLevel2 = selectedLevel2;
|
lastLevel1 = selectedLevel1; lastLevel2 = selectedLevel2;
|
||||||
|
if (!Running || Status == ZombieGameStatus.LastRound) return;
|
||||||
if (Status == ZombieGameStatus.NotStarted || Status == ZombieGameStatus.LastRound)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (initialChangeLevel) {
|
if (initialChangeLevel) {
|
||||||
Server.votingforlevel = true;
|
Server.votingforlevel = true;
|
||||||
@ -379,8 +377,7 @@ namespace MCGalaxy.Games {
|
|||||||
Server.votingforlevel = false;
|
Server.votingforlevel = false;
|
||||||
} else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; }
|
} else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; }
|
||||||
|
|
||||||
if (Status == ZombieGameStatus.NotStarted || Status == ZombieGameStatus.LastRound)
|
if (!Running || Status == ZombieGameStatus.LastRound) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (Level1Vote >= Level2Vote) {
|
if (Level1Vote >= Level2Vote) {
|
||||||
if (Level3Vote > Level1Vote && Level3Vote > Level2Vote) {
|
if (Level3Vote > Level1Vote && Level3Vote > Level2Vote) {
|
||||||
|
@ -24,8 +24,7 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
public override bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
|
public override bool HandlesManualChange(Player p, ushort x, ushort y, ushort z,
|
||||||
byte action, byte tile, byte b) {
|
byte action, byte tile, byte b) {
|
||||||
if (Status == ZombieGameStatus.NotStarted
|
if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
||||||
|| (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
|
||||||
if (CurLevel.BuildType == BuildType.NoModify) {
|
if (CurLevel.BuildType == BuildType.NoModify) {
|
||||||
p.RevertBlock(x, y, z); return true;
|
p.RevertBlock(x, y, z); return true;
|
||||||
} else if (CurLevel.BuildType == BuildType.ModifyOnly
|
} else if (CurLevel.BuildType == BuildType.ModifyOnly
|
||||||
@ -66,8 +65,7 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
public override bool HandlesMovement(Player p, ushort x, ushort y, ushort z,
|
||||||
byte rotX, byte rotY) {
|
byte rotX, byte rotY) {
|
||||||
if (Status == ZombieGameStatus.NotStarted
|
if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
||||||
|| (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
|
||||||
if (!p.referee && noRespawn) {
|
if (!p.referee && noRespawn) {
|
||||||
if (p.pos[0] >= x + 70 || p.pos[0] <= x - 70 ) {
|
if (p.pos[0] >= x + 70 || p.pos[0] <= x - 70 ) {
|
||||||
p.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]);
|
p.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]);
|
||||||
@ -82,8 +80,7 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandlesChatMessage(Player p, string message) {
|
public override bool HandlesChatMessage(Player p, string message) {
|
||||||
if (Status == ZombieGameStatus.NotStarted
|
if (!Running || (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
||||||
|| (p.level == null || !p.level.name.CaselessEq(CurLevelName))) return false;
|
|
||||||
if (Server.votingforlevel && HandleVote(p, message)) return true;
|
if (Server.votingforlevel && HandleVote(p, message)) return true;
|
||||||
|
|
||||||
if (message[0] == '~' && message.Length > 1) {
|
if (message[0] == '~' && message.Length > 1) {
|
||||||
@ -119,23 +116,23 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerJoinedServer(Player p) {
|
public override void PlayerJoinedServer(Player p) {
|
||||||
if (Status == ZombieGameStatus.NotStarted || Server.ZombieOnlyServer) return;
|
if (!Running || Server.ZombieOnlyServer) return;
|
||||||
Player.SendMessage(p, "A Zombie Survival game is running! " +
|
Player.SendMessage(p, "A Zombie Survival game is running! " +
|
||||||
"Type %T/g " + CurLevelName + " %Sto join.");
|
"Type %T/g " + CurLevelName + " %Sto join.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerJoinedLevel(Player p, Level oldLvl) {
|
public override void PlayerJoinedLevel(Player p, Level lvl, Level oldLvl) {
|
||||||
p.SendCpeMessage(CpeMessageType.BottomRight2, "");
|
p.SendCpeMessage(CpeMessageType.BottomRight2, "");
|
||||||
p.SendCpeMessage(CpeMessageType.BottomRight1, "");
|
p.SendCpeMessage(CpeMessageType.BottomRight1, "");
|
||||||
if (RoundInProgress && p.level.name.CaselessEq(CurLevelName)) {
|
if (RoundInProgress && lvl.name.CaselessEq(CurLevelName)) {
|
||||||
if (Status != ZombieGameStatus.NotStarted && p != null) {
|
if (Running && p != null) {
|
||||||
p.SendMessage("You joined in the middle of a round. &cYou are now infected!");
|
p.SendMessage("You joined in the middle of a round. &cYou are now infected!");
|
||||||
p.blockCount = 50;
|
p.blockCount = 50;
|
||||||
InfectPlayer(p);
|
InfectPlayer(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.level.name.CaselessEq(CurLevelName)) {
|
if (lvl.name.CaselessEq(CurLevelName)) {
|
||||||
double startLeft = (RoundStart - DateTime.UtcNow).TotalSeconds;
|
double startLeft = (RoundStart - DateTime.UtcNow).TotalSeconds;
|
||||||
if (startLeft >= 0)
|
if (startLeft >= 0)
|
||||||
p.SendMessage("%a" + (int)startLeft + " %Sseconds left until the round starts. %aRun!");
|
p.SendMessage("%a" + (int)startLeft + " %Sseconds left until the round starts. %aRun!");
|
||||||
@ -164,8 +161,12 @@ namespace MCGalaxy.Games {
|
|||||||
UpdateAllPlayerStatus();
|
UpdateAllPlayerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool PlayerCanJoinLevel(Player p, Level lvl, Level oldLvl) {
|
||||||
|
return base.PlayerCanJoinLevel(p, lvl, oldLvl);
|
||||||
|
}
|
||||||
|
|
||||||
public override void PlayerMoneyChanged(Player p) {
|
public override void PlayerMoneyChanged(Player p) {
|
||||||
if (Status == ZombieGameStatus.NotStarted || !p.level.name.CaselessEq(CurLevelName)) return;
|
if (!Running || !p.level.name.CaselessEq(CurLevelName)) return;
|
||||||
string moneyMsg = "&a" + p.money + " %S" + Server.moneys;
|
string moneyMsg = "&a" + p.money + " %S" + Server.moneys;
|
||||||
string stateMsg = " and you are " + (p.infected ? "&cdead" : "&aalive");
|
string stateMsg = " and you are " + (p.infected ? "&cdead" : "&aalive");
|
||||||
p.SendCpeMessage(CpeMessageType.Status3, moneyMsg + stateMsg);
|
p.SendCpeMessage(CpeMessageType.Status3, moneyMsg + stateMsg);
|
||||||
|
@ -53,6 +53,9 @@ namespace MCGalaxy.Games {
|
|||||||
/// <summary> Current round status of the game. </summary>
|
/// <summary> Current round status of the game. </summary>
|
||||||
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
public ZombieGameStatus Status = ZombieGameStatus.NotStarted;
|
||||||
|
|
||||||
|
/// <summary> Gets whether zombie survival is currently running. </summary>
|
||||||
|
public bool Running { get { return Status != ZombieGameStatus.NotStarted; } }
|
||||||
|
|
||||||
/// <summary> Whether a round is currently in progress. </summary>
|
/// <summary> Whether a round is currently in progress. </summary>
|
||||||
public bool RoundInProgress = false;
|
public bool RoundInProgress = false;
|
||||||
|
|
||||||
@ -108,7 +111,6 @@ namespace MCGalaxy.Games {
|
|||||||
public void Start(ZombieGameStatus status, int amount) {
|
public void Start(ZombieGameStatus status, int amount) {
|
||||||
if (UseLevelList && LevelList == null)
|
if (UseLevelList && LevelList == null)
|
||||||
ChangeLevels = false;
|
ChangeLevels = false;
|
||||||
Server.ZombieModeOn = true;
|
|
||||||
Status = status;
|
Status = status;
|
||||||
RoundInProgress = false;
|
RoundInProgress = false;
|
||||||
initialChangeLevel = false;
|
initialChangeLevel = false;
|
||||||
@ -122,7 +124,7 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
/// <summary> If there are no infected players left, randomly selected one of the alive players to continue the infection. </summary>
|
/// <summary> If there are no infected players left, randomly selected one of the alive players to continue the infection. </summary>
|
||||||
public void AssignFirstZombie() {
|
public void AssignFirstZombie() {
|
||||||
if (Status == ZombieGameStatus.NotStarted || !RoundInProgress || Infected.Count > 0) return;
|
if (!Running || !RoundInProgress || Infected.Count > 0) return;
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Player[] alive = Alive.Items;
|
Player[] alive = Alive.Items;
|
||||||
if (alive.Length == 0) return;
|
if (alive.Length == 0) return;
|
||||||
@ -202,7 +204,6 @@ namespace MCGalaxy.Games {
|
|||||||
Status = ZombieGameStatus.NotStarted;
|
Status = ZombieGameStatus.NotStarted;
|
||||||
MaxRounds = 0;
|
MaxRounds = 0;
|
||||||
initialChangeLevel = false;
|
initialChangeLevel = false;
|
||||||
Server.ZombieModeOn = false;
|
|
||||||
RoundInProgress = false;
|
RoundInProgress = false;
|
||||||
RoundStart = DateTime.MinValue;
|
RoundStart = DateTime.MinValue;
|
||||||
RoundEnd = DateTime.MinValue;
|
RoundEnd = DateTime.MinValue;
|
||||||
|
@ -284,7 +284,7 @@ namespace MCGalaxy
|
|||||||
public static event OnLevelLoaded LevelLoaded;
|
public static event OnLevelLoaded LevelLoaded;
|
||||||
|
|
||||||
public bool ShouldSaveLevelFile() {
|
public bool ShouldSaveLevelFile() {
|
||||||
if (Server.ZombieModeOn &&
|
if (Server.zombie.Running &&
|
||||||
(name.CaselessEq(Server.zombie.CurLevelName)
|
(name.CaselessEq(Server.zombie.CurLevelName)
|
||||||
|| name.CaselessEq(Server.zombie.LastLevelName))) return false;
|
|| name.CaselessEq(Server.zombie.LastLevelName))) return false;
|
||||||
if (Server.lava.active && Server.lava.HasMap(name)) return false;
|
if (Server.lava.active && Server.lava.HasMap(name)) return false;
|
||||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy {
|
|||||||
RevertBlock(x, y, z); return;
|
RevertBlock(x, y, z); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Server.ZombieModeOn && Server.zombie.HandlesManualChange(this, x, y, z, action, type, b))
|
if (Server.zombie.Running && Server.zombie.HandlesManualChange(this, x, y, z, action, type, b))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( Server.lava.active && Server.lava.HasPlayer(this) && Server.lava.IsPlayerDead(this) ) {
|
if ( Server.lava.active && Server.lava.HasPlayer(this) && Server.lava.IsPlayerDead(this) ) {
|
||||||
@ -905,7 +905,7 @@ return;
|
|||||||
|
|
||||||
if (Server.Countdown.HandlesMovement(this, x, y, z, rotx, roty))
|
if (Server.Countdown.HandlesMovement(this, x, y, z, rotx, roty))
|
||||||
return;
|
return;
|
||||||
if (Server.ZombieModeOn && Server.zombie.HandlesMovement(this, x, y, z, rotx, roty))
|
if (Server.zombie.Running && Server.zombie.HandlesMovement(this, x, y, z, rotx, roty))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (OnMove != null) OnMove(this, x, y, z);
|
if (OnMove != null) OnMove(this, x, y, z);
|
||||||
|
@ -510,7 +510,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
internal static void SpawnEntity(Player p, Player dst, byte id, ushort x, ushort y, ushort z,
|
internal static void SpawnEntity(Player p, Player dst, byte id, ushort x, ushort y, ushort z,
|
||||||
byte rotx, byte roty, string possession = "") {
|
byte rotx, byte roty, string possession = "") {
|
||||||
if (!Server.ZombieModeOn || !p.infected) {
|
if (!Server.zombie.Running || !p.infected) {
|
||||||
dst.SendSpawn(id, p.color + p.name + possession, x, y, z, rotx, roty); return;
|
dst.SendSpawn(id, p.color + p.name + possession, x, y, z, rotx, roty); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,7 +864,7 @@ Next: continue;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnMoneyChanged() {
|
public void OnMoneyChanged() {
|
||||||
if (Server.ZombieModeOn) Server.zombie.PlayerMoneyChanged(this);
|
if (Server.zombie.Running) Server.zombie.PlayerMoneyChanged(this);
|
||||||
if (Server.lava.active) Server.lava.PlayerMoneyChanged(this);
|
if (Server.lava.active) Server.lava.PlayerMoneyChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,6 @@ namespace MCGalaxy
|
|||||||
|
|
||||||
//Zombie
|
//Zombie
|
||||||
public static ZombieGame zombie;
|
public static ZombieGame zombie;
|
||||||
public static bool ZombieModeOn = false;
|
|
||||||
public static bool startZombieModeOnStartup = false;
|
public static bool startZombieModeOnStartup = false;
|
||||||
public static bool ZombieOnlyServer = true;
|
public static bool ZombieOnlyServer = true;
|
||||||
public static bool bufferblocks = true;
|
public static bool bufferblocks = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user