Exemplo n.º 1
0
        /// <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 }
                       ));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Mnozstvi ledu v generatoru
        /// </summary>
        /// <returns></returns>
        public List <string> GetIceStatus()
        {
            // definice
            List <string> status = new List <string>();

            // prochazeni bloku
            foreach (KeyValuePair <string, IMyGasGenerator> block in Instance.GetByType <IMyGasGenerator>())
            {
                // definice
                List <MyInventoryItem> items = new List <MyInventoryItem>();
                float total = 0;
                // nacteni polozek v inventari
                block.Value.GetInventory(0).GetItems(items);
                // vypocet celkoveho mnozstvi
                if (items.Count > 0)
                {
                    for (int j = 0; j < items.Count; j++)
                    {
                        if (items[j].Type.SubtypeId == "Ice")
                        {
                            total += (float)items[j].Amount;
                        }
                    }
                }
                // status
                if (block.Value.IsWorking && block.Value.IsFunctional)
                {
                    status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value), total, IceReference));
                }
            }
            // vraceni
            return(status);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Stav zasobnikuplynu
        /// </summary>
        /// <returns>Stav zasobniku</returns>
        public List <string> GetTankStatus()
        {
            // definice
            List <string> status = new List <string>();

            // prochazeni bloku
            foreach (KeyValuePair <string, IMyGasTank> block in Instance.GetByType <IMyGasTank>())
            {
                status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value), (block.Value as IMyGasTank).FilledRatio, 1));
            }
            return(status);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Status generatoru
        /// </summary>
        /// <returns></returns>
        public List <string> GetReactorStatus()
        {
            // definice
            List <string> status = new List <string>();

            //prochazeni bloku
            foreach (KeyValuePair <string, IMyReactor> block in Instance.GetByType <IMyReactor>())
            {
                //hodnoty
                IMyReactor reactor = block.Value as IMyReactor;
                float      actual  = reactor.CurrentOutput;
                float      maximum = reactor.MaxOutput;
                float      uranium = 0;
                //overeni funkcnosti
                if (reactor.IsFunctional && reactor.IsWorking)
                {
                    //overeni mnozstvi uranu
                    if (UraniumReference > 0)
                    {
                        // polozky inventare
                        List <MyInventoryItem> items = new List <MyInventoryItem>();
                        reactor.GetInventory(0).GetItems(items);
                        // vypocet mnozstvi uranu
                        if (items.Count > 0)
                        {
                            for (int j = 0; j < items.Count; j++)
                            {
                                if (items[j].Type.SubtypeId == "Uranium")
                                {
                                    uranium += (float)items[j].Amount;
                                }
                            }
                        }
                        // doplneni statusu do vystupu
                        status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, uranium <= UraniumReference ? Status.UraniumIsLow : Status.Working), actual, maximum));
                    }
                    else
                    {
                        status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.UraniumIsEmpty), 0, maximum));
                    }
                }
                else
                {
                    status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.NotWorking), 0, maximum));
                }
            }
            // vraceni
            return(status);
        }
Exemplo n.º 5
0
        /// <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 }
                       ));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Status baterek
        /// </summary>
        /// <returns></returns>
        public List <string> GetBatteryStatus()
        {
            // definice
            List <string> status = new List <string>();

            //prochazeni bloku
            foreach (KeyValuePair <string, IMyBatteryBlock> block in Instance.GetByType <IMyBatteryBlock>())
            {
                // hodnoty
                float input   = block.Value.CurrentInput;
                float output  = block.Value.CurrentOutput;
                float stored  = block.Value.CurrentStoredPower;
                float maximum = block.Value.MaxStoredPower;
                // overeni funkcnosti
                if (block.Value.IsFunctional && block.Value.IsWorking)
                {
                    if (stored == maximum)
                    {
                        status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.FullyCharged), stored, maximum));
                    }
                    else if (input > output)
                    {
                        status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.Recharging), stored, maximum));
                    }
                    else
                    {
                        status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.Discharging), stored, maximum));
                    }
                }
                else
                {
                    status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value, Status.NotWorking), 0, maximum));
                }
            }
            // zadne baterky
            if (status.Count == 0)
            {
                status.Add(Status.NoBatteries);
            }
            // vraceni
            return(status);
        }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
        /// <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 }
                       ));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Status solarnich panelu
        /// </summary>
        /// <param name="groupedName">Nazev pro seskupeni</param>
        /// <returns></returns>
        public List <string> GetSolarStatus()
        {
            // definice
            List <string> status = new List <string>();

            //prochazeni bloku
            foreach (KeyValuePair <string, IMySolarPanel> block in Instance.GetByType <IMySolarPanel>())
            {
                // hodnoty
                float actual  = block.Value.CurrentOutput;
                float maximum = block.Value.MaxOutput;
                // overeni funkcnosti
                status.Add(Formater.BarsWithPercent(Block.GetStatus(block.Value), actual, maximum));
            }
            // zadne panely
            if (status.Count == 0)
            {
                status.Add(Status.NoSolarPanels);
            }
            // vraceni
            return(status);
        }