EliteBGS/BGS/MissionCompleted.cs

43 lines
1.3 KiB
C#

using System.Text;
using EDJournal;
namespace EliteBGS.BGS {
public class MissionCompleted : LogEntry {
public MissionCompleted(MissionCompletedEntry e) {
Entries.Add(e);
Faction = e.JSON.GetValue("Faction").ToString();
}
public string MissionName {
get {
MissionCompletedEntry c = Entries[0] as MissionCompletedEntry;
if (string.IsNullOrEmpty(c.HumanReadableName)) {
return c.Name;
} else {
return c.HumanReadableName;
}
}
}
public string Influence {
get { return (Entries[0] as MissionCompletedEntry).GetInfluenceForFaction(Faction); }
}
public override string ToString() {
if (Entries.Count <= 0) {
return "";
}
StringBuilder builder = new StringBuilder();
var entry = Entries[0] as MissionCompletedEntry;
var influence = entry.GetInfluenceForFaction(Faction);
builder.AppendFormat("{0}", MissionName);
if (influence != "") {
builder.AppendFormat(", Influence: {0}", influence);
}
return builder.ToString();
}
}
}