Exemple #1
0
        public static bool BuyUpgrade(Dictionary <string, object> userArgs)
        {
            try {
                string upgrade = "";

                if (userArgs.ContainsKey("upgrade"))
                {
                    upgrade = (string)userArgs["upgrade"];
                }
                else
                {
                    throw new Exception("You must specify a valid 'upgrade' value.");
                }

                foreach (var upg in Shiftorium.GetAvailable())
                {
                    if (upg.ID == upgrade)
                    {
                        Shiftorium.Buy(upgrade, upg.Cost);
                        return(true);
                    }
                }

                throw new Exception($"Couldn't find upgrade with ID: {upgrade}");
            } catch {
                return(false);
            }
        }
Exemple #2
0
        public static bool BuyUpgrade(Dictionary <string, object> userArgs)
        {
            try
            {
                string upgrade = "";

                upgrade = (string)userArgs["upgrade"];

                var upg = Shiftorium.GetAvailable().FirstOrDefault(x => x.ID == upgrade);
                if (upg != null)
                {
                    if (!Shiftorium.Buy(upg.ID, upg.Cost) == true)
                    {
                        Console.WriteLine("{ERR_NOTENOUGHCODEPOINTS}");
                    }
                }
                else
                {
                    Console.WriteLine("{ERR_NOUPGRADE}");
                }
            }
            catch
            {
                Console.WriteLine("{ERR_GENERAL}");
            }
            return(true);
        }
Exemple #3
0
 public static bool GetAllUpgrades()
 {
     foreach (var upg in Shiftorium.GetDefaults())
     {
         Shiftorium.Buy(upg.ID, 0);
     }
     return(true);
 }