Chronicle 4 branch.

This commit is contained in:
MobiusDev
2017-07-19 21:24:06 +00:00
parent 9a69bec286
commit 3a0bf3539a
13496 changed files with 641683 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
/*
* 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;
import java.util.logging.LogManager;
/**
* Dummy class to enable logs while shutting down
*/
public class L2LogManager extends LogManager
{
public L2LogManager()
{
super();
}
@Override
public void reset()
{
// do nothing
}
public void doReset()
{
super.reset();
}
}

View File

@@ -0,0 +1,32 @@
/*
* 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.filter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
/**
* @author zabbix Lets drink to code!
*/
public class AuditFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getLoggerName().equalsIgnoreCase("audit");
}
}

View File

@@ -0,0 +1,29 @@
/*
* 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.filter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
public class ChatFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getLoggerName().equals("chat");
}
}

View File

@@ -0,0 +1,29 @@
/*
* 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.filter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
public class ErrorFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getThrown() != null;
}
}

View File

@@ -0,0 +1,29 @@
/*
* 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.filter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
public class GMAuditFilter implements Filter
{
@Override
public boolean isLoggable(LogRecord record)
{
return record.getLoggerName().equalsIgnoreCase("gmaudit");
}
}

View File

@@ -0,0 +1,60 @@
/*
* 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.filter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import com.l2jmobius.gameserver.model.L2ItemInstance;
/**
* @author Advi
*/
public class ItemFilter implements Filter
{
// This is example how to exclude consuming of shots and arrows from logging
private final String _excludeProcess = "Consume";
private final String _excludeItemType = "Arrow, Shot";
@Override
public boolean isLoggable(LogRecord record)
{
if (!record.getLoggerName().equals("item"))
{
return false;
}
if (_excludeProcess != null)
{
final String[] messageList = record.getMessage().split(":");
if ((messageList.length < 2) || !_excludeProcess.contains(messageList[1]))
{
return true;
}
}
if (_excludeItemType != null)
{
final L2ItemInstance item = ((L2ItemInstance) record.getParameters()[0]);
if (!_excludeItemType.contains(item.getItemType().toString()))
{
return true;
}
}
return ((_excludeProcess == null) && (_excludeItemType == null));
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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 javolution.text.TextBuilder;
/**
* @author zabbix Lets drink to code!
*/
public class AuditFormatter extends Formatter
{
private static final String CRLF = "\r\n";
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final TextBuilder output = new TextBuilder();
output.append('[');
output.append(dateFmt.format(new Date(record.getMillis())));
output.append(']');
output.append(' ');
output.append(record.getMessage());
for (final Object p : record.getParameters())
{
if (p == null)
{
continue;
}
output.append(',');
output.append(' ');
output.append(p.toString());
}
output.append(CRLF);
return output.toString();
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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 javolution.text.TextBuilder;
/**
* This class ...
* @version $Revision: 1.1.4.1 $ $Date: 2005/02/06 16:14:46 $
*/
public class ChatLogFormatter extends Formatter
{
private static final String CRLF = "\r\n";
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final Object[] params = record.getParameters();
final TextBuilder output = new TextBuilder();
output.append('[');
output.append(dateFmt.format(new Date(record.getMillis())));
output.append(']');
output.append(' ');
if (params != null)
{
for (final Object p : params)
{
output.append(p);
output.append(' ');
}
}
output.append(record.getMessage());
output.append(CRLF);
return output.toString();
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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.io.PrintWriter;
import java.io.StringWriter;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import javolution.text.TextBuilder;
/**
* This class ...
* @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:08 $
*/
public class ConsoleLogFormatter extends Formatter
{
/*
* (non-Javadoc)
* @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
*/
private static final String CRLF = "\r\n";
@Override
public String format(LogRecord record)
{
final TextBuilder output = new TextBuilder();
output.append(record.getMessage());
output.append(CRLF);
if (record.getThrown() != null)
{
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw))
{
record.getThrown().printStackTrace(pw);
output.append(sw.toString());
output.append(CRLF);
}
catch (final Exception ex)
{
}
}
return output.toString();
}
}

View File

@@ -0,0 +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 javolution.text.TextBuilder;
/**
* This class ...
* @version $Revision: 1.1.4.1 $ $Date: 2005/03/27 15:30:08 $
*/
public class FileLogFormatter extends Formatter
{
/*
* (non-Javadoc)
* @see java.util.logging.Formatter#format(java.util.logging.LogRecord)
*/
private static final String CRLF = "\r\n";
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)
{
final TextBuilder output = new TextBuilder();
return output.append(dateFmt.format(new Date(record.getMillis()))).append(TAB).append(record.getLevel().getName()).append(TAB).append(record.getThreadID()).append(TAB).append(record.getLoggerName()).append(TAB).append(record.getMessage()).append(CRLF).toString();
}
}

View File

@@ -0,0 +1,29 @@
/*
* 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.Formatter;
import java.util.logging.LogRecord;
public class GMAuditFormatter extends Formatter
{
@Override
public String format(LogRecord record)
{
return record.getMessage() + "\r\n";
}
}

View File

@@ -0,0 +1,74 @@
/*
* 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.gameserver.model.L2ItemInstance;
import javolution.text.TextBuilder;
/**
* @author Advi
*/
public class ItemLogFormatter extends Formatter
{
private static final String CRLF = "\r\n";
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
@Override
public String format(LogRecord record)
{
final TextBuilder output = new TextBuilder();
output.append('[');
output.append(dateFmt.format(new Date(record.getMillis())));
output.append(']');
output.append(' ');
output.append(record.getMessage());
for (final Object p : record.getParameters())
{
if (p == null)
{
continue;
}
output.append(',');
output.append(' ');
if (p instanceof L2ItemInstance)
{
final L2ItemInstance item = (L2ItemInstance) p;
output.append("item " + item.getObjectId() + ":");
if (item.getEnchantLevel() > 0)
{
output.append("+" + item.getEnchantLevel() + " ");
}
output.append(item.getItem().getName());
output.append("(" + item.getCount() + ")");
}
else
{
output.append(p.toString()/* + ":" + ((L2Object)p).getObjectId() */);
}
}
output.append(CRLF);
return output.toString();
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.handler;
import java.io.IOException;
import java.util.logging.FileHandler;
/**
* @author zabbix Lets drink to code!
*/
public class AuditLogHandler extends FileHandler
{
public AuditLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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.handler;
import java.io.IOException;
import java.util.logging.FileHandler;
public class ChatLogHandler extends FileHandler
{
public ChatLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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.handler;
import java.io.IOException;
import java.util.logging.FileHandler;
public class ErrorLogHandler extends FileHandler
{
public ErrorLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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.handler;
import java.io.IOException;
import java.util.logging.FileHandler;
public class GMAuditLogHandler extends FileHandler
{
public GMAuditLogHandler() throws IOException, SecurityException
{
super();
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.handler;
import java.io.IOException;
import java.util.logging.FileHandler;
/**
* @author Advi
*/
public class ItemLogHandler extends FileHandler
{
public ItemLogHandler() throws IOException, SecurityException
{
super();
}
}