Ejemplo n.º 1
0
 public void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         itemInventory.AddItem(armourItem);
     }
     else if (Input.GetKeyDown(KeyCode.R))
     {
         itemInventory.AddItem(armourItem2);
     }
     else if (Input.GetKeyDown(KeyCode.T))
     {
         itemInventory.AddItem(weaponItem);
     }
     else if (Input.GetKeyDown(KeyCode.Y))
     {
         itemInventory.AddItem(weaponItem2);
     }
     else if (Input.GetKeyDown(KeyCode.U))
     {
         itemInventory.AddItem(healthPotion);
     }
     else if (Input.GetKeyDown(KeyCode.I))
     {
         abilityInventory.AddItem(ability);
     }
 }
Ejemplo n.º 2
0
        private ItemInventory TestInitialize()
        {
            var inventory = new ItemInventory();

            var itemsTmp = new List <Item>()
            {
                new Item("Kase", 12.3, new DateTime(2012, 2, 21), "Ehsandar", "EhsanShop"),
                new Item("Boshghab", 23, new DateTime(2000, 1, 25), "Ehsandar", "EhsanShop"),
                new Item("Ahan", 2, new DateTime(2019, 2, 1), "Gholami", "EhsanShop"),
                new Item("Alat", 4.5, new DateTime(2003, 7, 23), "Gholami", "EhsanShop"),
                new Item("Docharkhe", 123.4, new DateTime(2018, 4, 4), "Gholami", "EhsanShop"),
                new Item("Mouse", 21.3, new DateTime(2019, 1, 1), "Genius", "EhsanShop"),
                new Item("Cat", 1, new DateTime(2020, 2, 21), "Hamsayeh", "EhsanShop"),
                new Item("Car", 100000000, new DateTime(2030, 3, 29), "Iran Kh", "EhsanShop"),
                new Item("Marker", 3.45, new DateTime(2012, 5, 11), "Panter", "EhsanShop"),
                new Item("Smart Phone", 2300000, new DateTime(2017, 4, 13), "Sony", "EhsanShop"),
            };

            foreach (Item item in itemsTmp)
            {
                inventory.AddItem(item);
            }

            return(inventory);
        }
Ejemplo n.º 3
0
        public override IInventory getLoot()
        {
            IInventory iteminv = new ItemInventory();

            iteminv.AddItem(new StoneBlockItem(1), null);
            return(iteminv);
        }
Ejemplo n.º 4
0
        private void handleFromGround(string from, string to, ServerRoom room, FreeData fd)
        {
            if (from.StartsWith(Ground) && !to.StartsWith(Ground))
            {
                SimpleItemInfo info = PickupItemUtil.GetGroundItemInfo(room, fd, from);
                if (info.cat > 0)
                {
                    ItemInventory inv = fd.freeInventory.GetInventoryManager().GetInventory("ground");

                    if (inv != null)
                    {
                        inv.Clear();
                        FreeItem item = FreeItemManager.GetItem(room.FreeArgs, FreeItemConfig.GetItemKey(info.cat, info.id), info.count);
                        item.GetParameters().AddPara(new IntPara("entityId", info.entityId));
                        inv.AddItem(room.FreeArgs, item, false);

                        DragGroundOne(fd, room, to);
                    }
                    else
                    {
                        Debug.LogErrorFormat("inventory {0} not existed.", from);
                    }
                }
            }
        }
Ejemplo n.º 5
0
    private void DropToBoxinventoryFromCharacterInventory(DragAndDropParam dragAndDropParam)
    {
        ItemCell          itemCellInventory = dragAndDropParam.dragCell as ItemCell;
        ItemCell          itemCellBox       = dragAndDropParam.dropCell as ItemCell;
        PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>();

        if (itemCellInventory != null)
        {
            Debug.Log("Drop to stuck");
        }
        else
        {
            ItemInventory itemInventory = panelBoxInventory.sceneObject.GetItemInventory();
            for (int i = 0; i < itemCellBox.count; i++)
            {
                if (!itemInventory.AddItem(itemCellBox.item))
                {
                    break;
                }
                CharacterParam.itemInventory.RemoveItem(itemCellBox.item);
            }
        }
        // Update Box Inventory Panel
        panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject);
        // Update All Panels
        UIBuilder.UpdateAllPanels();
    }
Ejemplo n.º 6
0
        public ItemEntity CreateSimpleItem(string itemName, int typeID, int ownerID, int locationID, ItemFlags flag,
                                           int quantity      = 1, bool contraband = false, bool singleton = false, double x = 0.0, double y = 0.0, double z = 0.0,
                                           string customInfo = null)
        {
            int itemID = (int)this.ItemDB.CreateItem(itemName, typeID, ownerID, locationID, flag, contraband, singleton,
                                                     quantity, 0, 0, 0, null);

            ItemEntity entity = this.LoadItem(itemID);

            // check if the inventory that loads this item is loaded
            // and ensure the item is added in there
            if (this.IsItemLoaded(entity.LocationID) == true)
            {
                ItemInventory inventory = this.GetItem(entity.LocationID) as ItemInventory;

                inventory.AddItem(entity);

                // look for any metainventories too
                try
                {
                    ItemInventory metaInventory =
                        this.MetaInventoryManager.GetOwnerInventoriesAtLocation(entity.LocationID, entity.OwnerID);

                    metaInventory.AddItem(entity);
                }
                catch (ArgumentOutOfRangeException)
                {
                    // ignore the exception, this is expected when no meta inventories are registered
                }
            }

            return(entity);
        }
Ejemplo n.º 7
0
    private void OnCollisionEnter(Collision collision)
    {
        IItem item = collision.collider.GetComponent <IItem>();

        if (item != null)
        {
            inventory.AddItem(item);
        }
    }
Ejemplo n.º 8
0
 public void AddPartyMember(PartyMember partyMember)
 {
     Add(partyMember);
     foreach (KeyValuePair <string, int> pair in partyMember.Data.DefaultWeaponsToDictionary())
     {
         WeaponInventories[partyMember.CharacterClass].AddItem(pair.Key, partyMember, pair.Value < 0);
     }
     foreach (KeyValuePair <string, int> pair in partyMember.Data.DefaultShieldsToDictionary())
     {
         ShieldInventory.AddItem(pair.Key, partyMember, pair.Value < 0);
     }
     foreach (KeyValuePair <string, int> pair in partyMember.Data.DefaultItemsToDictionary())
     {
         ItemInventory.AddItem(pair.Key, partyMember, pair.Value < 0);
     }
 }
Ejemplo n.º 9
0
    /// <summary>
    /// まだ武器を購入した時のみ
    /// </summary>
    /// <param name="itemName"></param>
    /// <param name="price"></param>
    public void Buy(string itemName, int price)
    {
        //お金の変更
        cashManager.Buy(price);

        //WeaponControllerからアイテムをテキストで検索して取得
        Weapon weapon = weaponDatabase.FindByName(itemName);

        if (weapon != null)
        {
            //武器インスタンスからアイテム化
            Item purchasedWeapon = new Item(weapon);

            //インベントリにアイテム追加
            itemInventory.AddItem(purchasedWeapon);
        }
    }
    //public bool sendFungusMessage;

    //public Flowchart flowchart;



    public void Clicked()
    {
        inventory.AddItem(this);

        gameObject.SetActive(false);
    }
Ejemplo n.º 11
0
 private void AddItemToList(Item item)
 {
     itemInventory.AddItem(item);
     UpdateItemInventory();
 }
Ejemplo n.º 12
0
 public bool AddAmmo(Ammo ammo, int number)
 {
     return(_itemInventory.AddItem(ammo, number));
 }
Ejemplo n.º 13
0
        public PyDataType AssembleShip(PyInteger itemID, CallInformation call)
        {
            int callerCharacterID = call.Client.EnsureCharacterIsSelected();

            // ensure the item is loaded somewhere in this node
            // this will usually be taken care by the EVE Client
            if (this.ItemManager.IsItemLoaded(itemID) == false)
            {
                throw new CustomError("Ships not loaded for player and hangar!");
            }

            Ship      ship      = this.ItemManager.GetItem(itemID) as Ship;
            Character character = this.ItemManager.GetItem(callerCharacterID) as Character;

            if (ship.OwnerID != callerCharacterID)
            {
                throw new AssembleOwnShipsOnly();
            }

            // do not do anything if item is already assembled
            if (ship.Singleton == true)
            {
                return(new ShipAlreadyAssembled(ship.Type.Name));
            }

            // first split the stack
            if (ship.Quantity > 1)
            {
                // subtract one off the stack
                ship.Quantity -= 1;
                ship.Persist();
                // notify the quantity change
                call.Client.NotifyItemQuantityChange(ship, ship.Quantity + 1);

                // create the new item in the database
                Station station = this.ItemManager.GetStation((int)call.Client.StationID);
                ship = this.ItemManager.CreateShip(ship.Type, station, character);
                // notify the new item
                call.Client.NotifyNewItem(ship);
                // ensure the item is in the meta inventory
                try
                {
                    ItemInventory metaInventory =
                        this.ItemManager.MetaInventoryManager.GetOwnerInventoriesAtLocation(ship.LocationID, character.ID);

                    metaInventory.AddItem(ship);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                // stack of one, simple as changing the singleton flag
                ship.Singleton = true;
                call.Client.NotifySingletonChange(ship, false);
            }

            // save the ship
            ship.Persist();

            return(null);
        }
Ejemplo n.º 14
0
    // Public
    // Protected
    static protected ItemInventory GetItemInventory(XmlNode node)
    {
        // Get Inventory Attribute
        XmlAttributeCollection inventoryAttributes = node.Attributes;
        uint volume = uint.MaxValue;
        uint mass   = uint.MaxValue;

        foreach (XmlAttribute attribut in inventoryAttributes)
        {
            switch (attribut.Name)
            {
            case "volume":
                uint.TryParse(attribut.InnerText, out volume);
                break;

            case "mass":
                uint.TryParse(attribut.InnerText, out mass);
                break;
            }
        }
        // Create Empty Inventory
        ItemInventory itemInventory = new ItemInventory(volume, mass);

        // Get Items
        foreach (XmlNode itemNode in node)
        {
            XmlAttributeCollection itemAttributes = itemNode.Attributes;
            string itemName = "";
            uint   count    = 0;
            foreach (XmlAttribute attribute in itemAttributes)
            {
                switch (attribute.Name)
                {
                case "name":
                    itemName = attribute.InnerText;
                    break;

                case "count":
                    uint.TryParse(attribute.InnerText, out count);
                    break;
                }
            }
            if (itemName == "" || count == 0)
            {
                break;
            }
            // Try Get Item
            BaseItem baseItem = ItemBuilder.GetItemByName(itemName);
            if (baseItem == null)
            {
                break;
            }
            for (int i = 0; i < count; i++)
            {
                if (!itemInventory.AddItem(baseItem))
                {
                    return(itemInventory);
                }
            }
        }
        return(itemInventory);
    }