public void UpdateValues(JsonElement values) { Experience = values.GetIntOrDefault("LegionExperience"); AttackDamageMin = values.GetFloatOrDefault("AttackDamageMin"); AttackDamageMax = values.GetFloatOrDefault("AttackDamageMax"); AttackRate = values.GetFloatOrDefault("AttackRate"); AttackRange = values.GetFloatOrDefault("AttackRange"); ArmorPhysical = values.GetFloatOrDefault("ArmorPhysical"); MagicResistance = values.GetFloatOrDefault("MagicResistance"); StatusHealth = values.GetFloatOrDefault("StatusHealth"); StatusHealthRegen = values.GetFloatOrDefault("StatusHealthRegen"); StatusMana = values.GetFloatOrDefault("StatusMana"); StatusManaRegen = values.GetFloatOrDefault("StatusManaRegen"); BountyGoldMin = values.GetFloatOrDefault("BountyGoldMin"); BountyGoldMax = values.GetFloatOrDefault("BountyGoldMax"); LegionAttackType = values.GetValueOrDefault("LegionAttackType"); LegionDefendType = values.GetValueOrDefault("LegionDefendType"); FractionName = values.GetValueOrDefault("LegionFraction") ?? "other"; DisplayName = values.GetValueOrDefault("DisplayName"); if (string.IsNullOrWhiteSpace(DisplayName)) { DisplayName = Name; } }
public bool UpdateValues(JsonElement values) { int oldGoldCost = GoldCost; int oldManaCost = ManaCost; float oldCooldown = Cooldown; float oldCastRange = CastRange; GoldCost = values.GetIntOrDefault("AbilityGoldCost"); ManaCost = values.GetIntOrDefault("AbilityManaCost"); Cooldown = values.GetFloatOrDefault("AbilityCooldown"); CastRange = values.GetFloatOrDefault("AbilityCastRange"); DisplayName = values.GetValueOrDefault("DisplayName"); if (string.IsNullOrEmpty(DisplayName)) { DisplayName = Name; } return(oldGoldCost != GoldCost || oldManaCost != ManaCost || oldCooldown != Cooldown || oldCastRange == CastRange); }