Exemple #1
0
 public override bool TakeAction()
 {
     this.ErrorCode = ops;
     CountryCombat countryCombat = new CountryCombat(ContextUser);
     if (ops == 1)
     {
         this.ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireTip, ExpNum);
     }
     else if (ops == 2)
     {
         if (ContextUser.ExpNum < ExpNum)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough;
             return false;
         }
         if (!countryCombat.Inspire(false, out inspirePercent))
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
         }
         ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, ExpNum, 0);
         //ContextUser.Update();
     }
     else if (ops == 3)
     {
         if (ContextUser.GoldNum < GlodNum)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
             return false;
         }
         this.ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireGoldTip, GlodNum);
     }
     else if (ops == 4)
     {
         if (ContextUser.VipLv < CountryCombat.CombatInspireVipLv)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnough;
             return false;
         }
         if (ContextUser.GoldNum < GlodNum)
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
             return false;
         }
         if (!countryCombat.Inspire(true, out inspirePercent))
         {
             this.ErrorCode = LanguageManager.GetLang().ErrorCode;
             this.ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
         }
         ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GlodNum, int.MaxValue);
         //ContextUser.Update();
     }
     return true;
 }