Beispiel #1
0
        /// <summary>
        /// Sends a packet to all nearby characters.
        /// </summary>
        /// <param name="packet">the packet to send</param>
        /// <param name="radius">the radius of the area to send to</param>
        /// <param name="includeSelf">whether or not to send the packet to ourselves (if we're a character)</param>
        public virtual void SendPacketToArea(RealmPacketOut packet, float radius, bool includeSelf)
        {
            if (radius > 0)
            {
                this.IterateEnvironment(radius, obj =>
                {
                    if ((obj is NPC) && ((NPC)obj).CharmerCharacter != null)
                    {
                        (((NPC)obj).CharmerCharacter).Send(packet.GetFinalizedPacket());
                    }

                    if (obj is Character)
                    {
                        ((Character)obj).Send(packet.GetFinalizedPacket());
                    }
                    return(true);
                });
            }
            else
            {
                for (var i = m_Map.Characters.Count - 1; i >= 0; i--)
                {
                    m_Map.Characters[i].Send(packet.GetFinalizedPacket());
                }
            }
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public void AddPacket(RealmPacketOut packet)
 {
     if (packet.ContentLength > byte.MaxValue)
     {
         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);
 }
Beispiel #4
0
        /// <summary>
        /// Sends a packet to all nearby characters.
        /// </summary>
        /// <param name="packet">the packet to send</param>
        public virtual void SendPacketToArea(RealmPacketOut packet)
        {
            if (IsAreaActive)
            {
                this.IterateEnvironment(BroadcastRange, obj =>
                {
                    if ((obj is NPC) && ((NPC)obj).CharmerCharacter != null)
                    {
                        (((NPC)obj).CharmerCharacter).Send(packet.GetFinalizedPacket());
                    }

                    if (obj is Character)
                    {
                        ((Character)obj).Send(packet.GetFinalizedPacket());
                    }
                    return(true);
                });
            }
        }
Beispiel #5
0
        static void DoPacketAnalyzr()
        {
            DebugHelper.Init();
            var packet = new RealmPacketOut(RealmServerOpCode.CMSG_MESSAGECHAT, 40);

            packet.Write((uint)ChatMsgType.Guild);
            packet.Write((uint)ChatLanguage.DemonTongue);
            packet.WriteCString("huhu Guild!");

            DebugHelper.DumpPacket(packet.GetFinalizedPacket());
        }
Beispiel #6
0
		/// <summary>
		/// Sends a packet to all nearby characters.
		/// </summary>
		/// <param name="packet">the packet to send</param>
		/// <param name="includeSelf">whether or not to send the packet to ourselves (if we're a character)</param>
		public virtual void SendPacketToArea(RealmPacketOut packet, bool includeSelf)
		{
			if (IsAreaActive)
			{
				this.IterateEnvironment(BroadcastRange, obj =>
				{
					if ((obj is NPC) && ((NPC)obj).CharmerCharacter != null)
					{
						(((NPC)obj).CharmerCharacter).Send(packet.GetFinalizedPacket());
					}

					if (obj is Character)
					{
						((Character)obj).Send(packet.GetFinalizedPacket());
					}
					return true;
				});
			}
		}
Beispiel #7
0
		/// <summary>
		/// Sends a packet to all nearby characters.
		/// </summary>
		/// <param name="packet">the packet to send</param>
		/// <param name="radius">the radius of the area to send to</param>
		/// <param name="includeSelf">whether or not to send the packet to ourselves (if we're a character)</param>
		public virtual void SendPacketToArea(RealmPacketOut packet, float radius, bool includeSelf)
		{
			if (radius > 0)
			{
				this.IterateEnvironment(radius, obj =>
				{
					if ((obj is NPC) && ((NPC)obj).CharmerCharacter != null)
					{
						(((NPC)obj).CharmerCharacter).Send(packet.GetFinalizedPacket());
					}

					if (obj is Character)
					{
						((Character)obj).Send(packet.GetFinalizedPacket());
					}
					return true;
				});
			}
			else
			{
				for (var i = m_Map.Characters.Count - 1; i >= 0; i--)
				{
					m_Map.Characters[i].Send(packet.GetFinalizedPacket());
				}
			}
		}
Beispiel #8
0
		public void Send(RealmPacketOut packet)
		{
			//_server.Debug(this, Resources.SendingPacket, packet, packet.Length);
			Send(packet.GetFinalizedPacket());
		}
Beispiel #9
0
		/// <summary>
		/// Sends a packet to all nearby characters.
		/// </summary>
		/// <param name="packet">the packet to send</param>
		public virtual void SendPacketToArea(RealmPacketOut packet)
		{
			if (IsAreaActive)
			{
				this.IterateEnvironment(BroadcastRange, obj =>
				{
					if (obj is Character)
					{
						((Character)obj).Send(packet.GetFinalizedPacket());
					}
					return true;
				});
			}
		}
Beispiel #10
0
 public void Send(RealmPacketOut packet)
 {
     //_server.Debug(this, Resources.SendingPacket, packet, packet.Length);
     Send(packet.GetFinalizedPacket());
 }
 public void Send(RealmPacketOut packet, bool addEnd = false)
 {
     byte[] finalizedPacket = packet.GetFinalizedPacket();
     ForeachCharacter(chr => chr.Send(finalizedPacket));
 }