RegionBBSManager.getInstance().changeCommunityBoard();
}
else if (target instanceof L2NpcInstance)
{
L2NpcInstance npc = (L2NpcInstance) target;
oldName = npc.getName();
npc.setName(val);
npc.updateAbnormalEffect();
}
if (oldName == null)
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
return false;
}
activeChar.sendMessage("Name changed from " + oldName + " to " + val);
return true;
} // changes char name
case admin_edit_character:
{
editCharacter(activeChar);
return true;
}
case admin_current_player:
{
showCharacterInfo(activeChar, null);
return true;
}
case admin_nokarma:
{
setTargetKarma(activeChar, 0);
return true;
}
case admin_setkarma:
{
int karma = 0;
if (st.hasMoreTokens())
{
String val = st.nextToken();
try
{
karma = Integer.parseInt(val);
val = null;
}
catch (NumberFormatException e)
{
activeChar.sendMessage("Usage: //setkarma new_karma_for_target(number)");
return false;
}
}
else
{
activeChar.sendMessage("Usage: //setkarma new_karma_for_target");
return false;
}
setTargetKarma(activeChar, karma);
return true;
}
case admin_character_list:
case admin_character_info:
{
String val = "";
if (st.hasMoreTokens())
{
while (st.hasMoreTokens())
{
if (val.equals(""))
{
val = st.nextToken();
}
else
{
val += " " + st.nextToken();
}
}
}
else
{
activeChar.sendMessage("Usage: //character_info <player_name>");
return false;
}
L2PcInstance target = L2World.getInstance().getPlayer(val);
if (target != null)
{
showCharacterInfo(activeChar, target);
val = null;
return true;
}
activeChar.sendPacket(new SystemMessage(SystemMessageId.CHARACTER_DOES_NOT_EXIST));
val = null;
return false;
} // given a player name:{} displays an information window
case admin_show_characters:
{
String val = "";
if (st.hasMoreTokens())
{
val = st.nextToken();
try
{
int page = Integer.parseInt(val);
listCharacters(activeChar, page);
val = null;
return true;
}
catch (NumberFormatException e)
{
activeChar.sendMessage("Usage: //show_characters <page_number>");
val = null;
listCharacters(activeChar, 0);
return false;
}
}
activeChar.sendMessage("Usage: //show_characters <page_number>");
listCharacters(activeChar, 0);
return false;
}
case admin_find_character:
{
String val = "";
if (st.hasMoreTokens())
{
while (st.hasMoreTokens())
{
if (val.equals(""))
{
val = st.nextToken();
}
else
{
val += " " + st.nextToken();
}
}
}
else
{
activeChar.sendMessage("Usage: //find_character <player_name>");
listCharacters(activeChar, 0);
return false;
}
findCharacter(activeChar, val);
val = null;
return true;
}
case admin_find_dualbox:
{
String val = "";
int boxes = 2;
if (st.hasMoreTokens())
{
val = st.nextToken();
try
{
boxes = Integer.parseInt(val);
val = null;
}
catch (NumberFormatException e)
{
activeChar.sendMessage("Usage: //find_dualbox <boxes_number>(default 2)");
val = null;
listCharacters(activeChar, 0);
return false;
}
}
findMultibox(activeChar, boxes);
return true;
}
case admin_find_ip:
{
String val = "";
if (st.hasMoreTokens())
{
val = st.nextToken();
}
else
{
activeChar.sendMessage("Usage: //find_ip <ip>");
listCharacters(activeChar, 0);
return false;
}
try
{
findCharactersPerIp(activeChar, val);
}
catch (IllegalArgumentException e)
{
activeChar.sendMessage("Usage: //find_ip <ip>");
listCharacters(activeChar, 0);
return false;
}
return true;
} // find all the player connections from a given IPv4 number
case admin_find_account:
{
String val = "";
if (st.hasMoreTokens())
{
val = st.nextToken();
}
else
{
activeChar.sendMessage("Usage: //find_account <account_name>");
listCharacters(activeChar, 0);
return false;
}
findCharactersPerAccount(activeChar, val);
return true;
} // list all the characters from an account (useful for GMs w/o DB access)
case admin_save_modifications:
{
String val = "";
if (st.hasMoreTokens())
{
while (st.hasMoreTokens())
{
if (val.equals(""))
val = st.nextToken();
else
val = val + " " + st.nextToken();
}
}
else
{
activeChar.sendMessage("Usage: //save_modifications <mods>");
listCharacters(activeChar, 0);
return false;
}
adminModifyCharacter(activeChar, val);
val = null;
return true;
} // consider it deprecated...
case admin_rec:
{
String val = "";
int value = 1;
if (st.hasMoreTokens())
{
val = st.nextToken();
try
{
value = Integer.parseInt(val);
}
catch (NumberFormatException e)
{
activeChar.sendMessage("Usage: //rec <value>(default 1)");
return false;
}
}
else
{
activeChar.sendMessage("Usage: //rec <value>(default 1)");
return false;
}
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
if (target instanceof L2PcInstance)
{
player = (L2PcInstance) target;
}
else
{
activeChar.sendMessage("Select player before. Usage: //rec <value>(default 1)");
listCharacters(activeChar, 0);
return false;
}
target = null;
player.setRecomHave(player.getRecomHave() + value);
SystemMessage sm = new SystemMessage(SystemMessageId.GM_S1);
sm.addString("You have been recommended by a GM");
player.sendPacket(sm);
player.broadcastUserInfo();
player = null;
sm = null;
val = null;
return true;
}
case admin_setclass:
{
String val = "";
int classidval = 0;
if (st.hasMoreTokens())
{
val = st.nextToken();
try
{
classidval = Integer.parseInt(val);
}
catch (NumberFormatException e)
{
activeChar.sendMessage("Usage: //setclass <value>(default 1)");
return false;
}
}
else
{
AdminHelpPage.showSubMenuPage(activeChar, "charclasses.htm");
return false;
}
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
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);
ClassId classId = ClassId.getClassIdByOrdinal(classidval);
if (!player.isSubClassActive())
{
// while(classId.level() != 0){ //go to root
// classId = classId.getParent();
// }
player.setBaseClass(classId);
}
String newclass = player.getTemplate().className;
player.store();
if (player != activeChar)
{
player.sendMessage("A GM changed your class to " + newclass);
}
player.broadcastUserInfo();
activeChar.sendMessage(player.getName() + " changed to " + newclass);
newclass = null;
return true;
}
activeChar.sendMessage("Usage: //setclass <valid_new_classid>");
return false;
}
case admin_settitle:
{
String val = "";
if (st.hasMoreTokens())
{
while (st.hasMoreTokens())
{
if (val.equals(""))
{
val = st.nextToken();
}
else
{
val += " " + st.nextToken();
}
}
}
else
{
activeChar.sendMessage("Usage: //settitle <new_title>");
return false;
}
L2Object target = activeChar.getTarget();
L2PcInstance player = null;
L2NpcInstance npc = null;
if (target == null)
{
player = activeChar;
}
else if (target instanceof L2PcInstance)
{
player = (L2PcInstance) target;
}
else if (target instanceof L2NpcInstance)
{
npc = (L2NpcInstance) target;
}
else
{
activeChar.sendMessage("Select your target before the command");
return false;
}
target = null;
st = null;
if (player != null)
{
player.setTitle(val);
if (player != activeChar)
{
player.sendMessage("Your title has been changed by a GM");
}
player.broadcastTitleInfo();
}
else if (npc != null)
{
npc.setTitle(val);
npc.updateAbnormalEffect();
}
val = null;
return true;