/// <summary> /// Sends the packet to show the battleground window /// </summary> /// <param name="client"></param> /// <param name="speaker"></param> /// <param name="character"></param> /// <returns></returns> public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST)) { packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0); packet.WriteUInt((uint)m_bgqueue.Template.BgID); packet.WriteByte(m_battlegroupId); //Battle group // TODO: Add sync'ing? //m_syncLock.EnterReadLock(); try { packet.WriteUInt(m_battlegrounds.Count); //Count foreach (var bg in m_battlegrounds.Values) { packet.WriteUInt(bg.InstanceId); } } finally { //m_syncLock.ExitReadLock(); } client.Send(packet); return true; } }
public static void Send_SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA(Character chr) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0)) { chr.Send(packet); } }
public static void SendInBounds(Character duelist) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_INBOUNDS,4)) { duelist.Send(packet); } }
public static void SendBreakTarget(IPacketReceiver rcvr, IEntity target) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BREAK_TARGET, 8)) { packet.Write(target.EntityId); rcvr.Send(packet); } }
public void GetMail(TestCharacter getter) { using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_GET_MAIL_LIST)) { packet.Write(EntityId.Zero); getter.FakeClient.ReceiveCMSG(packet, true); } }
/// <summary> /// An instance has been reset /// </summary> public static void SendInstanceReset(IPacketReceiver client, MapId mapId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_LAST_INSTANCE, 4)) { packet.Write((int)mapId); client.Send(packet); } }
public static void SendCancelAutoRepeat(IPacketReceiver client, IEntity entity) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CANCEL_AUTO_REPEAT)) { entity.EntityId.WritePacked(packet); client.Send(packet); } }
/// <summary> /// Make sure, we have a valid target before calling this method /// </summary> public static void SendCombatStart(Unit chr, Unit opponent, bool includeSelf) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ATTACKSTART, 16)) { chr.EntityId.WritePacked(packet); opponent.EntityId.WritePacked(packet); chr.PushPacketToSurroundingArea(packet, includeSelf, false); } }
/// <summary> /// Sends initially all spells and item cooldowns to the character /// </summary> public static void SendSpellsAndCooldowns(Character chr) { var spells = chr.PlayerSpells; var len = 5 + (4 * spells.Count); // +(14 * cooldowns); using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INITIAL_SPELLS, len)) { packet.Write((byte) 0); packet.Write((ushort) spells.Count); foreach (var spell in spells.AllSpells) { packet.Write(spell.Id); //packet.Write((ushort)0xEEEE); packet.Write((ushort) 0); } var countPos = packet.Position; ushort cooldownCount = 0; packet.Position = countPos + 2; // cooldowns var now = DateTime.Now.Ticks; foreach (var idCd in spells.IdCooldowns) { var delay = (int)(idCd.Until.Ticks - now); if (delay > 10) { cooldownCount++; packet.Write(idCd.SpellId); packet.Write((ushort) idCd.ItemId); packet.Write((ushort) 0); packet.Write(Utility.ToMilliSecondsInt(delay)); packet.Write(0); } } foreach (var catCd in spells.CategoryCooldowns) { var delay = (int)(catCd.Until.Ticks - now); if (delay > 10) { cooldownCount++; packet.Write(catCd.SpellId); packet.Write((ushort) catCd.ItemId); packet.Write((ushort) catCd.CategoryId); packet.Write(0); packet.Write(Utility.ToMilliSecondsInt(delay)); } } packet.Position = countPos; packet.Write(cooldownCount); chr.Client.Send(packet); } }
public static void SendTitleEarned(Character character, CharacterTitleEntry titleEntry, bool lost) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TITLE_EARNED, 4 + 4)) { packet.WriteUInt((uint) titleEntry.BitIndex); packet.WriteUInt(lost ? 0 : 1); character.Send(packet); } }
public static void SendGameObjectTextPage(IPacketReceiver rcv, IEntity obj) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_PAGETEXT, 8)) { packet.Write(obj.EntityId); rcv.Send(packet); } }
public static void SendUpdateWorldState(IPacketReceiver rcv, WorldStateId key, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_WORLD_STATE, 300)) { packet.Write((uint)key); packet.Write(value); rcv.Send(packet); } }
public void SendCustomAnim(uint anim) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_CUSTOM_ANIM, 12)) { packet.Write(EntityId); packet.Write(anim); SendPacketToArea(packet); } }
public static void SendOutOfBounds(Character duelist, uint cancelDelayMillis) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_OUTOFBOUNDS, 4)) { packet.Write(cancelDelayMillis); duelist.Send(packet); } }
public static void SendCountdown(Character duelist, uint millis) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_COUNTDOWN, 4)) { packet.Write(millis); duelist.Send(packet); } }
/// <summary> /// Makes the given faction visible to the client. /// </summary> public static void SendVisible(IPacketReceiver client, FactionReputationIndex reputationIndex) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_FACTION_VISIBLE, 4)) { packet.Write((int)reputationIndex); client.Send(packet); } }
public static void HandleSystemStatusPacket(IRealmClient client, RealmPacketIn packet) { using (var repPacket = new RealmPacketOut(RealmServerOpCode.SMSG_GMTICKET_SYSTEMSTATUS, 4)) { // TODO: Add indicator to Account for whether person may use ticket system repPacket.Write(1); client.Send(repPacket); } }
public static void SendQuestConfirmAccept(IRealmClient client) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUEST_CONFIRM_ACCEPT)) { packet.Write(0); client.Send(packet); } }
public static void SendTutorialFlags(Character chr) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TUTORIAL_FLAGS, 32)) { packet.Write(chr.TutorialFlags.FlagData); chr.Client.Send(packet); } }
public void AddPacket(RealmPacketOut packet) { if (packet.ContentLength > 255) throw new InvalidDataException("Packets added to a compressed stream must have length less than 255"); backingStream.Write((byte)packet.ContentLength); backingStream.Write((ushort)packet.OpCode); backingStream.Write(packet.GetFinalizedPacket(), packet.HeaderSize, packet.ContentLength); }
public void SendDespawn() { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_DESPAWN_ANIM, 8)) { packet.Write(EntityId); SendPacketToArea(packet); } }
public static void SendSystemStatus(Character chr, VoiceSystemStatus status) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_FEATURE_SYSTEM_STATUS)) { packet.WriteByte(2); // what is this packet.WriteByte((byte)status); chr.Client.Send(packet); } }
public static void SendComplete(Character duelist1, Character duelist2, bool complete) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_COMPLETE)) { packet.Write((byte)(complete ? 1 : 0)); if (duelist1 != null) duelist1.Client.Send(packet); if (duelist2 != null) duelist2.Client.Send(packet); } }
public static void SendEmote(WorldObject obj, EmoteType emote) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_EMOTE, 12)) { packet.WriteUInt((uint)emote); packet.Write(obj.EntityId); obj.SendPacketToArea(packet, true); } }
/// <summary> /// Creates a packet /// </summary> public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag) { var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length); packet.WriteByte((byte)type); // 1 packet.WriteUInt((uint)language); // 5 packet.WriteUIntPascalString(msg); // 22 + msg.Length packet.WriteByte((byte)tag); // 23 + msg.Length return packet; }
public static void SendItemNameQueryResponse(IPacketReceiver client, ItemTemplate item) { using (var outPacket = new RealmPacketOut(RealmServerOpCode.SMSG_ITEM_NAME_QUERY_RESPONSE, 4 + item.DefaultName.Length)) { outPacket.WriteInt(item.Id); outPacket.WriteCString(item.DefaultName); client.Send(outPacket); } }
public static void SendCombatStart(Unit unit, Unit opponent, bool includeSelf) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ATTACKSTART, 16)) { packet.Write(unit.EntityId); packet.Write(opponent.EntityId); unit.SendPacketToArea(packet, includeSelf); } }
/// <summary> /// Sends a request to wipe all talents, which must be confirmed by the player /// </summary> public static void SendClearQuery(TalentCollection talents) { using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_TALENT_WIPE_CONFIRM, 12)) { packet.Write(talents.Owner.EntityId); packet.Write(talents.GetResetPrice()); talents.OwnerCharacter.Send(packet); } }
public static void SendLearnedSpell(IPacketReceiver client, uint spellId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LEARNED_SPELL, 4)) { packet.WriteUInt(spellId); packet.WriteUShort(0); // 3.3.3a client.Send(packet); } }
public static void SendAreaTriggerMessage(IPacketReceiver client, string msg) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AREA_TRIGGER_MESSAGE, (msg.Length * 2) + 4)) { packet.WriteUIntPascalString(msg); packet.Write((byte)0); client.Send(packet); } }
public static void SendMovementPacket(IRealmClient client, RealmPacketOut pak, int moveTimePos, uint clientMoveTime) { //var correctedMoveTime = (MovementDelay + delay) + OutOfSyncDelay + Utility.GetEpochTime(); //var correctedMoveTime = (MovementDelay + delay) + OutOfSyncDelay + Utility.GetSystemTime(); //var correctedMoveTime = clientMoveTime - Utility.GetSystemTime(); var correctedMoveTime = Utility.GetSystemTime() + (client.OutOfSyncDelay * 800); //if (client.LastClientMoveTime > 0) //{ // correctedMoveTime += clientMoveTime - client.LastClientMoveTime; //} var originalPos = pak.Position; pak.Position = moveTimePos; pak.Write(correctedMoveTime); pak.Position = originalPos; client.LastClientMoveTime = clientMoveTime; client.Send(pak, addEnd: false); }
public static void ShowTaxiList(Character chr, IEntity vendor, PathNode curNode) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4))) { packet.Write(1); if (vendor != null) { packet.Write(vendor.EntityId.Full); } else { packet.Write(EntityId.Zero); } packet.Write(curNode.Id); for (var i = 0; i < chr.TaxiNodes.Mask.Length; ++i) { packet.Write(chr.TaxiNodes.Mask[i]); } chr.Send(packet, addEnd: false); } }
public static void SendPageText(Character chr, uint pageId) { var entry = PageTextEntry.GetEntry(pageId); if (entry != null) { do { SendPageText(chr, entry); entry = entry.NextPageEntry; } while (entry != null); } else { using (var outPack = new RealmPacketOut(RealmServerOpCode.SMSG_PAGE_TEXT_QUERY_RESPONSE, 100)) { outPack.Write("-page is missing-"); outPack.Write(0); chr.Send(outPack, addEnd: false); } } }
/// <summary> /// Sends a simple npc text update to the character /// </summary> /// <param name="character">recieving character</param> /// <param name="id">id of text to update</param> /// <param name="title">gossip window's title</param> /// <param name="text">gossip window's text</param> public static void SendNPCTextUpdateSimple(Character character, uint id, string title, string text) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_NPC_TEXT_UPDATE)) { packet.Write(id); packet.WriteFloat(1); packet.WriteCString(title); packet.WriteCString(text); packet.Fill(0, 4 * 7); for (var i = 1; i < 8; i++) { packet.WriteFloat(0); packet.WriteByte(0); packet.WriteByte(0); packet.Fill(0, 4 * 7); } character.Client.Send(packet, addEnd: false); } }
public static void SendWingsInfoResponse(Character chr, IRealmClient reciever) { if (chr.Asda2WingsItemId == (short)-1) { return; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WingsInfo)) { packet.WriteInt32(chr.AccId); packet.WriteInt16(chr.Asda2WingsItemId); packet.WriteSkip(FunctionalItemsHandler.stub6); if (reciever == null) { chr.SendPacketToArea(packet, true, true, Locale.Any, new float?()); chr.Send(packet, true); } else { reciever.Send(packet, true); } } }
public static void SendDungeonDifficulty(Character chr) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MSG_SET_DUNGEON_DIFFICULTY, 12)) { Group group = chr.Group; if (group != null && !group.Flags.HasFlag(GroupFlags.Raid)) { packet.Write(group.DungeonDifficulty); packet.Write(1); packet.Write(1); } else { packet.Write((int)chr.Record.DungeonDifficulty); packet.Write(1); packet.Write(0); } chr.Send(packet, false); } }
/// <summary> /// Goes through the queue, pulling out clients for the number of slots available at the time. /// </summary> /// <param name="state">the timer object</param> private static void ProcessQueuedClients(object state) { List <IRealmClient> realmClientList = new List <IRealmClient>(); try { IRealmClient realmClient; for (int index = RealmServerConfiguration.MaxClientCount - ServerApp <RealmServer> .Instance.AcceptedClients; index != 0 && s_queuedClients.TryDequeue(out realmClient); --index) { realmClientList.Add(realmClient); } int num = 0; using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_RESPONSE)) { packet.Write((byte)27); packet.Write(0); foreach (IRealmClient queuedClient in s_queuedClients) { packet.InsertIntAt(num++, 5L, false); queuedClient.Send(packet, false); } } } catch (Exception ex) { LogUtil.ErrorException(ex, "AuthQueue raised an Exception."); } finally { foreach (IRealmClient client in realmClientList) { client.Account.IsEnqueued = false; LoginHandler.InviteToRealm(client); } } }
public static void SendLootResponse(Character looter, Loot loot) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_RESPONSE, 14 + (loot.RemainingCount * 22))) { var looterEntry = looter.LooterEntry; packet.Write(loot.Lootable.EntityId); packet.Write((byte)loot.ResponseType); packet.Write(loot.IsMoneyLooted ? 0 : loot.Money); var countPos = packet.Position; var count = 0; packet.Position++; for (var i = 0; i < loot.Items.Length; i++) { var item = loot.Items[i]; var templ = item.Template; var looters = item.MultiLooters; if (!item.Taken && ((looters == null && templ.CheckLootConstraints(looter)) || (looters != null && looters.Contains(looterEntry)))) { packet.Write((byte)i); packet.Write(templ.Id); packet.Write(item.Amount); packet.Write(templ.DisplayId); packet.Write(templ.RandomSuffixFactor); packet.Write(templ.RandomSuffixFactor > 0 ? -(int)templ.RandomSuffixId : (int)templ.RandomPropertiesId); packet.Write((byte)item.Decision); count++; } } packet.Position = countPos; packet.Write((byte)count); looter.Client.Send(packet); } }
public static void SendFacingPacket(Unit movingUnit, float orientation, uint moveTimeMillis) { if (!movingUnit.IsAreaActive) { return; } using (RealmPacketOut realmPacketOut = new RealmPacketOut(RealmServerOpCode.SMSG_MONSTER_MOVE, 53)) { movingUnit.EntityId.WritePacked(realmPacketOut); realmPacketOut.Write((byte)0); realmPacketOut.Write(movingUnit.Position); realmPacketOut.Write(Utility.GetSystemTime()); realmPacketOut.Write((byte)4); realmPacketOut.Write(orientation); realmPacketOut.Write(0U); realmPacketOut.Write(moveTimeMillis); realmPacketOut.Write(1); realmPacketOut.Write(movingUnit.Position); movingUnit.SendPacketToArea(realmPacketOut, true, false, Locale.Any, new float?()); } }
public static void HandleAuctionListPendingSales(IRealmClient client, RealmPacketIn packet) { var chr = client.ActiveCharacter; var auctioneerId = packet.ReadEntityId(); var auctioneer = chr.Map.GetObject(auctioneerId) as NPC; var count = 1u; using (var packetOut = new RealmPacketOut(RealmServerOpCode.SMSG_AUCTION_LIST_PENDING_SALES, 14 * (int)count)) { packetOut.Write(count); for (var i = 0; i < count; ++i) { packetOut.Write(""); packetOut.Write(""); packetOut.WriteUInt(0); packetOut.WriteUInt(0); packetOut.WriteFloat(0f); client.Send(packetOut); } } }
public static void SendStartRoll(Loot loot, LootItem item, IEnumerable <LooterEntry> looters, MapId mapid) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_START_ROLL)) { packet.Write(loot.Lootable.EntityId); packet.WriteUInt((uint)mapid); packet.Write(item.Index); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write(item.Template.RandomSuffixFactor > 0U ? (int)-item.Template.RandomSuffixId : (int)item.Template.RandomPropertiesId); packet.Write((byte)15); foreach (LooterEntry looter in looters) { if (looter.Owner != null) { looter.Owner.Client.Send(packet, false); } } } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { RealmServerOpCode packetOpCode = trigger.Text.NextEnum(RealmServerOpCode.Unknown); if (packetOpCode == RealmServerOpCode.Unknown) { trigger.Reply("Invalid OpCode."); } else { using (RealmPacketOut packet = new RealmPacketOut(packetOpCode)) { while (trigger.Text.HasNext) { int num = trigger.Text.NextInt(); packet.Write(num); } ((Character)trigger.Args.Target).Client.Send(packet, false); } } }
public static void SendPartyMemberInitialInfoResponse(Character member) { if (member == null || member.Group == null) { return; } using (var packet = new RealmPacketOut(RealmServerOpCode.PartyMemberInitialInfo)) //5109 { packet.WriteInt32(member.AccId); //{accId}default value : 340701 Len : 4 packet.WriteByte(member.Level); //{level}default value : 33 Len : 1 packet.WriteByte(member.ProfessionLevel); //{profLevel}default value : 2 Len : 1 packet.WriteByte((byte)member.Class); //{profType}default value : 3 Len : 1 packet.WriteInt32(member.MaxHealth); //{maxHealth}default value : 1615 Len : 4 packet.WriteInt32(member.Health); //{curHealth}default value : 1615 Len : 4 packet.WriteInt16(member.MaxPower); //{maxMana}default value : 239 Len : 2 packet.WriteInt16(member.Power); //{curMana}default value : 239 Len : 2 packet.WriteInt16((short)member.Asda2X); //{x}default value : 75 Len : 2 packet.WriteInt16((short)member.Asda2Y); //{y}default value : 358 Len : 2 packet.WriteByte((byte)member.Map.MapId); //{map}default value : 3 Len : 1 member.Group.Send(packet, addEnd: false); } }
public static void SendRoll(Character looter, Loot loot, LootItem item, int rollNumber, LootRollType rollType) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_ROLL)) { packet.Write(loot.Lootable.EntityId); packet.Write(item.Index); packet.Write(looter.EntityId); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write((int)(item.Template.RandomSuffixFactor > 0 ? -item.Template.RandomSuffixId : item.Template.RandomPropertiesId)); packet.Write(rollNumber); packet.Write((byte)rollType); foreach (var looterEntry in loot.Looters) { if (looterEntry.Owner != null) { looterEntry.Owner.Client.Send(packet); } } } }
public static void SendPetLevelLimitBreakedResponse(IRealmClient client, PetLimitBreakStatus status, Asda2PetRecord pet = null, Asda2Item lvlBreakItem = null, Asda2Item suplItem = null) { var items = new Asda2Item[2]; items[0] = lvlBreakItem; items[1] = suplItem; using (var packet = new RealmPacketOut(RealmServerOpCode.PetLevelLimitBreaked)) //6149 { packet.WriteByte((byte)status); //{curstatus}default value : 1 Len : 1 packet.WriteInt32(pet == null ? 0 : pet.Guid); //{petGuid}default value : 68412 Len : 4 packet.WriteInt16(pet == null ? 0 : pet.Id); //{petId}default value : 2759 Len : 2 packet.WriteFixedAsciiString(pet == null ? "" : pet.Name, 16); //{petName}default value : Len : 16 packet.WriteByte(pet == null ? 0 : pet.HungerPrc); //{hunger}default value : 97 Len : 1 packet.WriteByte(pet == null ? 0 : pet.Level); //{curLvl}default value : 5 Len : 1 packet.WriteByte(pet == null ? 0 : pet.MaxLevel); //{maxLvl}default value : 5 Len : 1 packet.WriteInt16(pet == null ? 0 : pet.Expirience); //{exp}default value : 2000 Len : 2 packet.WriteByte(1); //value name : unk13 default value : 1Len : 1 packet.WriteInt16((short)(pet == null ? 0 : pet.Stat1Type)); //{stat1Type}default value : 2 Len : 2 packet.WriteInt32(pet == null ? 0 : pet.Stat1Value); //{stat1Value}default value : 77 Len : 4 packet.WriteInt16((short)(pet == null ? 0 : pet.Stat2Type)); //{stat1Type}default value : 2 Len : 2 packet.WriteInt32(pet == null ? 0 : pet.Stat2Value); //{stat1Value}default value : 77 Len : 4 packet.WriteInt16((short)(pet == null ? 0 : pet.Stat3Type)); //{stat1Type}default value : 2 Len : 2 packet.WriteInt32(pet == null ? 0 : pet.Stat3Value); //{stat1Value}default value : 77 Len : 4 packet.WriteInt32(client.ActiveCharacter.Asda2Inventory.Weight); //{inwWeight}default value : 9988 Len : 4 for (int i = 0; i < 2; i += 1) { var item = items[i]; packet.WriteInt32(item == null ? 0 : item.ItemId); //{itemId}default value : 31981 Len : 4 packet.WriteByte((byte)(item == null ? 0 : item.InventoryType)); //{inv}default value : 2 Len : 1 packet.WriteInt16(item == null ? -1 : item.Slot); //{slot}default value : 8 Len : 2 packet.WriteInt16(item == null ? -1 : item.IsDeleted ? -1 : 0); //{minusOneIfDelete}default value : -1 Len : 2 packet.WriteInt32(item == null ? 0 : item.Amount); //{amount}default value : 0 Len : 4 packet.WriteSkip(stab25); //value name : stab25 default value : stab25Len : 1 packet.WriteInt16(item == null ? 0 : item.Amount); //{amount0}default value : 0 Len : 2 packet.WriteSkip(stab28); //value name : stab28 default value : stab28Len : 41 } client.Send(packet); } }
public static void SendPlayerPositions(IPacketReceiver client, IList <Character> players, IList <Character> flagCarriers) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.MSG_BATTLEGROUND_PLAYER_POSITIONS)) { if (players != null) { packet.Write(players.Count); foreach (Character player in players) { packet.Write(player.EntityId); packet.Write(player.Position.X); packet.Write(player.Position.Y); } } else { packet.Write(0); } if (flagCarriers != null) { packet.Write(flagCarriers.Count); foreach (Character flagCarrier in flagCarriers) { packet.Write(flagCarrier.EntityId); packet.Write(flagCarrier.Position.X); packet.Write(flagCarrier.Position.Y); } } else { packet.Write(0); } client.Send(packet, false); } }
public static void SendPrivateShopChatNotificationAboutBuyResponse(Asda2PrivateShop shop, List <Asda2ItemTradeRef> itemsBuyed, Character buyer) { Asda2ItemTradeRef[] asda2ItemTradeRefArray = new Asda2ItemTradeRef[6]; for (int index = 0; index < itemsBuyed.Count; ++index) { asda2ItemTradeRefArray[index] = itemsBuyed[index]; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.PrivateShopChatNotificationAboutBuy)) { packet.WriteInt32(shop.Owner.AccId); packet.WriteInt16(shop.Owner.SessionId); packet.WriteByte( ((IEnumerable <Asda2ItemTradeRef>)asda2ItemTradeRefArray).Count <Asda2ItemTradeRef>( (Func <Asda2ItemTradeRef, bool>)(i => i != null))); packet.WriteInt32(buyer.AccId); for (int index = 0; index < 6; ++index) { Asda2Item asda2Item = asda2ItemTradeRefArray[index] == null || asda2ItemTradeRefArray[index].Item == null ? (Asda2Item)null : asda2ItemTradeRefArray[index].Item; packet.WriteInt32(asda2Item == null ? 0 : asda2Item.ItemId); packet.WriteByte(0); packet.WriteInt16(-1); packet.WriteInt32(asda2ItemTradeRefArray[index] == null ? -1 : asda2ItemTradeRefArray[index].Amount); packet.WriteInt32(asda2ItemTradeRefArray[index] == null ? -1 : (int)asda2ItemTradeRefArray[index].TradeSlot); packet.WriteInt16(0); packet.WriteSkip(Asda2PrivateShopHandler.stub18); } shop.Send(packet); } }
/// <summary> /// Send the stabled pets list packet to the client /// </summary> /// <param name="receiver">The client to receive the packet.</param> /// <param name="stableMaster">The stable the client is interacting with.</param> /// <param name="numStableSlots">The number of stable slots the character owns.</param> /// <param name="pets">An array of NPCs containing the ActivePet and the StabledPets</param> public static void SendStabledPetsList(IPacketReceiver receiver, Unit stableMaster, byte numStableSlots, List <PermanentPetRecord> pets) { using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_LIST_STABLED_PETS)) { byte count = 1; packet.Write(stableMaster.EntityId); packet.Write((byte)pets.Count); packet.Write(numStableSlots); foreach (var pet in pets) { // write in the Active/Stabled Pet(s) packet.Write(pet.PetNumber); packet.Write((uint)pet.EntryId); packet.Write(pet.Level); packet.Write(pet.Name); if (pet.IsActivePet && !pet.Flags.HasFlag(PetFlags.Stabled)) { packet.Write((byte)(0x01)); } else if (!pet.IsActivePet && pet.Flags.HasFlag(PetFlags.Stabled)) { packet.Write((byte)(0x02)); count++; } else { log.Warn("{0} tried to send a pet list that included a pet that is marked as both active and stabled.", receiver); } } receiver.Send(packet); } }
public static void SendItemBuyedFromPrivateShopToOwnerNotifyResponse(Asda2PrivateShop shop, List <Asda2ItemTradeRef> itemsBuyed, Character buyer) { Asda2ItemTradeRef[] asda2ItemTradeRefArray = new Asda2ItemTradeRef[6]; for (int index = 0; index < itemsBuyed.Count; ++index) { asda2ItemTradeRefArray[index] = itemsBuyed[index]; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemBuyedFromPrivateShopToOwnerNotify)) { packet.WriteInt16(shop.Owner.Asda2Inventory.Weight); packet.WriteInt32(shop.Owner.Money); packet.WriteByte( ((IEnumerable <Asda2ItemTradeRef>)asda2ItemTradeRefArray).Count <Asda2ItemTradeRef>( (Func <Asda2ItemTradeRef, bool>)(i => i != null))); packet.WriteInt32(buyer.AccId); for (int index = 0; index < 6; ++index) { Asda2Item asda2Item = asda2ItemTradeRefArray[index] == null || asda2ItemTradeRefArray[index].Item == null ? (Asda2Item)null : asda2ItemTradeRefArray[index].Item; packet.WriteInt32(asda2Item == null ? 0 : asda2Item.ItemId); packet.WriteByte(asda2Item == null ? (byte)0 : (byte)asda2Item.InventoryType); packet.WriteInt16(asda2Item == null ? 0 : (int)asda2Item.Slot); packet.WriteInt32(asda2ItemTradeRefArray[index] == null ? -1 : asda2ItemTradeRefArray[index].Amount); packet.WriteInt32(asda2ItemTradeRefArray[index] == null ? -1 : (int)asda2ItemTradeRefArray[index].TradeSlot); packet.WriteInt16(0); packet.WriteSkip(Asda2PrivateShopHandler.stub17); } shop.Owner.Send(packet, false); } }
public static void SendNewWorld(IRealmClient client, MapId map, ref Vector3 pos, float orientation) { var chr = client.ActiveCharacter; var trans = chr.Transport; // opens loading screen using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TRANSFER_PENDING, 4)) { packet.WriteUInt((uint)map); if (trans != null) { packet.Write((uint)trans.Entry.Id); packet.Write((uint)chr.MapId); } client.Send(packet); } // sends new world info using (var outPacket = new RealmPacketOut(RealmServerOpCode.SMSG_NEW_WORLD, 20)) { outPacket.WriteUInt((uint)map); if (trans != null) { outPacket.Write(chr.TransportPosition); outPacket.Write(chr.TransportOrientation); } else { outPacket.Write(pos); outPacket.WriteFloat(orientation); } client.Send(outPacket); } // client will ask for re-initialization afterwards }
public static void CreateAchievementData(RealmPacketOut packet, Character chr) { foreach (AchievementRecord completedAchievement in chr.Achievements.m_completedAchievements.Values) { packet.WriteUInt((uint)completedAchievement.AchievementEntryId); packet.WriteDateTime(completedAchievement.CompleteDate); } packet.WriteInt(0xFFFFFFFFu); /*foreach (AchievementProgressRecord achievementProgressRecord in chr.Achievements.m_achivement_progress.Values) * { * * packet.WriteUInt((uint)achievementProgressRecord.AchievementCriteriaId); * packet.WritePackedUInt64(achievementProgressRecord.Counter); // amount * chr.EntityId.WritePacked(packet); * packet.Write(0); * packet.WriteDateTime(DateTime.Now); // start time? * packet.Write(0); // Duration * packet.Write(0); * * } * packet.Write(0xFFFFFFFFu);*/ }
public static void SendStartRoll(Loot loot, LootItem item, IEnumerable <LooterEntry> looters, MapId mapid) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_START_ROLL)) { packet.Write(loot.Lootable.EntityId); packet.WriteUInt((uint)mapid); // TODO: actually use this packet.Write(item.Index); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write((int)(item.Template.RandomSuffixFactor > 0 ? -item.Template.RandomSuffixId : item.Template.RandomPropertiesId)); packet.Write(LootMgr.DefaultLootRollTimeout); packet.Write((byte)0x0F); // since 3.3: loot roll mask foreach (var looter in looters) { if (looter.Owner != null) { looter.Owner.Client.Send(packet); } } } }
public static void SendItemDisplayedResponse(Character displayer, Asda2Item item, Character reciever) { if (reciever == null) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemDisplayed)) { packet.WriteInt32(displayer.AccId); packet.WriteFixedAsciiString(displayer.Name, 20, Locale.Start); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); displayer.SendPacketToArea(packet, true, true, Locale.Any, new float?()); } } else { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.ItemDisplayed)) { packet.WriteInt32(displayer.AccId); packet.WriteFixedAsciiString(displayer.Name, 20, Locale.Start); Asda2InventoryHandler.WriteItemInfoToPacket(packet, item, false); reciever.Send(packet, false); } } }
public static void SendStatusEnqueued(Character chr, int index, BattlegroundRelation relation, BattlegroundQueue queue) { BattlegroundStatus battlegroundStatus = BattlegroundStatus.Enqueued; using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS)) { packet.Write(index); BattlegroundId id = queue.Template.Id; packet.Write((byte)0); packet.Write((byte)1); packet.Write((uint)id); packet.Write((ushort)8080); packet.Write((byte)0); packet.Write((byte)0); packet.Write(queue.InstanceId); packet.Write(false); packet.Write((int)battlegroundStatus); packet.Write(queue.AverageWaitTime); packet.Write((int)relation.QueueTime.TotalMilliseconds); chr.Send(packet, false); } }
public static void SendAuctionListItems(IPacketReceiver client, Auction[] auctions) { if (auctions == null || auctions.Length < 1) { return; } RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUCTION_LIST_RESULT, 7000); int num = 0; packet.Write(auctions.Length); foreach (Auction auction in auctions) { if (BuildAuctionPacket(auction, packet)) { ++num; } } packet.Write(num); packet.Write(300); client.Send(packet, false); packet.Close(); }
public static void SendWarEndedOneResponse(IRealmClient client, IEnumerable <Asda2Item> prizeItems) { Asda2Item[] asda2ItemArray = new Asda2Item[4]; int num = 0; foreach (Asda2Item prizeItem in prizeItems) { asda2ItemArray[num++] = prizeItem; } using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.WarEndedOne)) { packet.WriteByte(1); packet.WriteInt16(client.ActiveCharacter.Asda2Inventory.Weight); packet.WriteInt32(client.ActiveCharacter.Money); for (int index = 0; index < 4; ++index) { Asda2Item asda2Item = asda2ItemArray[index]; Asda2InventoryHandler.WriteItemInfoToPacket(packet, asda2Item, false); } client.Send(packet, true); } }
public static void SendStopMovementPacket(Unit movingUnit) { if (!movingUnit.IsAreaActive) { return; } using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MONSTER_MOVE, 25)) { movingUnit.EntityId.WritePacked(packet); packet.Write(false); // new 3.1 packet.Write(movingUnit.Position); packet.Write(Utility.GetSystemTime()); packet.Write((byte)MonsterMoveType.Stop); if (movingUnit is Character) { ((Character)movingUnit).Send(packet); return; } movingUnit.SendPacketToArea(packet); } }
public static void SendAuctionListItems(IPacketReceiver client, Auction[] auctions) { if (auctions == null || auctions.Length < 1) { return; } var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUCTION_LIST_RESULT, 7000); var count = 0; packet.Write(auctions.Length); foreach (var auction in auctions) { if (BuildAuctionPacket(auction, packet)) { count++; } } //packet.InsertIntAt(count, 0, true); packet.Write(count); packet.Write(300); client.Send(packet, addEnd: false); packet.Close(); }
public static void SendRoll(Character looter, Loot loot, LootItem item, int rollNumber, LootRollType rollType) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_ROLL)) { packet.Write((ulong)loot.Lootable.EntityId); packet.Write(item.Index); packet.Write((ulong)looter.EntityId); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write(item.Template.RandomSuffixFactor > 0U ? (int)-item.Template.RandomSuffixId : (int)item.Template.RandomPropertiesId); packet.Write(rollNumber); packet.Write((byte)rollType); foreach (LooterEntry looter1 in (IEnumerable <LooterEntry>)loot.Looters) { if (looter1.Owner != null) { looter1.Owner.Client.Send(packet, false); } } } }
public static void SendPageText(Character chr, uint pageId) { PageTextEntry entry = PageTextEntry.GetEntry(pageId); if (entry != null) { do { QueryHandler.SendPageText(chr, entry); entry = entry.NextPageEntry; } while (entry != null); } else { using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PAGE_TEXT_QUERY_RESPONSE, 100)) { packet.Write("-page is missing-"); packet.Write(0); chr.Send(packet, false); } } }