Пример #1
0
        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);
        }
Пример #2
0
        public RoundLog GetRound(int round)
        {
            RoundLog roundLog;

            List <RoundLog> .Enumerator enumerator = this.fRounds.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    RoundLog current = enumerator.Current;
                    if (current.Round != round)
                    {
                        continue;
                    }
                    roundLog = current;
                    return(roundLog);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
        }