void Handle(Player player, int objId) { if (player.Owner == null) { return; } SellableObject obj = player.Owner.GetEntity(objId) as SellableObject; if (obj != null) { obj.Buy(player); } }
protected override void HandlePacket(Client client, BuyPacket packet) { client.Manager.Logic.AddPendingAction(t => { if (client.Player.Owner == null) { return; } SellableObject obj = client.Player.Owner.GetEntity(packet.ObjectId) as SellableObject; if (obj != null) { obj.Buy(client.Player); } }, PendingPriority.Networking); }