// Token: 0x06004F88 RID: 20360 RVA: 0x0017F17C File Offset: 0x0017D37C public static ProGiftStoreItem ToPB(GiftStoreItem item) { return(new ProGiftStoreItem { BoughtNums = item.BoughtNums, GoodsId = item.GoodsId, NextFlushTime = item.NextFlushTime.Ticks }); }
// Token: 0x060040CB RID: 16587 RVA: 0x0012EF50 File Offset: 0x0012D150 private List <GiftStoreItem> GetOfferedStoreItemsByConfig() { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetOfferedStoreItemsByConfig_hotfix != null) { return((List <GiftStoreItem>) this.m_GetOfferedStoreItemsByConfig_hotfix.call(new object[] { this })); } BJLuaObjHelper.IsSkipLuaHotfix = false; List <GiftStoreItem> list = new List <GiftStoreItem>(); DateTime currentTime = this.m_basicInfo.GetCurrentTime(); foreach (KeyValuePair <int, ConfigDataGiftStoreItemInfo> keyValuePair in this.m_configDataLoader.GetAllConfigDataGiftStoreItemInfo()) { GiftStoreItem giftStoreItem; if (keyValuePair.Value.IsOperateGoods) { GiftStoreOperationalGoods giftStoreOperationalGoods = this.m_giftStoreDS.FindGiftStoreOperationalGoods(keyValuePair.Value.ID); if (giftStoreOperationalGoods == null) { continue; } if (!this.IsOnSaleTime(giftStoreOperationalGoods.SaleStartTime, giftStoreOperationalGoods.SaleEndTime, currentTime)) { continue; } giftStoreItem = new GiftStoreItem(); giftStoreItem.GoodsId = giftStoreOperationalGoods.GoodsId; giftStoreItem.SaleStartTime = giftStoreOperationalGoods.SaleStartTime; giftStoreItem.SaleEndTime = giftStoreOperationalGoods.SaleEndTime; } else { if (!this.IsOnSaleTime(DateTime.Parse(keyValuePair.Value.ShowStartTime), DateTime.Parse(keyValuePair.Value.ShowEndTime), currentTime)) { continue; } giftStoreItem = new GiftStoreItem(); giftStoreItem.GoodsId = keyValuePair.Value.ID; giftStoreItem.SaleStartTime = DateTime.Parse(keyValuePair.Value.ShowStartTime); giftStoreItem.SaleEndTime = DateTime.Parse(keyValuePair.Value.ShowEndTime); } giftStoreItem.BoughtNums = 0; giftStoreItem.Config = keyValuePair.Value; giftStoreItem.IsFirstBuy = !this.HasBought(keyValuePair.Value.ID); giftStoreItem.NextFlushTime = GoodsNextFlushCaculateTools.CaculateNextFlushTime(keyValuePair.Value.BuyLimitType, keyValuePair.Value.Param, currentTime, 0L); list.Add(giftStoreItem); } return(list); }
// Token: 0x060040CC RID: 16588 RVA: 0x0012F188 File Offset: 0x0012D388 public List <GiftStoreItem> GetOfferedStoreItems() { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetOfferedStoreItems_hotfix != null) { return((List <GiftStoreItem>) this.m_GetOfferedStoreItems_hotfix.call(new object[] { this })); } BJLuaObjHelper.IsSkipLuaHotfix = false; DateTime currentTime = this.m_basicInfo.GetCurrentTime(); List <GiftStoreItem> offeredStoreItemsByConfig = this.GetOfferedStoreItemsByConfig(); using (List <GiftStoreItem> .Enumerator enumerator = this.m_giftStoreDS.GetLocalBoughtItems().GetEnumerator()) { while (enumerator.MoveNext()) { GiftStoreItem localItem = enumerator.Current; GiftStoreItem giftStoreItem = offeredStoreItemsByConfig.Find((GiftStoreItem t) => t.GoodsId == localItem.GoodsId); if (giftStoreItem != null) { if (localItem.NextFlushTime == DateTime.MaxValue) { ConfigDataGiftStoreItemInfo configDataGiftStoreItemInfo = this.m_configDataLoader.GetConfigDataGiftStoreItemInfo(localItem.GoodsId); if (configDataGiftStoreItemInfo.Count != 0 && localItem.BoughtNums >= configDataGiftStoreItemInfo.Count) { offeredStoreItemsByConfig.Remove(giftStoreItem); continue; } } if (localItem.NextFlushTime > currentTime) { giftStoreItem.BoughtNums = localItem.BoughtNums; giftStoreItem.NextFlushTime = localItem.NextFlushTime; } else { giftStoreItem.NextFlushTime = GoodsNextFlushCaculateTools.CaculateNextFlushTime(giftStoreItem.Config.BuyLimitType, giftStoreItem.Config.Param, currentTime, localItem.NextFlushTime.Ticks); } } } } return(offeredStoreItemsByConfig); }
// Token: 0x060040CF RID: 16591 RVA: 0x0012F4AC File Offset: 0x0012D6AC public virtual int CanBuyGoods(int goodsId) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanBuyGoodsInt32_hotfix != null) { return(Convert.ToInt32(this.m_CanBuyGoodsInt32_hotfix.call(new object[] { this, goodsId }))); } BJLuaObjHelper.IsSkipLuaHotfix = false; ConfigDataGiftStoreItemInfo configDataGiftStoreItemInfo = this.m_configDataLoader.GetConfigDataGiftStoreItemInfo(goodsId); if (configDataGiftStoreItemInfo == null) { return(-5100); } DateTime currentTime = this.m_basicInfo.GetCurrentTime(); if (configDataGiftStoreItemInfo.IsOperateGoods) { GiftStoreOperationalGoods giftStoreOperationalGoods = this.m_giftStoreDS.FindGiftStoreOperationalGoods(goodsId); if (giftStoreOperationalGoods == null || !this.IsOnSaleTime(giftStoreOperationalGoods.SaleStartTime, giftStoreOperationalGoods.SaleEndTime, currentTime)) { return(-5101); } } else if (!this.IsOnSaleTime(DateTime.Parse(configDataGiftStoreItemInfo.ShowStartTime), DateTime.Parse(configDataGiftStoreItemInfo.ShowEndTime), currentTime)) { return(-5101); } GiftStoreItem giftStoreItem = this.m_giftStoreDS.FindLocalBoughtItemById(goodsId); if (giftStoreItem != null && giftStoreItem.NextFlushTime > currentTime && configDataGiftStoreItemInfo.Count != 0 && configDataGiftStoreItemInfo.Count <= giftStoreItem.BoughtNums) { return(-5102); } return(0); }
// Token: 0x06004B1A RID: 19226 RVA: 0x0017596C File Offset: 0x00173B6C public override object SerializeToClient() { DSGiftStoreNtf dsgiftStoreNtf = new DSGiftStoreNtf(); dsgiftStoreNtf.Version = (uint)base.Version; foreach (KeyValuePair <int, string> keyValuePair in this.m_firstboughtItemsRecords) { ProGiftStoreFirstBoughtRecord proGiftStoreFirstBoughtRecord = new ProGiftStoreFirstBoughtRecord(); proGiftStoreFirstBoughtRecord.GoodsId = keyValuePair.Key; proGiftStoreFirstBoughtRecord.GoodsRegisterId = keyValuePair.Value; dsgiftStoreNtf.Records.Add(proGiftStoreFirstBoughtRecord); } foreach (GiftStoreItem item in this.m_localBoughtItems) { dsgiftStoreNtf.BoughtItems.Add(GiftStoreItem.ToPB(item)); } foreach (KeyValuePair <string, OrderReward> keyValuePair2 in this.m_orderRerads) { dsgiftStoreNtf.OrderRewards.Add(OrderReward.ToPB(keyValuePair2.Value)); } return(dsgiftStoreNtf); }
// Token: 0x06004B20 RID: 19232 RVA: 0x00175B48 File Offset: 0x00173D48 public void InitBoughtItem(GiftStoreItem storeItem) { this.m_localBoughtItems.Add(storeItem); }
// Token: 0x06004B1C RID: 19228 RVA: 0x00175AEC File Offset: 0x00173CEC public void AddBoughtItem(GiftStoreItem item) { this.m_localBoughtItems.Add(item); base.SetDirty(true); }