Code: Select all
### Eclipse Workspace Patch 1.0#P datapack_developmentIndex: data/scripts/handlers/voicedcommandhandlers/CTFCmd.java===================================================================--- data/scripts/handlers/voicedcommandhandlers/CTFCmd.java (revision 0)+++ data/scripts/handlers/voicedcommandhandlers/CTFCmd.java (revision 0)@@ -0,0 +1,167 @@+/*+ * 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.voicedcommandhandlers;++import com.l2jserver.gameserver.handler.IVoicedCommandHandler;+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;+import com.l2jserver.gameserver.model.entity.CTF;+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;++public class CTFCmd implements IVoicedCommandHandler+{+ private static final String[] VOICED_COMMANDS = { "joinctf", "leavectf", "infoctf" };++ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)+ {+ if (command.startsWith("joinctf"))+ {+ JoinCTF(activeChar);+ }+ else if(command.startsWith("leavectf"))+ {+ LeaveCTF(activeChar);+ }++ else if(command.startsWith("infoctf"))+ {+ SendCTFinfo(activeChar);+ }++ return true;+ }++ public String[] getVoicedCommandList()+ {+ return VOICED_COMMANDS;+ }++ public boolean JoinCTF (L2PcInstance activeChar)+ {+ if ( activeChar == null)+ {+ return false;+ }+ NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );++ + if (!CTF._joining) //check if ctf event is running or/and joining is avaliable+ {+ npcHtmlMessage.setHtml("<html><body>You can not register now: CTF event joining is not avaliable.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (activeChar._inEventCTF) //check if player is already registered in ctf event+ {+ npcHtmlMessage.setHtml("<html><body>You are participating this event already.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if ( activeChar.isCursedWeaponEquipped()) //check if player is holding a cursed weapon+ {+ npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event holding a Cursed Weapon.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if ( activeChar.isInOlympiadMode()) //check if player is in olympiads - dunno why, but sometimes simple doesnt work this check =/+ {+ npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event while in Olympiad.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (activeChar.isInJail()) //check if player is in jail+ {+ npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event while in Jail.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (activeChar.getLevel() < CTF._minlvl)+ {+ npcHtmlMessage.setHtml("<html><body>Your level is too low to participate at this Event.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (activeChar.getKarma() > 0) //check player karma - dunno why karma players cant participate - looks useless since player can register while not with karma and do pk after that ;)+ {+ npcHtmlMessage.setHtml("<html><body>You are not allowed to participate to the Event with Karma.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (CTF._maxPlayers == CTF._playersShuffle.size()) //check player karma - dunno why karma players cant participate - looks useless since player can register while not with karma and do pk after that ;)+ {+ npcHtmlMessage.setHtml("<html><body>Sorry,CTF Event is full.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else //send dialog confirmation to player that he is registered in ctf event and add him+ {+ npcHtmlMessage.setHtml("<html><body>Your participation in the CTF event has been aproved.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ CTF.addPlayer(activeChar,"");+ return true;+ }+ }++ public boolean LeaveCTF (L2PcInstance activeChar)+ {+ if ( activeChar == null)+ {+ return false;+ }+ + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );++ if (!CTF._joining) //check if CTF event is running or joining is avaliable+ {+ npcHtmlMessage.setHtml("<html><body>You can not unregister now cause there is no CTF event running.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else if (CTF._teleport || CTF._started) //check if ctf event has already teleported and started+ {+ npcHtmlMessage.setHtml("<html><body>You can not leave after CTF event has started.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ else //send dialog confirmation to player that he is unregistered from ctf event and remove him+ {+ npcHtmlMessage.setHtml("<html><body>Your participation in the CTF event has been removed.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ CTF.removePlayer(activeChar);+ return true;+ }+ }+ public boolean SendCTFinfo (L2PcInstance activeChar)+ {+ if ( activeChar == null)+ {+ return false;+ }+ NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage( 0 );++ + if (CTF._joining)+ {+ npcHtmlMessage.setHtml("<html><body>There are " + CTF._playersShuffle.size() + " players participating in this event.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return true;+ }+ else+ {+ npcHtmlMessage.setHtml("<html><body>There is no Event in progress.</body></html>");+ activeChar.sendPacket( npcHtmlMessage );+ return false;+ }+ }+}Index: data/scripts/handlers/MasterHandler.java===================================================================--- data/scripts/handlers/MasterHandler.java (revision 6813)+++ data/scripts/handlers/MasterHandler.java (working copy)@@ -50,6 +50,7 @@ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCache()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminChangeAccessLevel()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCreateItem());+ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCTFEngine()); // Add by CTF Event AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCursedWeapons()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminDelete()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminDisconnect());@@ -225,6 +226,9 @@ private static void loadVoicedHandlers() { VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new stats());+ // Add by CTF Event+ if (Config.CTF_ALLOW_VOICE_COMMAND)+ VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new CTFCmd()); if (Config.L2JMOD_ALLOW_WEDDING) VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding()); if (Config.BANKING_SYSTEM_ENABLED)Index: data/scripts/handlers/itemhandlers/ItemSkills.java===================================================================--- data/scripts/handlers/itemhandlers/ItemSkills.java (revision 6813)+++ data/scripts/handlers/itemhandlers/ItemSkills.java (working copy)@@ -48,6 +48,12 @@ activeChar = ((L2PetInstance) playable).getOwner(); else return;+ // Add by CTF Event+ if (activeChar._inEventCTF)+ {+ activeChar.sendMessage("You may not use an escape skill in a Event.");+ return;+ } if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));Index: data/scripts/handlers/admincommandhandlers/AdminCTFEngine.java===================================================================--- data/scripts/handlers/admincommandhandlers/AdminCTFEngine.java (revision 0)+++ data/scripts/handlers/admincommandhandlers/AdminCTFEngine.java (revision 0)@@ -0,0 +1,470 @@+/*+ * 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.admincommandhandlers;++/**+ *+ * @author: FBIagent / fixed by SqueezeD+ *+ */++import com.l2jserver.Config;+import com.l2jserver.gameserver.datatables.ItemTable;+import com.l2jserver.gameserver.handler.IAdminCommandHandler;+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;+import com.l2jserver.gameserver.model.entity.CTF;+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;+import com.l2jserver.gameserver.ThreadPoolManager;++import javolution.text.TextBuilder;++public class AdminCTFEngine implements IAdminCommandHandler+{+ private static final String[] ADMIN_COMMANDS =+ {+ "admin_ctf",+ "admin_ctf_name",+ "admin_ctf_desc",+ "admin_ctf_join_loc",+ "admin_ctf_edit",+ "admin_ctf_control",+ "admin_ctf_minlvl",+ "admin_ctf_maxlvl",+ "admin_ctf_tele_npc",+ "admin_ctf_tele_team",+ "admin_ctf_tele_flag",+ "admin_ctf_npc",+ "admin_ctf_npc_pos",+ "admin_ctf_reward",+ "admin_ctf_reward_amount",+ "admin_ctf_team_add",+ "admin_ctf_team_remove",+ "admin_ctf_team_pos",+ "admin_ctf_team_color",+ "admin_ctf_team_flag",+ "admin_ctf_join",+ "admin_ctf_teleport",+ "admin_ctf_start",+ "admin_ctf_abort",+ "admin_ctf_finish",+ "admin_ctf_sit",+ "admin_ctf_dump",+ "admin_ctf_save",+ "admin_ctf_load",+ "admin_ctf_jointime",+ "admin_ctf_eventtime",+ "admin_ctf_autoevent",+ "admin_ctf_minplayers",+ "admin_ctf_maxplayers" };+++ public boolean useAdminCommand(String command, L2PcInstance activeChar)+ {+ try+ {+ if (command.equals("admin_ctf"))+ showMainPage(activeChar);+ else if (command.startsWith("admin_ctf_name "))+ {+ CTF._eventName = command.substring(15);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_desc "))+ {+ CTF._eventDesc = command.substring(15);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_minlvl "))+ {+ if (!CTF.checkMinLevel(Integer.valueOf(command.substring(17))))+ return false;+ CTF._minlvl = Integer.valueOf(command.substring(17));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_team_flag "))+ {+ String[] params;++ params = command.split(" ");++ if (params.length != 2)+ {+ activeChar.sendMessage("Wrong usge: //ctf_team_flag <teamName>");+ return false;+ }++ CTF.setTeamFlag(params[1], activeChar);+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_edit"))+ {+ showEditPage(activeChar);+ }+ else if (command.equals("admin_ctf_control"))+ {+ showControlPage(activeChar);+ }+ else if (command.equals("admin_ctf_tele_npc"))+ {+ activeChar.teleToLocation(CTF._npcX, CTF._npcY, CTF._npcZ);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_tele_team "))+ {+ for (String t : CTF._teams)+ if (t.equals(command.substring(20)))+ {+ int index = CTF._teams.indexOf(t);+ activeChar.teleToLocation(CTF._teamsX.get(index), CTF._teamsY.get(index), CTF._teamsZ.get(index));+ }+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_tele_flag "))+ {+ for (String t : CTF._teams)+ if (t.equals(command.substring(20)))+ {+ int index = CTF._teams.indexOf(t);+ activeChar.teleToLocation(CTF._flagsX.get(index), CTF._flagsY.get(index), CTF._flagsZ.get(index));+ }+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_maxlvl "))+ {+ if (!CTF.checkMaxLevel(Integer.valueOf(command.substring(17))))+ return false;+ CTF._maxlvl = Integer.valueOf(command.substring(17));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_minplayers "))+ {+ CTF._minPlayers = Integer.valueOf(command.substring(21));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_maxplayers "))+ {+ CTF._maxPlayers = Integer.valueOf(command.substring(21));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_join_loc "))+ {+ CTF._joiningLocationName = command.substring(19);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_npc "))+ {+ CTF._npcId = Integer.valueOf(command.substring(14));+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_npc_pos"))+ {+ CTF.setNpcPos(activeChar);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_reward "))+ {+ CTF._rewardId = Integer.valueOf(command.substring(17));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_reward_amount "))+ {+ CTF._rewardAmount = Integer.valueOf(command.substring(24));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_jointime "))+ {+ CTF._joinTime = Integer.valueOf(command.substring(19));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_eventtime "))+ {+ CTF._eventTime = Integer.valueOf(command.substring(20));+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_team_add "))+ {+ String teamName = command.substring(19);++ CTF.addTeam(teamName);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_team_remove "))+ {+ String teamName = command.substring(22);++ CTF.removeTeam(teamName);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_team_pos "))+ {+ String teamName = command.substring(19);++ CTF.setTeamPos(teamName, activeChar);+ showMainPage(activeChar);+ }+ else if (command.startsWith("admin_ctf_team_color "))+ {+ String[] params;++ params = command.split(" ");++ if (params.length != 3)+ {+ activeChar.sendMessage("Wrong usege: //ctf_team_color <colorHex> <teamName>");+ return false;+ }++ // name/title color in client is BGR, not RGB+ CTF.setTeamColor(command.substring(params[0].length() + params[1].length() + 2), Integer.decode("0x" + (params[1])));+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_join"))+ {+ CTF.startJoin(activeChar);+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_teleport"))+ {+ CTF.teleportStart();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_start"))+ {+ CTF.startEvent(activeChar);+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_abort"))+ {+ activeChar.sendMessage("Aborting event");+ CTF.abortEvent();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_finish"))+ {+ CTF.finishEvent();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_sit"))+ {+ CTF.sit();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_load"))+ {+ CTF.loadData();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_autoevent"))+ {+ if (CTF._joinTime > 0 && CTF._eventTime > 0)+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()+ {+ public void run()+ {+ CTF.autoEvent();+ }+ }, 0);+ else+ activeChar.sendMessage("Wrong usege: join time or event time invallid.");+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_save"))+ {+ CTF.saveData();+ showMainPage(activeChar);+ }+ else if (command.equals("admin_ctf_dump"))+ CTF.dumpData();++ return true;+ }+ catch (Exception e)+ {+ activeChar.sendMessage("The command was not used correctly");+ return false;+ }+ }++ public String[] getAdminCommandList()+ {+ return ADMIN_COMMANDS;+ }++ public void showEditPage(L2PcInstance activeChar)+ {+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);+ TextBuilder replyMSG = new TextBuilder();++ replyMSG.append("<html><body>");+ replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine by Darki699]</font></center><br><br><br>");+ replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");+ replyMSG.append("<table border=\"0\"><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Name\" action=\"bypass -h admin_ctf_name $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Description\" action=\"bypass -h admin_ctf_desc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Join Location\" action=\"bypass -h admin_ctf_join_loc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Max lvl\" action=\"bypass -h admin_ctf_maxlvl $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Min lvl\" action=\"bypass -h admin_ctf_minlvl $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Max players\" action=\"bypass -h admin_ctf_maxplayers $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Min players\" action=\"bypass -h admin_ctf_minplayers $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_ctf_npc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_ctf_npc_pos\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Reward\" action=\"bypass -h admin_ctf_reward $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Reward Amount\" action=\"bypass -h admin_ctf_reward_amount $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Join Time\" action=\"bypass -h admin_ctf_jointime $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Event Time\" action=\"bypass -h admin_ctf_eventtime $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Team Add\" action=\"bypass -h admin_ctf_team_add $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Team Color\" action=\"bypass -h admin_ctf_team_color $input1 $input2\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Team Pos\" action=\"bypass -h admin_ctf_team_pos $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Team Flag\" action=\"bypass -h admin_ctf_team_flag $input1 $input2\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Team Remove\" action=\"bypass -h admin_ctf_team_remove $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br>");+ replyMSG.append("<br><center><button value=\"Back\" action=\"bypass -h admin_ctf\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>");++ adminReply.setHtml(replyMSG.toString());+ activeChar.sendPacket(adminReply);+ }++ public void showControlPage(L2PcInstance activeChar)+ {+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);+ TextBuilder replyMSG = new TextBuilder();++ replyMSG.append("<html><body>");+ replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine by Darki699]</font></center><br><br><br>");+ replyMSG.append("<table border=\"0\"><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Join\" action=\"bypass -h admin_ctf_join\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Teleport\" action=\"bypass -h admin_ctf_teleport\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Start\" action=\"bypass -h admin_ctf_start\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Abort\" action=\"bypass -h admin_ctf_abort\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Finish\" action=\"bypass -h admin_ctf_finish\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Sit Force\" action=\"bypass -h admin_ctf_sit\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Dump\" action=\"bypass -h admin_ctf_dump\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br><br><table><tr>");+ replyMSG.append("<td width=\"100\"><button value=\"Save\" action=\"bypass -h admin_ctf_save\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_ctf_load\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Auto Event\" action=\"bypass -h admin_ctf_autoevent\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br>");+ replyMSG.append("<br><center><button value=\"Back\" action=\"bypass -h admin_ctf\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>");++ adminReply.setHtml(replyMSG.toString());+ activeChar.sendPacket(adminReply);+ }++ public void showMainPage(L2PcInstance activeChar)+ {+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);+ TextBuilder replyMSG = new TextBuilder();+ replyMSG.append("<html><body>");++ replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine by Darki699]</font></center><br><br><br>");++ replyMSG.append("<table><tr>");+ if (!CTF._joining && !CTF._started && !CTF._teleport)+ replyMSG.append("<td width=\"100\"><button value=\"Edit\" action=\"bypass -h admin_ctf_edit\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("<td width=\"100\"><button value=\"Control\" action=\"bypass -h admin_ctf_control\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");+ replyMSG.append("</tr></table><br>");+ replyMSG.append("<br><font color=\"LEVEL\">Current event...</font><br>");+ replyMSG.append(" ... name: <font color=\"00FF00\">" + CTF._eventName + "</font><br>");+ replyMSG.append(" ... description: <font color=\"00FF00\">" + CTF._eventDesc + "</font><br>");+ replyMSG.append(" ... joining location name: <font color=\"00FF00\">" + CTF._joiningLocationName + "</font><br>");+ replyMSG.append(" ... joining NPC ID: <font color=\"00FF00\">" + CTF._npcId + " on pos " + CTF._npcX + "," + CTF._npcY + "," + CTF._npcZ + "</font><br>");+ replyMSG.append(" <button value=\"Tele->NPC\" action=\"bypass -h admin_ctf_tele_npc\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");+ replyMSG.append(" ... reward ID: <font color=\"00FF00\">" + CTF._rewardId + "</font><br>");+ if (ItemTable.getInstance().getTemplate(CTF._rewardId) != null)+ replyMSG.append(" ... reward Item: <font color=\"00FF00\">" + ItemTable.getInstance().getTemplate(CTF._rewardId).getName() + "</font><br>");+ else+ replyMSG.append(" ... reward Item: <font color=\"00FF00\">(unknown)</font><br>");+ replyMSG.append(" ... reward Amount: <font color=\"00FF00\">" + CTF._rewardAmount + "</font><br>");+ replyMSG.append(" ... Min lvl: <font color=\"00FF00\">" + CTF._minlvl + "</font><br>");+ replyMSG.append(" ... Max lvl: <font color=\"00FF00\">" + CTF._maxlvl + "</font><br><br>");+ replyMSG.append(" ... Min Players: <font color=\"00FF00\">" + CTF._minPlayers + "</font><br>");+ replyMSG.append(" ... Max Players: <font color=\"00FF00\">" + CTF._maxPlayers + "</font><br>");+ replyMSG.append(" ... Joining Time: <font color=\"00FF00\">" + CTF._joinTime + "</font><br>");+ replyMSG.append(" ... Event Time: <font color=\"00FF00\">" + CTF._eventTime + "</font><br>");+ if (CTF._teams != null && !CTF._teams.isEmpty())+ replyMSG.append("<font color=\"LEVEL\">Current teams:</font><br>");+ replyMSG.append("<center><table border=\"0\">");++ for (String team : CTF._teams)+ {+ replyMSG.append("<tr><td width=\"100\">Name: <font color=\"FF0000\">" + team + "</font>");++ if (Config.CTF_EVEN_TEAMS.equals("NO") || Config.CTF_EVEN_TEAMS.equals("BALANCE"))+ replyMSG.append(" (" + CTF.teamPlayersCount(team) + " joined)");+ else if (Config.CTF_EVEN_TEAMS.equals("SHUFFLE"))+ {+ if (CTF._teleport || CTF._started)+ replyMSG.append(" (" + CTF.teamPlayersCount(team) + " in)");+ }+ replyMSG.append("</td></tr><tr><td>");++ String c = Integer.toHexString(CTF._teamColors.get(CTF._teams.indexOf(team)));+ while (c.length() < 6)+ c = "0" + c;+ replyMSG.append("Color: <font color=\"00FF00\">0x" + c.toUpperCase() + "</font><font color=\"" + c + "\"> =) </font>");++ replyMSG.append("</td></tr><tr><td>");+ replyMSG.append("<button value=\"Tele->Team\" action=\"bypass -h admin_ctf_tele_team " + team + "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");+ replyMSG.append("</td></tr><tr><td>");+ replyMSG.append(CTF._teamsX.get(CTF._teams.indexOf(team)) + ", " + CTF._teamsY.get(CTF._teams.indexOf(team)) + ", " + CTF._teamsZ.get(CTF._teams.indexOf(team)));+ replyMSG.append("</td></tr><tr><td>");+ replyMSG.append("Flag Id: <font color=\"00FF00\">" + CTF._flagIds.get(CTF._teams.indexOf(team)) + "</font>");+ replyMSG.append("</td></tr><tr><td>");+ replyMSG.append("<button value=\"Tele->Flag\" action=\"bypass -h admin_ctf_tele_flag " + team + "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");+ replyMSG.append("</td></tr><tr><td>");+ replyMSG.append(CTF._flagsX.get(CTF._teams.indexOf(team)) + ", " + CTF._flagsY.get(CTF._teams.indexOf(team)) + ", " + CTF._flagsZ.get(CTF._teams.indexOf(team)) + "</td></tr>");+ if (!CTF._joining && !CTF._started && !CTF._teleport)+ replyMSG.append("<tr><td width=\"60\"><button value=\"Remove\" action=\"bypass -h admin_ctf_team_remove " + team + "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr></tr>");+ }++ replyMSG.append("</table></center>");++ if (!CTF._joining && !CTF._started && !CTF._teleport)+ {+ if (CTF.startJoinOk())+ {+ replyMSG.append("<br>");+ replyMSG.append("Event is now set up. Press JOIN to start the registration.<br>");+ replyMSG.append("<button value=\"Join\" action=\"bypass -h admin_ctf_join\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");+ replyMSG.append("<br>");+ }+ else+ {+ replyMSG.append("<br>");+ replyMSG.append("Event is NOT set up. Press <font color=\"LEVEL\">EDIT</font> to create a new event, or <font color=\"LEVEL\">CONTROL</font> to load an existing event.<br>");+ replyMSG.append("<br>");+ }+ }+ else if (Config.CTF_EVEN_TEAMS.equals("SHUFFLE") && !CTF._started)+ {+ replyMSG.append("<br>");+ replyMSG.append(CTF._playersShuffle.size() + " players participating. Waiting to shuffle in teams(done on teleport)!");+ replyMSG.append("<br><br>");+ }++ replyMSG.append("</body></html>");+ adminReply.setHtml(replyMSG.toString());+ activeChar.sendPacket(adminReply);+ }+}\ No newline at end of fileIndex: data/scripts/handlers/usercommandhandlers/Escape.java===================================================================--- data/scripts/handlers/usercommandhandlers/Escape.java (revision 6813)+++ data/scripts/handlers/usercommandhandlers/Escape.java (working copy)@@ -66,6 +66,14 @@ activeChar.sendMessage("You may not use an escape command in a festival."); return false; }++ // Add by CTF Event+ if (activeChar.isInFunEvent())+ {+ activeChar.sendMessage("You may not escape from an Event.");+ return false;+ }+ // Check to see if player is in jail if (activeChar.isInJail())Index: data/scripts/handlers/itemhandlers/SummonItems.java===================================================================--- data/scripts/handlers/itemhandlers/SummonItems.java (revision 6813)+++ data/scripts/handlers/itemhandlers/SummonItems.java (working copy)@@ -23,6 +23,7 @@ import java.util.Collection; import java.util.logging.Level; +import com.l2jserver.Config; // Add by CTF Event import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.NpcTable; import com.l2jserver.gameserver.datatables.SummonItemsData;@@ -38,8 +39,10 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PetInstance; import com.l2jserver.gameserver.model.actor.instance.L2XmassTreeInstance;+import com.l2jserver.gameserver.model.entity.CTF; import com.l2jserver.gameserver.model.entity.TvTEvent; import com.l2jserver.gameserver.network.SystemMessageId;+import com.l2jserver.gameserver.network.serverpackets.ActionFailed; // Add by CTF Event import com.l2jserver.gameserver.network.serverpackets.MagicSkillLaunched; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; import com.l2jserver.gameserver.network.serverpackets.PetItemList;@@ -76,6 +79,13 @@ if (activeChar.inObserverMode()) return; + // Add by CTF Event+ if (activeChar._inEventCTF && CTF._started && !Config.CTF_ALLOW_SUMMON)+ {+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);+ return;+ }+ if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));Index: data/scripts/handlers/skillhandlers/SummonFriend.java===================================================================--- data/scripts/handlers/skillhandlers/SummonFriend.java (revision 6813)+++ data/scripts/handlers/skillhandlers/SummonFriend.java (working copy)@@ -52,7 +52,7 @@ if (!L2PcInstance.checkSummonerStatus(activePlayer)) return;- + try { for (L2Character target: (L2Character[]) targets)@@ -76,8 +76,15 @@ activePlayer.sendPacket(sm); continue; }- if (skill.getId() == 1403) //summon friend+ // Add by CTF Event+ if (activePlayer._inEventCTF || targetPlayer._inEventCTF) {+ activePlayer.sendMessage("You cannot summon your friend due to events restrictions.");+ targetPlayer.sendMessage("You cannot be summoned due to events restriction.");+ return;+ }+ else if (skill.getId() == 1403) //summon friend - Modified by CTF Event+ { // Send message ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId()); confirm.addCharName(activeChar);Index: data/scripts/handlers/itemhandlers/Potions.java===================================================================--- data/scripts/handlers/itemhandlers/Potions.java (revision 6813)+++ data/scripts/handlers/itemhandlers/Potions.java (working copy)@@ -26,6 +26,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PetInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.TimeStamp;+import com.l2jserver.gameserver.model.entity.CTF; import com.l2jserver.gameserver.model.entity.TvTEvent; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed;@@ -62,6 +63,13 @@ return; } + // Add by CTF Event+ if (activeChar._inEventCTF && CTF._started && !Config.CTF_ALLOW_POTIONS)+ {+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);+ return;+ }+ if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
except for the 'guessing' feature, don't really know about that, and doesnt sound to reliable