コード例 #1
0
        public PlayerFaction GetFaction(RealmDB _RealmDB)
        {
            int hordeCount       = 0;
            int allianceCount    = 0;
            var playersFightData = m_Raids.Last().Value.BossFights.Last().PlayerFightData;

            foreach (var playerData in playersFightData)
            {
                var player = _RealmDB.FindPlayer(playerData.Item1);
                if (player != null)
                {
                    PlayerFaction playerFaction = VF_RealmPlayersDatabase.StaticValues.GetFaction(player.Character.Race);
                    if (playerFaction == PlayerFaction.Horde)
                    {
                        ++hordeCount;
                    }
                    else if (playerFaction == PlayerFaction.Alliance)
                    {
                        ++allianceCount;
                    }

                    if (hordeCount - allianceCount > 10)
                    {
                        return(PlayerFaction.Horde);
                    }
                    else if (allianceCount - hordeCount > 10)
                    {
                        return(PlayerFaction.Alliance);
                    }
                }
            }
            if (hordeCount > allianceCount)
            {
                return(PlayerFaction.Horde);
            }
            else
            {
                return(PlayerFaction.Alliance);
            }
        }
コード例 #2
0
        private static string GeneratePlayerDeaths(VF_RaidDamageDatabase.RealmDB realmDB, List <Tuple <string, VF_RaidDamageDatabase.UnitData> > fullUnitDatas)
        {
            var playerDeaths = new List <Tuple <int, string> >();

            foreach (var data in fullUnitDatas)
            {
                if (data.Item2.I.Death > 0 || data.Item2.I.Dmg > 0 || data.Item2.I.RawHeal > 0)
                {
                    playerDeaths.Add(Tuple.Create(data.Item2.I.Death, data.Item1));
                }
            }
            if (playerDeaths.Count == 0)
            {
                return("");
            }
            int    totalPlayerDeaths   = 0;
            string playerDeathsStr     = "";
            var    orderedPlayerDeaths = playerDeaths.OrderByDescending((_Value) => _Value.Item1);
            int    lastDeathCount      = orderedPlayerDeaths.First().Item1;

            playerDeathsStr += lastDeathCount.ToString() + " Deaths: ";
            foreach (var playerDeath in orderedPlayerDeaths)
            {
                var playerData = realmDB.FindPlayer(playerDeath.Item2);
                if (playerData != null)
                {
                    if (lastDeathCount != playerDeath.Item1)
                    {
                        playerDeathsStr += "<br/>" + playerDeath.Item1.ToString() + " Deaths: ";
                        lastDeathCount   = playerDeath.Item1;
                    }
                    playerDeathsStr   += PageUtility.CreateColorCodedName(playerData) + ", ";
                    totalPlayerDeaths += playerDeath.Item1;
                }
            }
            return("<h3>Player deaths(total " + totalPlayerDeaths + ")</h3>" + playerDeathsStr);
        }