else if ((command.startsWith("admin_character_list"))||(command.startsWith("admin_character_info")))
{
try
{
String val = command.substring(21);
L2PcInstance target = L2World.getInstance().getPlayer(val);
if (target != null)
showCharacterInfo(activeChar, target);
else
activeChar.sendPacket(new SystemMessage(SystemMessageId.CHARACTER_DOES_NOT_EXIST));
}
catch (StringIndexOutOfBoundsException e)
{
activeChar.sendMessage("Usage: //character_info <player_name>");
}
}
else if (command.startsWith("admin_show_characters"))
{
try
{
String val = command.substring(22);
int page = Integer.parseInt(val);
listCharacters(activeChar, page);
}
catch (StringIndexOutOfBoundsException e)
{
//Case of empty page number
activeChar.sendMessage("Usage: //show_characters <page_number>");
}
}
else if (command.startsWith("admin_find_character"))
{
try
{
String val = command.substring(21);
findCharacter(activeChar, val);
}
catch (StringIndexOutOfBoundsException e)
{ //Case of empty character name
activeChar.sendMessage("Usage: //find_character <character_name>");
listCharacters(activeChar, 0);
}
}
else if (command.startsWith("admin_find_ip"))
{
try
{
String val = command.substring(14);
findCharactersPerIp(activeChar, val);
}
catch (Exception e)
{ //Case of empty or malformed IP number
activeChar.sendMessage("Usage: //find_ip <www.xxx.yyy.zzz>");
listCharacters(activeChar, 0);
}
}
else if (command.startsWith("admin_find_account"))
{
try
{
String val = command.substring(19);
findCharactersPerAccount(activeChar, val);
}
catch (Exception e)
{ //Case of empty or malformed player name
activeChar.sendMessage("Usage: //find_account <player_name>");
listCharacters(activeChar, 0);
}
}
else if (command.equals("admin_edit_character"))
editCharacter(activeChar);
// Karma control commands
else if (command.equals("admin_nokarma"))
setTargetKarma(activeChar, 0);
else if (command.startsWith("admin_setkarma"))
{
try
{
String val = command.substring(15);
int karma = Integer.parseInt(val);
if (activeChar == activeChar.getTarget() || activeChar.getAccessLevel()>=REQUIRED_LEVEL2)
GMAudit.auditGMAction(activeChar.getName(), command, activeChar.getName(), "");
setTargetKarma(activeChar, karma);
}
catch (StringIndexOutOfBoundsException e)
{
if (Config.DEVELOPER )
System.out.println("Set karma error: "+e);
activeChar.sendMessage("Usage: //setkarma <new_karma_value>");
}
}
else if (command.startsWith("admin_save_modifications"))
{
try
{
String val = command.substring(24);
if (activeChar == activeChar.getTarget() || activeChar.getAccessLevel()>=REQUIRED_LEVEL2)
GMAudit.auditGMAction(activeChar.getName(), command, activeChar.getName(), "");
adminModifyCharacter(activeChar, val);
}
catch (StringIndexOutOfBoundsException e)
{ //Case of empty character name
activeChar.sendMessage("Error while modifying character.");
listCharacters(activeChar, 0);
}
}
else if (command.startsWith("admin_rec"))
{
try
{
String val = command.substring(10);
int recVal = Integer.parseInt(val);
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance) {
player = (L2PcInstance)target;
} else {
return false;
}
player.setRecomHave(recVal);
player.sendMessage("You have been recommended by a GM");
player.broadcastUserInfo();
} catch (Exception e)
{
activeChar.sendMessage("Usage: //rec number");
}
}
else if (command.startsWith("admin_setclass"))
{
try
{
String val = command.substring(15);
int classidval = Integer.parseInt(val);
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance)
player = (L2PcInstance)target;
else
return false;
boolean valid=false;
for (ClassId classid: ClassId.values())
if (classidval == classid.getId())
valid = true;
if (valid && (player.getClassId().getId() != classidval))
{
player.setClassId(classidval);
if (!player.isSubClassActive())
player.setBaseClass(classidval);
String newclass = player.getTemplate().className;
player.store();
player.sendMessage("A GM changed your class to "+newclass);
player.broadcastUserInfo();
activeChar.sendMessage(player.getName()+" is a "+newclass);
}
activeChar.sendMessage("Usage: //setclass <valid_new_classid>");
}
catch (StringIndexOutOfBoundsException e)
{
AdminHelpPage.showHelpPage(activeChar, "charclasses.htm");
}
}
else if (command.startsWith("admin_settitle"))
{
try
{
String val = command.substring(15);
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance) {
player = (L2PcInstance)target;
} else {
return false;
}
player.setTitle(val);
player.sendMessage("Your title has been changed by a GM");
player.broadcastTitleInfo();
}
catch (StringIndexOutOfBoundsException e)
{ //Case of empty character title
activeChar.sendMessage("You need to specify the new title.");
}
}
else if (command.startsWith("admin_setname"))
{
try
{
String val = command.substring(14);
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance) {
player = (L2PcInstance)target;
} else {
return false;
}
player.setName(val);
player.sendMessage("Your name has been changed by a GM");
player.broadcastUserInfo();
player.store();
}
catch (StringIndexOutOfBoundsException e)
{ //Case of empty character name
activeChar.sendMessage("Usage: //setname new_name_for_target");
}
}
else if (command.startsWith("admin_setsex"))
{
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance) {
player = (L2PcInstance)target;
} else {
return false;
}
player.getAppearance().setSex(player.getAppearance().getSex()? false : true);
player.sendMessage("Your gender has been changed by a GM");
player.broadcastUserInfo();
player.decayMe();
player.spawnMe(player.getX(),player.getY(),player.getZ());
}
else if (command.startsWith("admin_setcolor"))
{
try
{
String val = command.substring(15);
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (activeChar != target && activeChar.getAccessLevel()<REQUIRED_LEVEL2)
return false;
if (target instanceof L2PcInstance) {
player = (L2PcInstance)target;
} else {
return false;
}
player.getAppearance().setNameColor(Integer.decode("0x"+val));
player.sendMessage("Your name color has been changed by a GM");
player.broadcastUserInfo();
}
catch (StringIndexOutOfBoundsException e)
{ //Case of empty color
activeChar.sendMessage("You need to specify the new color.");
}