introduce the concept of system contributions
This commit is contained in:
parent
1e73c6b7eb
commit
22d0bedf53
@ -40,6 +40,23 @@ public class MissionCompleted : Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rescue missions contribute to the system.
|
||||
/// </summary>
|
||||
public override bool SystemContribution {
|
||||
get {
|
||||
if (AcceptedEntry == null || AcceptedEntry.Mission == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AcceptedEntry.Mission.IsRescueMission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
if (Faction == null || CompletedEntry == null || CompletedEntry.Mission == null) {
|
||||
return "";
|
||||
|
@ -21,6 +21,16 @@ public class Transaction : IComparable<Transaction> {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the transaction helps the entire system.
|
||||
/// While all transactions are related to one faction, sometimes their
|
||||
/// overall effect on the system as a whole is more important, than to
|
||||
/// their faction. For example, rescuing refugees helps the Thargoid war
|
||||
/// effort in the system as a whole, not just for the faction.
|
||||
/// So this is true for transactions that help the system as a whole.
|
||||
/// </summary>
|
||||
public virtual bool SystemContribution { get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this transaction was completed in legacy ED
|
||||
/// </summary>
|
||||
|
@ -112,7 +112,7 @@ public class Mission : IComparable<Mission> {
|
||||
/// <summary>
|
||||
/// Passenger type for refugees
|
||||
/// </summary>
|
||||
public static readonly string PassengerTypeRefugee = "PassengerRefugee";
|
||||
public static readonly string PassengerTypeRefugee = "Refugee";
|
||||
|
||||
public ulong MissionID { get; set; } = 0;
|
||||
|
||||
|
@ -227,6 +227,10 @@ public class Objective : IComparable<Objective> {
|
||||
string.Compare(faction, Faction) == 0;
|
||||
}
|
||||
|
||||
public bool Matches(string system) {
|
||||
return string.Compare(system, System) == 0;
|
||||
}
|
||||
|
||||
public int CompareTo(Objective other) {
|
||||
return (other.System == System &&
|
||||
other.Faction == Faction) ? 0 : -1;
|
||||
|
@ -18,10 +18,19 @@ public class Report {
|
||||
}
|
||||
|
||||
foreach (Transaction t in transactions) {
|
||||
Objective o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
Objective o;
|
||||
if (t.SystemContribution) {
|
||||
o = Objectives.Find(x => x.Matches(t.System));
|
||||
} else {
|
||||
o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
if (t.SystemContribution) {
|
||||
o = new Objective() { System = t.System };
|
||||
} else {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
}
|
||||
Objectives.Add(o);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user