public void AddValueToDungeon(double value, ValueType valueType) { if (_currentGuid == null) { return; } try { if (_mainWindow.Dispatcher.CheckAccess()) { var dun = _mainWindowViewModel.TrackingDungeons?.FirstOrDefault(x => x.MapsGuid.Contains((Guid)_currentGuid) && x.Status == DungeonStatus.Active); dun?.Add(value, valueType); } else { _mainWindow.Dispatcher.Invoke(delegate { var dun = _mainWindowViewModel.TrackingDungeons?.FirstOrDefault(x => x.MapsGuid.Contains((Guid)_currentGuid) && x.Status == DungeonStatus.Active); dun?.Add(value, valueType); }); } } catch { // ignored } }
public void Add(double value, ValueType type, CityFaction cityFaction = CityFaction.Unknown) { switch (type) { case ValueType.Fame: Fame += value; return; case ValueType.ReSpec: var internalReSpecValue = Utilities.AddValue(value, _lastReSpecValue, out _lastReSpecValue); if (internalReSpecValue <= 0) { return; } ReSpec += internalReSpecValue; return; case ValueType.Silver: Silver += value; return; case ValueType.FactionFame: FactionFlags += value; return; case ValueType.FactionPoints: FactionCoins += value; if (cityFaction != CityFaction.Unknown) { CityFaction = cityFaction; } return; } }
public void Add(ValueType valueType, double value, CityFaction cityFaction = CityFaction.Unknown) { switch (valueType) { case ValueType.Fame: _famePerHourValue += value; _famePerHourList.Add(new ValuePerHour { DateTime = DateTime.UtcNow, Value = value }); _totalGainedFameInSession += value; RemoveValueFromValuePerHour(_famePerHourList, _famePerHourValue); break; case ValueType.ReSpec: var internalReSpecValue = Utilities.AddValue(value, _lastReSpecValue, out _lastReSpecValue); if (internalReSpecValue <= 0) { break; } _reSpecPerHourValue += internalReSpecValue; _reSpecPerHourList.Add(new ValuePerHour { DateTime = DateTime.UtcNow, Value = value }); _totalGainedReSpecInSession += internalReSpecValue; RemoveValueFromValuePerHour(_reSpecPerHourList, _reSpecPerHourValue); break; case ValueType.Silver: _silverPerHourValue += value; _silverPerHourList.Add(new ValuePerHour { DateTime = DateTime.UtcNow, Value = value }); _totalGainedSilverInSession += value; RemoveValueFromValuePerHour(_silverPerHourList, _silverPerHourValue); break; case ValueType.FactionPoints: _factionPointsPerHourValue += value; _factionPointsPerHourList.Add(new ValuePerHour() { DateTime = DateTime.UtcNow, CityFaction = cityFaction, Value = value }); _currentCityFaction = cityFaction; _totalGainedFactionPointsInSession += value; RemoveValueFromValuePerHour(_factionPointsPerHourList, _factionPointsPerHourValue); break; } Start(); }
public void AddValueToDungeon(double value, ValueType valueType, CityFaction cityFaction = CityFaction.Unknown) { if (_currentGuid == null) { return; } try { var dun = _dungeons?.FirstOrDefault(x => x.GuidList.Contains((Guid)_currentGuid) && x.Status == DungeonStatus.Active); dun?.Add(value, valueType, cityFaction); UpdateDungeonDataUi(dun); } catch { // ignored } }