public ItemInfo(string id, JsonDict json, string gameVersion) { json = JsonDict.Parse(json.ToString()); // clone Id = int.Parse(id); Name = json.GetStringAndRemove("name"); Description = json.GetStringAndRemove("description"); Plaintext = json.GetStringAndRemove("plaintext"); ExcludeFromStandardSummonerRift = Name.Contains("Quick Charge") || (Name == "Siege Ballista") || (Name == "Tower: Beam of Ruination") || (Name == "Port Pad") || (Name == "Flash Zone") || (Name == "Vanguard Banner") || (Name == "Siege Refund") || (Name == "Entropy Field") || (Name == "Shield Totem") || (Name == "Tower: Storm Bulwark") || (Name == "Poro-Snax") || (Name == "Diet Poro-Snax"); var image = json.GetDictAndRemove("image"); Icon = $"http://ddragon.leagueoflegends.com/cdn/{gameVersion}/img/{image["group"].GetString()}/{image["full"].GetString()}"; var from = json.GetListAndRemoveOrNull("from"); if (from == null) { BuildsFrom = new List <int>().AsReadOnly(); } else { BuildsFrom = from.Select(s => int.Parse(s.GetString())).ToList().AsReadOnly(); } var into = json.GetListAndRemoveOrNull("into"); if (into == null) { BuildsInto = new List <int>().AsReadOnly(); } else { BuildsInto = into.Select(s => int.Parse(s.GetString())).ToList().AsReadOnly(); } _tags = json.GetListAndRemove("tags") .Select(s => s.GetString()).Select(tag => { switch (tag) { case "CriticalStrike": return("CritChance"); case "Damage": return("PhysicalDamage"); case "SpellDamage": return("MagicDamage"); case "NonbootsMovement": return("Movement"); case "GoldPer": return("Gold"); case "SpellBlock": return("MagicResist"); default: return(tag); } }).ToHashSet(); if (_tags.Contains("Boots")) { _tags.Add("Movement"); } if (Description.Contains("<a href='Lethality'>")) { _tags.Add("Lethality"); } if (Id == 3152) // protobelt { _tags.Add("Movement"); } var gold = json.GetDictAndRemove("gold"); TotalPrice = gold.GetIntAndRemove("total"); SellPrice = gold.GetIntAndRemove("sell"); Purchasable = gold.GetBoolAndRemove("purchasable"); gold.GetIntAndRemove("base"); gold.EnsureEmpty(); HideFromAll = json.GetBoolAndRemoveOrNull("hideFromAll") ?? false; Stacks = json.GetIntAndRemoveOrNull("stacks") ?? 1; Consumed = json.GetBoolAndRemoveOrNull("consumed") ?? false; ConsumeOnFull = json.GetBoolAndRemoveOrNull("consumeOnFull") ?? false; InStore = json.GetBoolAndRemoveOrNull("inStore") ?? true; SpecialRecipeFrom = json.GetIntAndRemoveOrNull("specialRecipe"); RequiredChampion = json.GetStringAndRemoveOrNull("requiredChampion"); RequiredAlly = json.GetStringAndRemoveOrNull("requiredAlly"); var stats = json.GetDictAndRemove("stats"); addStatTag(Stat_ArmorFlat = stats.GetDecimalAndRemoveOrNull("FlatArmorMod"), "Armor"); addStatTag(Stat_AttackSpeedPrc = stats.GetDecimalAndRemoveOrNull("PercentAttackSpeedMod"), "AttackSpeed"); addStatTag(Stat_CritChanceFlat = stats.GetDecimalAndRemoveOrNull("FlatCritChanceMod"), "CritChance"); addStatTag(Stat_HealthPoolFlat = stats.GetDecimalAndRemoveOrNull("FlatHPPoolMod"), "Health"); addStatTag(Stat_HealthRegenFlat = stats.GetDecimalAndRemoveOrNull("FlatHPRegenMod"), "HealthRegen"); addStatTag(Stat_LifeStealPrc = stats.GetDecimalAndRemoveOrNull("PercentLifeStealMod"), "LifeSteal"); addStatTag(Stat_MagicDamageFlat = stats.GetDecimalAndRemoveOrNull("FlatMagicDamageMod"), "MagicDamage"); addStatTag(Stat_MagicResistFlat = stats.GetDecimalAndRemoveOrNull("FlatSpellBlockMod"), "MagicResist"); addStatTag(Stat_ManaPoolFlat = stats.GetDecimalAndRemoveOrNull("FlatMPPoolMod"), "Mana"); addStatTag(Stat_MoveSpeedFlat = stats.GetDecimalAndRemoveOrNull("FlatMovementSpeedMod"), "Movement"); addStatTag(Stat_MoveSpeedPrc = stats.GetDecimalAndRemoveOrNull("PercentMovementSpeedMod"), "Movement"); addStatTag(Stat_PhysicalDamageFlat = stats.GetDecimalAndRemoveOrNull("FlatPhysicalDamageMod"), "PhysicalDamage"); stats.EnsureEmpty(); var maps = json.GetDictAndRemove("maps"); MapSummonersRift = maps["11"].GetBool(); MapHowlingAbyss = maps["12"].GetBool(); json.GetIntAndRemoveOrNull("depth"); json.GetDictAndRemoveOrNull("effect"); json.GetStringAndRemove("colloq"); json.EnsureEmpty(); if (Id == 2421) // broken stopwatch via stopwatch { Purchasable = InStore = false; AllFrom.Add(2420); // stopwatch } if (Id == 2424) // broken stopwatch via perfectly timed stopwatch { Purchasable = InStore = false; AllFrom.Add(2423); // perfectly timed stopwatch } if (RequiredAlly == "Ornn") { Purchasable = InStore = false; } if (Id == 3671 || Id == 3672 || Id == 3673 || Id == 3675) { MapSummonersRift = false; // not actually available on SR despite what the data says? } }