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,130 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import java.util.Collection;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.handler.VoicedCommandHandler;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatAll implements IChatHandler
{
private static Logger _log = Logger.getLogger(ChatAll.class.getName());
private static final int[] COMMAND_IDS =
{
0
};
/**
* Handle chat type 'all'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String params, String text)
{
boolean vcd_used = false;
if (text.startsWith("."))
{
StringTokenizer st = new StringTokenizer(text);
IVoicedCommandHandler vch;
String command = "";
if (st.countTokens() > 1)
{
command = st.nextToken().substring(1);
params = text.substring(command.length() + 2);
vch = VoicedCommandHandler.getInstance().getHandler(command);
}
else
{
command = text.substring(1);
if (Config.DEBUG)
{
_log.info("Command: " + command);
}
vch = VoicedCommandHandler.getInstance().getHandler(command);
}
if (vch != null)
{
vch.useVoicedCommand(command, activeChar, params);
vcd_used = true;
}
else
{
if (Config.DEBUG)
{
_log.warning("No handler registered for bypass '" + command + "'");
}
vcd_used = false;
}
}
if (!vcd_used)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
/**
* Match the character "." literally (Exactly 1 time) Match any character that is NOT a . character. Between one and unlimited times as possible, giving back as needed (greedy)
*/
if (text.matches("\\.{1}[^\\.]+"))
{
activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX);
}
else
{
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
for (L2PcInstance player : plrs)
{
if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
{
player.sendPacket(cs);
}
}
activeChar.sendPacket(cs);
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
public class ChatAlliance implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
9
};
/**
* Handle chat type 'alliance'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.getClan() != null)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
activeChar.getClan().broadcastToOnlineAllyMembers(cs);
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatClan implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
4
};
/**
* Handle chat type 'clan'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.getClan() != null)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
activeChar.getClan().broadcastCSToOnlineMembers(cs, activeChar);
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* Hero chat handler.
* @author durgus
*/
public class ChatHeroVoice implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
17
};
/**
* Handle chat type 'hero voice'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isHero() || activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
{
activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds.");
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player != null) && !BlockList.isBlocked(player, activeChar))
{
player.sendPacket(cs);
}
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatParty implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
3
};
/**
* Handle chat type 'party'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
activeChar.getParty().broadcastCreatureSay(cs, activeChar);
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.PartyMatchRoom;
import com.l2jserver.gameserver.model.PartyMatchRoomList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author Gnacik
*/
public class ChatPartyMatchRoom implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
14
};
/**
* Handle chat type 'partymatchroom'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isInPartyMatchRoom())
{
PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
if (_room != null)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
for (L2PcInstance _member : _room.getPartyMembers())
{
_member.sendPacket(cs);
}
}
}
}
/**
* Returns the chat types registered to this handler
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
public static void main(String[] args)
{
new ChatPartyMatchRoom();
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatPartyRoomAll implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
16
};
/**
* Handle chat type 'party room all'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
activeChar.getParty().getCommandChannel().broadcastCreatureSay(cs, activeChar);
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatPartyRoomCommander implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
15
};
/**
* Handle chat type 'party room commander'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
activeChar.getParty().getCommandChannel().broadcastCreatureSay(cs, activeChar);
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.instancemanager.PetitionManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.util.Util;
/**
* A chat handler
* @author durgus
*/
public class ChatPetition implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
6,
7
};
/**
* Handle chat type 'petition player'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (!PetitionManager.getInstance().isPlayerInConsultation(activeChar))
{
activeChar.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_NOT_IN_A_PETITION_CHAT);
return;
}
PetitionManager.getInstance().sendActivePetitionMessage(activeChar, text);
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,93 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* Shout chat handler.
* @author durgus
*/
public class ChatShout implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
1
};
/**
* Handle chat type 'shout'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)))
{
int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId()))
{
player.sendPacket(cs);
}
}
}
else if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
{
activeChar.sendMessage("Do not spam shout channel.");
return;
}
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if (!BlockList.isBlocked(player, activeChar))
{
player.sendPacket(cs);
}
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* Tell chat handler.
* @author durgus
*/
public class ChatTell implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
2
};
/**
* Handle chat type 'tell'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
// Return if no target is set
if (target == null)
{
return;
}
L2PcInstance receiver = null;
receiver = L2World.getInstance().getPlayer(target);
if ((receiver != null) && !receiver.isSilenceMode(activeChar.getObjectId()))
{
if (Config.JAIL_DISABLE_CHAT && receiver.isJailed() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
{
activeChar.sendMessage("Player is in jail.");
return;
}
if (receiver.isChatBanned())
{
activeChar.sendPacket(SystemMessageId.THAT_PERSON_IS_IN_MESSAGE_REFUSAL_MODE);
return;
}
if ((receiver.getClient() == null) || receiver.getClient().isDetached())
{
activeChar.sendMessage("Player is in offline mode.");
return;
}
if (!BlockList.isBlocked(receiver, activeChar))
{
// Allow reciever to send PMs to this char, which is in silence mode.
if (Config.SILENCE_MODE_EXCLUDE && activeChar.isSilenceMode())
{
activeChar.addSilenceModeExcluded(receiver.getObjectId());
}
receiver.sendPacket(new CreatureSay(activeChar, receiver, activeChar.getName(), type, text));
activeChar.sendPacket(new CreatureSay(activeChar, receiver, "->" + receiver.getName(), type, text));
}
else
{
activeChar.sendPacket(SystemMessageId.THAT_PERSON_IS_IN_MESSAGE_REFUSAL_MODE);
}
}
else
{
activeChar.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}

View File

@@ -0,0 +1,93 @@
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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 DataPack 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 handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* Trade chat handler.
* @author durgus
*/
public class ChatTrade implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
8
};
/**
* Handle chat type 'trade'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)))
{
int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId()))
{
player.sendPacket(cs);
}
}
}
else if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("global"))
{
if (!activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS) && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
{
activeChar.sendMessage("Do not spam trade channel.");
return;
}
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if (!BlockList.isBlocked(player, activeChar))
{
player.sendPacket(cs);
}
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}