예제 #1
0
        public static void HandleNameQuery(IRealmClient client, RealmPacketIn packet)
        {
            int       num             = (int)packet.ReadUInt32();
            EntityId  id              = packet.ReadEntityId();
            Character activeCharacter = client.ActiveCharacter;
            NPC       npc             = activeCharacter.Map.GetObject(id) as NPC;

            if (npc == null)
            {
                return;
            }
            PetHandler.SendName((IPacketReceiver)activeCharacter, npc.PetNumber, npc.Name, npc.PetNameTimestamp);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="packet"></param>
        public static void HandleSetAction(IRealmClient client, RealmPacketIn packet)
        {
            EntityId  id = packet.ReadEntityId();
            Character activeCharacter = client.ActiveCharacter;
            NPC       pet             = activeCharacter.Map.GetObject(id) as NPC;

            if (pet == null || pet.PermanentPetRecord == null ||
                pet != activeCharacter.ActivePet && !activeCharacter.GodMode)
            {
                return;
            }
            while (packet.Length - packet.Position >= 8)
            {
                PetHandler.ReadButton(pet, packet);
            }
        }
예제 #3
0
        public static void HandleRename(IRealmClient client, RealmPacketIn packet)
        {
            EntityId  id = packet.ReadEntityId();
            Character activeCharacter = client.ActiveCharacter;
            NPC       npc             = activeCharacter.Map.GetObject(id) as NPC;

            if (npc == null || npc != activeCharacter.ActivePet && !activeCharacter.GodMode)
            {
                return;
            }
            string name = packet.ReadCString();
            PetNameInvalidReason reason = npc.TrySetPetName(activeCharacter, name);

            if (reason == PetNameInvalidReason.Ok)
            {
                return;
            }
            PetHandler.SendNameInvalid((IPacketReceiver)activeCharacter, reason, name);
        }