if(fullString.startsWith("admin_settitle"))
{
try
{
String val = fullString.substring(15);
L2Object target = activeChar.getTarget();
L2Player player;
if(target == null)
{
return false;
}
if(target.isPlayer())
{
player = (L2Player) target;
player.setTitle(val);
player.sendMessage("Your title has been changed by a GM");
player.sendChanges();
}
else if(target.isNpc())
{
((L2NpcInstance) target).setTitle(val);
target.decayMe();
target.spawnMe();
}
return true;
}
catch(StringIndexOutOfBoundsException e)
{ // Case of empty character title
activeChar.sendMessage("You need to specify the new title.");
return false;
}
}
else if(fullString.startsWith("admin_setname"))
{
try
{
String val = fullString.substring(14);
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
return false;
}
if(mysql.simple_get_int("count(*)", "characters", "`char_name` like '" + val + "'") > 0)
{
activeChar.sendMessage("Name already exist.");
return false;
}
Log.add("Character " + player.getName() + " renamed to " + val + " by GM " + activeChar.getName(), "renames");
player.reName(val);
player.sendMessage("Your name has been changed by a GM");
return true;
}
catch(StringIndexOutOfBoundsException e)
{ // Case of empty character name
activeChar.sendMessage("You need to specify the new name.");
return false;
}
}
}
if(!activeChar.getPlayerAccess().CanEditChar && !activeChar.getPlayerAccess().CanViewChar)
{
return false;
}
if(fullString.equals("admin_current_player"))
{
showCharacterList(activeChar, null);
}
else if(fullString.startsWith("admin_character_list"))
{
try
{
String val = fullString.substring(21);
L2Player target = L2ObjectsStorage.getPlayer(val);
showCharacterList(activeChar, target);
}
catch(StringIndexOutOfBoundsException e)
{
// Case of empty character name
}
}
else if(fullString.startsWith("admin_show_characters"))
{
try
{
String val = fullString.substring(22);
int page = Integer.parseInt(val);
listCharacters(activeChar, page);
}
catch(StringIndexOutOfBoundsException e)
{
// Case of empty page
}
}
else if(fullString.startsWith("admin_find_character"))
{
try
{
String val = fullString.substring(21);
findCharacter(activeChar, val);
}
catch(StringIndexOutOfBoundsException e)
{ // Case of empty character name
activeChar.sendMessage("You didnt enter a character name to find.");
listCharacters(activeChar, 0);
}
}
else if(!activeChar.getPlayerAccess().CanEditChar)
{
return false;
}
else if(fullString.equals("admin_edit_character"))
{
editCharacter(activeChar);
}
else if(fullString.equals("admin_character_actions"))
{
showCharacterActions(activeChar);
}
else if(fullString.equals("admin_nokarma"))
{
setTargetKarma(activeChar, 0);
}
else if(fullString.startsWith("admin_setkarma"))
{
try
{
String val = fullString.substring(15);
int karma = Integer.parseInt(val);
setTargetKarma(activeChar, karma);
}
catch(StringIndexOutOfBoundsException e)
{
activeChar.sendMessage("Please specify new karma value.");
}
}
else if(fullString.startsWith("admin_save_modifications"))
{
try
{
String val = fullString.substring(24);
adminModifyCharacter(activeChar, val);
}
catch(StringIndexOutOfBoundsException e)
{ // Case of empty character name
activeChar.sendMessage("Error while modifying character.");
listCharacters(activeChar, 0);
}
}
else if(fullString.equals("admin_rec"))
{
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
return false;
}
player.setRecomHave(player.getRecomHave() + 1);
player.sendMessage("You have been recommended by a GM");
player.broadcastUserInfo(true);
}
else if(fullString.startsWith("admin_rec"))
{
try
{
String val = fullString.substring(10);
int recVal = Integer.parseInt(val);
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
return false;
}
player.setRecomHave(player.getRecomHave() + recVal);
player.sendMessage("You have been recommended by a GM");
player.broadcastUserInfo(true);
}
catch(NumberFormatException e)
{
activeChar.sendMessage("Command format is //rec <number>");
}
}
else if(fullString.startsWith("admin_sethero"))
{
// Статус меняется только на текущую логон сессию
L2Object target = activeChar.getTarget();
L2Player player;
if(wordList.length > 1 && wordList[1] != null)
{
player = L2ObjectsStorage.getPlayer(wordList[1]);
if(player == null)
{
activeChar.sendMessage("Character " + wordList[1] + " not found in game.");
return false;
}
}
else if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
activeChar.sendMessage("You must specify the name or target character.");
return false;
}
if(player.isHero())
{
player.setHero(false);
player.updatePledgeClass();
Hero.removeSkills(player);
}
else
{
player.setHero(true);
player.updatePledgeClass();
Hero.addSkills(player);
}
player.sendPacket(new SkillList(player));
if(player.isHero())
{
player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
Announcements.getInstance().announceToAll(player.getName() + " has become a hero.");
}
player.sendMessage("Admin changed your hero status.");
player.broadcastUserInfo(true);
}
else if(fullString.startsWith("admin_setnoble"))
{
// Статус сохраняется в базе
L2Object target = activeChar.getTarget();
L2Player player;
if(wordList.length > 1 && wordList[1] != null)
{
player = L2ObjectsStorage.getPlayer(wordList[1]);
if(player == null)
{
activeChar.sendMessage("Character " + wordList[1] + " not found in game.");
return false;
}
}
else if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
activeChar.sendMessage("You must specify the name or target character.");
return false;
}
if(player.isNoble())
{
Olympiad.removeNoble(player);
player.setNoble(false);
player.sendMessage("Admin changed your noble status, now you are not nobless.");
}
else
{
Olympiad.addNoble(player);
player.setNoble(true);
player.broadcastPacket(new SocialAction(player.getObjectId(), SocialAction.VICTORY));
player.sendMessage("Admin changed your noble status, now you nobless.");
}
player.updatePledgeClass();
player.updateNobleSkills();
player.sendPacket(new SkillList(player));
player.broadcastUserInfo(true);
}
else if(fullString.startsWith("admin_setsex"))
{
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
return false;
}
player.changeSex();
player.sendMessage("Your gender has been changed by a GM");
player.broadcastUserInfo(true);
}
else if(fullString.startsWith("admin_setcolor"))
{
try
{
String val = fullString.substring(15);
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{
return false;
}
player.setNameColor(Integer.decode("0x" + val));
player.sendMessage("Your name color has been changed by a GM");
player.broadcastUserInfo(true);
}
catch(StringIndexOutOfBoundsException e)
{ // Case of empty color
activeChar.sendMessage("You need to specify the new color.");
}
}
else if(fullString.startsWith("admin_add_exp_sp_to_character"))
{
addExpSp(activeChar);
}
else if(fullString.startsWith("admin_add_exp_sp"))
{
try
{
final String val = fullString.substring(16);
adminAddExpSp(activeChar, val);
}
catch(final StringIndexOutOfBoundsException e)
{ // Case of empty character name
activeChar.sendMessage("Error while adding Exp-Sp.");
}
}
else if(fullString.startsWith("admin_trans"))
{
StringTokenizer st = new StringTokenizer(fullString);
if(st.countTokens() > 1)
{
st.nextToken();
int transformId;
try
{
transformId = Integer.parseInt(st.nextToken());
}
catch(Exception e)
{
activeChar.sendMessage("Specify a valid integer value.");
return false;
}
if(transformId != 0 && activeChar.getTransformation() != 0)
{
activeChar.sendPacket(Msg.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
activeChar.setTransformation(transformId);
activeChar.sendMessage("Transforming...");
}
else
{
activeChar.sendMessage("Usage: //trans <ID>");
}
}
else if(fullString.startsWith("admin_setsubclass"))
{
final L2Object target = activeChar.getTarget();
if(target == null || !target.isPlayer())
{
activeChar.sendPacket(Msg.SELECT_TARGET);
return false;
}
final L2Player player = (L2Player) target;
StringTokenizer st = new StringTokenizer(fullString);
if(st.countTokens() > 1)
{
st.nextToken();
short classId = Short.parseShort(st.nextToken());
if(!player.addSubClass(classId, true))
{
activeChar.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2VillageMasterInstance.SubclassCouldNotBeAdded", activeChar));
return false;
}
player.sendPacket(Msg.CONGRATULATIONS_YOU_HAVE_TRANSFERRED_TO_A_NEW_CLASS); // Transfer to new class.
}
else
{
setSubclass(activeChar, player);
}
}
else if(fullString.startsWith("admin_setfame"))
{
try
{
String val = fullString.substring(14);
int fame = Integer.parseInt(val);
setTargetFame(activeChar, fame);
}
catch(StringIndexOutOfBoundsException e)
{
activeChar.sendMessage("Please specify new fame value.");
}
}
else if(fullString.startsWith("admin_setbday"))
{
String msgUsage = "Usage: //setbday YYYY-MM-DD";
String date = fullString.substring(14);
if(date.length() != 10 || !Util.isMatchingRegexp(date, "[0-9]{4}-[0-9]{2}-[0-9]{2}"))
{
activeChar.sendMessage(msgUsage);
return false;
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try
{
dateFormat.parse(date);
}
catch(ParseException e)
{
activeChar.sendMessage(msgUsage);
}
if(activeChar.getTarget() == null || !activeChar.getTarget().isPlayer())
{
activeChar.sendMessage("Please select a character.");
return false;
}
if(!mysql.set("update characters set createtime = UNIX_TIMESTAMP('" + date + "') where obj_Id = " + activeChar.getTarget().getObjectId()))
{
activeChar.sendMessage(msgUsage);
return false;
}
activeChar.sendMessage("New Birthday for " + activeChar.getTarget().getName() + ": " + date);
activeChar.getTarget().getPlayer().sendMessage("Admin changed your birthday to: " + date);
}
else if(fullString.startsWith("admin_setclass"))
{
if(wordList.length < 2)
{
activeChar.sendMessage("Использование команды: //setclass CLASS_ID");
return false;
}
int classId;
try
{
classId = Integer.parseInt(wordList[1]);
}
catch(Exception e)
{
activeChar.sendMessage("При вызове команды //setclass Вы указали неверный параметр CLASS_ID");
return false;
}
L2Object target = activeChar.getTarget();
L2Player player;
if(target != null && target.isPlayer())
{
player = (L2Player) target;
}
else
{