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

A little rewrite for System Class #170

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
75 changes: 18 additions & 57 deletions EVEData/System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,21 @@ namespace SMT.EVEData
/// </summary>
public class System
{
/// <summary>
/// Initializes a new instance of the <see cref="System" /> class.
/// </summary>
public System()
{
Jumps = new List<string>();
SHStructures = new List<StructureHunter.Structures>();

SOVAllianceID = 0;
HasJumpBeacon = false;
}

/// <summary>
/// Initializes a new instance of the <see cref="System" /> class.
/// </summary>
/// <param name="name">Name of the System</param>
/// <param name="id">ID of the system</param>
/// <param name="region">Region this system is in</param>
/// <param name="station">Does this system contain an NPC station</param>
/// <param name="iceBelt">Does this system has an ice belt</param>
public System(string name, long id, string region, bool station, bool iceBelt)
{
Name = name;
ID = id;
Region = region;
HasNPCStation = station;
HasIceBelt = iceBelt;

// default the ESI stats
NPCKillsLastHour = 0;
NPCKillsDeltaLastHour = 0;
PodKillsLastHour = 0;
ShipKillsLastHour = 0;
JumpsLastHour = 0;
ActiveIncursion = false;

SOVAllianceID = 0;

Jumps = new List<string>();
SHStructures = new List<StructureHunter.Structures>();
}

public enum EdenComTrigStatus
Expand All @@ -67,7 +43,7 @@ public enum EdenComTrigStatus
/// Gets or sets the an incursion is active in this system
/// </summary>
[XmlIgnoreAttribute]
public bool ActiveIncursion { get; set; }
public bool ActiveIncursion { get; set; } = false;

/// <summary>
/// Gets or sets the X coordinate in real space for this system
Expand Down Expand Up @@ -120,7 +96,7 @@ public enum EdenComTrigStatus
public bool FactionWarSystem { get; set; }

[XmlIgnoreAttribute]
public bool HasJumpBeacon { get; set; }
public bool HasJumpBeacon { get; set; } = false;

/// <summary>
/// Gets or sets if this system has an NPC Station
Expand All @@ -144,13 +120,13 @@ public enum EdenComTrigStatus
/// <summary>
/// Gets or sets the list of Jumps from this system
/// </summary>
public List<string> Jumps { get; set; }
public List<string> Jumps { get; set; } = new();

/// <summary>
/// Gets or sets the number of pods killed in the last hour
/// </summary>
[XmlIgnoreAttribute]
public int JumpsLastHour { get; set; }
public int JumpsLastHour { get; set; } = 0;

/// <summary>
/// Gets or sets the Name of the system
Expand All @@ -161,13 +137,13 @@ public enum EdenComTrigStatus
/// Gets or sets the delta of NPC Kills in the last hour
/// </summary>
[XmlIgnoreAttribute]
public int NPCKillsDeltaLastHour { get; set; }
public int NPCKillsDeltaLastHour { get; set; } = 0;

/// <summary>
/// Gets or sets the number of NPC Kills in the last hour
/// </summary>
[XmlIgnoreAttribute]
public int NPCKillsLastHour { get; set; }
public int NPCKillsLastHour { get; set; } = 0;

/// <summary>
/// Gets or sets the Faction of the system if owned by an NPC Corp
Expand All @@ -179,7 +155,7 @@ public enum EdenComTrigStatus
/// Gets or sets the number of pod kills in the last hour
/// </summary>
[XmlIgnoreAttribute]
public int PodKillsLastHour { get; set; }
public int PodKillsLastHour { get; set; } = 0;

public double RadiusAU { get; set; }

Expand All @@ -192,19 +168,19 @@ public enum EdenComTrigStatus
/// Gets or sets the number of player ships killed in the last hour
/// </summary>
[XmlIgnoreAttribute]
public int ShipKillsLastHour { get; set; }
public int ShipKillsLastHour { get; set; } = 0;

/// <summary>
/// Gets or sets the an incursion is active in this system
/// </summary>
[XmlIgnoreAttribute]
public List<StructureHunter.Structures> SHStructures { get; set; }
public List<StructureHunter.Structures> SHStructures { get; set; } = new();

/// <summary>
/// Gets or sets the name of the alliance holding sov in this system
/// </summary>
[XmlIgnoreAttribute]
public int SOVAllianceID { get; set; }
public int SOVAllianceID { get; set; } = 0;

/// <summary>
/// Gets or sets the name of the corporation holding sov in this system
Expand All @@ -226,27 +202,12 @@ public enum EdenComTrigStatus
/// </summary>
public double TrueSec { get; set; }

public string SecType
{
get
{
if (TrueSec >= 0.45)
{
return "High Sec";
}

if (TrueSec > 0.0 && TrueSec < 0.45)
{
return "Low Sec";
}

return "Null Sec";
}
}
public string SecType => String.Join((TrueSec switch {
>= 0.45 => "High",
> 0.0 and < 0.45 => "Low",
_ => "Null"
}), " Sec");

public override string ToString()
{
return $"{Name} ({Region})";
}
public override string ToString() => $"{Name} ({Region})";
}
}
}