예제 #1
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    // You cannot do anything while fishing
    if (activeChar.isFishing()) {
      activeChar.sendPacket(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
      return;
    }

    // check if the actionId is allowed
    if (_actionId < 2 || _actionId > 13) {
      Util.handleIllegalPlayerAction(
          activeChar,
          activeChar.getName()
              + " of account "
              + activeChar.getAccountName()
              + " requested an internal Social Action.",
          Config.DEFAULT_PUNISH);
      return;
    }

    if (!activeChar.isInStoreMode()
        && activeChar.getActiveRequester() == null
        && !activeChar.isAlikeDead()
        && (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel())
        && activeChar.getAI().getIntention() == CtrlIntention.IDLE) {
      if (Config.DEBUG) _log.fine("Social Action: " + _actionId);

      activeChar.broadcastPacket(new SocialAction(activeChar, _actionId));
    }
  }
예제 #2
0
  private static void teleportToCharacter(L2PcInstance activeChar, L2PcInstance target) {
    if (target.getObjectId() == activeChar.getObjectId())
      activeChar.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF);
    else {
      int x = target.getX();
      int y = target.getY();
      int z = target.getZ();

      activeChar.getAI().setIntention(CtrlIntention.IDLE);
      activeChar.teleToLocation(x, y, z, 0);
      activeChar.sendMessage("You have teleported to " + target.getName() + ".");
    }
  }
예제 #3
0
  private static void teleportTo(L2PcInstance activeChar, String Cords) {
    try {
      StringTokenizer st = new StringTokenizer(Cords);
      String x1 = st.nextToken();
      int x = Integer.parseInt(x1);
      String y1 = st.nextToken();
      int y = Integer.parseInt(y1);
      String z1 = st.nextToken();
      int z = Integer.parseInt(z1);

      activeChar.getAI().setIntention(CtrlIntention.IDLE);
      activeChar.teleToLocation(x, y, z, 0);

      activeChar.sendMessage("You have been teleported to " + Cords + ".");
    } catch (NoSuchElementException nsee) {
      activeChar.sendMessage("Coordinates you entered as parameter [" + Cords + "] are wrong.");
    }
  }
예제 #4
0
 private static void teleportCharacter(L2PcInstance player, int x, int y, int z) {
   player.getAI().setIntention(CtrlIntention.IDLE);
   player.teleToLocation(x, y, z, 0);
   player.sendMessage("A GM is teleporting you.");
 }
예제 #5
0
  private void adminModifyCharacter(L2PcInstance activeChar, String modifications) {
    L2Object target = activeChar.getTarget();

    if (!(target instanceof L2PcInstance)) return;

    L2PcInstance player = (L2PcInstance) target;
    StringTokenizer st = new StringTokenizer(modifications);

    if (st.countTokens() != 6) {
      editCharacter(player);
      return;
    }

    String hp = st.nextToken();
    String mp = st.nextToken();
    String cp = st.nextToken();
    String pvpflag = st.nextToken();
    String pvpkills = st.nextToken();
    String pkkills = st.nextToken();

    int hpval = Integer.parseInt(hp);
    int mpval = Integer.parseInt(mp);
    int cpval = Integer.parseInt(cp);
    int pvpflagval = Integer.parseInt(pvpflag);
    int pvpkillsval = Integer.parseInt(pvpkills);
    int pkkillsval = Integer.parseInt(pkkills);

    // Common character information
    L2CoreMessage cm = new L2CoreMessage(MessageTable.Messages[30]);
    cm.addNumber(hpval);
    cm.addNumber(mpval);
    cm.addNumber(cpval);
    cm.addNumber(pvpflagval);
    cm.addNumber(pvpkillsval);
    cm.addNumber(pkkillsval);
    cm.sendMessage(player);
    player.setCurrentHp(hpval);
    player.setCurrentMp(mpval);
    player.setCurrentCp(cpval);
    player.setPvpFlag(pvpflagval);
    player.setPvpKills(pvpkillsval);
    player.setPkKills(pkkillsval);

    // Save the changed parameters to the database.
    player.store();

    StatusUpdate su = new StatusUpdate(player.getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, hpval);
    su.addAttribute(StatusUpdate.MAX_HP, player.getMaxHp());
    su.addAttribute(StatusUpdate.CUR_MP, mpval);
    su.addAttribute(StatusUpdate.MAX_MP, player.getMaxMp());
    su.addAttribute(StatusUpdate.CUR_CP, cpval);
    su.addAttribute(StatusUpdate.MAX_CP, player.getMaxCp());
    player.sendPacket(su);

    // Admin information
    cm = new L2CoreMessage(MessageTable.Messages[70]);
    cm.addString(player.getName());
    cm.addNumber(hpval);
    cm.addNumber(mpval);
    cm.addNumber(cpval);
    cm.addNumber(pvpflagval);
    cm.addNumber(pvpkillsval);
    cm.addNumber(pkkillsval);
    cm.sendMessage(activeChar);

    if (Config.DEBUG)
      _log.fine(
          "[GM]"
              + activeChar.getName()
              + " changed stats of "
              + player.getName()
              + ". "
              + " HP: "
              + hpval
              + " MP: "
              + mpval
              + " CP: "
              + cpval
              + " PvP: "
              + pvpflagval
              + " / "
              + pvpkillsval);

    showCharacterInfo(activeChar, null); // Back to start

    player.broadcastPacket(new CharInfo(player));
    player.sendPacket(new UserInfo(player));
    player.broadcastPacket(new ExBrExtraUserInfo(player));
    player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
    player.decayMe();
    player.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
  }