示例#1
0
        public static void SavePetTalentChanges(IRealmClient client, RealmPacketIn packet)
        {
            var petId = packet.ReadEntityId();

            var chr = client.ActiveCharacter;
            var pet = chr.Map.GetObject(petId) as NPC;

            if (pet != null && pet.IsAlive)
            {
                if (pet == chr.ActivePet)
                {
                    var count = packet.ReadInt32();

                    var talents = pet.Talents;
                    for (var i = 0; i < count; i++)
                    {
                        var talentId = (TalentId)packet.ReadUInt32();
                        var rank     = packet.ReadInt32();

                        talents.Learn(talentId, rank);
                    }

                    TalentHandler.SendTalentGroupList(talents);
                }
            }
        }
示例#2
0
        /// <summary>Sends the client the list of talents</summary>
        /// <param name="hasTalents">The IHasTalents to send the list from</param>
        public static void SendTalentGroupList(TalentCollection talents, int talentGroupId)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_TALENTS_INFO))
            {
                Unit owner = talents.Owner;
                bool flag  = owner is Character;
                packet.Write(flag ? (byte)0 : (byte)1);
                if (flag)
                {
                    TalentHandler.WritePlayerTalentList((BinaryWriter)packet, (Character)owner, talentGroupId);
                }
                else
                {
                    packet.Write(talents.FreeTalentPoints);
                    packet.Write((byte)talents.Count);
                    foreach (Talent talent in talents)
                    {
                        packet.Write((int)talent.Entry.Id);
                        packet.Write((byte)talent.Rank);
                    }
                }

                talents.OwnerCharacter.Send(packet, false);
            }
        }
示例#3
0
        public static void HandleRemoveGlyph(IRealmClient client, RealmPacketIn packet)
        {
            uint      num             = packet.ReadUInt32();
            Character activeCharacter = client.ActiveCharacter;

            activeCharacter.RemoveGlyph((byte)num);
            TalentHandler.SendTalentGroupList(activeCharacter.Talents);
        }
示例#4
0
 public static void SendInspectTalents(Character chr)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_INSPECT_TALENT))
     {
         chr.EntityId.WritePacked((BinaryWriter)packet);
         TalentHandler.WritePlayerTalentList((BinaryWriter)packet, chr, chr.Talents.CurrentSpecIndex);
         chr.Client.Send(packet, false);
     }
 }
示例#5
0
        public static void HandleLearnTalent(IRealmClient client, RealmPacketIn packet)
        {
            TalentId         id      = (TalentId)packet.ReadUInt32();
            int              rank    = packet.ReadInt32();
            TalentCollection talents = client.ActiveCharacter.Talents;

            if (talents.Learn(id, rank) == null)
            {
                return;
            }
            TalentHandler.SendTalentGroupList(talents);
        }
示例#6
0
        public static void HandleSaveTalentGroup(IRealmClient client, RealmPacketIn packet)
        {
            int num = packet.ReadInt32();
            TalentCollection talents = client.ActiveCharacter.Talents;

            for (int index = 0; index < num; ++index)
            {
                TalentId id   = (TalentId)packet.ReadUInt32();
                int      rank = packet.ReadInt32();
                talents.Learn(id, rank);
            }

            TalentHandler.SendTalentGroupList(talents);
        }
示例#7
0
        public static void HandlePetLearnTalent(IRealmClient client, RealmPacketIn packet)
        {
            EntityId  id1             = packet.ReadEntityId();
            Character activeCharacter = client.ActiveCharacter;
            NPC       npc             = activeCharacter.Map.GetObject(id1) as NPC;

            if (npc == null || !npc.IsAlive || npc != activeCharacter.ActivePet)
            {
                return;
            }
            TalentCollection talents = npc.Talents;
            TalentId         id2     = (TalentId)packet.ReadUInt32();
            int rank = packet.ReadInt32();

            talents.Learn(id2, rank);
            TalentHandler.SendTalentGroupList(talents);
        }
示例#8
0
        public static void HandlePetLearnTalent(IRealmClient client, RealmPacketIn packet)
        {
            var petId = packet.ReadEntityId();

            var chr = client.ActiveCharacter;
            var pet = chr.Map.GetObject(petId) as NPC;

            if (pet == null || !pet.IsAlive)
            {
                return;
            }
            if (pet != chr.ActivePet)
            {
                return;
            }

            var talents  = pet.Talents;
            var talentId = (TalentId)packet.ReadUInt32();
            var rank     = packet.ReadInt32();

            talents.Learn(talentId, rank);

            TalentHandler.SendTalentGroupList(talents);
        }
示例#9
0
 public static void SendTalentGroupList(TalentCollection talents)
 {
     TalentHandler.SendTalentGroupList(talents, talents.CurrentSpecIndex);
 }