/// <summary> /// Ziskani chybejicich materialu /// </summary> /// <returns>List<string></returns> public TableData GetMissing() { //definice List <string[]> missing = new List <string[]>(); //nalezeni chybejicich foreach (string item in Constants.CheckMissingIngot) { if (CargoIngot.ContainsKey(item)) { if (CargoIngot[item][0] < CargoIngot[item][1]) { missing.Add(new string[] { item, Formater.Amount(CargoIngot[item][1] - CargoIngot[item][0]) }); } } else { missing.Add(new string[] { item, Formater.Amount(Constants.AmountReference[item]) }); } } // sestaveni a vraceni return(TableData.Create( null, missing, new double[] { 65, 35 } )); }
/// <summary> /// Prehled o praci assembleru /// </summary> /// <returns></returns> public TableData GetAssemblesOverview(out bool stucked) { // definice List <string[]> ovreview = new List <string[]>(); int localStuck = 0; // nalezeni bloku foreach (KeyValuePair <string, IMyAssembler> block in Instance.GetByType <IMyAssembler>()) { // definice List <MyProductionItem> items = new List <MyProductionItem>(); // nacteni polozek inventare block.Value.GetQueue(items); // sestaveni prehledu if (items.Count > 0) { // detekce zaseknuti localStuck = Math.Max(localStuck, items.Count > 0 && !block.Value.IsProducing ? 1 : 0); // prirazeni ovreview.Add(new string[] { Block.GetName(block.Value), block.Value.IsProducing ? Status.Working : Status.Stuck, items[0].BlueprintId.SubtypeName.Replace("Component", ""), Formater.Amount((double)items[0].Amount) }); } else { ovreview.Add(new string[] { Block.GetName(block.Value), Status.Idle, "", "", }); } } // zaseknuti stucked = localStuck == 1 ? true : false; // sestaveni a vraceni return(TableData.Create( new string[] { "Name", "Status", "Queue", "Qty" }, ovreview, new double[] { 30, 20, 35, 15 } )); }
/// <summary> /// Priprava vypisu /// </summary> /// <param name="items">Polozky</param> /// <param name="simple">Zjednoduseny vypis</param> /// <param name="referenceOverride">Externi referencni hodnota</param> /// <returns></returns> private List <string> BuildItemList(Dictionary <string, float[]> items, bool simple, double referenceOverride = -1) { // definice List <string> itemList = new List <string>(); // sestaveni foreach (KeyValuePair <string, float[]> item in items) { if (simple) { itemList.Add(item.Key + " => " + Formater.Amount(item.Value[0])); } else { itemList.Add(Formater.BarsWithAmount(item.Key, item.Value[0], referenceOverride > -1 ? referenceOverride : item.Value[1])); } } // vraceni return(itemList); }
/// <summary> /// Prehled o praci rafinerii /// </summary> /// <returns></returns> public TableData GetRefineryOverview() { // definice List <string[]> ovreview = new List <string[]>(); // nalezeni bloku foreach (KeyValuePair <string, IMyRefinery> block in Instance.GetByType <IMyRefinery>()) { // definice List <MyInventoryItem> items = new List <MyInventoryItem>(); // nacteni polozek inventare block.Value.InputInventory.GetItems(items); // sestaveni prehledu if (items.Count > 0) { ovreview.Add(new string[] { Block.GetName(block.Value), Status.Working, items[0].Type.SubtypeId, Formater.Amount((double)items[0].Amount), items.Count >= 2 ? items[1].Type.SubtypeId : "" }); } else { ovreview.Add(new string[] { Block.GetName(block.Value), Status.Idle, "", "", "", }); } } // sestaveni a vraceni return(TableData.Create( new string[] { "Name", "Status", "Current", "Qty", "Queue" }, ovreview, new double[] { 27, 22, 19, 13, 19 } )); }