Example #1
0
    public List <UniqueItem> ParseItemList(string s)
    {
        //Debug.Log ("Unique Item Parsing: " + s);

        List <UniqueItem> uitems = new List <UniqueItem>();

        s = s.Trim('[', ']');
        //Debug.Log (s);
        string[] itemlist = s.Split('.');
        foreach (var iteminfo in itemlist)
        {
            //Debug.Log (iteminfo);

            string[] itemstring = iteminfo.Split('+');
            //Debug.Log (itemstring[0]+","+itemstring[1]);

            //Debug.Log (int.Parse (itemstring [0]));
            //Debug.Log (int.Parse (itemstring [1]));
            //Debug.Log(itemDictionary.GetItem (int.Parse (itemstring [1])).itemName);

            UniqueItem uitem = new UniqueItem(
                int.Parse(itemstring [0]),
                itemDictionary.GetItem(int.Parse(itemstring [1]))
                );
            //Debug.Log ("Parsed:" + uitem.item.itemName);
            uitems.Add(uitem);
        }

        //Debug.Log ("items:"+uitems);

        return(uitems);
    }
Example #2
0
        public static ItemStruct CreateItemFromLoot(LootItemStruct loot)
        {
            var itemData = ItemDictionary.GetItem(loot.ItemId);

            if (itemData.parameter != null)
            {
                CalcParameter(ref itemData.parameter, loot.Reality);
            }
            ItemStruct item = new ItemStruct()
            {
                Reality = loot.Reality,
                Amount  = loot.Amount,
                Data    = itemData
            };

            return(item);
        }
Example #3
0
 public static void SetupNewItemsList()
 {
     foreach (string k in ItemDictionary.itemClasses.Keys)
     {
         ToolStripButton it = new ToolStripButton(k);
         string          n  = k;
         it.Click += (object sender, EventArgs e) => {
             if (inventoriesNearby[list.SelectedIndex] == null)
             {
                 return;
             }
             Item i = ItemDictionary.GetItem(k, new object[] { });
             inventoriesNearby[list.SelectedIndex].GetItems().Add(i);
             items.Items.Add(i);
         };
         AddItems.DropDownItems.Add(it);
     }
 }
    public void LoadGame()
    {
        SaveData saveData = SaveSystem.Load();

        _dungeon_manager.Level    = saveData.Level;
        _dungeon_manager.MaxLevel = saveData.MaxLevel;

        for (int i = 0; i < _inventory.InventorySlots.Count; i++)
        {
            _inventory.InventorySlots[i].Item = saveData.InventoryItemNames[i] == "" ? null : ItemDictionary.GetItem(saveData.InventoryItemNames[i]);
        }

        _equipment.PrimaryWeapon.Item = saveData.PrimaryWeaponName == "" ? null : ItemDictionary.GetItem(saveData.PrimaryWeaponName);
        _equipment.PrimaryWeapon.EquipmentStats.Item = _equipment.PrimaryWeapon.Item;
        _equipment.PrimaryWeapon.EquipmentStats.UpdateItem();
        _equipment.SecondaryWeapon.Item = saveData.SecondaryWeaponName == "" ? null : ItemDictionary.GetItem(saveData.SecondaryWeaponName);
        _equipment.SecondaryWeapon.EquipmentStats.Item = _equipment.SecondaryWeapon.Item;
        _equipment.SecondaryWeapon.EquipmentStats.UpdateItem();
    }