/// <summary> /// Computes the base value for mining a tile, that is, before multipliers or modifications. /// </summary> /// <param name="tileOrWallType">The tile type or wall.</param> /// <param name="miningTargetType">Type of tile data, either tile or wall.</param> /// <returns>Base value in generic units.</returns> public decimal GetBaseMiningValue(ushort tileOrWallType, TileSubTarget miningTargetType, string group) { var key = new TileKey(tileOrWallType, miningTargetType); //check group overrides first if (!string.IsNullOrWhiteSpace(group)) { if (GroupMiningOverrides.TryGetValue(group, out var groupMiningOverride)) { if (groupMiningOverride.TryGetValue(key, out var groupValueOverride)) { return(groupValueOverride.Value); } } } //no group override found, move to global overrides if (MiningOverrides.TryGetValue(key, out var valueOverride)) { return(valueOverride.Value); } else { return(DefaultMiningValue); } }
/// <summary> /// Performs necessary setup and preprocessing to use a Currency in-game. /// </summary> /// <param name="id"></param> internal void OnInitialize(int id) { Id = id; NamesToQuadrants = createNamesToQuadrants(); currencyConverter = new CurrencyConverter(this); //set defaults if (currencyConverter.TryParse(DefaultMiningValueString, out var parsedResult)) { DefaultMiningValue = parsedResult; } if (currencyConverter.TryParse(DefaultPlacingValueString, out parsedResult)) { DefaultPlacingValue = parsedResult; } if (currencyConverter.TryParse(DefaultFishingValueString, out parsedResult)) { DefaultFishingValue = parsedResult; } if (currencyConverter.TryParse(DefaultPlayingValueString, out parsedResult)) { DefaultPlayingValue = parsedResult; } //set overrides KillingOverrides.Initialize(this); MiningOverrides.Initialize(this); PlacingOverrides.Initialize(this); FishingOverrides.Initialize(this); //set group overrides for tiles var tileGroupOverrides = new List <GroupValueOverrides <TileKey> >() { GroupMiningOverrides, GroupPlacingOverrides }; foreach (var go in tileGroupOverrides) { foreach (var vol in go.Values) { vol.Initialize(this); } } //set group overrides for playing foreach (var vol in GroupPlayingOverrides.Values) { vol.Initialize(this); } InitializeDisplayString(); }