From 8a4259cc09b64d2ed6174946fc2d17a8bf116430 Mon Sep 17 00:00:00 2001 From: gitmacer Date: Mon, 18 May 2020 21:32:47 +0200 Subject: [PATCH 1/5] Add ZoneName if you use a mod with custom Zones the enum number can change Also add Vacpack Timer --- .../Slime Rancher/GSI/Nodes/LocationNode.cs | 3 +++ .../Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs index a7b08dc04..66c35e39f 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs @@ -9,10 +9,13 @@ namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes public class LocationNode : Node { public BiomeNode In; + public string ZoneName; + internal LocationNode(string json) : base(json) { In = new BiomeNode(json); + ZoneName = GetString("zone_name"); } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs index 56d946875..8f5d87f1c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs @@ -11,6 +11,7 @@ public class VacPackNode : Node public AmountNode Amount; public MaxNode Max; public ColorNode Color; + public SpiralNode Spiral; public int SellectedSlot; public int UseableSlots; @@ -23,6 +24,7 @@ internal VacPackNode(string json) : base(json) Amount = new AmountNode(_ParsedData["amount"]?.ToString() ?? ""); Max = new MaxNode(_ParsedData["max"]?.ToString() ?? ""); Color = new ColorNode(_ParsedData["color"]?.ToString() ?? ""); + Spiral = new SpiralNode(_ParsedData["spiral"]?.ToString() ?? ""); SellectedSlot = GetInt("sellected_slot"); UseableSlots = GetInt("useable_slots"); @@ -187,5 +189,16 @@ internal ColorSlot5Node(string json) : base(json) } } #endregion + public class SpiralNode : Node + { + public float Percentage; + public float WarningThreshold; + + internal SpiralNode(string json) : base(json) + { + Percentage = GetFloat("percentage"); + WarningThreshold = GetFloat("warning_threshold"); + } + } } } From 5994b48039cfb8159943c5dad1c83caa3a40435a Mon Sep 17 00:00:00 2001 From: gitmacer Date: Mon, 18 May 2020 22:24:46 +0200 Subject: [PATCH 2/5] fix merge conflict --- .../Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs index 8f5d87f1c..29ce4bdd5 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs @@ -189,7 +189,7 @@ internal ColorSlot5Node(string json) : base(json) } } #endregion - public class SpiralNode : Node + public class SpiralNode : Node { public float Percentage; public float WarningThreshold; From 21ea7cd35cdb1c5a5b54f3c4246956ac86a86f61 Mon Sep 17 00:00:00 2001 From: gitmacer Date: Sat, 23 May 2020 17:21:45 +0200 Subject: [PATCH 3/5] Update to use AutojsonNode... -Changed ProviderNode to default one -Remove unnecessarily "duplicated" Nodes. --- .../Control_Slime_Rancher.xaml.cs | 9 +- .../GSI/GameState_Slime_Rancher.cs | 102 +--------- .../Slime Rancher/GSI/Nodes/GameStateNode.cs | 34 ++-- .../Slime Rancher/GSI/Nodes/LocationNode.cs | 103 ++++------ .../Slime Rancher/GSI/Nodes/MailNode.cs | 9 +- .../Slime Rancher/GSI/Nodes/PlayerNode.cs | 48 +---- .../Slime Rancher/GSI/Nodes/ProviderNode.cs | 36 ---- .../Slime Rancher/GSI/Nodes/VacPackNode.cs | 189 +++--------------- .../Project-Aurora/Project-Aurora.csproj | 1 - 9 files changed, 111 insertions(+), 420 deletions(-) delete mode 100644 Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/ProviderNode.cs diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/Control_Slime_Rancher.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/Control_Slime_Rancher.xaml.cs index 6f09935a7..b5d60c1cf 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/Control_Slime_Rancher.xaml.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/Control_Slime_Rancher.xaml.cs @@ -1,4 +1,5 @@ using Aurora.Profiles.Slime_Rancher.GSI; +using Aurora.Profiles.Slime_Rancher.GSI.Nodes; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -73,15 +74,11 @@ private void InGameCh_Checked(object sender, RoutedEventArgs e) { if ((sender as CheckBox).IsChecked == true) { - State.GameState.InGame = true; - State.GameState.InMenu = false; - State.GameState.loading = false; + State.GameState.State = GameStateEnum.InGame; } else { - State.GameState.InGame = false; - State.GameState.InMenu = true; - State.GameState.loading = false; + State.GameState.State = GameStateEnum.Menu; } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/GameState_Slime_Rancher.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/GameState_Slime_Rancher.cs index 2c3f108b7..6e8112ecc 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/GameState_Slime_Rancher.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/GameState_Slime_Rancher.cs @@ -1,3 +1,4 @@ +using Aurora.Profiles.Generic.GSI.Nodes; using Aurora.Profiles.Slime_Rancher.GSI.Nodes; using Newtonsoft.Json.Linq; using System; @@ -10,101 +11,14 @@ namespace Aurora.Profiles.Slime_Rancher.GSI { public class GameState_Slime_Rancher : GameState { - private ProviderNode _Provider; - private GameStateNode _GameState; - private PlayerNode _Player; - private VacPackNode _VacPack; - private MailNode _Mail; - private WorldNode _World; - private LocationNode _Location; + public ProviderNode Provider => NodeFor("provider"); + public GameStateNode GameState => NodeFor("game_state"); + public PlayerNode Player => NodeFor("player"); + public VacPackNode VacPack => NodeFor("vac_pack"); + public MailNode Mail => NodeFor("mail"); + public WorldNode World => NodeFor("world"); + public LocationNode Location => NodeFor("location"); - - /// - /// Provider node provides information about the data source so that Aurora can update the correct gamestate. - /// - public ProviderNode Provider { - get { - if (_Provider == null) - _Provider = new ProviderNode(_ParsedData["provider"]?.ToString() ?? ""); - return _Provider; - } - } - - /// - /// Game State node provides information about the GameState (InMenu/loading/InGame). - /// - public GameStateNode GameState - { - get - { - if (_GameState == null) - _GameState = new GameStateNode(_ParsedData["game_state"]?.ToString() ?? ""); - return _GameState; - } - } - - /// - /// Player node provides information about the player (e.g. health and hunger). - /// - public PlayerNode Player - { - get - { - if (_Player == null) - _Player = new PlayerNode(_ParsedData["player"]?.ToString() ?? ""); - return _Player; - } - } - - /// - /// Vac Pack node provides information about the Inventory. - /// - public VacPackNode VacPack - { - get - { - if (_VacPack == null) - _VacPack = new VacPackNode(_ParsedData["vac_pack"]?.ToString() ?? ""); - return _VacPack; - } - } - - /// - /// Mail node provides information about the Mails. - /// - public MailNode Mail { - get { - if (_Mail == null) - _Mail = new MailNode(_ParsedData["mail"]?.ToString() ?? ""); - return _Mail; - } - } - - /// - /// World node provides information about the world (e.g. time). - /// - public WorldNode World { - get { - if (_World == null) - _World = new WorldNode(_ParsedData["world"]?.ToString() ?? ""); - return _World; - } - } - - /// - /// Location node provides information about the Location (e.g. InRanch). - /// - public LocationNode Location { - get { - if (_Location == null) - _Location = new LocationNode(_ParsedData["location"]?.ToString() ?? ""); - return _Location; - } - } - - /// - /// Creates a default GameState_Slime_Rancher instance. - /// public GameState_Slime_Rancher() : base() { } /// diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/GameStateNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/GameStateNode.cs index aed4a570c..b3a107694 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/GameStateNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/GameStateNode.cs @@ -5,27 +5,25 @@ using System.Threading.Tasks; namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes { - public class GameStateNode : Node { + public enum GameStateEnum + { + Menu, + Loading, + InGame + } - public bool InMenu; - public bool loading; - public bool InGame; - public bool IsPaused; + public class GameStateNode : AutoJsonNode + { + [AutoJsonPropertyName("game_state")] + public GameStateEnum State; - internal GameStateNode(string json) : base(json) { + public bool InMenu => State == GameStateEnum.Menu; //legacy + public bool loading => State == GameStateEnum.Loading; //legacy + public bool InGame => State == GameStateEnum.InGame; //legacy - GameStateEnum GameState = (GameStateEnum)GetInt("game_state"); - InMenu = GameState == GameStateEnum.Menu; - loading = GameState == GameStateEnum.Loading; - InGame = GameState == GameStateEnum.InGame; - IsPaused = GetBool("pause_menu"); - } + [AutoJsonPropertyName("pause_menu")] + public bool IsPaused; - public enum GameStateEnum - { - Menu, - Loading, - InGame - } + internal GameStateNode(string json) : base(json) { } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs index 66c35e39f..d12103eb6 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs @@ -6,78 +6,63 @@ namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes { - public class LocationNode : Node + public enum SRZone { - public BiomeNode In; + None = -1, + TheRanch = 0, + REEF = 1, + QUARRY = 2, + MOSS = 3, + DESERT = 4, + SEA = 5, + RUINS = 7, + RUINS_TRANSITION = 8, + WILDS = 9, + OGDEN_RANCH = 10, + VALLEY = 11, + MOCHI_RANCH = 12, + SLIMULATIONS = 13, + VIKTOR_LAB = 14 + } + + public class LocationNode : AutoJsonNode + { + public SRZone Location => In.Location; //legacy + [AutoJsonPropertyName("zone_name")] public string ZoneName; + [AutoJsonIgnore] + public BiomeNode In; //legacy internal LocationNode(string json) : base(json) { - In = new BiomeNode(json); - ZoneName = GetString("zone_name"); + In = new BiomeNode(json); //legacy } - } - public class BiomeNode : Node + public class BiomeNode : AutoJsonNode { - public bool None; - public bool TheRanch; - public bool TheDryReef; - public bool TheIndigoQuarry; - public bool TheMossBlanket; - public bool TheGlassDesert; - public bool TheSlimeSea; - public bool TheAncientRuins; - public bool TheAncientRuinsCourtyard; - public bool TheWilds; - public bool OgdensRetreat; - public bool NimbleValley; - public bool MochisManor; - public bool TheSlimeulation; - public bool ViktorsWorkshop; + [GameStateIgnore] + public SRZone Location => (SRZone)GetInt("zone"); - internal BiomeNode(string json) : base(json) - { - SRZone Location = (SRZone)GetInt("zone"); + public bool None => Location == SRZone.None; + public bool TheRanch => Location == SRZone.TheRanch; + public bool TheDryReef => Location == SRZone.REEF; + public bool TheIndigoQuarry => Location == SRZone.QUARRY; + public bool TheMossBlanket => Location == SRZone.MOSS; + public bool TheGlassDesert => Location == SRZone.DESERT; + public bool TheSlimeSea => Location == SRZone.SEA; + public bool TheAncientRuins => Location == SRZone.RUINS; + public bool TheAncientRuinsCourtyard => Location == SRZone.RUINS_TRANSITION; + public bool TheWilds => Location == SRZone.WILDS; + public bool OgdensRetreat => Location == SRZone.OGDEN_RANCH; + public bool NimbleValley => Location == SRZone.VALLEY; + public bool MochisManor => Location == SRZone.MOCHI_RANCH; + public bool TheSlimeulation => Location == SRZone.SLIMULATIONS; + public bool ViktorsWorkshop => Location == SRZone.VIKTOR_LAB; - this.None = Location == SRZone.NONE; - this.TheRanch = Location == SRZone.RANCH; - this.TheDryReef = Location == SRZone.REEF; - this.TheIndigoQuarry = Location == SRZone.QUARRY; - this.TheMossBlanket = Location == SRZone.MOSS; - this.TheGlassDesert = Location == SRZone.DESERT; - this.TheSlimeSea = Location == SRZone.SEA; - this.TheAncientRuins = Location == SRZone.RUINS; - this.TheAncientRuinsCourtyard = Location == SRZone.RUINS_TRANSITION; - this.TheWilds = Location == SRZone.WILDS; - this.OgdensRetreat = Location == SRZone.OGDEN_RANCH; - this.NimbleValley = Location == SRZone.VALLEY; - this.MochisManor = Location == SRZone.MOCHI_RANCH; - this.TheSlimeulation = Location == SRZone.SLIMULATIONS; - this.ViktorsWorkshop = Location == SRZone.VIKTOR_LAB; - } + internal BiomeNode(string json) : base(json) { } } } -enum SRZone -{ - NONE = -1, - RANCH = 0, - REEF = 1, - QUARRY = 2, - MOSS = 3, - DESERT = 4, - SEA = 5, - RUINS = 7, - RUINS_TRANSITION = 8, - WILDS = 9, - OGDEN_RANCH = 10, - VALLEY = 11, - MOCHI_RANCH = 12, - SLIMULATIONS = 13, - VIKTOR_LAB = 14 -} - diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/MailNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/MailNode.cs index 76d6af38b..dc4407740 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/MailNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/MailNode.cs @@ -5,13 +5,12 @@ using System.Threading.Tasks; namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes { - public class MailNode : Node { + public class MailNode : AutoJsonNode + { + [AutoJsonPropertyName("new_mail")] public bool NewMail; - internal MailNode(string json) : base(json) { - NewMail = GetBool("new_mail"); - - } + internal MailNode(string json) : base(json) { } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/PlayerNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/PlayerNode.cs index 2a4111ab9..f9cf292a7 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/PlayerNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/PlayerNode.cs @@ -5,54 +5,20 @@ using System.Threading.Tasks; namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes { - public class PlayerNode : Node { - - public HealthNode Health; - public EnergyNode Energy; - public RadNode Radiation; - - internal PlayerNode(string json) : base(json) { - - Health = new HealthNode(_ParsedData["health"]?.ToString() ?? ""); - Energy = new EnergyNode(_ParsedData["energy"]?.ToString() ?? ""); - Radiation = new RadNode(_ParsedData["rad"]?.ToString() ?? ""); - } - - } - - public class HealthNode : Node + public class PlayerNode : AutoJsonNode { - public int Current; - public int Max; - - internal HealthNode(string json) : base(json) - { - Current = GetInt("current"); - Max = GetInt("max"); - } - } - - public class EnergyNode : Node - { - public int Current; - public int Max; + public CurrentMaxNode Health => NodeFor("health"); + public CurrentMaxNode Energy => NodeFor("energy"); + public CurrentMaxNode Radiation => NodeFor("rad"); - internal EnergyNode(string json) : base(json) - { - Current = GetInt("current"); - Max = GetInt("max"); - } + internal PlayerNode(string json) : base(json) { } } - public class RadNode : Node + public class CurrentMaxNode : AutoJsonNode { public int Current; public int Max; - internal RadNode(string json) : base(json) - { - Current = GetInt("current"); - Max = GetInt("max"); - } + internal CurrentMaxNode(string json) : base(json) { } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/ProviderNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/ProviderNode.cs deleted file mode 100644 index 67940da1b..000000000 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/ProviderNode.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes -{ - public class ProviderNode : Node - { - public string Name; - public int AppID; - //public ModVerNode ModVer; - - internal ProviderNode(string json) : base(json) - { - Name = GetString("name"); - AppID = GetInt("appid"); - //ModVer = new ModVerNode(_ParsedData["modver"]?.ToString() ?? ""); - } - - public class ModVerNode : Node - { - public int Major; - public int Minor; - public int Revision; - - internal ModVerNode(string json) : base(json) - { - this.Major = GetInt("major"); - this.Minor = GetInt("minor"); - this.Revision = GetInt("revision"); - } - } - } -} diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs index 29ce4bdd5..2cd5fa7c9 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/VacPackNode.cs @@ -6,35 +6,29 @@ namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes { - public class VacPackNode : Node + public class VacPackNode : AutoJsonNode { - public AmountNode Amount; - public MaxNode Max; - public ColorNode Color; - public SpiralNode Spiral; - + public SlotNode Amount => NodeFor("amount"); + public SlotNode Max => NodeFor("max"); + public ColorNode Color => NodeFor("color"); + public SpiralNode Spiral => NodeFor("spiral"); + + [AutoJsonPropertyName("sellected_slot")] public int SellectedSlot; + [AutoJsonPropertyName("useable_slots")] public int UseableSlots; + [AutoJsonPropertyName("emty_Item_slots")] public int EmtyItemSlots; + [AutoJsonPropertyName("in_gadget_mode")] public bool InGadgetMode; + [AutoJsonPropertyName("in_nimble_valley_mode")] public bool InNimbleValleyMode; - internal VacPackNode(string json) : base(json) - { - Amount = new AmountNode(_ParsedData["amount"]?.ToString() ?? ""); - Max = new MaxNode(_ParsedData["max"]?.ToString() ?? ""); - Color = new ColorNode(_ParsedData["color"]?.ToString() ?? ""); - Spiral = new SpiralNode(_ParsedData["spiral"]?.ToString() ?? ""); - - SellectedSlot = GetInt("sellected_slot"); - UseableSlots = GetInt("useable_slots"); - EmtyItemSlots = GetInt("emty_Item_slots"); - InGadgetMode = GetBool("in_gadget_mode"); - InNimbleValleyMode = GetBool("in_nimble_valley_mode"); - } + internal VacPackNode(string json) : base(json) { } - public class AmountNode : Node + public class SlotNode : AutoJsonNode { + [AutoJsonPropertyName("sellected_slot")] public int SellectedSlot; public int Slot1; public int Slot2; @@ -42,163 +36,38 @@ public class AmountNode : Node public int Slot4; public int Slot5; - internal AmountNode(string json) : base(json) - { - SellectedSlot = GetInt("sellected_slot"); - Slot1 = GetInt("slot1"); - Slot2 = GetInt("slot2"); - Slot3 = GetInt("slot3"); - Slot4 = GetInt("slot4"); - Slot5 = GetInt("slot5"); - } + internal SlotNode(string json) : base(json) { } } - public class MaxNode : Node + public class ColorNode : AutoJsonNode { - public int SellectedSlot; - public int Slot1; - public int Slot2; - public int Slot3; - public int Slot4; - public int Slot5; - - internal MaxNode(string json) : base(json) - { - SellectedSlot = GetInt("sellected_slot"); - Slot1 = GetInt("slot1"); - Slot2 = GetInt("slot2"); - Slot3 = GetInt("slot3"); - Slot4 = GetInt("slot4"); - Slot5 = GetInt("slot5"); - } + public ColorSlotNode SellectedSlot => NodeFor("sellected_slot"); + public ColorSlotNode Slot1 => NodeFor("slot1"); + public ColorSlotNode Slot2 => NodeFor("slot2"); + public ColorSlotNode Slot3 => NodeFor("slot3"); + public ColorSlotNode Slot4 => NodeFor("slot4"); + public ColorSlotNode Slot5 => NodeFor("slot5"); + + internal ColorNode(string json) : base(json) { } } - public class ColorNode : Node - { - public SellectedSlotNode SellectedSlot; - public ColorSlot1Node Slot1; - public ColorSlot2Node Slot2; - public ColorSlot3Node Slot3; - public ColorSlot4Node Slot4; - public ColorSlot5Node Slot5; - - internal ColorNode(string json) : base(json) - { - this.SellectedSlot = new SellectedSlotNode(_ParsedData["sellected_slot"]?.ToString() ?? ""); - this.Slot1 = new ColorSlot1Node(_ParsedData["slot1"]?.ToString() ?? ""); - this.Slot2 = new ColorSlot2Node(_ParsedData["slot2"]?.ToString() ?? ""); - this.Slot3 = new ColorSlot3Node(_ParsedData["slot3"]?.ToString() ?? ""); - this.Slot4 = new ColorSlot4Node(_ParsedData["slot4"]?.ToString() ?? ""); - this.Slot5 = new ColorSlot5Node(_ParsedData["slot5"]?.ToString() ?? ""); - } - } - #region ColorSlotNodes - public class SellectedSlotNode : Node + public class ColorSlotNode : AutoJsonNode { public float Red; public float Green; public float Blue; public float Alpha; - internal SellectedSlotNode(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } + internal ColorSlotNode(string json) : base(json) { } } - public class ColorSlot1Node : Node - { - public float Red; - public float Green; - public float Blue; - public float Alpha; - - internal ColorSlot1Node(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } - } - - public class ColorSlot2Node : Node - { - public float Red; - public float Green; - public float Blue; - public float Alpha; - - internal ColorSlot2Node(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } - } - - public class ColorSlot3Node : Node - { - public float Red; - public float Green; - public float Blue; - public float Alpha; - - internal ColorSlot3Node(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } - } - - public class ColorSlot4Node : Node - { - public float Red; - public float Green; - public float Blue; - public float Alpha; - - internal ColorSlot4Node(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } - } - - public class ColorSlot5Node : Node - { - public float Red; - public float Green; - public float Blue; - public float Alpha; - - internal ColorSlot5Node(string json) : base(json) - { - this.Red = GetFloat("red"); - this.Green = GetFloat("green"); - this.Blue = GetFloat("blue"); - this.Alpha = GetFloat("alpha"); - } - } - #endregion - public class SpiralNode : Node + public class SpiralNode : AutoJsonNode { public float Percentage; + [AutoJsonPropertyName("warning_threshold")] public float WarningThreshold; - internal SpiralNode(string json) : base(json) - { - Percentage = GetFloat("percentage"); - WarningThreshold = GetFloat("warning_threshold"); - } + internal SpiralNode(string json) : base(json) { } } } } diff --git a/Project-Aurora/Project-Aurora/Project-Aurora.csproj b/Project-Aurora/Project-Aurora/Project-Aurora.csproj index 157886780..5b1cd9fd4 100644 --- a/Project-Aurora/Project-Aurora/Project-Aurora.csproj +++ b/Project-Aurora/Project-Aurora/Project-Aurora.csproj @@ -535,7 +535,6 @@ - From 7ea4f8f75e8e61d1e755ed558968cbefdbf98182 Mon Sep 17 00:00:00 2001 From: gitmacer Date: Sat, 23 May 2020 17:38:30 +0200 Subject: [PATCH 4/5] Rename Enum entries from the Game ones to more user friendly ones. --- .../Slime Rancher/GSI/Nodes/LocationNode.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs index d12103eb6..357ae7d7e 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/GSI/Nodes/LocationNode.cs @@ -10,19 +10,19 @@ public enum SRZone { None = -1, TheRanch = 0, - REEF = 1, - QUARRY = 2, - MOSS = 3, - DESERT = 4, - SEA = 5, - RUINS = 7, - RUINS_TRANSITION = 8, - WILDS = 9, - OGDEN_RANCH = 10, - VALLEY = 11, - MOCHI_RANCH = 12, - SLIMULATIONS = 13, - VIKTOR_LAB = 14 + TheDryReef = 1, + TheIndigoQuarry = 2, + TheMossBlanket = 3, + TheGlassDesert = 4, + TheSlimeSea = 5, + TheAncientRuins = 7, + TheAncientRuinsCourtyard = 8, + TheWilds = 9, + OgdensRetreat = 10, + NimbleValley = 11, + MochisManor = 12, + TheSlimeulation = 13, + ViktorsWorkshop = 14 } public class LocationNode : AutoJsonNode @@ -47,19 +47,19 @@ public class BiomeNode : AutoJsonNode public bool None => Location == SRZone.None; public bool TheRanch => Location == SRZone.TheRanch; - public bool TheDryReef => Location == SRZone.REEF; - public bool TheIndigoQuarry => Location == SRZone.QUARRY; - public bool TheMossBlanket => Location == SRZone.MOSS; - public bool TheGlassDesert => Location == SRZone.DESERT; - public bool TheSlimeSea => Location == SRZone.SEA; - public bool TheAncientRuins => Location == SRZone.RUINS; - public bool TheAncientRuinsCourtyard => Location == SRZone.RUINS_TRANSITION; - public bool TheWilds => Location == SRZone.WILDS; - public bool OgdensRetreat => Location == SRZone.OGDEN_RANCH; - public bool NimbleValley => Location == SRZone.VALLEY; - public bool MochisManor => Location == SRZone.MOCHI_RANCH; - public bool TheSlimeulation => Location == SRZone.SLIMULATIONS; - public bool ViktorsWorkshop => Location == SRZone.VIKTOR_LAB; + public bool TheDryReef => Location == SRZone.TheDryReef; + public bool TheIndigoQuarry => Location == SRZone.TheIndigoQuarry; + public bool TheMossBlanket => Location == SRZone.TheMossBlanket; + public bool TheGlassDesert => Location == SRZone.TheGlassDesert; + public bool TheSlimeSea => Location == SRZone.TheSlimeSea; + public bool TheAncientRuins => Location == SRZone.TheAncientRuins; + public bool TheAncientRuinsCourtyard => Location == SRZone.TheAncientRuinsCourtyard; + public bool TheWilds => Location == SRZone.TheWilds; + public bool OgdensRetreat => Location == SRZone.OgdensRetreat; + public bool NimbleValley => Location == SRZone.NimbleValley; + public bool MochisManor => Location == SRZone.MochisManor; + public bool TheSlimeulation => Location == SRZone.TheSlimeulation; + public bool ViktorsWorkshop => Location == SRZone.ViktorsWorkshop; internal BiomeNode(string json) : base(json) { } } From 7b39501922c1be0dbf1fe3cb5ef5eac4c824258a Mon Sep 17 00:00:00 2001 From: gitmacer Date: Sat, 23 May 2020 17:45:59 +0200 Subject: [PATCH 5/5] Change default profile to use Enums instead -Use GameState Enum -Use Location Enum --- .../Slime Rancher/SlimeRancherProfile.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/SlimeRancherProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/SlimeRancherProfile.cs index de312e458..27b4a30c6 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/SlimeRancherProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Slime Rancher/SlimeRancherProfile.cs @@ -34,8 +34,8 @@ public override void Reset() }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() - .AddEntry(Color.FromArgb(228, 67, 108), new BooleanGSIBoolean("GameState/InMenu")) - .AddEntry(Color.FromArgb(2, 80, 146), new BooleanGSIBoolean("GameState/loading")) + .AddEntry(Color.FromArgb(228, 67, 108), new BooleanGSIEnum("GameState/State", GSI.Nodes.GameStateEnum.Menu)) + .AddEntry(Color.FromArgb(2, 80, 146), new BooleanGSIEnum("GameState/State", GSI.Nodes.GameStateEnum.Loading)) .AddEntry(Color.FromArgb(242, 242, 242), new BooleanGSIBoolean("GameState/IsPaused")) ) ), @@ -134,21 +134,21 @@ public override void Reset() }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() - .AddEntry(Color.FromArgb(214, 178, 133), new BooleanGSIBoolean("Location/In/TheRanch")) - .AddEntry(Color.FromArgb(189,66,80), new BooleanGSIBoolean("Location/In/TheDryReef")) - .AddEntry(Color.FromArgb(83,85,161), new BooleanGSIBoolean("Location/In/TheIndigoQuarry")) - .AddEntry(Color.FromArgb(28,128,90), new BooleanGSIBoolean("Location/In/TheMossBlanket")) - .AddEntry(Color.FromArgb(175,104,66), new BooleanGSIBoolean("Location/In/TheGlassDesert")) - .AddEntry(Color.FromArgb(9,138,153), new BooleanGSIBoolean("Location/In/TheSlimeSea")) - .AddEntry(Color.FromArgb(182,201,89), new BooleanGSIBoolean("Location/In/TheAncientRuins")) - .AddEntry(Color.FromArgb(182,201,89), new BooleanGSIBoolean("Location/In/TheAncientRuinsCourtyard")) - .AddEntry(Color.FromArgb(81,108,69), new BooleanGSIBoolean("Location/In/TheWilds")) - .AddEntry(Color.FromArgb(128,146,35), new BooleanGSIBoolean("Location/In/OgdensRetreat")) - .AddEntry(Color.FromArgb(192,192,192), new BooleanGSIBoolean("Location/In/NimbleValley")) - .AddEntry(Color.FromArgb(107,82,170), new BooleanGSIBoolean("Location/In/MochisManor")) - .AddEntry(Color.FromArgb(184,30,107), new BooleanGSIBoolean("Location/In/TheSlimeulation")) - .AddEntry(Color.FromArgb(107,163,209), new BooleanGSIBoolean("Location/In/ViktorsWorkshop")) - .AddEntry(Color.FromArgb(9,138,153), new BooleanGSIBoolean("Location/In/None")) + .AddEntry(Color.FromArgb(214, 178, 133), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheRanch)) + .AddEntry(Color.FromArgb(189,66,80), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheDryReef)) + .AddEntry(Color.FromArgb(83,85,161), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheIndigoQuarry)) + .AddEntry(Color.FromArgb(28,128,90), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheMossBlanket)) + .AddEntry(Color.FromArgb(175,104,66), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheGlassDesert)) + .AddEntry(Color.FromArgb(9,138,153), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheSlimeSea)) + .AddEntry(Color.FromArgb(182,201,89), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheAncientRuins)) + .AddEntry(Color.FromArgb(182,201,89), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheAncientRuinsCourtyard)) + .AddEntry(Color.FromArgb(81,108,69), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheWilds)) + .AddEntry(Color.FromArgb(128,146,35), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.OgdensRetreat)) + .AddEntry(Color.FromArgb(192,192,192), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.NimbleValley)) + .AddEntry(Color.FromArgb(107,82,170), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.MochisManor)) + .AddEntry(Color.FromArgb(184,30,107), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.TheSlimeulation)) + .AddEntry(Color.FromArgb(107,163,209), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.ViktorsWorkshop)) + .AddEntry(Color.FromArgb(9,138,153), new BooleanGSIEnum("Location/Location", GSI.Nodes.SRZone.None)) ) ), };