Пример #1
0
        public FightCharacterCounts(Fight fight,
                                    bool includeNPCs = true, bool includeZeroDamageDones = true, bool includeZeroDamageTakens = true)
        {
            Fight = fight;

            foreach (var fightCharacter in fight.FightCharacters
                     .Where(c => (includeNPCs || c.IsPlayerOrFightPet) &&
                            (includeZeroDamageDones || c.MastersOrOwnTotalDamageDonePlusPets != 0) &&
                            (includeZeroDamageTakens || c.TotalDamageTaken != 0)))
            {
                ++FightCharacterCount;
                // We can recognize a character as a player w/o successfully retrieving their bio...
                if (fightCharacter.IsPlayer)
                {
                    ++PlayerCount;
                    // ...So we may not have their level yet, which affects average level calculations down below...
                    if (fightCharacter.Level.HasValue)
                    {
                        ++PlayerWithLevelCount;
                        TotalPlayerLevel      += fightCharacter.Level.Value;
                        TotalPlayerAlienLevel += fightCharacter.AlienLevel.Value;
                    }
                }
                // ...But if not-unknown checks down here succeed, it implies we have their bio, including their levels.
                if (fightCharacter.Faction == Faction.Omni)
                {
                    ++OmniPlayerCount;
                    TotalOmniPlayerLevel      += fightCharacter.Level.Value;
                    TotalOmniPlayerAlienLevel += fightCharacter.AlienLevel.Value;
                }
                if (fightCharacter.Faction == Faction.Clan)
                {
                    ++ClanPlayerCount;
                    TotalClanPlayerLevel      += fightCharacter.Level.Value;
                    TotalClanPlayerAlienLevel += fightCharacter.AlienLevel.Value;
                }
                if (fightCharacter.Faction == Faction.Neutral)
                {
                    ++NeutralPlayerCount;
                    TotalNeutralPlayerLevel      += fightCharacter.Level.Value;
                    TotalNeutralPlayerAlienLevel += fightCharacter.AlienLevel.Value;
                }
                if (fightCharacter.Faction == Faction.Unknown)
                {
                    ++UnknownPlayerCount;
                }
                if (fightCharacter.IsFightPet)
                {
                    ++FightPetCount;
                }
                if (!fightCharacter.IsPlayerOrFightPet)
                {
                    ++NPCCount;
                }

                if (fightCharacter.Profession != null)
                {
                    ++_professionCounts[fightCharacter.Profession];

                    if (fightCharacter.Profession != Profession.Unknown)
                    {
                        if (fightCharacter.Level != null)
                        {
                            _professionTotalLevels[fightCharacter.Profession]      += fightCharacter.Level.Value;
                            _professionTotalAlienLevels[fightCharacter.Profession] += fightCharacter.AlienLevel.Value;
                        }
                    }
                }
            }
        }
Пример #2
0
        public static FightEvent Create(Fight fight, string line)
        {
            // Lines look like this for example, the array part always having four elements:
            // ["#000000004200000a#","Other hit by other","",1492309026]Elitengi hit Leet for 6 points of cold damage.
            int lastIndexOfArrayPart = line.IndexOf(']');

            string[] arrayPart = line.Substring(1, lastIndexOfArrayPart - 1).Split(',')
                                 .Select(p => p.Trim('"'))
                                 .ToArray();
            string   eventName = arrayPart[1];
            DateTime timestamp = fight.DamageMeter.IsRealTimeMode ? DateTime.Now
                : DateTimeHelper.DateTimeLocalFromUnixSeconds(long.Parse(arrayPart[3]));
            string description = line.Substring(lastIndexOfArrayPart + 1);

            switch (eventName)
            {
            case MeCastNano.EventName: return(new MeCastNano(fight, timestamp, description));

            case MeGotHealth.EventName: return(new MeGotHealth(fight, timestamp, description));

            case MeGotNano.EventName: return(new MeGotNano(fight, timestamp, description));

            case MeGotSK.EventName: return(new MeGotSK(fight, timestamp, description));

            case MeGotXP.EventName: return(new MeGotXP(fight, timestamp, description));

            case MeHitByEnvironment.EventName: return(new MeHitByEnvironment(fight, timestamp, description));

            case MeHitByMonster.EventName: return(new MeHitByMonster(fight, timestamp, description));

            case MeHitByNano.EventName: return(new MeHitByNano(fight, timestamp, description));

            case MeHitByPlayer.EventName: return(new MeHitByPlayer(fight, timestamp, description));

            case OtherHitByNano.EventName: return(new OtherHitByNano(fight, timestamp, description));

            case OtherHitByOther.EventName: return(new OtherHitByOther(fight, timestamp, description));

            case OtherMisses.EventName: return(new OtherMisses(fight, timestamp, description));

            case Research.EventName: return(new Research(fight, timestamp, description));

            case SystemEvent.EventName: return(new SystemEvent(fight, timestamp, description));

            case YouGaveHealth.EventName: return(new YouGaveHealth(fight, timestamp, description));

            case YouGaveNano.EventName: return(new YouGaveNano(fight, timestamp, description));

            case YouHitOther.EventName: return(new YouHitOther(fight, timestamp, description));

            case YouHitOtherWithNano.EventName: return(new YouHitOtherWithNano(fight, timestamp, description));

            case YourMisses.EventName: return(new YourMisses(fight, timestamp, description));

            case YourPetHitByMonster.EventName: return(new YourPetHitByMonster(fight, timestamp, description));

            case YourPetHitByNano.EventName: return(new YourPetHitByNano(fight, timestamp, description));

            case YourPetHitByOther.EventName: return(new YourPetHitByOther(fight, timestamp, description));

            default: return(new UnrecognizedEvent(fight, timestamp, description));
            }
        }
Пример #3
0
 protected void SetSourceAndTargetToOwner()
 => Source = Target = Fight.GetOrCreateFightCharacter(DamageMeter.Owner, Timestamp);
Пример #4
0
 protected void SetSourceAndTargetToUnknown()
 => Source = Target = Fight.GetOrCreateFightCharacter("〈Unknown〉", Timestamp);
Пример #5
0
 protected FightEvent(Fight fight, DateTime timestamp, string description)
 {
     Fight       = fight;
     Timestamp   = timestamp;
     Description = description;
 }