Example #1
0
 /// <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));
     }
 }
Example #2
0
        /// <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());
            }
        }
Example #3
0
 /// <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;
 }
Example #4
0
 /// <summary>
 /// Set the balance for this seasonal currency
 /// </summary>
 public void SetBalance(SeasonalCurrencyType currencyType, int newBalance)
 {
     Currencies[currencyType] = newBalance;
 }
Example #5
0
 /// <summary>
 /// Get the balance for this seasonal currency
 /// </summary>
 public int GetBalance(SeasonalCurrencyType currencyType)
 {
     return(Currencies.TryGetValue(currencyType, out var balance) ? balance : 0);
 }
Example #6
0
 public NoCreditsComposer(bool hasEnoughCredits, bool hasEnoughSeasonalCurrency, SeasonalCurrencyType seasonalCurrencyType)
 {
     this.hasEnoughCredits          = hasEnoughCredits;
     this.hasEnoughSeasonalCurrency = hasEnoughSeasonalCurrency;
     this.seasonalCurrencyType      = seasonalCurrencyType;
 }
Example #7
0
 public ActivityPointsNotificationComposer(SeasonalCurrencyType currencyType, int balance, bool notifyClient)
 {
     this.currencyType = currencyType;
     this.balance      = balance;
     this.notifyClient = notifyClient;
 }