Seems like sending a long-winded copy-paste of the traitor greeting message to host when he's still in lobby causes an error: https://cdn.discordapp.com/attachments/386620407035330561/387295192946049025/unknown.png

This is mostly a bugfix
This commit is contained in:
Alex Noir
2017-12-05 00:20:36 +03:00
parent 94b2c4c9e7
commit 3b02f0c86a
@@ -14,15 +14,15 @@ namespace Barotrauma
Character = character; Character = character;
} }
public void Greet(GameServer server) public void Greet(GameServer server, string codeWords, string codeResponse)
{ {
//Greeting messages TODO: Move this to a function in Traitor class //Greeting messages TODO: Move this to a function in Traitor class
string greetingMessage = "You are the Traitor! Your secret task is to assassinate " + TargetCharacter.Name + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew " string greetingMessage = "You are the Traitor! Your secret task is to assassinate " + TargetCharacter.Name + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident."; + "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.";
string moreAgentsMessage = "It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. " string moreAgentsMessage = "It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. "
+ "Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything."; + "Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything.";
moreAgentsMessage += "\nThe code words are: " + server.TraitorManager.codeWords + "."; moreAgentsMessage += "\nThe code words are: " + codeWords + ".";
moreAgentsMessage += "\nThe code response is: " + server.TraitorManager.codeResponse + ".\n"; moreAgentsMessage += "\nThe code response is: " + codeResponse + ".\n";
if (server.Character != Character) if (server.Character != Character)
{ {
@@ -35,8 +35,8 @@ namespace Barotrauma
var msgBox = ChatMessage.Create( var msgBox = ChatMessage.Create(
null, null,
"There might be other agents. Use these to communicate with them." + "There might be other agents. Use these to communicate with them." +
"\nThe code words are: " + server.TraitorManager.codeWords + "." + "\nThe code words are: " + codeWords + "." +
"\nThe code response is: " + server.TraitorManager.codeResponse + ".", "\nThe code response is: " + codeResponse + ".",
(ChatMessageType)ChatMessageType.MessageBox, (ChatMessageType)ChatMessageType.MessageBox,
null); null);
@@ -48,15 +48,12 @@ namespace Barotrauma
#if CLIENT #if CLIENT
if (server.Character == null) if (server.Character == null)
{ {
new GUIMessageBox("New traitor", Character.Name + " is the traitor and the target is " + Character.Name+"."); new GUIMessageBox("New traitor", Character.Name + " is the traitor and the target is " + TargetCharacter.Name+".");
} }
else if (server.Character == Character) else if (server.Character == Character)
{ {
TraitorManager.CreateStartPopUp(TargetCharacter.Name); TraitorManager.CreateStartPopUp(TargetCharacter.Name);
GameMain.NetworkMember.AddChatMessage(greetingMessage + "\n" + moreAgentsMessage, ChatMessageType.Server); GameMain.NetworkMember.AddChatMessage(moreAgentsMessage, ChatMessageType.Server);
GameMain.NetworkMember.AddChatMessage("There might be other agents. Use these to communicate with them." +
"\nThe code words are: " + server.TraitorManager.codeWords + "." +
"\nThe code response is: " + server.TraitorManager.codeResponse + ".", ChatMessageType.MessageBox);
return; return;
} }
#endif #endif
@@ -141,7 +138,7 @@ namespace Barotrauma
Character targetCharacter = characters[targetIndex]; Character targetCharacter = characters[targetIndex];
traitor.TargetCharacter = targetCharacter; traitor.TargetCharacter = targetCharacter;
traitor.Greet(server); traitor.Greet(server, codeWords, codeResponse);
} }
} }