Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P Game
- Index: java/realtek/gameserver/network/clientpackets/RequestRestartPoint.java
- ===================================================================
- --- java/realtek/gameserver/network/clientpackets/RequestRestartPoint.java (revision 718)
- +++ java/realtek/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
- @@ -22,6 +22,7 @@
- import realtek.gameserver.ThreadPoolManager;
- import realtek.gameserver.datatables.MapRegionTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.instancemanager.CastleManager;
- import realtek.gameserver.instancemanager.ClanHallManager;
- @@ -172,6 +173,9 @@
- if (TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
- return;
- + if (GvEEvent.isStarted() && GvEEvent.isPlayerParticipant(activeChar.getName()))
- + return;
- +
- //SystemMessage sm2 = new SystemMessage(SystemMessage.S1_S2);
- //sm2.addString("type:"+requestedPointType);
- //activeChar.sendPacket(sm2);
- Index: java/realtek/gameserver/model/actor/instance/L2GvENpcInstance.java
- ===================================================================
- --- java/realtek/gameserver/model/actor/instance/L2GvENpcInstance.java (revision 0)
- +++ java/realtek/gameserver/model/actor/instance/L2GvENpcInstance.java (revision 0)
- @@ -0,0 +1,84 @@
- +/*
- + * 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
- + */
- +package realtek.gameserver.model.actor.instance;
- +
- +import realtek.Config;
- +import realtek.gameserver.cache.HtmCache;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- +import realtek.gameserver.network.serverpackets.ActionFailed;
- +import realtek.gameserver.network.serverpackets.NpcHtmlMessage;
- +import realtek.gameserver.templates.L2NpcTemplate;
- +
- +public class L2GvENpcInstance extends L2NpcInstance
- +{
- + public L2GvENpcInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance playerInstance, String command)
- + {
- + GvEEvent.onBypass(command, playerInstance);
- + }
- +
- + @Override
- + public void showChatWindow(L2PcInstance playerInstance, int val)
- + {
- + if (playerInstance == null)
- + return;
- + if (GvEEvent.isParticipating())
- + {
- + String htmFile = "data/html/mods/";
- + if (!GvEEvent.isPlayerParticipant(playerInstance.getName()))
- + htmFile += "GvEEventParticipation";
- + else
- + htmFile += "GvEEventRemoveParticipation";
- + htmFile += ".htm";
- + String htmContent = HtmCache.getInstance().getHtm(htmFile);
- + if (htmContent != null)
- + {
- + int[] teamsPlayerCounts = GvEEvent.getTeamsPlayerCounts();
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
- + npcHtmlMessage.setHtml(htmContent);
- + npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
- + npcHtmlMessage.replace("%team1name%", Config.GVE_EVENT_TEAM_1_NAME);
- + npcHtmlMessage.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
- + npcHtmlMessage.replace("%team2name%", Config.GVE_EVENT_TEAM_2_NAME);
- + npcHtmlMessage.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
- + playerInstance.sendPacket(npcHtmlMessage);
- + }
- + }
- + else if (GvEEvent.isStarting() || GvEEvent.isStarted())
- + {
- + String htmFile = "data/html/mods/GvEEventStatus.htm";
- + String htmContent = HtmCache.getInstance().getHtm(htmFile);
- + if (htmContent != null)
- + {
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
- + npcHtmlMessage.setHtml(htmContent);
- + // npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
- + npcHtmlMessage.replace("%team1name%", Config.GVE_EVENT_TEAM_1_NAME);
- + npcHtmlMessage.replace("%team2name%", Config.GVE_EVENT_TEAM_2_NAME);
- + playerInstance.sendPacket(npcHtmlMessage);
- + }
- + }
- + playerInstance.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- +}
- \ No newline at end of file
- Index: Settings/Modifications/Events.ini
- ===================================================================
- --- Settings/Modifications/Events.ini (revision 718)
- +++ Settings/Modifications/Events.ini (working copy)
- @@ -93,6 +93,60 @@
- # Example: 1504,1;1500,1;1501,1;1085,3
- TvTEventMageBuffs =
- +# -----------------------------
- +# GvE Event Engine
- +# -----------------------------
- +# Enable GvEEvent
- +GvEEventEnabled = false
- +
- +# Time Between TvT events (in minutes, 300 = 5 hours)
- +GvEEventInterval = 300
- +
- +# Registration timer (in minutes) from start of event.
- +GvEEventParticipationTime = 60
- +
- +# Event running time, in minutes
- +GvEEventRunningTime = 20
- +
- +# TvT Event NPC Details (create a custom npc of type L2GvENpc)
- +GvEEventParticipationNpcId = 70011
- +GvEEventParticipationNpcCoordinates = 83425,148585,-3406
- +
- +# Minimum amount of players allowed in each team
- +GvEEventMinPlayersInTeams = 1
- +GvEEventMaxPlayersInTeams = 20
- +
- +# Level rules
- +GvEEventMinPlayerLevel = 1
- +GvEEventMaxPlayerLevel = 80
- +
- +# Teleport delay Timers (in seconds)
- +GvEEventRespawnTeleportDelay = 10
- +GvEEventStartLeaveTeleportDelay = 10
- +
- +# First Team Details (name, start and death x,y,z tp point)
- +GvEEventTeam1Name = Good
- +GvEEventTeam1Coordinates = 148695,46725,-3414
- +
- +# Second Team Details (name, start and death x,y,z tp point)
- +GvEEventTeam2Name = Evil
- +GvEEventTeam2Coordinates = 149999,46728,-3414
- +
- +# Reward for winning team
- +# itemId,amount;itemId,amount;itemId,amount;...
- +# no ";" at the start or end
- +GvEEventReward = 57,100000;5575,1000
- +
- +# GvEEvent Rules
- +GvEEventTargetTeamMembersAllowed = true
- +GvEEventPotionsAllowed = false
- +GvEEventSummonByItemAllowed = false
- +
- +# Door id's to close/open on start/end
- +# ex.: 1;2;3;4;5;6
- +# no ";" at the start or end
- +GvEEventDoorsCloseOpenOnStartEnd =
- +
- # -------------------------------------
- # Engine Not Done !
- # -------------------------------------
- Index: java/realtek/gameserver/events/engines/gve/GvETeleporter.java
- ===================================================================
- --- java/realtek/gameserver/events/engines/gve/GvETeleporter.java (revision 0)
- +++ java/realtek/gameserver/events/engines/gve/GvETeleporter.java (revision 0)
- @@ -0,0 +1,88 @@
- +/*
- + * 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
- + */
- +package realtek.gameserver.events.engines.gve;
- +
- +import realtek.Config;
- +import realtek.gameserver.ThreadPoolManager;
- +import realtek.gameserver.model.L2Effect;
- +import realtek.gameserver.model.L2Summon;
- +import realtek.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Realtek
- + */
- +public class GvETeleporter implements Runnable
- +{
- + /** The instance of the player to teleport */
- + private L2PcInstance _playerInstance;
- + /** Coordinates of the spot to teleport to */
- + private int[] _coordinates = new int[3];
- + /** Admin removed this player from event */
- + private boolean _adminRemove;
- +
- + /**
- + * Initialize the teleporter and start the delayed task
- + *
- + * @param playerInstance
- + * @param coordinates
- + * @param reAdd
- + */
- + public GvETeleporter(L2PcInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove)
- + {
- + _playerInstance = playerInstance;
- + _coordinates = coordinates;
- + _adminRemove = adminRemove;
- + // in config as seconds
- + long delay = (GvEEvent.isStarted() ? Config.GVE_EVENT_RESPAWN_TELEPORT_DELAY : Config.GVE_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000;
- + if (fastSchedule)
- + delay = 0;
- + ThreadPoolManager.getInstance().scheduleGeneral(this, delay);
- + }
- +
- + /**
- + * The task method to teleport the player<br>
- + * 1. Unsummon pet if there is one 2. Remove all effects 3. Revive and full heal the player 4. Teleport the player 5. Broadcast status and user info
- + *
- + * @see java.lang.Runnable#run()
- + */
- + public void run()
- + {
- + if (_playerInstance == null)
- + return;
- + L2Summon summon = _playerInstance.getPet();
- + if (summon != null)
- + summon.unSummon(_playerInstance);
- + for (L2Effect effect : _playerInstance.getAllEffects())
- + {
- + if (effect != null)
- + effect.exit();
- + }
- + _playerInstance.doRevive();
- + _playerInstance.setCurrentCp(_playerInstance.getMaxCp());
- + _playerInstance.setCurrentHp(_playerInstance.getMaxHp());
- + _playerInstance.setCurrentMp(_playerInstance.getMaxMp());
- + _playerInstance.teleToLocation(_coordinates[0], _coordinates[1], _coordinates[2], false);
- + if (GvEEvent.isStarted() && !_adminRemove)
- + _playerInstance.setTeam(GvEEvent.getParticipantTeamId(_playerInstance.getName()) + 1);
- + else
- + _playerInstance.setTeam(0);
- + _playerInstance.broadcastStatusUpdate();
- + _playerInstance.broadcastUserInfo();
- + }
- +}
- Index: java/realtek/gameserver/handler/voicedcommandhandlers/Wedding.java
- ===================================================================
- --- java/realtek/gameserver/handler/voicedcommandhandlers/Wedding.java (revision 718)
- +++ java/realtek/gameserver/handler/voicedcommandhandlers/Wedding.java (working copy)
- @@ -13,6 +13,7 @@
- import realtek.gameserver.ThreadPoolManager;
- import realtek.gameserver.ai.CtrlIntention;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IVoicedCommandHandler;
- import realtek.gameserver.instancemanager.CastleManager;
- @@ -326,6 +327,11 @@
- activeChar.sendMessage("[Wedding Manager]: You are in the dimensional rift.");
- return false;
- }
- + else if (!GvEEvent.onEscapeUse(activeChar.getName()))
- + {
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- else if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
- {
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- Index: java/realtek/gameserver/handler/itemhandlers/SummonItems.java
- ===================================================================
- --- java/realtek/gameserver/handler/itemhandlers/SummonItems.java (revision 718)
- +++ java/realtek/gameserver/handler/itemhandlers/SummonItems.java (working copy)
- @@ -31,6 +31,7 @@
- import realtek.gameserver.datatables.SummonItemsData;
- import realtek.gameserver.events.engines.CTF;
- import realtek.gameserver.events.engines.TvT;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IItemHandler;
- import realtek.gameserver.idfactory.IdFactory;
- @@ -66,6 +67,9 @@
- if (!TvTEvent.onItemSummon(playable.getObjectId()))
- return;
- + if (!GvEEvent.onItemSummon(playable.getName()))
- + return;
- +
- if (activeChar._inEventTvT && TvT._started && !Config.TVT_ALLOW_SUMMON)
- {
- activeChar.sendMessage("You are not allowed to summon by items in event.");
- Index: java/realtek/Config.java
- ===================================================================
- --- java/realtek/Config.java (revision 718)
- +++ java/realtek/Config.java (working copy)
- @@ -369,7 +369,6 @@
- public static boolean CUSTOM_DROPLIST_TABLE;
- public static boolean CUSTOM_MERCHANT_TABLES;
- -
- /** Options */
- public static String DEFAULT_GLOBAL_CHAT;
- public static String DEFAULT_TRADE_CHAT;
- @@ -679,6 +678,27 @@
- public static int TVT_EVENT_EFFECTS_REMOVAL;
- public static TIntIntHashMap TVT_EVENT_FIGHTER_BUFFS;
- public static TIntIntHashMap TVT_EVENT_MAGE_BUFFS;
- + public static boolean GVE_EVENT_ENABLED;
- + public static String[] GVE_EVENT_INTERVAL;
- + public static int GVE_EVENT_PARTICIPATION_TIME;
- + public static int GVE_EVENT_RUNNING_TIME;
- + public static int GVE_EVENT_PARTICIPATION_NPC_ID;
- + public static int[] GVE_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];
- + public static int GVE_EVENT_MIN_PLAYERS_IN_TEAMS;
- + public static int GVE_EVENT_MAX_PLAYERS_IN_TEAMS;
- + public static int GVE_EVENT_RESPAWN_TELEPORT_DELAY;
- + public static int GVE_EVENT_START_LEAVE_TELEPORT_DELAY;
- + public static String GVE_EVENT_TEAM_1_NAME;
- + public static int[] GVE_EVENT_TEAM_1_COORDINATES = new int[3];
- + public static String GVE_EVENT_TEAM_2_NAME;
- + public static int[] GVE_EVENT_TEAM_2_COORDINATES = new int[3];
- + public static List<int[]> GVE_EVENT_REWARDS = new FastList<int[]>();
- + public static boolean GVE_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;
- + public static boolean GVE_EVENT_POTIONS_ALLOWED;
- + public static boolean GVE_EVENT_SUMMON_BY_ITEM_ALLOWED;
- + public static List<Integer> GVE_EVENT_DOOR_IDS = new FastList<Integer>();
- + public static byte GVE_EVENT_MIN_LVL;
- + public static byte GVE_EVENT_MAX_LVL;
- // ------------------------------------------------------ //
- // NOT DONE //
- @@ -1867,6 +1887,111 @@
- }
- }
- + GVE_EVENT_ENABLED = Boolean.parseBoolean(Events.getProperty("GvEEventEnabled", "False"));
- + GVE_EVENT_INTERVAL = Events.getProperty("GvEEventInterval", "20:00").split(",");
- + GVE_EVENT_PARTICIPATION_TIME = Integer.parseInt(Events.getProperty("GvEEventParticipationTime", "3600"));
- + GVE_EVENT_RUNNING_TIME = Integer.parseInt(Events.getProperty("GvEEventRunningTime", "1800"));
- + GVE_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(Events.getProperty("GvEEventParticipationNpcId", "0"));
- +
- +
- + if (GVE_EVENT_PARTICIPATION_NPC_ID == 0)
- + {
- + GVE_EVENT_ENABLED = false;
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventParticipationNpcId");
- + }
- + else
- + {
- + String[] propertySplit = Events.getProperty("GvEEventParticipationNpcCoordinates", "0,0,0").split(",");
- +
- + if (propertySplit.length < 3)
- + {
- + GVE_EVENT_ENABLED = false;
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventParticipationNpcCoordinates");
- + }
- + else
- + {
- + GVE_EVENT_PARTICIPATION_NPC_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- + GVE_EVENT_PARTICIPATION_NPC_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- + GVE_EVENT_PARTICIPATION_NPC_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- +
- + GVE_EVENT_MIN_PLAYERS_IN_TEAMS = Integer.parseInt(Events.getProperty("GvEEventMinPlayersInTeams", "1"));
- + GVE_EVENT_MAX_PLAYERS_IN_TEAMS = Integer.parseInt(Events.getProperty("GvEEventMaxPlayersInTeams", "20"));
- + GVE_EVENT_MIN_LVL = (byte)Integer.parseInt(Events.getProperty("GvEEventMinPlayerLevel", "1"));
- + GVE_EVENT_MAX_LVL = (byte)Integer.parseInt(Events.getProperty("GvEEventMaxPlayerLevel", "80"));
- + GVE_EVENT_RESPAWN_TELEPORT_DELAY = Integer.parseInt(Events.getProperty("GvEEventRespawnTeleportDelay", "20"));
- + GVE_EVENT_START_LEAVE_TELEPORT_DELAY = Integer.parseInt(Events.getProperty("GvEEventStartLeaveTeleportDelay", "20"));
- +
- + GVE_EVENT_TEAM_1_NAME = Events.getProperty("GvEEventTeam1Name", "Team1");
- + propertySplit = Events.getProperty("GvEEventTeam1Coordinates", "0,0,0").split(",");
- +
- + if (propertySplit.length < 3)
- + {
- + GVE_EVENT_ENABLED = false;
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventTeam1Coordinates");
- + }
- + else
- + {
- + GVE_EVENT_TEAM_1_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- + GVE_EVENT_TEAM_1_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- + GVE_EVENT_TEAM_1_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- +
- + GVE_EVENT_TEAM_2_NAME = Events.getProperty("GvEEventTeam2Name", "Team2");
- + propertySplit = Events.getProperty("GvEEventTeam2Coordinates", "0,0,0").split(",");
- +
- + if (propertySplit.length < 3)
- + {
- + GVE_EVENT_ENABLED= false;
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventTeam2Coordinates");
- + }
- + else
- + {
- + GVE_EVENT_TEAM_2_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- + GVE_EVENT_TEAM_2_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- + GVE_EVENT_TEAM_2_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- + propertySplit = Events.getProperty("GvEEventReward", "57,100000").split(";");
- +
- + for (String reward : propertySplit)
- + {
- + String[] rewardSplit = reward.split(",");
- +
- + if (rewardSplit.length != 2)
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventReward \"" + reward + "\"");
- + else
- + {
- + try
- + {
- + GVE_EVENT_REWARDS.add(new int[]{Integer.valueOf(rewardSplit[0]), Integer.valueOf(rewardSplit[1])});
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (!reward.equals(""))
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventReward \"" + reward + "\"");
- + }
- + }
- + }
- +
- + GVE_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = Boolean.parseBoolean(Events.getProperty("GvEEventTargetTeamMembersAllowed", "true"));
- + GVE_EVENT_POTIONS_ALLOWED = Boolean.parseBoolean(Events.getProperty("GvEEventPotionsAllowed", "false"));
- + GVE_EVENT_SUMMON_BY_ITEM_ALLOWED = Boolean.parseBoolean(Events.getProperty("GvEEventSummonByItemAllowed", "false"));
- + propertySplit = Events.getProperty("GvEEventDoorsCloseOpenOnStartEnd", "").split(";");
- +
- + for (String door : propertySplit)
- + {
- + try
- + {
- + GVE_EVENT_DOOR_IDS.add(Integer.valueOf(door));
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (!door.equals(""))
- + System.out.println("GvEEventEngine[Config.load()]: invalid config property -> GvEEventDoorsCloseOpenOnStartEnd \"" + door + "\"");
- + }
- + }
- + }
- + }
- + }
- + }
- +
- // ------------------------------------------------------ //
- // NOT DONE //
- // ------------------------------------------------------ //
- @@ -2507,6 +2632,11 @@
- else if (pName.equalsIgnoreCase("TvTEventParticipationTime")) TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
- + else if (pName.equalsIgnoreCase("GvEEventEnabled")) GVE_EVENT_ENABLED = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("GvEEventInterval")) GVE_EVENT_INTERVAL = pValue.split(",");
- + else if (pName.equalsIgnoreCase("GvEEventParticipationTime")) GVE_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
- + else if (pName.equalsIgnoreCase("GvEEventRunningTime")) GVE_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
- + else if (pName.equalsIgnoreCase("GvEEventParticipationNpcId")) GVE_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
- else return false;
- return true;
- }
- Index: java/realtek/gameserver/Olympiad.java
- ===================================================================
- --- java/realtek/gameserver/Olympiad.java (revision 718)
- +++ java/realtek/gameserver/Olympiad.java (working copy)
- @@ -44,6 +44,7 @@
- import realtek.L2DatabaseFactory;
- import realtek.gameserver.datatables.HeroSkillTable;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.instancemanager.OlympiadStadiaManager;
- import realtek.gameserver.model.Inventory;
- @@ -427,6 +428,12 @@
- return false;
- }
- + if (GvEEvent.isPlayerParticipant(noble.getName()))
- + {
- + noble.sendMessage("You can't join olympiad while participating on GvE Event.");
- + return false;
- + }
- +
- if (!noble.isNoble())
- {
- sm = new SystemMessage(SystemMessageId.ONLY_NOBLESS_CAN_PARTICIPATE_IN_THE_OLYMPIAD);
- Index: java/realtek/gameserver/GameServer.java
- ===================================================================
- --- java/realtek/gameserver/GameServer.java (revision 705)
- +++ java/realtek/gameserver/GameServer.java (working copy)
- @@ -65,6 +65,7 @@
- import realtek.gameserver.datatables.SummonItemsData;
- import realtek.gameserver.datatables.TeleportLocationTable;
- import realtek.gameserver.datatables.ZoneData;
- +import realtek.gameserver.events.engines.gve.manager.GvEManager;
- import realtek.gameserver.events.engines.tvt.manager.TvTManager;
- import realtek.gameserver.events.games.ArenaLeaderboard;
- import realtek.gameserver.events.games.CraftLeaderboard;
- @@ -402,6 +403,7 @@
- if (Config.VOTE_EVENT)
- VoteManager.getInstance();
- TvTManager.getInstance();
- + GvEManager.getInstance();
- Util.printSection("Status");
- _log.info("Loading automatic online players status...");
- Index: java/realtek/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/realtek/gameserver/model/actor/instance/L2PcInstance.java (revision 718)
- +++ java/realtek/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -69,6 +69,7 @@
- import realtek.gameserver.datatables.SkillTreeTable;
- import realtek.gameserver.events.engines.CTF;
- import realtek.gameserver.events.engines.TvT;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.events.games.ArenaLeaderboard;
- import realtek.gameserver.handler.ItemHandler;
- @@ -4383,6 +4384,7 @@
- L2PcInstance pk = null;
- TvTEvent.onKill(killer, this);
- + GvEEvent.onKill(killer, this);
- if (_inEventTvT)
- {
- @@ -7272,6 +7274,10 @@
- if (TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(getObjectId()))
- return true;
- + // Check if the attacker is in GvE and GvE is started
- + if (GvEEvent.isStarted() && GvEEvent.isPlayerParticipant(getName()))
- + return true;
- +
- // Check if the attacker is not in the same clan
- if (getClan() != null && attacker != null && getClan().isMember(attacker.getName()))
- return false;
- @@ -10006,6 +10012,16 @@
- _log.log(Level.SEVERE, "deleteMe()", e);
- }
- + // GvE Event removal
- + try
- + {
- + GvEEvent.onLogout(this);
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.SEVERE, "deleteMe()", e);
- + }
- +
- // Update database with items in its freight and remove them from the world
- try { getFreight().deleteMe(); } catch (Throwable t) {_log.log(Level.SEVERE, "deleteMe()", t); }
- @@ -10532,6 +10548,9 @@
- if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(getObjectId()))
- TvTEvent.removeParticipant(getObjectId());
- + if (!GvEEvent.isInactive() && GvEEvent.isPlayerParticipant(getName()))
- + GvEEvent.removeParticipant(getName());
- +
- // Open a Html message to inform the player
- NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
- String jailInfos = HtmCache.getInstance().getHtm("data/html/jail_in.htm");
- @@ -10691,6 +10710,7 @@
- if(Rnd.get(100) <= Config.DEATH_PENALTY_CHANCE
- && !(killer instanceof L2PcInstance) && !(this.isGM())
- && !(TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(getObjectId()))
- + && !(GvEEvent.isStarted() && GvEEvent.isPlayerParticipant(getName()))
- && !(this.getCharmOfLuck() && (killer instanceof L2BossInstance || killer instanceof L2RaidBossInstance)))
- increaseDeathPenaltyBuffLevel();
- Index: java/realtek/gameserver/handler/itemhandlers/Potions.java
- ===================================================================
- --- java/realtek/gameserver/handler/itemhandlers/Potions.java (revision 718)
- +++ java/realtek/gameserver/handler/itemhandlers/Potions.java (working copy)
- @@ -26,6 +26,7 @@
- import realtek.gameserver.datatables.SkillTable;
- import realtek.gameserver.events.engines.CTF;
- import realtek.gameserver.events.engines.TvT;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IItemHandler;
- import realtek.gameserver.model.L2Effect;
- @@ -111,13 +112,19 @@
- return;
- }
- - if (TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
- + if (Config.TVT_EVENT_POTIONS_ALLOWED && TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
- {
- activeChar.sendMessage("You cannot use potions in event.");
- playable.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- + if (!GvEEvent.onPotionUse(playable.getName()))
- + {
- + playable.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- if (activeChar.isInOlympiadMode())
- {
- activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
- Index: java/realtek/gameserver/events/engines/gve/GvEEvent.java
- ===================================================================
- --- java/realtek/gameserver/events/engines/gve/GvEEvent.java (revision 0)
- +++ java/realtek/gameserver/events/engines/gve/GvEEvent.java (revision 0)
- @@ -0,0 +1,691 @@
- +/*
- + * 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
- + */
- +package realtek.gameserver.events.engines.gve;
- +
- +import realtek.Config;
- +import realtek.gameserver.datatables.DoorTable;
- +import realtek.gameserver.datatables.NpcTable;
- +import realtek.gameserver.datatables.SpawnTable;
- +import realtek.gameserver.model.L2Character;
- +import realtek.gameserver.model.L2Spawn;
- +import realtek.gameserver.model.L2Summon;
- +import realtek.gameserver.model.L2World;
- +import realtek.gameserver.model.actor.instance.L2DoorInstance;
- +import realtek.gameserver.model.actor.instance.L2NpcInstance;
- +import realtek.gameserver.model.actor.instance.L2PcInstance;
- +import realtek.gameserver.model.actor.instance.L2PetInstance;
- +import realtek.gameserver.model.actor.instance.L2SummonInstance;
- +import realtek.gameserver.network.serverpackets.MagicSkillUser;
- +import realtek.gameserver.network.serverpackets.NpcHtmlMessage;
- +import realtek.gameserver.templates.L2NpcTemplate;
- +import realtek.util.Rnd;
- +
- +/**
- + * @author Realtek
- + */
- +public class GvEEvent
- +{
- + enum EventState
- + {
- + INACTIVE,
- + INACTIVATING,
- + PARTICIPATING,
- + STARTING,
- + STARTED,
- + REWARDING
- + }
- +
- + /** The teams of the GvE Event<br> */
- + private static GvEEventTeam[] _teams = new GvEEventTeam[2]; // event only allow max 2 teams
- + /** The state of the GvE Event<br> */
- + private static EventState _state = EventState.INACTIVE;
- + /** The spawn of the participation npc<br> */
- + private static L2Spawn _npcSpawn = null;
- + /** the npc instance of the participation npc<br> */
- + private static L2NpcInstance _lastNpcSpawn = null;
- +
- + /**
- + * No instance of this class!<br>
- + */
- + private GvEEvent()
- + {
- + }
- +
- + /**
- + * Teams initializing<br>
- + */
- + public static void init()
- + {
- + _teams[0] = new GvEEventTeam(Config.GVE_EVENT_TEAM_1_NAME, Config.GVE_EVENT_TEAM_1_COORDINATES);
- + _teams[1] = new GvEEventTeam(Config.GVE_EVENT_TEAM_2_NAME, Config.GVE_EVENT_TEAM_2_COORDINATES);
- + }
- +
- + /**
- + * Starts the participation of the GvE Event<br>
- + * 1. Get L2NpcTemplate by Config.GvE _EVENT_PARTICIPATION_NPC_ID<br>
- + * 2. Try to spawn a new npc of it<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean startParticipation()
- + {
- + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.GVE_EVENT_PARTICIPATION_NPC_ID);
- + if (tmpl == null)
- + {
- + System.out.println("GvE EventEngine[GvE Event.startParticipation()]: L2NpcTemplate is a NullPointer -> Invalid npc id in configs?");
- + return false;
- + }
- + try
- + {
- + _npcSpawn = new L2Spawn(tmpl);
- + _npcSpawn.setLocx(Config.GVE_EVENT_PARTICIPATION_NPC_COORDINATES[0]);
- + _npcSpawn.setLocy(Config.GVE_EVENT_PARTICIPATION_NPC_COORDINATES[1]);
- + _npcSpawn.setLocz(Config.GVE_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
- + _npcSpawn.setAmount(1);
- + _npcSpawn.setHeading(0);
- + _npcSpawn.setRespawnDelay(1);
- + // later no need to delete spawn from db, we don't store it (false)
- + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
- + _npcSpawn.init();
- + _lastNpcSpawn = _npcSpawn.getLastSpawn();
- + _lastNpcSpawn.setCurrentHp(_lastNpcSpawn.getMaxHp());
- + _lastNpcSpawn.setTitle("GvE Event Participation");
- + _lastNpcSpawn.isAggressive();
- + _lastNpcSpawn.decayMe();
- + _lastNpcSpawn.spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
- + _lastNpcSpawn.broadcastPacket(new MagicSkillUser(_lastNpcSpawn, _lastNpcSpawn, 1034, 1, 1, 1));
- + }
- + catch (Exception e)
- + {
- + System.out.println("GvEEventEngine[GvEEvent.startParticipation()]: exception: " + e);
- + return false;
- + }
- + setState(EventState.PARTICIPATING);
- + return true;
- + }
- +
- + /**
- + * Starts the GvEEvent fight<br>
- + * 1. Set state EventState.STARTING<br>
- + * 2. Close doors specified in configs<br>
- + * 3. Abort if not enought participants(return false)<br>
- + * 4. Set state EventState.STARTED<br>
- + * 5. Teleport all participants to team spot<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean startFight()
- + {
- + setState(EventState.STARTING);
- + // not enought participants
- + if (_teams[0].getParticipatedPlayerCount() < Config.GVE_EVENT_MIN_PLAYERS_IN_TEAMS || _teams[1].getParticipatedPlayerCount() < Config.GVE_EVENT_MIN_PLAYERS_IN_TEAMS)
- + {
- + setState(EventState.INACTIVE);
- + _teams[0].cleanMe();
- + _teams[1].cleanMe();
- + unSpawnNpc();
- + return false;
- + }
- + closeDoors();
- + setState(EventState.STARTED); // set state to STARTED here, so GvEEventTeleporter know to teleport to team spot
- + // teleport all participants to there team spot
- + for (GvEEventTeam team : _teams)
- + {
- + for (String playerName : team.getParticipatedPlayerNames())
- + {
- + L2PcInstance playerInstance = team.getParticipatedPlayers().get(playerName);
- + if (playerInstance == null)
- + continue;
- + // implements Runnable and starts itself in constructor
- + new GvETeleporter(playerInstance, team.getCoordinates(), false, false);
- + }
- + }
- + return true;
- + }
- +
- + /**
- + * Calculates the GvEEvent reward<br>
- + * 1. If both teams are at a tie(points equals), send it as system message to all participants, if one of the teams have 0 participants left online abort rewarding<br>
- + * 2. Wait till teams are not at a tie anymore<br>
- + * 3. Set state EvcentState.REWARDING<br>
- + * 4. Reward team with more points<br>
- + * 5. Show win html to wining team participants<br>
- + * <br>
- + *
- + * @return String<br>
- + */
- + public static String calculateRewards()
- + {
- + return "GvE Event: The massacre finished.";
- + }
- +
- + /**
- + * Stops the GvEEvent fight<br>
- + * 1. Set state EventState.INACTIVATING<br>
- + * 2. Remove GvE npc from world<br>
- + * 3. Open doors specified in configs<br>
- + * 4. Teleport all participants back to participation npc location<br>
- + * 5. Teams cleaning<br>
- + * 6. Set state EventState.INACTIVE<br>
- + */
- + public static void stopFight()
- + {
- + setState(EventState.INACTIVATING);
- + unSpawnNpc();
- + openDoors();
- + for (GvEEventTeam team : _teams)
- + {
- + for (String playerName : team.getParticipatedPlayerNames())
- + {
- + L2PcInstance playerInstance = team.getParticipatedPlayers().get(playerName);
- + if (playerInstance == null)
- + continue;
- + new GvETeleporter(playerInstance, Config.GVE_EVENT_PARTICIPATION_NPC_COORDINATES, false, false);
- + }
- + }
- + _teams[0].cleanMe();
- + _teams[1].cleanMe();
- + setState(EventState.INACTIVE);
- + }
- +
- + /**
- + * Adds a player to a GvEEvent team<br>
- + * 1. Calculate the id of the team in which the player should be added<br>
- + * 2. Add the player to the calculated team<br>
- + * <br>
- + *
- + * @param playerInstance
- + * <br>
- + * @return boolean<br>
- + */
- + public static synchronized boolean addParticipant(L2PcInstance playerInstance)
- + {
- + if (playerInstance == null)
- + return false;
- + byte teamId = 0;
- + if (_teams[0].getParticipatedPlayerCount() == _teams[1].getParticipatedPlayerCount())
- + teamId = (byte) (Rnd.get(2));
- + else
- + teamId = (byte) (_teams[0].getParticipatedPlayerCount() > _teams[1].getParticipatedPlayerCount() ? 1 : 0);
- + return _teams[teamId].addPlayer(playerInstance);
- + }
- +
- + /**
- + * Removes a GvEEvent player from it's team<br>
- + * 1. Get team id of the player<br>
- + * 2. Remove player from it's team<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean removeParticipant(String playerName)
- + {
- + byte teamId = getParticipantTeamId(playerName);
- + if (teamId == -1)
- + return false;
- + _teams[teamId].removePlayer(playerName);
- + return true;
- + }
- +
- + /**
- + * Send a SystemMessage to all participated players<br>
- + * 1. Send the message to all players of team number one<br>
- + * 2. Send the message to all players of team number two<br>
- + * <br>
- + *
- + * @param message
- + * <br>
- + */
- + public static void sysMsgToAllParticipants(String message)
- + {
- + for (L2PcInstance playerInstance : _teams[0].getParticipatedPlayers().values())
- + {
- + if (playerInstance != null)
- + playerInstance.sendMessage(message);
- + }
- + for (L2PcInstance playerInstance : _teams[1].getParticipatedPlayers().values())
- + {
- + if (playerInstance != null)
- + playerInstance.sendMessage(message);
- + }
- + }
- +
- + /**
- + * Close doors specified in configs
- + */
- + private static void closeDoors()
- + {
- + for (int doorId : Config.GVE_EVENT_DOOR_IDS)
- + {
- + L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
- + if (doorInstance != null)
- + doorInstance.closeMe();
- + }
- + }
- +
- + /**
- + * Open doors specified in configs
- + */
- + private static void openDoors()
- + {
- + for (int doorId : Config.GVE_EVENT_DOOR_IDS)
- + {
- + L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
- + if (doorInstance != null)
- + doorInstance.openMe();
- + }
- + }
- +
- + /**
- + * UnSpawns the GvEEvent npc
- + */
- + private static void unSpawnNpc()
- + {
- + _lastNpcSpawn.deleteMe();
- + _npcSpawn.stopRespawn();
- + _npcSpawn = null;
- + _lastNpcSpawn = null;
- + }
- +
- + /**
- + * Called when a player logs in<br>
- + * <br>
- + *
- + * @param playerInstance
- + * <br>
- + */
- + public static void onLogin(L2PcInstance playerInstance)
- + {
- + if (playerInstance == null || (!isStarting() && !isStarted()))
- + return;
- + byte teamId = getParticipantTeamId(playerInstance.getName());
- + if (teamId == -1)
- + return;
- + _teams[teamId].addPlayer(playerInstance);
- + new GvETeleporter(playerInstance, _teams[teamId].getCoordinates(), true, false);
- + }
- +
- + /**
- + * Called when a player logs out<br>
- + * <br>
- + *
- + * @param playerInstance
- + * <br>
- + */
- + public static void onLogout(L2PcInstance playerInstance)
- + {
- + if (playerInstance == null || (!isStarting() && !isStarted()))
- + return;
- + removeParticipant(playerInstance.getName());
- + }
- +
- + /**
- + * Called on every bypass by npc of type L2GvEEventNpc<br>
- + * Needs synchronization cause of the max player check<br>
- + * <br>
- + *
- + * @param command
- + * <br>
- + * @param playerInstance
- + * <br>
- + */
- + public static synchronized void onBypass(String command, L2PcInstance playerInstance)
- + {
- + if (playerInstance == null)
- + return;
- +
- + if (command.equals("gve_remove_from_event"))
- + {
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>You are now teleported out of the event and you can join again whenever you want.</body></html>");
- + playerInstance.sendPacket(npcHtmlMessage);
- + removeParticipant(playerInstance.getName());
- + playerInstance.teleToLocation(0, 0, 0, false);
- + }
- +
- + if (command.equals("gve_event_participation"))
- + {
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
- + int playerLevel = playerInstance.getLevel();
- + if (playerInstance.isCursedWeaponEquiped())
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>Cursed weapon owners are not allowed to participate.</body></html>");
- + else if (playerInstance.getKarma() > 0)
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>Chaotic players are not allowed to participate.</body></html>");
- + else if (_teams[0].getParticipatedPlayerCount() >= Config.GVE_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() >= Config.GVE_EVENT_MAX_PLAYERS_IN_TEAMS)
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>Sorry ,this faction is full!Choose the other one.</body></html>");
- + else if (playerLevel < Config.GVE_EVENT_MIN_LVL || playerLevel > Config.GVE_EVENT_MAX_LVL)
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>Only players from level " + Config.GVE_EVENT_MIN_LVL + " to level " + Config.GVE_EVENT_MAX_LVL + " are allowed tro participate.</body></html>");
- + else if (_teams[0].getParticipatedPlayerCount() > 19 && _teams[1].getParticipatedPlayerCount() > 19)
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>The factions are full! Maximum of " + Config.GVE_EVENT_MAX_PLAYERS_IN_TEAMS + " player are allowed in one faction.</body></html>");
- + else if (addParticipant(playerInstance))
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>You are on the registration list now.</body></html>");
- + else
- + // addParticipant returned false cause playerInstance == null
- + return;
- + playerInstance.sendPacket(npcHtmlMessage);
- + }
- + else if (command.equals("gve_event_remove_participation"))
- + {
- + removeParticipant(playerInstance.getName());
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
- + npcHtmlMessage.setHtml("<html><head><title>GvE Event</title></head><body>You are not longer on the registration list.</body></html>");
- + playerInstance.sendPacket(npcHtmlMessage);
- + }
- + }
- +
- + /**
- + * Called on every onAction in L2PcIstance<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @param targetPlayerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean onAction(String playerName, String targetPlayerName)
- + {
- + if (!isStarted())
- + return true;
- + L2PcInstance playerInstance = L2World.getInstance().getPlayer(playerName);
- + if (playerInstance == null)
- + return false;
- + if (playerInstance.isGM())
- + return true;
- + byte playerTeamId = getParticipantTeamId(playerName);
- + byte targetPlayerTeamId = getParticipantTeamId(targetPlayerName);
- + if ((playerTeamId != -1 && targetPlayerTeamId == -1) || (playerTeamId == -1 && targetPlayerTeamId != -1))
- + return false;
- + if (playerTeamId != -1 && targetPlayerTeamId != -1 && playerTeamId == targetPlayerTeamId && !Config.GVE_EVENT_TARGET_TEAM_MEMBERS_ALLOWED)
- + return false;
- + return true;
- + }
- +
- + /**
- + * Called on every potion use<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean onPotionUse(String playerName)
- + {
- + if (!isStarted())
- + return true;
- + if (isPlayerParticipant(playerName) && !Config.GVE_EVENT_POTIONS_ALLOWED)
- + return false;
- + return true;
- + }
- +
- + /**
- + * Called on every escape use(thanks to nbd)<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean onEscapeUse(String playerName)
- + {
- + if (!isStarted())
- + return true;
- + if (isPlayerParticipant(playerName))
- + return false;
- + return true;
- + }
- +
- + /**
- + * Called on every summon item use<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean onItemSummon(String playerName)
- + {
- + if (!isStarted())
- + return true;
- + if (isPlayerParticipant(playerName) && !Config.GVE_EVENT_SUMMON_BY_ITEM_ALLOWED)
- + return false;
- + return true;
- + }
- +
- + /**
- + * Is called when a player is killed<br>
- + * <br>
- + *
- + * @param killerCharacter
- + * <br>
- + * @param killedPlayerInstance
- + * <br>
- + */
- + public static void onKill(L2Character killerCharacter, L2PcInstance killedPlayerInstance)
- + {
- + if (killerCharacter == null || killedPlayerInstance == null || (!(killerCharacter instanceof L2PcInstance) && !(killerCharacter instanceof L2PetInstance) && !(killerCharacter instanceof L2SummonInstance)) || !isStarted())
- + return;
- + L2PcInstance killerPlayerInstance = null;
- + if (killerCharacter instanceof L2PetInstance || killerCharacter instanceof L2SummonInstance)
- + {
- + killerPlayerInstance = ((L2Summon) killerCharacter).getOwner();
- + if (killerPlayerInstance == null)
- + return;
- + }
- + else
- + killerPlayerInstance = (L2PcInstance) killerCharacter;
- + String playerName = killerPlayerInstance.getName();
- + byte killerTeamId = getParticipantTeamId(playerName);
- + playerName = killedPlayerInstance.getName();
- + byte killedTeamId = getParticipantTeamId(playerName);
- + if (killerTeamId != -1 && killedTeamId != -1 && killerTeamId != killedTeamId)
- + killerPlayerInstance.addItem("Loot", 767, 1, killerPlayerInstance, true);
- + if (killedTeamId != -1)
- + new GvETeleporter(killedPlayerInstance, _teams[killedTeamId].getCoordinates(), false, false);
- + }
- +
- + /**
- + * Sets the GvEEvent state<br>
- + * <br>
- + *
- + * @param state
- + * <br>
- + */
- + private static void setState(EventState state)
- + {
- + synchronized (_state)
- + {
- + _state = state;
- + }
- + }
- +
- + /**
- + * Is GvEEvent inactive?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isInactive()
- + {
- + boolean isInactive;
- + synchronized (_state)
- + {
- + isInactive = _state == EventState.INACTIVE;
- + }
- + return isInactive;
- + }
- +
- + /**
- + * Is GvEEvent in inactivating?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isInactivating()
- + {
- + boolean isInactivating;
- + synchronized (_state)
- + {
- + isInactivating = _state == EventState.INACTIVATING;
- + }
- + return isInactivating;
- + }
- +
- + /**
- + * Is GvEEvent in participation?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isParticipating()
- + {
- + boolean isParticipating;
- + synchronized (_state)
- + {
- + isParticipating = _state == EventState.PARTICIPATING;
- + }
- + return isParticipating;
- + }
- +
- + /**
- + * Is GvEEvent starting?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isStarting()
- + {
- + boolean isStarting;
- + synchronized (_state)
- + {
- + isStarting = _state == EventState.STARTING;
- + }
- + return isStarting;
- + }
- +
- + /**
- + * Is GvEEvent started?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isStarted()
- + {
- + boolean isStarted;
- + synchronized (_state)
- + {
- + isStarted = _state == EventState.STARTED;
- + }
- + return isStarted;
- + }
- +
- + /**
- + * Is GvEEvent rewadrding?<br>
- + * <br>
- + *
- + * @return boolean<br>
- + */
- + public static boolean isRewarding()
- + {
- + boolean isRewarding;
- + synchronized (_state)
- + {
- + isRewarding = _state == EventState.REWARDING;
- + }
- + return isRewarding;
- + }
- +
- + /**
- + * Returns the team id of a player, if player is not participant it returns -1<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return byte<br>
- + */
- + public static byte getParticipantTeamId(String playerName)
- + {
- + return (byte) (_teams[0].containsPlayer(playerName) ? 0 : (_teams[1].containsPlayer(playerName) ? 1 : -1));
- + }
- +
- + /**
- + * Returns the team coordinates in which the player is in, if player is not in a team return null<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return int[]<br>
- + */
- + public static int[] getParticipantTeamCoordinates(String playerName)
- + {
- + return _teams[0].containsPlayer(playerName) ? _teams[0].getCoordinates() : (_teams[1].containsPlayer(playerName) ? _teams[1].getCoordinates() : null);
- + }
- +
- + /**
- + * Is given player participant of the event?<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public static boolean isPlayerParticipant(String playerName)
- + {
- + return _teams[0].containsPlayer(playerName) || _teams[1].containsPlayer(playerName);
- + }
- +
- + /**
- + * Returns participated player count<br>
- + * <br>
- + *
- + * @return int<br>
- + */
- + public static int getParticipatedPlayersCount()
- + {
- + return _teams[0].getParticipatedPlayerCount() + _teams[1].getParticipatedPlayerCount();
- + }
- +
- + /**
- + * Returns teams names<br>
- + * <br>
- + *
- + * @return String[]<br>
- + */
- + public static String[] getTeamNames()
- + {
- + return new String[] { _teams[0].getName(), _teams[1].getName() };
- + }
- +
- + /**
- + * Returns player count of both teams<br>
- + * <br>
- + *
- + * @return int[]<br>
- + */
- + public static int[] getTeamsPlayerCounts()
- + {
- + return new int[] { _teams[0].getParticipatedPlayerCount(), _teams[1].getParticipatedPlayerCount() };
- + }
- +
- +
- +}
- Index: java/realtek/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/realtek/gameserver/network/clientpackets/EnterWorld.java (revision 718)
- +++ java/realtek/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -35,6 +35,7 @@
- import realtek.gameserver.datatables.MapRegionTable;
- import realtek.gameserver.events.engines.CTF;
- import realtek.gameserver.events.engines.TvT;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.AdminCommandHandler;
- import realtek.gameserver.instancemanager.CastleManager;
- @@ -420,6 +421,7 @@
- }
- TvTEvent.onLogin(activeChar);
- + GvEEvent.onLogin(activeChar);
- RegionBBSManager.getInstance().changeCommunityBoard();
- CrownManager.getInstance().checkCrowns(activeChar);
- Index: java/realtek/gameserver/handler/itemhandlers/Scrolls.java
- ===================================================================
- --- java/realtek/gameserver/handler/itemhandlers/Scrolls.java (revision 718)
- +++ java/realtek/gameserver/handler/itemhandlers/Scrolls.java (working copy)
- @@ -18,6 +18,7 @@
- package realtek.gameserver.handler.itemhandlers;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IItemHandler;
- import realtek.gameserver.model.L2ItemInstance;
- @@ -69,6 +70,12 @@
- return;
- }
- + if (GvEEvent.isPlayerParticipant(activeChar.getName()))
- + {
- + playable.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- if (activeChar.isInOlympiadMode())
- {
- activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
- Index: java/realtek/gameserver/handler/itemhandlers/ScrollOfResurrection.java
- ===================================================================
- --- java/realtek/gameserver/handler/itemhandlers/ScrollOfResurrection.java (revision 718)
- +++ java/realtek/gameserver/handler/itemhandlers/ScrollOfResurrection.java (working copy)
- @@ -19,6 +19,7 @@
- package realtek.gameserver.handler.itemhandlers;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IItemHandler;
- import realtek.gameserver.instancemanager.CastleManager;
- @@ -70,6 +71,11 @@
- playable.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- + if (GvEEvent.isPlayerParticipant(activeChar.getName()))
- + {
- + playable.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- int itemId = item.getItemId();
- //boolean blessedScroll = (itemId != 737);
- Index: java/realtek/gameserver/events/engines/gve/GvEEventTeam.java
- ===================================================================
- --- java/realtek/gameserver/events/engines/gve/GvEEventTeam.java (revision 0)
- +++ java/realtek/gameserver/events/engines/gve/GvEEventTeam.java (revision 0)
- @@ -0,0 +1,193 @@
- +/*
- + * 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
- + */
- +package realtek.gameserver.events.engines.gve;
- +
- +import java.util.Map;
- +import java.util.Vector;
- +
- +import javolution.util.FastMap;
- +import realtek.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Realtek
- + */
- +public class GvEEventTeam
- +{
- + /** The name of the team<br> */
- + private String _name;
- + /** The team spot coordinated<br> */
- + private int[] _coordinates = new int[3];
- + /** Name and instance of all participated players in FastMap<br> */
- + private Map<String, L2PcInstance> _participatedPlayers = new FastMap<String, L2PcInstance>();
- + /** Name of all participated players in Vector<br> */
- + private Vector<String> _participatedPlayerNames = new Vector<String>();
- +
- + /**
- + * C'tor initialize the team<br>
- + * <br>
- + *
- + * @param name
- + * <br>
- + * @param coordinates
- + * <br>
- + */
- + public GvEEventTeam(String name, int[] coordinates)
- + {
- + _name = name;
- + _coordinates = coordinates;
- + }
- +
- + /**
- + * Adds a player to the team<br>
- + * <br>
- + *
- + * @param playerInstance
- + * <br>
- + * @return boolean<br>
- + */
- + public boolean addPlayer(L2PcInstance playerInstance)
- + {
- + if (playerInstance == null)
- + return false;
- + synchronized (_participatedPlayers)
- + {
- + String playerName = playerInstance.getName();
- + _participatedPlayers.put(playerName, playerInstance);
- + if (!_participatedPlayerNames.contains(playerName))
- + _participatedPlayerNames.add(playerName);
- + }
- + return true;
- + }
- +
- + /**
- + * Removes a player from the team<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + */
- + public void removePlayer(String playerName)
- + {
- + synchronized (_participatedPlayers)
- + {
- + _participatedPlayers.remove(playerName);
- + _participatedPlayerNames.remove(playerName);
- + }
- + }
- +
- + /**
- + * Cleanup the team and make it ready for adding players again<br>
- + */
- + public void cleanMe()
- + {
- + _participatedPlayers.clear();
- + _participatedPlayerNames.clear();
- + _participatedPlayers = new FastMap<String, L2PcInstance>();
- + _participatedPlayerNames = new Vector<String>();
- +
- + }
- +
- + /**
- + * Is given player in this team?<br>
- + * <br>
- + *
- + * @param playerName
- + * <br>
- + * @return boolean<br>
- + */
- + public boolean containsPlayer(String playerName)
- + {
- + boolean containsPlayer;
- + synchronized (_participatedPlayers)
- + {
- + containsPlayer = _participatedPlayerNames.contains(playerName);
- + }
- + return containsPlayer;
- + }
- +
- + /**
- + * Returns the name of the team<br>
- + * <br>
- + *
- + * @return String<br>
- + */
- + public String getName()
- + {
- + return _name;
- + }
- +
- + /**
- + * Returns the coordinates of the team spot<br>
- + * <br>
- + *
- + * @return int[]<br>
- + */
- + public int[] getCoordinates()
- + {
- + return _coordinates;
- + }
- +
- + /**
- + * Returns name and instance of all participated players in FastMap<br>
- + * <br>
- + *
- + * @return Map<String, L2PcInstance><br>
- + */
- + public Map<String, L2PcInstance> getParticipatedPlayers()
- + {
- + Map<String, L2PcInstance> participatedPlayers = null;
- + synchronized (_participatedPlayers)
- + {
- + participatedPlayers = _participatedPlayers;
- + }
- + return participatedPlayers;
- + }
- +
- + /**
- + * Returns name of all participated players in Vector<br>
- + * <br>
- + *
- + * @return Vector<String><br>
- + */
- + public Vector<String> getParticipatedPlayerNames()
- + {
- + Vector<String> participatedPlayerNames = null;
- + synchronized (_participatedPlayers)
- + {
- + participatedPlayerNames = _participatedPlayerNames;
- + }
- + return participatedPlayerNames;
- + }
- +
- + /**
- + * Returns player count of this team<br>
- + * <br>
- + *
- + * @return int<br>
- + */
- + public int getParticipatedPlayerCount()
- + {
- + int participatedPlayerCount;
- + synchronized (_participatedPlayers)
- + {
- + participatedPlayerCount = _participatedPlayers.size();
- + }
- + return participatedPlayerCount;
- + }
- +}
- \ No newline at end of file
- Index: java/realtek/gameserver/handler/itemhandlers/ScrollOfEscape.java
- ===================================================================
- --- java/realtek/gameserver/handler/itemhandlers/ScrollOfEscape.java (revision 718)
- +++ java/realtek/gameserver/handler/itemhandlers/ScrollOfEscape.java (working copy)
- @@ -24,6 +24,7 @@
- import realtek.gameserver.ai.CtrlIntention;
- import realtek.gameserver.datatables.MapRegionTable;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IItemHandler;
- import realtek.gameserver.instancemanager.CastleManager;
- @@ -71,6 +72,12 @@
- return;
- }
- + if (!GvEEvent.onEscapeUse(activeChar.getName()))
- + {
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- +
- if (activeChar.isSitting())
- {
- activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_MOVE_SITTING));
- Index: java/realtek/gameserver/handler/usercommandhandlers/Escape.java
- ===================================================================
- --- java/realtek/gameserver/handler/usercommandhandlers/Escape.java (revision 718)
- +++ java/realtek/gameserver/handler/usercommandhandlers/Escape.java (working copy)
- @@ -24,6 +24,7 @@
- import realtek.gameserver.ai.CtrlIntention;
- import realtek.gameserver.datatables.MapRegionTable;
- import realtek.gameserver.datatables.SkillTable;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- import realtek.gameserver.events.engines.tvt.TvTEvent;
- import realtek.gameserver.handler.ihandlers.IUserCommandHandler;
- import realtek.gameserver.model.L2Skill;
- @@ -57,6 +58,12 @@
- return false;
- }
- + if (!GvEEvent.onEscapeUse(activeChar.getName()))
- + {
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- +
- int unstuckTimer = (activeChar.getAccessLevel() >=REQUIRED_LEVEL? 5000 : Config.UNSTUCK_INTERVAL*1000 );
- // Check to see if the player is in a festival.
- Index: java/realtek/gameserver/events/engines/gve/manager/GvEManager.java
- ===================================================================
- --- java/realtek/gameserver/events/engines/gve/manager/GvEManager.java (revision 0)
- +++ java/realtek/gameserver/events/engines/gve/manager/GvEManager.java (revision 0)
- @@ -0,0 +1,298 @@
- +/*
- + * 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 realtek.gameserver.events.engines.gve.manager;
- +
- +import java.util.Calendar;
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.logging.Logger;
- +
- +import realtek.Config;
- +import realtek.gameserver.Announcements;
- +import realtek.gameserver.ThreadPoolManager;
- +import realtek.gameserver.events.engines.gve.GvEEvent;
- +
- +
- +/**
- + * @author FBIagent
- + */
- +public class GvEManager
- +{
- + protected static final Logger _log = Logger.getLogger(GvEManager.class.getName());
- +
- + /** Task for event cycles<br> */
- + private GvEStartTask _task;
- +
- + /**
- + * New instance only by getInstance()<br>
- + */
- + private GvEManager()
- + {
- + if (Config.GVE_EVENT_ENABLED)
- + {
- + GvEEvent.init();
- +
- + this.scheduleEventStart();
- + _log.info("GvE Event - Started.");
- + }
- + else
- + {
- + _log.info("GvE Event - Event Disabled.");
- + }
- + }
- +
- + /**
- + * Initialize new/Returns the one and only instance<br><br>
- + *
- + * @return GvEManager<br>
- + */
- + public static GvEManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + /**
- + * Starts GvEStartTask
- + */
- + public void scheduleEventStart()
- + {
- + try
- + {
- + Calendar currentTime = Calendar.getInstance();
- + Calendar nextStartTime = null;
- + Calendar testStartTime = null;
- + for (String timeOfDay : Config.GVE_EVENT_INTERVAL)
- + {
- + // Creating a Calendar object from the specified interval value
- + testStartTime = Calendar.getInstance();
- + testStartTime.setLenient(true);
- + String[] splitTimeOfDay = timeOfDay.split(":");
- + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
- + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
- + // If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.)
- + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
- + {
- + testStartTime.add(Calendar.DAY_OF_MONTH, 1);
- + }
- + // Check for the test date to be the minimum (smallest in the specified list)
- + if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
- + {
- + nextStartTime = testStartTime;
- + }
- + }
- + _task = new GvEStartTask(nextStartTime.getTimeInMillis());
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + catch (Exception e)
- + {
- + _log.warning("GvEEventEngine[GvEManager.scheduleEventStart()]: Error figuring out a start time. Check GvEEventInterval in config file.");
- + }
- + }
- +
- + /**
- + * Method to start participation
- + */
- + public void startReg()
- + {
- + if (!GvEEvent.startParticipation())
- + {
- + Announcements.getInstance().announceToAll("GvE Event: Event was cancelled.");
- + _log.warning("GvEEventEngine[GvEManager.run()]: Error spawning event npc for participation.");
- +
- + this.scheduleEventStart();
- + }
- + else
- + {
- + Announcements.getInstance().announceToAll("GvE Event: Registration opened for " + Config.GVE_EVENT_PARTICIPATION_TIME
- + + " minute(s).");
- +
- + // schedule registration end
- + _task.setStartTime(System.currentTimeMillis() + 60000L * Config.GVE_EVENT_PARTICIPATION_TIME);
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + }
- +
- + /**
- + * Method to start the fight
- + */
- + public void startEvent()
- + {
- + if (!GvEEvent.startFight())
- + {
- + Announcements.getInstance().announceToAll("GvE Event: Event cancelled due to lack of Participation.");
- + _log.info("GvEEventEngine[GvEManager.run()]: Lack of registration, abort event.");
- +
- + this.scheduleEventStart();
- + }
- + else
- + {
- + GvEEvent.sysMsgToAllParticipants("GvE Event: Teleporting participants to an arena in "
- + + Config.GVE_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
- + _task.setStartTime(System.currentTimeMillis() + 60000L * Config.GVE_EVENT_RUNNING_TIME);
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + }
- +
- + /**
- + * Method to end the event and reward
- + */
- + public void endEvent()
- + {
- + Announcements.getInstance().announceToAll(GvEEvent.calculateRewards());
- + GvEEvent.sysMsgToAllParticipants("GvE Event: Teleporting back to the registration npc in "
- + + Config.GVE_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
- + GvEEvent.stopFight();
- +
- + this.scheduleEventStart();
- + }
- +
- + public void skipDelay()
- + {
- + if (_task.nextRun.cancel(false))
- + {
- + _task.setStartTime(System.currentTimeMillis());
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + }
- +
- + /**
- + * Class for GvE cycles
- + */
- + class GvEStartTask implements Runnable
- + {
- + private long _startTime;
- + public ScheduledFuture<?> nextRun;
- +
- + public GvEStartTask(long startTime)
- + {
- + _startTime = startTime;
- + }
- +
- + public void setStartTime(long startTime)
- + {
- + _startTime = startTime;
- + }
- +
- + /**
- + * @see java.lang.Runnable#run()
- + */
- + public void run()
- + {
- + int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
- +
- + if (delay > 0)
- + {
- + this.announce(delay);
- + }
- +
- + int nextMsg = 0;
- + if (delay > 3600)
- + {
- + nextMsg = delay - 3600;
- + }
- + else if (delay > 1800)
- + {
- + nextMsg = delay - 1800;
- + }
- + else if (delay > 900)
- + {
- + nextMsg = delay - 900;
- + }
- + else if (delay > 600)
- + {
- + nextMsg = delay - 600;
- + }
- + else if (delay > 300)
- + {
- + nextMsg = delay - 300;
- + }
- + else if (delay > 60)
- + {
- + nextMsg = delay - 60;
- + }
- + else if (delay > 5)
- + {
- + nextMsg = delay - 5;
- + }
- + else if (delay > 0)
- + {
- + nextMsg = delay;
- + }
- + else
- + {
- + // start
- + if (GvEEvent.isInactive())
- + {
- + GvEManager.this.startReg();
- + }
- + else if (GvEEvent.isParticipating())
- + {
- + GvEManager.this.startEvent();
- + }
- + else
- + {
- + GvEManager.this.endEvent();
- + }
- + }
- +
- + if (delay > 0)
- + {
- + nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000);
- + }
- + }
- +
- + private void announce(long time)
- + {
- + if (time >= 3600 && time % 3600 == 0)
- + {
- + if (GvEEvent.isParticipating())
- + {
- + Announcements.getInstance().announceToAll("GvE Event: " + (time / 60 / 60) + " hour(s) until registration is closed!");
- + }
- + else if (GvEEvent.isStarted())
- + {
- + GvEEvent.sysMsgToAllParticipants("GvE Event: " + (time / 60 / 60) + " hour(s) until event is finished!");
- + }
- + }
- + else if (time >= 60)
- + {
- + if (GvEEvent.isParticipating())
- + {
- + Announcements.getInstance().announceToAll("GvE Event: " + (time / 60) + " minute(s) until registration is closed!");
- + }
- + else if (GvEEvent.isStarted())
- + {
- + GvEEvent.sysMsgToAllParticipants("GvE Event: " + (time / 60) + " minute(s) until the event is finished!");
- + }
- + }
- + else
- + {
- + if (GvEEvent.isParticipating())
- + {
- + Announcements.getInstance().announceToAll("GvE Event: " + time + " second(s) until registration is closed!");
- + }
- + else if (GvEEvent.isStarted())
- + {
- + GvEEvent.sysMsgToAllParticipants("GvE Event: " + time + " second(s) until the event is finished!");
- + }
- + }
- + }
- + }
- +
- + @SuppressWarnings("synthetic-access")
- + private static class SingletonHolder
- + {
- + protected static final GvEManager _instance = new GvEManager();
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement