Beispiel #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);
  }
Beispiel #2
0
 @Override
 public void finishTask() {
   if (state.equals(ETaskState.during)) {
     BaseMap baseMap = MapManager.instance().getMapById(arriveMap);
     if (!baseMap.isMonsterExist(uid)) {
       setState(ETaskState.failed);
       // ======刷新任务信息======
       TaskMessage.sendTask(role);
     }
   }
 }
  public void run() {
    while (process) {

      long startTime = System.currentTimeMillis(), spent = 0;

      Role role = MapManager.instance().getShizhuangQueue();
      if (role != null) {
        MapMessage.refreshNearbyShizhuang(role);
      }

      spent = System.currentTimeMillis() - startTime;
      if (spent < PERIOD_WAIT) {
        synchronized (this) {
          try {
            wait(PERIOD_WAIT);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
      }
    }
    LogManager.info("【时装状态变化处理器】已关闭");
  }