implement combat zones and combat bonds
This commit is contained in:
@@ -1,5 +1,30 @@
|
||||
namespace NonaBGS.BGS {
|
||||
public class CombatZone {
|
||||
private int level;
|
||||
using System;
|
||||
|
||||
namespace NonaBGS.BGS {
|
||||
public class CombatZone : LogEntry, IComparable {
|
||||
public string Type { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public int Amount { get; set; }
|
||||
|
||||
public int CompareTo(object obj) {
|
||||
if (obj.GetType() != typeof(CombatZone)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var b = obj as CombatZone;
|
||||
if (b.Faction != Faction || b.System != System) {
|
||||
return -1; // System and faction don't match
|
||||
}
|
||||
|
||||
if (b.Type != b.Type || b.Grade != b.Grade) {
|
||||
return -1; // grade and type don't match
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return string.Format("Won {0} x {1} {2} Combat Zone(s)", Amount, Type, Grade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,26 @@ namespace NonaBGS.BGS {
|
||||
return string.Format("Sold {0} CR worth of Micro Resources\n", sum);
|
||||
}
|
||||
|
||||
private string BuildKillBonds(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
FactionKillBonds[] bonds = objective.LogEntries
|
||||
.OfType<FactionKillBonds>()
|
||||
.ToArray()
|
||||
;
|
||||
|
||||
if (bonds == null || bonds.Length == 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (FactionKillBonds bond in bonds) {
|
||||
builder.AppendFormat("{0}\n", bond.ToString());
|
||||
}
|
||||
|
||||
builder.AppendFormat("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildVouchers(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var missions = from entries in objective.LogEntries
|
||||
@@ -126,6 +146,26 @@ namespace NonaBGS.BGS {
|
||||
return output.ToString();
|
||||
}
|
||||
|
||||
private string BuildCombatZones(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
CombatZone[] zones = objective.LogEntries
|
||||
.OfType<CombatZone>()
|
||||
.ToArray()
|
||||
;
|
||||
|
||||
if (zones == null || zones.Length == 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (CombatZone zone in zones) {
|
||||
builder.AppendFormat("{0}\n", zone.ToString());
|
||||
}
|
||||
|
||||
builder.Append("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
@@ -147,6 +187,12 @@ namespace NonaBGS.BGS {
|
||||
var vouchers = BuildVouchers(objective);
|
||||
entries.Append(vouchers);
|
||||
|
||||
var zones = BuildCombatZones(objective);
|
||||
entries.Append(zones);
|
||||
|
||||
var bonds = BuildKillBonds(objective);
|
||||
entries.Append(bonds);
|
||||
|
||||
var carto = BuildCartoGraphics(objective);
|
||||
entries.Append(carto);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user