@Override
 public Message execute(ActionContext context, C1753_QualifyChallengeReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String[] infos = this.getHeroInfos(reqMsg.getInfo());
   if (null == infos || infos.length < INFO_LENGTH) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(GameContext.getI18n().getText(TextId.ERROR_INPUT));
     return message;
   }
   Result result =
       GameContext.getQualifyApp().qualifyChallenge(role, infos[0], this.isConfirm(infos[1]));
   if (result.isIgnore()) {
     return null;
   }
   if (!result.isSuccess()) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(result.getInfo());
     return message;
   }
   C0003_TipNotifyMessage message = new C0003_TipNotifyMessage();
   message.setMsgContext(result.getInfo());
   return message;
 }
 @Override
 public Message execute(ActionContext context, C1008_MailTruePickReqMessage req) {
   C1003_MailAccessoryRespMessage resp = new C1003_MailAccessoryRespMessage();
   resp.setType(Status.FAILURE.getInnerCode());
   try {
     RoleInstance role = this.getCurrentRole(context);
     if (role == null) {
       return null;
     }
     String params = req.getParams();
     String mailId = params.split(Cat.comma)[1];
     resp.setMailId(mailId);
     Result result = GameContext.getMailApp().pickTrueMailAccessory(role, params);
     if (result.isIgnore()) {
       return null;
     }
     if (!result.isSuccess()) {
       resp.setInfo(result.getInfo());
       return resp;
     }
     resp.setType(Status.SUCCESS.getInnerCode());
     resp.setInfo(Status.Mail_Goods_Success.getTips());
   } catch (Exception e) {
     logger.error("MailTrueAccessoryAction", e);
   }
   return resp;
 }
Ejemplo n.º 3
0
 @Override
 public boolean canEnter(AbstractRole role) {
   if (role instanceof RoleInstance) {
     Result result = GameContext.getCopyLineApp().canEnter((RoleInstance) role, this.copyId);
     return result.isSuccess();
   }
   return false;
 }
Ejemplo n.º 4
0
 @Override
 public Message execute(ActionContext context, C3906_TradingDoneReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   Result result = GameContext.getTradingApp().trading(role);
   if (result.isSuccess()) {
     return null;
   }
   return new C0002_ErrorRespMessage(reqMsg.getCommandId(), result.getInfo());
 }
 @Override
 public Message execute(ActionContext context, C0253_MapTransferConfirmReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String param = reqMsg.getParam();
   Result result = GameContext.getWorldMapApp().transferConfirm(role, param);
   if (result.isSuccess()) {
     return null;
   }
   // return new ErrorRespMessage(reqMsg.getCommandId(),result.getInfo());
   return new C0003_TipNotifyMessage(result.getInfo());
 }
 @Override
 public Message execute(ActionContext context, C2002_RoleRebornConfirmReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String param = reqMsg.getParam();
   Result result = GameContext.getRoleRebornApp().rebornConfirm(role, param);
   if (!result.isSuccess()) {
     return new C0002_ErrorRespMessage(reqMsg.getCommandId(), result.getInfo());
   }
   C2001_RoleRebornRespMessage resp = new C2001_RoleRebornRespMessage();
   resp.setType(result.getResult());
   resp.setInfo(result.getInfo());
   return resp;
 }
  @Override
  public Message execute(ActionContext context, C0540_GoodsStrengthenReqMessage reqMsg) {
    C0540_GoodsStrengthenRespMessage resp = new C0540_GoodsStrengthenRespMessage();
    resp.setStatus(RespTypeStatus.FAILURE);
    try {
      RoleInstance role = this.getCurrentRole(context);
      if (null == role) {
        return null;
      }

      byte positionType = reqMsg.getPositionType();
      String instanceId = reqMsg.getInstanceId();
      int targetId = reqMsg.getTargetId();

      StorageType storageType = StorageType.get(positionType);
      RoleGoods equipGoods =
          GameContext.getUserGoodsApp().getRoleGoods(role, storageType, instanceId, targetId);
      if (equipGoods == null) {
        resp.setInfo(this.getText(TextId.NO_GOODS));
        return resp;
      }

      GoodsType goodsType = GameContext.getGoodsApp().getGoodsType(equipGoods.getGoodsId());
      AbstractGoodsBehavior goodsBehavior =
          goodsType.getGoodsBehavior(GoodsBehaviorType.Strengthen);

      StrengthenParam param = new StrengthenParam(role);
      param.setEquipGoods(equipGoods);
      param.setOperateType(StrengthenParam.STRENGTHEN_INFO);
      param.setTargetId(targetId);

      Result result = goodsBehavior.operate(param);
      if (!result.isSuccess()) {
        resp.setInfo(result.getInfo());
        return resp;
      }

      StrengthenResult stResult = (StrengthenResult) result;
      // 构建-540
      return this.buildStrengthenRespMesage(role, equipGoods, stResult.getGoodsTemplate());
    } catch (Exception e) {
      logger.error("GoodsDeriveStrengthenAction ", e);
      resp.setStatus(RespTypeStatus.FAILURE);
      resp.setInfo(this.getText(TextId.SYSTEM_ERROR));
    }
    return resp;
  }
Ejemplo n.º 8
0
 @Override
 public Message execute(ActionContext context, C2815_CardActivitySpendReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   Result result =
       GameContext.getRoleChoiceCardApp()
           .choiceCard(role, (byte) ChoiceFunType.ACTIVITY.ordinal(), reqMsg.getSpecificType());
   if (result.isIgnore()) {
     return null;
   }
   C2815_SpendActivityRespMessage respMsg = new C2815_SpendActivityRespMessage();
   respMsg.setSuccess(result.getResult());
   respMsg.setInfo(result.getInfo());
   return respMsg;
 }
Ejemplo n.º 9
0
 @Override
 public Message execute(ActionContext context, C1655_PetStarUpReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String roleId = role.getRoleId();
   RolePet rolePet = GameContext.getUserPetApp().getRolePet(roleId, reqMsg.getPetId());
   if (null == rolePet) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(GameContext.getI18n().getText(TextId.Pet_Not_Owned));
     return message;
   }
   Result result = GameContext.getPetApp().petStarUp(role, rolePet);
   C1655_PetStarUpRespMessage resp = new C1655_PetStarUpRespMessage();
   resp.setPetId(reqMsg.getPetId());
   resp.setInfo(result.getInfo());
   resp.setStatus(result.getResult());
   resp.setStarProgress(rolePet.getStarProgress());
   if (GameContext.getPetApp().isPetMaxStar(rolePet)) {
     resp.setFullStar((byte) 1);
   }
   return resp;
 }