public override bool Execute(PlayerCharacter callingPlayer, string parameters) { if (parameters.Length == 0) { callingPlayer.SendToCharacter("What do you want to say?\n\r"); return false; } ColorString toPlayer = new ColorString(String.Format("You say, \"{0}\"\n\r", parameters)); ColorString toOthers = new ColorString(String.Format("{0} says, \"{1}\"\n\r", callingPlayer.Name, parameters)); callingPlayer.SendToCharacter(toPlayer); // for each character in the room foreach (var ch in callingPlayer.InRoom.PlayerCharactersInRoom) { // we need to say what needs to be said if(ch != callingPlayer) { ch.SendToCharacter(toOthers); } } return true; }
public override bool Execute(PlayerCharacter callingPlayer, string parameters) { if (parameters.Length == 0) { callingPlayer.SendToCharacter("What do you want to say?\n\r"); return false; } callingPlayer.SendToCharacter(String.Format("{{gYou OOC \"{{x{0}{{g\"{{x\n\r", parameters)); ColorString toOthers = new ColorString(String.Format("{{g{0} OOC \"{{x{1}{{g\"{{x\n\r", callingPlayer.Name, parameters)); foreach (Character ch in Character.CharacterList) { if (ch is PlayerCharacter) { PlayerCharacter player = ch as PlayerCharacter; if (player != callingPlayer) { player.SendToCharacter(toOthers); } } } return true; }
public void SendToCharacter(ColorString message) { if (this.HasColorEnabled) { WriteToSocket(message.ColoredString); } else { WriteToSocket(message.NoColorString); } }