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(); }
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); } } } }
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); } }
public virtual void OnAddObject(L2Object obj, GameserverPacket pk, string msg = null) { }
public virtual async Task SendPacketAsync(GameserverPacket pk) { }
public virtual async Task BroadcastPacketAsync(GameserverPacket pk, bool excludeYourself = false) { await Region.BroadcastToNeighbours(p => p.SendPacketAsync(pk), excludeYourself?(int?)ObjectId : null); }
public virtual void SendPacket(GameserverPacket pk) { }
public virtual void BroadcastPacket(GameserverPacket pk) { BroadcastPacket(pk, false); }
public virtual async Task SendPacketAsync(GameserverPacket pk) { await Task.FromResult(1); }
public virtual async Task BroadcastPacketAsync(GameserverPacket pk) { await BroadcastPacketAsync(pk, false); }