Created
February 19, 2015 08:18
-
-
Save u3games/86a58a0f1f3946e46bd8 to your computer and use it in GitHub Desktop.
Dev_Engine_Data_v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: dist/game/config/adminCommands.xml | |
=================================================================== | |
--- dist/game/config/adminCommands.xml (revision 18787) | |
+++ dist/game/config/adminCommands.xml (working copy) | |
@@ -569,6 +569,16 @@ | |
<admin command="admin_tvt_add" accessLevel="7" /> | |
<admin command="admin_tvt_remove" accessLevel="7" /> | |
<admin command="admin_tvt_advance" accessLevel="7" /> | |
+ | |
+ <!-- ADMIN CTF EVENT --> | |
+ <admin command="admin_ctf_add" accessLevel="7" /> | |
+ <admin command="admin_ctf_remove" accessLevel="7" /> | |
+ <admin command="admin_ctf_advance" accessLevel="7" /> | |
+ | |
+ <!-- ADMIN DM EVENT --> | |
+ <admin command="admin_dm_add" accessLevel="7" /> | |
+ <admin command="admin_dm_remove" accessLevel="7" /> | |
+ <admin command="admin_dm_advance" accessLevel="7" /> | |
<!-- ADMIN UNBLOCK IP --> | |
<admin command="admin_unblockip" accessLevel="7" /> | |
Index: dist/game/data/html/admin/help/l2jmod/ctf.htm | |
=================================================================== | |
--- dist/game/data/html/admin/help/l2jmod/ctf.htm (revision 0) | |
+++ dist/game/data/html/admin/help/l2jmod/ctf.htm (working copy) | |
@@ -0,0 +1,23 @@ | |
+<html><title>Mods Help</title><body> | |
+<table width=260><tr> | |
+<td width=40><button value="Main" action="bypass -h admin_admin" width=40 height=15 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td width=180><center>Mod Help Page</center></td> | |
+<td width=40><button value="Back" action="bypass -h admin_admin5" width=40 height=15 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+</tr></table> | |
+<font color="LEVEL"><table width=260><tr> | |
+<td width 90>GM commands page:</td><td><a action="bypass -h admin_html admhelp.htm">Index</a></td><td><a action="bypass -h admin_html help/gmcommands.htm">1</a></td><td><a action="bypass -h admin_html help/gmcommands2.htm">2</a></td><td><a action="bypass -h admin_html help/gmcommands3.htm">3</a></td> | |
+</tr></table></font> | |
+<br> | |
+<font color="FF9933">These are the available settings for this mod.</font><br> | |
+(When a parameter is required, it must be written in the quickbox without leading nor trailing spaces)<br1> | |
+Mandatory parameters will appear <font color="FF0000"><ike this></font><br1> | |
+Optional parameters will appear <font color="00FF00">[like that]</font><br> | |
+<!-- Mod writers should change from here --> | |
+<font color="LEVEL">Enable</font> - Enable this mod<br> | |
+<font color="LEVEL">Interval</font> <font color="FF0000"><minutes></font> - Time between events.<br> | |
+<font color="LEVEL">PartTime</font> <font color="FF0000"><minutes></font> - Time allowed for application.<br> | |
+<font color="LEVEL">RunnTime</font> <font color="FF0000"><minutes></font> - Event duration<br> | |
+<br> | |
+<font color="LEVEL">Disable</font> - Disable this mod.<br> | |
+<font color="LEVEL">EventNpc</font> <font color="FF0000"><integer></font> - NpcId to be used as event manager. | |
+</body></html> | |
\ No newline at end of file | |
Index: dist/game/data/html/admin/mods_menu.htm | |
=================================================================== | |
--- dist/game/data/html/admin/mods_menu.htm (revision 18787) | |
+++ dist/game/data/html/admin/mods_menu.htm (working copy) | |
@@ -72,5 +72,34 @@ | |
</tr> | |
</table> | |
<br> | |
+<font color="LEVEL">L2J CTF EVENT MOD | |
+<a action="bypass -h admin_html help/l2jmod/ctf.htm">Help</a></font> | |
+<table width=240 border=0 bgcolor="666666"> | |
+<tr> | |
+<td><button value="Enable" action="bypass -h admin_set_mod CTFEventEnabled=true" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="Interval" action="bypass -h admin_set_mod CTFEventInterval=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="PartTime" action="bypass -h admin_set_mod CTFEventParticipationTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="RunnTime" action="bypass -h admin_set_mod CTFEventRunningTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+</tr> | |
+<tr> | |
+<td><button value="Disable" action="bypass -h admin_set_mod CTFEventEnabled=false" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="EventNpc" action="bypass -h admin_set_mod CTFEventParticipationNpcId=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+</tr> | |
+</table> | |
+<br> | |
+<font color="LEVEL">L2J DM EVENT MOD | |
+<a action="bypass -h admin_html help/l2jmod/dm.htm">Help</a></font> | |
+<table width=240 border=0 bgcolor="666666"> | |
+<tr> | |
+<td><button value="Enable" action="bypass -h admin_set_mod DMEventEnabled=true" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="Interval" action="bypass -h admin_set_mod DMEventInterval=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="PartTime" action="bypass -h admin_set_mod DMEventParticipationTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="RunnTime" action="bypass -h admin_set_mod DMEventRunningTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+</tr> | |
+<tr> | |
+<td><button value="Disable" action="bypass -h admin_set_mod DMEventEnabled=false" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+<td><button value="EventNpc" action="bypass -h admin_set_mod DMEventParticipationNpcId=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td> | |
+</tr> | |
+</table> | |
</center> | |
</body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts.cfg | |
=================================================================== | |
--- dist/game/data/scripts.cfg (revision 18787) | |
+++ dist/game/data/scripts.cfg (working copy) | |
@@ -223,6 +223,8 @@ | |
custom/events/Elpies/Elpies.java | |
custom/events/Rabbits/Rabbits.java | |
custom/events/Race/Race.java | |
+custom/events/CTF/CTFFlag/CTFFlag.java | |
+custom/events/CTF/CTFManager/CTFManager.java | |
custom/events/TvT/TvTManager/TvTManager.java | |
custom/events/Wedding/Wedding.java | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (working copy) | |
@@ -0,0 +1,130 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFFlag; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.datatables.ItemTable; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.itemcontainer.Inventory; | |
+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; | |
+ | |
+/** | |
+ * CtF Flag AI. | |
+ * @author Pandragon | |
+ */ | |
+public final class CTFFlag extends AbstractNpcAI | |
+{ | |
+ private static final int[] FLAGS = | |
+ { | |
+ 80001, | |
+ 80002 | |
+ }; | |
+ | |
+ public CTFFlag() | |
+ { | |
+ super(CTFFlag.class.getSimpleName(), "custom/events/CtF"); | |
+ addFirstTalkId(FLAGS); | |
+ addTalkId(FLAGS); | |
+ addStartNpc(FLAGS); | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ final String team = CTFEvent.getParticipantTeam(player.getObjectId()).getName(); | |
+ final String enemyteam = CTFEvent.getParticipantEnemyTeam(player.getObjectId()).getName(); | |
+ if (npc.getTitle() == team) | |
+ // player talking to friendly flag | |
+ { | |
+ // team flag is missing | |
+ if (CTFEvent.getEnemyCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // player has returned with enemy flag | |
+ else if (player == CTFEvent.getTeamCarrier(player)) | |
+ { | |
+ if (Config.CTF_EVENT_CAPTURE_SKILL > 0) | |
+ { | |
+ player.broadcastPacket(new MagicSkillUse(player, npc, Config.CTF_EVENT_CAPTURE_SKILL, 1, 1, 1)); | |
+ } | |
+ CTFEvent.removeFlagCarrier(player); | |
+ CTFEvent.getParticipantTeam(player.getObjectId()).increasePoints(); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has captured the " + enemyteam + " flag!", 7); | |
+ CTFEvent.broadcastScoreMessage(); | |
+ } | |
+ // go get the flag | |
+ else | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ } | |
+ else | |
+ // player talking to enemy flag | |
+ { | |
+ // player has flag | |
+ if (CTFEvent.playerIsCarrier(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // enemy flag is missing | |
+ else if (CTFEvent.getTeamCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%player%", CTFEvent.getTeamCarrier(player).getName()); | |
+ } | |
+ // take flag | |
+ else | |
+ { | |
+ CTFEvent.setCarrierUnequippedWeapons(player, player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND), player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND)); | |
+ player.getInventory().equipItem(ItemTable.getInstance().createItem("ctf", CTFEvent.getEnemyTeamFlagId(player), 1, player, null)); | |
+ player.getInventory().blockAllItems(); | |
+ player.broadcastUserInfo(); | |
+ CTFEvent.setTeamCarrier(player); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has taken the " + enemyteam + " flag!", 5); | |
+ } | |
+ } | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFFlag(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+Our flag is gone %player%!<br1> | |
+Go apprehend the %enemyteam% defiler who did this! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+There is no time to waste %player%,<br1> | |
+make haste and return with the %enemyteam% flag! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (working copy) | |
@@ -0,0 +1,224 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * CTF Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class CTFManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.CTF_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "ctf", | |
+ "ctfjoin", | |
+ "ctfleave" | |
+ }; | |
+ | |
+ public CTFManager() | |
+ { | |
+ super(CTFManager.class.getSimpleName(), "custom/events/CTF"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.CTF_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !CTFEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int team1Count = CTFEvent.getTeamsPlayerCounts()[0]; | |
+ final int team2Count = CTFEvent.getTeamsPlayerCounts()[1]; | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.CTF_EVENT_MIN_LVL) || (playerLevel > Config.CTF_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.CTF_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_LVL)); | |
+ } | |
+ else if ((team1Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)); | |
+ } | |
+ else if ((Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.CTF_ID, player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (CTFEvent.needParticipationFee() && !CTFEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ else if (CTFEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (CTFEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.CTF_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (CTFEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = CTFEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ htmltext = getCTFStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "ctf": | |
+ { | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ html = getCTFStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "ctfjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "ctfleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getCTFStatus(L2PcInstance player) | |
+ { | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ int[] teamsPointsCounts = CTFEvent.getTeamsPoints(); | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1])); | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for CTF Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest CTFManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a CTF Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for CTF Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest CTFManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players are allowed per team. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the TvT Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (working copy) | |
@@ -0,0 +1,130 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFFlag; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.datatables.ItemTable; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.itemcontainer.Inventory; | |
+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; | |
+ | |
+/** | |
+ * CtF Flag AI. | |
+ * @author Pandragon | |
+ */ | |
+public final class CTFFlag extends AbstractNpcAI | |
+{ | |
+ private static final int[] FLAGS = | |
+ { | |
+ 80001, | |
+ 80002 | |
+ }; | |
+ | |
+ public CTFFlag() | |
+ { | |
+ super(CTFFlag.class.getSimpleName(), "custom/events/CtF"); | |
+ addFirstTalkId(FLAGS); | |
+ addTalkId(FLAGS); | |
+ addStartNpc(FLAGS); | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ final String team = CTFEvent.getParticipantTeam(player.getObjectId()).getName(); | |
+ final String enemyteam = CTFEvent.getParticipantEnemyTeam(player.getObjectId()).getName(); | |
+ if (npc.getTitle() == team) | |
+ // player talking to friendly flag | |
+ { | |
+ // team flag is missing | |
+ if (CTFEvent.getEnemyCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // player has returned with enemy flag | |
+ else if (player == CTFEvent.getTeamCarrier(player)) | |
+ { | |
+ if (Config.CTF_EVENT_CAPTURE_SKILL > 0) | |
+ { | |
+ player.broadcastPacket(new MagicSkillUse(player, npc, Config.CTF_EVENT_CAPTURE_SKILL, 1, 1, 1)); | |
+ } | |
+ CTFEvent.removeFlagCarrier(player); | |
+ CTFEvent.getParticipantTeam(player.getObjectId()).increasePoints(); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has captured the " + enemyteam + " flag!", 7); | |
+ CTFEvent.broadcastScoreMessage(); | |
+ } | |
+ // go get the flag | |
+ else | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ } | |
+ else | |
+ // player talking to enemy flag | |
+ { | |
+ // player has flag | |
+ if (CTFEvent.playerIsCarrier(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // enemy flag is missing | |
+ else if (CTFEvent.getTeamCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%player%", CTFEvent.getTeamCarrier(player).getName()); | |
+ } | |
+ // take flag | |
+ else | |
+ { | |
+ CTFEvent.setCarrierUnequippedWeapons(player, player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND), player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND)); | |
+ player.getInventory().equipItem(ItemTable.getInstance().createItem("ctf", CTFEvent.getEnemyTeamFlagId(player), 1, player, null)); | |
+ player.getInventory().blockAllItems(); | |
+ player.broadcastUserInfo(); | |
+ CTFEvent.setTeamCarrier(player); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has taken the " + enemyteam + " flag!", 5); | |
+ } | |
+ } | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFFlag(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+Our flag is gone %player%!<br1> | |
+Go apprehend the %enemyteam% defiler who did this! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+There is no time to waste %player%,<br1> | |
+make haste and return with the %enemyteam% flag! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/CTFFlag.java (working copy) | |
@@ -0,0 +1,130 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFFlag; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.datatables.ItemTable; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.itemcontainer.Inventory; | |
+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; | |
+ | |
+/** | |
+ * CtF Flag AI. | |
+ * @author Pandragon | |
+ */ | |
+public final class CTFFlag extends AbstractNpcAI | |
+{ | |
+ private static final int[] FLAGS = | |
+ { | |
+ 80001, | |
+ 80002 | |
+ }; | |
+ | |
+ public CTFFlag() | |
+ { | |
+ super(CTFFlag.class.getSimpleName(), "custom/events/CtF"); | |
+ addFirstTalkId(FLAGS); | |
+ addTalkId(FLAGS); | |
+ addStartNpc(FLAGS); | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ final String team = CTFEvent.getParticipantTeam(player.getObjectId()).getName(); | |
+ final String enemyteam = CTFEvent.getParticipantEnemyTeam(player.getObjectId()).getName(); | |
+ if (npc.getTitle() == team) | |
+ // player talking to friendly flag | |
+ { | |
+ // team flag is missing | |
+ if (CTFEvent.getEnemyCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // player has returned with enemy flag | |
+ else if (player == CTFEvent.getTeamCarrier(player)) | |
+ { | |
+ if (Config.CTF_EVENT_CAPTURE_SKILL > 0) | |
+ { | |
+ player.broadcastPacket(new MagicSkillUse(player, npc, Config.CTF_EVENT_CAPTURE_SKILL, 1, 1, 1)); | |
+ } | |
+ CTFEvent.removeFlagCarrier(player); | |
+ CTFEvent.getParticipantTeam(player.getObjectId()).increasePoints(); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has captured the " + enemyteam + " flag!", 7); | |
+ CTFEvent.broadcastScoreMessage(); | |
+ } | |
+ // go get the flag | |
+ else | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_friendly.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ } | |
+ else | |
+ // player talking to enemy flag | |
+ { | |
+ // player has flag | |
+ if (CTFEvent.playerIsCarrier(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%team%", team); | |
+ htmltext = htmltext.replaceAll("%player%", player.getName()); | |
+ } | |
+ // enemy flag is missing | |
+ else if (CTFEvent.getTeamCarrier(player) != null) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "flag_enemy_missing.html"); | |
+ htmltext = htmltext.replaceAll("%enemyteam%", enemyteam); | |
+ htmltext = htmltext.replaceAll("%player%", CTFEvent.getTeamCarrier(player).getName()); | |
+ } | |
+ // take flag | |
+ else | |
+ { | |
+ CTFEvent.setCarrierUnequippedWeapons(player, player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND), player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND)); | |
+ player.getInventory().equipItem(ItemTable.getInstance().createItem("ctf", CTFEvent.getEnemyTeamFlagId(player), 1, player, null)); | |
+ player.getInventory().blockAllItems(); | |
+ player.broadcastUserInfo(); | |
+ CTFEvent.setTeamCarrier(player); | |
+ CTFEvent.broadcastScreenMessage(player.getName() + " has taken the " + enemyteam + " flag!", 5); | |
+ } | |
+ } | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFFlag(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_enemy_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+Our flag is gone %player%!<br1> | |
+Go apprehend the %enemyteam% defiler who did this! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><title>%team% Headquarters</title><body> | |
+<br><br><center> | |
+There is no time to waste %player%,<br1> | |
+make haste and return with the %enemyteam% flag! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFFlag/flag_friendly_missing.html (working copy) | |
@@ -0,0 +1,5 @@ | |
+<html><body> | |
+<br><br><center> | |
+You already have the %enemyteam% flag %player%!<br1> | |
+Better to return it at %team% Headquarters! | |
+</center></body></html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (working copy) | |
@@ -0,0 +1,224 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * CTF Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class CTFManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.CTF_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "ctf", | |
+ "ctfjoin", | |
+ "ctfleave" | |
+ }; | |
+ | |
+ public CTFManager() | |
+ { | |
+ super(CTFManager.class.getSimpleName(), "custom/events/CTF"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.CTF_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !CTFEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int team1Count = CTFEvent.getTeamsPlayerCounts()[0]; | |
+ final int team2Count = CTFEvent.getTeamsPlayerCounts()[1]; | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.CTF_EVENT_MIN_LVL) || (playerLevel > Config.CTF_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.CTF_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_LVL)); | |
+ } | |
+ else if ((team1Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)); | |
+ } | |
+ else if ((Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.CTF_ID, player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (CTFEvent.needParticipationFee() && !CTFEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ else if (CTFEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (CTFEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.CTF_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (CTFEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = CTFEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ htmltext = getCTFStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "ctf": | |
+ { | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ html = getCTFStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "ctfjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "ctfleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getCTFStatus(L2PcInstance player) | |
+ { | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ int[] teamsPointsCounts = CTFEvent.getTeamsPoints(); | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1])); | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for CTF Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest CTFManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a CTF Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for CTF Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest CTFManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players are allowed per team. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the TvT Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CTFManager.java (working copy) | |
@@ -0,0 +1,224 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.CTF.CTFManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * CTF Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class CTFManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.CTF_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "ctf", | |
+ "ctfjoin", | |
+ "ctfleave" | |
+ }; | |
+ | |
+ public CTFManager() | |
+ { | |
+ super(CTFManager.class.getSimpleName(), "custom/events/CTF"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.CTF_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !CTFEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int team1Count = CTFEvent.getTeamsPlayerCounts()[0]; | |
+ final int team2Count = CTFEvent.getTeamsPlayerCounts()[1]; | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.CTF_EVENT_MIN_LVL) || (playerLevel > Config.CTF_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.CTF_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_LVL)); | |
+ } | |
+ else if ((team1Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.CTF_EVENT_MAX_PLAYERS_IN_TEAMS)); | |
+ } | |
+ else if ((Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.CTF_ID, player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (CTFEvent.needParticipationFee() && !CTFEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ else if (CTFEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (CTFEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.CTF_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.CTF_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (CTFEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = CTFEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", CTFEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ htmltext = getCTFStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "ctf": | |
+ { | |
+ if (CTFEvent.isStarting() || CTFEvent.isStarted()) | |
+ { | |
+ html = getCTFStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "ctfjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "ctfleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getCTFStatus(L2PcInstance player) | |
+ { | |
+ int[] teamsPlayerCounts = CTFEvent.getTeamsPlayerCounts(); | |
+ int[] teamsPointsCounts = CTFEvent.getTeamsPoints(); | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.CTF_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.CTF_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1])); | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new CTFManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for CTF Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest CTFManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a CTF Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for CTF Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest CTFManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/TeamsFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players are allowed per team. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/CTF/CTFManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>CTF Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the TvT Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (working copy) | |
@@ -0,0 +1,248 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.DM.DMManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * DM Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class DMManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.DM_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "dm", | |
+ "dmjoin", | |
+ "dmleave" | |
+ }; | |
+ | |
+ public DMManager() | |
+ { | |
+ super(DMManager.class.getSimpleName(), "custom/events/DM"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.DM_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !DMEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int players = DMEvent.getPlayerCounts(); | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.DM_EVENT_MIN_LVL) || (playerLevel > Config.DM_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.DM_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_LVL)); | |
+ } | |
+ else if (players == Config.DM_EVENT_MAX_PLAYERS) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "EventFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_PLAYERS)); | |
+ } | |
+ else if ((Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.DM_ID, player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (DMEvent.needParticipationFee() && !DMEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ else if (DMEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (DMEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.DM_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (DMEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = DMEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = DMEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.DM_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.DM_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ htmltext = getDMStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "dm": | |
+ { | |
+ if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ html = getDMStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "dmjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "dmleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getDMStatus(L2PcInstance player) | |
+ { | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ try | |
+ { | |
+ String[] firstPositions = DMEvent.getFirstPosition(Config.DM_EVENT_REWARD_FIRST_PLAYERS); | |
+ NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); | |
+ | |
+ String htmltext1 = ""; | |
+ Boolean c = true; | |
+ String c1 = "D9CC46"; | |
+ String c2 = "FFFFFF"; | |
+ if (firstPositions != null) | |
+ { | |
+ for (int i = 0; i < firstPositions.length; i++) | |
+ { | |
+ String[] row = firstPositions[i].split("\\,"); | |
+ String color = (c ? c1 : c2); | |
+ htmltext1 += "<tr>"; | |
+ htmltext1 += "<td width=\"35\" align=\"center\"><font color=\"" + color + "\">" + String.valueOf(i + 1) + "</font></td>"; | |
+ htmltext1 += "<td width=\"100\" align=\"left\"><font color=\"" + color + "\">" + row[0] + "</font></td>"; | |
+ htmltext1 += "<td width=\"125\" align=\"right\"><font color=\"" + color + "\">" + row[1] + "</font></td>"; | |
+ htmltext1 += "</tr>"; | |
+ c = !c; | |
+ } | |
+ } | |
+ | |
+ npcHtmlMessage.setHtml(htmltext); | |
+ npcHtmlMessage.replace("%toprank%", htmltext1); | |
+ player.sendPacket(npcHtmlMessage); | |
+ } | |
+ catch (Exception e) | |
+ { | |
+ | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new DMManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players for event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for DM Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest DMManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for DM Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest DMManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (working copy) | |
@@ -0,0 +1,248 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.DM.DMManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * DM Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class DMManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.DM_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "dm", | |
+ "dmjoin", | |
+ "dmleave" | |
+ }; | |
+ | |
+ public DMManager() | |
+ { | |
+ super(DMManager.class.getSimpleName(), "custom/events/DM"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.DM_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !DMEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int players = DMEvent.getPlayerCounts(); | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.DM_EVENT_MIN_LVL) || (playerLevel > Config.DM_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.DM_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_LVL)); | |
+ } | |
+ else if (players == Config.DM_EVENT_MAX_PLAYERS) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "EventFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_PLAYERS)); | |
+ } | |
+ else if ((Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.DM_ID, player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (DMEvent.needParticipationFee() && !DMEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ else if (DMEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (DMEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.DM_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (DMEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = DMEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = DMEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.DM_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.DM_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ htmltext = getDMStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "dm": | |
+ { | |
+ if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ html = getDMStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "dmjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "dmleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getDMStatus(L2PcInstance player) | |
+ { | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ try | |
+ { | |
+ String[] firstPositions = DMEvent.getFirstPosition(Config.DM_EVENT_REWARD_FIRST_PLAYERS); | |
+ NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); | |
+ | |
+ String htmltext1 = ""; | |
+ Boolean c = true; | |
+ String c1 = "D9CC46"; | |
+ String c2 = "FFFFFF"; | |
+ if (firstPositions != null) | |
+ { | |
+ for (int i = 0; i < firstPositions.length; i++) | |
+ { | |
+ String[] row = firstPositions[i].split("\\,"); | |
+ String color = (c ? c1 : c2); | |
+ htmltext1 += "<tr>"; | |
+ htmltext1 += "<td width=\"35\" align=\"center\"><font color=\"" + color + "\">" + String.valueOf(i + 1) + "</font></td>"; | |
+ htmltext1 += "<td width=\"100\" align=\"left\"><font color=\"" + color + "\">" + row[0] + "</font></td>"; | |
+ htmltext1 += "<td width=\"125\" align=\"right\"><font color=\"" + color + "\">" + row[1] + "</font></td>"; | |
+ htmltext1 += "</tr>"; | |
+ c = !c; | |
+ } | |
+ } | |
+ | |
+ npcHtmlMessage.setHtml(htmltext); | |
+ npcHtmlMessage.replace("%toprank%", htmltext1); | |
+ player.sendPacket(npcHtmlMessage); | |
+ } | |
+ catch (Exception e) | |
+ { | |
+ | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new DMManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players for event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for DM Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest DMManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for DM Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest DMManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/CursedWeaponEquipped.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cursed weapon holders are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/DMManager.java (working copy) | |
@@ -0,0 +1,248 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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 custom.events.DM.DMManager; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.handler.VoicedCommandHandler; | |
+import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
+import com.l2jserver.gameserver.model.actor.L2Npc; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+/** | |
+ * DM Manager AI. | |
+ * @author Zoey76 | |
+ */ | |
+public final class DMManager extends AbstractNpcAI implements IVoicedCommandHandler | |
+{ | |
+ private static final int MANAGER_ID = Config.DM_EVENT_PARTICIPATION_NPC_ID; | |
+ private static final String[] COMMANDS = | |
+ { | |
+ "dm", | |
+ "dmjoin", | |
+ "dmleave" | |
+ }; | |
+ | |
+ public DMManager() | |
+ { | |
+ super(DMManager.class.getSimpleName(), "custom/events/DM"); | |
+ addFirstTalkId(MANAGER_ID); | |
+ addTalkId(MANAGER_ID); | |
+ addStartNpc(MANAGER_ID); | |
+ | |
+ if (Config.DM_ALLOW_VOICED_COMMAND) | |
+ { | |
+ VoicedCommandHandler.getInstance().registerHandler(this); | |
+ } | |
+ } | |
+ | |
+ @Override | |
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) | |
+ { | |
+ if ((player == null) || !DMEvent.isParticipating()) | |
+ { | |
+ return super.onAdvEvent(event, npc, player); | |
+ } | |
+ | |
+ String htmltext = null; | |
+ switch (event) | |
+ { | |
+ case "join": | |
+ { | |
+ int playerLevel = player.getLevel(); | |
+ final int players = DMEvent.getPlayerCounts(); | |
+ if (player.isCursedWeaponEquipped()) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "CursedWeaponEquipped.html"); | |
+ } | |
+ else if (OlympiadManager.getInstance().isRegistered(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Olympiad.html"); | |
+ } | |
+ else if (player.getKarma() > 0) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Karma.html"); | |
+ } | |
+ else if ((playerLevel < Config.DM_EVENT_MIN_LVL) || (playerLevel > Config.DM_EVENT_MAX_LVL)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Level.html"); | |
+ htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.DM_EVENT_MIN_LVL)); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_LVL)); | |
+ } | |
+ else if (players == Config.DM_EVENT_MAX_PLAYERS) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "EventFull.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.DM_EVENT_MAX_PLAYERS)); | |
+ } | |
+ else if ((Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.DM_ID, player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html"); | |
+ htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP))); | |
+ } | |
+ else if (DMEvent.needParticipationFee() && !DMEvent.hasParticipationFee(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "ParticipationFee.html"); | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ else if (DMEvent.addParticipant(player)) | |
+ { | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Registered.html"); | |
+ } | |
+ break; | |
+ } | |
+ case "remove": | |
+ { | |
+ if (DMEvent.removeParticipant(player.getObjectId())) | |
+ { | |
+ if (Config.DM_EVENT_MAX_PARTICIPANTS_PER_IP > 0) | |
+ { | |
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.DM_ID, player); | |
+ } | |
+ htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html"); | |
+ } | |
+ else | |
+ { | |
+ player.sendMessage("You cannot unregister to this event."); | |
+ } | |
+ break; | |
+ } | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
+ { | |
+ String htmltext = null; | |
+ if (DMEvent.isParticipating()) | |
+ { | |
+ final boolean isParticipant = DMEvent.isPlayerParticipant(player.getObjectId()); | |
+ int[] teamsPlayerCounts = DMEvent.getTeamsPlayerCounts(); | |
+ htmltext = getHtm(player.getHtmlPrefix(), (!isParticipant ? "Participation.html" : "RemoveParticipation.html")); | |
+ htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId())); | |
+ htmltext = htmltext.replaceAll("%team1name%", Config.DM_EVENT_TEAM_1_NAME); | |
+ htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0])); | |
+ htmltext = htmltext.replaceAll("%team2name%", Config.DM_EVENT_TEAM_2_NAME); | |
+ htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1])); | |
+ htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1])); | |
+ | |
+ if (!isParticipant) | |
+ { | |
+ htmltext = htmltext.replaceAll("%fee%", DMEvent.getParticipationFee()); | |
+ } | |
+ } | |
+ else if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ htmltext = getDMStatus(player); | |
+ } | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) | |
+ { | |
+ String html = null; | |
+ switch (command) | |
+ { | |
+ case "dm": | |
+ { | |
+ if (DMEvent.isStarting() || DMEvent.isStarted()) | |
+ { | |
+ html = getDMStatus(activeChar); | |
+ } | |
+ else | |
+ { | |
+ html = "The event has not started."; | |
+ } | |
+ break; | |
+ } | |
+ case "dmjoin": | |
+ { | |
+ html = onAdvEvent("join", null, activeChar); | |
+ break; | |
+ } | |
+ case "dmleave": | |
+ { | |
+ html = onAdvEvent("remove", null, activeChar); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ if (html != null) | |
+ { | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ private String getDMStatus(L2PcInstance player) | |
+ { | |
+ String htmltext = getHtm(player.getHtmlPrefix(), "Status.html"); | |
+ try | |
+ { | |
+ String[] firstPositions = DMEvent.getFirstPosition(Config.DM_EVENT_REWARD_FIRST_PLAYERS); | |
+ NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); | |
+ | |
+ String htmltext1 = ""; | |
+ Boolean c = true; | |
+ String c1 = "D9CC46"; | |
+ String c2 = "FFFFFF"; | |
+ if (firstPositions != null) | |
+ { | |
+ for (int i = 0; i < firstPositions.length; i++) | |
+ { | |
+ String[] row = firstPositions[i].split("\\,"); | |
+ String color = (c ? c1 : c2); | |
+ htmltext1 += "<tr>"; | |
+ htmltext1 += "<td width=\"35\" align=\"center\"><font color=\"" + color + "\">" + String.valueOf(i + 1) + "</font></td>"; | |
+ htmltext1 += "<td width=\"100\" align=\"left\"><font color=\"" + color + "\">" + row[0] + "</font></td>"; | |
+ htmltext1 += "<td width=\"125\" align=\"right\"><font color=\"" + color + "\">" + row[1] + "</font></td>"; | |
+ htmltext1 += "</tr>"; | |
+ c = !c; | |
+ } | |
+ } | |
+ | |
+ npcHtmlMessage.setHtml(htmltext); | |
+ npcHtmlMessage.replace("%toprank%", htmltext1); | |
+ player.sendPacket(npcHtmlMessage); | |
+ } | |
+ catch (Exception e) | |
+ { | |
+ | |
+ } | |
+ | |
+ return htmltext; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return COMMANDS; | |
+ } | |
+ | |
+ public static void main(String[] args) | |
+ { | |
+ new DMManager(); | |
+ } | |
+} | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/EventFull.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ The event is full! Only %max% players for event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/IPRestriction.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Maximum of %max% participant(s) per IP address is allowed. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Karma.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Karma.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Chaotic players are not allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Level.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Level.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Level.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Only players from level %min% to level %max% are allowed to participate. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Olympiad.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You can not participate while registered for Olympiad. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Participation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Participation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Registration for DM Event:<br> | |
+ <center> | |
+ %playercount% players in.<br> | |
+ Participation Fee: %fee%<br> | |
+ <button action="bypass -h Quest DMManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/ParticipationFee.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You need %fee% for participation. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Registered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Registered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You are registered for a DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/RemoveParticipation.html (working copy) | |
@@ -0,0 +1,13 @@ | |
+<html> | |
+ <head> | |
+ </head><title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Cancel registration for DM Event:<br> | |
+ You are already registered for this event. Do you wish to cancel your participation in this Event?<br> | |
+ <center> | |
+ Participation fee is not returned!<br> | |
+ <button action="bypass -h Quest DMManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back"> | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Reward.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Reward.html (working copy) | |
@@ -0,0 +1,9 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ <font color="LEVEL">Your team won the event!</font><br> | |
+ Look in your inventory, there should be your reward. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Status.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Status.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Status.html (working copy) | |
@@ -0,0 +1,12 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ Status:<br> | |
+ <center> | |
+ %team1name% with %team1playercount% players and %team1points% points.<br> | |
+ %team2name% with %team2playercount% players and %team2points% points. | |
+ </center> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (revision 0) | |
+++ dist/game/data/scripts/custom/events/DM/DMManager/Unregistered.html (working copy) | |
@@ -0,0 +1,8 @@ | |
+<html> | |
+ <head> | |
+ <title>DM Event</title> | |
+ </head> | |
+ <body> | |
+ You have been unregistered from the DM Event. | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
Index: dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java | |
=================================================================== | |
--- dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java (revision 18787) | |
+++ dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java (working copy) | |
@@ -26,7 +26,7 @@ | |
import com.l2jserver.gameserver.instancemanager.AntiFeedManager; | |
import com.l2jserver.gameserver.model.actor.L2Npc; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.olympiad.OlympiadManager; | |
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
@@ -36,7 +36,7 @@ | |
*/ | |
public final class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler | |
{ | |
- private static final int MANAGER_ID = 70010; | |
+ private static final int MANAGER_ID = Config.TVT_EVENT_PARTICIPATION_NPC_ID; | |
private static final String[] COMMANDS = | |
{ | |
"tvt", | |
Index: dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java (working copy) | |
@@ -26,7 +26,9 @@ | |
import com.l2jserver.gameserver.model.L2Object; | |
import com.l2jserver.gameserver.model.actor.L2Character; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.network.SystemMessageId; | |
import com.l2jserver.gameserver.network.serverpackets.ActionFailed; | |
@@ -61,6 +63,18 @@ | |
return false; | |
} | |
+ // See description in CTFEvent.java | |
+ if (!CTFEvent.onAction(activeChar, target.getObjectId())) | |
+ { | |
+ return false; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.onAction(activeChar, target.getObjectId())) | |
+ { | |
+ return false; | |
+ } | |
+ | |
// Check if the L2PcInstance is confused | |
if (activeChar.isOutOfControl()) | |
{ | |
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminCTFEvent.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminCTFEvent.java (revision 0) | |
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminCTFEvent.java (working copy) | |
@@ -0,0 +1,112 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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.admincommandhandlers; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IAdminCommandHandler; | |
+import com.l2jserver.gameserver.model.L2Object; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEventTeleporter; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFManager; | |
+ | |
+/** | |
+ * @author HorridoJoho | |
+ */ | |
+public class AdminCTFEvent implements IAdminCommandHandler | |
+{ | |
+ private static final String[] ADMIN_COMMANDS = | |
+ { | |
+ "admin_ctf_add", | |
+ "admin_ctf_remove", | |
+ "admin_ctf_advance" | |
+ }; | |
+ | |
+ @Override | |
+ public boolean useAdminCommand(String command, L2PcInstance activeChar) | |
+ { | |
+ if (command.equals("admin_ctf_add")) | |
+ { | |
+ L2Object target = activeChar.getTarget(); | |
+ | |
+ if (!(target instanceof L2PcInstance)) | |
+ { | |
+ activeChar.sendMessage("You should select a player!"); | |
+ return true; | |
+ } | |
+ | |
+ add(activeChar, (L2PcInstance) target); | |
+ } | |
+ else if (command.equals("admin_ctf_remove")) | |
+ { | |
+ L2Object target = activeChar.getTarget(); | |
+ | |
+ if (!(target instanceof L2PcInstance)) | |
+ { | |
+ activeChar.sendMessage("You should select a player!"); | |
+ return true; | |
+ } | |
+ | |
+ remove(activeChar, (L2PcInstance) target); | |
+ } | |
+ else if (command.equals("admin_ctf_advance")) | |
+ { | |
+ CTFManager.getInstance().skipDelay(); | |
+ } | |
+ | |
+ return true; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getAdminCommandList() | |
+ { | |
+ return ADMIN_COMMANDS; | |
+ } | |
+ | |
+ private void add(L2PcInstance activeChar, L2PcInstance playerInstance) | |
+ { | |
+ if (playerInstance.isOnEvent()) | |
+ { | |
+ activeChar.sendMessage("Player already participated in the event!"); | |
+ return; | |
+ } | |
+ | |
+ if (!CTFEvent.addParticipant(playerInstance)) | |
+ { | |
+ activeChar.sendMessage("Player instance could not be added, it seems to be null!"); | |
+ return; | |
+ } | |
+ | |
+ if (CTFEvent.isStarted()) | |
+ { | |
+ new CTFEventTeleporter(playerInstance, CTFEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false); | |
+ } | |
+ } | |
+ | |
+ private void remove(L2PcInstance activeChar, L2PcInstance playerInstance) | |
+ { | |
+ if (!CTFEvent.removeParticipant(playerInstance.getObjectId())) | |
+ { | |
+ activeChar.sendMessage("Player is not part of the event!"); | |
+ return; | |
+ } | |
+ | |
+ new CTFEventTeleporter(playerInstance, Config.CTF_EVENT_PARTICIPATION_NPC_COORDINATES, true, true); | |
+ } | |
+} | |
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminDMEvent.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminDMEvent.java (revision 0) | |
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminDMEvent.java (working copy) | |
@@ -0,0 +1,112 @@ | |
+/* | |
+ * Copyright (C) 2004-2015 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.admincommandhandlers; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.handler.IAdminCommandHandler; | |
+import com.l2jserver.gameserver.model.L2Object; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEventTeleporter; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMManager; | |
+ | |
+/** | |
+ * @author HorridoJoho | |
+ */ | |
+public class AdminDMEvent implements IAdminCommandHandler | |
+{ | |
+ private static final String[] ADMIN_COMMANDS = | |
+ { | |
+ "admin_dm_add", | |
+ "admin_dm_remove", | |
+ "admin_dm_advance" | |
+ }; | |
+ | |
+ @Override | |
+ public boolean useAdminCommand(String command, L2PcInstance activeChar) | |
+ { | |
+ if (command.equals("admin_dm_add")) | |
+ { | |
+ L2Object target = activeChar.getTarget(); | |
+ | |
+ if (!(target instanceof L2PcInstance)) | |
+ { | |
+ activeChar.sendMessage("You should select a player!"); | |
+ return true; | |
+ } | |
+ | |
+ add(activeChar, (L2PcInstance) target); | |
+ } | |
+ else if (command.equals("admin_dm_remove")) | |
+ { | |
+ L2Object target = activeChar.getTarget(); | |
+ | |
+ if (!(target instanceof L2PcInstance)) | |
+ { | |
+ activeChar.sendMessage("You should select a player!"); | |
+ return true; | |
+ } | |
+ | |
+ remove(activeChar, (L2PcInstance) target); | |
+ } | |
+ else if (command.equals("admin_dm_advance")) | |
+ { | |
+ DMManager.getInstance().skipDelay(); | |
+ } | |
+ | |
+ return true; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getAdminCommandList() | |
+ { | |
+ return ADMIN_COMMANDS; | |
+ } | |
+ | |
+ private void add(L2PcInstance activeChar, L2PcInstance playerInstance) | |
+ { | |
+ if (playerInstance.isOnEvent()) | |
+ { | |
+ activeChar.sendMessage("Player already participated in the event!"); | |
+ return; | |
+ } | |
+ | |
+ if (!DMEvent.addParticipant(playerInstance)) | |
+ { | |
+ activeChar.sendMessage("Player instance could not be added, it seems to be null!"); | |
+ return; | |
+ } | |
+ | |
+ if (DMEvent.isStarted()) | |
+ { | |
+ new DMEventTeleporter(playerInstance, Config.DM_EVENT_PARTICIPATION_NPC_COORDINATES, true, false); | |
+ } | |
+ } | |
+ | |
+ private void remove(L2PcInstance activeChar, L2PcInstance playerInstance) | |
+ { | |
+ if (!DMEvent.removeParticipant(playerInstance.getObjectId())) | |
+ { | |
+ activeChar.sendMessage("Player is not part of the event!"); | |
+ return; | |
+ } | |
+ | |
+ new DMEventTeleporter(playerInstance, Config.DM_EVENT_PARTICIPATION_NPC_COORDINATES, true, true); | |
+ } | |
+} | |
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminTvTEvent.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminTvTEvent.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminTvTEvent.java (working copy) | |
@@ -22,9 +22,9 @@ | |
import com.l2jserver.gameserver.handler.IAdminCommandHandler; | |
import com.l2jserver.gameserver.model.L2Object; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
-import com.l2jserver.gameserver.model.entity.TvTEventTeleporter; | |
-import com.l2jserver.gameserver.model.entity.TvTManager; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEventTeleporter; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTManager; | |
/** | |
* @author HorridoJoho | |
Index: dist/game/data/scripts/handlers/effecthandlers/CallPc.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/effecthandlers/CallPc.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/effecthandlers/CallPc.java (working copy) | |
@@ -26,7 +26,9 @@ | |
import com.l2jserver.gameserver.model.conditions.Condition; | |
import com.l2jserver.gameserver.model.effects.AbstractEffect; | |
import com.l2jserver.gameserver.model.entity.Instance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.holders.SummonRequestHolder; | |
import com.l2jserver.gameserver.model.skills.BuffInfo; | |
import com.l2jserver.gameserver.model.zone.ZoneId; | |
@@ -131,7 +133,10 @@ | |
return false; | |
} | |
- if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !TvTEvent.onEscapeUse(target.getObjectId())) | |
+ // TODO: TvT Event | |
+ // TODO: CTF Event | |
+ // TODO: DM Event | |
+ if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !CTFEvent.onEscapeUse(target.getObjectId()) || !DMEvent.onEscapeUse(target.getObjectId()) || !TvTEvent.onEscapeUse(target.getObjectId())) | |
{ | |
activeChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING); | |
return false; | |
Index: dist/game/data/scripts/handlers/itemhandlers/ItemSkillsTemplate.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkillsTemplate.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkillsTemplate.java (working copy) | |
@@ -21,7 +21,9 @@ | |
import com.l2jserver.gameserver.ai.CtrlIntention; | |
import com.l2jserver.gameserver.handler.IItemHandler; | |
import com.l2jserver.gameserver.model.actor.L2Playable; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.holders.SkillHolder; | |
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
@@ -43,6 +45,7 @@ | |
return false; | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.onScrollUse(playable.getObjectId())) | |
{ | |
playable.sendPacket(ActionFailed.STATIC_PACKET); | |
@@ -49,6 +52,20 @@ | |
return false; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.onScrollUse(playable.getObjectId())) | |
+ { | |
+ playable.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.onScrollUse(playable.getObjectId())) | |
+ { | |
+ playable.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
+ | |
// Pets can use items only when they are tradable. | |
if (playable.isPet() && !item.isTradeable()) | |
{ | |
Index: dist/game/data/scripts/handlers/itemhandlers/SummonItems.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (working copy) | |
@@ -22,7 +22,9 @@ | |
import com.l2jserver.gameserver.model.L2PetData; | |
import com.l2jserver.gameserver.model.actor.L2Playable; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.holders.PetItemHolder; | |
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; | |
import com.l2jserver.gameserver.network.SystemMessageId; | |
@@ -41,11 +43,24 @@ | |
return false; | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.onItemSummon(playable.getObjectId())) | |
{ | |
return false; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.onItemSummon(playable.getObjectId())) | |
+ { | |
+ return false; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.onItemSummon(playable.getObjectId())) | |
+ { | |
+ return false; | |
+ } | |
+ | |
final L2PcInstance activeChar = playable.getActingPlayer(); | |
if (!activeChar.getFloodProtectors().getItemPetSummon().tryPerformAction("summon items") || (activeChar.getBlockCheckerArena() != -1) || activeChar.inObserverMode() || activeChar.isAllSkillsDisabled() || activeChar.isCastingNow()) | |
{ | |
Index: dist/game/data/scripts/handlers/MasterHandler.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy) | |
@@ -39,11 +39,13 @@ | |
import handlers.admincommandhandlers.AdminBBS; | |
import handlers.admincommandhandlers.AdminBuffs; | |
import handlers.admincommandhandlers.AdminCHSiege; | |
+import handlers.admincommandhandlers.AdminCTFEvent; | |
import handlers.admincommandhandlers.AdminCamera; | |
import handlers.admincommandhandlers.AdminChangeAccessLevel; | |
import handlers.admincommandhandlers.AdminClan; | |
import handlers.admincommandhandlers.AdminCreateItem; | |
import handlers.admincommandhandlers.AdminCursedWeapons; | |
+import handlers.admincommandhandlers.AdminDMEvent; | |
import handlers.admincommandhandlers.AdminDebug; | |
import handlers.admincommandhandlers.AdminDelete; | |
import handlers.admincommandhandlers.AdminDisconnect; | |
@@ -336,6 +338,7 @@ | |
AdminChangeAccessLevel.class, | |
AdminCHSiege.class, | |
AdminClan.class, | |
+ AdminCTFEvent.class, | |
AdminPcCondOverride.class, | |
AdminCreateItem.class, | |
AdminCursedWeapons.class, | |
@@ -342,6 +345,7 @@ | |
AdminDebug.class, | |
AdminDelete.class, | |
AdminDisconnect.class, | |
+ AdminDMEvent.class, | |
AdminDoorControl.class, | |
AdminEditChar.class, | |
AdminEffects.class, | |
Index: dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java (working copy) | |
@@ -25,7 +25,9 @@ | |
import com.l2jserver.gameserver.model.L2World; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
import com.l2jserver.gameserver.model.actor.tasks.player.TeleportTask; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.events.Containers; | |
import com.l2jserver.gameserver.model.events.EventType; | |
import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerLogin; | |
@@ -161,11 +163,24 @@ | |
player.setInstanceId(0); | |
player.setIsIn7sDungeon(false); | |
+ // TODO: TvT Event | |
if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getObjectId())) | |
{ | |
TvTEvent.removeParticipant(player.getObjectId()); | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.isInactive() && CTFEvent.isPlayerParticipant(player.getObjectId())) | |
+ { | |
+ CTFEvent.removeParticipant(player.getObjectId()); | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.isInactive() && DMEvent.isPlayerParticipant(player.getObjectId())) | |
+ { | |
+ DMEvent.removeParticipant(player.getObjectId()); | |
+ } | |
+ | |
if (OlympiadManager.getInstance().isRegisteredInComp(player)) | |
{ | |
OlympiadManager.getInstance().removeDisconnectedCompetitor(player); | |
Index: dist/game/data/scripts/handlers/targethandlers/Clan.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/targethandlers/Clan.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/targethandlers/Clan.java (working copy) | |
@@ -29,7 +29,9 @@ | |
import com.l2jserver.gameserver.model.actor.L2Character; | |
import com.l2jserver.gameserver.model.actor.L2Npc; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.model.skills.targets.L2TargetType; | |
import com.l2jserver.gameserver.util.Util; | |
@@ -109,11 +111,24 @@ | |
continue; | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.checkForTvTSkill(player, obj, skill)) | |
{ | |
continue; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.checkForCTFSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.checkForDMSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) | |
{ | |
targetList.add(obj.getSummon()); | |
Index: dist/game/data/scripts/handlers/targethandlers/CorpseClan.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/targethandlers/CorpseClan.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/targethandlers/CorpseClan.java (working copy) | |
@@ -29,7 +29,9 @@ | |
import com.l2jserver.gameserver.model.actor.L2Character; | |
import com.l2jserver.gameserver.model.actor.L2Npc; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.model.skills.targets.L2TargetType; | |
import com.l2jserver.gameserver.model.zone.ZoneId; | |
@@ -91,11 +93,24 @@ | |
continue; | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.checkForTvTSkill(player, obj, skill)) | |
{ | |
continue; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.checkForCTFSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.checkForDMSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
if (!Skill.addCharacter(activeChar, obj, radius, true)) | |
{ | |
continue; | |
Index: dist/game/data/scripts/handlers/targethandlers/PartyClan.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/targethandlers/PartyClan.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/targethandlers/PartyClan.java (working copy) | |
@@ -26,7 +26,9 @@ | |
import com.l2jserver.gameserver.model.L2Object; | |
import com.l2jserver.gameserver.model.actor.L2Character; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.model.skills.targets.L2TargetType; | |
@@ -123,11 +125,24 @@ | |
continue; | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.checkForTvTSkill(player, obj, skill)) | |
{ | |
continue; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.checkForCTFSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.checkForDMSkill(player, obj, skill)) | |
+ { | |
+ continue; | |
+ } | |
+ | |
if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false)) | |
{ | |
targetList.add(obj.getSummon()); | |
Index: dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java (working copy) | |
@@ -26,7 +26,9 @@ | |
import com.l2jserver.gameserver.handler.IUserCommandHandler; | |
import com.l2jserver.gameserver.model.TeleportWhereType; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.network.SystemMessageId; | |
import com.l2jserver.gameserver.network.serverpackets.ActionFailed; | |
@@ -47,12 +49,24 @@ | |
@Override | |
public boolean useUserCommand(int id, L2PcInstance activeChar) | |
{ | |
- // Thanks nbd | |
+ // TODO: TvT Event | |
if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) | |
{ | |
activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
return false; | |
} | |
+ // TODO: CTF Event | |
+ else if (!CTFEvent.onEscapeUse(activeChar.getObjectId())) | |
+ { | |
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
+ // TODO: DM Event | |
+ else if (!DMEvent.onEscapeUse(activeChar.getObjectId())) | |
+ { | |
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
else if (activeChar.isJailed()) | |
{ | |
activeChar.sendMessage("You cannot use this function while you are jailed."); | |
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java (revision 18787) | |
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java (working copy) | |
@@ -40,7 +40,9 @@ | |
import com.l2jserver.gameserver.model.Location; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
import com.l2jserver.gameserver.model.entity.L2Event; | |
-import com.l2jserver.gameserver.model.entity.TvTEvent; | |
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent; | |
+import com.l2jserver.gameserver.model.entity.events.dm.DMEvent; | |
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent; | |
import com.l2jserver.gameserver.model.skills.AbnormalVisualEffect; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.model.zone.ZoneId; | |
@@ -335,7 +337,7 @@ | |
return false; | |
} | |
- // Thanks nbd | |
+ // TODO: TvT Event | |
if (!TvTEvent.onEscapeUse(activeChar.getObjectId())) | |
{ | |
activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
@@ -342,6 +344,20 @@ | |
return false; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.onEscapeUse(activeChar.getObjectId())) | |
+ { | |
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ if (!DMEvent.onEscapeUse(activeChar.getObjectId())) | |
+ { | |
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
+ return false; | |
+ } | |
+ | |
if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) | |
{ | |
activeChar.sendMessage("You are in area which blocks summoning."); | |
@@ -445,6 +461,7 @@ | |
} | |
} | |
+ // TODO: TvT Event | |
if (!TvTEvent.onEscapeUse(partner.getObjectId())) | |
{ | |
activeChar.sendMessage("Your partner is in an event."); | |
@@ -451,6 +468,15 @@ | |
return false; | |
} | |
+ // TODO: CTF Event | |
+ if (!CTFEvent.onEscapeUse(partner.getObjectId())) | |
+ { | |
+ activeChar.sendMessage("Your partner is in an event."); | |
+ return false; | |
+ } | |
+ | |
+ // TODO: DM Event | |
+ | |
if (partner.isInsideZone(ZoneId.NO_SUMMON_FRIEND)) | |
{ | |
activeChar.sendMessage("Your partner is in area which blocks summoning."); | |
Index: dist/game/data/stats/npcs/custom/custom.xml | |
=================================================================== | |
--- dist/game/data/stats/npcs/custom/custom.xml (revision 18787) | |
+++ dist/game/data/stats/npcs/custom/custom.xml (working copy) | |
@@ -6,6 +6,8 @@ | |
<height normal="23" /> | |
</collision> | |
</npc> | |
+ | |
+ <!-- TvT Event --> | |
<npc id="70010" displayId="31606" name="Catrina" usingServerSideName="true" title="TvT Event Manager" usingServerSideTitle="true" type="L2Npc"> | |
<collision> | |
<radius normal="8" /> | |
@@ -12,6 +14,36 @@ | |
<height normal="15" /> | |
</collision> | |
</npc> | |
+ | |
+ <!-- CTF Event --> | |
+ <npc id="70020" displayId="32209" name="Ferdinand" usingServerSideName="true" title="CTF Event Manager" usingServerSideTitle="true" type="L2Npc"> | |
+ <equipment rhand="9646" /> | |
+ <collision> | |
+ <radius normal="13" /> | |
+ <height normal="25" /> | |
+ </collision> | |
+ </npc> | |
+ <npc id="70021" displayId="35609" level="75" name="Headquarters" usingServerSideName="true" type="L2Npc"> | |
+ <collision> | |
+ <radius normal="51.8" /> | |
+ <height normal="108.25" /> | |
+ </collision> | |
+ </npc> | |
+ <npc id="70022" displayId="35608" level="75" name="Headquarters" usingServerSideName="true" type="L2Npc"> | |
+ <collision> | |
+ <radius normal="51.8" /> | |
+ <height normal="108.25" /> | |
+ </collision> | |
+ </npc> | |
+ | |
+ <!-- DM Event --> | |
+ <npc id="70030" displayId="31606" name="Catriny" usingServerSideName="true" title="DM Event Manager" usingServerSideTitle="true" type="L2Npc"> | |
+ <collision> | |
+ <radius normal="8" /> | |
+ <height normal="15" /> | |
+ </collision> | |
+ </npc> | |
+ | |
<npc id="900100" displayId="20432" level="1" name="Elpy" type="L2EventMonster"> | |
<stats str="40" int="21" dex="30" wit="20" con="43" men="20"> | |
<vitals hp="40" hpRegen="3" mp="36" mpRegen="1" /> | |
Index: dist/game/data/zones/cleft.xml | |
=================================================================== | |
--- dist/game/data/zones/cleft.xml (revision 18787) | |
+++ dist/game/data/zones/cleft.xml (working copy) | |
@@ -45,6 +45,7 @@ | |
<stat name="chance" val="100" /> | |
<stat name="default_enabled" val="false" /> | |
<stat name="reuse" val="5000" /> | |
+ <stat name="showDangerIcon" val="false" /> | |
<stat name="skillIdLvl" val="4148-12;" /> <!-- s_area_poison12 --> | |
<node X="-215486" Y="244252" /> | |
<node X="-214474" Y="244260" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment