Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/L2J_Mobius_C6_Interlude/.gitignore b/L2J_Mobius_C6_Interlude/.gitignore
- new file mode 100644
- index 0000000..ae3c172
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/.gitignore
- @@ -0,0 +1 @@
- +/bin/
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
- index 407ede2..2fdc23c 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java
- @@ -112,6 +112,7 @@
- private static final String PHYSICS_BALANCE_CONFIG_FILE = "./config/custom/PhysicsBalance.ini";
- private static final String SCHEME_BUFFER_CONFIG_FILE = "./config/custom/SchemeBuffer.ini";
- private static final String STARTING_LOCATION_CONFIG_FILE = "./config/custom/StartingLocation.ini";
- + private static final String EVENT_TVT_CONFIG_FILE = "./config/custom/TvTEvents.ini";
- private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
- private static final String HEXID_FILE = "./config/hexid.txt";
- @@ -1154,6 +1155,29 @@
- public static boolean ACCEPT_NEW_GAMESERVER;
- public static boolean AUTO_CREATE_ACCOUNTS;
- + public static String TVT_EVEN_TEAMS;
- + public static boolean TVT_ALLOW_INTERFERENCE;
- + public static boolean TVT_ALLOW_POTIONS;
- + public static boolean TVT_ALLOW_SUMMON;
- + public static boolean TVT_ON_START_REMOVE_ALL_EFFECTS;
- + public static boolean TVT_ON_START_UNSUMMON_PET;
- + public static boolean TVT_REVIVE_RECOVERY;
- + public static boolean TVT_ANNOUNCE_TEAM_STATS;
- + public static boolean TVT_ANNOUNCE_REWARD;
- + public static boolean TVT_PRICE_NO_KILLS;
- + public static boolean TVT_JOIN_CURSED;
- + public static boolean TVT_COMMAND;
- + public static long TVT_REVIVE_DELAY;
- + public static boolean TVT_OPEN_FORT_DOORS;
- + public static boolean TVT_CLOSE_FORT_DOORS;
- + public static boolean TVT_OPEN_ADEN_COLOSSEUM_DOORS;
- + public static boolean TVT_CLOSE_ADEN_COLOSSEUM_DOORS;
- + public static int TVT_TOP_KILLER_REWARD;
- + public static int TVT_TOP_KILLER_QTY;
- + public static boolean TVT_AURA;
- + public static boolean TVT_STATS_LOGGER;
- + public static boolean TVT_REMOVE_BUFFS_ON_DIE;
- +
- public static boolean ENABLE_GUI;
- public static boolean DARK_THEME;
- @@ -2879,6 +2903,37 @@
- ENABLE_EXP_GAIN_COMMANDS = characterConfig.getBoolean("EnableExpGainCommands", false);
- }
- + public static void loadTVTConfig()
- + {
- + final PropertiesParser tvtConfig = new PropertiesParser(EVENT_TVT_CONFIG_FILE);
- + TVT_EVEN_TEAMS = tvtConfig.getString("TvTEvenTeams", "BALANCE");
- + TVT_ALLOW_INTERFERENCE = tvtConfig.getBoolean("TvTAllowInterference", false);
- + TVT_ALLOW_POTIONS = tvtConfig.getBoolean("TvTAllowPotions", false);
- + TVT_ALLOW_SUMMON = tvtConfig.getBoolean("TvTAllowSummon", false);
- + TVT_ON_START_REMOVE_ALL_EFFECTS = tvtConfig.getBoolean("TvTOnStartRemoveAllEffects", true);
- + TVT_ON_START_UNSUMMON_PET = tvtConfig.getBoolean("TvTOnStartUnsummonPet", true);
- + TVT_REVIVE_RECOVERY = tvtConfig.getBoolean("TvTReviveRecovery", false);
- + TVT_ANNOUNCE_TEAM_STATS = tvtConfig.getBoolean("TvTAnnounceTeamStats", false);
- + TVT_ANNOUNCE_REWARD = tvtConfig.getBoolean("TvTAnnounceReward", false);
- + TVT_PRICE_NO_KILLS = tvtConfig.getBoolean("TvTPriceNoKills", false);
- + TVT_JOIN_CURSED = tvtConfig.getBoolean("TvTJoinWithCursedWeapon", true);
- + TVT_COMMAND = tvtConfig.getBoolean("TvTCommand", true);
- + TVT_REVIVE_DELAY = tvtConfig.getLong("TvTReviveDelay", 20000);
- + if (TVT_REVIVE_DELAY < 1000)
- + {
- + TVT_REVIVE_DELAY = 1000; // can't be set less then 1 second
- + }
- + TVT_OPEN_FORT_DOORS = tvtConfig.getBoolean("TvTOpenFortDoors", false);
- + TVT_CLOSE_FORT_DOORS = tvtConfig.getBoolean("TvTCloseFortDoors", false);
- + TVT_OPEN_ADEN_COLOSSEUM_DOORS = tvtConfig.getBoolean("TvTOpenAdenColosseumDoors", false);
- + TVT_CLOSE_ADEN_COLOSSEUM_DOORS = tvtConfig.getBoolean("TvTCloseAdenColosseumDoors", false);
- + TVT_TOP_KILLER_REWARD = tvtConfig.getInt("TvTTopKillerRewardId", 5575);
- + TVT_TOP_KILLER_QTY = tvtConfig.getInt("TvTTopKillerRewardQty", 2000000);
- + TVT_AURA = tvtConfig.getBoolean("TvTAura", false);
- + TVT_STATS_LOGGER = tvtConfig.getBoolean("TvTStatsLogger", true);
- + TVT_REMOVE_BUFFS_ON_DIE = tvtConfig.getBoolean("TvTRemoveBuffsOnPlayerDie", false);
- + }
- +
- /**
- * Loads all Filter Words
- */
- @@ -3079,6 +3134,7 @@
- loadOlympConfig();
- loadEnchantConfig();
- loadBossConfig();
- + loadTVTConfig();
- // Head functions
- loadCustomServerConfig();
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java
- index 0aff7d1..f2c5091 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java
- @@ -106,6 +106,7 @@
- import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
- import org.l2jmobius.gameserver.instancemanager.SiegeManager;
- import org.l2jmobius.gameserver.instancemanager.TradeManager;
- +import org.l2jmobius.gameserver.instancemanager.events.EventManager;
- import org.l2jmobius.gameserver.instancemanager.events.PcPoint;
- import org.l2jmobius.gameserver.instancemanager.games.Lottery;
- import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
- @@ -402,6 +403,22 @@
- CoupleManager.getInstance();
- }
- + printSection("EventManager");
- + EventManager.getInstance().startEventRegistration();
- +
- + if (EventManager.TVT_EVENT_ENABLED)
- + {
- + if (EventManager.TVT_EVENT_ENABLED)
- + {
- + LOGGER.info("TVT Event is Enabled.");
- + }
- +
- + }
- + else
- + {
- + LOGGER.info("All events are Disabled.");
- + }
- +
- if (Config.PCB_ENABLE)
- {
- ThreadPool.scheduleAtFixedRate(PcPoint.getInstance(), Config.PCB_INTERVAL * 1000, Config.PCB_INTERVAL * 1000);
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java
- index 7c1d9da..573f86c 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/AdminCommandHandler.java
- @@ -81,6 +81,7 @@
- import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTarget;
- import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTeleport;
- import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTest;
- +import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTvTEngine;
- import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminZone;
- /**
- @@ -157,6 +158,7 @@
- registerAdminCommandHandler(new AdminTeleport());
- registerAdminCommandHandler(new AdminTest());
- registerAdminCommandHandler(new AdminZone());
- + registerAdminCommandHandler(new AdminTvTEngine());
- LOGGER.info("AdminCommandHandler: Loaded " + _datatable.size() + " handlers.");
- }
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/VoicedCommandHandler.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/VoicedCommandHandler.java
- index 466e2a6..53d5171 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/VoicedCommandHandler.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/VoicedCommandHandler.java
- @@ -29,6 +29,7 @@
- import org.l2jmobius.gameserver.handler.voicedcommandhandlers.OfflineShop;
- import org.l2jmobius.gameserver.handler.voicedcommandhandlers.Online;
- import org.l2jmobius.gameserver.handler.voicedcommandhandlers.StatsCmd;
- +import org.l2jmobius.gameserver.handler.voicedcommandhandlers.TvTCmd;
- import org.l2jmobius.gameserver.handler.voicedcommandhandlers.VoiceCommand;
- import org.l2jmobius.gameserver.handler.voicedcommandhandlers.Wedding;
- @@ -89,6 +90,11 @@
- registerVoicedCommandHandler(new AutoPotion());
- }
- + if (Config.TVT_COMMAND)
- + {
- + registerVoicedCommandHandler(new TvTCmd());
- + }
- +
- LOGGER.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
- }
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminTvTEngine.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminTvTEngine.java
- new file mode 100644
- index 0000000..0970af3
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminTvTEngine.java
- @@ -0,0 +1,474 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.handler.admincommandhandlers;
- +
- +import java.util.StringTokenizer;
- +
- +import org.l2jmobius.Config;
- +import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- +import org.l2jmobius.gameserver.model.Location;
- +import org.l2jmobius.gameserver.model.World;
- +import org.l2jmobius.gameserver.model.actor.Player;
- +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
- +import org.l2jmobius.gameserver.util.BuilderUtil;
- +
- +public class AdminTvTEngine implements IAdminCommandHandler
- +{
- + private static final String[] ADMIN_COMMANDS =
- + {
- + "admin_tvt",
- + "admin_tvt_name",
- + "admin_tvt_desc",
- + "admin_tvt_join_loc",
- + "admin_tvt_minLevel",
- + "admin_tvt_maxLevel",
- + "admin_tvt_npc",
- + "admin_tvt_npc_pos",
- + "admin_tvt_reward",
- + "admin_tvt_reward_amount",
- + "admin_tvt_team_add",
- + "admin_tvt_team_remove",
- + "admin_tvt_team_pos",
- + "admin_tvt_team_color",
- + "admin_tvt_join",
- + "admin_tvt_teleport",
- + "admin_tvt_start",
- + "admin_tvt_abort",
- + "admin_tvt_finish",
- + "admin_tvt_sit",
- + "admin_tvt_dump",
- + "admin_tvt_save",
- + "admin_tvt_load",
- + "admin_tvt_jointime",
- + "admin_tvt_eventtime",
- + "admin_tvt_autoevent",
- + "admin_tvt_startevent",
- + "admin_tvt_minplayers",
- + "admin_tvt_maxplayers",
- + "admin_tvtkick",
- + "admin_tvt_interval"
- + };
- +
- + @Override
- + public boolean useAdminCommand(String command, Player activeChar)
- + {
- + if (command.equals("admin_tvt"))
- + {
- + showMainPage(activeChar);
- + }
- + else if (command.startsWith("admin_tvt_name "))
- + {
- + if (TvT.setEventName(command.substring(15)))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_desc "))
- + {
- + if (TvT.setEventDesc(command.substring(15)))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_minLevel "))
- + {
- + if (!TvT.checkMinLevel(Integer.parseInt(command.substring(17))))
- + {
- + return false;
- + }
- +
- + if (TvT.setMinlvl(Integer.parseInt(command.substring(17))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_maxLevel "))
- + {
- + if (!TvT.checkMaxLevel(Integer.parseInt(command.substring(17))))
- + {
- + return false;
- + }
- +
- + if (TvT.setMaxlvl(Integer.parseInt(command.substring(17))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_minplayers "))
- + {
- + if (TvT.setMinPlayers(Integer.parseInt(command.substring(21))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_maxplayers "))
- + {
- + if (TvT.setMaxPlayers(Integer.parseInt(command.substring(21))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_join_loc "))
- + {
- + if (TvT.setJoiningLocationName(command.substring(19)))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_npc "))
- + {
- + if (TvT.setNpcId(Integer.parseInt(command.substring(14))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.equals("admin_tvt_npc_pos"))
- + {
- + TvT.setNpcPos(activeChar);
- + showMainPage(activeChar);
- + }
- + else if (command.startsWith("admin_tvt_reward "))
- + {
- + if (TvT.setRewardId(Integer.parseInt(command.substring(17))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_reward_amount "))
- + {
- + if (TvT.setRewardAmount(Integer.parseInt(command.substring(24))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_jointime "))
- + {
- + if (TvT.setJoinTime(Integer.parseInt(command.substring(19))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_eventtime "))
- + {
- + if (TvT.setEventTime(Integer.parseInt(command.substring(20))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_interval "))
- + {
- + if (TvT.setIntervalBetweenMatches(Integer.parseInt(command.substring(20))))
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, event in progress");
- + }
- + }
- + else if (command.startsWith("admin_tvt_team_add "))
- + {
- + final String teamName = command.substring(19);
- + TvT.addTeam(teamName);
- + showMainPage(activeChar);
- + }
- + else if (command.startsWith("admin_tvt_team_remove "))
- + {
- + final String teamName = command.substring(22);
- + TvT.removeTeam(teamName);
- + showMainPage(activeChar);
- + }
- + else if (command.startsWith("admin_tvt_team_pos "))
- + {
- + final String teamName = command.substring(19);
- + TvT.setTeamPos(teamName, activeChar);
- + showMainPage(activeChar);
- + }
- + else if (command.startsWith("admin_tvt_team_color "))
- + {
- + String[] params;
- + params = command.split(" ");
- + if (params.length != 3)
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Wrong usege: //tvt_team_color <colorHex> <teamName>");
- + return false;
- + }
- +
- + TvT.setTeamColor(command.substring(params[0].length() + params[1].length() + 2), Integer.decode("0x" + params[1]));
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_join"))
- + {
- + if (TvT.startJoin())
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot startJoin, check LOGGER for info..");
- + }
- + }
- + else if (command.equals("admin_tvt_teleport"))
- + {
- + TvT.startTeleport();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_start"))
- + {
- + if (TvT.startEvent())
- + {
- + showMainPage(activeChar);
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Cannot startEvent, check LOGGER for info..");
- + }
- + }
- + else if (command.equals("admin_tvt_startevent"))
- + {
- + TvT.eventOnceStart();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_abort"))
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Aborting event");
- + TvT.abortEvent();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_finish"))
- + {
- + TvT.finishEvent();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_sit"))
- + {
- + TvT.sit();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_load"))
- + {
- + TvT.loadData();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_autoevent"))
- + {
- + if ((TvT.getJoinTime() > 0) && (TvT.getEventTime() > 0))
- + {
- + TvT.autoEvent();
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Wrong usege: join time or event time invalid.");
- + }
- +
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_save"))
- + {
- + TvT.saveData();
- + showMainPage(activeChar);
- + }
- + else if (command.equals("admin_tvt_dump"))
- + {
- + TvT.dumpData();
- + }
- + else if (command.startsWith("admin_tvtkick"))
- + {
- + final StringTokenizer st = new StringTokenizer(command);
- + if (st.countTokens() > 1)
- + {
- + st.nextToken();
- + final String plyr = st.nextToken();
- + final Player playerToKick = World.getInstance().getPlayer(plyr);
- + if (playerToKick != null)
- + {
- + TvT.kickPlayerFromTvt(playerToKick);
- + BuilderUtil.sendSysMessage(activeChar, "You kicked " + playerToKick.getName() + " from the TvT.");
- + }
- + else
- + {
- + BuilderUtil.sendSysMessage(activeChar, "Wrong usege: //tvtkick <player>");
- + }
- + }
- + }
- + return true;
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +
- + public void showMainPage(Player activeChar)
- + {
- + final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
- + final StringBuilder replyMSG = new StringBuilder("<html><title>Team vs Team</title><body>");
- + replyMSG.append("<center><font color=\"LEVEL\">[TvT Engine]</font></center><br><br><br>");
- + replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
- + replyMSG.append("<table border=\"0\"><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Name\" action=\"bypass -h admin_tvt_name $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Description\" action=\"bypass -h admin_tvt_desc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Join Location\" action=\"bypass -h admin_tvt_join_loc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Max lvl\" action=\"bypass -h admin_tvt_maxLevel $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Min lvl\" action=\"bypass -h admin_tvt_minLevel $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Max players\" action=\"bypass -h admin_tvt_maxplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Min players\" action=\"bypass -h admin_tvt_minplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_tvt_npc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_tvt_npc_pos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Reward\" action=\"bypass -h admin_tvt_reward $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Reward Amount\" action=\"bypass -h admin_tvt_reward_amount $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Join Time\" action=\"bypass -h admin_tvt_jointime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Event Time\" action=\"bypass -h admin_tvt_eventtime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Interval Time\" action=\"bypass -h admin_tvt_interval $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Team Add\" action=\"bypass -h admin_tvt_team_add $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Team Color\" action=\"bypass -h admin_tvt_team_color $input1 $input2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Team Pos\" action=\"bypass -h admin_tvt_team_pos $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Team Remove\" action=\"bypass -h admin_tvt_team_remove $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Join\" action=\"bypass -h admin_tvt_join\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Teleport\" action=\"bypass -h admin_tvt_teleport\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Start\" action=\"bypass -h admin_tvt_start\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><table><tr>");
- + replyMSG.append("</tr></table><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"StartEventOnceTime\" action=\"bypass -h admin_tvt_startevent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Abort\" action=\"bypass -h admin_tvt_abort\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Finish\" action=\"bypass -h admin_tvt_finish\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Sit Force\" action=\"bypass -h admin_tvt_sit\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Dump\" action=\"bypass -h admin_tvt_dump\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><br><table><tr>");
- + replyMSG.append("<td width=\"100\"><button value=\"Save\" action=\"bypass -h admin_tvt_save\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_tvt_load\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("<td width=\"100\"><button value=\"Auto Event\" action=\"bypass -h admin_tvt_autoevent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
- + replyMSG.append("</tr></table><br><br>");
- + replyMSG.append("Current event:<br1>");
- + replyMSG.append("Name: <font color=\"00FF00\">" + TvT.getEventName() + "</font><br1>");
- + replyMSG.append("Description: <font color=\"00FF00\">" + TvT.getEventDesc() + "</font><br1>");
- + replyMSG.append("Joining location name: <font color=\"00FF00\">" + TvT.getJoiningLocationName() + "</font><br1>");
- +
- + final Location npcLoc = TvT.getNpcLocation();
- + replyMSG.append("Joining NPC ID: <font color=\"00FF00\">" + TvT.getNpcId() + " on pos " + npcLoc.getX() + "," + npcLoc.getY() + "," + npcLoc.getZ() + "</font><br1>");
- + replyMSG.append("Reward ID: <font color=\"00FF00\">" + TvT.getRewardId() + "</font><br1>");
- + replyMSG.append("Reward Amount: <font color=\"00FF00\">" + TvT.getRewardAmount() + "</font><br><br>");
- + replyMSG.append("Min lvl: <font color=\"00FF00\">" + TvT.getMinLevel() + "</font><br>");
- + replyMSG.append("Max lvl: <font color=\"00FF00\">" + TvT.getMaxLevel() + "</font><br><br>");
- + replyMSG.append("Min Players: <font color=\"00FF00\">" + TvT.getMinPlayers() + "</font><br>");
- + replyMSG.append("Max Players: <font color=\"00FF00\">" + TvT.getMaxPlayers() + "</font><br><br>");
- + replyMSG.append("Joining Time: <font color=\"00FF00\">" + TvT.getJoinTime() + "</font><br>");
- + replyMSG.append("Event Timer: <font color=\"00FF00\">" + TvT.getEventTime() + "</font><br><br>");
- + replyMSG.append("Interval Time: <font color=\"00FF00\">" + TvT.getIntervalBetweenMatches() + "</font><br><br>");
- + replyMSG.append("Current teams:<br1>");
- + replyMSG.append("<center><table border=\"0\">");
- + for (String team : TvT._teams)
- + {
- + replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font>");
- + if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + replyMSG.append(" (" + TvT.teamPlayersCount(team) + " joined)");
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + if (TvT.isTeleport() || TvT.isStarted())
- + {
- + replyMSG.append(" (" + TvT.teamPlayersCount(team) + " in)");
- + }
- + }
- +
- + replyMSG.append("</td></tr><tr><td>");
- + replyMSG.append(TvT._teamColors.get(TvT._teams.indexOf(team)));
- + replyMSG.append("</td></tr><tr><td>");
- + replyMSG.append(TvT._teamsX.get(TvT._teams.indexOf(team)) + ", " + TvT._teamsY.get(TvT._teams.indexOf(team)) + ", " + TvT._teamsZ.get(TvT._teams.indexOf(team)));
- + replyMSG.append("</td></tr><tr><td width=\"60\"><button value=\"Remove\" action=\"bypass -h admin_tvt_team_remove " + team + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
- + }
- +
- + replyMSG.append("</table></center>");
- +
- + if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + if (!TvT.isStarted())
- + {
- + replyMSG.append("<br1>");
- + replyMSG.append(TvT._playersShuffle.size() + " players participating. Waiting to shuffle in teams(done on teleport)!");
- + replyMSG.append("<br><br>");
- + }
- + }
- +
- + replyMSG.append("</body></html>");
- + adminReply.setHtml(replyMSG.toString());
- + activeChar.sendPacket(adminReply);
- + }
- +}
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Potions.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Potions.java
- index 424c1cc..67e95ad 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Potions.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/itemhandlers/Potions.java
- @@ -28,6 +28,7 @@
- import org.l2jmobius.gameserver.data.ItemTable;
- import org.l2jmobius.gameserver.data.SkillTable;
- import org.l2jmobius.gameserver.handler.IItemHandler;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Skill;
- import org.l2jmobius.gameserver.model.actor.Playable;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -37,6 +38,7 @@
- import org.l2jmobius.gameserver.model.effects.EffectType;
- import org.l2jmobius.gameserver.model.item.instance.Item;
- import org.l2jmobius.gameserver.network.SystemMessageId;
- +import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
- import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- public class Potions implements IItemHandler
- @@ -203,6 +205,11 @@
- {
- Player activeChar;
- activeChar = (Player) playable;
- + if (activeChar._inEventTvT && TvT.isStarted() && !Config.TVT_ALLOW_POTIONS)
- + {
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- if (activeChar.isInOlympiadMode())
- {
- activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THAT_ITEM_IN_A_GRAND_OLYMPIAD_GAMES_MATCH);
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/skillhandlers/Recall.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/skillhandlers/Recall.java
- index 316d52d..ab9f3f6 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/skillhandlers/Recall.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/skillhandlers/Recall.java
- @@ -21,6 +21,7 @@
- import org.l2jmobius.gameserver.enums.TeleportWhereType;
- import org.l2jmobius.gameserver.handler.ISkillHandler;
- import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Skill;
- import org.l2jmobius.gameserver.model.actor.Creature;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -86,6 +87,11 @@
- targetChar.sendMessage("You can't use escape skill in an event.");
- continue;
- }
- + if ((targetChar._inEventTvT && TvT.isStarted()))
- + {
- + targetChar.sendMessage("You can't use escape skill in Event.");
- + continue;
- + }
- if (targetChar.isInJail())
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
- index 1ccf17c..df14c97 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
- @@ -22,6 +22,7 @@
- import org.l2jmobius.gameserver.enums.TeleportWhereType;
- import org.l2jmobius.gameserver.handler.IUserCommandHandler;
- import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.actor.Player;
- import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
- @@ -46,7 +47,12 @@
- player.sendMessage("You may not use an escape command in a festival.");
- return false;
- }
- -
- + // Check to see if the current player is in TVT Event.
- + if (player._inEventTvT && TvT.isStarted())
- + {
- + player.sendMessage("You may not use an escape skill in TvT.");
- + return false;
- + }
- // Check to see if the current player is in an event.
- if (player.isOnEvent())
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/TvTCmd.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/TvTCmd.java
- new file mode 100644
- index 0000000..2650121
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/TvTCmd.java
- @@ -0,0 +1,179 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.handler.voicedcommandhandlers;
- +
- +import org.l2jmobius.gameserver.data.ItemTable;
- +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- +import org.l2jmobius.gameserver.model.actor.Player;
- +
- +public class TvTCmd implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "tvtjoin",
- + "tvtleave",
- + "tvtinfo"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String target)
- + {
- + if (command.startsWith("tvtjoin"))
- + {
- + JoinTvT(activeChar);
- + }
- + else if (command.startsWith("tvtleave"))
- + {
- + LeaveTvT(activeChar);
- + }
- +
- + else if (command.startsWith("tvtinfo"))
- + {
- + TvTinfo(activeChar);
- + }
- +
- + return true;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +
- + public boolean JoinTvT(Player activeChar)
- + {
- + if (activeChar == null)
- + {
- + return false;
- + }
- +
- + if (!TvT.isJoining())
- + {
- + activeChar.sendMessage("There is no TvT Event in progress.");
- + return false;
- + }
- + else if (TvT.isJoining() && activeChar._inEventTvT)
- + {
- + activeChar.sendMessage("You are already registered.");
- + return false;
- + }
- + else if (activeChar.isCursedWeaponEquipped())
- + {
- + activeChar.sendMessage("You are not allowed to participate to the event because you are holding a Cursed Weapon.");
- + return false;
- + }
- + else if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("You are not allowed to participate to the event because you are in Olympiad.");
- + return false;
- + }
- + else if (activeChar.getLevel() < TvT.getMinLevel())
- + {
- + activeChar.sendMessage("You are not allowed to participate to the event because your level is too low.");
- + return false;
- + }
- + else if (activeChar.getLevel() > TvT.getMaxLevel())
- + {
- + activeChar.sendMessage("You are not allowed to participate to the event because your level is too high.");
- + return false;
- + }
- + else if (activeChar.getKarma() > 0)
- + {
- + activeChar.sendMessage("You are not allowed to participate to the event because you have Karma.");
- + return false;
- + }
- + else if (TvT.isTeleport() || TvT.isStarted())
- + {
- + activeChar.sendMessage("TvT Event registration period is over. You can't register now.");
- + return false;
- + }
- + else
- + {
- + activeChar.sendMessage("Your participation in the TvT event has been approved.");
- + TvT.addPlayer(activeChar, "");
- + return false;
- + }
- + }
- +
- + public boolean LeaveTvT(Player activeChar)
- + {
- + if (activeChar == null)
- + {
- + return false;
- + }
- +
- + if (!TvT.isJoining())
- + {
- + activeChar.sendMessage("There is no TvT Event in progress.");
- + return false;
- + }
- + else if ((TvT.isTeleport() || TvT.isStarted()) && activeChar._inEventTvT)
- + {
- + activeChar.sendMessage("You can not leave now because TvT event has started.");
- + return false;
- + }
- + else if (TvT.isJoining() && !activeChar._inEventTvT)
- + {
- + activeChar.sendMessage("You aren't registered in the TvT Event.");
- + return false;
- + }
- + else
- + {
- + TvT.removePlayer(activeChar);
- + return true;
- + }
- + }
- +
- + public boolean TvTinfo(Player activeChar)
- + {
- + if (activeChar == null)
- + {
- + return false;
- + }
- +
- + if (!TvT.isJoining())
- + {
- + activeChar.sendMessage("There is no TvT Event in progress.");
- + return false;
- + }
- + else if (TvT.isTeleport() || TvT.isStarted())
- + {
- + activeChar.sendMessage("I can't provide you this info. Command available only in joining period.");
- + return false;
- + }
- + else
- + {
- + if (TvT._playersShuffle.size() == 1)
- + {
- + activeChar.sendMessage("There is " + TvT._playersShuffle.size() + " player participating in this event.");
- + activeChar.sendMessage("Reward: " + TvT.getRewardAmount() + " " + ItemTable.getInstance().getTemplate(TvT.getRewardId()).getName() + " !");
- + activeChar.sendMessage("Player Min lvl: " + TvT.getMinLevel() + ".");
- + activeChar.sendMessage("Player Max lvl: " + TvT.getMaxLevel() + ".");
- + }
- + else
- + {
- + activeChar.sendMessage("There are " + TvT._playersShuffle.size() + " players participating in this event.");
- + activeChar.sendMessage("Reward: " + TvT.getRewardAmount() + " " + ItemTable.getInstance().getTemplate(TvT.getRewardId()).getName() + " !");
- + activeChar.sendMessage("Player Min lvl: " + TvT.getMinLevel() + ".");
- + activeChar.sendMessage("Player Max lvl: " + TvT.getMaxLevel() + ".");
- + }
- + return true;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
- index 2dcc812..4cd7c7c 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
- @@ -26,6 +26,7 @@
- import org.l2jmobius.gameserver.instancemanager.CastleManager;
- import org.l2jmobius.gameserver.instancemanager.CoupleManager;
- import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Skill;
- import org.l2jmobius.gameserver.model.World;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -263,6 +264,11 @@
- activeChar.sendMessage("Your partner is in the Olympiad now.");
- return false;
- }
- + if (activeChar._inEventTvT && TvT.isStarted())
- + {
- + activeChar.sendMessage("You may not use go to love in TvT.");
- + return false;
- + }
- else if (partner.isOnEvent())
- {
- activeChar.sendMessage("Your partner is in an event.");
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/EventManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/EventManager.java
- new file mode 100644
- index 0000000..ec5c32e
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/EventManager.java
- @@ -0,0 +1,143 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.instancemanager.events;
- +
- +import java.io.File;
- +import java.io.FileInputStream;
- +import java.io.IOException;
- +import java.io.InputStream;
- +import java.util.ArrayList;
- +import java.util.List;
- +import java.util.Properties;
- +import java.util.logging.Logger;
- +
- +/**
- + * @author Shyla
- + */
- +public class EventManager
- +{
- + protected static final Logger LOGGER = Logger.getLogger(EventManager.class.getName());
- +
- + private static final String EVENT_MANAGER_CONFIGURATION_FILE = "./config/custom/EventManager.ini";
- +
- + public static boolean TVT_EVENT_ENABLED;
- + public static List<String> TVT_TIMES_LIST;
- +
- + public static boolean CTF_EVENT_ENABLED;
- + public static List<String> CTF_TIMES_LIST;
- +
- + public static boolean DM_EVENT_ENABLED;
- + public static List<String> DM_TIMES_LIST;
- +
- + private static EventManager instance = null;
- +
- + private EventManager()
- + {
- + loadConfiguration();
- + }
- +
- + public static EventManager getInstance()
- + {
- + if (instance == null)
- + {
- + instance = new EventManager();
- + }
- + return instance;
- + }
- +
- + public static void loadConfiguration()
- + {
- + InputStream is = null;
- + try
- + {
- + final Properties eventSettings = new Properties();
- + is = new FileInputStream(new File(EVENT_MANAGER_CONFIGURATION_FILE));
- + eventSettings.load(is);
- +
- + TVT_EVENT_ENABLED = Boolean.parseBoolean(eventSettings.getProperty("TVTEventEnabled", "false"));
- + TVT_TIMES_LIST = new ArrayList<>();
- + String[] propertySplit;
- + propertySplit = eventSettings.getProperty("TVTStartTime", "").split(";");
- + for (String time : propertySplit)
- + {
- + TVT_TIMES_LIST.add(time);
- + }
- +
- + CTF_EVENT_ENABLED = Boolean.parseBoolean(eventSettings.getProperty("CTFEventEnabled", "false"));
- + CTF_TIMES_LIST = new ArrayList<>();
- + propertySplit = eventSettings.getProperty("CTFStartTime", "").split(";");
- + for (String time : propertySplit)
- + {
- + CTF_TIMES_LIST.add(time);
- + }
- +
- + DM_EVENT_ENABLED = Boolean.parseBoolean(eventSettings.getProperty("DMEventEnabled", "false"));
- + DM_TIMES_LIST = new ArrayList<>();
- + propertySplit = eventSettings.getProperty("DMStartTime", "").split(";");
- + for (String time : propertySplit)
- + {
- + DM_TIMES_LIST.add(time);
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(e.toString());
- + }
- + finally
- + {
- + if (is != null)
- + {
- + try
- + {
- + is.close();
- + }
- + catch (IOException e)
- + {
- + LOGGER.warning(e.toString());
- + }
- + }
- + }
- + }
- +
- + public void startEventRegistration()
- + {
- + if (TVT_EVENT_ENABLED)
- + {
- + registerTvT();
- + }
- +
- + }
- +
- + private void registerTvT()
- + {
- + TvT.loadData();
- + if (!TvT.checkStartJoinOk())
- + {
- + LOGGER.warning("registerTvT: TvT Event is not setted Properly");
- + }
- +
- + EventsGlobalTask.getInstance().clearEventTasksByEventName(TvT.getEventName());
- +
- + for (String time : TVT_TIMES_LIST)
- + {
- + final TvT newInstance = TvT.getNewInstance();
- + newInstance.setEventStartTime(time);
- + EventsGlobalTask.getInstance().registerNewEventTask(newInstance);
- + }
- + }
- +
- +}
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/GameEvent.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/GameEvent.java
- new file mode 100644
- index 0000000..f2c080f
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/GameEvent.java
- @@ -0,0 +1,358 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.instancemanager.events;
- +
- +import java.io.BufferedInputStream;
- +import java.io.BufferedReader;
- +import java.io.DataInputStream;
- +import java.io.FileInputStream;
- +import java.io.InputStreamReader;
- +import java.util.Iterator;
- +import java.util.LinkedList;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +import java.util.logging.Logger;
- +
- +import org.l2jmobius.gameserver.data.sql.NpcTable;
- +import org.l2jmobius.gameserver.data.sql.SpawnTable;
- +import org.l2jmobius.gameserver.enums.ChatType;
- +import org.l2jmobius.gameserver.model.World;
- +import org.l2jmobius.gameserver.model.actor.Player;
- +import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
- +import org.l2jmobius.gameserver.model.spawn.Spawn;
- +import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
- +import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
- +import org.l2jmobius.gameserver.util.EventData;
- +
- +public class GameEvent
- +{
- + protected static final Logger LOGGER = Logger.getLogger(GameEvent.class.getName());
- +
- + public static final Map<Integer, LinkedList<String>> players = new ConcurrentHashMap<>();
- + public static final Map<String, EventData> connectionLossData = new ConcurrentHashMap<>();
- + public static final Map<Integer, String> names = new ConcurrentHashMap<>();
- + public static final List<String> participatingPlayers = new LinkedList<>();
- + public static final List<String> npcs = new LinkedList<>();
- + public static String eventName = "";
- + public static int teamsNumber = 0;
- + public static boolean active = false;
- + public static int id = 12760;
- +
- + public static int getTeamOfPlayer(String name)
- + {
- + for (int i = 1; i <= players.size(); i++)
- + {
- + final LinkedList<String> temp = players.get(i);
- + final Iterator<String> it = temp.iterator();
- +
- + while (it.hasNext())
- + {
- + if (it.next().equals(name))
- + {
- + return i;
- + }
- + }
- + }
- + return 0;
- + }
- +
- + public static String[] getTopNKillers(int n)
- + {
- + // this will return top N players sorted by kills, first element in the array will be the one with more kills
- + final String[] killers = new String[n];
- + String playerTemp = "";
- + int kills = 0;
- +
- + final LinkedList<String> killersTemp = new LinkedList<>();
- + for (int k = 0; k < n; k++)
- + {
- + kills = 0;
- + for (int i = 1; i <= teamsNumber; i++)
- + {
- + final LinkedList<String> temp = players.get(i);
- + final Iterator<String> it = temp.iterator();
- +
- + while (it.hasNext())
- + {
- + try
- + {
- + final Player player = World.getInstance().getPlayer(it.next());
- + if (!killersTemp.contains(player.getName()) && (player.kills.size() > kills))
- + {
- + kills = player.kills.size();
- + playerTemp = player.getName();
- + }
- + }
- + catch (Exception e)
- + {
- + }
- + }
- + }
- +
- + killersTemp.add(playerTemp);
- + }
- +
- + for (int i = 0; i < n; i++)
- + {
- + kills = 0;
- + final Iterator<String> it = killersTemp.iterator();
- +
- + while (it.hasNext())
- + {
- + try
- + {
- + final Player player = World.getInstance().getPlayer(it.next());
- + if (player.kills.size() > kills)
- + {
- + kills = player.kills.size();
- + playerTemp = player.getName();
- + }
- + }
- + catch (Exception e)
- + {
- + }
- + }
- +
- + killers[i] = playerTemp;
- + killersTemp.remove(playerTemp);
- + }
- +
- + return killers;
- + }
- +
- + public static void showEventHtml(Player player, String objectid)
- + {
- + FileInputStream fis = null;
- + BufferedInputStream buff = null;
- + DataInputStream in = null;
- + InputStreamReader isr = null;
- + BufferedReader inbr = null;
- +
- + try
- + {
- + final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
- + fis = new FileInputStream("data/events/" + eventName);
- + buff = new BufferedInputStream(fis);
- + in = new DataInputStream(buff);
- + isr = new InputStreamReader(in);
- + inbr = new BufferedReader(isr);
- +
- + final StringBuilder replyMSG = new StringBuilder("<html><body>");
- + replyMSG.append("<center><font color=\"LEVEL\">" + eventName + "</font><font color=\"FF0000\"> bY " + inbr.readLine() + "</font></center><br>");
- + replyMSG.append("<br>" + inbr.readLine());
- + if (participatingPlayers.contains(player.getName()))
- + {
- + replyMSG.append("<br><center>You are already in the event players list !!</center></body></html>");
- + }
- + else
- + {
- + replyMSG.append("<br><center><button value=\"Participate !! \" action=\"bypass -h npc_" + objectid + "_event_participate\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
- + }
- +
- + adminReply.setHtml(replyMSG.toString());
- + player.sendPacket(adminReply);
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(e.getMessage());
- + }
- + finally
- + {
- + if (inbr != null)
- + {
- + try
- + {
- + inbr.close();
- + }
- + catch (Exception e1)
- + {
- + LOGGER.warning(e1.toString());
- + }
- + }
- +
- + if (isr != null)
- + {
- + try
- + {
- + isr.close();
- + }
- + catch (Exception e1)
- + {
- + LOGGER.warning(e1.toString());
- + }
- + }
- +
- + if (in != null)
- + {
- + try
- + {
- + in.close();
- + }
- + catch (Exception e1)
- + {
- + LOGGER.warning(e1.toString());
- + }
- + }
- +
- + if (buff != null)
- + {
- + try
- + {
- + buff.close();
- + }
- + catch (Exception e1)
- + {
- + LOGGER.warning(e1.toString());
- + }
- + }
- +
- + if (fis != null)
- + {
- + try
- + {
- + fis.close();
- + }
- + catch (Exception e1)
- + {
- + LOGGER.warning(e1.toString());
- + }
- + }
- + }
- + }
- +
- + public static void spawn(Player target, int npcid)
- + {
- + final NpcTemplate template1 = NpcTable.getInstance().getTemplate(npcid);
- +
- + try
- + {
- + final Spawn spawn = new Spawn(template1);
- + spawn.setX(target.getX() + 50);
- + spawn.setY(target.getY() + 50);
- + spawn.setZ(target.getZ());
- + spawn.setAmount(1);
- + spawn.setHeading(target.getHeading());
- + spawn.setRespawnDelay(1);
- +
- + SpawnTable.getInstance().addNewSpawn(spawn, false);
- + spawn.init();
- + spawn.getLastSpawn().getStatus().setCurrentHp(999999999);
- + spawn.getLastSpawn().setName("event inscriptor");
- + spawn.getLastSpawn().setTitle(eventName);
- + spawn.getLastSpawn().isEventMob = true;
- + spawn.getLastSpawn().isAggressive();
- + spawn.getLastSpawn().decayMe();
- + spawn.getLastSpawn().spawnMe(spawn.getLastSpawn().getX(), spawn.getLastSpawn().getY(), spawn.getLastSpawn().getZ());
- + spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1));
- + npcs.add(String.valueOf(spawn.getLastSpawn().getObjectId()));
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(e.getMessage());
- + }
- + }
- +
- + public static void announceAllPlayers(String text)
- + {
- + final CreatureSay cs = new CreatureSay(0, ChatType.ANNOUNCEMENT, "", text);
- + for (Player player : World.getInstance().getAllPlayers())
- + {
- + player.sendPacket(cs);
- + }
- + }
- +
- + public static boolean isOnEvent(Player player)
- + {
- + for (int k = 0; k < teamsNumber; k++)
- + {
- + final Iterator<String> it = players.get(k + 1).iterator();
- + boolean temp = false;
- +
- + while (it.hasNext())
- + {
- + temp = player.getName().equalsIgnoreCase(it.next());
- + if (temp)
- + {
- + return true;
- + }
- + }
- + }
- + return false;
- + }
- +
- + public static void inscribePlayer(Player player)
- + {
- + try
- + {
- + participatingPlayers.add(player.getName());
- + player.eventKarma = player.getKarma();
- + player.eventX = player.getX();
- + player.eventY = player.getY();
- + player.eventZ = player.getZ();
- + player.eventPkKills = player.getPkKills();
- + player.eventPvpKills = player.getPvpKills();
- + player.eventTitle = player.getTitle();
- + player.kills.clear();
- + player.atEvent = true;
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning("error when signing in the event:" + e.getMessage());
- + }
- + }
- +
- + public static void restoreChar(Player player)
- + {
- + try
- + {
- + player.eventX = connectionLossData.get(player.getName()).eventX;
- + player.eventY = connectionLossData.get(player.getName()).eventY;
- + player.eventZ = connectionLossData.get(player.getName()).eventZ;
- + player.eventKarma = connectionLossData.get(player.getName()).eventKarma;
- + player.eventPvpKills = connectionLossData.get(player.getName()).eventPvpKills;
- + player.eventPkKills = connectionLossData.get(player.getName()).eventPkKills;
- + player.eventTitle = connectionLossData.get(player.getName()).eventTitle;
- + player.kills = connectionLossData.get(player.getName()).kills;
- + player.eventSitForced = connectionLossData.get(player.getName()).eventSitForced;
- + player.atEvent = true;
- + }
- + catch (Exception e)
- + {
- + }
- + }
- +
- + public static void restoreAndTeleChar(Player target)
- + {
- + try
- + {
- + restoreChar(target);
- + target.setTitle(target.eventTitle);
- + target.setKarma(target.eventKarma);
- + target.setPvpKills(target.eventPvpKills);
- + target.setPkKills(target.eventPkKills);
- + target.teleToLocation(target.eventX, target.eventY, target.eventZ);
- + target.kills.clear();
- + target.eventSitForced = false;
- + target.atEvent = false;
- + }
- + catch (Exception e)
- + {
- + }
- + }
- +}
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/TvT.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/TvT.java
- new file mode 100644
- index 0000000..16a7eef
- --- /dev/null
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/events/TvT.java
- @@ -0,0 +1,2770 @@
- +/*
- + * This file is part of the L2J Mobius project.
- + *
- + * This program is free software: you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation, either version 3 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package org.l2jmobius.gameserver.instancemanager.events;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.util.ArrayList;
- +import java.util.List;
- +import java.util.logging.Logger;
- +
- +import org.l2jmobius.Config;
- +import org.l2jmobius.commons.database.DatabaseFactory;
- +import org.l2jmobius.commons.threads.ThreadPool;
- +import org.l2jmobius.commons.util.Rnd;
- +import org.l2jmobius.gameserver.data.ItemTable;
- +import org.l2jmobius.gameserver.data.SkillTable;
- +import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
- +import org.l2jmobius.gameserver.data.sql.NpcTable;
- +import org.l2jmobius.gameserver.data.sql.SpawnTable;
- +import org.l2jmobius.gameserver.data.xml.DoorData;
- +import org.l2jmobius.gameserver.instancemanager.CastleManager;
- +import org.l2jmobius.gameserver.model.Location;
- +import org.l2jmobius.gameserver.model.Party;
- +import org.l2jmobius.gameserver.model.World;
- +import org.l2jmobius.gameserver.model.actor.Player;
- +import org.l2jmobius.gameserver.model.actor.Summon;
- +import org.l2jmobius.gameserver.model.actor.instance.Pet;
- +import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
- +import org.l2jmobius.gameserver.model.olympiad.Olympiad;
- +import org.l2jmobius.gameserver.model.siege.Castle;
- +import org.l2jmobius.gameserver.model.spawn.Spawn;
- +import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
- +import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
- +import org.l2jmobius.gameserver.network.serverpackets.Ride;
- +import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
- +
- +public class TvT implements EventTask
- +{
- + protected static final Logger LOGGER = Logger.getLogger(TvT.class.getName());
- +
- + protected static String _eventName = "";
- + protected static String _eventDesc = "";
- + protected static String _joiningLocationName = "";
- + private static Spawn _npcSpawn;
- + protected static boolean _joining = false;
- + protected static boolean _teleport = false;
- + protected static boolean _started = false;
- + protected static boolean _aborted = false;
- + protected static boolean _sitForced = false;
- + protected static boolean _inProgress = false;
- + protected static int _npcId = 0;
- + protected static int _npcX = 0;
- + protected static int _npcY = 0;
- + protected static int _npcZ = 0;
- + protected static int _npcHeading = 0;
- + protected static int _rewardId = 0;
- + protected static int _rewardAmount = 0;
- + protected static int _minLevel = 0;
- + protected static int _maxLevel = 0;
- + protected static int _joinTime = 0;
- + protected static int _eventTime = 0;
- + protected static int _minPlayers = 0;
- + protected static int _maxPlayers = 0;
- + protected static long _intervalBetweenMatches = 0;
- + private String startEventTime;
- + private static boolean _teamEvent = true; // TODO to be integrated
- + public static List<Player> _players = new ArrayList<>();
- + private static String _topTeam = "";
- + public static List<Player> _playersShuffle = new ArrayList<>();
- + public static List<String> _teams = new ArrayList<>();
- + public static List<String> _savePlayers = new ArrayList<>();
- + public static List<String> _savePlayerTeams = new ArrayList<>();
- + public static List<Integer> _teamPlayersCount = new ArrayList<>();
- + public static List<Integer> _teamColors = new ArrayList<>();
- + public static List<Integer> _teamsX = new ArrayList<>();
- + public static List<Integer> _teamsY = new ArrayList<>();
- + public static List<Integer> _teamsZ = new ArrayList<>();
- + public static List<Integer> _teamPointsCount = new ArrayList<>();
- + public static int _topKills = 0;
- +
- + /**
- + * Instantiates a new tvt.
- + */
- + private TvT()
- + {
- + }
- +
- + /**
- + * Gets the new instance.
- + * @return the new instance
- + */
- + public static TvT getNewInstance()
- + {
- + return new TvT();
- + }
- +
- + /**
- + * Gets the _event name.
- + * @return the _eventName
- + */
- + public static String getEventName()
- + {
- + return _eventName;
- + }
- +
- + /**
- + * Set_event name.
- + * @param eventName the _eventName to set
- + * @return true, if successful
- + */
- + public static boolean setEventName(String eventName)
- + {
- + if (!_inProgress)
- + {
- + TvT._eventName = eventName;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _event desc.
- + * @return the _eventDesc
- + */
- + public static String getEventDesc()
- + {
- + return _eventDesc;
- + }
- +
- + /**
- + * Set_event desc.
- + * @param eventDesc the _eventDesc to set
- + * @return true, if successful
- + */
- + public static boolean setEventDesc(String eventDesc)
- + {
- + if (!_inProgress)
- + {
- + TvT._eventDesc = eventDesc;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _joining location name.
- + * @return the _joiningLocationName
- + */
- + public static String getJoiningLocationName()
- + {
- + return _joiningLocationName;
- + }
- +
- + /**
- + * Set_joining location name.
- + * @param joiningLocationName the _joiningLocationName to set
- + * @return true, if successful
- + */
- + public static boolean setJoiningLocationName(String joiningLocationName)
- + {
- + if (!_inProgress)
- + {
- + TvT._joiningLocationName = joiningLocationName;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _npc id.
- + * @return the _npcId
- + */
- + public static int getNpcId()
- + {
- + return _npcId;
- + }
- +
- + /**
- + * Set_npc id.
- + * @param npcId the _npcId to set
- + * @return true, if successful
- + */
- + public static boolean setNpcId(int npcId)
- + {
- + if (!_inProgress)
- + {
- + TvT._npcId = npcId;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _npc location.
- + * @return the _npc location
- + */
- + public static Location getNpcLocation()
- + {
- + return new Location(_npcX, _npcY, _npcZ, _npcHeading);
- + }
- +
- + /**
- + * Gets the _reward id.
- + * @return the _rewardId
- + */
- + public static int getRewardId()
- + {
- + return _rewardId;
- + }
- +
- + /**
- + * Set_reward id.
- + * @param rewardId the _rewardId to set
- + * @return true, if successful
- + */
- + public static boolean setRewardId(int rewardId)
- + {
- + if (!_inProgress)
- + {
- + TvT._rewardId = rewardId;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _reward amount.
- + * @return the _rewardAmount
- + */
- + public static int getRewardAmount()
- + {
- + return _rewardAmount;
- + }
- +
- + /**
- + * Set_reward amount.
- + * @param rewardAmount the _rewardAmount to set
- + * @return true, if successful
- + */
- + public static boolean setRewardAmount(int rewardAmount)
- + {
- + if (!_inProgress)
- + {
- + TvT._rewardAmount = rewardAmount;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _minLevel.
- + * @return the _minLevel
- + */
- + public static int getMinLevel()
- + {
- + return _minLevel;
- + }
- +
- + /**
- + * Set_minLevel.
- + * @param minLevel the _minLevel to set
- + * @return true, if successful
- + */
- + public static boolean setMinlvl(int minLevel)
- + {
- + if (!_inProgress)
- + {
- + TvT._minLevel = minLevel;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _maxLevel.
- + * @return the _maxLevel
- + */
- + public static int getMaxLevel()
- + {
- + return _maxLevel;
- + }
- +
- + /**
- + * Set_maxLevel.
- + * @param maxLevel the _maxLevel to set
- + * @return true, if successful
- + */
- + public static boolean setMaxlvl(int maxLevel)
- + {
- + if (!_inProgress)
- + {
- + TvT._maxLevel = maxLevel;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _join time.
- + * @return the _joinTime
- + */
- + public static int getJoinTime()
- + {
- + return _joinTime;
- + }
- +
- + /**
- + * Set_join time.
- + * @param joinTime the _joinTime to set
- + * @return true, if successful
- + */
- + public static boolean setJoinTime(int joinTime)
- + {
- + if (!_inProgress)
- + {
- + TvT._joinTime = joinTime;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _event time.
- + * @return the _eventTime
- + */
- + public static int getEventTime()
- + {
- + return _eventTime;
- + }
- +
- + /**
- + * Set_event time.
- + * @param eventTime the _eventTime to set
- + * @return true, if successful
- + */
- + public static boolean setEventTime(int eventTime)
- + {
- + if (!_inProgress)
- + {
- + TvT._eventTime = eventTime;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _min players.
- + * @return the _minPlayers
- + */
- + public static int getMinPlayers()
- + {
- + return _minPlayers;
- + }
- +
- + /**
- + * Set_min players.
- + * @param minPlayers the _minPlayers to set
- + * @return true, if successful
- + */
- + public static boolean setMinPlayers(int minPlayers)
- + {
- + if (!_inProgress)
- + {
- + TvT._minPlayers = minPlayers;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _max players.
- + * @return the _maxPlayers
- + */
- + public static int getMaxPlayers()
- + {
- + return _maxPlayers;
- + }
- +
- + /**
- + * Set_max players.
- + * @param maxPlayers the _maxPlayers to set
- + * @return true, if successful
- + */
- + public static boolean setMaxPlayers(int maxPlayers)
- + {
- + if (!_inProgress)
- + {
- + TvT._maxPlayers = maxPlayers;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the _interval between matches.
- + * @return the _intervalBetweenMatches
- + */
- + public static long getIntervalBetweenMatches()
- + {
- + return _intervalBetweenMatches;
- + }
- +
- + /**
- + * Set_interval between matches.
- + * @param intervalBetweenMatches the _intervalBetweenMatches to set
- + * @return true, if successful
- + */
- + public static boolean setIntervalBetweenMatches(long intervalBetweenMatches)
- + {
- + if (!_inProgress)
- + {
- + TvT._intervalBetweenMatches = intervalBetweenMatches;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Gets the start event time.
- + * @return the startEventTime
- + */
- + public String getStartEventTime()
- + {
- + return startEventTime;
- + }
- +
- + /**
- + * Sets the start event time.
- + * @param startEventTime the startEventTime to set
- + * @return true, if successful
- + */
- + public boolean setStartEventTime(String startEventTime)
- + {
- + if (!_inProgress)
- + {
- + this.startEventTime = startEventTime;
- + return true;
- + }
- + return false;
- + }
- +
- + /**
- + * Checks if is _joining.
- + * @return the _joining
- + */
- + public static boolean isJoining()
- + {
- + return _joining;
- + }
- +
- + /**
- + * Checks if is _teleport.
- + * @return the _teleport
- + */
- + public static boolean isTeleport()
- + {
- + return _teleport;
- + }
- +
- + /**
- + * Checks if is _started.
- + * @return the _started
- + */
- + public static boolean isStarted()
- + {
- + return _started;
- + }
- +
- + /**
- + * Checks if is _aborted.
- + * @return the _aborted
- + */
- + public static boolean isAborted()
- + {
- + return _aborted;
- + }
- +
- + /**
- + * Checks if is _sit forced.
- + * @return the _sitForced
- + */
- + public static boolean isSitForced()
- + {
- + return _sitForced;
- + }
- +
- + /**
- + * Checks if is _in progress.
- + * @return the _inProgress
- + */
- + public static boolean isInProgress()
- + {
- + return _inProgress;
- + }
- +
- + /**
- + * Check max level.
- + * @param maxLevel the maxLevel
- + * @return true, if successful
- + */
- + public static boolean checkMaxLevel(int maxLevel)
- + {
- + return _minLevel < maxLevel;
- + }
- +
- + /**
- + * Check min level.
- + * @param minLevel the minLevel
- + * @return true, if successful
- + */
- + public static boolean checkMinLevel(int minLevel)
- + {
- + return _maxLevel > minLevel;
- + }
- +
- + /**
- + * returns true if participated players is higher or equal then minimum needed players.
- + * @param players the players
- + * @return true, if successful
- + */
- + public static boolean checkMinPlayers(int players)
- + {
- + return _minPlayers <= players;
- + }
- +
- + /**
- + * returns true if max players is higher or equal then participated players.
- + * @param players the players
- + * @return true, if successful
- + */
- + public static boolean checkMaxPlayers(int players)
- + {
- + return _maxPlayers > players;
- + }
- +
- + /**
- + * Check start join ok.
- + * @return true, if successful
- + */
- + public static boolean checkStartJoinOk()
- + {
- + if (_started || _teleport || _joining || _eventName.equals("") || _joiningLocationName.equals("") || _eventDesc.equals("") || (_npcId == 0) || (_npcX == 0) || (_npcY == 0) || (_npcZ == 0) || (_rewardId == 0) || (_rewardAmount == 0))
- + {
- + return false;
- + }
- +
- + if (_teamEvent)
- + {
- + if (!checkStartJoinTeamInfo())
- + {
- + return false;
- + }
- + }
- + else if (!checkStartJoinPlayerInfo())
- + {
- + return false;
- + }
- +
- + if (!Config.ALLOW_EVENTS_DURING_OLY && Olympiad.getInstance().inCompPeriod())
- + {
- + return false;
- + }
- +
- + for (Castle castle : CastleManager.getInstance().getCastles())
- + {
- + if ((castle != null) && (castle.getSiege() != null) && castle.getSiege().isInProgress())
- + {
- + return false;
- + }
- + }
- +
- + if (!checkOptionalEventStartJoinOk())
- + {
- + return false;
- + }
- +
- + return true;
- + }
- +
- + /**
- + * Check start join team info.
- + * @return true, if successful
- + */
- + private static boolean checkStartJoinTeamInfo()
- + {
- + return (_teams.size() >= 2) && !_teamsX.contains(0) && !_teamsY.contains(0) && !_teamsZ.contains(0);
- + }
- +
- + /**
- + * Check start join player info.
- + * @return true, if successful
- + */
- + private static boolean checkStartJoinPlayerInfo()
- + {
- + // TODO be integrated
- + return true;
- + }
- +
- + /**
- + * Check auto event start join ok.
- + * @return true, if successful
- + */
- + protected static boolean checkAutoEventStartJoinOk()
- + {
- + return (_joinTime != 0) && (_eventTime != 0);
- + }
- +
- + /**
- + * Check optional event start join ok.
- + * @return true, if successful
- + */
- + private static boolean checkOptionalEventStartJoinOk()
- + {
- + // TODO be integrated
- + return true;
- + }
- +
- + /**
- + * Sets the npc pos.
- + * @param player the new npc pos
- + */
- + public static void setNpcPos(Player player)
- + {
- + _npcX = player.getX();
- + _npcY = player.getY();
- + _npcZ = player.getZ();
- + _npcHeading = player.getHeading();
- + }
- +
- + /**
- + * Spawn event npc.
- + */
- + private static void spawnEventNpc()
- + {
- + final NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
- +
- + try
- + {
- + _npcSpawn = new Spawn(tmpl);
- + _npcSpawn.setX(_npcX);
- + _npcSpawn.setY(_npcY);
- + _npcSpawn.setZ(_npcZ);
- + _npcSpawn.setAmount(1);
- + _npcSpawn.setHeading(_npcHeading);
- + _npcSpawn.setRespawnDelay(1);
- +
- + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
- + _npcSpawn.init();
- + _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
- + _npcSpawn.getLastSpawn().setTitle(_eventName);
- + _npcSpawn.getLastSpawn()._isEventMobTvT = true;
- + _npcSpawn.getLastSpawn().isAggressive();
- + _npcSpawn.getLastSpawn().decayMe();
- + _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
- + _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUse(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(_eventName + " Engine[spawnEventNpc(exception: " + e.getMessage());
- + }
- + }
- +
- + /**
- + * Unspawn event npc.
- + */
- + private static void unspawnEventNpc()
- + {
- + if ((_npcSpawn == null) || (_npcSpawn.getLastSpawn() == null))
- + {
- + return;
- + }
- +
- + _npcSpawn.getLastSpawn().deleteMe();
- + _npcSpawn.stopRespawn();
- + SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
- + }
- +
- + /**
- + * Start join.
- + * @return true, if successful
- + */
- + public static boolean startJoin()
- + {
- + if (!checkStartJoinOk())
- + {
- + return false;
- + }
- +
- + _inProgress = true;
- + _joining = true;
- + spawnEventNpc();
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Event " + _eventName + "!");
- + if (Config.TVT_ANNOUNCE_REWARD && (ItemTable.getInstance().getTemplate(_rewardId) != null))
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Reward: " + _rewardAmount + " " + ItemTable.getInstance().getTemplate(_rewardId).getName());
- + }
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Recruiting levels: " + _minLevel + " to " + _maxLevel);
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Joinable in " + _joiningLocationName + ".");
- + if (Config.TVT_COMMAND)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Commands .tvtjoin .tvtleave .tvtinfo");
- + }
- +
- + return true;
- + }
- +
- + /**
- + * Start teleport.
- + * @return true, if successful
- + */
- + public static boolean startTeleport()
- + {
- + if (!_joining || _started || _teleport)
- + {
- + return false;
- + }
- +
- + removeOfflinePlayers();
- +
- + if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE") && checkMinPlayers(_playersShuffle.size()))
- + {
- + shuffleTeams();
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE") && !checkMinPlayers(_playersShuffle.size()))
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Not enough players for event. Min Requested : " + _minPlayers + ", Participating : " + _playersShuffle.size());
- +
- + return false;
- + }
- +
- + _joining = false;
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Teleport to team spot in 20 seconds!");
- + setUserData();
- + ThreadPool.schedule(() ->
- + {
- + sit();
- +
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + // Remove Summon's buffs
- + if (Config.TVT_ON_START_UNSUMMON_PET && (player.getPet() != null))
- + {
- + final Summon summon = player.getPet();
- + summon.stopAllEffects();
- +
- + if (summon instanceof Pet)
- + {
- + summon.unSummon(player);
- + }
- + }
- +
- + if (Config.TVT_ON_START_REMOVE_ALL_EFFECTS)
- + {
- + player.stopAllEffects();
- + }
- +
- + // Remove player from his party
- + if (player.getParty() != null)
- + {
- + final Party party = player.getParty();
- + party.removePartyMember(player);
- + }
- +
- + player.teleToLocation((_teamsX.get(_teams.indexOf(player._teamNameTvT)) + Rnd.get(201)) - 100, (_teamsY.get(_teams.indexOf(player._teamNameTvT)) + Rnd.get(201)) - 100, _teamsZ.get(_teams.indexOf(player._teamNameTvT)));
- + }
- + }
- + }
- + }, 20000);
- + _teleport = true;
- + return true;
- + }
- +
- + /**
- + * Start event.
- + * @return true, if successful
- + */
- + public static boolean startEvent()
- + {
- + if (!startEventOk())
- + {
- + return false;
- + }
- +
- + _teleport = false;
- + sit();
- +
- + if (Config.TVT_CLOSE_FORT_DOORS)
- + {
- + closeFortDoors();
- + }
- +
- + if (Config.TVT_CLOSE_ADEN_COLOSSEUM_DOORS)
- + {
- + closeAdenColosseumDoors();
- + }
- +
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Started. Go to kill your enemies!");
- + _started = true;
- + return true;
- + }
- +
- + /**
- + * Restarts Event checks if event was aborted. and if true cancels restart task
- + */
- + public static synchronized void restartEvent()
- + {
- + LOGGER.info(_eventName + ": Event has been restarted...");
- + _joining = false;
- + _started = false;
- + _inProgress = false;
- + _aborted = false;
- + final long delay = _intervalBetweenMatches;
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": joining period will be avaible again in " + _intervalBetweenMatches + " minute(s)!");
- + waiter(delay);
- +
- + try
- + {
- + if (!_aborted)
- + {
- + autoEvent(); // start a new event
- + }
- + else
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": next event aborted!");
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(_eventName + ": Error While Trying to restart Event... " + e);
- + }
- + }
- +
- + /**
- + * Finish event.
- + */
- + public static void finishEvent()
- + {
- + if (!finishEventOk())
- + {
- + return;
- + }
- +
- + _started = false;
- + _aborted = false;
- + unspawnEventNpc();
- +
- + afterFinishOperations();
- +
- + if (_teamEvent)
- + {
- + processTopTeam();
- + synchronized (_players)
- + {
- + final Player bestKiller = findBestKiller(_players);
- + final Player looser = findLooser(_players);
- + if (_topKills != 0)
- + {
- + playKneelAnimation(_topTeam);
- +
- + if (Config.TVT_ANNOUNCE_TEAM_STATS)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + " Team Statistics:");
- + for (String team : _teams)
- + {
- + final int _kills = teamKillsCount(team);
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Team: " + team + " - Kills: " + _kills);
- + }
- +
- + if (bestKiller != null)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Top killer: " + bestKiller.getName() + " - Kills: " + bestKiller._countTvTkills);
- + }
- + if ((looser != null) && (!looser.equals(bestKiller)))
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Top looser: " + looser.getName() + " - Dies: " + looser._countTvTdies);
- + }
- + }
- +
- + if (_topTeam != null)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + _topTeam + "'s win the match! " + _topKills + " kills.");
- + }
- + else
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": The event finished with a TIE: " + _topKills + " kills by each team!");
- + }
- + rewardTeam(_topTeam, bestKiller, looser);
- + if (Config.TVT_STATS_LOGGER)
- + {
- + LOGGER.info("**** " + _eventName + " ****");
- + LOGGER.info(_eventName + " Team Statistics:");
- + for (String team : _teams)
- + {
- + final int _kills = teamKillsCount(team);
- + LOGGER.info("Team: " + team + " - Kills: " + _kills);
- + }
- +
- + if (bestKiller != null)
- + {
- + LOGGER.info("Top killer: " + bestKiller.getName() + " - Kills: " + bestKiller._countTvTkills);
- + }
- + if ((looser != null) && (!looser.equals(bestKiller)))
- + {
- + LOGGER.info("Top looser: " + looser.getName() + " - Dies: " + looser._countTvTdies);
- + }
- +
- + LOGGER.info(_eventName + ": " + _topTeam + "'s win the match! " + _topKills + " kills.");
- + }
- + }
- + else
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": The event finished with a TIE: No team wins the match(nobody killed)!");
- + if (Config.TVT_STATS_LOGGER)
- + {
- + LOGGER.info(_eventName + ": No team win the match(nobody killed).");
- + }
- +
- + rewardTeam(_topTeam, bestKiller, looser);
- + }
- + }
- + }
- + else
- + {
- + processTopPlayer();
- + }
- +
- + teleportFinish();
- + }
- +
- + /**
- + * After finish operations.
- + */
- + private static void afterFinishOperations()
- + {
- + if (Config.TVT_OPEN_FORT_DOORS)
- + {
- + openFortDoors();
- + }
- +
- + if (Config.TVT_OPEN_ADEN_COLOSSEUM_DOORS)
- + {
- + openAdenColosseumDoors();
- + }
- + }
- +
- + /**
- + * Abort event.
- + */
- + public static void abortEvent()
- + {
- + if (!_joining && !_teleport && !_started)
- + {
- + return;
- + }
- +
- + if (_joining && !_teleport && !_started)
- + {
- + unspawnEventNpc();
- + cleanTvT();
- + _joining = false;
- + _inProgress = false;
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Match aborted!");
- + return;
- + }
- + _joining = false;
- + _teleport = false;
- + _started = false;
- + _aborted = true;
- + unspawnEventNpc();
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Match aborted!");
- + teleportFinish();
- + }
- +
- + /**
- + * Teleport finish.
- + */
- + public static void teleportFinish()
- + {
- + sit();
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Teleport back to participation NPC in 20 seconds!");
- + ThreadPool.schedule(() ->
- + {
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + if (player.isOnline())
- + {
- + player.teleToLocation(_npcX, _npcY, _npcZ);
- + }
- + else
- + {
- + try (Connection con = DatabaseFactory.getConnection())
- + {
- + final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
- + statement.setInt(1, _npcX);
- + statement.setInt(2, _npcY);
- + statement.setInt(3, _npcZ);
- + statement.setString(4, player.getName());
- + statement.execute();
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(e.getMessage());
- + }
- + }
- + }
- + }
- + }
- +
- + sit();
- + cleanTvT();
- + }, 20000);
- + }
- +
- + protected static class AutoEventTask implements Runnable
- + {
- + @Override
- + public void run()
- + {
- + LOGGER.info("Starting " + _eventName + "!");
- + LOGGER.info("Matchs Are Restarted At Every: " + getIntervalBetweenMatchs() + " Minutes.");
- + if (checkAutoEventStartJoinOk() && startJoin() && !_aborted)
- + {
- + if (_joinTime > 0)
- + {
- + waiter(_joinTime * 60 * 1000); // minutes for join event
- + }
- + else if (_joinTime <= 0)
- + {
- + LOGGER.info(_eventName + ": join time <=0 aborting event.");
- + abortEvent();
- + return;
- + }
- + if (startTeleport() && !_aborted)
- + {
- + waiter(30 * 1000); // 30 sec wait time until start fight after teleported
- + if (startEvent() && !_aborted)
- + {
- + LOGGER.warning(_eventName + ": waiting.....minutes for event time " + _eventTime);
- + waiter(_eventTime * 60 * 1000); // minutes for event time
- + finishEvent();
- +
- + LOGGER.info(_eventName + ": waiting... delay for final messages ");
- + waiter(60000); // just a give a delay delay for final messages
- + sendFinalMessages();
- +
- + if (!_started && !_aborted) // if is not already started and it's not aborted
- + {
- + LOGGER.info(_eventName + ": waiting.....delay for restart event " + _intervalBetweenMatches + " minutes.");
- + waiter(60000); // just a give a delay to next restart
- +
- + try
- + {
- + if (!_aborted)
- + {
- + restartEvent();
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning("Error while tying to Restart Event " + e);
- + }
- + }
- + }
- + }
- + else if (!_aborted)
- + {
- + abortEvent();
- + restartEvent();
- + }
- + }
- + }
- + }
- +
- + /**
- + * Auto event.
- + */
- + public static void autoEvent()
- + {
- + ThreadPool.execute(new AutoEventTask());
- + }
- +
- + /**
- + * Event once start.
- + */
- + public static void eventOnceStart()
- + {
- + if (startJoin() && !_aborted)
- + {
- + if (_joinTime > 0)
- + {
- + waiter(_joinTime * 60 * 1000); // minutes for join event
- + }
- + else if (_joinTime <= 0)
- + {
- + abortEvent();
- + return;
- + }
- + if (startTeleport() && !_aborted)
- + {
- + waiter(1 * 60 * 1000); // 1 min wait time untill start fight after teleported
- + if (startEvent() && !_aborted)
- + {
- + waiter(_eventTime * 60 * 1000); // minutes for event time
- + finishEvent();
- + }
- + }
- + else if (!_aborted)
- + {
- + abortEvent();
- + }
- + }
- + }
- +
- + /**
- + * Waiter.
- + * @param interval the interval
- + */
- + protected static void waiter(long interval)
- + {
- + final long startWaiterTime = System.currentTimeMillis();
- + int seconds = (int) (interval / 1000);
- +
- + while (((startWaiterTime + interval) > System.currentTimeMillis()) && !_aborted)
- + {
- + seconds--; // Here because we don't want to see two time announce at the same time
- + if (_joining || _started || _teleport)
- + {
- + switch (seconds)
- + {
- + case 3600: // 1 hour left
- + {
- + removeOfflinePlayers();
- + if (_joining)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Joinable in " + _joiningLocationName + "!");
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + (seconds / 60 / 60) + " hour(s) till registration close!");
- + }
- + else if (_started)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + (seconds / 60 / 60) + " hour(s) till event finish!");
- + }
- + break;
- + }
- + case 1800: // 30 minutes left
- + case 900: // 15 minutes left
- + case 600: // 10 minutes left
- + case 300: // 5 minutes left
- + case 240: // 4 minutes left
- + case 180: // 3 minutes left
- + case 120: // 2 minutes left
- + case 60: // 1 minute left
- + {
- + if (_joining)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Joinable in " + _joiningLocationName + "!");
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + (seconds / 60) + " minute(s) till registration close!");
- + }
- + else if (_started)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + (seconds / 60) + " minute(s) till event finish!");
- + }
- + break;
- + }
- + case 30: // 30 seconds left
- + case 15: // 15 seconds left
- + case 10: // 10 seconds left
- + {
- + removeOfflinePlayers();
- + // fallthrough?
- + }
- + case 3: // 3 seconds left
- + case 2: // 2 seconds left
- + case 1: // 1 seconds left
- + {
- + if (_joining)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + seconds + " second(s) till registration close!");
- + }
- + else if (_teleport)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + seconds + " seconds(s) till start fight!");
- + }
- + else if (_started)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": " + seconds + " second(s) till event finish!");
- + }
- + break;
- + }
- + }
- + }
- +
- + final long startOneSecondWaiterStartTime = System.currentTimeMillis();
- +
- + // Only the try catch with Thread.sleep(1000) give bad countdown on high wait times
- + while ((startOneSecondWaiterStartTime + 1000) > System.currentTimeMillis())
- + {
- + try
- + {
- + Thread.sleep(1);
- + }
- + catch (InterruptedException e)
- + {
- + }
- + }
- + }
- + }
- +
- + /**
- + * Sit.
- + */
- + public static void sit()
- + {
- + if (_sitForced)
- + {
- + _sitForced = false;
- + }
- + else
- + {
- + _sitForced = true;
- + }
- +
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + if (_sitForced)
- + {
- + player.stopMove(null, false);
- + player.abortAttack();
- + player.abortCast();
- +
- + if (!player.isSitting())
- + {
- + player.sitDown();
- + }
- + }
- + else if (player.isSitting())
- + {
- + player.standUp();
- + }
- + }
- + }
- + }
- + }
- +
- + /**
- + * Removes the offline players.
- + */
- + public static void removeOfflinePlayers()
- + {
- + try
- + {
- + if ((_playersShuffle == null) || _playersShuffle.isEmpty())
- + {
- + return;
- + }
- +
- + for (Player player : _playersShuffle)
- + {
- + if (player == null)
- + {
- + _playersShuffle.remove(player);
- + }
- + else if (!player.isOnline() || player.isInJail() || player.isInOfflineMode())
- + {
- + removePlayer(player);
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(e.getMessage());
- + }
- + }
- +
- + /**
- + * Start event ok.
- + * @return true, if successful
- + */
- + private static boolean startEventOk()
- + {
- + if (_joining || !_teleport || _started)
- + {
- + return false;
- + }
- +
- + if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + if (_teamPlayersCount.contains(0))
- + {
- + return false;
- + }
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + final List<Player> playersShuffleTemp = new ArrayList<>();
- + int loopCount = 0;
- + loopCount = _playersShuffle.size();
- + for (int i = 0; i < loopCount; i++)
- + {
- + playersShuffleTemp.add(_playersShuffle.get(i));
- + }
- +
- + _playersShuffle = playersShuffleTemp;
- + playersShuffleTemp.clear();
- + }
- + return true;
- + }
- +
- + /**
- + * Finish event ok.
- + * @return true, if successful
- + */
- + private static boolean finishEventOk()
- + {
- + return _started;
- + }
- +
- + /**
- + * Adds the player ok.
- + * @param teamName the team name
- + * @param eventPlayer the event player
- + * @return true, if successful
- + */
- + private static boolean addPlayerOk(String teamName, Player eventPlayer)
- + {
- + if (eventPlayer.isAio() && !Config.ALLOW_AIO_IN_EVENTS)
- + {
- + eventPlayer.sendMessage("AIO charactes are not allowed to participate in events :/");
- + }
- + if (checkShufflePlayers(eventPlayer) || eventPlayer._inEventTvT)
- + {
- + eventPlayer.sendMessage("You already participated in the event!");
- + return false;
- + }
- +
- + if (Olympiad.getInstance().isRegistered(eventPlayer) || eventPlayer.isInOlympiadMode())
- + {
- + eventPlayer.sendMessage("You already participated in Olympiad!");
- + return false;
- + }
- +
- + if ((eventPlayer._activeBoxes > 1) && !Config.ALLOW_DUALBOX_EVENT)
- + {
- + final List<String> playerBoxes = eventPlayer._activeBoxCharacters;
- + if ((playerBoxes != null) && (playerBoxes.size() > 1))
- + {
- + for (String character_name : playerBoxes)
- + {
- + final Player player = World.getInstance().getPlayer(character_name);
- + if ((player != null) && player._inEventTvT)
- + {
- + eventPlayer.sendMessage("You already participated in event with another char!");
- + return false;
- + }
- + }
- + }
- + }
- +
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player.getObjectId() == eventPlayer.getObjectId())
- + {
- + eventPlayer.sendMessage("You already participated in the event!");
- + return false;
- + }
- + else if (player.getName().equalsIgnoreCase(eventPlayer.getName()))
- + {
- + eventPlayer.sendMessage("You already participated in the event!");
- + return false;
- + }
- + }
- +
- + if (_players.contains(eventPlayer))
- + {
- + eventPlayer.sendMessage("You already participated in the event!");
- + return false;
- + }
- + }
- +
- + if (Config.TVT_EVEN_TEAMS.equals("NO"))
- + {
- + return true;
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + boolean allTeamsEqual = true;
- + int countBefore = -1;
- + for (int playersCount : _teamPlayersCount)
- + {
- + if (countBefore == -1)
- + {
- + countBefore = playersCount;
- + }
- +
- + if (countBefore != playersCount)
- + {
- + allTeamsEqual = false;
- + break;
- + }
- +
- + countBefore = playersCount;
- + }
- +
- + if (allTeamsEqual)
- + {
- + return true;
- + }
- +
- + countBefore = Integer.MAX_VALUE;
- + for (int teamPlayerCount : _teamPlayersCount)
- + {
- + if (teamPlayerCount < countBefore)
- + {
- + countBefore = teamPlayerCount;
- + }
- + }
- +
- + final List<String> joinableTeams = new ArrayList<>();
- + for (String team : _teams)
- + {
- + if (teamPlayersCount(team) == countBefore)
- + {
- + joinableTeams.add(team);
- + }
- + }
- +
- + if (joinableTeams.contains(teamName))
- + {
- + return true;
- + }
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + return true;
- + }
- +
- + eventPlayer.sendMessage("Too many players in team \"" + teamName + "\"");
- + return false;
- + }
- +
- + /**
- + * Sets the user data.
- + */
- + public static void setUserData()
- + {
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + player._originalNameColorTvT = player.getAppearance().getNameColor();
- + player._originalKarmaTvT = player.getKarma();
- + player._originalTitleTvT = player.getTitle();
- + player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameTvT)));
- + player.setKarma(0);
- + player.setTitle("Kills: " + player._countTvTkills);
- + if (Config.TVT_AURA && (_teams.size() >= 2))
- + {
- + player.setTeam(_teams.indexOf(player._teamNameTvT) + 1);
- + }
- +
- + if (player.isMounted() && player.setMountType(0))
- + {
- + if (player.isFlying())
- + {
- + player.removeSkill(SkillTable.getInstance().getSkill(4289, 1));
- + }
- +
- + player.broadcastPacket(new Ride(player.getObjectId(), Ride.ACTION_DISMOUNT, 0));
- + player.setMountObjectID(0);
- + }
- + player.broadcastUserInfo();
- + }
- + }
- + }
- +
- + /**
- + * Dump data.
- + */
- + public static void dumpData()
- + {
- + LOGGER.info("");
- + LOGGER.info("");
- +
- + if (!_joining && !_teleport && !_started)
- + {
- + LOGGER.info("<<---------------------------------->>");
- + LOGGER.info(">> " + _eventName + " Engine infos dump (INACTIVE) <<");
- + LOGGER.info("<<--^----^^-----^----^^------^^----->>");
- + }
- + else if (_joining && !_teleport && !_started)
- + {
- + LOGGER.info("<<--------------------------------->>");
- + LOGGER.info(">> " + _eventName + " Engine infos dump (JOINING) <<");
- + LOGGER.info("<<--^----^^-----^----^^------^----->>");
- + }
- + else if (!_joining && _teleport && !_started)
- + {
- + LOGGER.info("<<---------------------------------->>");
- + LOGGER.info(">> " + _eventName + " Engine infos dump (TELEPORT) <<");
- + LOGGER.info("<<--^----^^-----^----^^------^^----->>");
- + }
- + else if (!_joining && !_teleport && _started)
- + {
- + LOGGER.info("<<--------------------------------->>");
- + LOGGER.info(">> " + _eventName + " Engine infos dump (STARTED) <<");
- + LOGGER.info("<<--^----^^-----^----^^------^----->>");
- + }
- +
- + LOGGER.info("Name: " + _eventName);
- + LOGGER.info("Desc: " + _eventDesc);
- + LOGGER.info("Join location: " + _joiningLocationName);
- + LOGGER.info("Min lvl: " + _minLevel);
- + LOGGER.info("Max lvl: " + _maxLevel);
- + LOGGER.info("");
- + LOGGER.info("##########################");
- + LOGGER.info("# _teams(List<String>) #");
- + LOGGER.info("##########################");
- +
- + for (String team : _teams)
- + {
- + LOGGER.info(team + " Kills Done :" + _teamPointsCount.get(_teams.indexOf(team)));
- + }
- +
- + if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + LOGGER.info("");
- + LOGGER.info("#########################################");
- + LOGGER.info("# _playersShuffle(List<PlayerInstance>) #");
- + LOGGER.info("#########################################");
- +
- + for (Player player : _playersShuffle)
- + {
- + if (player != null)
- + {
- + LOGGER.info("Name: " + player.getName());
- + }
- + }
- + }
- +
- + LOGGER.info("");
- + LOGGER.info("##################################");
- + LOGGER.info("# _players(List<PlayerInstance>) #");
- + LOGGER.info("##################################");
- +
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + LOGGER.info("Name: " + player.getName() + " Team: " + player._teamNameTvT + " Kills Done:" + player._countTvTkills);
- + }
- + }
- + }
- +
- + LOGGER.info("");
- + LOGGER.info("#####################################################################");
- + LOGGER.info("# _savePlayers(List<String>) and _savePlayerTeams(List<String>) #");
- + LOGGER.info("#####################################################################");
- +
- + for (String player : _savePlayers)
- + {
- + LOGGER.info("Name: " + player + " Team: " + _savePlayerTeams.get(_savePlayers.indexOf(player)));
- + }
- +
- + LOGGER.info("");
- + LOGGER.info("");
- +
- + dumpLocalEventInfo();
- + }
- +
- + /**
- + * Dump local event info.
- + */
- + private static void dumpLocalEventInfo()
- + {
- + }
- +
- + /**
- + * Load data.
- + */
- + public static void loadData()
- + {
- + _eventName = "";
- + _eventDesc = "";
- + _joiningLocationName = "";
- + _savePlayers = new ArrayList<>();
- + _players = new ArrayList<>();
- + _topTeam = "";
- + _teams = new ArrayList<>();
- + _savePlayerTeams = new ArrayList<>();
- + _playersShuffle = new ArrayList<>();
- + _teamPlayersCount = new ArrayList<>();
- + _teamPointsCount = new ArrayList<>();
- + _teamColors = new ArrayList<>();
- + _teamsX = new ArrayList<>();
- + _teamsY = new ArrayList<>();
- + _teamsZ = new ArrayList<>();
- + _joining = false;
- + _teleport = false;
- + _started = false;
- + _sitForced = false;
- + _aborted = false;
- + _inProgress = false;
- + _npcId = 0;
- + _npcX = 0;
- + _npcY = 0;
- + _npcZ = 0;
- + _npcHeading = 0;
- + _rewardId = 0;
- + _rewardAmount = 0;
- + _topKills = 0;
- + _minLevel = 0;
- + _maxLevel = 0;
- + _joinTime = 0;
- + _eventTime = 0;
- + _minPlayers = 0;
- + _maxPlayers = 0;
- + _intervalBetweenMatches = 0;
- +
- + try (Connection con = DatabaseFactory.getConnection())
- + {
- + PreparedStatement statement;
- + ResultSet rs;
- + statement = con.prepareStatement("Select * from tvt");
- + rs = statement.executeQuery();
- + int teams = 0;
- +
- + while (rs.next())
- + {
- + _eventName = rs.getString("eventName");
- + _eventDesc = rs.getString("eventDesc");
- + _joiningLocationName = rs.getString("joiningLocation");
- + _minLevel = rs.getInt("minLevel");
- + _maxLevel = rs.getInt("maxLevel");
- + _npcId = rs.getInt("npcId");
- + _npcX = rs.getInt("npcX");
- + _npcY = rs.getInt("npcY");
- + _npcZ = rs.getInt("npcZ");
- + _npcHeading = rs.getInt("npcHeading");
- + _rewardId = rs.getInt("rewardId");
- + _rewardAmount = rs.getInt("rewardAmount");
- + teams = rs.getInt("teamsCount");
- + _joinTime = rs.getInt("joinTime");
- + _eventTime = rs.getInt("eventTime");
- + _minPlayers = rs.getInt("minPlayers");
- + _maxPlayers = rs.getInt("maxPlayers");
- + _intervalBetweenMatches = rs.getLong("delayForNextEvent");
- + }
- + statement.close();
- +
- + int index = -1;
- + if (teams > 0)
- + {
- + index = 0;
- + }
- + while ((index < teams) && (index > -1))
- + {
- + statement = con.prepareStatement("Select * from tvt_teams where teamId = ?");
- + statement.setInt(1, index);
- + rs = statement.executeQuery();
- + while (rs.next())
- + {
- + _teams.add(rs.getString("teamName"));
- + _teamPlayersCount.add(0);
- + _teamPointsCount.add(0);
- + _teamColors.add(0);
- + _teamsX.add(0);
- + _teamsY.add(0);
- + _teamsZ.add(0);
- + _teamsX.set(index, rs.getInt("teamX"));
- + _teamsY.set(index, rs.getInt("teamY"));
- + _teamsZ.set(index, rs.getInt("teamZ"));
- + _teamColors.set(index, rs.getInt("teamColor"));
- + }
- + index++;
- + statement.close();
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning("Exception: loadData(): " + e.getMessage());
- + }
- + }
- +
- + /**
- + * Save data.
- + */
- + public static void saveData()
- + {
- + try (Connection con = DatabaseFactory.getConnection())
- + {
- + PreparedStatement statement;
- + statement = con.prepareStatement("Delete from tvt");
- + statement.execute();
- + statement.close();
- +
- + statement = con.prepareStatement("INSERT INTO tvt (eventName, eventDesc, joiningLocation, minLevel, maxLevel, npcId, npcX, npcY, npcZ, npcHeading, rewardId, rewardAmount, teamsCount, joinTime, eventTime, minPlayers, maxPlayers,delayForNextEvent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)");
- + statement.setString(1, _eventName);
- + statement.setString(2, _eventDesc);
- + statement.setString(3, _joiningLocationName);
- + statement.setInt(4, _minLevel);
- + statement.setInt(5, _maxLevel);
- + statement.setInt(6, _npcId);
- + statement.setInt(7, _npcX);
- + statement.setInt(8, _npcY);
- + statement.setInt(9, _npcZ);
- + statement.setInt(10, _npcHeading);
- + statement.setInt(11, _rewardId);
- + statement.setInt(12, _rewardAmount);
- + statement.setInt(13, _teams.size());
- + statement.setInt(14, _joinTime);
- + statement.setInt(15, _eventTime);
- + statement.setInt(16, _minPlayers);
- + statement.setInt(17, _maxPlayers);
- + statement.setLong(18, _intervalBetweenMatches);
- + statement.execute();
- + statement.close();
- +
- + statement = con.prepareStatement("Delete from tvt_teams");
- + statement.execute();
- + statement.close();
- +
- + for (String teamName : _teams)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + con.close();
- + return;
- + }
- + statement = con.prepareStatement("INSERT INTO tvt_teams (teamId ,teamName, teamX, teamY, teamZ, teamColor) VALUES (?, ?, ?, ?, ?, ?)");
- + statement.setInt(1, index);
- + statement.setString(2, teamName);
- + statement.setInt(3, _teamsX.get(index));
- + statement.setInt(4, _teamsY.get(index));
- + statement.setInt(5, _teamsZ.get(index));
- + statement.setInt(6, _teamColors.get(index));
- + statement.execute();
- + statement.close();
- + }
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning("Exception: saveData(): " + e.getMessage());
- + }
- + }
- +
- + /**
- + * Show event html.
- + * @param eventPlayer the event player
- + * @param objectId the object id
- + */
- + public static void showEventHtml(Player eventPlayer, String objectId)
- + {
- + try
- + {
- + final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
- + final StringBuilder replyMSG = new StringBuilder("<html><title>" + _eventName + "</title><body>");
- + replyMSG.append("<center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></center><br1>");
- + replyMSG.append("<center><font color=\"3366CC\">Current event:</font></center><br1>");
- + replyMSG.append("<center>Name: <font color=\"00FF00\">" + _eventName + "</font></center><br1>");
- + replyMSG.append("<center>Description: <font color=\"00FF00\">" + _eventDesc + "</font></center><br><br>");
- + if (!_started && !_joining)
- + {
- + replyMSG.append("<center>Wait till the admin/gm start the participation.</center>");
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE") && !checkMaxPlayers(_playersShuffle.size()))
- + {
- + if (!_started)
- + {
- + replyMSG.append("Currently participated: <font color=\"00FF00\">" + _playersShuffle.size() + ".</font><br>");
- + replyMSG.append("Max players: <font color=\"00FF00\">" + _maxPlayers + "</font><br><br>");
- + replyMSG.append("<font color=\"FFFF00\">You can't participate to this event.</font><br>");
- + }
- + }
- + else if (eventPlayer.isCursedWeaponEquiped() && !Config.TVT_JOIN_CURSED)
- + {
- + replyMSG.append("<font color=\"FFFF00\">You can't participate to this event with a cursed Weapon.</font><br>");
- + }
- + else if (!_started && _joining && (eventPlayer.getLevel() >= _minLevel) && (eventPlayer.getLevel() <= _maxLevel))
- + {
- + synchronized (_players)
- + {
- + if (_players.contains(eventPlayer) || _playersShuffle.contains(eventPlayer) || checkShufflePlayers(eventPlayer))
- + {
- + if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + replyMSG.append("You participated already in team <font color=\"LEVEL\">" + eventPlayer._teamNameTvT + "</font><br><br>");
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + replyMSG.append("<center><font color=\"3366CC\">You participated already!</font></center><br><br>");
- + }
- +
- + replyMSG.append("<center>Joined Players: <font color=\"00FF00\">" + _playersShuffle.size() + "</font></center><br>");
- + replyMSG.append("<center><font color=\"3366CC\">Wait till event start or remove your participation!</font><center>");
- + replyMSG.append("<center><button value=\"Remove\" action=\"bypass -h npc_" + objectId + "_tvt_player_leave\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center>");
- + }
- + else
- + {
- + replyMSG.append("<center><font color=\"3366CC\">You want to participate in the event?</font></center><br>");
- + replyMSG.append("<center><td width=\"200\">Min lvl: <font color=\"00FF00\">" + _minLevel + "</font></center></td><br>");
- + replyMSG.append("<center><td width=\"200\">Max lvl: <font color=\"00FF00\">" + _maxLevel + "</font></center></td><br><br>");
- + replyMSG.append("<center><font color=\"3366CC\">Teams:</font></center><br>");
- + if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + replyMSG.append("<center><table border=\"0\">");
- + for (String team : _teams)
- + {
- + replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font> (" + teamPlayersCount(team) + " joined)</td>");
- + replyMSG.append("<center><td width=\"60\"><button value=\"Join\" action=\"bypass -h npc_" + objectId + "_tvt_player_join " + team + "\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td></tr>");
- + }
- + replyMSG.append("</table></center>");
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + replyMSG.append("<center>");
- +
- + for (String team : _teams)
- + {
- + replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font> </td>");
- + }
- +
- + replyMSG.append("</center><br>");
- +
- + replyMSG.append("<center><button value=\"Join Event\" action=\"bypass -h npc_" + objectId + "_tvt_player_join eventShuffle\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center>");
- + replyMSG.append("<center><font color=\"3366CC\">Teams will be reandomly generated!</font></center><br>");
- + replyMSG.append("<center>Joined Players:</font> <font color=\"LEVEL\">" + _playersShuffle.size() + "</center></font><br>");
- + replyMSG.append("<center>Reward: <font color=\"LEVEL\">" + _rewardAmount + " " + ItemTable.getInstance().getTemplate(_rewardId).getName() + "</center></font>");
- + }
- + }
- + }
- + }
- + else if (_started && !_joining)
- + {
- + replyMSG.append("<center>" + _eventName + " match is in progress.</center>");
- + }
- + else if ((eventPlayer.getLevel() < _minLevel) || (eventPlayer.getLevel() > _maxLevel))
- + {
- + replyMSG.append("Your lvl: <font color=\"00FF00\">" + eventPlayer.getLevel() + "</font><br>");
- + replyMSG.append("Min lvl: <font color=\"00FF00\">" + _minLevel + "</font><br>");
- + replyMSG.append("Max lvl: <font color=\"00FF00\">" + _maxLevel + "</font><br><br>");
- + replyMSG.append("<font color=\"FFFF00\">You can't participate to this event.</font><br>");
- + }
- +
- + replyMSG.append("</body></html>");
- + adminReply.setHtml(replyMSG.toString());
- + eventPlayer.sendPacket(adminReply);
- +
- + // Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
- + eventPlayer.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + catch (Exception e)
- + {
- + LOGGER.warning(_eventName + " Engine[showEventHtlm(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
- + }
- + }
- +
- + /**
- + * Adds the player.
- + * @param player the player
- + * @param teamName the team name
- + */
- + public static void addPlayer(Player player, String teamName)
- + {
- + if (!addPlayerOk(teamName, player))
- + {
- + return;
- + }
- +
- + synchronized (_players)
- + {
- + if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE"))
- + {
- + player._teamNameTvT = teamName;
- + _players.add(player);
- + setTeamPlayersCount(teamName, teamPlayersCount(teamName) + 1);
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE"))
- + {
- + _playersShuffle.add(player);
- + }
- + }
- +
- + player._inEventTvT = true;
- + player._countTvTkills = 0;
- + player.sendMessage(_eventName + ": You successfully registered for the event.");
- + }
- +
- + /**
- + * Removes the player.
- + * @param player the player
- + */
- + public static void removePlayer(Player player)
- + {
- + if (player._inEventTvT)
- + {
- + if (!_joining)
- + {
- + player.getAppearance().setNameColor(player._originalNameColorTvT);
- + player.setTitle(player._originalTitleTvT);
- + player.setKarma(player._originalKarmaTvT);
- + if (Config.TVT_AURA && (_teams.size() >= 2))
- + {
- + player.setTeam(0); // clear aura :P
- + }
- + player.broadcastUserInfo();
- + }
- +
- + // after remove, all event data must be cleaned in player
- + player._originalNameColorTvT = 0;
- + player._originalTitleTvT = null;
- + player._originalKarmaTvT = 0;
- + player._teamNameTvT = "";
- + player._countTvTkills = 0;
- + player._inEventTvT = false;
- +
- + synchronized (_players)
- + {
- + if ((Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE")) && _players.contains(player))
- + {
- + setTeamPlayersCount(player._teamNameTvT, teamPlayersCount(player._teamNameTvT) - 1);
- + _players.remove(player);
- + }
- + else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE") && (!_playersShuffle.isEmpty() && _playersShuffle.contains(player)))
- + {
- + _playersShuffle.remove(player);
- + }
- + }
- +
- + player.sendMessage("Your participation in the TvT event has been removed.");
- + }
- + }
- +
- + /**
- + * Clean tvt.
- + */
- + public static void cleanTvT()
- + {
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + cleanEventPlayer(player);
- +
- + removePlayer(player);
- + if (_savePlayers.contains(player.getName()))
- + {
- + _savePlayers.remove(player.getName());
- + }
- + player._inEventTvT = false;
- + }
- + }
- + }
- +
- + if ((_playersShuffle != null) && !_playersShuffle.isEmpty())
- + {
- + for (Player player : _playersShuffle)
- + {
- + if (player != null)
- + {
- + player._inEventTvT = false;
- + }
- + }
- + }
- +
- + _topKills = 0;
- + _topTeam = "";
- + _players = new ArrayList<>();
- + _playersShuffle = new ArrayList<>();
- + _savePlayers = new ArrayList<>();
- + _savePlayerTeams = new ArrayList<>();
- + _teamPointsCount = new ArrayList<>();
- + _teamPlayersCount = new ArrayList<>();
- + cleanLocalEventInfo();
- +
- + _inProgress = false;
- + loadData();
- + }
- +
- + /**
- + * Clean local event info.
- + */
- + private static void cleanLocalEventInfo()
- + {
- + // nothing
- + }
- +
- + /**
- + * Clean event player.
- + * @param player the player
- + */
- + private static void cleanEventPlayer(Player player)
- + {
- + // nothing
- + }
- +
- + /**
- + * Adds the disconnected player.
- + * @param player the player
- + */
- + public static synchronized void addDisconnectedPlayer(Player player)
- + {
- + if ((Config.TVT_EVEN_TEAMS.equals("SHUFFLE") && (_teleport || _started)) || (Config.TVT_EVEN_TEAMS.equals("NO") || (Config.TVT_EVEN_TEAMS.equals("BALANCE") && (_teleport || _started))))
- + {
- + if (Config.TVT_ON_START_REMOVE_ALL_EFFECTS)
- + {
- + player.stopAllEffects();
- + }
- +
- + player._teamNameTvT = _savePlayerTeams.get(_savePlayers.indexOf(player.getName()));
- +
- + synchronized (_players)
- + {
- + for (Player p : _players)
- + {
- + if (p == null)
- + {
- + continue;
- + }
- +
- + // check by name incase player got new objectId
- + if (p.getName().equals(player.getName()))
- + {
- + player._originalNameColorTvT = player.getAppearance().getNameColor();
- + player._originalTitleTvT = player.getTitle();
- + player._originalKarmaTvT = player.getKarma();
- + player._inEventTvT = true;
- + player._countTvTkills = p._countTvTkills;
- + _players.remove(p); // removing old object id from vector
- + _players.add(player); // adding new objectId to vector
- + break;
- + }
- + }
- + }
- +
- + player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameTvT)));
- + player.setKarma(0);
- + if (Config.TVT_AURA && (_teams.size() >= 2))
- + {
- + player.setTeam(_teams.indexOf(player._teamNameTvT) + 1);
- + }
- + player.broadcastUserInfo();
- +
- + player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameTvT)), _teamsY.get(_teams.indexOf(player._teamNameTvT)), _teamsZ.get(_teams.indexOf(player._teamNameTvT)));
- + afterAddDisconnectedPlayerOperations(player);
- + }
- + }
- +
- + /**
- + * After add disconnected player operations.
- + * @param player the player
- + */
- + private static void afterAddDisconnectedPlayerOperations(Player player)
- + {
- + // nothing
- + }
- +
- + /**
- + * Shuffle teams.
- + */
- + public static void shuffleTeams()
- + {
- + int teamCount = 0;
- + int playersCount = 0;
- +
- + synchronized (_players)
- + {
- + for (;;)
- + {
- + if (_playersShuffle.isEmpty())
- + {
- + break;
- + }
- +
- + final int playerToAddIndex = Rnd.get(_playersShuffle.size());
- + Player player = null;
- + player = _playersShuffle.get(playerToAddIndex);
- + _players.add(player);
- + _players.get(playersCount)._teamNameTvT = _teams.get(teamCount);
- + _savePlayers.add(_players.get(playersCount).getName());
- + _savePlayerTeams.add(_teams.get(teamCount));
- + playersCount++;
- +
- + if (teamCount == (_teams.size() - 1))
- + {
- + teamCount = 0;
- + }
- + else
- + {
- + teamCount++;
- + }
- +
- + _playersShuffle.remove(playerToAddIndex);
- + }
- + }
- + }
- +
- + /**
- + * Play kneel animation.
- + * @param teamName the team name
- + */
- + public static void playKneelAnimation(String teamName)
- + {
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if (player != null)
- + {
- + if (!player._teamNameTvT.equals(teamName))
- + {
- + player.broadcastPacket(new SocialAction(player.getObjectId(), 7));
- + }
- + else if (player._teamNameTvT.equals(teamName))
- + {
- + player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
- + }
- + }
- + }
- + }
- + }
- +
- + /**
- + * Reward team.
- + * @param teamName the team name
- + * @param bestKiller the best killer
- + * @param looser the looser
- + */
- + public static void rewardTeam(String teamName, Player bestKiller, Player looser)
- + {
- + synchronized (_players)
- + {
- + for (Player player : _players)
- + {
- + if ((player != null) && player.isOnline() && (player._inEventTvT) && (!player.equals(looser)) && ((player._countTvTkills > 0) || Config.TVT_PRICE_NO_KILLS))
- + {
- + if ((bestKiller != null) && (bestKiller.equals(player)))
- + {
- + player.addItem(_eventName + " Event: " + _eventName, _rewardId, _rewardAmount, player, true);
- + player.addItem(_eventName + " Event: " + _eventName, Config.TVT_TOP_KILLER_REWARD, Config.TVT_TOP_KILLER_QTY, player, true);
- + }
- + else if ((teamName != null) && (player._teamNameTvT.equals(teamName)))
- + {
- + player.addItem(_eventName + " Event: " + _eventName, _rewardId, _rewardAmount, player, true);
- +
- + final NpcHtmlMessage nhm = new NpcHtmlMessage(5);
- + final StringBuilder replyMSG = new StringBuilder("");
- + replyMSG.append("<html><body>");
- + replyMSG.append("<font color=\"FFFF00\">Your team wins the event. Look in your inventory for the reward.</font>");
- + replyMSG.append("</body></html>");
- +
- + nhm.setHtml(replyMSG.toString());
- + player.sendPacket(nhm);
- +
- + // Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else if (teamName == null)
- + {
- + int minusReward = 0;
- + if (_topKills != 0)
- + {
- + minusReward = _rewardAmount / 2;
- + }
- + else
- + {
- + // nobody killed
- + minusReward = _rewardAmount / 4;
- + }
- +
- + player.addItem(_eventName + " Event: " + _eventName, _rewardId, minusReward, player, true);
- +
- + final NpcHtmlMessage nhm = new NpcHtmlMessage(5);
- + final StringBuilder replyMSG = new StringBuilder("");
- + replyMSG.append("<html><body>");
- + replyMSG.append("<font color=\"FFFF00\">Your team had a tie in the event. Look in your inventory for the reward.</font>");
- + replyMSG.append("</body></html>");
- +
- + nhm.setHtml(replyMSG.toString());
- + player.sendPacket(nhm);
- +
- + // Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + }
- + }
- + }
- + }
- +
- + /**
- + * Process top player.
- + */
- + private static void processTopPlayer()
- + {
- + // nothing
- + }
- +
- + /**
- + * Process top team.
- + */
- + private static void processTopTeam()
- + {
- + _topTeam = null;
- + for (String team : _teams)
- + {
- + if ((teamKillsCount(team) == _topKills) && (_topKills > 0))
- + {
- + _topTeam = null;
- + }
- +
- + if (teamKillsCount(team) > _topKills)
- + {
- + _topTeam = team;
- + _topKills = teamKillsCount(team);
- + }
- + }
- + }
- +
- + /**
- + * Adds the team.
- + * @param teamName the team name
- + */
- + public static void addTeam(String teamName)
- + {
- + if (_inProgress)
- + {
- + return;
- + }
- +
- + if (teamName.equals(" "))
- + {
- + return;
- + }
- +
- + _teams.add(teamName);
- + _teamPlayersCount.add(0);
- + _teamPointsCount.add(0);
- + _teamColors.add(0);
- + _teamsX.add(0);
- + _teamsY.add(0);
- + _teamsZ.add(0);
- +
- + addTeamEventOperations(teamName);
- + }
- +
- + /**
- + * Adds the team event operations.
- + * @param teamName the team name
- + */
- + private static void addTeamEventOperations(String teamName)
- + {
- + // nothing
- + }
- +
- + /**
- + * Removes the team.
- + * @param teamName the team name
- + */
- + public static void removeTeam(String teamName)
- + {
- + if (_inProgress || _teams.isEmpty())
- + {
- + return;
- + }
- +
- + if (teamPlayersCount(teamName) > 0)
- + {
- + return;
- + }
- +
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamsZ.remove(index);
- + _teamsY.remove(index);
- + _teamsX.remove(index);
- + _teamColors.remove(index);
- + _teamPointsCount.remove(index);
- + _teamPlayersCount.remove(index);
- + _teams.remove(index);
- +
- + removeTeamEventItems(teamName);
- + }
- +
- + /**
- + * Removes the team event items.
- + * @param teamName the team name
- + */
- + private static void removeTeamEventItems(String teamName)
- + {
- + _teams.indexOf(teamName);
- +
- + //
- + }
- +
- + /**
- + * Sets the team pos.
- + * @param teamName the team name
- + * @param player the player
- + */
- + public static void setTeamPos(String teamName, Player player)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamsX.set(index, player.getX());
- + _teamsY.set(index, player.getY());
- + _teamsZ.set(index, player.getZ());
- + }
- +
- + /**
- + * Sets the team pos.
- + * @param teamName the team name
- + * @param x the x
- + * @param y the y
- + * @param z the z
- + */
- + public static void setTeamPos(String teamName, int x, int y, int z)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamsX.set(index, x);
- + _teamsY.set(index, y);
- + _teamsZ.set(index, z);
- + }
- +
- + /**
- + * Sets the team color.
- + * @param teamName the team name
- + * @param color the color
- + */
- + public static void setTeamColor(String teamName, int color)
- + {
- + if (_inProgress)
- + {
- + return;
- + }
- +
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamColors.set(index, color);
- + }
- +
- + /**
- + * Team players count.
- + * @param teamName the team name
- + * @return the int
- + */
- + public static int teamPlayersCount(String teamName)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return -1;
- + }
- + return _teamPlayersCount.get(index);
- + }
- +
- + /**
- + * Sets the team players count.
- + * @param teamName the team name
- + * @param teamPlayersCount the team players count
- + */
- + public static void setTeamPlayersCount(String teamName, int teamPlayersCount)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamPlayersCount.set(index, teamPlayersCount);
- + }
- +
- + /**
- + * Check shuffle players.
- + * @param eventPlayer the event player
- + * @return true, if successful
- + */
- + public static boolean checkShufflePlayers(Player eventPlayer)
- + {
- + try
- + {
- + for (Player player : _playersShuffle)
- + {
- + if ((player == null) || !player.isOnline())
- + {
- + _playersShuffle.remove(player);
- + eventPlayer._inEventTvT = false;
- + }
- + else if (player.getObjectId() == eventPlayer.getObjectId())
- + {
- + eventPlayer._inEventTvT = true;
- + eventPlayer._countTvTkills = 0;
- + return true;
- + }
- + // This 1 is incase player got new objectid after DC or reconnect
- + else if (player.getName().equals(eventPlayer.getName()))
- + {
- + _playersShuffle.remove(player);
- + _playersShuffle.add(eventPlayer);
- + eventPlayer._inEventTvT = true;
- + eventPlayer._countTvTkills = 0;
- + return true;
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + }
- + return false;
- + }
- +
- + /**
- + * just an announcer to send termination messages.
- + */
- + public static void sendFinalMessages()
- + {
- + if (!_started && !_aborted)
- + {
- + AnnouncementsTable.getInstance().criticalAnnounceToAll(_eventName + ": Thank you For Participating At, " + _eventName + " Event.");
- + }
- + }
- +
- + /**
- + * returns the interval between each event.
- + * @return the interval between matchs
- + */
- + public static int getIntervalBetweenMatchs()
- + {
- + final long actualTime = System.currentTimeMillis();
- + final long totalTime = actualTime + _intervalBetweenMatches;
- + final long interval = totalTime - actualTime;
- + final int seconds = (int) (interval / 1000);
- + return seconds / 60;
- + }
- +
- + @Override
- + public void run()
- + {
- + LOGGER.info(_eventName + ": Event notification start");
- + eventOnceStart();
- + }
- +
- + @Override
- + public String getEventIdentifier()
- + {
- + return _eventName;
- + }
- +
- + @Override
- + public String getEventStartTime()
- + {
- + return startEventTime;
- + }
- +
- + /**
- + * Sets the event start time.
- + * @param newTime the new event start time
- + */
- + public void setEventStartTime(String newTime)
- + {
- + startEventTime = newTime;
- + }
- +
- + /**
- + * On disconnect.
- + * @param player the player
- + */
- + public static void onDisconnect(Player player)
- + {
- + if (player._inEventTvT)
- + {
- + removePlayer(player);
- + player.teleToLocation(_npcX, _npcY, _npcZ);
- + }
- + }
- +
- + /**
- + * Team kills count.
- + * @param teamName the team name
- + * @return the int
- + */
- + public static int teamKillsCount(String teamName)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return -1;
- + }
- + return _teamPointsCount.get(index);
- + }
- +
- + /**
- + * Sets the team kills count.
- + * @param teamName the team name
- + * @param teamKillsCount the team kills count
- + */
- + public static void setTeamKillsCount(String teamName, int teamKillsCount)
- + {
- + final int index = _teams.indexOf(teamName);
- + if (index == -1)
- + {
- + return;
- + }
- +
- + _teamPointsCount.set(index, teamKillsCount);
- + }
- +
- + /**
- + * Kick player from tvt.
- + * @param playerToKick the player to kick
- + */
- + public static void kickPlayerFromTvt(Player playerToKick)
- + {
- + if (playerToKick == null)
- + {
- + return;
- + }
- +
- + synchronized (_players)
- + {
- + if (_joining)
- + {
- + _playersShuffle.remove(playerToKick);
- + _players.remove(playerToKick);
- + playerToKick._inEventTvT = false;
- + playerToKick._teamNameTvT = "";
- + playerToKick._countTvTkills = 0;
- + }
- + }
- +
- + if (_started || _teleport)
- + {
- + _playersShuffle.remove(playerToKick);
- + removePlayer(playerToKick);
- + if (playerToKick.isOnline())
- + {
- + playerToKick.getAppearance().setNameColor(playerToKick._originalNameColorTvT);
- + playerToKick.setKarma(playerToKick._originalKarmaTvT);
- + playerToKick.setTitle(playerToKick._originalTitleTvT);
- + playerToKick.broadcastUserInfo();
- + playerToKick.sendMessage("You have been kicked from the TvT.");
- + playerToKick.teleToLocation(_npcX, _npcY, _npcZ);
- + playerToKick.teleToLocation((_npcX + Rnd.get(201)) - 100, (_npcY + Rnd.get(201)) - 100, _npcZ);
- + }
- + }
- + }
- +
- + /**
- + * Find best killer.
- + * @param players the players
- + * @return the pc instance
- + */
- + public static Player findBestKiller(List<Player> players)
- + {
- + if (players == null)
- + {
- + return null;
- + }
- + Player bestKiller = null;
- + for (Player player : players)
- + {
- + if ((bestKiller == null) || (bestKiller._countTvTkills < player._countTvTkills))
- + {
- + bestKiller = player;
- + }
- + }
- + return bestKiller;
- + }
- +
- + /**
- + * Find looser.
- + * @param players the players
- + * @return the pc instance
- + */
- + public static Player findLooser(List<Player> players)
- + {
- + if (players == null)
- + {
- + return null;
- + }
- + Player looser = null;
- + for (Player player : players)
- + {
- + if ((looser == null) || (looser._countTvTdies < player._countTvTdies))
- + {
- + looser = player;
- + }
- + }
- + return looser;
- + }
- +
- + /**
- + * The Class TvTTeam.
- + */
- + public static class TvTTeam
- + {
- + /** The kill count. */
- + private int killCount = -1;
- +
- + /** The name. */
- + private String name = null;
- +
- + /**
- + * Instantiates a new tvt team.
- + * @param name the name
- + * @param killCount the kill count
- + */
- + TvTTeam(String name, int killCount)
- + {
- + this.killCount = killCount;
- + this.name = name;
- + }
- +
- + /**
- + * Gets the kill count.
- + * @return the kill count
- + */
- + public int getKillCount()
- + {
- + return killCount;
- + }
- +
- + /**
- + * Sets the kill count.
- + * @param killCount the new kill count
- + */
- + public void setKillCount(int killCount)
- + {
- + this.killCount = killCount;
- + }
- +
- + /**
- + * Gets the name.
- + * @return the name
- + */
- + public String getName()
- + {
- + return name;
- + }
- +
- + /**
- + * Sets the name.
- + * @param name the new name
- + */
- + public void setName(String name)
- + {
- + this.name = name;
- + }
- + }
- +
- + /**
- + * Close fort doors.
- + */
- + private static void closeFortDoors()
- + {
- + DoorData.getInstance().getDoor(23170004).closeMe();
- + DoorData.getInstance().getDoor(23170005).closeMe();
- + DoorData.getInstance().getDoor(23170002).closeMe();
- + DoorData.getInstance().getDoor(23170003).closeMe();
- + DoorData.getInstance().getDoor(23170006).closeMe();
- + DoorData.getInstance().getDoor(23170007).closeMe();
- + DoorData.getInstance().getDoor(23170008).closeMe();
- + DoorData.getInstance().getDoor(23170009).closeMe();
- + DoorData.getInstance().getDoor(23170010).closeMe();
- + DoorData.getInstance().getDoor(23170011).closeMe();
- +
- + try
- + {
- + Thread.sleep(20);
- + }
- + catch (InterruptedException ie)
- + {
- + LOGGER.warning("Error, " + ie.getMessage());
- + }
- + }
- +
- + /**
- + * Open fort doors.
- + */
- + private static void openFortDoors()
- + {
- + DoorData.getInstance().getDoor(23170004).openMe();
- + DoorData.getInstance().getDoor(23170005).openMe();
- + DoorData.getInstance().getDoor(23170002).openMe();
- + DoorData.getInstance().getDoor(23170003).openMe();
- + DoorData.getInstance().getDoor(23170006).openMe();
- + DoorData.getInstance().getDoor(23170007).openMe();
- + DoorData.getInstance().getDoor(23170008).openMe();
- + DoorData.getInstance().getDoor(23170009).openMe();
- + DoorData.getInstance().getDoor(23170010).openMe();
- + DoorData.getInstance().getDoor(23170011).openMe();
- + }
- +
- + /**
- + * Close aden colosseum doors.
- + */
- + private static void closeAdenColosseumDoors()
- + {
- + DoorData.getInstance().getDoor(24190002).closeMe();
- + DoorData.getInstance().getDoor(24190003).closeMe();
- +
- + try
- + {
- + Thread.sleep(20);
- + }
- + catch (InterruptedException ie)
- + {
- + LOGGER.warning("Error, " + ie.getMessage());
- + }
- + }
- +
- + /**
- + * Open aden colosseum doors.
- + */
- + private static void openAdenColosseumDoors()
- + {
- + DoorData.getInstance().getDoor(24190002).openMe();
- + DoorData.getInstance().getDoor(24190003).openMe();
- + }
- +}
- \ No newline at end of file
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/CursedWeapon.java
- index fae94a4..0fb1b39 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/CursedWeapon.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/CursedWeapon.java
- @@ -22,11 +22,13 @@
- import java.util.concurrent.ScheduledFuture;
- import java.util.logging.Logger;
- +import org.l2jmobius.Config;
- import org.l2jmobius.commons.database.DatabaseFactory;
- import org.l2jmobius.commons.threads.ThreadPool;
- import org.l2jmobius.commons.util.Rnd;
- import org.l2jmobius.gameserver.data.SkillTable;
- import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.actor.Attackable;
- import org.l2jmobius.gameserver.model.actor.Creature;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -345,6 +347,10 @@
- return;
- }
- }
- + if ((player._inEventTvT && !Config.TVT_JOIN_CURSED) && player._inEventTvT)
- + {
- + TvT.removePlayer(player);
- + }
- _isActivated = true;
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java
- index 9958f07..55a674b 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/Skill.java
- @@ -23,11 +23,13 @@
- import java.util.StringTokenizer;
- import java.util.logging.Logger;
- +import org.l2jmobius.Config;
- import org.l2jmobius.gameserver.data.SkillTable;
- import org.l2jmobius.gameserver.data.sql.SkillTreeTable;
- import org.l2jmobius.gameserver.enums.ClassId;
- import org.l2jmobius.gameserver.geoengine.GeoEngine;
- import org.l2jmobius.gameserver.instancemanager.SiegeManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.actor.Attackable;
- import org.l2jmobius.gameserver.model.actor.Creature;
- import org.l2jmobius.gameserver.model.actor.Npc;
- @@ -1568,11 +1570,32 @@
- continue;
- }
- // if src is in event and trg not or viceversa
- - if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT)))
- {
- continue;
- }
- +
- + // // if src is in event and trg not or viceversa
- + // if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // {
- + // continue;
- + // }
- }
- + // else if (obj instanceof Summon)
- + // {
- + // final Player trg = ((Summon) obj).getOwner();
- + // if (trg == src)
- + // {
- + // continue;
- + // }
- + // // if src is in event and trg not or viceversa
- + // if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // {
- + // continue;
- + // }
- + // }
- +
- else if (obj instanceof Summon)
- {
- final Player trg = ((Summon) obj).getOwner();
- @@ -1581,7 +1604,8 @@
- continue;
- }
- // if src is in event and trg not or viceversa
- - if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT)))
- {
- continue;
- }
- @@ -1710,8 +1734,28 @@
- {
- continue;
- }
- + // // if src is in event and trg not or viceversa
- + // if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // {
- + // continue;
- + // }
- + // }
- + // else if (obj instanceof Summon)
- + // {
- + // final Player trg = ((Summon) obj).getOwner();
- + // if (trg == src)
- + // {
- + // continue;
- + // }
- + // // if src is in event and trg not or viceversa
- + // if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // {
- + // continue;
- + // }
- + // }
- // if src is in event and trg not or viceversa
- - if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT)))
- {
- continue;
- }
- @@ -1724,7 +1768,8 @@
- continue;
- }
- // if src is in event and trg not or viceversa
- - if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT)))
- {
- continue;
- }
- @@ -1779,7 +1824,14 @@
- {
- continue;
- }
- -
- + // check if allow interference is allowed if player is not on event but target is on event
- + if (((TvT.isStarted() && !Config.TVT_ALLOW_INTERFERENCE))/* && !player.isGM() */)
- + {
- + if ((partyMember._inEventTvT && !player._inEventTvT) || (!partyMember._inEventTvT && player._inEventTvT))
- + {
- + continue;
- + }
- + }
- if (!partyMember.isDead() && Util.checkIfInRange(_skillRadius, creature, partyMember, true))
- {
- Player src = null;
- @@ -1791,13 +1843,19 @@
- {
- src = ((Summon) creature).getOwner();
- }
- +
- final Player trg = partyMember;
- + // // if src is in event and trg not or viceversa
- + // if ((src != null) && ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent())))
- + // {
- + // continue;
- + // }
- // if src is in event and trg not or viceversa
- - if ((src != null) && ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent())))
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if ((src != null) && (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT))))
- {
- continue;
- }
- -
- targetList.add(partyMember);
- if ((partyMember.getPet() != null) && !partyMember.getPet().isDead())
- {
- @@ -1926,11 +1984,15 @@
- final Player trg = newTarget;
- final Player src = player;
- // if src is in event and trg not or viceversa
- - if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // if ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent()))
- + // {
- + // continue;
- + // }
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT)))
- {
- continue;
- }
- -
- final Summon pet = newTarget.getPet();
- if ((pet != null) && Util.checkIfInRange(radius, creature, pet, true) && !onlyFirst && (((_targetType == SkillTargetType.CORPSE_CLAN) && pet.isDead()) || ((_targetType == SkillTargetType.CLAN) && !pet.isDead())) && player.checkPvpSkill(newTarget, this))
- {
- @@ -2176,11 +2238,15 @@
- }
- // if src is in event and trg not or viceversa
- - if ((src != null) && (trg != null) && ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent())))
- + // if ((src != null) && (trg != null) && ((src.isOnEvent() && !trg.isOnEvent()) || (trg.isOnEvent() && !src.isOnEvent())))
- + // {
- + // continue;
- + // }
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if ((src != null) && (trg != null) && (((src.isOnEvent() || src._inEventTvT) && (!trg.isOnEvent() && !trg._inEventTvT)) || ((trg.isOnEvent() || trg._inEventTvT) && (!src.isOnEvent() && !src._inEventTvT))))
- {
- continue;
- }
- -
- targetList.add((Creature) obj);
- }
- }
- @@ -2654,16 +2720,25 @@
- }
- // if src is in event and trg not OR viceversa, the target must be not attackable
- - if ((activeCh.isOnEvent() && !targetChar.isOnEvent()) || (targetChar.isOnEvent() && !activeCh.isOnEvent()))
- + // if ((activeCh.isOnEvent() && !targetChar.isOnEvent()) || (targetChar.isOnEvent() && !activeCh.isOnEvent()))
- + // {
- + // return true;
- + // }
- + //
- + // if (activeCh.isOnEvent() && targetChar.isOnEvent())
- + // {
- + // return false;
- + // }
- + // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- + if (((activeCh.isOnEvent() || activeCh._inEventTvT) && (!targetChar.isOnEvent() && !targetChar._inEventTvT)) || ((targetChar.isOnEvent() || targetChar._inEventTvT) && (!activeCh.isOnEvent() && !activeCh._inEventTvT)))
- {
- return true;
- }
- - if (activeCh.isOnEvent() && targetChar.isOnEvent())
- + if ((activeCh.isOnEvent() && targetChar.isOnEvent()) || (activeCh._inEventTvT && targetChar._inEventTvT))
- {
- return false;
- }
- -
- // Is in the same party?
- if ((activeCh.getParty() != null) && (targetChar.getParty() != null) && (activeCh.getParty().getPartyLeaderOID() == targetChar.getParty().getPartyLeaderOID()))
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
- index e6fc06d..676b25a 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
- @@ -53,6 +53,8 @@
- import org.l2jmobius.gameserver.instancemanager.DuelManager;
- import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
- import org.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager;
- +import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Duel;
- import org.l2jmobius.gameserver.model.ForceBuff;
- import org.l2jmobius.gameserver.model.Location;
- @@ -1845,6 +1847,21 @@
- }
- else if (this instanceof Player)
- {
- + final Player player = (Player) this;
- +
- + // to avoid Event Remove buffs on die
- + if (player._inEventTvT && TvT.isStarted())
- + {
- + if (Config.TVT_REMOVE_BUFFS_ON_DIE)
- + {
- + stopAllEffects();
- + }
- + }
- +
- + }
- +
- + else if (this instanceof Player)
- + {
- if (Config.LEAVE_BUFFS_ON_DIE)
- {
- stopAllEffects();
- @@ -5361,6 +5378,22 @@
- */
- protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
- {
- + // Block movement during Event start
- + if (isPlayer())
- + {
- + if (GameEvent.active && getActingPlayer().eventSitForced)
- + {
- + getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
- + getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + else if ((TvT.isSitForced() && getActingPlayer()._inEventTvT))
- + {
- + getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
- + getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- // Get the Move Speed of the Creature
- final float speed = getStat().getMoveSpeed();
- if ((speed <= 0) || isMovementDisabled())
- @@ -6484,6 +6517,13 @@
- {
- return false;
- }
- + if (dst.isInFunEvent() && src.isInFunEvent())
- + {
- + if (src.isInStartedTVTEvent() && dst.isInStartedTVTEvent())
- + {
- + return false;
- + }
- + }
- if (dst.isOnEvent() && src.isOnEvent())
- {
- @@ -7176,6 +7216,102 @@
- }
- }
- + private boolean _ArenaProtection;
- +
- + public void setArenaProtection(boolean comm)
- + {
- + _ArenaProtection = comm;
- + }
- +
- + public boolean isArenaProtection()
- + {
- + return _ArenaProtection;
- + }
- +
- + private boolean inArenaEvent = false;
- +
- + public void setInArenaEvent(boolean val)
- + {
- + inArenaEvent = val;
- + }
- +
- + public boolean isInArenaEvent()
- + {
- + return inArenaEvent;
- + }
- +
- + private boolean _ArenaAttack;
- +
- + public void setArenaAttack(boolean comm)
- + {
- + _ArenaAttack = comm;
- + }
- +
- + public boolean isArenaAttack()
- + {
- + return _ArenaAttack;
- + }
- +
- + private boolean _Arena1x1;
- +
- + public void setArena1x1(boolean comm)
- + {
- + _Arena1x1 = comm;
- + }
- +
- + public boolean isArena1x1()
- + {
- + return _Arena1x1;
- + }
- +
- + private boolean _Arena3x3;
- +
- + public void setArena3x3(boolean comm)
- + {
- + _Arena3x3 = comm;
- + }
- +
- + public boolean isArena3x3()
- + {
- + return _Arena3x3;
- + }
- +
- + private boolean _Arena5x5;
- +
- + public void setArena5x5(boolean comm)
- + {
- + _Arena5x5 = comm;
- + }
- +
- + public boolean isArena5x5()
- + {
- + return _Arena5x5;
- + }
- +
- + private boolean _Arena9x9;
- +
- + public void setArena9x9(boolean comm)
- + {
- + _Arena9x9 = comm;
- + }
- +
- + public boolean isArena9x9()
- + {
- + return _Arena9x9;
- + }
- +
- + private boolean _ArenaObserv;
- +
- + public void setArenaObserv(boolean comm)
- + {
- + _ArenaObserv = comm;
- + }
- +
- + public boolean isArenaObserv()
- + {
- + return _ArenaObserv;
- + }
- +
- /**
- * On magic hit timer.
- * @param targets the targets
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java
- index a47a65f..1bfb32d 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java
- @@ -41,6 +41,8 @@
- import org.l2jmobius.gameserver.instancemanager.IdManager;
- import org.l2jmobius.gameserver.instancemanager.QuestManager;
- import org.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager;
- +import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.instancemanager.games.Lottery;
- import org.l2jmobius.gameserver.model.DropCategory;
- import org.l2jmobius.gameserver.model.DropData;
- @@ -118,6 +120,10 @@
- private boolean _isSpoil = false;
- private int _castleIndex = -2;
- private int _fortIndex = -2;
- + public boolean isEventMob = false;
- + public boolean _isEventMobTvT = false;
- + public boolean _isEventVIPNPC = false;
- + public boolean _isEventVIPNPCEnd = false;
- private boolean _isInTown = false;
- private final boolean _isQuestMonster = getTemplate().isQuestMonster();
- private int _isSpoiledBy = 0;
- @@ -654,6 +660,15 @@
- // Send a Server->Client packet SocialAction to the all Player on the _knownPlayer of the Npc to display a social action of the Npc on their client
- broadcastSocialAction(Rnd.get(8));
- + // Open a chat window on client with the text of the NpcInstance
- + if (isEventMob)
- + {
- + GameEvent.showEventHtml(player, String.valueOf(getObjectId()));
- + }
- + else if (_isEventMobTvT)
- + {
- + TvT.showEventHtml(player, String.valueOf(getObjectId()));
- + }
- final List<Quest> questList = getTemplate().getEventQuests(EventType.NPC_FIRST_TALK);
- if (questList.size() == 1)
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Playable.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Playable.java
- index 15b726b..84d70d6 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Playable.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Playable.java
- @@ -458,6 +458,16 @@
- _lastCharmOfLuckEffect = null;
- }
- + /**
- + * Checks if is in fun event.
- + * @return true, if is in fun event
- + */
- + public boolean isInFunEvent()
- + {
- + final Player player = getActingPlayer();
- + return (player != null) && player.isInFunEvent();
- + }
- +
- public boolean isOnEvent()
- {
- return false;
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
- index ce1f47c..9deda4a 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java
- @@ -24,6 +24,7 @@
- import java.util.Collection;
- import java.util.Date;
- import java.util.HashMap;
- +import java.util.LinkedList;
- import java.util.List;
- import java.util.Map;
- import java.util.Map.Entry;
- @@ -84,6 +85,8 @@
- import org.l2jmobius.gameserver.instancemanager.RebirthManager;
- import org.l2jmobius.gameserver.instancemanager.RecipeManager;
- import org.l2jmobius.gameserver.instancemanager.SiegeManager;
- +import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.AccessLevel;
- import org.l2jmobius.gameserver.model.BlockList;
- import org.l2jmobius.gameserver.model.Duel;
- @@ -204,6 +207,7 @@
- import org.l2jmobius.gameserver.network.serverpackets.ObservationReturn;
- import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowUpdate;
- import org.l2jmobius.gameserver.network.serverpackets.PetInventoryUpdate;
- +import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
- import org.l2jmobius.gameserver.network.serverpackets.PledgeShowInfoUpdate;
- import org.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListDelete;
- import org.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListUpdate;
- @@ -326,6 +330,29 @@
- private boolean _isAio = false;
- private long _aioEndTime = 0;
- private boolean _expGain = true;
- + // event mod
- + public int eventX;
- + public int eventY;
- + public int eventZ;
- + public int eventKarma;
- + public int eventPvpKills;
- + public int eventPkKills;
- + public String eventTitle;
- + public List<String> kills = new LinkedList<>();
- + public boolean eventSitForced = false;
- + public boolean atEvent = false;
- + public String _teamNameTvT;
- + public String _originalTitleTvT;
- + public int _originalNameColorTvT = 0;
- + public int _countTvTkills;
- + public int _countTvTdies;
- + public int _originalKarmaTvT;
- + public boolean _inEventTvT = false;
- + public int _originalNameColor;
- + public int _countKills;
- + public int _originalKarma;
- + public int _eventKills;
- + public boolean _inEvent = false;
- private boolean _inOlympiadMode = false;
- private boolean _olympiadStart = false;
- private int[] _olympiadPosition;
- @@ -411,6 +438,7 @@
- private boolean _messageRefusal = false; // message refusal mode
- private boolean _dietMode = false; // ignore weight penalty
- private boolean _exchangeRefusal = false; // Exchange refusal
- + private boolean _isPartyInRefuse = false; // Party Refusal Mode
- private Party _party;
- private Player _activeRequester;
- private long _requestExpireTime = 0;
- @@ -639,6 +667,13 @@
- return;
- }
- + // during teleport phase, players cant do any attack
- + if ((TvT.isTeleport() && _inEventTvT))
- + {
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- // Pk protection config
- if (Config.ALLOW_CHAR_KILL_PROTECT && !isGM() && target.isPlayer() && (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getKarma() == 0))
- {
- @@ -685,7 +720,12 @@
- sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- -
- + // during teleport phase, players cant do any attack
- + if ((TvT.isTeleport() && _inEventTvT))
- + {
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- super.doCast(skill);
- if (!skill.isOffensive())
- @@ -3174,7 +3214,14 @@
- ThreadPool.schedule(new StandUpTask(this), 2000);
- stopFakeDeath(null);
- }
- -
- + if (GameEvent.active && eventSitForced)
- + {
- + sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
- + }
- + else if ((TvT.isSitForced() && _inEventTvT))
- + {
- + sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
- + }
- if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
- {
- if (_relax)
- @@ -4250,6 +4297,15 @@
- @Override
- public void onAction(Player player)
- {
- + // no Interaction with not participant to events
- + if (((TvT.isStarted() || TvT.isTeleport()) && !Config.TVT_ALLOW_INTERFERENCE))
- + {
- + if ((_inEventTvT && !player._inEventTvT) || (!_inEventTvT && player._inEventTvT))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- // Check if the Player is confused
- if (player.isOutOfControl())
- {
- @@ -4349,6 +4405,14 @@
- }
- else // Like L2OFF set the target of the Player player
- {
- + if (((TvT.isStarted() || TvT.isTeleport()) && !Config.TVT_ALLOW_INTERFERENCE))
- + {
- + if ((_inEventTvT && !player._inEventTvT) || (!_inEventTvT && player._inEventTvT))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- // Check if the Player is confused
- if (player.isOutOfControl())
- {
- @@ -4453,6 +4517,31 @@
- }
- }
- + @Override
- + public boolean isInFunEvent()
- + {
- + return (atEvent || isInStartedTVTEvent());
- + }
- +
- + public boolean isInStartedTVTEvent()
- + {
- + return (TvT.isStarted() && _inEventTvT);
- + }
- +
- + public boolean isRegisteredInTVTEvent()
- + {
- + return _inEventTvT;
- + }
- +
- + /**
- + * Checks if is registered in fun event.
- + * @return true, if is registered in fun event
- + */
- + public boolean isRegisteredInFunEvent()
- + {
- + return (atEvent || (_inEventTvT) || Olympiad.getInstance().isRegistered(this));
- + }
- +
- /**
- * Are player offensive skills locked.
- * @return true, if successful
- @@ -5532,6 +5621,54 @@
- if (killer != null)
- {
- final Player pk = killer.getActingPlayer();
- + if (pk != null)
- + {
- +
- + if (atEvent)
- + {
- + pk.kills.add(getName());
- + }
- +
- + if (_inEventTvT && pk._inEventTvT)
- + {
- + if (TvT.isTeleport() || TvT.isStarted())
- + {
- + if (!(pk._teamNameTvT.equals(_teamNameTvT)))
- + {
- + _countTvTdies++;
- + pk._countTvTkills++;
- + pk.setTitle("Kills: " + pk._countTvTkills);
- + pk.sendPacket(new PlaySound(0, "ItemSound.quest_itemget", this));
- + pk.broadcastUserInfo();
- + TvT.setTeamKillsCount(pk._teamNameTvT, TvT.teamKillsCount(pk._teamNameTvT) + 1);
- + pk.broadcastUserInfo();
- + }
- + else
- + {
- + pk.sendMessage("You are a teamkiller !!! Teamkills not counting.");
- + }
- + sendMessage("You will be revived and teleported to team spot in " + (Config.TVT_REVIVE_DELAY / 1000) + " seconds!");
- + ThreadPool.schedule(() ->
- + {
- + teleToLocation((TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, (TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)) + Rnd.get(201)) - 100, TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)));
- + doRevive();
- + }, Config.TVT_REVIVE_DELAY);
- + }
- + }
- + else if (_inEventTvT)
- + {
- + if (TvT.isTeleport() || TvT.isStarted())
- + {
- + sendMessage("You will be revived and teleported to team spot in " + (Config.TVT_REVIVE_DELAY / 1000) + " seconds!");
- + ThreadPool.schedule(() ->
- + {
- + teleToLocation(TvT._teamsX.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsY.get(TvT._teams.indexOf(_teamNameTvT)), TvT._teamsZ.get(TvT._teams.indexOf(_teamNameTvT)));
- + doRevive();
- + broadcastPacket(new SocialAction(getObjectId(), 15));
- + }, Config.TVT_REVIVE_DELAY);
- + }
- + }
- + }
- // Clear resurrect xp calculation
- setExpBeforeDeath(0);
- @@ -5637,11 +5774,14 @@
- */
- private void onDieDropItem(Creature killer)
- {
- - if (isOnEvent())
- + // if (isOnEvent())
- + // {
- + // return;
- + // }
- + if (atEvent || (TvT.isStarted() && _inEventTvT) || (killer == null))
- {
- return;
- }
- -
- if ((getKarma() <= 0) && (killer instanceof Player) && (((Player) killer).getClan() != null) && (getClan() != null) && ((Player) killer).getClan().isAtWarWith(getClanId()))
- {
- return;
- @@ -5759,11 +5899,14 @@
- return;
- }
- - if (isOnEvent())
- + // if (isOnEvent())
- + // {
- + // return;
- + // }
- + if ((_inEventTvT && TvT.isStarted()))
- {
- return;
- }
- -
- if (isCursedWeaponEquipped())
- {
- CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquipedId);
- @@ -5842,6 +5985,41 @@
- {
- AnnouncementsTable.getInstance().announceToAll("Player " + getName() + " hunted Player " + target.getName());
- }
- + // 'No war' or 'One way war' -> 'Normal PK'
- + if ((!_inEventTvT || !TvT.isStarted()))
- + {
- + if (targetPlayer.getKarma() > 0) // Target player has karma
- + {
- + if (Config.KARMA_AWARD_PK_KILL)
- + {
- + increasePvpKills();
- + }
- +
- + if ((target instanceof Player) && Config.ANNOUNCE_PVP_KILL)
- + {
- + AnnouncementsTable.getInstance().announceToAll("Player " + getName() + " hunted Player " + target.getName());
- + }
- + }
- + else if (targetPlayer.getPvpFlag() == 0) // Target player doesn't have karma
- + {
- + if (Config.FACTION_SYSTEM_ENABLED)
- + {
- + if ((_isGood && targetPlayer.isGood()) || (_isEvil && targetPlayer.isEvil()))
- + {
- + increasePkKillsAndKarma(targetPlayer.getLevel());
- + }
- + }
- + else
- + {
- + increasePkKillsAndKarma(targetPlayer.getLevel());
- + }
- +
- + if ((target instanceof Player) && Config.ANNOUNCE_PK_KILL)
- + {
- + AnnouncementsTable.getInstance().announceToAll("Player " + getName() + " has assassinated Player " + target.getName());
- + }
- + }
- + }
- else if ((target instanceof Player) && Config.ANNOUNCE_ALL_KILL)
- {
- AnnouncementsTable.getInstance().announceToAll("Player " + getName() + " killed Player " + target.getName());
- @@ -6038,7 +6216,10 @@
- {
- return;
- }
- -
- + if ((TvT.isStarted() && _inEventTvT))
- + {
- + return;
- + }
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- @@ -6080,6 +6261,10 @@
- {
- return;
- }
- + if ((TvT.isStarted() && _inEventTvT))
- + {
- + return;
- + }
- final int baseKarma = Config.KARMA_MIN_KARMA;
- int newKarma = baseKarma;
- @@ -6198,6 +6383,10 @@
- */
- public void updatePvPStatus()
- {
- + if ((TvT.isStarted() && _inEventTvT))
- + {
- + return;
- + }
- if (isInsideZone(ZoneId.PVP))
- {
- return;
- @@ -6236,6 +6425,10 @@
- return;
- }
- + if ((TvT.isStarted() && _inEventTvT && targetPlayer._inEventTvT))
- + {
- + return;
- + }
- if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && targetPlayer.isEvil()) || (isEvil() && targetPlayer.isGood())))
- {
- return;
- @@ -6318,6 +6511,18 @@
- // Calculate the Experience loss
- long lostExp = 0;
- + if (!atEvent && (!_inEventTvT || !TvT.isStarted()))
- + {
- + final byte maxLevel = ExperienceData.getInstance().getMaxLevel();
- + if (lvl < maxLevel)
- + {
- + lostExp = Math.round(((getStat().getExpForLevel(lvl + 1) - getStat().getExpForLevel(lvl)) * percentLost) / 100);
- + }
- + else
- + {
- + lostExp = Math.round(((getStat().getExpForLevel(maxLevel) - getStat().getExpForLevel(maxLevel - 1)) * percentLost) / 100);
- + }
- + }
- if (!isOnEvent())
- {
- final byte maxLevel = ExperienceData.getInstance().getMaxLevel();
- @@ -9090,6 +9295,36 @@
- {
- return false;
- }
- + // Check if the attacker is in an event
- + if (isOnEvent() && (attacker instanceof Playable))
- + {
- + final Player player = attacker.getActingPlayer();
- + if ((player != null) && player.isOnEvent())
- + {
- + return isOnSoloEvent() || (getTeam() != player.getTeam()) || (_inEventTvT && player._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(player._teamNameTvT));
- + }
- + }
- + if (attacker.isInArenaEvent())
- + {
- + Player player = null;
- + if (attacker instanceof Player)
- + {
- + player = (Player) attacker;
- + }
- + else if (attacker instanceof Summon)
- + {
- + player = ((Summon) attacker).getOwner();
- + }
- + if (player != null)
- + {
- + if (isArenaAttack() && player.isArenaAttack())
- + {
- + return true;
- + }
- +
- + return false;
- + }
- + }
- // Check if the Player has Karma
- if ((getKarma() > 0) || (getPvpFlag() > 0))
- @@ -9634,6 +9869,7 @@
- // Check if a Forced ATTACK is in progress on non-attackable target
- if (!target.isAutoAttackable(this) //
- && (!forceUse && ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */))) //
- + && (!_inEventTvT || !TvT.isStarted()) //
- && (skillTargetType != SkillTargetType.AURA) //
- && (skillTargetType != SkillTargetType.CLAN) //
- && (skillTargetType != SkillTargetType.ALLY) //
- @@ -9868,11 +10104,15 @@
- WorldObject target = worldObject;
- // Check if player and target are in events and on the same team.
- + // if ((target instanceof Player) && isOnEvent() && skill.isOffensive())
- + // {
- + // return target.getActingPlayer().isOnEvent() && (isOnSoloEvent() || (getTeam() != target.getActingPlayer().getTeam()));
- + // }
- + // Check if player and target are in events and on the same team.
- if ((target instanceof Player) && isOnEvent() && skill.isOffensive())
- {
- - return target.getActingPlayer().isOnEvent() && (isOnSoloEvent() || (getTeam() != target.getActingPlayer().getTeam()));
- + return target.getActingPlayer().isOnEvent() && (isOnSoloEvent() || (getTeam() != target.getActingPlayer().getTeam())) && ((skill.isOffensive() && (_inEventTvT && target.getActingPlayer()._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(target.getActingPlayer()._teamNameTvT))));
- }
- -
- // check for PC->PC Pvp status
- if (target instanceof Summon)
- {
- @@ -10868,6 +11108,22 @@
- return _exchangeRefusal;
- }
- + public boolean isPartyInRefuse()
- +
- + {
- +
- + return _isPartyInRefuse;
- +
- + }
- +
- + public void setIsPartyInRefuse(boolean value)
- +
- + {
- +
- + _isPartyInRefuse = value;
- +
- + }
- +
- /**
- * Gets the block list.
- * @return the block list
- @@ -12207,7 +12463,13 @@
- getParty().getDimensionalRift().memberRessurected(this);
- }
- - if (isOnEvent())
- + // if (isOnEvent())
- + // {
- + // getStatus().setCurrentHp(getMaxHp());
- + // getStatus().setCurrentMp(getMaxMp());
- + // getStatus().setCurrentCp(getMaxCp());
- + // }
- + if ((_inEventTvT && TvT.isStarted() && Config.TVT_REVIVE_RECOVERY))
- {
- getStatus().setCurrentHp(getMaxHp());
- getStatus().setCurrentMp(getMaxMp());
- @@ -15194,6 +15456,10 @@
- _punishTask = ThreadPool.schedule(new PunishTask(this), _punishTimer);
- sendMessage("You are in jail for " + (delayInMilliseconds / 60000) + " minutes.");
- }
- + if (_inEventTvT)
- + {
- + TvT.onDisconnect(this);
- + }
- if (Olympiad.getInstance().isRegisteredInComp(this))
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BroadcastingTower.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BroadcastingTower.java
- index 9066d7b..9386373 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BroadcastingTower.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/BroadcastingTower.java
- @@ -51,7 +51,12 @@
- player.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- -
- + if ((player._inEventTvT))
- + {
- + player.sendMessage("You already participate in an event!");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- if (player.isRegisteredOnEvent())
- {
- player.sendMessage("You already participate in an event!");
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/VillageMaster.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/VillageMaster.java
- index 0061cb9..5ebd896 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/VillageMaster.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/VillageMaster.java
- @@ -347,7 +347,12 @@
- player.setLocked(false);
- return;
- }
- -
- + if (player._inEventTvT)
- + {
- + player.sendMessage("You can't add a subclass while in an event.");
- + player.setLocked(false);
- + return;
- + }
- // Check player level
- if (player.getLevel() < 75)
- {
- @@ -448,6 +453,13 @@
- player.setLocked(false);
- return;
- }
- + // You can't change Subclass when you are registered in Events (TVT, CTF, DM)
- + if (player._inEventTvT)
- + {
- + player.sendMessage("You can't change subclass while in an event.");
- + player.setLocked(false);
- + return;
- + }
- // You can't change Subclass when you are registered in Olympiad
- if (Olympiad.getInstance().isRegisteredInComp(player) || (player.getOlympiadGameId() > 0))
- @@ -509,7 +521,13 @@
- player.setLocked(false);
- return;
- }
- -
- + // You can't change Subclass when you are registered in Events (TVT, CTF, DM)
- + if (player._inEventTvT)
- + {
- + player.sendMessage("You can't delete a subclass while in an event.");
- + player.setLocked(false);
- + return;
- + }
- // You can't delete Subclass when you are registered in Olympiad
- if (Olympiad.getInstance().isRegisteredInComp(player) || (player.getOlympiadGameId() > 0))
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
- index c92d3cc..25aed21 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
- @@ -38,6 +38,8 @@
- import org.l2jmobius.gameserver.data.sql.CharInfoTable;
- import org.l2jmobius.gameserver.data.sql.ClanTable;
- import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
- +import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.CharSelectInfoPackage;
- import org.l2jmobius.gameserver.model.World;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -45,6 +47,7 @@
- import org.l2jmobius.gameserver.model.olympiad.Olympiad;
- import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
- import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- +import org.l2jmobius.gameserver.util.EventData;
- import org.l2jmobius.gameserver.util.FloodProtectors;
- /**
- @@ -485,6 +488,17 @@
- final Player player = _player;
- if (player != null) // this should only happen on connection loss
- {
- + // we store all data from players who are disconnected while in an event in order to restore it in the next login
- + if (player.atEvent)
- + {
- + final EventData data = new EventData(player.eventX, player.eventY, player.eventZ, player.eventKarma, player.eventPvpKills, player.eventPkKills, player.eventTitle, player.kills, player.eventSitForced);
- + GameEvent.connectionLossData.put(player.getName(), data);
- + }
- + else if (player._inEventTvT)
- + {
- + TvT.onDisconnect(player);
- + }
- +
- if (player.isFlying())
- {
- player.removeSkill(SkillTable.getInstance().getSkill(4289, 1));
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/AttackRequest.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/AttackRequest.java
- index 833f5d2..f49283c 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/AttackRequest.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/AttackRequest.java
- @@ -17,9 +17,11 @@
- package org.l2jmobius.gameserver.network.clientpackets;
- import org.l2jmobius.commons.network.ReadablePacket;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.World;
- import org.l2jmobius.gameserver.model.WorldObject;
- import org.l2jmobius.gameserver.model.actor.Player;
- +import org.l2jmobius.gameserver.model.actor.Summon;
- import org.l2jmobius.gameserver.model.actor.instance.Servitor;
- import org.l2jmobius.gameserver.network.GameClient;
- import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
- @@ -96,6 +98,34 @@
- return;
- }
- + // During teleport phase, players cant do any attack
- + if ((TvT.isTeleport() && player._inEventTvT))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- + // No attacks to same team in Event
- + if (TvT.isStarted())
- + {
- + if (target instanceof Player)
- + {
- + if ((player._inEventTvT && ((Player) target)._inEventTvT) && player._teamNameTvT.equals(((Player) target)._teamNameTvT))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- + else if (target instanceof Summon)
- + {
- + if ((player._inEventTvT && ((Summon) target).getOwner()._inEventTvT) && player._teamNameTvT.equals(((Summon) target).getOwner()._teamNameTvT))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- + }
- +
- // No attacks to same team in event
- if (player.isOnEvent() && !player.isOnSoloEvent())
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java
- index fb7f499..9da0f73 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java
- @@ -42,6 +42,7 @@
- import org.l2jmobius.gameserver.instancemanager.RebirthManager;
- import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
- import org.l2jmobius.gameserver.instancemanager.SiegeManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Skill;
- import org.l2jmobius.gameserver.model.Wedding;
- import org.l2jmobius.gameserver.model.World;
- @@ -444,6 +445,11 @@
- RebirthManager.getInstance().grantRebirthSkills(player);
- }
- + if (TvT._savePlayers.contains(player.getName()))
- + {
- + TvT.addDisconnectedPlayer(player);
- + }
- +
- // Means that it's not ok multiBox situation, so logout.
- if (!player.canMultiBox())
- {
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestBypassToServer.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestBypassToServer.java
- index dcfe0f4..a4f8244 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestBypassToServer.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestBypassToServer.java
- @@ -27,6 +27,8 @@
- import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
- import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
- import org.l2jmobius.gameserver.instancemanager.RebirthManager;
- +import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Location;
- import org.l2jmobius.gameserver.model.World;
- import org.l2jmobius.gameserver.model.WorldObject;
- @@ -155,6 +157,39 @@
- try
- {
- + if (_command.substring(endOfId + 1).startsWith("event_participate"))
- + {
- + GameEvent.inscribePlayer(player);
- + }
- + else if (_command.substring(endOfId + 1).startsWith("tvt_player_join "))
- + {
- + final String teamName = _command.substring(endOfId + 1).substring(16);
- + if (TvT.isJoining())
- + {
- + TvT.addPlayer(player, teamName);
- + }
- + else
- + {
- + player.sendMessage("The event is already started. You can not join now!");
- + }
- + }
- + else if (_command.substring(endOfId + 1).startsWith("tvt_player_leave"))
- + {
- + if (TvT.isJoining())
- + {
- + TvT.removePlayer(player);
- + }
- + else
- + {
- + player.sendMessage("The event is already started. You can not leave now!");
- + }
- + }
- +
- + if (_command.substring(endOfId + 1).startsWith("event_participate"))
- + {
- + GameEvent.inscribePlayer(player);
- + }
- +
- final WorldObject object = World.getInstance().findObject(Integer.parseInt(id));
- if ((Config.ALLOW_CLASS_MASTERS && Config.ALLOW_REMOTE_CLASS_MASTERS && (object instanceof ClassMaster)) //
- || ((object instanceof Npc) && (endOfId > 0) && player.isInsideRadius2D(object, Npc.INTERACTION_DISTANCE)))
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java
- index b3bb662..acc50ce 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java
- @@ -17,6 +17,7 @@
- package org.l2jmobius.gameserver.network.clientpackets;
- import org.l2jmobius.commons.network.ReadablePacket;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.BlockList;
- import org.l2jmobius.gameserver.model.Party;
- import org.l2jmobius.gameserver.model.World;
- @@ -54,6 +55,21 @@
- return;
- }
- + if ((requestor._inEventTvT && !target._inEventTvT && (TvT.isStarted() || TvT.isTeleport())) || (!requestor._inEventTvT && target._inEventTvT && (TvT.isStarted() || TvT.isTeleport())))
- + {
- + requestor.sendMessage("You can't invite that player in party: you or your target are in Event");
- + return;
- + }
- + if (target.isPartyInRefuse())
- +
- + {
- +
- + requestor.sendMessage("[Party Refuse]: Player in refusal party.");
- +
- + return;
- +
- + }
- +
- if (target.isInParty())
- {
- final SystemMessage msg = new SystemMessage(SystemMessageId.S1_IS_A_MEMBER_OF_ANOTHER_PARTY_AND_CANNOT_BE_INVITED);
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestart.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestart.java
- index 2ef23aa..a2516e3 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestart.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestart.java
- @@ -119,6 +119,14 @@
- return;
- }
- + // Check if player is in Event
- + if (player._inEventTvT)
- + {
- + player.sendMessage("You can't restart during Event.");
- + player.sendPacket(RestartResponse.valueOf(false));
- + return;
- + }
- +
- player.getInventory().updateDatabase();
- // Fix against exploit anti-target
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java
- index aa1ed7f..7ddd035 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java
- @@ -26,6 +26,7 @@
- import org.l2jmobius.gameserver.instancemanager.CastleManager;
- import org.l2jmobius.gameserver.instancemanager.FortManager;
- import org.l2jmobius.gameserver.instancemanager.QuestManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.Location;
- import org.l2jmobius.gameserver.model.actor.Player;
- import org.l2jmobius.gameserver.model.quest.Quest;
- @@ -117,6 +118,12 @@
- return;
- }
- + else if ((_player._inEventTvT && TvT.isStarted()))
- + {
- + _player.sendMessage("You cannot do that while participating in an event!");
- + return;
- + }
- +
- try
- {
- Location loc = null;
- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/Die.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/Die.java
- index ee75ca2..4c43e12 100644
- --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/Die.java
- +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/Die.java
- @@ -18,6 +18,7 @@
- import org.l2jmobius.gameserver.instancemanager.CastleManager;
- import org.l2jmobius.gameserver.instancemanager.FortManager;
- +import org.l2jmobius.gameserver.instancemanager.events.TvT;
- import org.l2jmobius.gameserver.model.actor.Attackable;
- import org.l2jmobius.gameserver.model.actor.Creature;
- import org.l2jmobius.gameserver.model.actor.Player;
- @@ -45,7 +46,7 @@
- final Player player = creature.getActingPlayer();
- _allowFixedRes = player.getAccessLevel().allowFixedRes();
- _clan = player.getClan();
- - _canTeleport = !player.isPendingRevive();
- + _canTeleport = ((!TvT.isStarted() || !player._inEventTvT) && !player.isOnEvent() && !player.isPendingRevive());
- }
- _objectId = creature.getObjectId();
- _fake = !creature.isDead();
- ======================================================================================
- \L2jMobius_c6_interlude\game\config\custom\TvTEvents.ini
- ======================================================================================
- #====================================#
- # Team vs Team #
- #====================================#
- # TvT(Team vs Team) Event: Blue vs Red.
- # Setting for Team vs. Team pvp
- # TvTEvenTeams = NO|BALANCE|SHUFFLE
- # NO means: not even teams.
- # BALANCE means: Players can only join team with lowest player count.
- # SHUFFLE means: Players can only participate to tzhe event and not direct to a team. Teams will be schuffeled in teleporting teams.
- TvTEvenTeams = SHUFFLE
- # players there not participated in tvt can target tvt participants?
- TvTAllowInterference = False
- # tvt participants can use potions?
- TvTAllowPotions = True
- # tvt participants can summon by item?
- TvTAllowSummon = True
- # remove all effects of tvt participants on event start?
- TvTOnStartRemoveAllEffects = False
- # unsummon pet of tvt participants on event start?
- TvTOnStartUnsummonPet = True
- # on revive participants regain full hp/mp/cp ?
- TvTReviveRecovery = True
- # announce all team statistics
- TvTAnnounceTeamStats = True
- # announce reward
- TvTAnnounceReward = True
- # give price with 0 kills
- TvTPriceNoKills = True
- # players with cursed weapon are allowed to join ?
- TvTJoinWithCursedWeapon = False
- # Enable voice command to register on tvt event
- TvTCommand = True
- # Delay on revive when dead, NOTE: 20000 equals to 20 seconds, minimum 1000 (1 second)
- TvTReviveDelay = 10000
- # Open Western Fortress doors on tvt finish
- TvTOpenFortDoors = False
- # Close Western Fortress doors on tvt start
- TvTCloseFortDoors = False
- # Open Aden Colosseum doors on tvt finish
- TvTOpenAdenColosseumDoors = True
- # Close Aden Colosseum doors on tvt start
- TvTCloseAdenColosseumDoors = True
- # TvT Top Killer reward id
- TvTTopKillerRewardId = 5575
- # TvT Top Killer reward quantity
- TvTTopKillerRewardQty = 5000000
- # Place an aura on participants team ?
- TvTAura = False
- # Enable event stats logger
- TvTStatsLogger = True
- # Remove Buffs on player die
- TvTRemoveBuffsOnPlayerDie = False
- ======================================================================================
- \L2jMobius_c6_interlude\game\config\custom\EventManager.ini
- ======================================================================================
- #============================================================#
- # Event Manager #
- #============================================================#
- # Enable auto events and start time.
- # TvT auto start
- # Example TVTStartTime = 20:00;21:00;22:00;
- TVTEventEnabled = True
- TVTStartTime = 16:50;15:15;01:30;
- ======================================================================================
- SQL
- ======================================================================================
- tvt.sql
- -- -----------------------
- -- Table structure for tvt
- -- -----------------------
- DROP TABLE IF EXISTS `tvt`;
- CREATE TABLE `tvt` (
- `eventName` varchar(255) NOT NULL DEFAULT '',
- `eventDesc` varchar(255) NOT NULL DEFAULT '',
- `joiningLocation` varchar(255) NOT NULL DEFAULT '',
- `minLevel` int(4) NOT NULL DEFAULT '0',
- `maxLevel` int(4) NOT NULL DEFAULT '0',
- `npcId` int(8) NOT NULL DEFAULT '0',
- `npcX` int(11) NOT NULL DEFAULT '0',
- `npcY` int(11) NOT NULL DEFAULT '0',
- `npcZ` int(11) NOT NULL DEFAULT '0',
- `npcHeading` int(11) NOT NULL DEFAULT '0',
- `rewardId` int(11) NOT NULL DEFAULT '0',
- `rewardAmount` int(11) NOT NULL DEFAULT '0',
- `teamsCount` int(4) NOT NULL DEFAULT '0',
- `joinTime` int(11) NOT NULL DEFAULT '0',
- `eventTime` int(11) NOT NULL DEFAULT '0',
- `minPlayers` int(4) NOT NULL DEFAULT '0',
- `maxPlayers` int(4) NOT NULL DEFAULT '0',
- `delayForNextEvent` BIGINT NOT NULL DEFAULT '0'
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- -- ---------------------
- -- Records for table tvt
- -- ---------------------
- INSERT INTO `tvt` values
- ('TVT', 'A PvP Event', 'Giran', 1, 81, 70010, 82688, 148677, -3469, 0, 8752, 1, 2, 5, 5, 2, 50, 300000);
- ======================================================================================
- SQL
- ======================================================================================
- tvt_teams.sql
- -- -----------------------------
- -- Table structure for tvt_teams
- -- -----------------------------
- DROP TABLE IF EXISTS `tvt_teams`;
- CREATE TABLE `tvt_teams` (
- `teamId` int(4) NOT NULL DEFAULT '0',
- `teamName` varchar(255) NOT NULL DEFAULT '',
- `teamX` int(11) NOT NULL DEFAULT '0',
- `teamY` int(11) NOT NULL DEFAULT '0',
- `teamZ` int(11) NOT NULL DEFAULT '0',
- `teamColor` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`teamId`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- -- ---------------------------
- -- Records for table tvt_teams
- -- ---------------------------
- INSERT INTO `tvt_teams` VALUES
- ('0', 'Blue', '148179', '45841', '-3413', '16711680'),
- ('1', 'Red', '150787', '45822', '-3413', '255'),
- ('2', 'Green', '149496', '47826', '-3413', '26367');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement