Exemple #1
0
        internal void ToGround(int itemID, string to, string from)
        {
            //Console.WriteLine("moveItem: Trying to move item: from Inventory " + from + " to ground " + to);
            Item item          = null;
            int  inventorySlot = ItemLocationInventory.GetInventorySlotId(from);

            if (inventorySlot < 0)
            {
                return;
            }
            else
            {
                item = player.GetEquipment(from);
                if (item == null)
                {
                    return;
                }
                else
                {
                    if (item.Id != itemID)
                    {
                        Console.WriteLine("ItemMove: The item id on slot: " + inventorySlot + " does not match with " + itemID);
                    }
                }
            }

            Location toGameLocation = Location.Parse(to);

            moveItemToGround(item, inventorySlot, toGameLocation);
            return;
        }
Exemple #2
0
        internal void ToInventory(int itemID, string to, ItemLocationContainer containerLoc)
        {
            int toSlotId = ItemLocationInventory.GetInventorySlotId(to);

            if (toSlotId < 1)
            {
                //Console.WriteLine("moveItem: The inventory location: " + to + " is invalid.");
                return;
            }
            moveItemToInventory(containerLoc.item, containerLoc.Slot, containerLoc.ContainerIndex, toSlotId);
        }
Exemple #3
0
        public Item GetEquipment(string location)
        {
            int slotId = ItemLocationInventory.GetInventorySlotId(location);

            if (slotId < 1)
            {
                Console.WriteLine("| Inventory: location " + location + " not found");
                return(null);
            }
            return(playerReader.GetInventoryItem((InventoryLocation)slotId));
        }
Exemple #4
0
        internal void ToInventory(int itemID, string to, string from)
        {
            //Console.WriteLine("moveItem: Trying to move item: from ground " + from + " to inventory " + to);
            Location fromGameLocation = Location.Parse(from);

            int inventorySlot = ItemLocationInventory.GetInventorySlotId(to);

            if (inventorySlot < 0)
            {
                Console.WriteLine("moveItem: Invalid inventory slot: " + inventorySlot);
                return;
            }

            //should check the item id on ground
            //if ground item.id == itemID

            moveItemToInventory(fromGameLocation, inventorySlot);
        }
Exemple #5
0
        internal void ToContainer(int itemID, string to, string from)
        {
            //Console.WriteLine("moveItem: Trying to move item: from Inventory " + from + " to container " + to);
            Item item          = null;
            int  inventorySlot = ItemLocationInventory.GetInventorySlotId(from);

            if (inventorySlot < 0)
            {
                return;
            }
            else
            {
                item = player.GetEquipment(from);
                if (item == null)
                {
                    return;
                }
                else
                {
                    if (item.Id != itemID)
                    {
                        Console.WriteLine("ItemMove: The item id on slot: " + inventorySlot + " does not match with " + itemID);
                    }
                }
            }

            Container destination = game.GetContainer(Convert.ToInt32(to));

            if (destination == null)
            {
                Console.WriteLine("moveItem: Could not found a container with index: " + to);
                return;
            }

            moveItemToContainer(item, inventorySlot, destination);
        }
Exemple #6
0
        internal void ToInventory(int itemID, string to, string from)
        {
            //Console.WriteLine("moveItem: Trying to move item: from Inventory " + from + " to Inventory " + to);
            Item item     = null;
            int  fromSlot = ItemLocationInventory.GetInventorySlotId(from);

            if (fromSlot < 0)
            {
                return;
            }
            else
            {
                item = player.GetEquipment(from);
                if (item == null)
                {
                    return;
                }
                else
                {
                    if (item.Id != itemID)
                    {
                        Console.WriteLine("ItemMove: The item id on slot: " + fromSlot + " does not match with " + itemID);
                    }
                }
            }

            int toSlot = ItemLocationInventory.GetInventorySlotId(to);

            if (toSlot < 0)
            {
                Console.WriteLine("ItemMove: Invalid slot location " + to);
                return;
            }

            moveItemToInventory(item, fromSlot, toSlot);
        }