Exemplo n.º 1
0
 public void OnDbLoad()
 {
     this.Template     = Database.ItemTemplates.TryGet(this.Entry);
     this.DisplayID    = this.Template.DisplayID;
     this.Type         = (InventoryTypes)this.Template.InvType;
     this.SpellCharges = this.Template.SpellCharges;
     this.EquipSlot    = PrefInvSlot();
 }
Exemplo n.º 2
0
 public InventoryViewModel()
 {
     this.InventoryTypes = new Dictionary <int, string>();
     InventoryTypes.Add((int)InventoryTypeLookup.RawMaterials, InventoryTypeLookup.RawMaterials.ToString());
     InventoryTypes.Add((int)InventoryTypeLookup.WorkInProgress, InventoryTypeLookup.WorkInProgress.ToString());
     InventoryTypes.Add((int)InventoryTypeLookup.FinishedGoods, InventoryTypeLookup.FinishedGoods.ToString());
     InventoryTypes.Add((int)InventoryTypeLookup.PackingMaterial, InventoryTypeLookup.PackingMaterial.ToString());
     InventoryTypes.Add((int)InventoryTypeLookup.Supplies, InventoryTypeLookup.Supplies.ToString());
 }
    public void DisplayUI()
    {
        Bag = inventoryObject.Bag;
        List <inventoryItems> obj = Bag;

        BackPack = new InventoryTypes[obj.Count];
        for (int i = 0; i < obj.Count; i++)
        {
            BackPack[i]          = new InventoryTypes();
            BackPack[i].name     = obj[i].item.typeOfResource;
            BackPack[i].icon     = obj[i].item.icon;
            BackPack[i].resource = obj[i].item;
        }

        for (int i = 0; i < obj.Count; i++)
        {
            if (obj[i].amount <= obj[i].item.perStack)
            {
                BackPack[i].pack    = new int[1];
                BackPack[i].UI      = new Button[1];
                BackPack[i].pack[0] = obj[i].amount;
            }

            if (obj[i].amount > obj[i].item.perStack)
            {
                if (obj[i].amount % obj[i].item.perStack == 0)
                {
                    BackPack[i].pack = new int[(obj[i].amount / obj[i].item.perStack)];
                    BackPack[i].UI   = new Button[(obj[i].amount / obj[i].item.perStack)];
                    for (int j = 0; j < BackPack[i].pack.Length; j++)
                    {
                        BackPack[i].pack[j] = obj[i].item.perStack;
                    }
                }

                if (obj[i].amount % obj[i].item.perStack != 0)
                {
                    BackPack[i].pack = new int[(obj[i].amount / obj[i].item.perStack) + 1];
                    for (int j = 0; j < BackPack[i].pack.Length; j++)
                    {
                        if (j < BackPack[i].pack.Length - 1)
                        {
                            BackPack[i].pack[j] = obj[i].item.perStack;
                        }
                        if (j == BackPack[i].pack.Length - 1)
                        {
                            BackPack[i].pack[j] = obj[i].amount - closestNumber(obj[i].amount, obj[i].item.perStack);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
        public List <UnitObject> GetItemsOfInventoryType(InventoryTypes type)
        {
            List <UnitObject> tmp = new List <UnitObject>();

            foreach (UnitObject item in UnitObject.Items)
            {
                if (item.InventoryLocationIndex == (int)type)
                {
                    tmp.Add(item);
                }
            }

            return(tmp);
        }
Exemplo n.º 5
0
 private void tscb_area_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tscb_area.SelectedItem.ToString() == "Cube")
     {
         INVENTORYTYPE = InventoryTypes.Cube;
     }
     else if (tscb_area.SelectedItem.ToString() == "Inventory")
     {
         INVENTORYTYPE = InventoryTypes.Inventory;
     }
     else if (tscb_area.SelectedItem.ToString() == "Stash")
     {
         INVENTORYTYPE = InventoryTypes.Stash;
     }
 }
        public Inventory(InventoryTypes type, decimal cost, DateTime registrationDate, DateTime expirationDate, Location loc)
        {
            this.type             = type;
            this.cost             = cost;
            this.registrationDate = registrationDate;
            this.expirationDate   = expirationDate;

            if (loc.Equals(null))
            {
                this.loc = new Location("ERROR", -1, -1, -1);
            }
            else
            {
                this.loc = loc;
            }
        }
        public InventoryTypeViewModel(EFDbContext context)
        {
            _context = context;
            repo     = new EFRepository <InventoryType>(context);
            Refresh();

            Window window;

            if (Identity.IsAuthorized())
            {
                window = new InventoryTypes(this);
            }
            else
            {
                window = new UnauthInventoryTypes(this);
            }
            window.ShowDialog();
        }
Exemplo n.º 8
0
        public PacketWriter CreateItem()
        {
            //Ensure values are right
            this.ObjectType |= ObjectTypes.TYPE_ITEM;

            if (this.Template == null)
            {
                this.Template = Database.ItemTemplates.TryGet(this.Entry);
            }

            this.DisplayID    = this.Template.DisplayID;
            this.Type         = (InventoryTypes)this.Template.InvType;
            this.SpellCharges = this.Template.SpellCharges;
            this.EquipSlot    = PrefInvSlot();

            //List management
            Database.Items.TryAdd(this);
            return(this.BuildUpdate());
        }
Exemplo n.º 9
0
        public static void AddInventoriesToFetch(InventoryTypes type, SteamID botId)
        {
            switch (type)
            {
            case InventoryTypes.TF2:
                AddInventoriesToFetch(440, 2, botId);
                break;

            case InventoryTypes.Dota2:
                AddInventoriesToFetch(570, 2, botId);
                break;

            case InventoryTypes.Portal2:
                AddInventoriesToFetch(620, 2, botId);
                break;

            case InventoryTypes.CSGO:
                AddInventoriesToFetch(730, 2, botId);
                break;

            case InventoryTypes.SpiralKnights:
                AddInventoriesToFetch(99900, 0, botId);
                break;

            case InventoryTypes.SteamGifts:
                AddInventoriesToFetch(753, 1, botId);
                break;

            case InventoryTypes.SteamCoupons:
                AddInventoriesToFetch(753, 3, botId);
                break;

            case InventoryTypes.SteamCommunity:
                AddInventoriesToFetch(753, 6, botId);
                break;

            case InventoryTypes.SteamItemRewards:
                AddInventoriesToFetch(753, 7, botId);
                break;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Extracts the serialized inventory from a file content
        /// </summary>
        /// <param name="serializedInventory">Serialized inventory.</param>
        protected virtual void ExtractSerializedInventory(SerializedInventory serializedInventory)
        {
            if (serializedInventory == null)
            {
                return;
            }

            InventoryType          = serializedInventory.InventoryType;
            DrawContentInInspector = serializedInventory.DrawContentInInspector;
            Content = new InventoryItem[serializedInventory.ContentType.Length];
            for (int i = 0; i < serializedInventory.ContentType.Length; i++)
            {
                if (serializedInventory.ContentType[i] != null)
                {
                    Content[i]          = Resources.Load <InventoryItem>(_resourceItemPath + serializedInventory.ContentType[i]).Copy();
                    Content[i].Quantity = serializedInventory.ContentQuantity[i];
                }
                else
                {
                    Content[i] = null;
                }
            }
        }
Exemplo n.º 11
0
 private void tscb_area_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tscb_area.SelectedItem.ToString() == "Cube")
     {
         INVENTORYTYPE = InventoryTypes.Cube;
     }
     else if (tscb_area.SelectedItem.ToString() == "Inventory")
     {
         INVENTORYTYPE = InventoryTypes.Inventory;
     }
     else if (tscb_area.SelectedItem.ToString() == "Stash")
     {
         INVENTORYTYPE = InventoryTypes.Stash;
     }
 }
Exemplo n.º 12
0
 internal static InventoryItemBase getInventoryItem(HttpSessionStateBase Session, int ID, InventoryTypes inventorytype)
 {
     var list = Utilities.Inventory.GetAllInventory(Session,inventorytype);
     var item = list.Single(s => s.ID == ID) as InventoryItemBase;
     return item;
 }
Exemplo n.º 13
0
 internal static List<InventoryItemBase> GetAllInventory(HttpSessionStateBase Session,InventoryTypes inventorytype)
 {
     Dictionary<String, List<InventoryItemBase>> Inventory = Session["Inventory"] as Dictionary<String, List<InventoryItemBase>>;
     List<InventoryItemBase> list = Inventory[inventorytype.ToString()];
     return list;
 }
Exemplo n.º 14
0
        public List<UnitObject> GetItemsOfInventoryType(InventoryTypes type)
        {
            List<UnitObject> tmp = new List<UnitObject>();

            foreach (UnitObject item in UnitObject.Items)
            {
                if (item.InventoryLocationIndex == (int)type)
                {
                    tmp.Add(item);
                }
            }

            return tmp;
        }
Exemplo n.º 15
0
 public Inventory(InventoryTypes type, IEnumerable <byte> hash)
 {
     Type = type;
     Hash = hash;
 }
Exemplo n.º 16
0
 //public Item( int _model, InventoryTypes _inventoryType, int _quality, int _subclass, int _objectclass, int _sheath, int param1, int param2, int param3 )
 public Item( int _model, InventoryTypes _inventoryType, int _objectclass, int _subclass, int _quality, int _sheath, int param1, int param2, int param3 )
 {
     model = _model;
     inventoryType = _inventoryType;
     quality = _quality;
     subClass = _subclass;
     objectClass = _objectclass;
     sheath = _sheath;
 }
Exemplo n.º 17
0
 public Inventory(InventoryTypes type)
 {
     Type = type;
 }