Esempio n. 1
0
 @Override
 public void handleReply() throws Exception {
   LlpMessage message = null;
   try {
     message = LlpJava.instance().getMessage("s_shenbingReset");
     message.write("result", result);
     message.write("reason", reason);
     channel.write(message);
   } finally {
     if (message != null) {
       message.destory();
     }
   }
 }
Esempio n. 2
0
  @Override
  public void handleReply() throws Exception {
    LlpMessage message = null;
    try {
      message = LlpJava.instance().getMessage("s_aroundAllRole");
      if (newList != null) {
        for (Long roleId : newList) {
          LlpMessage aroundAllRoleInfo = message.write("aroundAllRoleInfoList");

          if (ServerManager.instance().isOnline(roleId)) {
            Role role = ServerManager.instance().getOnlinePlayer(roleId);
            aroundAllRoleInfo.write("roleId", role.getId());
            aroundAllRoleInfo.write("name", role.getNick());
            aroundAllRoleInfo.write("figure", role.getFigure());
            aroundAllRoleInfo.write("vocation", role.getVocation().getName());
            aroundAllRoleInfo.write("level", role.getLevel());
          }
        }
      }
      channel.write(message);
    } finally {
      if (message != null) {
        message.destory();
      }
    }
  }
Esempio n. 3
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); // ======提示======
  }
Esempio n. 4
0
  /**
   * 小地图
   *
   * @param role 角色对象
   */
  public static void refreshMiniMap(Role role) {
    LlpMessage llpMessage = null;
    try {
      if (role != null && role.getChannel() != null) {
        llpMessage = LlpJava.instance().getMessage("s_refresh_miniMap");
        List<MapRaidsInfo> list = role.getRaidsTeamInfo().getRaidsFloor().getMapRaidsInfos();
        for (int i = 0; i < list.size(); i++) {
          MapRaidsInfo mapRaidsInfo = list.get(i);
          LlpMessage msg = llpMessage.write("raidsCellInfoList");
          msg.write("index", i);
          msg.write("state", mapRaidsInfo.getState());
          msg.write("number", mapRaidsInfo.numberOnMap());
        }
        role.getChannel().write(llpMessage);
      }

    } catch (Exception e) {
      LogManager.info("异常报告:通知客户端副本信息");
      e.printStackTrace();
    } finally {
      if (llpMessage != null) {
        llpMessage.destory();
      }
    }
  }
Esempio n. 5
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);
   }
 }
Esempio n. 6
0
 @Override
 public void handleReply() throws Exception {
   LlpMessage message = null;
   try {
     message = LlpJava.instance().getMessage("s_partnerOut");
     message.write("result", result);
     message.write("reason", reason);
     if (result == 0) {
       PartnerMessage.sendPartners(online, partnerList);
       PartnerMessage.refreshFightPartner(online);
     }
     channel.write(message);
   } finally {
     if (message != null) {
       message.destory();
     }
   }
 }
Esempio n. 7
0
  @Override
  public void handleReceived(LlpMessage msg) {
    // ======数据重置======
    result = 0;
    reason = "挑战成功";

    if (online.getLevel() < 40) {
      result = 1;
      reason = "等级不足40级,不能挑战";
      return;
    }
    if (!online.getMapInfo().getBaseMap().getType().equals(EMapType.common)) {
      result = 1;
      reason = "此地图不能挑战";
      return;
    }
    int currentFloorId = msg.readInt("currentFloorId");

    if (online.isBattle()) {
      result = 1;
      reason = "已战斗";
      return;
    }

    if (online.isPrBattle()) {
      result = 1;
      reason = "已申请战斗";
      return;
    }
    online.setPrBattle(true);

    if (online.getTeam() != null) {
      result = 1;
      reason = "组队状态时不能挑战千层塔";
      return;
    }

    if (currentFloorId > QiancengtaJson.instance().getQiancengtas().size()) {
      result = 1;
      reason = "已经全部挑战完成";
      return;
    }

    if (online.getCurrentFloorId() != currentFloorId) {
      result = 1;
      reason = "不能挑战";
      return;
    }

    QiancengtaInfo qiancengtaInfo =
        QiancengtaJson.instance().getQiancengtaMap().get(currentFloorId);
    MonsterGroup monsterGroup = MonsterJson.instance().getMonsterGroup(qiancengtaInfo.getGroupId());
    battleInfo =
        BattleServer.preBattle(online, monsterGroup, 5, online.getMapInfo().getBaseMap(), false);
    battleInfo.setCurrentFloorId(currentFloorId);
  }
Esempio n. 8
0
 @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);
   }
 }
Esempio n. 9
0
  @Override
  public void handleReceived(LlpMessage msg) {

    // ======重置数据======
    result = 0;
    reason = "遇怪成功";

    if (online.isBattle()) {
      result = 1;
      reason = "已战斗";
      return;
    }

    if (online.isPrBattle()) {
      result = 1;
      reason = "已申请战斗";
      return;
    }
    online.setPrBattle(true);
    // ======获取参数======
    int trialsId = msg.readInt("trialsId");
    int position = msg.readInt("position");

    if (online.getTeam() != null) {
      result = 1;
      reason = "组队状态时不能试炼";
      return;
    }

    if (!online.getMapInfo().getBaseMap().getType().equals(EMapType.common)) {
      result = 1;
      reason = "此地图不能试炼";
      return;
    }

    TrialsInfo trialsInfo = RaidsJson.instance().getTrialsMap().get(trialsId);
    if (trialsInfo == null) {
      result = 1;
      reason = "本层试练已经全部击杀完毕!";
      return;
    }
    if (!trialsInfo.getMonsterMap().containsKey(position)) {
      result = 1;
      reason = "本层试练已经全部击杀!";
      return;
    }
    int monsterGroupId = trialsInfo.getMonsterMap().get(position);
    MonsterGroup monsterGroup = MonsterJson.instance().getMonsterGroup(monsterGroupId);
    battleInfo =
        BattleServer.preBattle(online, monsterGroup, 3, online.getMapInfo().getBaseMap(), false);

    battleInfo.setTrialsId(trialsId);

    LogManager.trials(online, trialsId, position); // 试炼日志
  }
Esempio n. 10
0
  @Override
  public void handleReply() throws Exception {
    LlpMessage llpMessage = null;
    try {
      llpMessage = LlpJava.instance().getMessage("s_kill");
      llpMessage.write("result", result);
      llpMessage.write("reason", reason);
      channel.write(llpMessage);
    } finally {
      if (llpMessage != null) {
        llpMessage.destory();
      }
    }

    if (result == 0) {
      online.setBattle(true);
      BattleManager.instance().addBattleProcessor(new BattleProcessorCenter(battleInfo));
      online.setBattleId(battleInfo.getBattleId()); // 设置战斗编号
      FightMessage.sendEncounterResult(battleInfo, online);
    }
    online.setPrBattle(false);
  }
Esempio n. 11
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()); // 重置神兵日志
  }
Esempio n. 12
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);
  }
Esempio n. 13
0
  public static void refreshRaids(MapRaidsInfo mapRaidsInfo) {
    LlpMessage llpMessage = null;
    try {
      llpMessage = LlpJava.instance().getMessage("s_refresh_raids");
      llpMessage.write(
          "floorMax", mapRaidsInfo.getRaidsTeamInfo().getRaidsInfo().getFloorMax()); // 总层数
      llpMessage.write(
          "state", mapRaidsInfo.getRaidsTeamInfo().getRaidsState()); // 整个副本状态(0.未通关,1.通关)
      llpMessage.write("floor", mapRaidsInfo.getRaidsTeamInfo().getRaidsFloor().getFloor()); // 当前层数
      llpMessage.write(
          "floorState",
          mapRaidsInfo.getRaidsTeamInfo().getRaidsFloor().getState()); // 本层状态(0.未通关,1.通关)
      llpMessage.write("index", mapRaidsInfo.getIndex());
      llpMessage.write("cellState", mapRaidsInfo.getState()); // 状态(0.未通关,1.通关)

      //			System.out.println("floorMax======>" +
      // mapRaidsInfo.getRaidsTeamInfo().getRaidsInfo().getFloorMax());
      //			System.out.println("state======>" + mapRaidsInfo.getRaidsTeamInfo().getRaidsState());
      //			System.out.println("floor======>" +
      // mapRaidsInfo.getRaidsTeamInfo().getRaidsFloor().getFloor());
      //			System.out.println("floorState======>" +
      // mapRaidsInfo.getRaidsTeamInfo().getRaidsFloor().getState());
      //			System.out.println("index======>" + mapRaidsInfo.getIndex());
      //			System.out.println("cellState======>" + mapRaidsInfo.getState());

      for (Long roleId : mapRaidsInfo.allInMap()) {
        if (ServerManager.instance().isOnline(roleId)) {
          Role role = ServerManager.instance().getOnlinePlayer(roleId);
          //					System.out.println("roleId=" + roleId);
          role.getChannel().write(llpMessage);
        }
      }
    } catch (Exception e) {
      LogManager.info("异常报告:通知客户端副本信息");
      e.printStackTrace();
    } finally {
      if (llpMessage != null) {
        llpMessage.destory();
      }
    }
  }
Esempio n. 14
0
 /**
  * 刷新副本状态
  *
  * @param role 角色对象
  */
 public static void refreshRaids(Role role) {
   LlpMessage llpMessage = null;
   try {
     if (role != null && role.getChannel() != null && role.isLogon()) {
       llpMessage = LlpJava.instance().getMessage("s_refresh_raids");
       llpMessage.write("floorMax", role.getRaidsTeamInfo().getRaidsInfo().getFloorMax()); // 总层数
       llpMessage.write("state", role.getRaidsTeamInfo().getRaidsState()); // 整个副本状态(0.未通关,1.通关)
       llpMessage.write("floor", role.getRaidsTeamInfo().getRaidsFloor().getFloor()); // 当前层数
       llpMessage.write(
           "floorState", role.getRaidsTeamInfo().getRaidsFloor().getState()); // 本层状态(0.未通关,1.通关)
       MapRaidsInfo mapRaidsInfo = (MapRaidsInfo) role.getMapInfo().getBaseMap();
       llpMessage.write("index", mapRaidsInfo.getIndex());
       llpMessage.write("cellState", mapRaidsInfo.getState()); // 状态(0.未通关,1.通关)
       role.getChannel().write(llpMessage);
     }
   } catch (Exception e) {
     LogManager.info("异常报告:通知客户端副本信息");
     e.printStackTrace();
   } finally {
     if (llpMessage != null) {
       llpMessage.destory();
     }
   }
 }
Esempio n. 15
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);
  }