internal EncounterReport CreateReport(Encounter enc, bool all_entries) { EncounterReport encounterReport = new EncounterReport(); RoundLog roundLog = null; TurnLog timestamp = null; foreach (IEncounterLogEntry fEntry in this.fEntries) { StartRoundLogEntry startRoundLogEntry = fEntry as StartRoundLogEntry; StartTurnLogEntry startTurnLogEntry = fEntry as StartTurnLogEntry; if (startRoundLogEntry != null) { if (roundLog != null) { encounterReport.Rounds.Add(roundLog); } roundLog = new RoundLog(startRoundLogEntry.Round); } else if (startTurnLogEntry == null) { if (!all_entries && !fEntry.Important) { continue; } timestamp.Entries.Add(fEntry); } else { if (timestamp != null) { timestamp.End = startTurnLogEntry.Timestamp; roundLog.Turns.Add(timestamp); } timestamp = new TurnLog(startTurnLogEntry.CombatantID) { Start = startTurnLogEntry.Timestamp }; } } if (roundLog != null) { if (timestamp != null) { if (timestamp.Entries.Count != 0) { timestamp.End = timestamp.Entries[timestamp.Entries.Count - 1].Timestamp; } roundLog.Turns.Add(timestamp); } encounterReport.Rounds.Add(roundLog); } return(encounterReport); }
public void AddStartTurnEntry(Guid id) { if (!this.fActive) { return; } StartTurnLogEntry startTurnLogEntry = new StartTurnLogEntry() { CombatantID = id }; this.fEntries.Add(startTurnLogEntry); }