Ejemplo n.º 1
0
Archivo: Say.cs Proyecto: noaki/vortex
        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;
        }
Ejemplo n.º 2
0
Archivo: Ooc.cs Proyecto: noaki/vortex
        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;
        }
Ejemplo n.º 3
0
 public void SendToCharacter(ColorString message)
 {
     if (this.HasColorEnabled) {
         WriteToSocket(message.ColoredString);
     } else {
         WriteToSocket(message.NoColorString);
     }
 }