Пример #1
0
  @Override
  public void handleReceived(LlpMessage msg) {
    result = 0;
    reason = "成功";
    cellsMap.clear();

    int isBind = msg.readInt("isBind");

    Map<EEquip, Equip> equipments = online.getEquipments();
    Equip equip = equipments.get(EEquip.shenbing);
    if (equip == null) {
      result = 1;
      reason = "升级失败,您没有装备神兵!";
      return;
    }
    // 背包中符石索引
    Map<Integer, Integer> fushiIndexMap = online.getBag().isInBagById(21010, 1, equip.getSteps());

    if (fushiIndexMap.isEmpty()) {
      result = 1;
      reason = "符石不足,无法重置!";
      // 指向单独购买
      if (MallJson.instance().getLessItem().containsKey(21010)) {
        MallJson.instance().countLessItem(online, 21010, equip.getSteps(), 1);
      }
      return;
    }
    // 扣除符石
    Iterator<Entry<Integer, Integer>> fushi = fushiIndexMap.entrySet().iterator();
    while (fushi.hasNext()) {
      Entry<Integer, Integer> entry = fushi.next();
      online
          .getBag()
          .removeByIndex(entry.getKey(), entry.getValue(), cellsMap, EItemCost.shenbingReset);
    }

    equip.getAddPropertyList().clear();
    ShenbingServer.reset(equip);

    if (isBind == 1) {
      equip.bind();
    }

    RoleServer.wield(online, equip);
    BagMessage.sendEquip(online);
    BagMessage.sendBag(online, cellsMap, false);
    SendMessage.sendSttribute(online);

    LogManager.shenbing(
        2, equip.getUid(), equip.getSteps(), online, equip.getShowLevel()); // 重置神兵日志
  }
Пример #2
0
  @Override
  public void handleReceived(LlpMessage msg) {
    result = 0;
    reason = "成功";
    partnerList.clear();
    long partnerId = msg.readLong("partnerId");

    Partner partner = online.findPartner(partnerId);
    if (partner == null) {
      result = 1;
      reason = "伙伴不存在";
      return;
    }

    PartnerSendBack partnerSendBack = PartnerJson.instance().getSendBack().get(partner.getIndex());
    if (partnerSendBack != null) {
      Map<Integer, Cell> cellsMap = new HashMap<>();

      Item item = ItemJson.instance().getItem(partnerSendBack.getId());
      if (partnerSendBack.getBind() == 1) { // 使用绑定材料,物品绑定
        item.bind();
      }
      BagServer.add(online, item, partnerSendBack.getNum(), cellsMap, EItemGet.partnerOut);
      BagMessage.sendBag(online, cellsMap);
    }

    online.getPartnerMap().remove(partner.getId());
    partner.setOperateFlag(EpartnerOperate.delete);
    partnerList.add(partner);
    TipServer.costPartner(online, partner); // ======提示======
  }
Пример #3
0
 @Override
 public void handleReply() throws Exception {
   LlpMessage message = null;
   try {
     message = LlpJava.instance().getMessage("s_unloadEquip");
     message.write("result", result);
     message.write("reason", reason);
     channel.write(message);
   } finally {
     if (message != null) {
       message.destory();
     }
   }
   if (result == 0) {
     BagMessage.sendBag(online, cellsMap, false);
     BagMessage.sendEquip(online);
   }
 }