/*
* 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 .
*/
package com.l2jserver.gameserver.communitybbs.Manager;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javolution.util.FastList;
import javolution.util.FastMap;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GameServer;
import com.l2jserver.gameserver.datatables.ExperienceTable;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.StringUtil;
public class RegionBBSManager extends BaseBBSManager
{
private static Logger _logChat = Logger.getLogger("chat");
private RegionBBSManager()
{
}
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
if (command.equals("_bbsloc"))
{
showOldCommunity(activeChar, 1);
}
else if (command.startsWith("_bbsloc;page;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int page = 0;
try
{
page = Integer.parseInt(st.nextToken());
}
catch (NumberFormatException nfe)
{
}
showOldCommunity(activeChar, page);
}
else if (command.startsWith("_bbsloc;playerinfo;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
String name = st.nextToken();
showOldCommunityPI(activeChar, name);
}
else
{
if (Config.COMMUNITY_TYPE == 1)
{
showOldCommunity(activeChar, 1);
}
else
{
ShowBoard sb = new ShowBoard("
the command: " + command
+ " is not implemented yet
");
try
{
L2PcInstance receiver = L2World.getInstance().getPlayer(ar2);
if (receiver == null)
{
StringUtil.append(htmlCode, "Player not found!
");
separateAndSend(htmlCode.toString(), activeChar);
return;
}
if (Config.JAIL_DISABLE_CHAT && receiver.isInJail())
{
activeChar.sendMessage("Player is in jail.");
return;
}
if (receiver.isChatBanned())
{
activeChar.sendMessage("Player is chat banned.");
return;
}
if (activeChar.isInJail() && Config.JAIL_DISABLE_CHAT)
{
activeChar.sendMessage("You can not chat while in jail.");
return;
}
if (activeChar.isChatBanned())
{
activeChar.sendMessage("You are banned from using chat");
return;
}
if (Config.LOG_CHAT)
{
LogRecord record = new LogRecord(Level.INFO, ar3);
record.setLoggerName("chat");
record.setParameters(new Object[] { "TELL", "[" + activeChar.getName() + " to " + receiver.getName() + "]" });
_logChat.log(record);
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), Say2.TELL, activeChar.getName(), ar3);
if (!receiver.isSilenceMode() && !BlockList.isBlocked(receiver, activeChar) )
{
receiver.sendPacket(cs);
activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), Say2.TELL, "->" + receiver.getName(), ar3));
StringUtil.append(htmlCode, "Message Sent