Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SR Update Add VacPack Spiral #1928

Merged
merged 5 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Aurora.Profiles.Generic.GSI.Nodes;
using Aurora.Profiles.Slime_Rancher.GSI.Nodes;
using Newtonsoft.Json.Linq;
using System;
Expand All @@ -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<ProviderNode>("provider");
public GameStateNode GameState => NodeFor<GameStateNode>("game_state");
public PlayerNode Player => NodeFor<PlayerNode>("player");
public VacPackNode VacPack => NodeFor<VacPackNode>("vac_pack");
public MailNode Mail => NodeFor<MailNode>("mail");
public WorldNode World => NodeFor<WorldNode>("world");
public LocationNode Location => NodeFor<LocationNode>("location");


/// <summary>
/// Provider node provides information about the data source so that Aurora can update the correct gamestate.
/// </summary>
public ProviderNode Provider {
get {
if (_Provider == null)
_Provider = new ProviderNode(_ParsedData["provider"]?.ToString() ?? "");
return _Provider;
}
}

/// <summary>
/// Game State node provides information about the GameState (InMenu/loading/InGame).
/// </summary>
public GameStateNode GameState
{
get
{
if (_GameState == null)
_GameState = new GameStateNode(_ParsedData["game_state"]?.ToString() ?? "");
return _GameState;
}
}

/// <summary>
/// Player node provides information about the player (e.g. health and hunger).
/// </summary>
public PlayerNode Player
{
get
{
if (_Player == null)
_Player = new PlayerNode(_ParsedData["player"]?.ToString() ?? "");
return _Player;
}
}

/// <summary>
/// Vac Pack node provides information about the Inventory.
/// </summary>
public VacPackNode VacPack
{
get
{
if (_VacPack == null)
_VacPack = new VacPackNode(_ParsedData["vac_pack"]?.ToString() ?? "");
return _VacPack;
}
}

/// <summary>
/// Mail node provides information about the Mails.
/// </summary>
public MailNode Mail {
get {
if (_Mail == null)
_Mail = new MailNode(_ParsedData["mail"]?.ToString() ?? "");
return _Mail;
}
}

/// <summary>
/// World node provides information about the world (e.g. time).
/// </summary>
public WorldNode World {
get {
if (_World == null)
_World = new WorldNode(_ParsedData["world"]?.ToString() ?? "");
return _World;
}
}

/// <summary>
/// Location node provides information about the Location (e.g. InRanch).
/// </summary>
public LocationNode Location {
get {
if (_Location == null)
_Location = new LocationNode(_ParsedData["location"]?.ToString() ?? "");
return _Location;
}
}

/// <summary>
/// Creates a default GameState_Slime_Rancher instance.
/// </summary>
public GameState_Slime_Rancher() : base() { }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GameStateNode>
{
[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) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,63 @@

namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes
{
public class LocationNode : Node
public enum SRZone
{
public BiomeNode In;
None = -1,
TheRanch = 0,
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<LocationNode>
{
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);
In = new BiomeNode(json); //legacy
}

}

public class BiomeNode : Node
public class BiomeNode : AutoJsonNode<BiomeNode>
{
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.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;

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
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
using System.Threading.Tasks;

namespace Aurora.Profiles.Slime_Rancher.GSI.Nodes {
public class MailNode : Node {
public class MailNode : AutoJsonNode<MailNode>
{

[AutoJsonPropertyName("new_mail")]
public bool NewMail;

internal MailNode(string json) : base(json) {
NewMail = GetBool("new_mail");

}
internal MailNode(string json) : base(json) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlayerNode>
{
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<CurrentMaxNode>("health");
public CurrentMaxNode Energy => NodeFor<CurrentMaxNode>("energy");
public CurrentMaxNode Radiation => NodeFor<CurrentMaxNode>("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<CurrentMaxNode>
{
public int Current;
public int Max;

internal RadNode(string json) : base(json)
{
Current = GetInt("current");
Max = GetInt("max");
}
internal CurrentMaxNode(string json) : base(json) { }
}
}
Loading