Пример #1
0
        private void OnLoadFilesComplete()
        {
            if (chkGeneratecontainersLootJson.Checked)
            {
                var workignOutputJsonFolder = Path.Combine(txtOutputPath.Text, DateTime.Now.ToString("yyyy-MM-dd HH-mm") + " containers json");

                if (!Directory.Exists(workignOutputJsonFolder))
                {
                    Directory.CreateDirectory(workignOutputJsonFolder);
                }

                foreach (var kvp in containersLoot)
                {
                    var containersLootJson = JsonConvert.SerializeObject(kvp.Value);
                    File.WriteAllText(Path.Combine(workignOutputJsonFolder, $"{kvp.Key}.json"), containersLootJson);
                }

                return;
            }


            var workignOutputFolder = Path.Combine(txtOutputPath.Text, DateTime.Now.ToString("yyyy-MM-dd HH-mm"));

            if (!Directory.Exists(workignOutputFolder))
            {
                Directory.CreateDirectory(workignOutputFolder);
            }


            // Calculate the stats
            StatsCalculator.Calculate(containersLoot);


            // Populate the Containers tab
            var dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Tier", typeof(int));
            dt.Columns.Add("Hits", typeof(int));
            dt.Columns.Add("Average Items", typeof(float));
            dt.Columns.Add("Total Items", typeof(int));

            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                var dr = dt.NewRow();

                dr["Name"] = stats.ContainerName;
                dr["Tier"] = stats.Tier;
                dr["Hits"] = stats.TotalContainers;

                dr["Average Items"] = stats.TotalItems / (float)stats.TotalContainers;
                dr["Total Items"]   = stats.TotalItems;

                dt.Rows.Add(dr);
            }

            dataGridView1.DataSource = dt;

            dataGridView1.Columns["Hits"].DefaultCellStyle.Format          = "N0";
            dataGridView1.Columns["Average Items"].DefaultCellStyle.Format = "0.0";
            dataGridView1.Columns["Total Items"].DefaultCellStyle.Format   = "N0";

            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                if (i == 0)
                {
                    continue;
                }

                dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }

            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.AutoResizeColumns();


            // Output stats by tier
            foreach (var kvp in StatsCalculator.StatsByLootTier)
            {
                File.WriteAllText(Path.Combine(workignOutputFolder, "Tier " + kvp.Key + " (No Chests).txt"), kvp.Value.ToString());
            }

            // Output stats by container name
            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                File.WriteAllText(Path.Combine(workignOutputFolder, "Container " + stats.ContainerName + $" (T{stats.Tier}).txt"), stats.ToString());
            }


            // Audit all the containers for anomolies
            File.Delete(Path.Combine(workignOutputFolder, "Tier Container Audit.txt"));
            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                // Chests of the same name can contain multiple tiers
                if (ContainerInfo.IsChest(stats.ContainerName))
                {
                    continue;
                }

                outputAuditLine = false;

                ContainerTierAuditSpells(stats, 1, Mag.Shared.Spells.Spell.BuffLevels.I, Mag.Shared.Spells.Spell.BuffLevels.III);
                ContainerTierAuditSpells(stats, 2, Mag.Shared.Spells.Spell.BuffLevels.III, Mag.Shared.Spells.Spell.BuffLevels.V);
                ContainerTierAuditSpells(stats, 3, Mag.Shared.Spells.Spell.BuffLevels.IV, Mag.Shared.Spells.Spell.BuffLevels.VI);
                ContainerTierAuditSpells(stats, 4, Mag.Shared.Spells.Spell.BuffLevels.IV, Mag.Shared.Spells.Spell.BuffLevels.VI);
                ContainerTierAuditSpells(stats, 5, Mag.Shared.Spells.Spell.BuffLevels.V, Mag.Shared.Spells.Spell.BuffLevels.VII);
                ContainerTierAuditSpells(stats, 6, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VII);
                ContainerTierAuditSpells(stats, 7, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VIII);
                ContainerTierAuditSpells(stats, 8, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VIII);

                ContainerTierAuditWieldReqs(stats, 1, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    0
                });
                ContainerTierAuditWieldReqs(stats, 2, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    0, 250
                });
                ContainerTierAuditWieldReqs(stats, 3, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    0, 250, 300
                });
                ContainerTierAuditWieldReqs(stats, 4, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    0, 250, 300, 325
                });
                ContainerTierAuditWieldReqs(stats, 5, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    300, 325, 350
                });
                ContainerTierAuditWieldReqs(stats, 6, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    350, 370, 400
                });
                ContainerTierAuditWieldReqs(stats, 7, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    370, 400, 420
                });
                ContainerTierAuditWieldReqs(stats, 8, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.TwoHandedCombat, (int)Skill.HeavyWeapons, (int)Skill.LightWeapons, (int)Skill.FinesseWeapons
                }, new HashSet <int> {
                    400, 420, 430
                });

                ContainerTierAuditWieldReqs(stats, 1, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    0
                });
                ContainerTierAuditWieldReqs(stats, 2, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    0, 250
                });
                ContainerTierAuditWieldReqs(stats, 3, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    0, 250, 270
                });
                ContainerTierAuditWieldReqs(stats, 4, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    250, 270, 290
                });
                ContainerTierAuditWieldReqs(stats, 5, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    270, 290, 315
                });
                ContainerTierAuditWieldReqs(stats, 6, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    315, 335, 360
                });
                ContainerTierAuditWieldReqs(stats, 7, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    335, 360, 375
                });
                ContainerTierAuditWieldReqs(stats, 8, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.MissileWeapons
                }, new HashSet <int> {
                    360, 375, 385
                });

                ContainerTierAuditWieldReqs(stats, 1, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0
                });
                ContainerTierAuditWieldReqs(stats, 2, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0
                });
                ContainerTierAuditWieldReqs(stats, 3, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0
                });
                ContainerTierAuditWieldReqs(stats, 4, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0, 290
                });
                ContainerTierAuditWieldReqs(stats, 5, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0, 290, 310
                });
                ContainerTierAuditWieldReqs(stats, 6, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    0, 290, 310, 330, 355
                });
                ContainerTierAuditWieldReqs(stats, 7, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    330, 355, 375
                });
                ContainerTierAuditWieldReqs(stats, 8, (int)WieldRequirement.RawSkill, new HashSet <int> {
                    (int)Skill.WarMagic, (int)Skill.VoidMagic
                }, new HashSet <int> {
                    355, 375, 385
                });

                if (outputAuditLine)
                {
                    File.AppendAllText(Path.Combine(workignOutputFolder, "Tier Container Audit.txt"), Environment.NewLine);
                }
            }
        }
Пример #2
0
        private void OnLoadFilesComplete()
        {
            // Calculate the stats
            StatsCalculator.Calculate(containersLoot);


            // Populate the Containers tab
            var dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Tier", typeof(int));
            dt.Columns.Add("Hits", typeof(int));
            dt.Columns.Add("Average Items", typeof(float));
            dt.Columns.Add("Total Items", typeof(int));

            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                var dr = dt.NewRow();

                dr["Name"] = stats.ContainerName;
                dr["Tier"] = stats.Tier;
                dr["Hits"] = stats.TotalContainers;

                dr["Average Items"] = stats.TotalItems / (float)stats.TotalContainers;
                dr["Total Items"]   = stats.TotalItems;

                dt.Rows.Add(dr);
            }

            dataGridView1.DataSource = dt;

            dataGridView1.Columns["Hits"].DefaultCellStyle.Format          = "N0";
            dataGridView1.Columns["Average Items"].DefaultCellStyle.Format = "0.0";
            dataGridView1.Columns["Total Items"].DefaultCellStyle.Format   = "N0";

            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                if (i == 0)
                {
                    continue;
                }

                dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }

            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.AutoResizeColumns();


            // Output stats by tier
            foreach (var kvp in StatsCalculator.StatsByLootTier)
            {
                File.WriteAllText(Path.Combine(txtOutputPath.Text, "Tier " + kvp.Key + ".txt"), kvp.Value.ToString());
            }

            // Output stats by container name
            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                File.WriteAllText(Path.Combine(txtOutputPath.Text, "Container " + stats.ContainerName + $" (T{stats.Tier}).txt"), stats.ToString());
            }


            // Audit all the containers for anomolies
            File.Delete(Path.Combine(txtOutputPath.Text, "Tier Container Audit.txt"));
            foreach (var stats in StatsCalculator.StatsByContainerNameAndTier)
            {
                outputAuditLine = false;

                ContainerTierAudit(stats, 1, Mag.Shared.Spells.Spell.BuffLevels.I, Mag.Shared.Spells.Spell.BuffLevels.III);
                ContainerTierAudit(stats, 2, Mag.Shared.Spells.Spell.BuffLevels.III, Mag.Shared.Spells.Spell.BuffLevels.V);
                ContainerTierAudit(stats, 3, Mag.Shared.Spells.Spell.BuffLevels.IV, Mag.Shared.Spells.Spell.BuffLevels.VI);
                ContainerTierAudit(stats, 4, Mag.Shared.Spells.Spell.BuffLevels.IV, Mag.Shared.Spells.Spell.BuffLevels.VI);
                ContainerTierAudit(stats, 5, Mag.Shared.Spells.Spell.BuffLevels.V, Mag.Shared.Spells.Spell.BuffLevels.VII);
                ContainerTierAudit(stats, 6, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VII);
                ContainerTierAudit(stats, 7, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VIII);
                ContainerTierAudit(stats, 8, Mag.Shared.Spells.Spell.BuffLevels.VI, Mag.Shared.Spells.Spell.BuffLevels.VIII);

                if (outputAuditLine)
                {
                    File.AppendAllText(Path.Combine(txtOutputPath.Text, "Tier Container Audit.txt"), Environment.NewLine);
                }
            }
        }
Пример #3
0
        private void OnLoadFilesComplete()
        {
            var sb = new StringBuilder();


            // Calculate the loot tiers
            TierCalculator.Calculate(containersLoot);


            // Populate the Containers tab
            var dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Tier", typeof(int));
            dt.Columns.Add("Hits", typeof(int));
            dt.Columns.Add("Average Items", typeof(float));
            dt.Columns.Add("Total Items", typeof(int));

            foreach (var kvp in containersLoot)
            {
                var dr = dt.NewRow();

                dr["Name"] = kvp.Key;
                dr["Tier"] = TierCalculator.GetTierByContainerName(kvp.Key);
                dr["Hits"] = kvp.Value.Count;

                var totalItems = 0;

                foreach (var containers in kvp.Value)
                {
                    totalItems += containers.Value.Count;
                }

                dr["Average Items"] = totalItems / (float)kvp.Value.Count;
                dr["Total Items"]   = totalItems;

                dt.Rows.Add(dr);
            }

            dataGridView1.DataSource = dt;

            dataGridView1.Columns["Hits"].DefaultCellStyle.Format          = "N0";
            dataGridView1.Columns["Average Items"].DefaultCellStyle.Format = "0.0";
            dataGridView1.Columns["Total Items"].DefaultCellStyle.Format   = "N0";

            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                if (i == 0)
                {
                    continue;
                }

                dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }

            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.AutoResizeColumns();


            // Calculate the stats
            StatsCalculator.Calculate(containersLoot);


            // Output stats by tier
            sb.Clear();
            foreach (var kvp in StatsCalculator.StatsByLootTier)
            {
                sb.AppendLine();
                sb.AppendLine("========== Tier " + kvp.Key + " ==========");
                sb.Append(kvp.Value);
            }
            txtRawOutput1.Text = sb.ToString();

            // Output stats by container name
            sb.Clear();
            foreach (var kvp in StatsCalculator.StatsByContainerName)
            {
                sb.AppendLine();
                sb.AppendLine("========== Container Name " + kvp.Key + " ==========");
                sb.Append(kvp.Value);
            }
            txtRawOutput2.Text = sb.ToString();
        }