示例#1
0
        public void SendPacket(GameserverPacket pk)
        {
            pk.Write();

            List <byte> blist = new List <byte>();

            byte[] db = pk.ToByteArray();

            short len = (short)db.Length;

            blist.AddRange(BitConverter.GetBytes(len));
            blist.AddRange(db);

            Nstream.Write(blist.ToArray(), 0, blist.Count);
            Nstream.Flush();
        }
示例#2
0
 public void BroadcastPacket(GameserverPacket pk)
 {
     foreach (L2Object obj in ObjectsInside.Values)
     {
         if (obj is L2Player)
         {
             ((L2Player)obj).SendPacket(pk);
         }
         else
         {
             if (obj is L2Summon)
             {
                 ((L2Summon)obj).SendPacket(pk);
             }
         }
     }
 }
示例#3
0
        public void AddKnownObject(L2Object obj, GameserverPacket pk, bool pkuse)
        {
            if (KnownObjects.ContainsKey(obj.ObjId))
            {
                return;
            }

            KnownObjects.Add(obj.ObjId, obj);

            if (!obj.Visible)
            {
                return;
            }

            if (pkuse)
            {
                OnAddObject(obj, pk);
            }
        }
示例#4
0
 public virtual void OnAddObject(L2Object obj, GameserverPacket pk, string msg = null)
 {
 }
示例#5
0
 public virtual async Task SendPacketAsync(GameserverPacket pk)
 {
 }
示例#6
0
 public virtual async Task BroadcastPacketAsync(GameserverPacket pk, bool excludeYourself = false)
 {
     await Region.BroadcastToNeighbours(p => p.SendPacketAsync(pk), excludeYourself?(int?)ObjectId : null);
 }
示例#7
0
 public virtual void SendPacket(GameserverPacket pk)
 {
 }
示例#8
0
 public virtual void BroadcastPacket(GameserverPacket pk)
 {
     BroadcastPacket(pk, false);
 }
示例#9
0
 public virtual async Task SendPacketAsync(GameserverPacket pk)
 {
     await Task.FromResult(1);
 }
示例#10
0
 public virtual async Task BroadcastPacketAsync(GameserverPacket pk)
 {
     await BroadcastPacketAsync(pk, false);
 }