Skip to content

Instantly share code, notes, and snippets.

@u3games
Last active August 29, 2015 14:20
Show Gist options
  • Save u3games/1e4dbe6074da4817b3ca to your computer and use it in GitHub Desktop.
Save u3games/1e4dbe6074da4817b3ca to your computer and use it in GitHub Desktop.
Dev_Events_Data_v1 - U3Games
### Eclipse Workspace Patch 1.0
#P Dev_Events_Data
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/handlers/punishmenthandlers/JailHandler.java
===================================================================
--- dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java (revision 18960)
+++ dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java (working copy)
@@ -25,7 +25,8 @@
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.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,6 +162,11 @@
player.setInstanceId(0);
player.setIsIn7sDungeon(false);
+ if (!CTFEvent.isInactive() && CTFEvent.isPlayerParticipant(player.getObjectId()))
+ {
+ CTFEvent.removeParticipant(player.getObjectId());
+ }
+
if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getObjectId()))
{
TvTEvent.removeParticipant(player.getObjectId());
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/handlers/targethandlers/PartyClan.java
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/PartyClan.java (revision 18960)
+++ dist/game/data/scripts/handlers/targethandlers/PartyClan.java (working copy)
@@ -26,7 +26,8 @@
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.tvt.TvTEvent;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
@@ -123,7 +124,7 @@
continue;
}
- if (!TvTEvent.checkForTvTSkill(player, obj, skill))
+ if ((!CTFEvent.checkForCTFSkill(player, obj, skill)) || (!TvTEvent.checkForTvTSkill(player, obj, skill)))
{
continue;
}
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">&lt;ike this&gt;</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">&lt;minutes&gt;</font> - Time between events.<br>
+<font color="LEVEL">PartTime</font> <font color="FF0000">&lt;minutes&gt;</font> - Time allowed for application.<br>
+<font color="LEVEL">RunnTime</font> <font color="FF0000">&lt;minutes&gt;</font> - Event duration<br>
+<br>
+<font color="LEVEL">Disable</font> - Disable this mod.<br>
+<font color="LEVEL">EventNpc</font> <font color="FF0000">&lt;integer&gt;</font> - NpcId to be used as event manager.
+</body></html>
\ No newline at end of file
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/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/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/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/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.EventTeleporter;
+import com.l2jserver.gameserver.model.entity.events.ctf.CTFEvent;
+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;
+ }
+
+ 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 EventTeleporter(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 EventTeleporter(playerInstance, Config.CTF_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
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.EVENTS_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.EVENTS_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/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/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_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/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/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: .classpath
===================================================================
--- .classpath (revision 18960)
+++ .classpath (working copy)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts" />
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
- <classpathentry combineaccessrules="false" kind="src" path="/L2J_Server" />
- <classpathentry kind="lib" path="/L2J_Server/dist/libs/mmocore.jar" />
- <classpathentry kind="output" path="bin" />
-</classpath>
\ No newline at end of file
+ <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="lib" path="/Dev_Events_Core/dist/libs/mmocore.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/Dev_Events_Core"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
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/handlers/itemhandlers/SummonItems.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (revision 18960)
+++ dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (working copy)
@@ -22,7 +22,7 @@
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.tvt.TvTEvent;
import com.l2jserver.gameserver.model.holders.PetItemHolder;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -41,7 +41,7 @@
return false;
}
- if (!TvTEvent.onItemSummon(playable.getObjectId()))
+ if ((!TvTEvent.onItemSummon(playable.getObjectId())) || (!TvTEvent.onItemSummon(playable.getObjectId())))
{
return false;
}
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/handlers/effecthandlers/CallPc.java
===================================================================
--- dist/game/data/scripts/handlers/effecthandlers/CallPc.java (revision 18960)
+++ dist/game/data/scripts/handlers/effecthandlers/CallPc.java (working copy)
@@ -26,7 +26,8 @@
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.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 +132,7 @@
return false;
}
- if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !TvTEvent.onEscapeUse(target.getObjectId()))
+ if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !CTFEvent.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/voicedcommandhandlers/Wedding.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java (revision 18960)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java (working copy)
@@ -40,7 +40,8 @@
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.tvt.TvTEvent;
import com.l2jserver.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.zone.ZoneId;
@@ -335,8 +336,7 @@
return false;
}
- // Thanks nbd
- if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
+ if ((!CTFEvent.onEscapeUse(activeChar.getObjectId())) || (!TvTEvent.onEscapeUse(activeChar.getObjectId())))
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return false;
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 =
+ {
+ Config.CTF_EVENT_TEAM_1_HEADQUARTERS,
+ Config.CTF_EVENT_TEAM_2_HEADQUARTERS
+ };
+
+ 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.EVENTS_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.EVENTS_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.EVENTS_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.EVENTS_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/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/zones/cleft.xml
===================================================================
--- dist/game/data/zones/cleft.xml (revision 18960)
+++ 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" />
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 =
+ {
+ Config.CTF_EVENT_TEAM_1_HEADQUARTERS,
+ Config.CTF_EVENT_TEAM_2_HEADQUARTERS
+ };
+
+ 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/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/handlers/targethandlers/CorpseClan.java
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/CorpseClan.java (revision 18960)
+++ dist/game/data/scripts/handlers/targethandlers/CorpseClan.java (working copy)
@@ -29,7 +29,8 @@
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.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,7 +92,7 @@
continue;
}
- if (!TvTEvent.checkForTvTSkill(player, obj, skill))
+ if ((!CTFEvent.checkForCTFSkill(player, obj, skill)) || (!TvTEvent.checkForTvTSkill(player, obj, skill)))
{
continue;
}
Index: dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java
===================================================================
--- dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java (revision 18960)
+++ dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java (working copy)
@@ -27,7 +27,7 @@
import com.l2jserver.gameserver.model.Location;
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.tvt.TvTEvent;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -56,8 +56,8 @@
@Override
public boolean action(L2PcInstance activeChar, L2Object target, boolean interact)
{
- // See description in TvTEvent.java
- if (!TvTEvent.onAction(activeChar, target.getObjectId()))
+ // Check Events
+ if ((!TvTEvent.onAction(activeChar, target.getObjectId())) || (!TvTEvent.onAction(activeChar, target.getObjectId())))
{
return false;
}
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 =
+ {
+ Config.CTF_EVENT_TEAM_1_HEADQUARTERS,
+ Config.CTF_EVENT_TEAM_2_HEADQUARTERS
+ };
+
+ 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/handlers/itemhandlers/ItemSkillsTemplate.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkillsTemplate.java (revision 18960)
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkillsTemplate.java (working copy)
@@ -21,7 +21,8 @@
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.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,7 +44,7 @@
return false;
}
- if (!TvTEvent.onScrollUse(playable.getObjectId()))
+ if ((!CTFEvent.onScrollUse(playable.getObjectId())) || (!TvTEvent.onScrollUse(playable.getObjectId())))
{
playable.sendPacket(ActionFailed.STATIC_PACKET);
return false;
Index: dist/game/data/stats/npcs/custom/custom.xml
===================================================================
--- dist/game/data/stats/npcs/custom/custom.xml (revision 18960)
+++ dist/game/data/stats/npcs/custom/custom.xml (working copy)
@@ -12,6 +12,24 @@
<height normal="15" />
</collision>
</npc>
+ <npc id="70020" displayId="31606" name="Ferdinand" usingServerSideName="true" title="CTF Event Manager" usingServerSideTitle="true" type="L2Npc">
+ <collision>
+ <radius normal="8" />
+ <height normal="15" />
+ </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>
<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/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/handlers/usercommandhandlers/Unstuck.java
===================================================================
--- dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java (revision 18960)
+++ dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java (working copy)
@@ -26,7 +26,8 @@
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.tvt.TvTEvent;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -47,8 +48,7 @@
@Override
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
- // Thanks nbd
- if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
+ if ((!CTFEvent.onEscapeUse(activeChar.getObjectId())) || (!TvTEvent.onEscapeUse(activeChar.getObjectId())))
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return false;
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 18960)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -39,6 +39,7 @@
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;
@@ -335,6 +336,7 @@
AdminCamera.class,
AdminChangeAccessLevel.class,
AdminCHSiege.class,
+ AdminCTFEvent.class,
AdminClan.class,
AdminPcCondOverride.class,
AdminCreateItem.class,
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminTvTEvent.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminTvTEvent.java (revision 18960)
+++ 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.EventTeleporter;
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTEvent;
+import com.l2jserver.gameserver.model.entity.events.tvt.TvTManager;
/**
* @author HorridoJoho
@@ -95,7 +95,7 @@
if (TvTEvent.isStarted())
{
- new TvTEventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false);
+ new EventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false);
}
}
@@ -107,6 +107,6 @@
return;
}
- new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
+ new EventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
}
}
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/handlers/targethandlers/Clan.java
===================================================================
--- dist/game/data/scripts/handlers/targethandlers/Clan.java (revision 18960)
+++ dist/game/data/scripts/handlers/targethandlers/Clan.java (working copy)
@@ -29,7 +29,8 @@
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.tvt.TvTEvent;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
import com.l2jserver.gameserver.util.Util;
@@ -109,7 +110,7 @@
continue;
}
- if (!TvTEvent.checkForTvTSkill(player, obj, skill))
+ if ((!CTFEvent.checkForCTFSkill(player, obj, skill)) || (!TvTEvent.checkForTvTSkill(player, obj, skill)))
{
continue;
}
Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg (revision 18960)
+++ dist/game/data/scripts.cfg (working copy)
@@ -220,6 +220,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/TvT/TvTManager/TvTManager.java
===================================================================
--- dist/game/data/scripts/custom/events/TvT/TvTManager/TvTManager.java (revision 18960)
+++ 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;
@@ -96,7 +96,7 @@
htmltext = getHtm(player.getHtmlPrefix(), "TeamsFull.html");
htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
}
- else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))
+ else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.EVENTS_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))
{
htmltext = getHtm(player.getHtmlPrefix(), "IPRestriction.html");
htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)));
@@ -118,7 +118,7 @@
{
if (Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0)
{
- AntiFeedManager.getInstance().removePlayer(AntiFeedManager.TVT_ID, player);
+ AntiFeedManager.getInstance().removePlayer(AntiFeedManager.EVENTS_ID, player);
}
htmltext = getHtm(player.getHtmlPrefix(), "Unregistered.html");
}
Index: dist/game/config/adminCommands.xml
===================================================================
--- dist/game/config/adminCommands.xml (revision 18960)
+++ dist/game/config/adminCommands.xml (working copy)
@@ -564,7 +564,12 @@
<admin command="admin_stats" accessLevel="7" />
<admin command="admin_skill_test" accessLevel="7" />
<admin command="admin_known" 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 TVT EVENT -->
<admin command="admin_tvt_add" accessLevel="7" />
<admin command="admin_tvt_remove" accessLevel="7" />
Index: dist/game/data/html/admin/mods_menu.htm
===================================================================
--- dist/game/data/html/admin/mods_menu.htm (revision 18960)
+++ 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment