Exemplo n.º 1
0
        private void _Contructor(Old_RaidBossFight _BossFight, List <string> _RaidMembers)
        {
            try
            {
                m_PlayerFightData = new List <Tuple <string, PlayerFightData> >();
                m_BossName        = _BossFight.GetBossName();
                m_AttemptType     = AttemptTypeConverter.Convert(_BossFight.GetFightData().GetAttemptType());
                m_StartDateTime   = _BossFight.GetStartDateTime();
                m_EndDateTime     = _BossFight.GetFightData().GetEndDateTime();
                m_FightDuration   = _BossFight.GetFightDuration();

                var realmDB   = Hidden._GlobalInitializationData.GetRealmDBFunc(_BossFight.GetRaid().Realm);
                var unitsData = _BossFight.GetFilteredPlayerUnitsData(true, realmDB.RD_GetPlayerIdentifierFunc(_BossFight));
                var petData   = _BossFight.GetFilteredPetUnitsData();
                List <Tuple <string, VF_RaidDamageDatabase.UnitData> > abusingPets = new List <Tuple <string, VF_RaidDamageDatabase.UnitData> >();
                foreach (var unitPet in petData)
                {
                    if (_RaidMembers.Contains(unitPet.Item1.Split('(').First()) == true)
                    {
                        //Player with Pet UnitPet should be banned from damagemeter or has its damage purged
                        string abusingPlayer = unitPet.Item1.Split(new string[] { "(Pet for ", ")" }, StringSplitOptions.RemoveEmptyEntries)[1];
                        abusingPets.Add(Tuple.Create(abusingPlayer, unitPet.Item2));
                    }
                }
                foreach (var unitData in unitsData)
                {
                    if (unitData.Item2.I.Death > 0 || unitData.Item2.I.Dmg > 0 || unitData.Item2.I.RawHeal > 0)
                    {
                        if (unitData.Item1 == "Unknown")
                        {
                            continue;
                        }

                        var petsAbused = abusingPets.FindAll((_Value) => { return(_Value.Item1 == unitData.Item1); });
                        if (petsAbused != null && petsAbused.Count > 0)
                        {
                            var unitFightData = unitData.Item2.CreateCopy();

                            foreach (var petAbused in petsAbused)
                            {
                                unitFightData.SubtractUnitData(petAbused.Item2);
                            }
                            PlayerFightData newFightData = new PlayerFightData(unitFightData);
                            newFightData.InitCache(this);
                            m_PlayerFightData.Add(Tuple.Create(unitData.Item1, newFightData));
                        }
                        else
                        {
                            PlayerFightData newFightData = new PlayerFightData(unitData.Item2);
                            newFightData.InitCache(this);
                            m_PlayerFightData.Add(Tuple.Create(unitData.Item1, newFightData));
                        }
                    }
                }
                m_DataPrecisionDetails = new DataPrecisionDetails(_BossFight, realmDB);
            }
            catch (Exception ex)
            {
                VF_RaidDamageDatabase.Logger.LogException(ex);
            }
        }