コード例 #1
0
ファイル: Action4014.cs プロジェクト: dongliang/Scut
        public override bool TakeAction()
        {
            int totalNum = 0;

            UserHelper.ChechDailyRestrain(ContextUser.UserID);
            totalNum = PlotHelper.HeroSurplusNum(ContextUser.UserID, cityID, ContextUser.VipLv);
            if (totalNum <= 0 || PlotHelper.HeroRefreshNum(ContextUser.UserID, cityID) > totalNum)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St4014_HeroRefreshPlotFull;
                return(false);
            }
            int useGold = ConfigEnvSet.GetInt("UserPlot.HeroRefreshGoldNum");

            if (ops == 1)
            {
                ErrorCode = ops;
                ErrorInfo = string.Format(LanguageManager.GetLang().St4014_HeroRefreshPlot, useGold);
                return(false);
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum < useGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }
                UserDailyRestrain dailyRestrain = new GameDataCacheSet <UserDailyRestrain>().FindKey(ContextUser.UserID);
                if (dailyRestrain != null)
                {
                    //z增加刷新次数 (未完成)
                    HeroRefreshNum(ContextUser.UserID, cityID);
                }
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useGold, int.MaxValue);
                //ContextUser.Update();
            }
            return(true);
        }