public void Dispatch(ISession session, IPacket packet) { BinaryReader reader = packet.CreateReader(); byte castCount = reader.ReadByte(); uint spellId = reader.ReadUInt32(); byte unklags = reader.ReadByte(); IPacket pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_START); BinaryWriter writer = pkt.CreateWriter(); writer.WritePackGuid(session.Player.Guid); writer.WritePackGuid(session.Player.Guid); writer.Write(castCount); writer.Write(spellId); writer.Write(0); //cast flags writer.Write(0); //ticks count writer.Write(0); //targetflags session.Send(pkt); Thread.Sleep(5000); pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_GO); writer = pkt.CreateWriter(); writer.WritePackGuid(session.Player.Guid); writer.WritePackGuid(session.Player.Guid); writer.Write(castCount); writer.Write(spellId); writer.Write(0); //cast flags writer.Write(0); //ticks count writer.Write((byte)1); //hit count writer.Write(session.Player.Guid); writer.Write((byte)0); //miss count writer.Write(0); // targetflags session.Send(pkt); }
public IPacket Build() { IPacket packet = Create(wmsg); builder(packet.CreateWriter()); return(packet); }
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); }
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); }
private static IPacket GetShowBankPkt(ulong guid) { IPacket responce = WorldPacketFactory.Create(WMSG.SMSG_SHOW_BANK); BinaryWriter writer = responce.CreateWriter(); writer.Write(guid); return(responce); }
private static IPacket GetDestroyObjectPkt(WorldObject obj) { IPacket result = WorldPacketFactory.Create(WMSG.SMSG_DESTROY_OBJECT); BinaryWriter writer = result.CreateWriter(); writer.Write(obj.Guid); return(result); }
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); }
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); }
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); }
private static IPacket GetUpdateAccountDataCompletePkt(AccountDataType type) { IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_UPDATE_ACCOUNT_DATA_COMPLETE); BinaryWriter writer = packet.CreateWriter(); writer.Write((uint)type); writer.Write(0); return(packet); }
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); }
private IPacket GetPowerUpdatePkt(uint value) { IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_POWER_UPDATE); BinaryWriter writer = packet.CreateWriter(); writer.WritePackGuid(Guid); writer.Write((byte)PowerType); writer.Write(value); return(packet); }
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); }
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); }
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); }
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); }
public IPacket GetCharEnumPkt() { IPacket p = WorldPacketFactory.Create(WMSG.SMSG_CHAR_ENUM); BinaryWriter w = p.CreateWriter(); w.Write((byte)players.Count); foreach (Player player in players) { w.Write(player.Guid); w.WriteCString(player.Name); w.Write((byte)player.Race); w.Write((byte)player.Classe); w.Write((byte)player.Gender); w.Write(player.Skin); w.Write(player.Face); w.Write(player.HairStyle); w.Write(player.HairColor); w.Write(player.FacialHair); w.Write((byte)player.Level); w.Write(player.ZoneId); w.Write(player.MapId); w.Write(player.PosX); w.Write(player.PosY); w.Write(player.PosZ); w.Write(player.GuildMember.With(x => x.Guild.Id)); uint flag = 0x00000000; w.Write(flag); w.Write((byte)0); w.Write(player.PetDisplayId); w.Write(player.PetLevel); w.Write(player.PetCreatureFamily); w.Write(0); for (int i = 0; i < 23; i++) { Item item = player.Inventory[i]; if (item != null) { w.Write(item.Template.DisplayId); w.Write((byte)item.Template.InventoryType); w.Write(0); } else { w.Write(0); w.Write((byte)0); w.Write(0); } } } return(p); }
private static IPacket GetMoveResponce(IPacket packet) { BinaryReader reader = packet.CreateReader(); reader.BaseStream.Seek(0, SeekOrigin.Begin); byte[] bytes = reader.ReadBytes(packet.Size); IPacket responce = WorldPacketFactory.Create((WMSG)packet.Code); BinaryWriter w = responce.CreateWriter(); w.Write(bytes); return(responce); }
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); }
public IPacket Build() { IPacket result = WorldPacketFactory.Create(WMSG.SMSG_UPDATE_OBJECT); BinaryWriter writer = result.CreateWriter(); writer.Write(updateBlocks.Count); foreach (IUpdateBlock updater in updateBlocks) { writer.Write((byte)updater.UpdateType); updater.Write(writer); } return(result); }
private static IPacket GetCorpseQuery(Corpse corpse) { IPacket pkt = WorldPacketFactory.Create(WMSG.MSG_CORPSE_QUERY); BinaryWriter writer = pkt.CreateWriter(); writer.Write((byte)1); writer.Write(corpse.MapId); writer.Write(corpse.PosX); writer.Write(corpse.PosY); writer.Write(corpse.PosZ); writer.Write(corpse.MapId); return(pkt); }
private static IPacket GetUpdateAccountDataPkt(AccpuntData accpuntData) { IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_UPDATE_ACCOUNT_DATA); BinaryWriter writer = packet.CreateWriter(); writer.Write(accpuntData.Guid); writer.Write((uint)accpuntData.Type); writer.Write(accpuntData.Time.ToUnixTimestamp()); writer = new BinaryWriter(new DeflaterOutputStream(writer.BaseStream)); writer.WriteCString(accpuntData.Data); writer.Flush(); return(packet); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }