actual freya branch
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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 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.serverpackets.CreatureSay;
|
||||
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatAll implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
private static Logger _log = Logger.getLogger(ChatAll.class.getName());
|
||||
|
||||
/**
|
||||
* Handle chat type 'all'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
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().getVoicedCommandHandler(command);
|
||||
}
|
||||
else
|
||||
{
|
||||
command = text.substring(1);
|
||||
if (Config.DEBUG)
|
||||
_log.info("Command: " + command);
|
||||
vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(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)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
|
||||
|
||||
Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
|
||||
//synchronized (activeChar.getKnownList().getKnownPlayers())
|
||||
{
|
||||
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
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
public class ChatAlliance implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
9
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'alliance'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.getClan() != null)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getClan().broadcastToOnlineAllyMembers(cs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public class ChatBattlefield implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
20
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'battlefield'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (TerritoryWarManager.getInstance().isTWChannelOpen() && activeChar.getSiegeSide() > 0)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
|
||||
for (L2PcInstance player : pls)
|
||||
if (player.getSiegeSide() == activeChar.getSiegeSide())
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatClan implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
4
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'clan'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.getClan() != null)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getClan().broadcastCSToOnlineMembers(cs, activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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.serverpackets.CreatureSay;
|
||||
|
||||
|
||||
/**
|
||||
* Hero chat handler.
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatHeroVoice implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
17
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'hero voice'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isHero() || activeChar.isGM())
|
||||
{
|
||||
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);
|
||||
|
||||
Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
|
||||
for (L2PcInstance player : pls)
|
||||
{
|
||||
if (player != null && !BlockList.isBlocked(player, activeChar))
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatParty implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
3
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().broadcastCSToPartyMembers(cs, activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
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.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* @author Gnacik
|
||||
*/
|
||||
public class ChatPartyMatchRoom implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
14
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'partymatchroom'
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInPartyMatchRoom())
|
||||
{
|
||||
PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
|
||||
if(_room != null)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
for(L2PcInstance _member : _room.getPartyMembers())
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the chat types registered to this handler
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new ChatPartyMatchRoom();
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPartyRoomAll implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
16
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party room all'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().getCommandChannel().broadcastCSToChannelMembers(cs, activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPartyRoomCommander implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
15
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party room commander'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getChannelLeader().equals(activeChar))
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().getCommandChannel().broadcastCSToChannelMembers(cs, activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
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.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPetition implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
6,
|
||||
7
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'petition player'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (!PetitionManager.getInstance().isPlayerInConsultation(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_NOT_IN_PETITION_CHAT));
|
||||
return;
|
||||
}
|
||||
|
||||
PetitionManager.getInstance().sendActivePetitionMessage(activeChar, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.MapRegionTable;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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.serverpackets.CreatureSay;
|
||||
|
||||
|
||||
/**
|
||||
* Shout chat handler.
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatShout implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
1
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'shout'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
|
||||
Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
|
||||
|
||||
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
|
||||
{
|
||||
int region = MapRegionTable.getInstance().getMapRegion(activeChar.getX(), activeChar.getY());
|
||||
for (L2PcInstance player : pls)
|
||||
{
|
||||
if (region == MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()) && !BlockList.isBlocked(player, activeChar) && player.getInstanceId() == activeChar.getInstanceId())
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("global"))
|
||||
{
|
||||
if (!activeChar.isGM() && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
|
||||
{
|
||||
activeChar.sendMessage("Do not spam shout channel.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2PcInstance player : pls)
|
||||
{
|
||||
if (!BlockList.isBlocked(player, activeChar))
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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 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.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Tell chat handler.
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatTell implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
2
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'tell'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isChatBanned())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHATTING_PROHIBITED));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.JAIL_DISABLE_CHAT && activeChar.isInJail() && !activeChar.isGM())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHATTING_PROHIBITED));
|
||||
return;
|
||||
}
|
||||
|
||||
// Return if no target is set
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
L2PcInstance receiver = null;
|
||||
|
||||
receiver = L2World.getInstance().getPlayer(target);
|
||||
|
||||
if (receiver != null && !receiver.isSilenceMode())
|
||||
{
|
||||
if (Config.JAIL_DISABLE_CHAT && receiver.isInJail() && !activeChar.isGM())
|
||||
{
|
||||
activeChar.sendMessage("Player is in jail.");
|
||||
return;
|
||||
}
|
||||
if (receiver.isChatBanned())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_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))
|
||||
{
|
||||
receiver.sendPacket(cs);
|
||||
activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), type, "->" + receiver.getName(), text));
|
||||
}
|
||||
else
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_PERSON_IS_IN_MESSAGE_REFUSAL_MODE));
|
||||
}
|
||||
else
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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 handlers.chathandlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.MapRegionTable;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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.serverpackets.CreatureSay;
|
||||
|
||||
|
||||
/**
|
||||
* Trade chat handler.
|
||||
*
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatTrade implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
8
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'trade'
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#handleChat(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
||||
*/
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
|
||||
Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
|
||||
|
||||
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
|
||||
{
|
||||
int region = MapRegionTable.getInstance().getMapRegion(activeChar.getX(), activeChar.getY());
|
||||
for (L2PcInstance player : pls)
|
||||
{
|
||||
if (region == MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()) && !BlockList.isBlocked(player, activeChar) && player.getInstanceId() == activeChar.getInstanceId())
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("global"))
|
||||
{
|
||||
if (!activeChar.isGM() && !activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"))
|
||||
{
|
||||
activeChar.sendMessage("Do not spam trade channel.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2PcInstance player : pls)
|
||||
{
|
||||
if (!BlockList.isBlocked(player, activeChar))
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
* @see com.l2jserver.gameserver.handler.IChatHandler#getChatTypeList()
|
||||
*/
|
||||
public int[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user