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."); }
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); }
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); }
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."); } }
private void removeGroup(String command, L2PcInstance activeChar) { int groupId; try { groupId = Integer.parseInt(command.split(" ")[1]); } catch (Exception e) { activeChar.sendMessage("Usage: //mobgroup_remove <groupId>"); return; } final MobGroup group = MobGroupTable.getInstance().getGroup(groupId); if (group == null) { activeChar.sendMessage("Invalid group specified."); return; } doAnimation(activeChar); group.unspawnGroup(); if (MobGroupTable.getInstance().removeGroup(groupId)) { activeChar.sendMessage("Mob group " + groupId + " unspawned and removed."); } }
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); }
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(); }
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(); }
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."); }
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); }