Beispiel #1
0
        public MapItem PutItem(ClientSession Session, short type, short slot, short amount, out Inventory inv)
        {
            Random rnd = new Random();
            int random = 0;
            inv = Session.Character.InventoryList.LoadBySlotAndType(slot, type);
            MapItem DroppedItem = null;
            if (amount <= inv.InventoryItem.Amount)
            {
                DroppedItem = new MapItem((short)(rnd.Next(Session.Character.MapX - 2, Session.Character.MapX + 3)), (short)(rnd.Next(Session.Character.MapY - 2, Session.Character.MapY + 3)))
                {
                    Amount = amount,
                    Color = inv.InventoryItem.Color,
                    Concentrate = inv.InventoryItem.Concentrate,
                    CriticalLuckRate = inv.InventoryItem.CriticalLuckRate,
                    CriticalRate = inv.InventoryItem.CriticalRate,
                    DamageMaximum = inv.InventoryItem.DamageMaximum,
                    DamageMinimum = inv.InventoryItem.DamageMinimum,
                    DarkElement = inv.InventoryItem.DarkElement,
                    DistanceDefence = inv.InventoryItem.DistanceDefence,
                    DefenceDodge = inv.InventoryItem.DefenceDodge,
                    DistanceDefenceDodge = inv.InventoryItem.DistanceDefenceDodge,
                    ElementRate = inv.InventoryItem.ElementRate,
                    FireElement = inv.InventoryItem.FireElement,
                    HitRate = inv.InventoryItem.HitRate,
                    WaterElement = inv.InventoryItem.WaterElement,
                    SlHit = inv.InventoryItem.SlHit,
                    ItemVNum = inv.InventoryItem.ItemVNum,
                    LightElement = inv.InventoryItem.LightElement,
                    MagicDefence = inv.InventoryItem.MagicDefence,
                    RangeDefence = inv.InventoryItem.RangeDefence,
                    Rare = inv.InventoryItem.Rare,
                    SlDefence = inv.InventoryItem.SlDefence,
                    SlElement = inv.InventoryItem.SlElement,
                    SlHP = inv.InventoryItem.SlHP,
                    Upgrade = inv.InventoryItem.Upgrade
                };
                while (Session.CurrentMap.DroppedList.ContainsKey(random = rnd.Next(1, 999999)))
                { }
                DroppedItem.InventoryItemId = random;
                Session.CurrentMap.DroppedList.Add(random, DroppedItem);
                inv.InventoryItem.Amount = (short)(inv.InventoryItem.Amount - amount);
                Session.Character.InventoryList.InsertOrUpdate(ref inv);

            }
            return DroppedItem;
        }