Пример #1
0
        public void Faction()
        {
            FactionEvent fact   = null;
            var          parser = new LogParser(PLAYER);

            parser.OnFaction += (args) => fact = args;

            fact = null;
            parser.ParseLine("[Tue Nov 03 22:09:49 2015] Your faction standing with Stone Hive Bixies has been adjusted by -2.");
            Assert.NotNull(fact);
            Assert.Equal("Stone Hive Bixies", fact.Name);
            Assert.Equal(-2, fact.Change);

            fact = null;
            parser.ParseLine("[Sat Mar 19 11:17:05 2016] Your faction standing with Apparitions of Fear could not possibly get any worse.");
            Assert.NotNull(fact);
            Assert.Equal("Apparitions of Fear", fact.Name);
            Assert.Equal(0, fact.Change);

            fact = null;
            parser.ParseLine("[Sat Mar 19 11:17:05 2016] Your faction standing with Iceshard Manor could not possibly get any better.");
            Assert.NotNull(fact);
            Assert.Equal("Iceshard Manor", fact.Name);
            Assert.Equal(0, fact.Change);
        }
Пример #2
0
        private void TrackFaction(FactionEvent faction)
        {
            var f = Factions.FirstOrDefault(x => x.Name == faction.Name);

            if (f == null)
            {
                f = new FactionInfo {
                    Name = faction.Name
                };
                Factions.Add(f);
            }
            f.Count += 1;
            f.Sum   += faction.Change;
        }