Example #1
0
        /// <summary>
        /// </summary>
        /// <param name="sender">
        /// </param>
        /// <param name="message">
        /// </param>
        public void Handle(object sender, Message message)
        {
            var client         = (Client)sender;
            var chatCmdMessage = (ChatCmdMessage)message.Body;

            ChatCommandHandler.Read(chatCmdMessage, client);
        }
        /// <summary>
        /// </summary>
        /// <param name="sender">
        /// </param>
        /// <param name="message">
        /// </param>
        public void Handle(object sender, Message message)
        {
            var client         = (ZoneClient)sender;
            var chatCmdMessage = (ChatCmdMessage)message.Body;

            ChatCommandHandler.Read(chatCmdMessage, client);
            client.Character.SendChangedStats();
        }
Example #3
0
 /// <summary>
 /// </summary>
 /// <param name="chatCommand">
 /// </param>
 private void HandleChatCommand(ChatCommand chatCommand)
 {
     foreach (Playfield playfield in this.playfields)
     {
         IInstancedEntity character =
             playfield.FindByIdentity(
                 new Identity {
             Type = IdentityType.CanbeAffected, Instance = chatCommand.CharacterId
         });
         if (character != null)
         {
             ChatCommandHandler.Read(
                 chatCommand.ChatCommandString.TrimStart('.'),
                 (ZoneClient)((Character)character).Client);
         }
     }
 }
        /// <summary>
        /// </summary>
        /// <param name="sender">
        /// </param>
        /// <param name="message">
        /// </param>
        public void Handle(object sender, Message message)
        {
            if (((TextMessage)message.Body).Message.Text.StartsWith("."))
            {
                // It is a chat command in vicinity chat, lets process it
                ChatCommandHandler.Read(((TextMessage)message.Body).Message.Text.TrimStart('.'), (ZoneClient)sender);
                return;
            }

            ICharacter character = ((IZoneClient)sender).Character;
            IPlayfield playfield = character.Playfield;

            float range = 0.0f;

            switch ((int)((TextMessage)message.Body).Message.Type)
            {
            case 0x01:
                range = 1.5f;
                break;

            case 0x00:
                range = 10.0f;
                break;

            case 0x02:
                range = 60.0f;
                break;
            }

            List <Character> charsInRange = playfield.FindInRange(character, range);

            VicinityChatMessage vicinityChat = new VicinityChatMessage
            {
                CharacterIds =
                    charsInRange.Select(
                        x => x.Identity.Instance).ToList(),
                MessageType =
                    (byte)
                    ((TextMessage)message.Body).Message.Type,
                Text =
                    ((TextMessage)message.Body).Message.Text,
                SenderId = character.Identity.Instance
            };

            Program.ISComClient.Send(vicinityChat);
        }