Ejemplo n.º 1
0
        private static IPacket GetCreatureQueryResponse(CreatureTemplate template)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_CREATURE_QUERY_RESPONSE);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(template.Id);
            writer.WriteCString(template.Name);
            writer.WriteCString("");
            writer.WriteCString("");
            writer.WriteCString("");
            writer.WriteCString(template.GuildName);
            writer.WriteCString("");
            writer.Write((uint)template.Flags);
            writer.Write((uint)template.Type);
            writer.Write((uint)template.Family);
            writer.Write((uint)template.Rank);
            writer.Write(0);             // SpellGroupId
            writer.Write(template.DisplayId);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(1f);
            writer.Write(1f);
            writer.Write((byte)0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);             // id from CreatureMovement.dbc
            return(packet);
        }
Ejemplo n.º 2
0
        private static IPacket GetGossipMessagePkt(ulong guid, GossipMessage gossipMessage)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_GOSSIP_MESSAGE);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(guid);
            writer.Write(0);
            writer.Write(gossipMessage.TextId);
            writer.Write(gossipMessage.GossipMenu.Count);
            foreach (GossipMenuItem menuItem in gossipMessage.GossipMenu)
            {
                writer.Write(menuItem.MenuId);
                writer.Write((byte)menuItem.Icon);
                writer.Write((byte)(menuItem.InputBox ? 1 : 0));
                writer.Write(menuItem.Cost);
                writer.WriteCString(menuItem.Text);
                writer.WriteCString(menuItem.AcceptText);
            }
            writer.Write(gossipMessage.QuestsMenu.Count);
            foreach (QuestsMenuItem menuItem in gossipMessage.QuestsMenu)
            {
                writer.Write(menuItem.Id);
                writer.Write(menuItem.Icon);
                writer.Write((uint)0);
                writer.Write(menuItem.Text);
            }

            return(packet);
        }
Ejemplo n.º 3
0
        private static IPacket GetDestroyObjectPkt(WorldObject obj)
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_DESTROY_OBJECT);
            BinaryWriter writer = result.CreateWriter();

            writer.Write(obj.Guid);
            return(result);
        }
Ejemplo n.º 4
0
        private static IPacket GetShowBankPkt(ulong guid)
        {
            IPacket      responce = WorldPacketFactory.Create(WMSG.SMSG_SHOW_BANK);
            BinaryWriter writer   = responce.CreateWriter();

            writer.Write(guid);
            return(responce);
        }
Ejemplo n.º 5
0
        private static IPacket GetLogoutResponcePkt(LogoutResponses error)
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_LOGOUT_RESPONSE);
            BinaryWriter writer = result.CreateWriter();

            writer.Write((byte)error);
            writer.Write(0);
            return(result);
        }
Ejemplo n.º 6
0
        private static IPacket GetSetProficiencyPkt(byte type, int bitmask)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_SET_PROFICIENCY);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(type);
            writer.Write(bitmask);
            return(packet);
        }
Ejemplo n.º 7
0
        public void SendHeartBeat()
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.MSG_MOVE_HEARTBEAT);
            BinaryWriter writer = packet.CreateWriter();

            writer.WritePackGuid(Player.Guid);
            Player.MovementInfo.Write(writer);
            SendNear(Player, packet);
        }
Ejemplo n.º 8
0
        private static IPacket GetLoginSetTimeSpeedPkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_LOGIN_SETTIMESPEED);
            BinaryWriter w      = result.CreateWriter();

            w.Write(WorldServerHandlers.GetActualTime());
            w.Write(0.01666667F);
            return(result);
        }
Ejemplo n.º 9
0
        private static IPacket GetRealmSplitPkt(uint unk1)
        {
            IPacket      responce = WorldPacketFactory.Create(WMSG.SMSG_REALM_SPLIT);
            BinaryWriter w        = responce.CreateWriter();

            w.Write(unk1);
            //0-normal, 1-split, 2-split pending;
            w.Write(0);
            w.WriteCString(DateTime.Now.AddDays(1).ToShortDateString());
            return(responce);
        }
Ejemplo n.º 10
0
        public static IPacket GetTutorialFlagsPkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_TUTORIAL_FLAGS);
            BinaryWriter w      = result.CreateWriter();

            for (int i = 0; i < 32; i++)
            {
                w.Write((byte)0xff);
            }
            return(result);
        }
Ejemplo n.º 11
0
        private IPacket GetLoginVerifyWorldPkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_LOGIN_VERIFY_WORLD);
            BinaryWriter writer = result.CreateWriter();

            writer.Write(Player.MapId);
            writer.Write(Player.PosX);
            writer.Write(Player.PosY);
            writer.Write(Player.PosZ);
            writer.Write(Player.Facing);
            return(result);
        }
Ejemplo n.º 12
0
        private IPacket GetAuthResponcePkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_AUTH_RESPONSE);
            BinaryWriter w      = result.CreateWriter();

            w.Write((byte)0x0C);
            w.Write((uint)0);
            w.Write((byte)2);
            w.Write((uint)0);
            w.Write((byte)session.Account.Expansion);
            return(result);
        }
Ejemplo n.º 13
0
        private static IPacket GetAddonInfoPkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_ADDON_INFO);
            BinaryWriter w      = result.CreateWriter();

            foreach (AddonInfo item in AddonManager.Instance.AddonInfos)
            {
                w.Write((ulong)0x0102);
            }
            w.Write(0);
            w.Flush();
            return(result);
        }
Ejemplo n.º 14
0
        private IPacket GetAuthChallengePkt()
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_AUTH_CHALLENGE);
            BinaryWriter w      = result.CreateWriter();

            w.Write(1);
            w.Write(serverSeed);
            w.Write(0);
            w.Write(0);
            w.Write(0);
            w.Write(0);
            return(result);
        }
Ejemplo n.º 15
0
        private IPacket GetInitialSpellsPkt()
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_INITIAL_SPELLS);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write((byte)0);
            writer.Write((ushort)Player.Spells.Count());
            foreach (int i in Player.Spells)
            {
                writer.Write(i);
                writer.Write((ushort)0);
            }
            writer.Write((ushort)0);
            return(packet);
        }
Ejemplo n.º 16
0
        private IPacket GetAccountDataTimesPkt(uint mask)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_ACCOUNT_DATA_TIMES);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(0);
            writer.Write((byte)1);
            writer.Write(mask);
            for (int i = 0; i < 8; i++)
            {
                if ((mask & (1 << i)) != 0)
                {
                    writer.Write(Account.FindAccpuntData((AccountDataType)i, Player != null ? Player.Guid : 0).Time.ToUnixTimestamp());
                }
            }
            return(packet);
        }
Ejemplo n.º 17
0
        private static IPacket GetGameObjectQueryResponcePkt(GameObjectTemplate template)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_GAMEOBJECT_QUERY_RESPONSE);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(template.Id);
            writer.Write((uint)template.Type);
            writer.Write(template.DisplayId);
            writer.WriteCString(template.Name);
            writer.WriteCString("");
            writer.WriteCString("");
            writer.WriteCString("");
            writer.WriteCString(template.IconName);
            writer.WriteCString(template.CastBarCaption);
            writer.WriteCString("");
            writer.Write(template.Field0);
            writer.Write(template.Field1);
            writer.Write(template.Field2);
            writer.Write(template.Field3);
            writer.Write(template.Field4);
            writer.Write(template.Field5);
            writer.Write(template.Field6);
            writer.Write(template.Field7);
            writer.Write(template.Field8);
            writer.Write(template.Field9);
            writer.Write(template.Field10);
            writer.Write(template.Field11);
            writer.Write(template.Field12);
            writer.Write(template.Field13);
            writer.Write(template.Field14);
            writer.Write(template.Field15);
            writer.Write(template.Field16);
            writer.Write(template.Field17);
            writer.Write(template.Field18);
            writer.Write(template.Field19);
            writer.Write(template.Field20);
            writer.Write(template.Field21);
            writer.Write(template.Field22);
            writer.Write(template.Field23);
            writer.Write(template.ScaleX);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            return(packet);
        }
Ejemplo n.º 18
0
        private static IPacket GetNameQueryResponcePkt(Player player)
        {
            IPacket      result = WorldPacketFactory.Create(WMSG.SMSG_NAME_QUERY_RESPONSE);
            BinaryWriter writer = result.CreateWriter();

            writer.WritePackGuid(player.Guid);
            writer.Write((byte)0);             // this is a type, ranging from 0-3
            writer.WriteCString(player.Name);
            writer.WriteCString("");
            writer.Write((byte)player.Race);
            writer.Write((byte)player.Gender);
            writer.Write((byte)player.Classe);
            writer.Write(true);
            writer.WriteCString(player.Name);
            writer.WriteCString(player.Name);
            writer.WriteCString(player.Name);
            writer.WriteCString(player.Name);
            return(result);
        }
Ejemplo n.º 19
0
        private static IPacket GetNpcTextUpdatePkt(NpcTexts texts)
        {
            IPacket      responce = WorldPacketFactory.Create(WMSG.SMSG_NPC_TEXT_UPDATE);
            BinaryWriter writer   = responce.CreateWriter();

            writer.Write(texts.Id);
            for (int i = 0; i < 8; i++)
            {
                NpcText text = texts.Texts[i];
                writer.Write(text.Probability);
                writer.WriteCString(text.Text0);
                writer.WriteCString(text.Text1);
                writer.Write(text.Language);
                for (int j = 0; (j < 3); j++)
                {
                    writer.Write(text.Emote[j, 0]);
                    writer.Write(text.Emote[j, 1]);
                }
            }
            return(responce);
        }
Ejemplo n.º 20
0
 private static IPacket GetLogoutCompletePkt()
 {
     return(WorldPacketFactory.Create(WMSG.SMSG_LOGOUT_COMPLETE));
 }
Ejemplo n.º 21
0
        private static IPacket GetItemQuerySingleResponsePkt(ItemTemplate template)
        {
            IPacket      packet = WorldPacketFactory.Create(WMSG.SMSG_ITEM_QUERY_SINGLE_RESPONSE);
            BinaryWriter writer = packet.CreateWriter();

            writer.Write(template.Id);
            writer.Write(template.ObjectClass);
            writer.Write(template.SubClass);
            writer.Write(template.Unk1);
            writer.WriteCString(template.Name);
            writer.WriteCString(template.Name2);
            writer.WriteCString(template.Name3);
            writer.WriteCString(template.Name4);
            writer.Write(template.DisplayId);
            writer.Write(template.Quality);
            writer.Write(template.Flags);
            writer.Write(template.Faction);
            writer.Write(template.BuyPrice);
            writer.Write(template.SellPrice);
            writer.Write((int)template.InventoryType);
            writer.Write(template.RequiredClassMask);
            writer.Write(template.RequiredRaceMask);
            writer.Write(template.Level);
            writer.Write(template.RequiredLevel);
            writer.Write(template.RequiredSkill);
            writer.Write(template.RequiredSkillValue);
            writer.Write(template.RequiredSpell);
            writer.Write(template.RequiredPvPRank);
            writer.Write(template.RequiredPvPMedal);
            writer.Write(template.RequiredFaction);
            writer.Write(template.RequiredFactionStanding);
            writer.Write(template.UniqueCount);
            writer.Write(template.MaxAmount);
            writer.Write(template.ContainerSlots);

            writer.Write(10);
            for (int i = 0; i < 10; i++)
            {
                writer.Write(template.bonuses[i].Type);
                writer.Write(template.bonuses[i].Value);
            }

            writer.Write(0);             // NEW 3.0.2 ScalingStatDistribution.dbc
            writer.Write(0);             // NEW 3.0.2 ScalingStatFlags

            for (int i = 0; i < 2; i++)
            {
                writer.Write(template.damages[i].Min);
                writer.Write(template.damages[i].Max);
                writer.Write(template.damages[i].School);
            }

            for (int i = 0; i < 7; i++)
            {
                writer.Write(template.Resistance[i]);
            }

            writer.Write(template.AttackTime);             //
            writer.Write(template.ProjectileType);
            writer.Write(template.RangeModifier);

            for (int i = 0; i < 5; i++)
            {
                writer.Write(template.spells[i].Id);
                writer.Write(template.spells[i].Trigger);
                writer.Write(template.spells[i].Charges);
                writer.Write(template.spells[i].Cooldown);
                writer.Write(template.spells[i].CategoryId);
                writer.Write(template.spells[i].CategoryCooldown);
            }

            writer.Write(template.BondType);
            writer.WriteCString(template.Description);
            writer.Write(template.PageTextId);
            writer.Write(template.PaeCount);
            writer.Write(template.PageMaterial);
            writer.Write(template.QuestId);
            writer.Write(template.LockId);
            writer.Write(template.Material);
            writer.Write(template.SheathType);
            writer.Write(template.RandomPropertiesId);
            writer.Write(template.RandomSuffixId);
            writer.Write(template.BlockValue);
            writer.Write(template.SetId);
            writer.Write(template.MaxDurability);
            writer.Write(template.ZoneId);
            writer.Write(template.MapId);
            writer.Write(template.BagFamily);
            writer.Write(template.TotemCategory);

            for (int i = 0; i < 3; i++)
            {
                writer.Write(template.sockets[i].Color);
                writer.Write(template.sockets[i].Content);
            }

            writer.Write(template.SocketBonusEnchantId);
            writer.Write(template.GemPropertiesId);
            writer.Write(template.RequiredDisenchantingLevel);
            writer.Write(template.ArmorModifier);
            writer.Write(0);
            writer.Write(0);
            writer.Write(0);
            return(packet);
        }
Ejemplo n.º 22
0
 private static IPacket GetLogoutCancelAckPkt()
 {
     return(WorldPacketFactory.Create(WMSG.SMSG_LOGOUT_CANCEL_ACK));
 }