예제 #1
0
  private void teleportToCharacter(Player activeChar, GameObject target) {
    if (target == null) return;

    activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
    activeChar.teleToLocation(target.getLoc(), target.getReflectionId());

    activeChar.sendMessage("You have teleported to " + target);
  }
예제 #2
0
 private void recallNPC(Player activeChar) {
   GameObject obj = activeChar.getTarget();
   if (obj != null && obj.isNpc()) {
     obj.setLoc(activeChar.getLoc());
     ((NpcInstance) obj).broadcastCharInfo();
     activeChar.sendMessage(
         "You teleported npc " + obj.getName() + " to " + activeChar.getLoc().toString() + ".");
   } else activeChar.sendMessage("Target is't npc.");
 }
예제 #3
0
 private void teleportCharacter(Player activeChar, String Cords) {
   GameObject target = activeChar.getTarget();
   if (target == null || !target.isPlayer()) {
     activeChar.sendPacket(Msg.INVALID_TARGET);
     return;
   }
   if (target.getObjectId() == activeChar.getObjectId()) {
     activeChar.sendMessage("You cannot teleport yourself.");
     return;
   }
   teleportTo(activeChar, (Player) target, Cords, activeChar.getReflectionId());
 }
예제 #4
0
 private Player getTargetChar(String[] wordList, int wordListIndex, Player activeChar) {
   // цель задана аргументом
   if (wordListIndex >= 0 && wordList.length > wordListIndex) {
     Player player = World.getPlayer(wordList[wordListIndex]);
     if (player == null) activeChar.sendMessage("Can't find player: " + wordList[wordListIndex]);
     return player;
   }
   // цель задана текущим таргетом
   GameObject my_target = activeChar.getTarget();
   if (my_target != null && my_target.isPlayer()) return (Player) my_target;
   // в качестве цели сам админ
   return activeChar;
 }
예제 #5
0
  private void showTeleportCharWindow(Player activeChar) {
    GameObject target = activeChar.getTarget();
    Player player = null;
    if (target.isPlayer()) player = (Player) target;
    else {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return;
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    StringBuilder replyMSG = new StringBuilder("<html><title>Teleport Character</title>");
    replyMSG.append("<body>");
    replyMSG.append("The character you will teleport is " + player.getName() + ".");
    replyMSG.append("<br>");

    replyMSG.append("Co-ordinate x");
    replyMSG.append("<edit var=\"char_cord_x\" width=110>");
    replyMSG.append("Co-ordinate y");
    replyMSG.append("<edit var=\"char_cord_y\" width=110>");
    replyMSG.append("Co-ordinate z");
    replyMSG.append("<edit var=\"char_cord_z\" width=110>");
    replyMSG.append(
        "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
    replyMSG.append(
        "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character "
            + activeChar.getX()
            + " "
            + activeChar.getY()
            + " "
            + activeChar.getZ()
            + "\" width=115 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
    replyMSG.append(
        "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></center>");
    replyMSG.append("</body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }