private string GetAffixes(int i) { if (i == -1) { return(string.Empty); } var table = Manager.GetDataTable("AFFIXES"); var affix = table.Rows[i]["property1"].ToString(); var evaluator = new Evaluator { Unit = new Item() }; evaluator.Evaluate(affix); var result = ItemDisplay.GetDisplayStrings(evaluator.Unit); var transform = ConcatStrings(result); return(transform); }
public override string ExportTableInsertScript() { SQLTableScript table = new SQLTableScript("id", "code", "id INT NOT NULL", "code VARCHAR(6) NOT NULL", "name TEXT NOT NULL", "formatted_name TEXT NOT NULL", "display_string TEXT NOT NULL", "ilvl INT NOT NULL", "faction TEXT" ); var affixes = Manager.GetDataTable("AFFIXES"); string id, code, magicName, formattedName, displayString, ilvl, typeList, faction; string property1, type; Evaluator evaluator = new Evaluator(); ItemDisplay.Manager = Manager; evaluator.Manager = Manager; foreach (DataRow row in affixes.Rows) { //don't show affixes that aren't used/implemented if ((int)row["spawn"] == 0) { continue; } //skip non-armorsets magicName = row["setNameString_string"].ToString(); if (String.IsNullOrWhiteSpace(magicName)) { continue; } type = row["affixType1_string"].ToString(); if (type.CompareTo("armorset") != 0) { continue; } faction = row["onlyOnItemsRequiringUnitType_string"].ToString(); if (!String.IsNullOrWhiteSpace(faction)) { faction = GetSqlString(faction); } Unit unit = new Item(); Game3 game3 = new Game3(); evaluator.Unit = unit; evaluator.Game3 = game3; property1 = string.Empty; for (int i = 1; i < 7; i++) { property1 += row["property" + i].ToString(); } //not sure how armor affixes normally work on regular items (random?), //so skip the blank ones and only display the ilvl that produces the effects on uniques of non-standard ilvls if (string.IsNullOrWhiteSpace(property1)) { continue; } evaluator.Evaluate(property1); String[] displayStrings = ItemDisplay.GetDisplayStrings(unit); id = row["Index"].ToString(); code = GetSqlString(((int)row["code"]).ToString("X")); magicName = magicName.Replace("[item]", string.Empty).Trim(); formattedName = String.Format("'''{0}'''", magicName); ilvl = row["itemLevel"].ToString(); magicName = GetSqlString(magicName); formattedName = GetSqlString(formattedName); displayString = GetSqlString(displayStrings.Aggregate(string.Empty, (current, affix) => current + affix + "<br />")); //Debug.WriteLine(id + ", " + row["affix"] + ", " + displayString); table.AddRow(id, code, magicName, formattedName, displayString, ilvl, faction); } return(table.GetFullScript()); }
public override string ExportTableInsertScript() { SQLTableScript table = new SQLTableScript("id", "code", "id INT NOT NULL", "code VARCHAR(6) NOT NULL", //"isBossAffix BOOL NOT NULL", "name TEXT NOT NULL", "formatted_name TEXT NOT NULL", "display_string TEXT NOT NULL" ); var affixes = Manager.GetDataTable("AFFIXES"); string id, code, magicName, formattedName, displayString; string quality, property1; object shields; bool isBoss = false; Evaluator evaluator = new Evaluator(); ItemDisplay.Manager = Manager; evaluator.Manager = Manager; foreach (DataRow row in affixes.Rows) { //don't show affixes that aren't used/implemented //if ((int)row["spawn"] == 0) continue; isBoss = false; magicName = row["magicNameString_string"].ToString(); if (String.IsNullOrWhiteSpace(magicName)) { continue; } if (row["allowTypes1_string"].ToString() != "monster") { continue; } Unit unit = new Monster(); Game3 game3 = new Game3(); evaluator.Unit = unit; evaluator.Game3 = game3; for (int i = 1; i < 7; i++) { property1 = row["property" + i].ToString(); evaluator.Evaluate(property1); } String[] displayStrings = ItemDisplay.GetDisplayStrings(unit); id = row["Index"].ToString(); code = GetSqlString(((int)row["code"]).ToString("X")); magicName = magicName.Replace("[item]", string.Empty).Trim(); isBoss = magicName.Contains("Sydonai"); if (isBoss) { continue; //don't think we need boss titles } formattedName = String.Format("'''{0}'''", magicName); quality = row["affixType1_string"].ToString(); switch (quality) { case "common": //just leave it bold break; case "rare": formattedName = Colorize(formattedName, WikiColors.Rare); break; case "legendary": formattedName = Colorize(formattedName, WikiColors.Legendary); break; case "mythic": formattedName = Colorize(formattedName, WikiColors.Mythic); break; default: throw new NotImplementedException(String.Format("Apparently we need '{0}'?", quality)); } magicName = GetSqlString(magicName); formattedName = GetSqlString(formattedName); displayString = displayStrings.Aggregate(string.Empty, (current, affix) => current + affix + "<br />"); displayString = displayString.Replace(" you get", ""); //display "when hit" instead of "when you get hit" //manually add shields if needed (never a number) shields = unit.GetStat("shield_buffer_max"); if (!(shields is int)) { displayString = displayString.Replace("ilevel", shields.ToString()); //hacky, but whatever } //add procs and skills displayString += AddOtherProperties(unit); displayString = GetSqlString(displayString); //Debug.WriteLine(id + ", " + row["affix"] + ", " + displayString); table.AddRow(id, code, /*Convert.ToInt32(isBoss).ToString(),*/ magicName, formattedName, displayString); } return(table.GetFullScript()); }
public override string ExportTableInsertScript() { SQLTableScript table = new SQLTableScript("id", "code", "id INT NOT NULL", "code VARCHAR(6) NOT NULL", "name TEXT NOT NULL", "formatted_name TEXT NOT NULL", "display_string TEXT NOT NULL", "ilvl_range TEXT NOT NULL", "allowed_types TEXT NOT NULL", "faction TEXT" , "feed_costs TEXT NOT NULL" ); var affixes = Manager.GetDataTable("AFFIXES"); string id, code, magicName, formattedName, displayString, levelRange, typeList, faction; string[] feeds; string quality, property1, allowType; bool isMonster = false; Evaluator evaluator = new Evaluator(); ItemDisplay.Manager = Manager; evaluator.Manager = Manager; foreach (DataRow row in affixes.Rows) { //don't show affixes that aren't used/implemented if ((int)row["spawn"] == 0) { continue; } isMonster = false; magicName = row["magicNameString_string"].ToString(); if (String.IsNullOrWhiteSpace(magicName)) { continue; } typeList = string.Empty; faction = row["onlyOnItemsRequiringUnitType_string"].ToString(); if (!String.IsNullOrWhiteSpace(faction)) { faction = GetSqlString(faction); } for (int i = 1; i < 7; i++) { allowType = row[String.Format("allowTypes{0}_string", i)].ToString(); if (String.IsNullOrWhiteSpace(allowType)) { break; } else if (allowType.CompareTo("monster") == 0) { isMonster = true; break; } if (!String.IsNullOrWhiteSpace(typeList)) { typeList += ", "; } typeList += GetItemType(allowType); } if (isMonster) { continue; } typeList = GetSqlString(typeList); levelRange = GetSqlString(row["minLevel"].ToString() + "-" + row["maxLevel"].ToString()); Unit unit = new Item(); Game3 game3 = new Game3(); evaluator.Unit = unit; evaluator.Game3 = game3; for (int i = 1; i < 7; i++) { property1 = row["property" + i].ToString(); evaluator.Evaluate(property1); } String[] displayStrings = ItemDisplay.GetDisplayStrings(unit); feeds = ItemDisplay.GetFeedCosts(unit); id = row["Index"].ToString(); code = GetSqlString(((int)row["code"]).ToString("X")); magicName = magicName.Replace("[item]", string.Empty).Trim(); formattedName = String.Format("'''{0}'''", magicName); quality = row["affixType1_string"].ToString(); switch (quality) { case "common": //just leave it bold break; case "rare": formattedName = Colorize(formattedName, WikiColors.Rare); break; case "legendary": formattedName = Colorize(formattedName, WikiColors.Legendary); break; case "mythic": formattedName = Colorize(formattedName, WikiColors.Mythic); break; default: throw new NotImplementedException(String.Format("Apparently we need '{0}'?", quality)); } magicName = GetSqlString(magicName); formattedName = GetSqlString(formattedName); displayString = GetSqlString(FormatAffixList(displayStrings)); Debug.WriteLine(id + ", " + row["affix"] + ", " + displayString); table.AddRow(id, code, magicName, formattedName, displayString, levelRange, typeList, faction, GetSqlString(FormatAffixList(feeds))); } return(table.GetFullScript()); }