diff --git a/InventoryListToLcd.cs b/InventoryListToLcd.cs index 127876f..f0ad546 100644 --- a/InventoryListToLcd.cs +++ b/InventoryListToLcd.cs @@ -1,6 +1,6 @@ public Program() { - Runtime.UpdateFrequency = UpdateFrequency.Update10; + Runtime.UpdateFrequency = UpdateFrequency.Update100; } public void Save() @@ -28,24 +28,28 @@ public void Main(string argument, UpdateType updateSource) { "Platinum", 7 }, { "Iron", 3 } }; + Dictionary ores = new Dictionary(ingots); foreach (var container in containers) { foreach (var ingot in ingots.Keys.ToList()) { - ingots[ingot] += (float)container.GetInventory(0).GetItemAmount(new MyItemType("MyObjectBuilder_Ingot", ingot)); + for (int i = 0; i < container.InventoryCount; i++) + { + ingots[ingot] += (float)container.GetInventory(i).GetItemAmount(new MyItemType("MyObjectBuilder_Ingot", ingot)); + ores[ingot] += (float)container.GetInventory(i).GetItemAmount(new MyItemType("MyObjectBuilder_Ore", ingot)); + } } } // Dispaly - string output = ""; + string output = " Ingots Ores\n-----------------------------------\n"; foreach (var ingot in ingots) { - output += ingot.Key + " " + ingot.Value.ToString("n2") + "\n"; + output += ingot.Key.PadRight(10) + " " + ingot.Value.ToString("n2").PadRight(15) + " " + ores[ingot.Key].ToString("n2") + "\n"; } LCD.ContentType = ContentType.TEXT_AND_IMAGE; LCD.WriteText(output); - }