Example #1
0
  @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);
  }
Example #2
0
  @Override
  public void handleReceived(LlpMessage msg) {
    result = 0;
    reason = "强化成功";

    int part = msg.readInt("part"); // 部位
    int number = msg.readInt("number"); // 强化次数

    EEquip eEquip = EEquip.values()[part];
    int level = online.getBodyIntensify().get(eEquip);

    if (level >= online.getLevel()) {
      result = 1;
      reason = "您已经强化到最高等级";
      return;
    }

    if (number + level >= online.getLevel()) {
      number = online.getLevel() - level;
    }

    int sum = 0;
    int i = 0;

    // int addMattack = 0;
    // int addPattack = 0;
    // int addMdefence = 0;
    // int addPdefence = 0;
    // int addHp = 0;
    // int addMp = 0;
    // int addSpeed = 0;

    while (i < number) {
      BodyInfo equipIntensify = IntensifyJson.instance().getEquipIntensifyMap(eEquip, level + i);
      if (online.getVip().isVip(EVip.diamond)) {
        sum += equipIntensify.getVipCost();
      } else {
        sum += equipIntensify.getGold();
      }

      // addMattack += equipIntensify.getAddMattack();
      // addPattack += equipIntensify.getAddPattack();
      // addMdefence += equipIntensify.getMdefence();
      // addPdefence += equipIntensify.getAddPdefence();
      // addHp += equipIntensify.getAddHp();
      // addMp += equipIntensify.getAddMp();
      // addSpeed += equipIntensify.getAddSpeed();

      i++;
      if (level + i >= online.getLevel()) {
        break;
      }
    }

    if (!RoleServer.costGoldOnly(online, sum, EGold.qianghua, false)) {
      result = 1;
      reason = "";
      SendMessage.refreshNoCoin(online, 1);
      return;
    }

    online.getBodyIntensify().put(eEquip, level + i); // 强化
    reason += "强化" + i + "次成功,消耗" + sum + "绑银";
    RoleServer.countIntensify(online); // 计算属性

    // HelperServer.helper(online, EHelper.intensify); // 小助手记录
    LogManager.intensify(online, EIntensifyEvent.部位强化, part, 0, number);
  }