Do not hardcode 'zombie survival names' in tab list's code.

This commit is contained in:
UnknownShadow200 2016-05-10 11:28:04 +10:00
parent d53d02e9c5
commit 42c03d2b77
4 changed files with 28 additions and 13 deletions

View File

@ -68,5 +68,10 @@ namespace MCGalaxy.Games {
/// <summary> Adjusts the prefix (e.g. title) shown before the player's name in chat. </summary>
public virtual void AdjustPrefix(Player p, ref string prefix) { }
/// <summary> Gets the player's name shown in the tab list
/// (for clients that support a separate tab list) that are in this game. </summary>
public virtual void GetTabName(Player p, Player dst,
ref string name, ref string group) { }
}
}

View File

@ -199,5 +199,20 @@ namespace MCGalaxy.Games {
else if (winStreak == 3) prefix += "&6*"+ p.color;
else if (winStreak > 0) prefix += "&6" + winStreak + p.color;
}
public override void GetTabName(Player p, Player dst,
ref string name, ref string group) {
if (p.Game.Referee) {
group = "&2Referees";
} else if (p.Game.Infected) {
group = "&cZombies";
if (ZombieGame.ZombieName != "" && !dst.Game.Aka)
name = "&c" + ZombieGame.ZombieName;
else
name = "&c" + p.truename;
} else {
group = "&fHumans";
}
}
}
}

View File

@ -87,7 +87,7 @@ namespace MCGalaxy {
SendMessage("You have " + Awards.AwardAmount(name) + " awards.");
} catch {
}
Player[] players = PlayerInfo.Online.Items;
SendMessage("You have modified &a" + overallBlocks + " %Sblocks!");
string prefix = players.Length == 1 ? "There is" : "There are";

View File

@ -48,24 +48,19 @@ namespace MCGalaxy {
if (!dst.hasExtList) return;
byte grpPerm = (byte)(offset - p.group.Permission);
if (!Server.TablistRankSorted) grpPerm = 0;
string col = Entities.GetSupportedCol(dst, p.color);
if (p.IsAfk) {
string col = Entities.GetSupportedCol(dst, p.color);
dst.SendExtAddPlayerName(id, p.truename, col + p.truename, "&7AFK", grpPerm);
return;
}
if (!Server.zombie.Running || !p.Game.Infected) {
string col = Entities.GetSupportedCol(dst, p.color);
string group = p.Game.Referee ? "&2Referees" : "&fPlayers";
dst.SendExtAddPlayerName(id, p.truename, col + p.truename, group, grpPerm);
return;
}
string name = col + p.truename;
string group = "&fPlayers";
string name = p.truename;
if (ZombieGame.ZombieName != "" && !dst.Game.Aka)
name = ZombieGame.ZombieName;
dst.SendExtAddPlayerName(id, p.truename, Colors.red + name, "&cZombies", grpPerm);
IGame game = p.level.CurrentGame();
if (game != null)
game.GetTabName(p, dst, ref name, ref group);
dst.SendExtAddPlayerName(id, p.truename, name, group, grpPerm);
}
/// <summary> Adds the given bot to that player's tab list (if their client support it). </summary>