Partial sync L2jUnity free release Feb 16th 2015.

This commit is contained in:
MobiusDev
2016-10-23 14:56:34 +00:00
parent 89d5331c99
commit be6443a66a
106 changed files with 1866 additions and 1803 deletions

View File

@@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
/**
* @author Nos
*/
public abstract class AbstractFormatter extends Formatter
{
private final DateFormat _dateFormat = new SimpleDateFormat("dd/MM HH:mm:ss");
@Override
public String format(LogRecord record)
{
final StringBuilder sb = new StringBuilder(32);
sb.append("[");
sb.append(_dateFormat.format(new Date(record.getMillis())));
sb.append("] ");
sb.append(record.getMessage());
return sb.toString();
}
}

View File

@@ -1,114 +1,105 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.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()), ") ");
}
break;
}
case AUTHED:
{
if (client.getAccountName() != null)
{
StringUtil.append(output, client.getAccountName(), " ");
}
break;
}
case CONNECTED:
{
if (address != null)
{
StringUtil.append(output, address);
}
break;
}
default:
{
throw new IllegalStateException("Missing state on switch");
}
}
}
else if (p instanceof L2PcInstance)
{
final 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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
public class AccountingFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
output.append(", ");
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)
{
output.append(client.getActiveChar().getName());
output.append("(");
output.append(client.getActiveChar().getObjectId());
output.append(") ");
}
case AUTHED:
if (client.getAccountName() != null)
{
output.append(client.getAccountName());
output.append(" ");
}
case CONNECTED:
if (address != null)
{
output.append(address);
}
break;
default:
throw new IllegalStateException("Missing state on switch");
}
}
else if (p instanceof L2PcInstance)
{
L2PcInstance player = (L2PcInstance) p;
output.append(player.getName());
output.append("(");
output.append(player.getObjectId());
output.append(")");
}
else
{
output.append(p);
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,55 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
/**
* @author zabbix
*/
public class AuditFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
output.append(", ");
output.append(p);
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,49 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.util.StringUtil;
public class ChatLogFormatter 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 ? 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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
public class ChatLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
output.append(p);
output.append(" ");
}
}
output.append(record.getMessage());
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,50 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.util.StringUtil;
import com.l2jmobius.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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.util.Util;
public class ConsoleLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final StringBuilder output = new StringBuilder(128);
output.append(super.format(record));
output.append(Config.EOL);
if (record.getThrown() != null)
{
try
{
output.append(Util.getStackTrace(record.getThrown()));
output.append(Config.EOL);
}
catch (Exception ex)
{
}
}
return output.toString();
}
}

View File

@@ -1,84 +1,89 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.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)
{
final 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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
public class DamageFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
if (p instanceof L2Character)
{
final L2Character creature = (L2Character) p;
if ((p instanceof L2Attackable) && ((L2Attackable) p).isRaid())
{
output.append("RaidBoss ");
}
output.append(creature.getName());
output.append("(");
output.append(creature.getObjectId());
output.append(") ");
output.append(creature.getLevel());
output.append(" lvl");
if (p instanceof L2Summon)
{
L2PcInstance owner = ((L2Summon) p).getOwner();
if (owner != null)
{
output.append(" Owner:");
output.append(owner.getName());
output.append("(");
output.append(owner.getObjectId());
output.append(")");
}
}
}
else if (p instanceof Skill)
{
output.append(" with skill ");
output.append(p);
}
else
{
output.append(p);
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,89 +1,104 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.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)
{
final 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)
{
final 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)
{
final 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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
public class EnchantFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
output.append(", ");
if (p instanceof L2PcInstance)
{
L2PcInstance player = (L2PcInstance) p;
output.append("Character:");
output.append(player.getName());
output.append(" [");
output.append(player.getObjectId());
output.append("] Account:");
output.append(player.getAccountName());
if ((player.getClient() != null) && !player.getClient().isDetached())
{
output.append(" IP:");
output.append(player.getClient().getConnection().getInetAddress().getHostAddress());
}
}
else if (p instanceof L2ItemInstance)
{
L2ItemInstance item = (L2ItemInstance) p;
if (item.getEnchantLevel() > 0)
{
output.append("+");
output.append(item.getEnchantLevel());
output.append(" ");
}
output.append(item.getItem().getName());
output.append("(");
output.append(item.getCount());
output.append(")");
output.append(" [");
output.append(item.getObjectId());
output.append("]");
}
else if (p instanceof Skill)
{
Skill skill = (Skill) p;
if (skill.getLevel() > 100)
{
output.append("+");
output.append(skill.getLevel() % 100);
output.append(" ");
}
output.append(skill.getName());
output.append("(");
output.append(skill.getId());
output.append(" ");
output.append(skill.getLevel());
output.append(")");
}
else
{
output.append(p);
}
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,41 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.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);
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringJoiner;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
/**
* This class ...
* @version $Revision: 1.1.4.1 $ $Date: 2005/03/27 15:30:08 $
*/
public class FileLogFormatter extends Formatter
{
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");
@Override
public String format(LogRecord record)
{
final StringJoiner sj = new StringJoiner("\t", "", Config.EOL);
sj.add(dateFormat.format(new Date(record.getMillis())));
sj.add(record.getLevel().getName());
sj.add(String.valueOf(record.getThreadID()));
sj.add(record.getLoggerName());
sj.add(record.getMessage());
return sj.toString();
}
}

View File

@@ -1,70 +1,70 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.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)
{
final 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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Advi
*/
public class ItemLogFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
for (Object p : record.getParameters())
{
if (p == null)
{
continue;
}
output.append(", ");
if (p instanceof L2ItemInstance)
{
L2ItemInstance item = (L2ItemInstance) p;
output.append("item ");
output.append(item.getObjectId());
output.append(":");
if (item.getEnchantLevel() > 0)
{
output.append("+");
output.append(item.getEnchantLevel());
output.append(" ");
}
output.append(item.getItem().getName());
output.append("(");
output.append(item.getCount());
output.append(")");
}
else
{
output.append(p);
}
}
output.append(Config.EOL);
return output.toString();
}
}

View File

@@ -1,50 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
import com.l2jmobius.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();
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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.l2jmobius.log.formatter;
import java.util.logging.LogRecord;
import com.l2jmobius.Config;
public class OlympiadFormatter extends AbstractFormatter
{
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
output.append(super.format(record));
if (params != null)
{
for (Object p : params)
{
if (p == null)
{
continue;
}
output.append(",");
output.append(p);
}
}
output.append(Config.EOL);
return output.toString();
}
}