Example #1
0
        public static void Drop(YiObj owner, YiObj dropper, Item drop)
        {
            var floorItem = new FloorItem
            {
                Original = drop,
                Owner    = owner,
                MapId    = dropper.MapId,
                DropTime = DateTime.UtcNow,
                Jobs     = new List <Job>()
            };

            floorItem.UniqueId   = UniqueIdGenerator.GetNext(EntityType.FloorItem);
            floorItem.Location.X = dropper.Location.X;
            floorItem.Location.Y = dropper.Location.Y;
            QueueDrop(floorItem);
        }
Example #2
0
        public static void DropMoney(YiObj owner, YiObj dropper, int amount)
        {
            var floorItem = new FloorItem
            {
                Original = Item.Factory.CreateMoney(amount),
                Owner    = owner is Player ? owner : null,
                MapId    = dropper.MapId,
                Amount   = amount,
                DropTime = DateTime.UtcNow,
                Jobs     = new List <Job>()
            };

            if (floorItem.Amount > 0 && dropper is Player powner)
            {
                powner.Money -= floorItem.Amount;
            }

            floorItem.UniqueId   = UniqueIdGenerator.GetNext(EntityType.FloorItem);
            floorItem.Location.X = dropper.Location.X;
            floorItem.Location.Y = dropper.Location.Y;
            QueueDrop(floorItem);
        }