// Coroutine to show delayed status regarding delivery as result of purchasing fuel (i.e. so player sees refuel complete message first)

        public static IEnumerator Wait(float seconds)
        {
            yield return(new WaitForSeconds(seconds));

            instance.timerEnd           = GasStation.TimerEnd();
            instance.isAwaitingDelivery = true;
            LabelStatus();
        }
        // initiates recharge and sends result to status
        private static void TryRecharge()
        {
            if (canRecharge)
            {
                code = GasStation.Recharge();

                if (code == 4)
                {
                    statusStringToReturn = "Recharge complete!, come again soon!";
                    LabelStatus();
                }
            }
        }
        public void Start()
        {
            // get the icons from file, preload menu position, get prices, instantiate the toolbar button & set status'

            if (HighLogic.LoadedSceneIsFlight)
            {
                instance = this;

                if (grapesBtn != null)
                {
                    onDestroy();
                    grapesBtn = null;
                }


                grapesTextureOff = GameDatabase.Instance.GetTexture("FruitKocktail/GRAPES/Icons/grapesoff", false);
                grapesTextureOn  = GameDatabase.Instance.GetTexture("FruitKocktail/GRAPES/Icons/grapeson", false);
                guiPos           = new Rect(menuPR, menuSR);
                rates            = GasStation.ProvidePrices();

                grapesBtn = ApplicationLauncher.Instance.AddModApplication(onTrue, onFalse, onHover, onHoverOut, null, null,
                                                                           ApplicationLauncher.AppScenes.FLIGHT, grapesTextureOff);

                btnIsPresent = true;

                if (btnIsPressed)
                {
                    grapesBtn.SetTrue();
                }
                else
                {
                    grapesBtn.SetFalse();
                }

                if (!isAwaitingDelivery)
                {
                    statusStringToReturn = "Awaiting Your Order";
                }
            }

            else
            {
                if (grapesBtn != null)
                {
                    onDestroy();
                    grapesBtn    = null;
                    btnIsPresent = false;
                }
            }
        }
        // gets cost to recharge or n/a if no capacity
        private static string GetRechargeAbility()
        {
            canRecharge = GasStation.QueryRecharge();

            if (canRecharge)
            {
                return(rates[5].ToString("0.00"));
            }

            else
            {
                return("N/A");
            }
        }
        // gets cost to fill up in current context
        private static string GetFillUpCost()
        {
            double grabbedPrice = GasStation.GetFuelAmount();

            if (grabbedPrice == 0)
            {
                canRefuel = false;
                return("All Tanks Full!");
            }

            else
            {
                canRefuel = true;
                string stringToReturn = grabbedPrice.ToString("0.00");
                return(stringToReturn);
            }
        }
        // initiates refuel and sends result to status
        private static void TryRefuel()
        {
            if (canRefuel)
            {
                code = GasStation.Refuel();

                if (code == 1)
                {
                    statusStringToReturn = "All tanks now full, come again soon!";
                }
                else if (code == 2)
                {
                    statusStringToReturn = "Part refill complete, come again soon!";
                }

                LabelStatus();
                StaticCoroutine.Start(Wait(5));
            }
        }
        // finds how much credit the player has available on their cards
        private static string GetCredit()
        {
            double creditAmount = GasStation.GetCreditAmount();

            if (creditAmount == 0)
            {
                canRecharge = false;
                canRefuel   = false;
                return("All Cards Are Empty!");
            }

            else
            {
                canRecharge = true;
                canRefuel   = true;
                string stringToReturn = creditAmount.ToString("0.00");
                return(stringToReturn);
            }
        }
        public void Start()
        {
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            else if (HighLogic.LoadedSceneIsFlight)
            {
                Instance = this;

                try
                {
                    basePrices   = new List <double>();
                    currentOrbit = FlightGlobals.ActiveVessel.mainBody;
                    string strOrbit = currentOrbit.displayName;

                    GrapeUtils priceModifier = new GrapeUtils();
                    modCost    = priceModifier.DistanceCalculator(strOrbit);
                    basePrices = priceModifier.BaseRates();

                    lfoCost = Math.Round(basePrices[0] * modCost, 2);
                    lfCost  = Math.Round(basePrices[1] * modCost, 2);
                    oCost   = Math.Round(basePrices[2] * modCost, 2);
                    mCost   = Math.Round(basePrices[3] * modCost, 2);
                    xCost   = Math.Round(basePrices[4] * modCost, 2);
                    batCost = Math.Round(basePrices[5] * modCost, 2);
                    repCost = Math.Round(basePrices[6] * modCost, 2);

                    totalPrice = 0;
                }
                catch
                {
                    // internal error
                }
            }
        }