Fix chat over heads, thanks Inanzen for the tip months ago!

This commit is contained in:
Zack Piispanen 2013-10-04 16:11:36 -04:00
parent f55eaa3caf
commit 0ed25ebbfe
2 changed files with 7 additions and 4 deletions

View file

@ -171,7 +171,7 @@ namespace TShockAPI
"Changes ingame chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message"
)] public string ChatFormat = "{1}{2}{3}: {4}";
[Description("Change the chat format when using chat above heads. This begins with a player name wrapped in brackets, as per Terraria's formatting. Same formatting as ChatFormat.")] public string ChatAboveHeadsFormat = "{4}";
[Description("Change the player name when using chat above heads. This begins with a player name wrapped in brackets, as per Terraria's formatting. Same formatting as ChatFormat(minus the text).")] public string ChatAboveHeadsFormat = "{2}";
[Description("Force the world time to be normal, day, or night.")] public string ForceTime = "normal";

View file

@ -966,9 +966,12 @@ namespace TShockAPI
}
else
{
Utils.Broadcast(args.Who,
String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
args.Text), tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
string name = Main.player[args.Who].name;
Main.player[args.Who].name = String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix);
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, Main.player[args.Who].name, args.Who, 0, 0, 0, 0);
Main.player[args.Who].name = name;
Utils.Broadcast(args.Who, args.Text, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, name, args.Who, 0, 0, 0, 0);
args.Handled = true;
}
}