From ecee91bc559e1c0d716a3032e371218812df61e7 Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Fri, 24 Jun 2016 16:44:42 -0400 Subject: Loads of changes... Custom shifter options using Lua, and other stuff. --- source/WindowsFormsApplication1/SaveSystem.cs | 37 +++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'source/WindowsFormsApplication1/SaveSystem.cs') diff --git a/source/WindowsFormsApplication1/SaveSystem.cs b/source/WindowsFormsApplication1/SaveSystem.cs index a86ee52..aab5ab2 100644 --- a/source/WindowsFormsApplication1/SaveSystem.cs +++ b/source/WindowsFormsApplication1/SaveSystem.cs @@ -186,6 +186,32 @@ namespace SaveSystem public static List DefaultUpgrades = new List(); + public static List GetCategories(bool showBought) + { + List cats = new List(); + foreach(var upg in DefaultUpgrades) + { + if(upg.id.Contains("dummy")) + { + if(!cats.Contains(upg.Category.ToLower())) + { + if(API.Upgrades[upg.Category.ToLower()]) + { + if(showBought == true) + { + cats.Add(upg.Category.ToLower()); + } + } + else + { + cats.Add(upg.Category.ToLower()); + } + + } + } + } + return cats; //Meow! No. I don't mean the animal. I mean "Categories". + } /// /// Adds upgrade info (such as CP, description, etc) to the registry. Add your Shiftorium upgrades here. @@ -460,13 +486,14 @@ namespace SaveSystem try { ShiftoriumUpgrades[kv.Key] = kv.Value; - } catch(Exception ex) + } catch { Console.WriteLine("[Shiftorium/Registry] [ERROR] Upgrade {0} from disk doesn't seem to be found in the 'Default Upgrades' dictionary. This may be caused by a bug.", kv.Key); } } } - catch (Exception ex) + catch + { string shiftoriumjson = JsonConvert.SerializeObject(ShiftoriumUpgrades); if (API.DeveloperMode == true) @@ -505,10 +532,10 @@ namespace Shiftorium /// Whether the upgrade could be bought. public static bool Buy(Upgrade upgradeToBuy) { - if(API.Codepoints >= upgradeToBuy.Cost) + if(API.Codepoints >= upgradeToBuy.Cost / API.CurrentSave.PriceDivider) { SaveSystem.ShiftoriumRegistry.ShiftoriumUpgrades[upgradeToBuy.id] = true; - SaveSystem.Utilities.LoadedSave.codepoints -= upgradeToBuy.Cost; + SaveSystem.Utilities.LoadedSave.codepoints -= upgradeToBuy.Cost / API.CurrentSave.PriceDivider; SaveSystem.Utilities.saveGame(); API.UpdateWindows(); API.Log("[Shiftorium] Upgrade \"" + upgradeToBuy.id + "\" bought successfully, game saved."); @@ -561,7 +588,7 @@ namespace Shiftorium } - catch (Exception ex) + catch { if (upgrade.id.Contains("dummy")) { -- cgit v1.2.3