Example #1
0
  @Override
  public void showChatWindow(Player player, int val, Object... arg) {
    NpcHtmlMessage message = new NpcHtmlMessage(player, this);
    if (_powerUnits != 0) {
      message.setFile("residence2/fortress/fortress_mainpower002.htm");
    } else {
      message.setFile("residence2/fortress/fortress_mainpower001.htm");
    }

    player.sendPacket(message);
  }
Example #2
0
  private void showMessageWindow(Player player, int val) {
    player.sendActionFailed();
    String filename = "castle/blacksmith/castleblacksmith-no.htm";

    int condition = validateCondition(player);
    if (condition > COND_ALL_FALSE) {
      if (condition == COND_BUSY_BECAUSE_OF_SIEGE) {
        filename = "castle/blacksmith/castleblacksmith-busy.htm"; // Busy because of siege
      } else if (condition == COND_OWNER) {
        if (val == 0) {
          filename = "castle/blacksmith/castleblacksmith.htm";
        } else {
          filename = "castle/blacksmith/castleblacksmith-" + val + ".htm";
        }
      }
    }

    NpcHtmlMessage html = new NpcHtmlMessage(player, this);
    html.setFile(filename);
    html.replace("%castleid%", Integer.toString(getCastle().getId()));
    player.sendPacket(html);
  }
Example #3
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();
     }
   }
 }
Example #4
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);
      }
    }
  }