Esempio n. 1
0
        private PySubStruct BindInventory(ItemInventory inventoryItem, int characterID, Client client, Flags flag)
        {
            ItemInventory inventory = inventoryItem;

            // create a meta inventory only if required
            if (inventoryItem is not Ship && inventoryItem is not Character)
            {
                inventory = this.ItemFactory.MetaInventoryManager.RegisterMetaInventoryForOwnerID(inventoryItem, characterID);
            }

            // create an instance of the inventory service and bind it to the item data
            return(BoundInventory.BindInventory(this.ItemDB, inventory, flag, this.ItemFactory, this.NodeContainer, this.BoundServiceManager, client));
        }
Esempio n. 2
0
        public PyDataType GetInventoryFromId(PyInteger itemID, PyInteger one, CallInformation call)
        {
            int        callerCharacterID = call.Client.EnsureCharacterIsSelected();
            ItemEntity inventoryItem     = this.ItemManager.LoadItem(itemID);

            // also make sure it's a container
            if (inventoryItem is ItemInventory == false)
            {
                throw new ItemNotContainer(itemID);
            }

            // build the meta inventory item now
            ItemInventory inventoryByOwner = this.ItemManager.MetaInventoryManager.RegisterMetaInventoryForOwnerID(inventoryItem as ItemInventory,
                                                                                                                   callerCharacterID);

            // create an instance of the inventory service and bind it to the item data
            return(BoundInventory.BindInventory(this.ItemDB, inventoryByOwner, ItemFlags.None, this.ItemManager, this.NodeContainer, this.BoundServiceManager));
        }
Esempio n. 3
0
        public PyDataType GetInventory(PyInteger containerID, PyNone none, CallInformation call)
        {
            int callerCharacterID = call.Client.EnsureCharacterIsSelected();

            ItemFlags flag = ItemFlags.None;

            switch ((int)containerID)
            {
            case (int)ItemContainer.Wallet:
                flag = ItemFlags.Wallet;
                break;

            case (int)ItemContainer.Hangar:
                flag = ItemFlags.Hangar;
                break;

            case (int)ItemContainer.Character:
                flag = ItemFlags.Skill;
                break;

            case (int)ItemContainer.Global:
                flag = ItemFlags.None;
                break;

            default:
                throw new CustomError($"Trying to open container ID ({containerID.Value}) is not supported");
            }

            // get the inventory item first
            ItemEntity inventoryItem = this.ItemManager.LoadItem(this.mObjectID);

            // also make sure it's a container
            if (inventoryItem is ItemInventory == false)
            {
                throw new ItemNotContainer(inventoryItem.ID);
            }

            // build the meta inventory item now
            ItemInventory inventoryByOwner = this.ItemManager.MetaInventoryManager.RegisterMetaInventoryForOwnerID(inventoryItem as ItemInventory,
                                                                                                                   callerCharacterID);

            // create an instance of the inventory service and bind it to the item data
            return(BoundInventory.BindInventory(this.ItemDB, inventoryByOwner, flag, this.ItemManager, this.NodeContainer, this.BoundServiceManager));
        }