/// <summary> /// Updates singular currency on client side /// </summary> public void UpdateCurrency(SeasonalCurrencyType seasonalCurrency, bool notify = true) { if (Currencies.TryGetValue(seasonalCurrency, out var balance)) { player.Send(new ActivityPointsNotificationComposer(seasonalCurrency, balance, notify)); } }
/// <summary> /// Get singular currency for user straight from database /// </summary> public static CurrencyData GetCurrency(int userId, SeasonalCurrencyType seasonalCurrencyType) { using (var session = SessionFactoryBuilder.Instance.SessionFactory.OpenSession()) { CurrencyData currencyDataAlias = null; return(session.QueryOver(() => currencyDataAlias).Where(() => currencyDataAlias.UserId == userId && currencyDataAlias.SeasonalType == seasonalCurrencyType).SingleOrDefault()); } }
/// <summary> /// Add the balance for this seasonal currency (will also accept negatives) /// </summary> public void AddBalance(SeasonalCurrencyType currencyType, int newBalance) { Currencies[currencyType] = CurrencyDao.GetCurrency(player.Details.Id, currencyType).Balance + newBalance; }
/// <summary> /// Set the balance for this seasonal currency /// </summary> public void SetBalance(SeasonalCurrencyType currencyType, int newBalance) { Currencies[currencyType] = newBalance; }
/// <summary> /// Get the balance for this seasonal currency /// </summary> public int GetBalance(SeasonalCurrencyType currencyType) { return(Currencies.TryGetValue(currencyType, out var balance) ? balance : 0); }
public NoCreditsComposer(bool hasEnoughCredits, bool hasEnoughSeasonalCurrency, SeasonalCurrencyType seasonalCurrencyType) { this.hasEnoughCredits = hasEnoughCredits; this.hasEnoughSeasonalCurrency = hasEnoughSeasonalCurrency; this.seasonalCurrencyType = seasonalCurrencyType; }
public ActivityPointsNotificationComposer(SeasonalCurrencyType currencyType, int balance, bool notifyClient) { this.currencyType = currencyType; this.balance = balance; this.notifyClient = notifyClient; }