int itemId = Integer.parseInt(st.nextToken());
int amount = Integer.parseInt(st.nextToken());
if(player != null)
{
L2ItemInstance item = player.getInventory().addItem("Status-Give", itemId, amount, null, null);
InventoryUpdate iu = new InventoryUpdate();
iu.addItem(item);
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
sm.addItemName(itemId);
sm.addNumber(amount);
player.sendPacket(iu);
_print.println("ok");
}
}
catch(Exception e)
{
}
}
else if (_usrCommand.startsWith("jail"))
{
StringTokenizer st = new StringTokenizer(_usrCommand.substring(5));
try
{
String playerName = st.nextToken();
L2PcInstance playerObj = L2World.getInstance().getPlayer(playerName);
int delay = 0;
try
{
delay = Integer.parseInt(st.nextToken());
} catch (NumberFormatException nfe) {
} catch (NoSuchElementException nsee) {}
//L2PcInstance playerObj = L2World.getInstance().getPlayer(player);
if (playerObj != null)
{
playerObj.setInJail(true, delay);
_print.println("Character "+playerObj.getName()+" jailed for "+(delay>0 ? delay+" minutes." : "ever!"));
}
else
{
jailOfflinePlayer(playerName, delay);
}
} catch (NoSuchElementException nsee)
{
_print.println("Specify a character name.");
} catch(Exception e)
{
if (Config.DEBUG) e.printStackTrace();
}
}
else if (_usrCommand.startsWith("unjail"))
{
StringTokenizer st = new StringTokenizer(_usrCommand.substring(7));
try
{
String playerName = st.nextToken();
L2PcInstance playerObj = L2World.getInstance().getPlayer(st.nextToken());
if (playerObj != null)
{
playerObj.stopJailTask(false);
playerObj.setInJail(false, 0);
_print.println("Character "+playerObj.getName()+" removed from jail");
}
else
{
unjailOfflinePlayer(playerName);
}
} catch (NoSuchElementException nsee)
{
_print.println("Specify a character name.");
} catch(Exception e)
{
if (Config.DEBUG) e.printStackTrace();
}
}
else if (_usrCommand.startsWith("debug") && _usrCommand.length() > 6)
{
StringTokenizer st = new StringTokenizer(_usrCommand.substring(6));
try
{
String dbg = st.nextToken();
if(dbg.equals("decay"))
{
_print.print(DecayTaskManager.getInstance().toString());
}
else if(dbg.equals("ai"))
{
/*
_print.println("AITaskManagerStats");
for(String line : AITaskManager.getInstance().getStats())
{
_print.println(line);
}
*/
}
else if(dbg.equals("aiflush"))
{
//AITaskManager.getInstance().flush();
}
else if(dbg.equals("PacketTP"))
{
String str = ThreadPoolManager.getInstance().getPacketStats();
_print.println(str);
int i = 0;
File f = new File("./log/StackTrace-PacketTP-"+i+".txt");
while(f.exists())
{
i++;
f = new File("./log/StackTrace-PacketTP-"+i+".txt");
}
f.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(f);
OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
out.write(str);
out.flush();
out.close();
fos.close();
}
else if(dbg.equals("IOPacketTP"))
{
String str = ThreadPoolManager.getInstance().getIOPacketStats();
_print.println(str);
int i = 0;
File f = new File("./log/StackTrace-IOPacketTP-"+i+".txt");
while(f.exists())
{
i++;
f = new File("./log/StackTrace-IOPacketTP-"+i+".txt");
}
f.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(f);
OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
out.write(str);
out.flush();
out.close();
fos.close();
}
else if(dbg.equals("GeneralTP"))
{
String str = ThreadPoolManager.getInstance().getGeneralStats();
_print.println(str);
int i = 0;
File f = new File("./log/StackTrace-GeneralTP-"+i+".txt");
while(f.exists())
{
i++;
f = new File("./log/StackTrace-GeneralTP-"+i+".txt");
}
f.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(f);
OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
out.write(str);
out.flush();
out.close();
fos.close();
}
}
catch(Exception e){}
}
else if (_usrCommand.startsWith("reload"))
{
StringTokenizer st = new StringTokenizer(_usrCommand.substring(7));
try
{
String type = st.nextToken();
if(type.equals("multisell"))
{
_print.print("Reloading multisell... ");
L2Multisell.getInstance().reload();
_print.print("done\n");
}
else if(type.equals("skill"))
{
_print.print("Reloading skills... ");
SkillTable.getInstance().reload();
_print.print("done\n");
}
else if(type.equals("npc"))
{
_print.print("Reloading npc templates... ");
NpcTable.getInstance().reloadAllNpc();
_print.print("done\n");
}
else if(type.equals("html"))
{
_print.print("Reloading html cache... ");
HtmCache.getInstance().reload();
_print.print("done\n");
}
else if(type.equals("item"))
{
_print.print("Reloading item templates... ");
ItemTable.getInstance().reload();
_print.print("done\n");
}
else if(type.equals("instancemanager"))
{
_print.print("Reloading instance managers... ");
Manager.reloadAll();
_print.print("done\n");
}
else if(type.equals("zone"))
{
_print.print("Reloading zone tables... ");
//TODO: ZONETODO reload zones using telnet ZoneManager.getInstance().reload();
_print.print("done\n");
}
}
catch(Exception e){}
}
else if (_usrCommand.startsWith("gamestat"))
{
StringTokenizer st = new StringTokenizer(_usrCommand.substring(9));
try
{
String type = st.nextToken();
// name;type;x;y;itemId:enchant:price...
if(type.equals("privatestore"))
{
for(L2PcInstance player : L2World.getInstance().getAllPlayers())
{
if(player.getPrivateStoreType() == 0)
continue;
TradeList list = null;
String content = "";
if(player.getPrivateStoreType() == 1) // sell
{
list = player.getSellList();
for(TradeItem item : list.getItems())
{
content += item.getItem().getItemId()+":"+item.getEnchant()+":"+item.getPrice()+":";
}
content = player.getName()+";"+"sell;"+player.getX()+";"+player.getY()+";"+content;
_print.println(content);
continue;
}
else if(player.getPrivateStoreType() == 3) // buy
{
list = player.getBuyList();
for(TradeItem item : list.getItems())
{
content += item.getItem().getItemId()+":"+item.getEnchant()+":"+item.getPrice()+":";
}
content = player.getName()+";"+"buy;"+player.getX()+";"+player.getY()+";"+content;
_print.println(content);
continue;
}