Ejemplo n.º 1
0
 @Override
 public void onAction(Player player, boolean shift) {
   if (this != player.getTarget()) {
     player.setTarget(this);
     player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
     player.sendPacket(new ValidateLocation(this));
   } else {
     player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
     if (!isInRange(player, INTERACTION_DISTANCE)) {
       player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
       player.sendActionFailed();
     } else {
       if (CastleManorManager.getInstance().isDisabled()) {
         NpcHtmlMessage html = new NpcHtmlMessage(player, this);
         html.setFile("npcdefault.htm");
         player.sendPacket(html);
       } else {
         showMessageWindow(player, 0);
       }
       player.sendActionFailed();
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (CastleManorManager.getInstance().isDisabled()) {
      NpcHtmlMessage html = new NpcHtmlMessage(player, this);
      html.setFile("npcdefault.htm");
      player.sendPacket(html);
      return;
    }

    int condition = validateCondition(player);
    if (condition <= COND_ALL_FALSE) {
      return;
    }

    if (condition == COND_BUSY_BECAUSE_OF_SIEGE) {
      return;
    }

    if (condition == COND_OWNER) {
      if (command.startsWith("Chat")) {
        int val = 0;
        try {
          val = Integer.parseInt(command.substring(5));
        } catch (IndexOutOfBoundsException ioobe) {
        } catch (NumberFormatException nfe) {
        }
        showMessageWindow(player, val);
      } else {
        super.onBypassFeedback(player, command);
      }
    }
  }