示例#1
0
        private void ProcessMobs(KPDatabaseDataSet dataSet, MobFilter mobFilter,
                                 ref StringBuilder sb, List <StringMods> strModList)
        {
            var allBattles = from b in dataSet.Battles
                             where mobFilter.CheckFilterBattle(b) == true
                             select b;

            // Actual killed mobs
            var battles = allBattles.Where(b => b.Killed == true);

            int battleCount = battles.Count();

            string tmpStr = "Mobs";

            strModList.Add(new StringMods
            {
                Start  = sb.Length,
                Length = tmpStr.Length,
                Bold   = true,
                Color  = Color.Red
            });
            sb.Append(tmpStr + "\n\n");

            sb.AppendFormat("Total number of mobs: {0}\n\n", battles.Count());

            if (battleCount > 0)
            {
                // Types of kills
                var dropDead = battles.Where(b => b.IsKillerIDNull() == true);

                var lastActions = from b in battles
                                  where b.IsKillerIDNull() == false
                                  select new
                {
                    Battle     = b,
                    LastAction = GetLastAction(b)
                };

                int meleeCount    = 0;
                int magicCount    = 0;
                int wsCount       = 0;
                int jaCount       = 0;
                int otherCount    = 0;
                int dropDeadCount = 0;
                int unknownCount  = 0;
                int petCount      = 0;

                dropDeadCount = dropDead.Count();

                foreach (var action in lastActions)
                {
                    if (action.LastAction == null)
                    {
                        unknownCount++;
                    }
                    else
                    {
                        switch ((ActionType)action.LastAction.ActionType)
                        {
                        case ActionType.Ability:
                            jaCount++;
                            break;

                        case ActionType.Spell:
                            magicCount++;
                            break;

                        case ActionType.Weaponskill:
                        case ActionType.Skillchain:
                            wsCount++;
                            break;

                        case ActionType.Melee:
                        case ActionType.Ranged:
                        case ActionType.Counterattack:
                        case ActionType.Retaliation:
                            meleeCount++;
                            break;

                        default:
                            otherCount++;
                            break;
                        }
                        ;

                        if ((EntityType)action.LastAction.CombatantsRowByActorCombatantRelation.CombatantType
                            == EntityType.Pet)
                        {
                            petCount++;
                        }
                    }
                }


                tmpStr = "Kill Types:";

                strModList.Add(new StringMods
                {
                    Start  = sb.Length,
                    Length = tmpStr.Length,
                    Bold   = true,
                    Color  = Color.Black
                });
                sb.Append(tmpStr + "\n\n");

                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Melee",
                                meleeCount, (double)meleeCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Magic",
                                magicCount, (double)magicCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Weaponskill",
                                wsCount, (double)wsCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Ability",
                                jaCount, (double)jaCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Other",
                                otherCount, (double)otherCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Drop dead",
                                dropDeadCount, (double)dropDeadCount / battleCount);
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Unknown",
                                unknownCount, (double)unknownCount / battleCount);
                sb.Append("\n");
                sb.AppendFormat("{0,-14}: {1,6}  ({2,8:p2})\n", "Pets",
                                petCount, (double)petCount / battleCount);

                sb.Append("\n\n");

                // Cruor
                tmpStr = "Cruor:";
                strModList.Add(new StringMods
                {
                    Start  = sb.Length,
                    Length = tmpStr.Length,
                    Bold   = true,
                    Color  = Color.Black
                });
                sb.Append(tmpStr + "\n\n");

                var cruorBattles = battles.Where(b => b.GetLootRows().Any(l => l.ItemsRow.ItemName == lsCruor));

                sb.AppendFormat("Number of mobs that dropped Cruor : {0}\n", cruorBattles.Count());

                if (cruorBattles.Any())
                {
                    int totalCruor = cruorBattles.Sum(b =>
                                                      b.GetLootRows().First(l => l.ItemsRow.ItemName == lsCruor).GilDropped);
                    double avgCruor = (double)totalCruor / cruorBattles.Count();
                    sb.AppendFormat("Total Cruor drop (mobs) : {0}\n", totalCruor);
                    sb.AppendFormat("Average Cruor drop      : {0:f2}\n", avgCruor);
                }

                sb.Append("\n\n");
            }
        }
示例#2
0
        private void ProcessChests(KPDatabaseDataSet dataSet, MobFilter mobFilter,
                                   ref StringBuilder sb, List <StringMods> strModList)
        {
            string tmpStr = "Chests";

            strModList.Add(new StringMods
            {
                Start  = sb.Length,
                Length = tmpStr.Length,
                Bold   = true,
                Color  = Color.Red
            });
            sb.Append(tmpStr + "\n\n");

            var selectBattles = from b in dataSet.Battles
                                where mobFilter.CheckFilterBattle(b) == true
                                select b;

            var droppedChests = from b in selectBattles
                                where b.GetLootRows().Any() &&
                                b.GetLootRows().Any(l => l.ItemsRow.ItemName == lsTreasureChest)
                                select b;

            int droppedChestCount = droppedChests.Count();

            var chestBattles = from b in dataSet.Battles
                               where b.IsEnemyIDNull() == false &&
                               (EntityType)b.CombatantsRowByEnemyCombatantRelation.CombatantType == EntityType.TreasureChest
                               select b;

            int failedChests         = 0;
            int expiredChests        = 0;
            int openedChests         = 0;
            int usedKey              = 0;
            int chestsWithCruor      = 0;
            int cruorTotal           = 0;
            int chestsWithExperience = 0;
            int experienceTotal      = 0;
            int chestsWithTE         = 0;

            foreach (var chestBattle in chestBattles)
            {
                if (chestBattle.Killed)
                {
                    openedChests++;

                    if (chestBattle.GetInteractionsRows()
                        .Any(i => i.IsItemIDNull() == false && i.ItemsRow.ItemName == lsKey))
                    {
                        usedKey++;
                    }

                    if (chestBattle.ExperiencePoints > 0)
                    {
                        chestsWithExperience++;
                        experienceTotal += chestBattle.ExperiencePoints;
                    }
                    else
                    {
                        var chestLoot = chestBattle.GetLootRows();

                        if (chestLoot.Any())
                        {
                            var cruorLoot = chestLoot.Where(l => l.ItemsRow.ItemName == lsCruor);

                            if ((cruorLoot != null) && (cruorLoot.Any()))
                            {
                                chestsWithCruor++;
                                cruorTotal += cruorLoot.Sum(l => l.GilDropped);
                            }

                            var teLoot = chestLoot.Where(l => l.ItemsRow.ItemName == lsTimeExtension);

                            if ((teLoot != null) && (teLoot.Any()))
                            {
                                chestsWithTE++;
                            }
                        }
                    }
                }
                else
                {
                    if (chestBattle.GetInteractionsRows()
                        .Any(i => (FailedActionType)i.FailedActionType == FailedActionType.FailedUnlock))
                    {
                        failedChests++;
                    }
                    else
                    {
                        expiredChests++;
                    }
                }
            }

            if (droppedChestCount + failedChests + openedChests > 0)
            {
                sb.AppendFormat("Dropped chests : {0}\n", droppedChestCount);
                sb.AppendFormat("Expired chests : {0}\n", expiredChests);
                sb.AppendFormat("Failed chests  : {0}\n", failedChests);
                sb.Append("\n");
                sb.AppendFormat("Opened chests  : {0}\n", openedChests);
                sb.AppendFormat(" - Using a key : {0}\n", usedKey);
                sb.Append("\n");

                if (chestsWithTE > 0)
                {
                    sb.AppendFormat("Chests that granted Time Extensions : {0}\n", chestsWithTE);
                    sb.AppendFormat(" - Total time gained  : {0}\n",
                                    new TimeSpan(0, chestsWithTE * 10, 0).FormattedShortTimeSpanString());
                    sb.Append("\n");
                }

                if (chestsWithExperience > 0)
                {
                    sb.AppendFormat("Chests that granted experience : {0}\n", chestsWithExperience);
                    sb.AppendFormat(" - Total experience   : {0}\n", experienceTotal);
                    sb.AppendFormat(" - Average experience : {0:f2}\n", (double)experienceTotal / chestsWithExperience);
                    sb.Append("\n");
                }

                if (chestsWithCruor > 0)
                {
                    sb.AppendFormat("Chests that granted Cruor : {0}\n", chestsWithCruor);
                    sb.AppendFormat(" - Total Cruor        : {0}\n", cruorTotal);
                    sb.AppendFormat(" - Average Cruor      : {0:f2}\n", (double)cruorTotal / chestsWithCruor);
                }

                sb.Append("\n\n");
            }
        }
示例#3
0
        private void ProcessLights(KPDatabaseDataSet dataSet, MobFilter mobFilter,
                                   ref StringBuilder sb, List <StringMods> strModList)
        {
            string tmpStr = "Lights";

            strModList.Add(new StringMods
            {
                Start  = sb.Length,
                Length = tmpStr.Length,
                Bold   = true,
                Color  = Color.Red
            });
            sb.Append(tmpStr + "\n\n");

            var allBattles = from b in dataSet.Battles
                             where mobFilter.CheckFilterBattle(b) == true ||
                             (b.IsEnemyIDNull() == false &&
                              (EntityType)b.CombatantsRowByEnemyCombatantRelation.CombatantType == EntityType.TreasureChest)
                             select b;

            var lightRewards = from b in allBattles
                               let loot                         = b.GetLootRows()
                                                      let light = loot.FirstOrDefault(l => colorLight.Match(l.ItemsRow.ItemName).Success == true)
                                                                  where light != null
                                                                  group b by light.ItemsRow.ItemName;

            // Header
            string formatString = "{0,-18} : {1,10}{2,14}{3,10}";

            tmpStr = string.Format(formatString,
                                   "Color Light",
                                   "From Mobs",
                                   "From Chests",
                                   "Total");

            strModList.Add(new StringMods
            {
                Start     = sb.Length,
                Length    = tmpStr.Length,
                Bold      = true,
                Underline = true,
                Color     = Color.Black
            });
            sb.Append(tmpStr + "\n");


            int totalMobCount   = 0;
            int totalChestCount = 0;
            int totalCount      = 0;

            foreach (var light in lightRewards.OrderBy(a => a.Key))
            {
                int lightCount      = light.Count();
                int chestLightCount = light.Count(a =>
                                                  (EntityType)a.CombatantsRowByEnemyCombatantRelation.CombatantType == EntityType.TreasureChest);

                int mobLightCount = lightCount - chestLightCount;

                totalCount      += lightCount;
                totalMobCount   += mobLightCount;
                totalChestCount += chestLightCount;

                sb.AppendFormat(formatString,
                                light.Key,
                                mobLightCount,
                                chestLightCount,
                                lightCount);
                sb.Append("\n");
            }

            if (totalCount > 0)
            {
                sb.Append("\n");
                sb.AppendFormat(formatString,
                                "Total",
                                totalMobCount,
                                totalChestCount,
                                totalCount);
                sb.Append("\n");
            }


            sb.Append("\n\n");
        }