示例#1
0
    void GetItemsFromMagazine()
    {
        Items = new Magazine();
        for (int i = 0; i < StaticValues.InvMagazine.Items.Count; i++)
        {
            bool canSpawn = false;
            switch (StaticValues.InvMagazine.Items[i].item.Category)
            {
            case ItemCategory.Armor:
                if (((IArmor)StaticValues.InvMagazine.Items[i].item).Stage < StaticValues.UpgradesItems.MaxStage)
                {
                    canSpawn = true;
                }
                break;

            case ItemCategory.Weapon:
                if (((IWeapon)StaticValues.InvMagazine.Items[i].item).Stage < StaticValues.UpgradesItems.MaxStage)
                {
                    canSpawn = true;
                }
                break;
            }
            if (canSpawn)
            {
                Items.AddItem(StaticValues.InvMagazine.Items[i], true);
            }
        }
    }
 void CollectItem(CollectorDatabase collectorData, ManagmentType typeWorker)
 {
     time = 0;
     if (variant > 0)
     {
         for (int i = 0; i < itemPerHours; i++)
         {
             int Rate = 1;
             foreach (var item in collectorData.Items)
             {
                 Rate += item.variants[variant - 1].rate;
             }
             int rand = Random.Range(1, Rate);
             Rate = 0;
             foreach (var item in collectorData.Items)
             {
                 Rate += item.variants[variant - 1].rate;
                 if (rand <= Rate)
                 {
                     int      amount   = item.variants[variant - 1].amount * collectorData.multiplerPerception * WorkerPerception(typeWorker) / 100;
                     SlotItem slotitem = new SlotItem(StaticValues.Items.Components[item.id_item], item.variants[variant - 1].amount);
                     magazine.AddItem(slotitem, true);
                     break;
                 }
             }
         }
     }
 }
示例#3
0
    void RandomItems()
    {
        if (StaticValues.Items_in_Shop > 0)
        {
            for (int i = 0; i < StaticValues.Items_in_Shop; i++)
            {
                int    rand   = Random.Range(0, StaticValues.ShopItems.ID_Items.Count);
                ItemID id     = StaticValues.ShopItems.ID_Items[rand];
                int    amount = 1;
                Item   item   = null;
                switch (StaticValues.ShopItems.ID_Items[rand].Category)
                {
                case ItemCategory.Accessories:
                    item = StaticValues.Items.Accessories[id.ID];
                    break;

                case ItemCategory.Armor:
                    item = StaticValues.Items.Armors[id.ID];
                    break;

                case ItemCategory.Component:
                    item = StaticValues.Items.Components[id.ID];
                    break;

                case ItemCategory.Consume:
                    item = StaticValues.Items.Consumes[id.ID];
                    break;

                case ItemCategory.Recipe:
                    item = StaticValues.Items.Recipes[id.ID];
                    break;

                case ItemCategory.Rune:
                    item = StaticValues.Items.Runes[id.ID];
                    break;

                case ItemCategory.Throw:
                    item = StaticValues.Items.Throws[id.ID];
                    break;

                case ItemCategory.Weapon:
                    item = StaticValues.Items.Weapons[id.ID];
                    break;
                }

                if (item != null)
                {
                    if (item.Stack > 1)
                    {
                        amount = Random.Range(1, item.Stack + 1);
                    }
                    SlotItem slotitem = new SlotItem(item, amount);
                    ShopItems.AddItem(slotitem, true);
                }
            }
        }
    }
示例#4
0
 void GetRunesFromMagazine()
 {
     RunesInMagazine = new Magazine();
     for (int i = 0; i < StaticValues.InvMagazine.Items.Count; i++)
     {
         switch (StaticValues.InvMagazine.Items[i].item.Category)
         {
         case ItemCategory.Rune:
             RunesInMagazine.AddItem(StaticValues.InvMagazine.Items[i], true);
             break;
         }
     }
 }