Don't prevent players from talking when voting for the next map in zombie survival, don't spam ingame/IRC with 'X joined Y' messages.

This commit is contained in:
UnknownShadow200 2016-03-27 12:40:01 +11:00
parent 8d8c1aafa8
commit c62ca5f2f3
5 changed files with 26 additions and 10 deletions

View File

@ -32,11 +32,11 @@ namespace MCGalaxy.Commands {
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.Status != ZombieGameStatus.NotStarted) {
int delta = (int)(DateTime.UtcNow - Server.zombie.RoundEnd).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.");
} else { } else {
delta = (int)(DateTime.UtcNow - Server.zombie.RoundStart).TotalSeconds; delta = (int)(Server.zombie.RoundStart - DateTime.UtcNow).TotalSeconds;
if (delta > 0) if (delta > 0)
Player.SendMessage(p, "&a" + delta + " %Sseconds until the round starts."); Player.SendMessage(p, "&a" + delta + " %Sseconds until the round starts.");
} }

View File

@ -131,7 +131,7 @@ namespace MCGalaxy.Commands {
p.Loading = false; p.Loading = false;
CheckGamesJoin(p, oldLevel); CheckGamesJoin(p, oldLevel);
if (!p.hidden) { if (!p.hidden && p.level.ShouldSaveLevelFile()) {
Player.SendChatFrom(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false); Player.SendChatFrom(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false);
Server.IRC.Say(p.color + p.DisplayName + " %rwent to &8" + lvl.name, false, true); Server.IRC.Say(p.color + p.DisplayName + " %rwent to &8" + lvl.name, false, true);
} }

View File

@ -358,8 +358,11 @@ namespace MCGalaxy.Games {
if (initialChangeLevel) { if (initialChangeLevel) {
Server.votingforlevel = true; Server.votingforlevel = true;
CurLevel.ChatLevel(" " + Colors.black + "Level Vote: %S" + selectedLevel1 + ", " + selectedLevel2 + Player[] players = PlayerInfo.Online.Items;
" or random " + "(" + Colors.lime + "1%S/" + Colors.red + "2%S/" + Colors.blue + "3%S)"); foreach (Player pl in players) {
if (pl.level != CurLevel) continue;
SendVoteMessage(pl, selectedLevel1, selectedLevel2);
}
System.Threading.Thread.Sleep(15000); System.Threading.Thread.Sleep(15000);
Server.votingforlevel = false; Server.votingforlevel = false;
} else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; } } else { Level1Vote = 1; Level2Vote = 0; Level3Vote = 0; }
@ -398,5 +401,17 @@ namespace MCGalaxy.Games {
maps.Add(fil.Name.Split('.')[0]); maps.Add(fil.Name.Split('.')[0]);
return maps; return maps;
} }
void SendVoteMessage(Player p, string lvl1, string lvl2) {
const string line1 = "&eVote for the next level! Type &a1&e, &c2&e or &93";
string line2 = "&eLevels: &a" + lvl1 + "&e, &c" + lvl2 + "&e, &9random";
if (p.HasCpeExt(CpeExt.MessageTypes)) {
p.SendCpeMessage(CpeMessageType.BottomRight2, line1, true);
p.SendCpeMessage(CpeMessageType.BottomRight1, line2, true);
} else {
p.SendMessage(line1, true);
p.SendMessage(line2, true);
}
}
} }
} }

View File

@ -108,10 +108,6 @@ namespace MCGalaxy.Games {
Player.CheckVote(message, p, "2", "two", ref Level2Vote) || Player.CheckVote(message, p, "2", "two", ref Level2Vote) ||
Player.CheckVote(message, p, "3", "three", ref Level3Vote)) Player.CheckVote(message, p, "3", "three", ref Level3Vote))
return true; return true;
if (!p.voice) {
p.SendMessage("Chat moderation is on while voting is on!"); return true;
}
return false; return false;
} }
@ -129,6 +125,8 @@ namespace MCGalaxy.Games {
} }
public override void PlayerJoinedLevel(Player p, Level oldLvl) { public override void PlayerJoinedLevel(Player p, Level oldLvl) {
p.SendCpeMessage(CpeMessageType.BottomRight2, "");
p.SendCpeMessage(CpeMessageType.BottomRight1, "");
if (RoundInProgress && p.level.name.CaselessEq(CurLevelName)) { if (RoundInProgress && p.level.name.CaselessEq(CurLevelName)) {
if (Status != ZombieGameStatus.NotStarted && p != null) { if (Status != ZombieGameStatus.NotStarted && 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!");
@ -151,6 +149,9 @@ namespace MCGalaxy.Games {
p.SendMessage("It was created by " + CurLevel.Authors); p.SendMessage("It was created by " + CurLevel.Authors);
p.SendCpeMessage(CpeMessageType.Status3, "%SYou have &a" + p.money + " %S" + Server.moneys); p.SendCpeMessage(CpeMessageType.Status3, "%SYou have &a" + p.money + " %S" + Server.moneys);
UpdatePlayerStatus(p); UpdatePlayerStatus(p);
if (Server.votingforlevel)
SendVoteMessage(p, lastLevel1, lastLevel2);
return; return;
} }

View File

@ -185,7 +185,7 @@ namespace MCGalaxy.Games {
pl.ratedMap = false; pl.ratedMap = false;
pl.pledgeSurvive = false; pl.pledgeSurvive = false;
if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) { if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) {
pl.SendMessage("Going to the next map!"); pl.SendMessage("Going to the next map - &a" + next);
Command.all.Find("goto").Use(pl, next); Command.all.Find("goto").Use(pl, next);
} }
} }