public static void HandleInitialSpells(Packet packet)
        {
            var count = packet.ReadBits("Spell Count", 22);
            packet.ReadBit("InitialLogin");

            var spells = new List<uint>((int)count);
            for (var i = 0; i < count; i++)
            {
                var spellId = packet.ReadUInt32<SpellId>("Spell ID", i);
                spells.Add(spellId);
            }

            var startSpell = new StartSpell { Spells = spells };

            WoWObject character;
            if (Storage.Objects.TryGetValue(CoreParsers.SessionHandler.LoginGuid, out character))
            {
                var player = character as Player;
                if (player != null && player.FirstLogin)
                    Storage.StartSpells.Add(new Tuple<Race, Class>(player.Race, player.Class), startSpell, packet.TimeSpan);
            }
        }
        public static void HandleInitialSpells547(Packet packet)
        {
            if (packet.Direction == Direction.ServerToClient)
            {
                packet.ReadBits("Unk Bits", 1);
                var count = packet.ReadBits("Spell Count", 22);
                packet.ResetBitReader();

                var spells = new List<uint>((int)count);
                for (var i = 0; i < count; i++)
                {
                    var spellId = packet.ReadEntry<UInt32>(StoreNameType.Spell, "Spell ID", i);
                    spells.Add((uint)spellId);
                }

                var startSpell = new StartSpell { Spells = spells };

                WoWObject character;
                if (Storage.Objects.TryGetValue(SessionHandler.LoginGuid, out character))
                {
                    var player = character as Player;
                    if (player != null && player.FirstLogin)
                        Storage.StartSpells.Add(new Tuple<Race, Class>(player.Race, player.Class), startSpell, packet.TimeSpan);
                }
            } else
            {
                packet.WriteLine("              : CMSG_GUILD_DECLINE");
                packet.Opcode = (int)Opcode.CMSG_GUILD_DECLINE;

                packet.ReadToEnd();
            }
        }
Example #3
0
        public static void HandleInitialSpells(Packet packet)
        {
            packet.ReadByte("Talent Spec");

            var count = packet.ReadUInt16("Spell Count");
            var spells = new List<uint>(count);
            for (var i = 0; i < count; i++)
            {
                uint spellId;
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
                    spellId = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID", i);
                else
                    spellId = (uint) packet.ReadEntryWithName<UInt16>(StoreNameType.Spell, "Spell ID", i);

                packet.ReadInt16("Unk Int16", i);

                spells.Add(spellId);
            }

            var startSpell = new StartSpell {Spells = spells};

            WoWObject character;
            if (Storage.Objects.TryGetValue(SessionHandler.LoginGuid, out character))
            {
                var player = character as Player;
                if (player != null && player.FirstLogin)
                    Storage.StartSpells.Add(new Tuple<Race, Class>(player.Race, player.Class), startSpell, packet.TimeSpan);
            }

            var cooldownCount = packet.ReadUInt16("Cooldown Count");
            for (var i = 0; i < cooldownCount; i++)
            {
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
                    packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Cooldown Spell ID", i);
                else
                    packet.ReadEntryWithName<UInt16>(StoreNameType.Spell, "Cooldown Spell ID", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
                    packet.ReadInt32("Cooldown Cast Item ID", i);
                else
                    packet.ReadUInt16("Cooldown Cast Item ID", i);

                packet.ReadUInt16("Cooldown Spell Category", i);
                packet.ReadInt32("Cooldown Time", i);
                var catCd = packet.ReadUInt32();
                packet.WriteLine("[{0}] Cooldown Category Time: {1}", i, ((catCd >> 31) != 0 ? "Infinite" : (catCd & 0x7FFFFFFF).ToString(CultureInfo.InvariantCulture)));
            }
        }
Example #4
0
        public static void HandleInitialSpells510(Packet packet)
        {
            var count = packet.ReadBits("Spell Count", 24);
            packet.ReadBit("Unk Bit");
            packet.ResetBitReader();

            var spells = new List<uint>((int)count);
            for (var i = 0; i < count; i++)
            {
                var spellId = packet.ReadEntryWithName<UInt32>(StoreNameType.Spell, "Spell ID", i);
                spells.Add((uint)spellId);
            }

            var startSpell = new StartSpell { Spells = spells };

            WoWObject character;
            if (Storage.Objects.TryGetValue(SessionHandler.LoginGuid, out character))
            {
                var player = character as Player;
                if (player != null && player.FirstLogin)
                    Storage.StartSpells.Add(new Tuple<Race, Class>(player.Race, player.Class), startSpell, packet.TimeSpan);
            }
        }
        public static void HandleInitialSpells(Packet packet)
        {
            packet.ReadByte("Talent Spec");

            var count = packet.ReadInt16("Spell Count");
            var spells = new List<uint>(count);
            for (var i = 0; i < count; i++)
            {
                uint spellId;
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
                    spellId = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID", i);
                else
                    spellId = (uint) packet.ReadEntryWithName<UInt16>(StoreNameType.Spell, "Spell ID", i);

                packet.ReadInt16("Unk Int16", i);

                spells.Add(spellId);
            }

            var startSpell = new StartSpell();
            startSpell.Spells = spells;

            if (SessionHandler.LoggedInCharacter.FirstLogin)
                packet.SniffFileInfo.Stuffing.StartSpells.TryAdd(new Tuple<Race, Class>(SessionHandler.LoggedInCharacter.Race, SessionHandler.LoggedInCharacter.Class), startSpell);

            var cooldownCount = packet.ReadInt16("Cooldown Count");
            for (var i = 0; i < cooldownCount; i++)
            {
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
                    packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Cooldown Spell ID", i);
                else
                    packet.ReadEntryWithName<UInt16>(StoreNameType.Spell, "Cooldown Spell ID", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
                    packet.ReadInt32("Cooldown Cast Item ID");
                else
                    packet.ReadInt16("Cooldown Cast Item ID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_0_15005))
                    packet.ReadInt32("Cooldown Spell Category", i);
                else
                    packet.ReadInt16("Cooldown Spell Category", i);

                packet.ReadInt32("Cooldown Time", i);
                packet.ReadInt32("Cooldown Category Time", i);
            }
        }