コード例 #1
0
ファイル: ShenbingReset.java プロジェクト: fhyfhy17/MyWork
  @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
ファイル: UnloadEquip.java プロジェクト: fhyfhy17/MyWork
  @Override
  public void handleReceived(LlpMessage msg) {
    result = 0;
    reason = "";
    cellsMap.clear();

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

    // ======检查背包======
    if (online.getBag().isFull()) {
      result = 1;
      reason = "背包已满!";
      return;
    }

    // ======获取要卸下装备的对象======
    Map<EEquip, Equip> equipments = online.getEquipments();
    Equip equip = equipments.get(EEquip.values()[part]);
    if (equip == null) {
      result = 1;
      reason = "卸装备失败,装备不存在!";
      return;
    }

    // ======背包添加卸下的装备======
    // online.getBag().add(equip, 1, cellsMap, EItemGet.unloadEquip);
    BagServer.add(online, equip, 1, cellsMap, EItemGet.unloadEquip);

    // ======卸下并重新计算武将属性======
    RoleServer.unwield(online, equip.getPart());

    LogManager.equip(online, equip.getId(), EEquipEvent.卸装备);

    if (equip.getPart().equals(EEquip.shenbing)) {
      MapManager.instance().addShenbingQueue(online);
    } else if (equip.getPart().equals(EEquip.shizhuang)) {
      MapManager.instance().addShizhuangQueue(online);
      if (online.getTeam() != null) {
        TeamMessage.sendTeamAllMsg(online.getTeam());
      }
    }

    SendMessage.sendSttribute(online);
  }
コード例 #3
0
ファイル: BodyIntensify.java プロジェクト: fhyfhy17/MyWork
 @Override
 public void handleReply() throws Exception {
   LlpMessage llpMessage = null;
   try {
     llpMessage = LlpJava.instance().getMessage("s_bodyIntensify");
     llpMessage.write("result", result);
     llpMessage.write("reason", reason);
     channel.write(llpMessage);
   } finally {
     if (llpMessage != null) {
       llpMessage.destory();
     }
   }
   if (result == 0) {
     // ======发送部位强化======
     SendMessage.sendBodyIntensify(online);
     SendMessage.sendSttribute(online);
   }
 }