Esempio n. 1
0
  private void invul(String command, L2PcInstance activeChar) {
    int groupId;
    String enabled;

    try {
      groupId = Integer.parseInt(command.split(" ")[1]);
      enabled = command.split(" ")[2];
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_invul <groupId> <on|off>");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    if (enabled.equalsIgnoreCase("on") || enabled.equalsIgnoreCase("true")) {
      group.setInvul(true);
    } else if (enabled.equalsIgnoreCase("off") || enabled.equalsIgnoreCase("false")) {
      group.setInvul(false);
    } else {
      activeChar.sendMessage("Incorrect command arguments.");
    }
  }
Esempio n. 2
0
  private void teleportGroup(String command, L2PcInstance activeChar) {
    int groupId;
    String targetPlayerStr = null;
    L2PcInstance targetPlayer = null;

    try {
      groupId = Integer.parseInt(command.split(" ")[1]);
      targetPlayerStr = command.split(" ")[2];

      if (targetPlayerStr != null) {
        targetPlayer = L2World.getInstance().getPlayer(targetPlayerStr);
      }

      if (targetPlayer == null) {
        targetPlayer = activeChar;
      }
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_teleport <groupId> [playerName]");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    group.teleportGroup(activeChar);
  }
Esempio n. 3
0
  private void createGroup(String command, L2PcInstance activeChar) {
    int groupId;
    int templateId;
    int mobCount;

    try {
      final String[] cmdParams = command.split(" ");

      groupId = Integer.parseInt(cmdParams[1]);
      templateId = Integer.parseInt(cmdParams[2]);
      mobCount = Integer.parseInt(cmdParams[3]);
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_create <group> <npcid> <count>");
      return;
    }

    if (MobGroupTable.getInstance().getGroup(groupId) != null) {
      activeChar.sendMessage("Mob group " + groupId + " already exists.");
      return;
    }

    final L2NpcTemplate template = NpcData.getInstance().getTemplate(templateId);

    if (template == null) {
      activeChar.sendMessage("Invalid NPC ID specified.");
      return;
    }

    final MobGroup group = new MobGroup(groupId, template, mobCount);
    MobGroupTable.getInstance().addGroup(groupId, group);

    activeChar.sendMessage("Mob group " + groupId + " created.");
  }
Esempio n. 4
0
  private void attackGrp(String command, L2PcInstance activeChar) {
    int groupId;
    int othGroupId;

    try {
      groupId = Integer.parseInt(command.split(" ")[1]);
      othGroupId = Integer.parseInt(command.split(" ")[2]);
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_attackgrp <groupId> <TargetGroupId>");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    final MobGroup othGroup = MobGroupTable.getInstance().getGroup(othGroupId);

    if (othGroup == null) {
      activeChar.sendMessage("Incorrect target group.");
      return;
    }

    group.setAttackGroup(othGroup);
  }
Esempio n. 5
0
  /**
   * Send a SystemMessage to all participated players<br>
   * 1. Send the message to all players of team number one<br>
   * 2. Send the message to all players of team number two<br>
   * <br>
   *
   * @param message as String<br>
   */
  public static void sysMsgToAllParticipants(String message) {
    for (L2PcInstance playerInstance : _teams[0].getParticipatedPlayers().values()) {
      if (playerInstance != null) {
        playerInstance.sendMessage(message);
      }
    }

    for (L2PcInstance playerInstance : _teams[1].getParticipatedPlayers().values()) {
      if (playerInstance != null) {
        playerInstance.sendMessage(message);
      }
    }
  }
Esempio n. 6
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    int id;
    int count = 1;
    final String[] data = command.split(" ");
    try {
      id = Integer.parseInt(data[1]);
      if (data.length > 2) {
        count = Integer.parseInt(data[2]);
      }
    } catch (NumberFormatException nfe) {
      activeChar.sendMessage("Incorrect format for command 'summon'");
      return false;
    }

    String subCommand;
    if (id < 1000000) {
      subCommand = "admin_create_item";
      if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) {
        activeChar.sendMessage("You don't have the access right to use this command!");
        _log.warning(
            "Character "
                + activeChar.getName()
                + " tryed to use admin command "
                + subCommand
                + ", but have no access to it!");
        return false;
      }
      final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
      ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
    } else {
      subCommand = "admin_spawn_once";
      if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel())) {
        activeChar.sendMessage("You don't have the access right to use this command!");
        _log.warning(
            "Character "
                + activeChar.getName()
                + " tryed to use admin command "
                + subCommand
                + ", but have no access to it!");
        return false;
      }
      final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);

      activeChar.sendMessage("This is only a temporary spawn.  The mob(s) will NOT respawn.");
      id -= 1000000;
      ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
    }
    return true;
  }
Esempio n. 7
0
 private void follow(String command, L2PcInstance activeChar, L2Character target) {
   int groupId;
   try {
     groupId = Integer.parseInt(command.split(" ")[1]);
   } catch (Exception e) {
     activeChar.sendMessage("Incorrect command arguments.");
     return;
   }
   final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);
   if (group == null) {
     activeChar.sendMessage("Invalid group specified.");
     return;
   }
   group.setFollowMode(target);
 }
Esempio n. 8
0
 private void setNormal(String command, L2PcInstance activeChar) {
   int groupId;
   try {
     groupId = Integer.parseInt(command.split(" ")[1]);
   } catch (Exception e) {
     activeChar.sendMessage("Incorrect command arguments.");
     return;
   }
   final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);
   if (group == null) {
     activeChar.sendMessage("Invalid group specified.");
     return;
   }
   group.setAttackRandom();
 }
Esempio n. 9
0
  @Override
  public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    try {
      final L2Npc olymanager = activeChar.getLastFolkNPC();

      if (command.startsWith(COMMANDS[0])) // list
      {
        if (!Olympiad.getInstance().inCompPeriod()) {
          activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
          return false;
        }

        activeChar.sendPacket(new ExOlympiadMatchList());
      } else {
        if ((olymanager == null) || !(olymanager instanceof L2OlympiadManagerInstance)) {
          return false;
        }

        if (!activeChar.inObserverMode()
            && !activeChar.isInsideRadius(olymanager, 300, false, false)) {
          return false;
        }

        if (OlympiadManager.getInstance().isRegisteredInComp(activeChar)) {
          activeChar.sendPacket(
              SystemMessageId
                  .YOU_MAY_NOT_OBSERVE_A_OLYMPIAD_GAMES_MATCH_WHILE_YOU_ARE_ON_THE_WAITING_LIST);
          return false;
        }

        if (!Olympiad.getInstance().inCompPeriod()) {
          activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
          return false;
        }

        if (activeChar.isOnEvent()) {
          activeChar.sendMessage("You can not observe games while registered on an event");
          return false;
        }

        final int arenaId = Integer.parseInt(command.substring(12).trim());
        final OlympiadGameTask nextArena =
            OlympiadGameManager.getInstance().getOlympiadTask(arenaId);
        if (nextArena != null) {
          activeChar.enterOlympiadObserverMode(
              nextArena.getZone().getSpectatorSpawns().get(0), arenaId);
          activeChar.setInstanceId(
              OlympiadGameManager.getInstance().getOlympiadTask(arenaId).getZone().getInstanceId());
        }
      }
      return true;
    } catch (Exception e) {
      _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
    }
    return false;
  }
Esempio n. 10
0
  private void setCasting(String command, L2PcInstance activeChar) {
    int groupId;

    try {
      groupId = Integer.parseInt(command.split(" ")[1]);
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_casting <groupId>");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    group.setCastMode();
  }
Esempio n. 11
0
  private void spawnGroup(String command, L2PcInstance activeChar) {
    int groupId;
    boolean topos = false;
    int posx = 0;
    int posy = 0;
    int posz = 0;

    try {
      final String[] cmdParams = command.split(" ");
      groupId = Integer.parseInt(cmdParams[1]);

      try { // we try to get a position
        posx = Integer.parseInt(cmdParams[2]);
        posy = Integer.parseInt(cmdParams[3]);
        posz = Integer.parseInt(cmdParams[4]);
        topos = true;
      } catch (Exception e) {
        // no position given
      }
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_spawn <group> [ x y z ]");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    doAnimation(activeChar);

    if (topos) {
      group.spawnGroup(posx, posy, posz);
    } else {
      group.spawnGroup(activeChar);
    }

    activeChar.sendMessage("Mob group " + groupId + " spawned.");
  }
Esempio n. 12
0
  private void showGroupList(L2PcInstance activeChar) {
    final MobGroup[] mobGroupList = MobGroupTable.getInstance().getGroups();

    activeChar.sendMessage("======= <Mob Groups> =======");

    for (MobGroup mobGroup : mobGroupList) {
      activeChar.sendMessage(
          mobGroup.getGroupId()
              + ": "
              + mobGroup.getActiveMobCount()
              + " alive out of "
              + mobGroup.getMaxMobCount()
              + " of NPC ID "
              + mobGroup.getTemplate().getId()
              + " ("
              + mobGroup.getStatus()
              + ")");
    }

    activeChar.sendPacket(SystemMessageId.EMPTY3);
  }
Esempio n. 13
0
  private void unspawnGroup(String command, L2PcInstance activeChar) {
    int groupId;

    try {
      groupId = Integer.parseInt(command.split(" ")[1]);
    } catch (Exception e) {
      activeChar.sendMessage("Usage: //mobgroup_unspawn <groupId>");
      return;
    }

    final MobGroup group = MobGroupTable.getInstance().getGroup(groupId);

    if (group == null) {
      activeChar.sendMessage("Invalid group specified.");
      return;
    }

    doAnimation(activeChar);
    group.unspawnGroup();

    activeChar.sendMessage("Mob group " + groupId + " unspawned.");
  }