{
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.");
}
}
else if (command.startsWith("admin_fullfood"))
{
L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance)
{
L2PetInstance targetPet = (L2PetInstance)target;
targetPet.setCurrentFed(targetPet.getMaxFed());
}