// Token: 0x060075BD RID: 30141 RVA: 0x0020401C File Offset: 0x0020221C
        public int BuyStoreItem(int storeId, int index)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_BuyStoreItemInt32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_BuyStoreItemInt32Int32_hotfix.call(new object[]
                {
                    this,
                    storeId,
                    index
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            RandomStore randomStore = this.m_randomStoreDS.FindStore(storeId);

            if (randomStore == null)
            {
                return(-1100);
            }
            if (index < 0 || index >= randomStore.Items.Count)
            {
                return(-1101);
            }
            RandomStoreItem storeItem = this.m_randomStoreDS.GetStoreItem(randomStore, index);

            if (base.IsBoughtStoreItem(storeItem))
            {
                return(-1102);
            }
            ConfigDataRandomStoreItemInfo configDataRandomStoreItemInfo = this.m_configDataLoader.GetConfigDataRandomStoreItemInfo(storeItem.Id);
            int num = this.m_basicInfo.IsCurrencyEnough(configDataRandomStoreItemInfo.CurrencyType, configDataRandomStoreItemInfo.Price);

            if (num != 0)
            {
                return(num);
            }
            this.m_basicInfo.AddCurrency(configDataRandomStoreItemInfo.CurrencyType, -configDataRandomStoreItemInfo.Price, GameFunctionType.GameFunctionType_None, null);
            this.m_randomStoreDS.BuyStoreItem(storeItem);
            base.OnBuyStoreItem(storeId, storeItem.Id);
            return(storeItem.Id);
        }
Beispiel #2
0
        // Token: 0x06004764 RID: 18276 RVA: 0x00160280 File Offset: 0x0015E480
        public virtual int CanBuyRandomStoreItem(int storeId, int index, int selectedIndex)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanBuyRandomStoreItemInt32Int32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_CanBuyRandomStoreItemInt32Int32Int32_hotfix.call(new object[]
                {
                    this,
                    storeId,
                    index,
                    selectedIndex
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            RandomStore randomStore = this.m_randomStoreDS.FindStore(storeId);

            if (randomStore == null)
            {
                return(-1100);
            }
            if (index < 0 || index >= randomStore.Items.Count)
            {
                return(-1101);
            }
            RandomStoreItem storeItem = this.m_randomStoreDS.GetStoreItem(randomStore, index);

            if (this.IsBoughtStoreItem(storeItem))
            {
                return(-1102);
            }
            ConfigDataRandomStoreItemInfo configDataRandomStoreItemInfo = this.m_configDataLoader.GetConfigDataRandomStoreItemInfo(storeItem.Id);
            int num = this.m_basicInfo.IsCurrencyEnough(configDataRandomStoreItemInfo.CurrencyType, configDataRandomStoreItemInfo.Price);

            if (num != 0)
            {
                return(num);
            }
            if (configDataRandomStoreItemInfo.ItemType == GoodsType.GoodsType_Item)
            {
                ConfigDataItemInfo configDataItemInfo = this.m_configDataLoader.GetConfigDataItemInfo(configDataRandomStoreItemInfo.ItemID);
                if (configDataItemInfo.FuncType == ItemFuncType.ItemFuncType_SelfSelectedBox)
                {
                    ConfigDataSelfSelectedBoxInfo configDataSelfSelectedBoxInfo = this.m_configDataLoader.GetConfigDataSelfSelectedBoxInfo(configDataItemInfo.FuncTypeParam1);
                    if (configDataSelfSelectedBoxInfo.Reward.Count <= selectedIndex || selectedIndex < 0)
                    {
                        return(-539);
                    }
                }
                else if (selectedIndex != -1)
                {
                    return(-540);
                }
            }
            else if (selectedIndex != -1)
            {
                return(-540);
            }
            if (this.m_bag.IsBagFullByCurrentSize())
            {
                return(-500);
            }
            return(0);
        }