示例#1
0
 private void FillFilterUniqueData(LeagueData data, List <string> baseTypes, UniqueValue value)
 {
     foreach (string baseTy in baseTypes)
     {
         if (!data.Uniques.TryGetValue(baseTy, out UniqueBaseType unique))
         {
             if (baseTy == "Maelstr")
             {
                 if (!data.Uniques.TryGetValue("Maelström Staff", out unique))
                 {
                     unique = new UniqueBaseType("Maelström Staff");
                     data.Uniques.Add("Maelström Staff", unique);
                 }
             }
             else
             {
                 unique = new UniqueBaseType(baseTy);
                 data.Uniques.Add(baseTy, unique);
                 MessageBox.Show("Filter: unknown basetype: " + unique.BaseType, "Error", MessageBoxButtons.OK);
                 Environment.Exit(1);
             }
         }
         unique.FilterValue = value;
     }
 }
示例#2
0
 private void FillDivinationListView(ListView lv, LeagueData data)
 {
     lv.BeginUpdate();
     lv.Items.Clear();
     foreach (string div in model.DivinationCards)
     {
         if (!data.DivinationCards.TryGetValue(div, out DivinationCard divCard))
         {
             continue;
         }
         DivinationValue expect    = divCard.ExpectedFilterValue;
         string          severity  = divCard.SeverityLevel.ToString();
         string          filterVal = divCard.FilterValue.ToString();
         string          expectVal = expect.Value == divCard.FilterValue.Value ? "" : expect.ToString();
         string          listedVal = divCard.ChaosValue < 0.0f ? "?" : divCard.ChaosValue.ToString();
         lv.Items.Add(new ListViewItem(new string[] { div, severity, filterVal, expectVal, listedVal }));
     }
     lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[3].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[4].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.EndUpdate();
 }
示例#3
0
 private void FillUniqueListView(ListView lv, LeagueData data)
 {
     lv.BeginUpdate();
     lv.Items.Clear();
     foreach (string baseType in model.Uniques)
     {
         if (!data.Uniques.TryGetValue(baseType, out UniqueBaseType uniqData))
         {
             continue;
         }
         string values = "";
         foreach (UniqueItem udata in uniqData.Items)
         {
             if (udata.Links > 4)
             {
                 values += "(" + udata.Links + "L)";
             }
             string value = udata.Count > 0 ? udata.ChaosValue.ToString() : "?";
             values += udata.Name + ": " + value + ", ";
         }
         UniqueValue expect     = uniqData.ExpectedFilterValue;
         string      severity   = uniqData.SeverityLevel.ToString();
         string      filterVal  = uniqData.FilterValue.ToString();
         string      expectVal  = expect.Value == uniqData.FilterValue.Value ? "" : expect.ToString();
         string      listedVals = values.Substring(0, values.Length - 2);
         lv.Items.Add(new ListViewItem(new string[] { baseType, severity, filterVal, expectVal, listedVals }));
     }
     lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[3].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[4].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.EndUpdate();
 }
示例#4
0
        private void GetJsonData(LeagueData data)
        {
            string leagueStr = data.IsHardcore ? "Hardcore " + league : league;

            FillJsonData(string.Format(jsonURL, "DivinationCards", leagueStr), data, DivinationJsonHandler);
            FillJsonData(string.Format(jsonURL, "UniqueArmour", leagueStr), data, UniqueJsonHandler);
            FillJsonData(string.Format(jsonURL, "UniqueFlask", leagueStr), data, UniqueJsonHandler);
            FillJsonData(string.Format(jsonURL, "UniqueWeapon", leagueStr), data, UniqueJsonHandler);
            FillJsonData(string.Format(jsonURL, "UniqueAccessory", leagueStr), data, UniqueJsonHandler);
        }
示例#5
0
        private void DivinationJsonHandler(ItemData jdata, LeagueData data)
        {
            string name = jdata.Name;

            if (!data.DivinationCards.ContainsKey(name))
            {
                DivinationCard div = new DivinationCard();
                data.DivinationCards.Add(name, div);
            }
            data.DivinationCards[name].Load(jdata);
        }
示例#6
0
        private void DivinationJsonHandler(JsonData jdata, LeagueData data)
        {
            string name = jdata.Name;

            if (!data.DivinationCards.TryGetValue(name, out DivinationCard div))
            {
                div = new DivinationCard();
                data.DivinationCards.Add(name, div);
            }
            data.DivinationCards[name].Load(jdata);
        }
示例#7
0
 private void FillFilterDivinationData(LeagueData data, List <string> baseTypes, DivinationValue value)
 {
     foreach (string baseTy in baseTypes)
     {
         if (!data.DivinationCards.TryGetValue(baseTy, out DivinationCard divCard))
         {
             divCard = new DivinationCard(baseTy);
             data.DivinationCards.Add(baseTy, divCard);
         }
         divCard.FilterValue = value;
     }
 }
示例#8
0
 private void FillFilterEnchantData(LeagueData data, IEnumerable <string> enchantTypes, EnchantmentValue value)
 {
     foreach (string enchType in enchantTypes)
     {
         if (!data.Enchantments.TryGetValue(enchType, out Enchantment ench))
         {
             ench = new Enchantment(enchType);
             data.Enchantments.Add(enchType, ench);
         }
         ench.FilterValue = value;
     }
 }
示例#9
0
        private void EnchantJsonHandler(ItemData jdata, LeagueData data)
        {
            string description = jdata.Name.Trim();

            if (!data.EnchantmentsDescriptions.TryGetValue(description, out Enchantment ench))
            {
                ench = new Enchantment(description);
                data.EnchantmentsDescriptions.Add(description, ench);
                EnchantsErrors.Add(jdata);
            }
            ench.Load(jdata);
        }
示例#10
0
 public FilterWriter(DataModel model, LeagueData l1, LeagueData l2)
 {
     Model           = model;
     DivinationCards = model.DivinationCards;
     Enchantments    = model.Enchantments;
     UniquesA        = l1.Uniques;
     UniquesB        = l2.Uniques;
     DivinationA     = l1.DivinationCards;
     DivinationB     = l2.DivinationCards;
     EnchantsA       = l1.Enchantments;
     EnchantsB       = l2.Enchantments;
     Conflicts       = model.DivinationCardNameConflicts;
 }
示例#11
0
        private void UniqueJsonHandler(ItemData jdata, LeagueData data)
        {
            string baseTy = jdata.BaseType;

            if (!data.Uniques.TryGetValue(baseTy, out UniqueBaseType uniq))
            {
                uniq = new UniqueBaseType(baseTy);
                data.Uniques.Add(baseTy, uniq);
            }
            if (!uniq.Add(jdata))
            {
                UniquesErrors.Add(jdata);
            }
        }
示例#12
0
 private void FillDivination(DataTable table, LeagueData data)
 {
     table.Clear();
     foreach (DivinationCard divCard in data.DivinationCards.Values)
     {
         DataRow row = table.NewRow();
         row["Divination Card"] = divCard.Name;
         row["Severity"]        = divCard.SeverityLevel;
         row["Filter"]          = divCard.FilterValue;
         row["Expected"]        = divCard.ExpectedFilterValue;          // expect.Value == divCard.FilterValue.Value ? "" : expect.ToString();
         row["Value"]           = divCard.ChaosValue < 0.0f ? DBNull.Value : (object)divCard.ChaosValue;
         table.Rows.Add(row);
     }
 }
示例#13
0
 private void FillUniques(DataTable table, LeagueData data)
 {
     table.Clear();
     foreach (UniqueBaseType unique in data.Uniques.Values)
     {
         DataRow row = table.NewRow();
         row["BaseType"] = unique.BaseType;
         row["Severity"] = unique.SeverityLevel;
         row["Filter"]   = unique.FilterValue;
         row["Expected"] = unique.ExpectedFilterValue;                 // expect.Value == unique.FilterValue.Value ? "" : expect.ToString();
         row["Min"]      = (object)unique.MinValue ?? DBNull.Value;
         row["Max"]      = (object)unique.MaxValue ?? DBNull.Value;
         row["Uniques"]  = unique.GetString();
         table.Rows.Add(row);
     }
 }
示例#14
0
 private void FillEnchants(DataTable table, LeagueData data)
 {
     table.Clear();
     foreach (Enchantment ench in data.Enchantments.Values)
     {
         DataRow row = table.NewRow();
         row["Gem"]         = ench.Gem;
         row["Enchantment"] = ench.Description;
         row["Severity"]    = ench.SeverityLevel;
         row["Filter"]      = ench.FilterValue;
         row["Expected"]    = ench.ExpectedFilterValue;              // expect.Value == ench.FilterValue.Value ? "" : expect.ToString();
         row["Value"]       = ench.ChaosValue < 0.0f ? DBNull.Value : (object)ench.ChaosValue;
         row["Name"]        = ench.Name;
         table.Rows.Add(row);
     }
 }
示例#15
0
        private void EnchantJsonHandler(JsonData jdata, LeagueData data)
        {
            string description = jdata.Name.Trim();

            if (!data.EnchantmentsDescriptions.TryGetValue(description, out Enchantment ench))
            {
                ench = new Enchantment(description);
                data.EnchantmentsDescriptions.Add(description, ench);
                MessageBox.Show("JSON: The CSV file is missing Enchantment: " + description, "Error", MessageBoxButtons.OK);
                ErrorCount++;
            }
            ench.Load(jdata);
            if (ErrorCount > MaxErrors)
            {
                Environment.Exit(1);
            }
        }
示例#16
0
        private void Sort(LeagueData data, string baseType)
        {
            List <UniqueItem> resortList = new List <UniqueItem>();
            List <UniqueItem> items      = data.Uniques[baseType].Items;

            foreach (UniqueItem item in items)
            {
                if (item.League.Length > 0)
                {
                    resortList.Add(item);
                }
            }
            foreach (UniqueItem item in resortList)
            {
                items.Remove(item);
                items.Add(item);
            }
        }
示例#17
0
        private void FillJsonData(string url, LeagueData data, Action <JsonData, LeagueData> handler)
        {
            string jsonURLString = ReadWebPage(url, "application/json");

            if (jsonURLString.Length == 0)
            {
                MessageBox.Show("Failed to read the web URL: " + url, "Error", MessageBoxButtons.OK);
                Environment.Exit(1);
            }
            else
            {
                JObject jsonString = JObject.Parse(jsonURLString);
                JToken  results    = jsonString["lines"];
                foreach (JToken result in results)
                {
                    JsonData jdata = result.ToObject <JsonData>();
                    handler(jdata, data);
                }
            }
        }
示例#18
0
        private void UniqueJsonHandler(JsonData jdata, LeagueData data)
        {
            string baseTy = jdata.BaseType;

            if (!data.Uniques.TryGetValue(baseTy, out UniqueBaseType uniq))
            {
                uniq = new UniqueBaseType(baseTy);
                data.Uniques.Add(baseTy, uniq);
                if (!data.IsHardcore)
                {
                    MessageBox.Show("JSON: The CSV file is missing BaseType: " + baseTy, "Error", MessageBoxButtons.OK);
                    ErrorCount++;
                }
            }
            if (!uniq.Add(jdata) && !data.IsHardcore)
            {
                MessageBox.Show("JSON: The CSV file is missing: " + jdata.BaseType + " " + jdata.Name, "Error", MessageBoxButtons.OK);
                ErrorCount++;
            }
            if (ErrorCount > MaxErrors)
            {
                Environment.Exit(1);
            }
        }
示例#19
0
 private void Sort(LeagueData data, string baseType)
 {
     data.Uniques[baseType].Sort();
 }