예제 #1
0
        public static void HandleCreatureStats(ref PacketReader packet, ref WorldClass session)
        {
            int id = packet.ReadInt32();
            ulong guid = packet.ReadUInt64();

            Creature creature = DataMgr.FindCreature(id);
            if (creature != null)
            {
                CreatureStats stats = creature.Stats;

                PacketWriter creatureStats = new PacketWriter(LegacyMessage.CreatureStats);

                creatureStats.WriteInt32(stats.Id);
                creatureStats.WriteCString(stats.Name);

                for (int i = 0; i < 7; i++)
                    creatureStats.WriteCString("");

                creatureStats.WriteCString(stats.SubName);
                creatureStats.WriteCString("");
                creatureStats.WriteCString(stats.IconName);

                foreach (var v in stats.Flag)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteInt32(stats.Type);
                creatureStats.WriteInt32(stats.Family);
                creatureStats.WriteInt32(stats.Rank);

                foreach (var v in stats.QuestKillNpcId)
                    creatureStats.WriteInt32(v);

                foreach (var v in stats.DisplayInfoId)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteFloat(stats.HealthModifier);
                creatureStats.WriteFloat(stats.PowerModifier);

                creatureStats.WriteUInt8(stats.RacialLeader);

                foreach (var v in stats.QuestItemId)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteInt32(stats.MovementInfoId);
                creatureStats.WriteInt32(stats.ExpansionRequired);

                session.Send(ref creatureStats);
            }
            else
                Log.Message(LogType.DEBUG, "Creature (Id: {0}) not found.", id);
        }
예제 #2
0
        public static void HandleNameCache(ref PacketReader packet, ref WorldClass session)
        {
            Character pChar = session.Character;

            ulong guid = packet.ReadUInt64();
            uint realmId = packet.ReadUInt32();

            PacketWriter nameCache = new PacketWriter(LegacyMessage.NameCache);

            nameCache.WriteGuid(guid);
            nameCache.WriteUInt8(0);
            nameCache.WriteCString(pChar.Name);
            nameCache.WriteUInt32(realmId);
            nameCache.WriteUInt8(pChar.Race);
            nameCache.WriteUInt8(pChar.Gender);
            nameCache.WriteUInt8(pChar.Class);
            nameCache.WriteUInt8(0);

            session.Send(nameCache);
        }
예제 #3
0
        public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
        {
            var guid = packet.ReadUInt64();
            var gossipData = GossipMgr.GetGossip<Creature>(ObjectGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter gossipMessage = new PacketWriter(LegacyMessage.GossipMessage);

                gossipMessage.WriteUInt64(guid);
                gossipMessage.WriteInt32(gossipData.Id);
                gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
                gossipMessage.WriteInt32(gossipData.TextID);
                gossipMessage.WriteInt32(gossipData.OptionsCount);
                gossipMessage.WriteInt32(gossipData.QuestsCount);

                session.Send(ref gossipMessage);
            }
        }
예제 #4
0
        public static void HandleResponseCharacterDelete(ref PacketReader packet, ref WorldClass session)
        {
            UInt64 guid = packet.ReadUInt64();

            PacketWriter writer = new PacketWriter(LegacyMessage.ResponseCharacterDelete);
            writer.WriteUInt8(0x47);
            session.Send(writer);

            DB.Characters.Execute("DELETE FROM characters WHERE guid = {0}", guid);
            DB.Characters.Execute("DELETE FROM character_spells WHERE guid = {0}", guid);
            DB.Characters.Execute("DELETE FROM character_skills WHERE guid = {0}", guid);
        }
예제 #5
0
        public static void HandleGameObjectStats(ref PacketReader packet, ref WorldClass session)
        {
            int id = packet.ReadInt32();
            ulong guid = packet.ReadUInt64();

            GameObject gObject = DataMgr.FindGameObject(id);
            if (gObject != null)
            {
                GameObjectStats stats = gObject.Stats;

                PacketWriter gameObjectStats = new PacketWriter(LegacyMessage.GameObjectStats);

                gameObjectStats.WriteInt32(stats.Id);
                gameObjectStats.WriteInt32(stats.Type);
                gameObjectStats.WriteInt32(stats.DisplayInfoId);
                gameObjectStats.WriteCString(stats.Name);

                for (int i = 0; i < 3; i++)
                    gameObjectStats.WriteCString("");

                gameObjectStats.WriteCString(stats.IconName);
                gameObjectStats.WriteCString(stats.CastBarCaption);
                gameObjectStats.WriteCString("");

                foreach (var v in stats.Data)
                    gameObjectStats.WriteInt32(v);

                gameObjectStats.WriteFloat(stats.Size);

                foreach (var v in stats.QuestItemId)
                    gameObjectStats.WriteInt32(v);

                gameObjectStats.WriteInt32(stats.ExpansionRequired);

                session.Send(ref gameObjectStats);
            }
            else
                Log.Message(LogType.DEBUG, "Gameobject (Id: {0}) not found.", id);
        }
예제 #6
0
        public static void HandleNameCache(ref PacketReader packet, ref WorldClass session)
        {
            ulong guid = packet.ReadUInt64();
            uint realmId = packet.ReadUInt32();

            var pSession = WorldMgr.GetSession(guid);
            if (pSession != null)
            {
                var pChar = pSession.Character;

                if (pChar != null)
                {
                    PacketWriter nameCache = new PacketWriter(LegacyMessage.NameCache);

                    nameCache.WriteGuid(guid);
                    nameCache.WriteUInt8(0);
                    nameCache.WriteCString(pChar.Name);
                    nameCache.WriteUInt32(realmId);
                    nameCache.WriteUInt8(pChar.Race);
                    nameCache.WriteUInt8(pChar.Gender);
                    nameCache.WriteUInt8(pChar.Class);
                    nameCache.WriteUInt8(0);

                    session.Send(ref nameCache);
                }
            }
        }
예제 #7
0
        public static void HandleVendorTabeList(ref PacketReader packet, ref WorldClass session)
        {
            ulong targetGuid = packet.ReadUInt64();
            if (targetGuid == session.Character.TargetGuid)
            {
            HighGuidType  lol = Framework.ObjectDefines.ObjectGuid.GetGuidType(targetGuid);
              ulong odd =      ObjectGuid.GetGuid(targetGuid);
              CreatureSpawn spawn =  Globals.SpawnMgr.FindSpawn(targetGuid);
              Creature  npc = spawn.Creature;

                  PacketWriter Inventory = new PacketWriter(JAMCMessage.VendorInventory);
                  BitPack ss = new BitPack(Inventory);
                  Inventory.WriteInt8(0x01);//client expects counting to start at 1??
                byte[] count = {00,10,00};//count dat bitstream fortmat unkown
                Inventory.WriteBytes(count, 3);
             /*Item1*/
                Inventory.WriteInt8(11);//slot
                Inventory.WriteInt32(0xFFF010);//left ub stock?
                  ss.Flush();
                 string ssss = "00 00 0C 34 00 00 0C 10 00 00 00 10 00 00 05 30 00 00 03 C0 00 00 00 10 00 00 0C 74 00 00 00 B0 E0 00 0F FF FF FF F0 00 00 00 00 20 00 00 00 10 00 00 02 80 00 00 01 40 00 00 00 10 00 00 0C 44 00 00 0C 20 00 00 0F FF FF FF F0 00 00 00 00 30 00 00 00 10 00 00 05 30 00 00 02 D0 00 00 00 10 00 00 0C 64 00 00 0C 30 00 00 0F FF FF FF F0 00 00 00 00 40 00 00 00 10 00 00 03 E0 00 00 01 E0 00 00 00 10 00 00 0C 84 00 00 00 C0 E0 00 0F FF FF FF F0 00 00 00 00 50 00 00 00 10 00 00 02 80 00 00 01 40 00 00 00 10 00 00 0C 54 00 00 0C 70 20 00 0F FF FF FF F0 00 00 00 00 60 00 00 00 10 00 00 02 C0 00 00 01 40 00 00 00 10 00 00 0F 34 10 00 05 50 00 00 0F FF FF FF F0 00 00 00 00 70 00 00 00 10 00 00 05 50 00 00 03 C0 00 00 00 10 00 00 06 B3 80 00 02 B0 70 00 0F FF FF FF F0 00 00 00 00 80 00 00 00 10 00 00 02 B0 00 00 01 40 00 00 00 10 00 00 0F 44 20 00 0D 10 00 00 0F FF FF FF F0 00 00 00 00 90 00 00 00 10 00 00 05 20 00 00 02 D0 00 00 00 10 00 00 06 C3 80 00 0D 20 00 00 0F FF FF FF F0 00 00 00 00 A0 00 00 00 10 00 00 03 D0 00 00 01 E0 00 00 00 10 00 00 0A 93 70 00 02 C0 70 00 0F FF FF FF F0 00 00 00 00 B0 00 00 00 10 00 00 02 B0 00 00 01 40 00 00 00 10 00 00 06 D3 80 00 0C A0 20 00 0F FF FF FF F0 00 00 00 00 C0 00 00 00 10 00 00 02 C0 00 00 01 40 00 00 05 99 CF 03 10 D9 C0";
                  string[] all = ssss.Split(' ');

                //  int gu = int.Parse(all[0] + " " + all[1] + " " + all[2] + " " + all[3], System.Globalization.NumberStyles.HexNumber);
                  foreach (string a in all)
                  {
                      byte test = byte.Parse(a, System.Globalization.NumberStyles.HexNumber);
                      Inventory.WriteUInt8(test);
                  }

                 /* Inventory.WriteGuid(121332123);
                   Item ii = npc.Data.VendorItems[0];

                   Inventory.WriteUInt32(1);       // client expects counting to start at 1
                   Inventory.WriteUInt32(1); // unk 4.0.1 always 1
                   Inventory.WriteUInt32((uint)71634);
                   Inventory.WriteUInt32((uint)69314);
                   Inventory.WriteUInt32(0xFFFFFFFF);//left in stcok
                   Inventory.WriteUInt32(1);
                   Inventory.WriteUInt32(0);
                   Inventory.WriteUInt32(1);
                   Inventory.WriteUInt32(0);
                   Inventory.WriteInt8(0); ;*/
                  // unk 4.0.1
                 session.Send(ref Inventory);

              Console.WriteLine(npc.Data.NpcFlags);
            }
              //  Globals.WorldMgr.
        }
예제 #8
0
        public static void HandleNPCText(ref PacketReader packet, ref WorldClass session)
        {
            var gossipTextId = packet.ReadInt32();
            var guid = packet.ReadUInt64();

            var gossipData = GossipMgr.GetGossip<Creature>(ObjectGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter npcText = new PacketWriter(LegacyMessage.NPCText);

                npcText.WriteInt32(gossipTextId);
                npcText.WriteFloat(1);

                for (int i = 0; i < 7; i++)
                    npcText.WriteUInt32(0);

                npcText.WriteInt32(gossipData.BroadCastText.Id);

                for (int i = 0; i < 7; i++)
                    npcText.WriteUInt32(0);

                session.Send(ref npcText);
            }
        }