Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 public void SendCustomAnim(uint anim)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_CUSTOM_ANIM, 12))
     {
         packet.Write(EntityId);
         packet.Write(anim);
         SendPacketToArea(packet);
     }
 }
Ejemplo n.º 3
0
        /// <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);
            }
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Sends a request to wipe all talents, which must be confirmed by the player
		/// </summary>
		public static void SendClearQuery(IHasTalents thing)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_TALENT_WIPE_CONFIRM, 12))
			{
				packet.Write(thing.EntityId);
				packet.Write(thing.Talents.ResetAllPrice);

				thing.Client.Send(packet);
			}
		}
Ejemplo n.º 5
0
		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);
			}
		}
Ejemplo n.º 6
0
        /// <summary>
        /// Lets player know they are at war with a certain faction.
        /// </summary>
        public static void SendSetAtWar(IPacketReceiver client, Reputation rep)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SET_FACTION_ATWAR, 5))
			{
				packet.Write((int)rep.Faction.ReputationIndex);

				packet.Write((byte)rep.Flags); // rep flags

				client.Send(packet);
			}
		}
Ejemplo n.º 7
0
		public static void SendRequest(GameObject duelFlag, Character challenger, Character rival)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_REQUESTED))
			{
				packet.Write(duelFlag.EntityId);
				packet.Write(challenger.EntityId);

				rival.Client.Send(packet);
				challenger.Client.Send(packet);
			}
		}
Ejemplo n.º 8
0
        /*[ClientPacketHandler(RealmServerOpCode.CMSG_SET_PVP_TITLE)]
        public static void HandleSetPvPTitle(IRealmClient client, RealmPacketIn packet)
        {
        }*/


        public static void SendPVPCredit(IPacketReceiver receiver, uint points, Character victim)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PVP_CREDIT))
            {
                packet.Write(points);
                packet.Write(victim.EntityId);
                packet.Write((int)victim.PvPRank);

                receiver.Send(packet);
            }
        }
Ejemplo n.º 9
0
		public static void SendWinner(DuelWin win, Unit winner, INamed loser)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_WINNER))
			{
				packet.Write((byte)win);
				packet.Write(winner.Name);
				packet.Write(loser.Name);

				winner.SendPacketToArea(packet);
			}
		}
Ejemplo n.º 10
0
		// SMSG_CRITERIA_UPDATE
		public static void SendAchievmentStatus(AchievementProgressRecord achievementProgressRecord, Character chr)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CRITERIA_UPDATE, 4*5+8*2))
			{
				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);								// Duration left

				chr.Client.Send(packet);
			}
		}
Ejemplo n.º 11
0
 public static RealmPacketOut CreateAchievementEarnedToGuild(AchievementEntryId achievementEntryId, Character chr)
 {
     // Must be a better way to do this.
     const string msg = "|Hplayer:$N|h[$N]|h has earned the achievement $a!";
     var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
     packet.WriteByte((byte) ChatMsgType.Achievment);
     packet.WriteUInt((uint) ChatLanguage.Universal);
     packet.Write(chr.EntityId);
     packet.WriteUInt(5);
     packet.Write(chr.EntityId);
     packet.WriteUIntPascalString(msg);
     packet.WriteByte(0);
     packet.WriteUInt((uint) achievementEntryId);
     return packet;
 }
Ejemplo n.º 12
0
 private void SendGetStabledPetsListPacket()
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_LIST_STABLED_PETS))
     {
         packet.Write(Cat.EntityId);
         Master.FakeClient.ReceiveCMSG(packet, true, true);
     }
 }
Ejemplo n.º 13
0
 public static void SendStableResult(IPacketReceiver receiver, StableResult result)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_STABLE_RESULT, 1))
     {
         packet.Write((byte)result);
         receiver.Send(packet);
     }
 }
Ejemplo n.º 14
0
 public static void SendTameFailure(IPacketReceiver receiver, TameFailReason reason)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_TAME_FAILURE, 1))
     {
         packet.Write((byte)reason);
         receiver.Send(packet);
     }
 }
Ejemplo n.º 15
0
 public static void SendOutOfBounds(Character duelist, int cancelDelayMillis)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_OUTOFBOUNDS, 4))
     {
         packet.Write(cancelDelayMillis);
         duelist.Send(packet, false);
     }
 }
Ejemplo n.º 16
0
 public static void SendUpdateResponse(IPacketReceiver client, TicketInfoResponse response)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GMTICKET_UPDATETEXT))
     {
         packet.Write((uint)response);
         client.Send(packet);
     }
 }
Ejemplo n.º 17
0
 /// <summary>Sends a ping reply to the client.</summary>
 /// <param name="client">the client to send to</param>
 /// <param name="sequence">the sequence number sent by client</param>
 public static void SendPingReply(IPacketReceiver client, uint sequence)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_PONG, 4))
     {
         packet.Write(sequence);
         client.Send(packet, false);
     }
 }
Ejemplo n.º 18
0
 public static void SendQuestForceRemoved(IRealmClient client, QuestTemplate quest)
 {
     using (var pkt = new RealmPacketOut(RealmServerOpCode.SMSG_QUEST_FORCE_REMOVE, 4))
     {
         pkt.Write((uint)quest.Id);
         client.Send(pkt);
     }
 }
Ejemplo n.º 19
0
 public static void SendActivateTaxiReply(IPacketReceiver client, TaxiActivateResponse response)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ACTIVATETAXIREPLY, 4))
     {
         packet.Write((uint)response);
         client.Send(packet, addEnd: false);
     }
 }
Ejemplo n.º 20
0
 public static void SendBankSlotResult(Character chr, BuyBankBagResponse response)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BUY_BANK_SLOT_RESULT, 4))
     {
         packet.Write((uint)response);
         chr.Send(packet);
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 /// An instance has been saved
 /// </summary>
 public static void SendInstanceSave(IPacketReceiver client, MapId mapId)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_LAST_INSTANCE, 4))
     {
         packet.Write((int)mapId);
         client.Send(packet);
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Warns a player within the instance that the leader is attempting to reset the instance
 /// </summary>
 /// <param name="client"></param>
 public static void SendResetWarning(IPacketReceiver client, MapId map)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_RESET_FAILED_NOTIFY, 4))
     {
         packet.Write((uint)map);
         client.Send(packet);
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Send packet generated by the server to initialize authentification
 /// </summary>
 /// <param name="client">the client to send to</param>
 public static void SendAuthChallenge(IRealmClient client)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_CHALLENGE))
     {
         packet.Write(1);
         packet.Write(ServerApp <WCell.RealmServer.RealmServer> .Instance.AuthSeed);
         packet.WriteUInt(4082343331U);
         packet.WriteUInt(1854228409);
         packet.WriteUInt(2590679800U);
         packet.WriteUInt(2767286516U);
         packet.WriteUInt(4082343331U);
         packet.WriteUInt(1854228409);
         packet.WriteUInt(2590679800U);
         packet.WriteUInt(2767286516U);
         client.Send(packet, false);
     }
 }
Ejemplo n.º 24
0
 private void SendPetTalentResetPacket()
 {
     using (var packet = new RealmPacketOut((RealmServerOpCode.CMSG_PET_UNLEARN)))
     {
         packet.Write(Cat.EntityId);
         Master.FakeClient.ReceiveCMSG(packet, true, true);
     }
 }
Ejemplo n.º 25
0
 public void GetMail(TestCharacter getter)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.CMSG_GET_MAIL_LIST))
     {
         packet.Write(EntityId.Zero);
         getter.FakeClient.ReceiveCMSG(packet, true);
     }
 }
Ejemplo n.º 26
0
 public static void SendUseEquipmentSetResult(IPacketReceiver client, UseEquipmentSetError error)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_USE_EQUIPMENT_SET_RESULT))
     {
         packet.Write((byte)error);
         client.Send(packet, false);
     }
 }
Ejemplo n.º 27
0
 public static void SendFriendOnline(Character target, Character friend, string note, bool justAdded)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_FRIEND_STATUS))
     {
         packet.WriteByte(justAdded ? (byte)6 : (byte)2);
         packet.Write(friend.EntityId);
         if (justAdded)
         {
             packet.WriteCString(note ?? string.Empty);
         }
         packet.WriteByte((byte)friend.Status);
         packet.Write((int)friend.Zone.Id);
         packet.WriteUInt(friend.Level);
         packet.WriteUInt((byte)friend.Class);
         target.Client.Send(packet, false);
     }
 }
Ejemplo n.º 28
0
 public static void SendGameObjectTextPage(IPacketReceiver rcv, IEntity obj)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_PAGETEXT, 8))
     {
         packet.Write(obj.EntityId);
         rcv.Send(packet, false);
     }
 }
Ejemplo n.º 29
0
 public static void SendBreakTarget(IPacketReceiver rcvr, IEntity target)
 {
     using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_BREAK_TARGET, 8))
     {
         packet.Write((ulong)target.EntityId);
         rcvr.Send(packet, false);
     }
 }
Ejemplo n.º 30
0
 public static void SendAuthChallengeFailReply(IRealmClient client, AccountStatus error)
 {
     if (error == AccountStatus.AccountBanned)
     {
         AuthenticationHandler.SendDisconnectResponse(client, DisconnectStatus.AccountBanned);
     }
     else
     {
         using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.AuthorizeResponse))
         {
             packet.Write((int)error);
             packet.Write((short)5);
             packet.Write((byte)0);
             client.Send(packet, false);
         }
     }
 }
Ejemplo n.º 31
0
 public static void SendUpdateSearch(IRealmClient client)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_LFG_UPDATE_SEARCH))
     {
         packet.Write(true);
         client.Send(packet, false);
     }
 }
Ejemplo n.º 32
0
 public static void SendCountdown(Character duelist, uint millis)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_COUNTDOWN, 4))
     {
         packet.Write(millis);
         duelist.Send(packet, false);
     }
 }
Ejemplo n.º 33
0
 public static void SendTutorialFlags(Character chr)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_TUTORIAL_FLAGS, 32))
     {
         packet.Write(chr.TutorialFlags.FlagData);
         chr.Client.Send(packet, false);
     }
 }
Ejemplo n.º 34
0
 public static void SendBootPlayer(IRealmClient client)
 {
     // SMSG_LFG_BOOT_PLAYER
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LFG_BOOT_PROPOSAL_UPDATE))
     {
         packet.WriteByte(true);                                         // Vote in progress
         packet.WriteByte(false);                                        // Did player Vote
         packet.WriteByte(true);                                         // Did player pass the motion
         packet.Write(EntityId.Zero);                                    // EntityID of player being voted on
         packet.WriteUInt(0);                                            // Total votes
         packet.WriteUInt(0);                                            // Count of votes to boot
         packet.WriteUInt(0);                                            // Time left in seconds
         packet.WriteUInt(0);                                            // Needed Votes
         packet.Write("Too noobzor for this l33t grpz");                 // Kick reason
         client.Send(packet);
     }
 }
Ejemplo n.º 35
0
 public static void SendCreateResponse(IPacketReceiver client, TicketInfoResponse response)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GMTICKET_CREATE))
     {
         packet.Write((uint)response);
         client.Send(packet, addEnd: false);
     }
 }
Ejemplo n.º 36
0
 public static void SendEmptySpells(IPacketReceiver receiver)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PET_SPELLS, 8))
     {
         packet.Write(0L);
         receiver.Send(packet);
     }
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Notifies the Client that there is new mail
 /// </summary>
 public static void SendNotify(IRealmClient client)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_RECEIVED_MAIL, 4))
     {
         packet.Write(0);
         client.Send(packet);
     }
 }
Ejemplo n.º 38
0
 /// <summary>Send a "time query" reply to the client.</summary>
 /// <param name="client">the client to send to</param>
 public static void SendQueryTimeReply(IRealmClient client)
 {
     using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_QUERY_TIME_RESPONSE, 4))
     {
         packet.Write(Utility.GetEpochTime());
         client.Send(packet, false);
     }
 }
Ejemplo n.º 39
0
        public void SendMessage(string message)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT))
            {
                packet.Write((byte)17);
                packet.Write(7U);
                packet.Write((ulong)EntityId.Zero);
                packet.WriteCString("");
                packet.Write((ulong)EntityId.Zero);
                packet.WriteUIntPascalString(message);
                packet.Write((byte)0);
                ChannelHandler.SendPacketToChannel(this, packet);
            }

            ChatMgr.ChatNotify((IChatter)null, message, ChatLanguage.Common, ChatMsgType.Channel,
                               (IGenericChatTarget)this);
        }
Ejemplo n.º 40
0
 /// <summary>Makes the given faction visible to the client.</summary>
 public static void SendVisible(IPacketReceiver client, FactionReputationIndex reputationIndex)
 {
     using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SET_FACTION_VISIBLE, 4))
     {
         packet.Write((int)reputationIndex);
         client.Send(packet, false);
     }
 }
Ejemplo n.º 41
0
		/// <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);
			}
		}
Ejemplo n.º 42
0
		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);
			}
		}
Ejemplo n.º 43
0
        public static void SendBattlefieldList(Character chr, GlobalBattlegroundQueue queue)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
            {
                var fromGUI = true;

                packet.Write((long)0);
                packet.Write(fromGUI);                                                  // since 3.1.1
                packet.Write((uint)queue.Template.Id);
                packet.Write((byte)queue.BracketId);                                    // BracketId
                packet.Write((byte)0);                                                  // since 3.3

                var pos = packet.Position;
                packet.Position += 4;

                var count = 0;
                for (var i = 0; i < queue.Instances.Count; i++)
                {
                    var bg = queue.Instances[i];
                    if (chr.Role.IsStaff || bg.CanEnter(chr))
                    {
                        packet.Write(bg.InstanceId);
                        count++;
                    }
                }

                packet.Position = pos;
                packet.Write(count);

                chr.Send(packet);
            }
        }
Ejemplo n.º 44
0
        /// <summary>Sends the quest giver quest list.</summary>
        /// <param name="qHolder">The quest giver.</param>
        /// <param name="list">The list.</param>
        /// <param name="chr">The character.</param>
        public static void SendQuestList(IQuestHolder qHolder, List <QuestTemplate> list, Character chr)
        {
            using (RealmPacketOut packet =
                       new RealmPacketOut(new PacketId(RealmServerOpCode.SMSG_QUESTGIVER_QUEST_LIST)))
            {
                packet.Write(qHolder.EntityId);
                if (qHolder.QuestHolderInfo == null)
                {
                    return;
                }
                packet.Write("Stay a while and listen...");
                packet.Write(0U);
                packet.Write(1U);
                int num = Math.Min(20, list.Count);
                packet.Write((byte)num);
                foreach (QuestTemplate questTemplate in list)
                {
                    packet.Write(questTemplate.Id);
                    Quest activeQuest = chr.QuestLog.GetActiveQuest(questTemplate.Id);
                    if (activeQuest != null)
                    {
                        if (activeQuest.CompleteStatus == QuestCompleteStatus.Completed)
                        {
                            packet.Write(4);
                        }
                        else
                        {
                            packet.Write(5U);
                        }
                    }
                    else
                    {
                        uint availability = (uint)questTemplate.GetAvailability(chr);
                        packet.Write(availability);
                    }

                    packet.WriteUInt(questTemplate.Level);
                    packet.WriteUInt((uint)questTemplate.Flags);
                    packet.Write((byte)0);
                    packet.WriteCString(questTemplate.DefaultTitle);
                }

                chr.Client.Send(packet, false);
            }
        }
Ejemplo n.º 45
0
        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);
            }
        }
Ejemplo n.º 46
0
        public static void SendQuestConfirmAccept(IRealmClient client)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUEST_CONFIRM_ACCEPT))
            {
                packet.Write(0);

                client.Send(packet);
            }
        }
Ejemplo n.º 47
0
		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);
			}
		}
Ejemplo n.º 48
0
		public static void SendCountdown(Character duelist, uint millis)
		{
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_COUNTDOWN, 4))
            {
                packet.Write(millis);

                duelist.Send(packet);
            }
		}
Ejemplo n.º 49
0
		/// <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);
			}
		}
Ejemplo n.º 50
0
		public static void SendOutOfBounds(Character duelist, uint cancelDelayMillis)
		{
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_OUTOFBOUNDS, 4))
            {
                packet.Write(cancelDelayMillis);

                duelist.Send(packet);
            }
		}
Ejemplo n.º 51
0
        public void SendDespawn()
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GAMEOBJECT_DESPAWN_ANIM, 8))
            {
                packet.Write(EntityId);

                SendPacketToArea(packet);
            }
        }
Ejemplo n.º 52
0
		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);
			}
		}
Ejemplo n.º 53
0
        public static void SendInitWorldStates(IPacketReceiver rcv, WorldStateCollection states, Zone newZone)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INIT_WORLD_STATES, 300))
            {
                packet.Write((uint)newZone.Map.Id);
                packet.Write((uint)newZone.ParentZoneId);
                packet.Write((uint)newZone.Id);

                var countPos = packet.Position;
                packet.Position += 2;

                var count = AppendWorldStates(packet, newZone);

                packet.Position = countPos;
                packet.Write((ushort)count);

                rcv.Send(packet);
            }
        }
Ejemplo n.º 54
0
		/// <summary>
		/// Send a "time query" reply to the client.
		/// </summary>
		/// <param name="client">the client to send to</param>
		public static void SendQueryTimeReply(IRealmClient client)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUERY_TIME_RESPONSE, 4))
			{
				packet.Write(Utility.GetEpochTime());
				//packet.Write(Utility.GetSystemTime());

				client.Send(packet);
			}
		}
Ejemplo n.º 55
0
		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);
			}
		}
Ejemplo n.º 56
0
		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);
			}
		}
Ejemplo n.º 57
0
		public static void SendAddOnInfoPacket(IRealmClient client)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ADDON_INFO))
			{
				//Fix for reading past the end of stream
				//Due to fake clients!
				if (client.Addons.Length > 0)
				{
					int unk;
					using (var binReader = new BinaryReader(new MemoryStream(client.Addons)))
					{
						var addonCount = binReader.ReadInt32();
						for (var i = 0; i < addonCount; i++)
						{
							var addon = ReadAddOn(binReader);
							WriteAddOnInfo(packet, addon);
						}

						unk = binReader.ReadInt32();
					}
					Console.WriteLine("CMSG ADDON Unk: " + unk);
				}

				

				const int count = 0;
				packet.Write(count);

				for (int i = 0; i < count; i++)
				{
					packet.Write(0);
					packet.Write(new byte[16]);
					packet.Write(new byte[16]);
					packet.Write(0);
					packet.Write(0);
				}

				client.Send(packet);
			}

			client.Addons = null;
		}
Ejemplo n.º 58
0
		/// <summary>
		/// Make sure, we have a valid target before calling this method
		/// </summary>
		public static void SendCombatStop(Unit chr, Unit opponent, bool includeSelf)
		{
			using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ATTACKSTOP, 20)) {
				chr.EntityId.WritePacked(packet);
				if (opponent != null)
					opponent.EntityId.WritePacked(packet);
				packet.Write(0);

				chr.PushPacketToSurroundingArea(packet, includeSelf, false);
			}
		}
Ejemplo n.º 59
0
 //SMSG_SERVER_FIRST_ACHIEVEMENT
 public static void SendServerFirstAchievement(AchievementEntryId achievementEntryId, Character chr)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SERVER_FIRST_ACHIEVEMENT, chr.Name.Length + 1 + 8 + 4 + 4))
     {
         packet.WriteCString(chr.Name);
         packet.Write(chr.EntityId);
         packet.WriteUInt((uint)achievementEntryId);
         packet.WriteUInt(0);
         World.Broadcast(packet);
     }
 }
Ejemplo n.º 60
0
		/// <summary>
		/// Sends to the specified client the Who List based on the given characters
		/// </summary>
		/// <param name="client">The client to send the list</param>
		/// <param name="characters">The list of characters that matched the Who List search</param>
		public static void SendWhoList(IPacketReceiver client, ICollection<Character> characters)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_WHO))
			{
				packet.Write(characters.Count);
				packet.Write(characters.Count);

				foreach (Character character in characters)
				{
					packet.WriteCString(character.Name);
                    packet.WriteCString(character.Guild != null ? character.Guild.Name : string.Empty); //TODO: Add Guild name here
					packet.Write(character.Level);
					packet.WriteUInt((byte)character.Class);
					packet.WriteUInt((byte)character.Race);
					packet.WriteByte(0); //New in 2.4.x
					packet.Write(character.Zone != null ? (uint)character.Zone.Id : 0);
				}
				client.Send(packet);
			}
		}