Exemple #1
0
 void MergeIngOreListInfo()
 {
     _infoIngOre = $"\n=== СЛИТКИ / РУДЫ ===";
     foreach (var item in Ingots)
     {
         _infoIngOre += $"\n{TranslateName_components(item.Key)} : {item.Value.Amount} кг";
         if (Ores.ContainsKey(item.Key))
         {
             _infoIngOre += $" ( {Math.Round((double)Ores[item.Key].Amount / 1000)} т руды )";
         }
     }
 }
Exemple #2
0
 void SortingItems(ref List <MyInventoryItem> items)
 {
     foreach (var item in items)
     {
         if (item.Type.TypeId == "MyObjectBuilder_Component" && Components.ContainsKey(item.Type.SubtypeId)) // Если имя сходится с тем что в словаре
         {
             Components[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_Ingot" && Ingots.ContainsKey(item.Type.SubtypeId))
         {
             Ingots[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_Ore" && Ores.ContainsKey(item.Type.SubtypeId))
         {
             Ores[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_PhysicalGunObject" && Tools.ContainsKey(item.Type.SubtypeId))
         {
             Tools[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_OxygenContainerObject" && Oxygen.ContainsKey(item.Type.SubtypeId))
         {
             Oxygen[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_GasContainerObject" && Hydrogen.ContainsKey(item.Type.SubtypeId))
         {
             Hydrogen[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else if (item.Type.TypeId == "MyObjectBuilder_AmmoMagazine" && Ammo.ContainsKey(item.Type.SubtypeId))
         {
             Ammo[item.Type.SubtypeId].Amount += item.Amount.ToIntSafe();
         }
         else
         {
             Warning += $"\n[{item.Type.TypeId}/{item.Type.SubtypeId}] отсутствует в словарях";
         }
     }
 }