// Token: 0x0600497A RID: 18810 RVA: 0x0016E8F0 File Offset: 0x0016CAF0
        public TrainingTechResourceRequirements GetTechLevelupResourceRequirements(int TechId, int DeltaLevel = 1)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetTechLevelupResourceRequirementsInt32Int32_hotfix != null)
            {
                return((TrainingTechResourceRequirements)this.m_GetTechLevelupResourceRequirementsInt32Int32_hotfix.call(new object[]
                {
                    this,
                    TechId,
                    DeltaLevel
                }));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId);

            if (DeltaLevel < 1)
            {
                return(null);
            }
            int level = tech.Level;

            if (!this.CanLevelup(TechId, DeltaLevel))
            {
                return(null);
            }
            TrainingTechResourceRequirements trainingTechResourceRequirements = this.GetResourceRequirementsByLevel(TechId, tech.Level + 1);
            int num = tech.Level + 2;

            while (num < this.GetTechMaxLevel(TechId) && num < tech.Level + DeltaLevel)
            {
                trainingTechResourceRequirements += this.GetResourceRequirementsByLevel(TechId, num);
                num++;
            }
            return(trainingTechResourceRequirements);
        }
Example #2
0
    public static int get_Gold(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements trainingTechResourceRequirements = (TrainingTechResourceRequirements)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, trainingTechResourceRequirements.Gold);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Example #3
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements o = new TrainingTechResourceRequirements();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Example #4
0
    public static int set_Materials(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements trainingTechResourceRequirements = (TrainingTechResourceRequirements)LuaObject.checkSelf(l);
            List <Goods> materials;
            LuaObject.checkType <List <Goods> >(l, 2, out materials);
            trainingTechResourceRequirements.Materials = materials;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Example #5
0
    public static int set_PreTechs(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements trainingTechResourceRequirements = (TrainingTechResourceRequirements)LuaObject.checkSelf(l);
            List <int> preTechs;
            LuaObject.checkType <List <int> >(l, 2, out preTechs);
            trainingTechResourceRequirements.PreTechs = preTechs;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Example #6
0
    public static int set_RoomLevel(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements trainingTechResourceRequirements = (TrainingTechResourceRequirements)LuaObject.checkSelf(l);
            int roomLevel;
            LuaObject.checkType(l, 2, out roomLevel);
            trainingTechResourceRequirements.RoomLevel = roomLevel;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
        // Token: 0x0600497D RID: 18813 RVA: 0x0016EBAC File Offset: 0x0016CDAC
        public void AddTechLevel(int TechId, int DeltaLevel, bool NoCheckAndCost = false)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_AddTechLevelInt32Int32Boolean_hotfix != null)
            {
                this.m_AddTechLevelInt32Int32Boolean_hotfix.call(new object[]
                {
                    this,
                    TechId,
                    DeltaLevel,
                    NoCheckAndCost
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId);
            int          num  = tech.Level + DeltaLevel;
            ConfigDataTrainingTechInfo configDataTrainingTechInfo = this.m_configDataLoader.GetConfigDataTrainingTechInfo(TechId);

            if (!NoCheckAndCost)
            {
                TrainingTechResourceRequirements techLevelupResourceRequirements = this.GetTechLevelupResourceRequirements(TechId, DeltaLevel);
                List <Goods> list = new List <Goods>();
                list.Add(new Goods
                {
                    GoodsType = GoodsType.GoodsType_Gold,
                    Count     = techLevelupResourceRequirements.Gold
                });
                list.AddRange(techLevelupResourceRequirements.Materials);
                this.m_bag.ConsumeGoods(list, null, null, GameFunctionType.GameFunctionType_TrainingGround, string.Format("{0}: {1}", TechId, num));
                this.OutPutTeachnologyTreeOperateLog(configDataTrainingTechInfo.m_courseId, TechId, num, null, list);
            }
            this.m_trainingGroundDS.UpdateTechLevel(TechId, num);
            foreach (Hero hero in this.m_hero.GetAllHeros())
            {
                this.ApplyTrainingTechToHero(hero, tech);
                this.m_hero.OnHeroBattlePowerChange(hero);
            }
            if (this.TrainingTechLevelupMissionEvent != null)
            {
                this.TrainingTechLevelupMissionEvent(tech);
            }
        }
Example #8
0
    public static int op_Addition(IntPtr l)
    {
        int result;

        try
        {
            TrainingTechResourceRequirements x;
            LuaObject.checkType <TrainingTechResourceRequirements>(l, 1, out x);
            TrainingTechResourceRequirements y;
            LuaObject.checkType <TrainingTechResourceRequirements>(l, 2, out y);
            TrainingTechResourceRequirements o = x + y;
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    public static int __callBase_GetTechLevelupResourceRequirements(IntPtr l)
    {
        int result;

        try
        {
            TrainingGroundCompoment trainingGroundCompoment = (TrainingGroundCompoment)LuaObject.checkSelf(l);
            int techId;
            LuaObject.checkType(l, 2, out techId);
            int deltaLevel;
            LuaObject.checkType(l, 3, out deltaLevel);
            TrainingTechResourceRequirements o = trainingGroundCompoment.m_luaExportHelper.__callBase_GetTechLevelupResourceRequirements(techId, deltaLevel);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
        // Token: 0x0600497B RID: 18811 RVA: 0x0016E9F8 File Offset: 0x0016CBF8
        public int CheckTechLevelup(int TechId, int DeltaLevel = 1)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CheckTechLevelupInt32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_CheckTechLevelupInt32Int32_hotfix.call(new object[]
                {
                    this,
                    TechId,
                    DeltaLevel
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId);

            if (!this.CanLevelup(TechId, DeltaLevel))
            {
                return(-10077);
            }
            TrainingTechResourceRequirements techLevelupResourceRequirements = this.GetTechLevelupResourceRequirements(TechId, DeltaLevel);

            if (techLevelupResourceRequirements == null)
            {
                return(-10076);
            }
            if (!this.m_basicInfo.IsGoldEnough(techLevelupResourceRequirements.Gold))
            {
                return(-400);
            }
            List <BagItemBase> list = this.m_bag.FindEnoughBagItems(techLevelupResourceRequirements.Materials);

            if (list.Count != techLevelupResourceRequirements.Materials.Count)
            {
                return(-10076);
            }
            return(0);
        }