Esempio n. 1
0
 private void LoadWeaponData()
 {
     storedWeapons = Interface.GetMod().DataFileSystem.ReadObject <StoredWeapons>("MagazinBoost");
     if (storedWeapons.weaponStatsList.Count == 0)
     {
         storedWeapons = new StoredWeapons();
         WeaponInventory inv;
         var             weapons = ItemManager.itemList.Where(p => p.category == ItemCategory.Weapon).ToList();
         foreach (var weapon in weapons)
         {
             var item = ItemManager.CreateByName(weapon.shortname);
             if (item.GetHeldEntity() is BaseProjectile)
             {
                 inv = new WeaponInventory(
                     item.info.shortname,
                     item.info.displayName.english,
                     (item.GetHeldEntity() as BaseProjectile).primaryMagazine.capacity,
                     (item.GetHeldEntity() as BaseProjectile).primaryMagazine.contents,
                     Convert.ToInt32(_itemMaxCondition.GetValue(item)),
                     (item.GetHeldEntity() as BaseProjectile).primaryMagazine.ammoType.shortname,
                     item.GetHeldEntity().skinID
                     );
                 storedWeapons.weaponStatsList.Add(inv);
             }
             item.Remove(0f);
         }
         SaveWeaponData();
     }
 }
Esempio n. 2
0
            public void Add(StoredWeapons things)
            {
                List <StoredWeapons> l;

                if (!this.FoundThings.TryGetValue(things.Weapon.def, out l))
                {
                    l = new List <StoredWeapons>();
                    this.FoundThings.Add(things.Weapon.def, l);
                }
                l.Add(things);
            }