This commit is contained in:
mobius
2015-01-01 20:02:50 +00:00
parent eeae660458
commit a6a3718849
17894 changed files with 2818932 additions and 0 deletions

View File

@ -0,0 +1,107 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.util.StringUtil;
public class AccountingFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
StringUtil.append(output, ", ");
if (p instanceof L2GameClient)
{
final L2GameClient client = (L2GameClient) p;
String address = null;
try
{
if (!client.isDetached())
{
address = client.getConnection().getInetAddress().getHostAddress();
}
}
catch (Exception e)
{
}
switch (client.getState())
{
case IN_GAME:
if (client.getActiveChar() != null)
{
StringUtil.append(output, client.getActiveChar().getName());
StringUtil.append(output, "(", String.valueOf(client.getActiveChar().getObjectId()), ") ");
}
case AUTHED:
if (client.getAccountName() != null)
{
StringUtil.append(output, client.getAccountName(), " ");
}
case CONNECTED:
if (address != null)
{
StringUtil.append(output, address);
}
break;
default:
throw new IllegalStateException("Missing state on switch");
}
}
else if (p instanceof L2PcInstance)
{
L2PcInstance player = (L2PcInstance) p;
StringUtil.append(output, player.getName());
StringUtil.append(output, "(", String.valueOf(player.getObjectId()), ")");
}
else
{
StringUtil.append(output, p.toString());
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.util.StringUtil;
/**
* @author zabbix
*/
public class AuditFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
StringUtil.append(output, ", ", p.toString());
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.util.StringUtil;
public class ChatLogFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params != null ? 10 * params.length : 0), "[", dateFmt.format(new Date(record.getMillis())), "] ");
if (params != null)
{
for (Object p : params)
{
StringUtil.append(output, String.valueOf(p), " ");
}
}
StringUtil.append(output, record.getMessage(), Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.util.StringUtil;
import com.l2jserver.util.Util;
public class ConsoleLogFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd/MM HH:mm:ss");
@Override
public String format(LogRecord record)
{
final StringBuilder output = new StringBuilder(500);
StringUtil.append(output, "[", dateFmt.format(new Date(record.getMillis())), "] " + record.getMessage(), Config.EOL);
if (record.getThrown() != null)
{
try
{
StringUtil.append(output, Util.getStackTrace(record.getThrown()), Config.EOL);
}
catch (Exception ex)
{
}
}
return output.toString();
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.util.StringUtil;
public class DamageFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("yy.MM.dd H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), "[", dateFmt.format(new Date(record.getMillis())), "] '---': ", record.getMessage());
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
if (p instanceof L2Character)
{
if ((p instanceof L2Attackable) && ((L2Attackable) p).isRaid())
{
StringUtil.append(output, "RaidBoss ");
}
StringUtil.append(output, ((L2Character) p).getName(), "(", String.valueOf(((L2Character) p).getObjectId()), ") ");
StringUtil.append(output, String.valueOf(((L2Character) p).getLevel()), " lvl");
if (p instanceof L2Summon)
{
L2PcInstance owner = ((L2Summon) p).getOwner();
if (owner != null)
{
StringUtil.append(output, " Owner:", owner.getName(), "(", String.valueOf(owner.getObjectId()), ")");
}
}
}
else if (p instanceof Skill)
{
StringUtil.append(output, " with skill ", ((Skill) p).getName(), "(", String.valueOf(((Skill) p).getId()), ")");
}
else
{
StringUtil.append(output, p.toString());
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.util.StringUtil;
public class EnchantFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
StringUtil.append(output, ", ");
if (p instanceof L2PcInstance)
{
L2PcInstance player = (L2PcInstance) p;
StringUtil.append(output, "Character:", player.getName(), " [" + String.valueOf(player.getObjectId()) + "] Account:", player.getAccountName());
if ((player.getClient() != null) && !player.getClient().isDetached())
{
StringUtil.append(output, " IP:", player.getClient().getConnection().getInetAddress().getHostAddress());
}
}
else if (p instanceof L2ItemInstance)
{
L2ItemInstance item = (L2ItemInstance) p;
if (item.getEnchantLevel() > 0)
{
StringUtil.append(output, "+", String.valueOf(item.getEnchantLevel()), " ");
}
StringUtil.append(output, item.getItem().getName(), "(", String.valueOf(item.getCount()), ")");
StringUtil.append(output, " [", String.valueOf(item.getObjectId()), "]");
}
else if (p instanceof Skill)
{
Skill skill = (Skill) p;
if (skill.getLevel() > 100)
{
StringUtil.append(output, "+", String.valueOf(skill.getLevel() % 100), " ");
}
StringUtil.append(output, skill.getName(), "(", String.valueOf(skill.getId()), " ", String.valueOf(skill.getLevel()), ")");
}
else
{
StringUtil.append(output, p.toString());
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.util.StringUtil;
/**
* This class ...
* @version $Revision: 1.1.4.1 $ $Date: 2005/03/27 15:30:08 $
*/
public class FileLogFormatter extends Formatter
{
private static final String TAB = "\t";
private final SimpleDateFormat dateFmt = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");
@Override
public String format(LogRecord record)
{
return StringUtil.concat(dateFmt.format(new Date(record.getMillis())), TAB, record.getLevel().getName(), TAB, String.valueOf(record.getThreadID()), TAB, record.getLoggerName(), TAB, record.getMessage(), Config.EOL);
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
public class GMAuditFormatter extends Formatter
{
@Override
public String format(LogRecord record)
{
return record.getMessage() + Config.EOL;
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.util.StringUtil;
/**
* @author Advi
*/
public class ItemLogFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params.length * 50), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
for (Object p : record.getParameters())
{
if (p == null)
{
continue;
}
output.append(", ");
if (p instanceof L2ItemInstance)
{
L2ItemInstance item = (L2ItemInstance) p;
StringUtil.append(output, "item ", String.valueOf(item.getObjectId()), ":");
if (item.getEnchantLevel() > 0)
{
StringUtil.append(output, "+", String.valueOf(item.getEnchantLevel()), " ");
}
StringUtil.append(output, item.getItem().getName(), "(", String.valueOf(item.getCount()), ")");
}
// else if (p instanceof L2PcInstance)
// output.append(((L2PcInstance)p).getName());
else
{
output.append(p.toString()/* + ":" + ((L2Object)p).getObjectId() */);
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jserver.Config;
import com.l2jserver.util.StringUtil;
public class OlympiadFormatter extends Formatter
{
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd/MM/yyyy H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), dateFmt.format(new Date(record.getMillis())), ",", record.getMessage());
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
StringUtil.append(output, ",", p.toString());
}
}
output.append(Config.EOL);
return output.toString();
}
}