// Token: 0x06004897 RID: 18583 RVA: 0x00168518 File Offset: 0x00166718
        protected void SelectCardUseTickets(CardPool cardPool, bool isSingleSelect)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SelectCardUseTicketsCardPoolBoolean_hotfix != null)
            {
                this.m_SelectCardUseTicketsCardPoolBoolean_hotfix.call(new object[]
                {
                    this,
                    cardPool,
                    isSingleSelect
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int num  = 0;
            int num2 = (!isSingleSelect) ? 10 : 1;

            if (this.IsCrystalOrActivityCardPool(cardPool.Config.PoolType))
            {
                BagItemBase bagItemBase = this.m_bag.FindBagItemByType(GoodsType.GoodsType_Item, cardPool.Config.TicketId);
                int         num3        = (bagItemBase != null) ? bagItemBase.Nums : 0;
                if (num3 < num2)
                {
                    num  = (num2 - num3) * cardPool.Config.CrystalCost;
                    num2 = num3;
                }
            }
            this.m_bag.RemoveBagItemByType(GoodsType.GoodsType_Item, cardPool.Config.TicketId, num2, GameFunctionType.GameFunctionType_SelectCard, cardPool.PoolId.ToString());
            this.OnSelectCardFinished(cardPool.PoolId, isSingleSelect);
            if (num > 0)
            {
                this.m_basicInfo.AddCrystal(-num, GameFunctionType.GameFunctionType_SelectCard, cardPool.PoolId.ToString());
            }
        }
 // Token: 0x0600489B RID: 18587 RVA: 0x00168964 File Offset: 0x00166B64
 protected virtual int CanUseTicketSelectCard(CardPool cardPool, int ticketNums)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanUseTicketSelectCardCardPoolInt32_hotfix != null)
     {
         return(Convert.ToInt32(this.m_CanUseTicketSelectCardCardPoolInt32_hotfix.call(new object[]
         {
             this,
             cardPool,
             ticketNums
         })));
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     if (this.IsCrystalOrActivityCardPool(cardPool.Config.PoolType))
     {
         BagItemBase bagItemBase = this.m_bag.FindBagItemByType(GoodsType.GoodsType_Item, cardPool.Config.TicketId);
         if (bagItemBase == null || bagItemBase.Nums < ticketNums)
         {
             int num         = (bagItemBase != null) ? bagItemBase.Nums : 0;
             int num2        = ticketNums - num;
             int consumeNums = num2 * cardPool.Config.CrystalCost;
             if (this.m_basicInfo.IsCrystalEnough(consumeNums))
             {
                 return(-1515);
             }
             return(-1514);
         }
     }
     else if (!this.IsTicketsEnough(cardPool.Config.TicketId, ticketNums))
     {
         return(-1502);
     }
     return(0);
 }
        // Token: 0x060049B2 RID: 18866 RVA: 0x001701A4 File Offset: 0x0016E3A4
        public int AttackTreasureLevel(int levelId)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_AttackTreasureLevelInt32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_AttackTreasureLevelInt32_hotfix.call(new object[]
                {
                    this,
                    levelId
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int num = this.CanAttackTreasureLevel(levelId);

            if (num != 0)
            {
                if (num == -900)
                {
                    this.m_battle.FightFinished(GameFunctionStatus.Error, false, true);
                }
                return(num);
            }
            ConfigDataTreasureLevelInfo configDataTreasureLevelInfo = this.m_configDataLoader.GetConfigDataTreasureLevelInfo(levelId);

            this.m_basicInfo.DecreaseEnergy(configDataTreasureLevelInfo.EnergyFail, GameFunctionType.GameFunctionType_TreasureMap, levelId.ToString());
            if (configDataTreasureLevelInfo.TicketCost > 0)
            {
                int         ticketId = this.m_bag.GetTicketId(GameFunctionType.GameFunctionType_TreasureMap);
                BagItemBase bagItem  = this.m_bag.FindBagItemByType(GoodsType.GoodsType_Item, ticketId);
                this.m_bag.RemoveBagItemDirectly(bagItem, configDataTreasureLevelInfo.TicketCost, GameFunctionType.GameFunctionType_TreasureMap, levelId.ToString());
            }
            this.m_battle.SetProcessingBattleInfo(BattleType.TreasureMap, levelId);
            return(0);
        }
 // Token: 0x06004E33 RID: 20019 RVA: 0x0017C5E0 File Offset: 0x0017A7E0
 public static BagItemBase PBGoodsToBagItem(BagItemFactory bagItemFactory, ProGoods pbGoods)
 {
     if (BagItemBase.IsInstanceBagItem((GoodsType)pbGoods.GoodsType))
     {
         return(bagItemFactory.CreateInstanceBagItemByClient(pbGoods));
     }
     return(bagItemFactory.CreateBagItem((GoodsType)pbGoods.GoodsType, pbGoods.Id, pbGoods.Nums));
 }
Exemple #5
0
        // Token: 0x06004F98 RID: 20376 RVA: 0x0017F348 File Offset: 0x0017D548
        public static OrderReward FromPB(ProOrderReward pbOrderReward)
        {
            OrderReward orderReward = new OrderReward();

            orderReward.OrderId = pbOrderReward.OrderId;
            orderReward.Rewards.AddRange(BagItemBase.PBGoodsListToGoodsList(pbOrderReward.Rewards));
            return(orderReward);
        }
Exemple #6
0
        // Token: 0x06004F97 RID: 20375 RVA: 0x0017F310 File Offset: 0x0017D510
        public static ProOrderReward ToPB(OrderReward orderReward)
        {
            ProOrderReward proOrderReward = new ProOrderReward();

            proOrderReward.OrderId = orderReward.OrderId;
            proOrderReward.Rewards.AddRange(BagItemBase.GoodsListToPBGoodsList(orderReward.Rewards));
            return(proOrderReward);
        }
        // Token: 0x06004A63 RID: 19043 RVA: 0x00174110 File Offset: 0x00172310
        public BagItemBase SetBagItemNums(BagItemBase bagItem, int nums)
        {
            UpdateCache <BagItemBase> updateCache = this.FindCache(bagItem);

            updateCache.Data.Nums = nums;
            updateCache.Dirty     = true;
            base.SetDirty(true);
            return(bagItem);
        }
        // Token: 0x06004E34 RID: 20020 RVA: 0x0017C614 File Offset: 0x0017A814
        public static List <BagItemBase> PBGoodsToBagItems(BagItemFactory bagItemFactory, List <ProGoods> goodsList)
        {
            List <BagItemBase> list = new List <BagItemBase>();

            foreach (ProGoods pbGoods in goodsList)
            {
                list.Add(BagItemBase.PBGoodsToBagItem(bagItemFactory, pbGoods));
            }
            return(list);
        }
        // Token: 0x06004A69 RID: 19049 RVA: 0x00174248 File Offset: 0x00172448
        private int FindBagItemIndex(BagItemBase bagItem)
        {
            int minValue;

            if (!this.m_instanceId2CacheIndex.TryGetValue(bagItem.InstanceId, out minValue))
            {
                minValue = int.MinValue;
            }
            return(minValue);
        }
Exemple #10
0
        // Token: 0x06004E37 RID: 20023 RVA: 0x0017C740 File Offset: 0x0017A940
        public static List <Goods> PBGoodsListToGoodsList(List <ProGoods> pbGoodsList)
        {
            List <Goods> list = new List <Goods>();

            foreach (ProGoods pbGoods in pbGoodsList)
            {
                list.Add(BagItemBase.PBGoodsToGoods(pbGoods));
            }
            return(list);
        }
Exemple #11
0
        // Token: 0x06004E36 RID: 20022 RVA: 0x0017C6DC File Offset: 0x0017A8DC
        public static List <ProGoods> GoodsListToPBGoodsList(List <Goods> goodsList)
        {
            List <ProGoods> list = new List <ProGoods>();

            foreach (Goods goods in goodsList)
            {
                list.Add(BagItemBase.GoodsToPBGoods(goods));
            }
            return(list);
        }
Exemple #12
0
 // Token: 0x06004805 RID: 18437 RVA: 0x0016446C File Offset: 0x0016266C
 protected void OnCreateBagItemEventCallBack(BagItemBase bagItem)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_OnCreateBagItemEventCallBackBagItemBase_hotfix != null)
     {
         this.m_OnCreateBagItemEventCallBackBagItemBase_hotfix.call(new object[]
         {
             this,
             bagItem
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     if (bagItem.GoodsTypeId == GoodsType.GoodsType_Equipment)
     {
         this.AddEquipmentId(bagItem.ContentId);
     }
 }
        // Token: 0x06004A64 RID: 19044 RVA: 0x00174140 File Offset: 0x00172340
        public BagItemBase RemoveBagItem(BagItemBase bagItem, int nums)
        {
            int index = this.FindBagItemIndex(bagItem);
            UpdateCache <BagItemBase> updateCache = this.Bag.Find(index);

            bagItem.Nums -= nums;
            if (bagItem.Nums <= 0)
            {
                this.Bag.Remove(index);
                this.m_instanceId2CacheIndex.Remove(bagItem.InstanceId);
            }
            else
            {
                updateCache.Dirty = true;
            }
            base.SetDirty(true);
            return(bagItem);
        }
 // Token: 0x0600437F RID: 17279 RVA: 0x001440D8 File Offset: 0x001422D8
 protected void SetCommonSuccessHeroTrainningLevel(ConfigDataHeroTrainningLevelInfo levelInfo, List <int> battleTreasures, List <int> heroes, int energyCost, bool isBattleTeam)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SetCommonSuccessHeroTrainningLevelConfigDataHeroTrainningLevelInfoList ` 1List ` 1Int32Boolean_hotfix != null)
     {
         this.m_SetCommonSuccessHeroTrainningLevelConfigDataHeroTrainningLevelInfoList ` 1List ` 1Int32Boolean_hotfix.call(new object[]
         {
             this,
             levelInfo,
             battleTreasures,
             heroes,
             energyCost,
             isBattleTeam
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     this.m_battle.AddBattleTreasures(battleTreasures);
     this.m_basicInfo.AddPlayerExp(levelInfo.PlayerExp);
     this.m_battle.AddFightHeroFightNumsAndExp(heroes, levelInfo.HeroExp);
     this.m_basicInfo.AddGold(levelInfo.Gold, GameFunctionType.GameFunctionType_HeroTrainning, levelInfo.ID.ToString());
     if (levelInfo.TicketCost > 0)
     {
         int         ticketId = this.m_bag.GetTicketId(GameFunctionType.GameFunctionType_HeroTrainning);
         BagItemBase bagItem  = this.m_bag.FindBagItemByType(GoodsType.GoodsType_Item, ticketId);
         this.m_bag.RemoveBagItemDirectly(bagItem, levelInfo.TicketCost, GameFunctionType.GameFunctionType_HeroTrainning, levelInfo.ID.ToString());
     }
     if (energyCost > 0)
     {
         this.m_basicInfo.DecreaseEnergy(energyCost, GameFunctionType.GameFunctionType_HeroTrainning, levelInfo.ID.ToString());
     }
     this.m_battle.WinPveBattle(levelInfo.Battle_ID);
     if (!isBattleTeam)
     {
         this.m_heroTrainningDS.AddFinishedLevel(levelInfo.ID);
     }
     if (this.IsDailyChallenge())
     {
         this.AddChallengedNums(1);
     }
     if (this.CompleteHeroTrainningMissionEvent != null)
     {
         this.CompleteHeroTrainningMissionEvent(BattleType.HeroTrainning, levelInfo.ID, heroes);
     }
 }
        // Token: 0x06004059 RID: 16473 RVA: 0x0012BCBC File Offset: 0x00129EBC
        protected int CanBuyFixedStoreItem(ConfigDataFixedStoreItemInfo itemConfig, FixedStoreItem item)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanBuyFixedStoreItemConfigDataFixedStoreItemInfoFixedStoreItem_hotfix != null)
            {
                return(Convert.ToInt32(this.m_CanBuyFixedStoreItemConfigDataFixedStoreItemInfoFixedStoreItem_hotfix.call(new object[]
                {
                    this,
                    itemConfig,
                    item
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            if (!this.IsInSaleTime(itemConfig))
            {
                return(-1303);
            }
            bool isFirstBuy;

            if (item == null)
            {
                isFirstBuy = true;
            }
            else
            {
                isFirstBuy = this.m_fixedStoreDS.IsFirstBuy(item);
                if (new DateTime(item.NextFlushTime) > this.m_basicInfo.GetCurrentTime() && this.IsSoldOut(itemConfig, item))
                {
                    return(-1302);
                }
            }
            int consumeNums = this.CaculateCurrencyCount(itemConfig, isFirstBuy);
            int num         = this.m_basicInfo.IsCurrencyEnough(itemConfig.CurrencyType, consumeNums);

            if (num != 0)
            {
                return(num);
            }
            if (BagItemBase.IsBagItem(itemConfig.ItemType) && this.m_bag.IsBagFullByCurrentSize())
            {
                return(-500);
            }
            return(0);
        }
Exemple #16
0
        // Token: 0x0600502F RID: 20527 RVA: 0x00180530 File Offset: 0x0017E730
        public static ProMail MailToPBMail(Mail mail)
        {
            ProMail proMail = new ProMail();

            proMail.TemplateId = mail.TemplateId;
            proMail.InstanceId = mail.InstanceId;
            proMail.Status     = mail.Status;
            proMail.SendTime   = mail.SendTime.Ticks;
            proMail.ReadedOrGotAttachmentTime = mail.ReadedOrGotAttachmentTime.Ticks;
            proMail.MailTypeId = (int)mail.MailTypeId;
            proMail.Content    = mail.Content;
            if (mail.TemplateMailConfig == null)
            {
                proMail.Title             = mail.Title;
                proMail.ExpiredTime       = mail.ExpiredTime;
                proMail.ReadedExpiredTime = mail.ReadedExpiredTime;
                proMail.GotDeleted        = mail.GotDeleted;
            }
            proMail.Attachments.AddRange(BagItemBase.GoodsListToPBGoodsList(mail.Attachments));
            return(proMail);
        }
Exemple #17
0
        // Token: 0x06005031 RID: 20529 RVA: 0x00180660 File Offset: 0x0017E860
        public static Mail PBMailToMail(ProMail pbMail)
        {
            Mail mail = new Mail();

            mail.InstanceId = pbMail.InstanceId;
            mail.TemplateId = pbMail.TemplateId;
            mail.Status     = pbMail.Status;
            mail.SendTime   = new DateTime(pbMail.SendTime);
            mail.ReadedOrGotAttachmentTime = new DateTime(pbMail.ReadedOrGotAttachmentTime);
            mail.Content    = pbMail.Content;
            mail.MailTypeId = (MailType)pbMail.MailTypeId;
            if (pbMail.TemplateId == 0)
            {
                mail.Title             = pbMail.Title;
                mail.ExpiredTime       = pbMail.ExpiredTime;
                mail.ReadedExpiredTime = pbMail.ReadedExpiredTime;
                mail.GotDeleted        = pbMail.GotDeleted;
            }
            mail.Attachments.AddRange(BagItemBase.PBGoodsListToGoodsList(pbMail.Attachments));
            return(mail);
        }
Exemple #18
0
 // Token: 0x06004823 RID: 18467 RVA: 0x00164D84 File Offset: 0x00162F84
 public void OnCreateBagItemEventCallBack(BagItemBase bagItem)
 {
     this.m_owner.OnCreateBagItemEventCallBack(bagItem);
 }
        // Token: 0x06004A61 RID: 19041 RVA: 0x001740B0 File Offset: 0x001722B0
        public void InitBagItem(BagItemBase bagItem)
        {
            int value = this.Bag.Init(bagItem);

            this.m_instanceId2CacheIndex.Add(bagItem.InstanceId, value);
        }
        // Token: 0x06004A6A RID: 19050 RVA: 0x00174274 File Offset: 0x00172474
        private UpdateCache <BagItemBase> FindCache(BagItemBase bagItem)
        {
            int index = this.FindBagItemIndex(bagItem);

            return(this.Bag.Find(index));
        }