Removal of hardcoded events and addition of player isOnCustomEvent methods.
This commit is contained in:
@@ -216,32 +216,6 @@
|
||||
<admin command="admin_setbe" accessLevel="100" />
|
||||
<admin command="admin_enchant" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN EVENT ENGINE -->
|
||||
<admin command="admin_event" accessLevel="100" />
|
||||
<admin command="admin_event_new" accessLevel="100" />
|
||||
<admin command="admin_event_choose" accessLevel="100" />
|
||||
<admin command="admin_event_store" accessLevel="100" />
|
||||
<admin command="admin_event_set" accessLevel="100" />
|
||||
<admin command="admin_event_change_teams_number" accessLevel="100" />
|
||||
<admin command="admin_event_announce" accessLevel="100" />
|
||||
<admin command="admin_event_panel" accessLevel="100" />
|
||||
<admin command="admin_event_control_begin" accessLevel="100" />
|
||||
<admin command="admin_event_control_teleport" accessLevel="100" />
|
||||
<admin command="admin_add" accessLevel="100" />
|
||||
<admin command="admin_event_see" accessLevel="100" />
|
||||
<admin command="admin_event_del" accessLevel="100" />
|
||||
<admin command="admin_delete_buffer" accessLevel="100" />
|
||||
<admin command="admin_event_control_sit" accessLevel="100" />
|
||||
<admin command="admin_event_name" accessLevel="100" />
|
||||
<admin command="admin_event_control_kill" accessLevel="100" />
|
||||
<admin command="admin_event_control_res" accessLevel="100" />
|
||||
<admin command="admin_event_control_transform" accessLevel="100" />
|
||||
<admin command="admin_event_control_untransform" accessLevel="100" />
|
||||
<admin command="admin_event_control_prize" accessLevel="100" />
|
||||
<admin command="admin_event_control_chatban" accessLevel="100" />
|
||||
<admin command="admin_event_control_kick" accessLevel="100" />
|
||||
<admin command="admin_event_control_finish" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN EVENTS -->
|
||||
<admin command="admin_event_menu" accessLevel="100" />
|
||||
<admin command="admin_event_start" accessLevel="100" />
|
||||
@@ -584,11 +558,6 @@
|
||||
<admin command="admin_stats" accessLevel="100" />
|
||||
<admin command="admin_skill_test" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN TVT EVENT -->
|
||||
<admin command="admin_tvt_add" accessLevel="100" />
|
||||
<admin command="admin_tvt_remove" accessLevel="100" />
|
||||
<admin command="admin_tvt_advance" accessLevel="100" />
|
||||
|
||||
<!-- ADMIN VITALITY -->
|
||||
<admin command="admin_set_vitality" accessLevel="100" />
|
||||
<admin command="admin_set_vitality_level" accessLevel="100" />
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Team vs. Team Event Engine (by HorridoJoho)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# <u><b><font color="red">WARNING: this mod require custom NPC table support turned on !</font></b></u>
|
||||
# CustomNpcTable = True in General.properties
|
||||
# ---------------------------------------------------------------------------
|
||||
# Enable/Disable TvTEvent System
|
||||
# Default: False
|
||||
TvTEventEnabled = False
|
||||
|
||||
# TvT in instance
|
||||
# Default: False
|
||||
TvTEventInInstance = False
|
||||
|
||||
# Id of the instance template for TvT
|
||||
# Default: 3049 (coliseum.xml)
|
||||
TvTEventInstanceId = 3049
|
||||
|
||||
# Times TvT will occur (24h format).
|
||||
# Default: 9:00,15:00,21:00,3:00
|
||||
TvTEventInterval = 9:00,15:00,21:00,3:00
|
||||
|
||||
# Registration timer from start of event (in minutes).
|
||||
# Default: 30
|
||||
TvTEventParticipationTime = 30
|
||||
|
||||
# Event running time (in minutes).
|
||||
# Default: 20
|
||||
TvTEventRunningTime = 20
|
||||
|
||||
# TvT Event NPC (create a custom npc of type L2TvTEventNpc).
|
||||
# Default: 70010
|
||||
TvTEventParticipationNpcId = 70010
|
||||
|
||||
# TvT Event Participation Fee (itemId, number). Fee is not returned.
|
||||
# Example: 57,100000
|
||||
# Default: 0,0
|
||||
TvTEventParticipationFee = 0,0
|
||||
|
||||
# Location for TvTEvent NPC to spawn in form x,y,z[,heading]
|
||||
# Default: 83425,148585,-3406
|
||||
TvTEventParticipationNpcCoordinates = 83425,148585,-3406
|
||||
|
||||
# Minimum amount of players allowed in each team.
|
||||
# Default: 1
|
||||
TvTEventMinPlayersInTeams = 1
|
||||
# Maximum amount of players allowed in each team.
|
||||
# Default: 20
|
||||
TvTEventMaxPlayersInTeams = 20
|
||||
|
||||
# Minimum level of players that may join the event.
|
||||
# Default: 1
|
||||
TvTEventMinPlayerLevel = 1
|
||||
# Maximum level of players that may join the event.
|
||||
# Default: 85
|
||||
TvTEventMaxPlayerLevel = 85
|
||||
|
||||
# Respawn delay timer (in seconds).
|
||||
# Default: 10
|
||||
TvTEventRespawnTeleportDelay = 10
|
||||
# Exit delay timer (in seconds).
|
||||
# Default: 10
|
||||
TvTEventStartLeaveTeleportDelay = 10
|
||||
|
||||
# First Team - Name, Start/Death x,y,z location.
|
||||
TvTEventTeam1Name = Team1
|
||||
TvTEventTeam1Coordinates = 148695,46725,-3414
|
||||
|
||||
# Second Team - Name, Start/Death x,y,z location.
|
||||
TvTEventTeam2Name = Team2
|
||||
TvTEventTeam2Coordinates = 149999,46728,-3414
|
||||
|
||||
# Reward for winning team.
|
||||
# Example: TvTEventReward = itemId,amount;itemId,amount;itemId,amount
|
||||
TvTEventReward = 57,100000
|
||||
|
||||
# TvTEvent Rules
|
||||
TvTEventTargetTeamMembersAllowed = True
|
||||
TvTEventScrollsAllowed = False
|
||||
TvTEventPotionsAllowed = False
|
||||
TvTEventSummonByItemAllowed = False
|
||||
|
||||
# Door ID's to open/close on start/end.
|
||||
# Not supported in instance, use xml template for defining doors.
|
||||
# Example: TvTDoorsToOpen = 1;2;3;4;5;6
|
||||
TvTDoorsToOpen =
|
||||
TvTDoorsToClose =
|
||||
|
||||
# Should both teams get reward if there's a tie?
|
||||
TvTRewardTeamTie = False
|
||||
|
||||
# Participant's effects handling on teleport/death.
|
||||
# Effects lasting through death never removed.
|
||||
# 0 - always remove all effects.
|
||||
# 1 - remove all effects only during port to event (noblesse blessing can be used)
|
||||
# 2 - never remove any effect
|
||||
# Default: 0
|
||||
TvTEventEffectsRemoval = 0
|
||||
|
||||
# Fighter-class participants will be buffed with those buffs each respawn
|
||||
# Format: skill1Id,skill1Level;skill2Id,skill2Level...
|
||||
# Example: 1504,1;1501,1;1502,1;1499,1
|
||||
TvTEventFighterBuffs =
|
||||
|
||||
# Mage-class participants will be buffed with those buffs each respawn
|
||||
# Format: skill1Id,skill1Level;skill2Id,skill2Level...
|
||||
# Example: 1504,1;1500,1;1501,1;1085,3
|
||||
TvTEventMageBuffs =
|
||||
|
||||
# Maximum number of allowed participants per IP address (dualbox check)
|
||||
# Default: 0 (no limits)
|
||||
TvTEventMaxParticipantsPerIP = 0
|
||||
|
||||
# Voiced command (.tvt) working during TVT event to get information about event status
|
||||
TvTAllowVoicedInfoCommand = false
|
||||
@@ -1,23 +0,0 @@
|
||||
<html><title>Mods Help</title><body>
|
||||
<table width=260><tr>
|
||||
<td width=40><button value="Main" action="bypass -h admin_admin" width=40 height=15 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td width=180><center>Mod Help Page</center></td>
|
||||
<td width=40><button value="Back" action="bypass -h admin_admin5" width=40 height=15 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr></table>
|
||||
<font color="LEVEL"><table width=260><tr>
|
||||
<td width 90>GM commands page:</td><td><a action="bypass -h admin_html admhelp.htm">Index</a></td><td><a action="bypass -h admin_html help/gmcommands.htm">1</a></td><td><a action="bypass -h admin_html help/gmcommands2.htm">2</a></td><td><a action="bypass -h admin_html help/gmcommands3.htm">3</a></td>
|
||||
</tr></table></font>
|
||||
<br>
|
||||
<font color="FF9933">These are the available settings for this mod.</font><br>
|
||||
(When a parameter is required, it must be written in the quickbox without leading nor trailing spaces)<br1>
|
||||
Mandatory parameters will appear <font color="FF0000"><ike this></font><br1>
|
||||
Optional parameters will appear <font color="00FF00">[like that]</font><br>
|
||||
<!-- Mod writers should change from here -->
|
||||
<font color="LEVEL">Enable</font> - Enable this mod<br>
|
||||
<font color="LEVEL">Interval</font> <font color="FF0000"><minutes></font> - Time between events.<br>
|
||||
<font color="LEVEL">PartTime</font> <font color="FF0000"><minutes></font> - Time allowed for application.<br>
|
||||
<font color="LEVEL">RunnTime</font> <font color="FF0000"><minutes></font> - Event duration<br>
|
||||
<br>
|
||||
<font color="LEVEL">Disable</font> - Disable this mod.<br>
|
||||
<font color="LEVEL">EventNpc</font> <font color="FF0000"><integer></font> - NpcId to be used as event manager.
|
||||
</body></html>
|
||||
@@ -57,20 +57,5 @@
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<font color="LEVEL">TvT EVENT MOD
|
||||
<a action="bypass -h admin_html help/l2jmod/tvt.htm">Help</a></font>
|
||||
<table width=240 border=0 bgcolor="666666">
|
||||
<tr>
|
||||
<td><button value="Enable" action="bypass -h admin_set_mod TvTEventEnabled=true" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="Interval" action="bypass -h admin_set_mod TvTEventInterval=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="PartTime" action="bypass -h admin_set_mod TvTEventParticipationTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="RunnTime" action="bypass -h admin_set_mod TvTEventRunningTime=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button value="Disable" action="bypass -h admin_set_mod TvTEventEnabled=false" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
<td><button value="EventNpc" action="bypass -h admin_set_mod TvTEventParticipationNpcId=$qbox" width=60 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</center>
|
||||
</body></html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<html><body scroll="no">
|
||||
<table cellpadding=0 cellspacing=0 width=292 height=358 background="L2UI_CH3.refinewnd_back_Pattern">
|
||||
<tr><td valign="top" align="center">
|
||||
<table width=96% cellpadding=0 cellspacing=0>
|
||||
<tr><td height=30></td></tr>
|
||||
<tr><td align=center><font color="LEVEL">%eventName%</font> by %eventCreator%</td></tr>
|
||||
<tr><td height=20></td></tr>
|
||||
<tr><td align=center>%eventInfo%</td></tr>
|
||||
<tr><td height=34></td></tr>
|
||||
<tr><td align=center><button value="Unregister" action="bypass -h npc_%objectId%_event_unregister" width=120 height=32 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td></tr>
|
||||
<tr><td height=34></td></tr>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
</body></html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<html><body scroll="no">
|
||||
<table cellpadding=0 cellspacing=0 width=292 height=358 background="L2UI_CH3.refinewnd_back_Pattern">
|
||||
<tr><td valign="top" align="center">
|
||||
<table width=96% cellpadding=0 cellspacing=0>
|
||||
<tr><td height=30></td></tr>
|
||||
<tr><td align=center><font color="LEVEL">%eventName%</font> by %eventCreator%</td></tr>
|
||||
<tr><td height=20></td></tr>
|
||||
<tr><td align=center>%eventInfo%</td></tr>
|
||||
<tr><td height=34></td></tr>
|
||||
<tr><td align=center><button value="Participate" action="bypass -h npc_%objectId%_event_participate" width=120 height=32 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td></tr>
|
||||
<tr><td height=34></td></tr>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
</body></html>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<instance id="3049" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/instance.xsd">
|
||||
<PvPInstance val="true" />
|
||||
<doorlist>
|
||||
<door id="24190001" />
|
||||
<door id="24190002" />
|
||||
<door id="24190003" />
|
||||
<door id="24190004" />
|
||||
</doorlist>
|
||||
</instance>
|
||||
@@ -95,7 +95,7 @@ public class Warpgate extends AbstractNpcAI
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final PlayerInstance player = creature.getActingPlayer();
|
||||
if (!canEnter(player) && !player.canOverrideCond(PlayerCondOverride.ZONE_CONDITIONS) && !player.isOnEvent())
|
||||
if (!canEnter(player) && !player.canOverrideCond(PlayerCondOverride.ZONE_CONDITIONS) && !player.isOnCustomEvent())
|
||||
{
|
||||
startQuestTimer("TELEPORT", 1000, null, player);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Cursed weapon holders are not allowed to participate.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Maximum of %max% participant(s) per IP address is allowed.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Chaotic players are not allowed to participate.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Only players from level %min% to level %max% are allowed to participate.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You can not participate while registered for Olympiad.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,13 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Registration for TvT Event:<br>
|
||||
<center>
|
||||
%playercount% players in.<br>
|
||||
Participation Fee: %fee%<br>
|
||||
<button action="bypass -h Quest TvTManager join" value="Participate" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply">
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You need %fee% for participation.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You are registered for a TvT Event.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,13 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head><title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Cancel registration for TvT Event:<br>
|
||||
You are already registered for this event. Do you wish to cancel your participation in this Event?<br>
|
||||
<center>
|
||||
Participation fee is not returned!<br>
|
||||
<button action="bypass -h Quest TvTManager remove" msg="1480" value="Cancel" width="200" height="31" back="L2UI_CT1.OlympiadWnd_DF_Back_Down" fore="L2UI_CT1.OlympiadWnd_DF_Back">
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
<font color="LEVEL">Your team won the event!</font><br>
|
||||
Look in your inventory, there should be your reward.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
Status:<br>
|
||||
<center>
|
||||
%team1name% with %team1playercount% players and %team1points% points.<br>
|
||||
%team2name% with %team2playercount% players and %team2points% points.
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
The event is full! Only %max% players are allowed per team.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
* 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 custom.events.TvT.TvTManager;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
|
||||
import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
/**
|
||||
* TvT Manager AI.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler
|
||||
{
|
||||
private static final int MANAGER_ID = 70010;
|
||||
private static final String[] COMMANDS =
|
||||
{
|
||||
"tvt",
|
||||
"tvtjoin",
|
||||
"tvtleave"
|
||||
};
|
||||
|
||||
public TvTManager()
|
||||
{
|
||||
addFirstTalkId(MANAGER_ID);
|
||||
addTalkId(MANAGER_ID);
|
||||
addStartNpc(MANAGER_ID);
|
||||
|
||||
if (Config.TVT_ALLOW_VOICED_COMMAND)
|
||||
{
|
||||
VoicedCommandHandler.getInstance().registerHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
if ((player == null) || !TvTEvent.isParticipating())
|
||||
{
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "join":
|
||||
{
|
||||
final int playerLevel = player.getLevel();
|
||||
final int team1Count = TvTEvent.getTeamsPlayerCounts()[0];
|
||||
final int team2Count = TvTEvent.getTeamsPlayerCounts()[1];
|
||||
if (player.isCursedWeaponEquipped())
|
||||
{
|
||||
htmltext = getHtm(player, "CursedWeaponEquipped.html");
|
||||
}
|
||||
else if (Olympiad.getInstance().isRegistered(player))
|
||||
{
|
||||
htmltext = getHtm(player, "Olympiad.html");
|
||||
}
|
||||
else if (player.getKarma() > 0)
|
||||
{
|
||||
htmltext = getHtm(player, "Karma.html");
|
||||
}
|
||||
else if ((playerLevel < Config.TVT_EVENT_MIN_LEVEL) || (playerLevel > Config.TVT_EVENT_MAX_LEVEL))
|
||||
{
|
||||
htmltext = getHtm(player, "Level.html");
|
||||
htmltext = htmltext.replace("%min%", String.valueOf(Config.TVT_EVENT_MIN_LEVEL));
|
||||
htmltext = htmltext.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_LEVEL));
|
||||
}
|
||||
else if ((team1Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS))
|
||||
{
|
||||
htmltext = getHtm(player, "TeamsFull.html");
|
||||
htmltext = htmltext.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
|
||||
}
|
||||
else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))
|
||||
{
|
||||
htmltext = getHtm(player, "IPRestriction.html");
|
||||
htmltext = htmltext.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)));
|
||||
}
|
||||
else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player))
|
||||
{
|
||||
htmltext = getHtm(player, "ParticipationFee.html");
|
||||
htmltext = htmltext.replace("%fee%", TvTEvent.getParticipationFee());
|
||||
}
|
||||
else if (TvTEvent.addParticipant(player))
|
||||
{
|
||||
htmltext = getHtm(player, "Registered.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "remove":
|
||||
{
|
||||
if (TvTEvent.removeParticipant(player.getObjectId()))
|
||||
{
|
||||
if (Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.TVT_ID, player);
|
||||
}
|
||||
htmltext = getHtm(player, "Unregistered.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("You cannot unregister to this event.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(Npc npc, PlayerInstance player)
|
||||
{
|
||||
String htmltext = null;
|
||||
if (TvTEvent.isParticipating())
|
||||
{
|
||||
final boolean isParticipant = TvTEvent.isPlayerParticipant(player.getObjectId());
|
||||
final int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
|
||||
htmltext = getHtm(player, (!isParticipant ? "Participation.html" : "RemoveParticipation.html"));
|
||||
htmltext = htmltext.replace("%objectId%", String.valueOf(npc.getObjectId()));
|
||||
htmltext = htmltext.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
|
||||
htmltext = htmltext.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
|
||||
htmltext = htmltext.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
|
||||
htmltext = htmltext.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
|
||||
htmltext = htmltext.replace("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1]));
|
||||
if (!isParticipant)
|
||||
{
|
||||
htmltext = htmltext.replace("%fee%", TvTEvent.getParticipationFee());
|
||||
}
|
||||
}
|
||||
else if (TvTEvent.isStarting() || TvTEvent.isStarted())
|
||||
{
|
||||
htmltext = getTvTStatus(player);
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, PlayerInstance player, String params)
|
||||
{
|
||||
String html = null;
|
||||
switch (command)
|
||||
{
|
||||
case "tvt":
|
||||
{
|
||||
if (TvTEvent.isStarting() || TvTEvent.isStarted())
|
||||
{
|
||||
html = getTvTStatus(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "The event has not started.";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tvtjoin":
|
||||
{
|
||||
html = onAdvEvent("join", null, player);
|
||||
break;
|
||||
}
|
||||
case "tvtleave":
|
||||
{
|
||||
html = onAdvEvent("remove", null, player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (html != null)
|
||||
{
|
||||
player.sendPacket(new NpcHtmlMessage(html));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getTvTStatus(PlayerInstance player)
|
||||
{
|
||||
final int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
|
||||
final int[] teamsPointsCounts = TvTEvent.getTeamsPoints();
|
||||
String htmltext = getHtm(player, "Status.html");
|
||||
htmltext = htmltext.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
|
||||
htmltext = htmltext.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
|
||||
htmltext = htmltext.replace("%team1points%", String.valueOf(teamsPointsCounts[0]));
|
||||
htmltext = htmltext.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
|
||||
htmltext = htmltext.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
|
||||
htmltext = htmltext.replace("%team2points%", String.valueOf(teamsPointsCounts[1]));
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return COMMANDS;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TvTManager();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>TvT Event</title>
|
||||
</head>
|
||||
<body>
|
||||
You have been unregistered from the TvT Event.
|
||||
</body>
|
||||
</html>
|
||||
@@ -72,7 +72,6 @@ import handlers.admincommandhandlers.AdminEditChar;
|
||||
import handlers.admincommandhandlers.AdminEffects;
|
||||
import handlers.admincommandhandlers.AdminElement;
|
||||
import handlers.admincommandhandlers.AdminEnchant;
|
||||
import handlers.admincommandhandlers.AdminEventEngine;
|
||||
import handlers.admincommandhandlers.AdminEvents;
|
||||
import handlers.admincommandhandlers.AdminExpSp;
|
||||
import handlers.admincommandhandlers.AdminFakePlayers;
|
||||
@@ -130,7 +129,6 @@ import handlers.admincommandhandlers.AdminTeleport;
|
||||
import handlers.admincommandhandlers.AdminTerritoryWar;
|
||||
import handlers.admincommandhandlers.AdminTest;
|
||||
import handlers.admincommandhandlers.AdminTransform;
|
||||
import handlers.admincommandhandlers.AdminTvTEvent;
|
||||
import handlers.admincommandhandlers.AdminVitality;
|
||||
import handlers.admincommandhandlers.AdminZone;
|
||||
import handlers.admincommandhandlers.AdminZones;
|
||||
@@ -139,7 +137,6 @@ import handlers.bypasshandlers.Buy;
|
||||
import handlers.bypasshandlers.BuyShadowItem;
|
||||
import handlers.bypasshandlers.ChatLink;
|
||||
import handlers.bypasshandlers.ClanWarehouse;
|
||||
import handlers.bypasshandlers.EventEngine;
|
||||
import handlers.bypasshandlers.Festival;
|
||||
import handlers.bypasshandlers.FindPvP;
|
||||
import handlers.bypasshandlers.Freight;
|
||||
@@ -370,7 +367,6 @@ public class MasterHandler
|
||||
AdminEffects.class,
|
||||
AdminElement.class,
|
||||
AdminEnchant.class,
|
||||
AdminEventEngine.class,
|
||||
AdminEvents.class,
|
||||
AdminExpSp.class,
|
||||
AdminFakePlayers.class,
|
||||
@@ -428,7 +424,6 @@ public class MasterHandler
|
||||
AdminTerritoryWar.class,
|
||||
AdminTest.class,
|
||||
AdminTransform.class,
|
||||
AdminTvTEvent.class,
|
||||
AdminVitality.class,
|
||||
AdminZone.class,
|
||||
},
|
||||
@@ -439,7 +434,6 @@ public class MasterHandler
|
||||
BuyShadowItem.class,
|
||||
ChatLink.class,
|
||||
ClanWarehouse.class,
|
||||
EventEngine.class,
|
||||
Festival.class,
|
||||
FindPvP.class,
|
||||
Freight.class,
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.IActionHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -115,25 +114,19 @@ public class NpcAction implements IActionHandler
|
||||
}
|
||||
|
||||
// Open a chat window on client with the text of the Npc
|
||||
if (npc.isEventMob())
|
||||
if (npc.hasListener(EventType.ON_NPC_QUEST_START))
|
||||
{
|
||||
GameEvent.showEventHtml(player, String.valueOf(target.getObjectId()));
|
||||
player.setLastQuestNpcObject(target.getObjectId());
|
||||
}
|
||||
if (npc.hasListener(EventType.ON_NPC_FIRST_TALK))
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcFirstTalk(npc, player), npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (npc.hasListener(EventType.ON_NPC_QUEST_START))
|
||||
{
|
||||
player.setLastQuestNpcObject(target.getObjectId());
|
||||
}
|
||||
if (npc.hasListener(EventType.ON_NPC_FIRST_TALK))
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcFirstTalk(npc, player), npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.showChatWindow(player);
|
||||
}
|
||||
npc.showChatWindow(player);
|
||||
}
|
||||
|
||||
if (Config.PLAYER_MOVEMENT_BLOCK_TIME > 0)
|
||||
{
|
||||
player.updateNotMoveUntil();
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.IActionHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -51,12 +50,6 @@ public class PlayerInstanceAction implements IActionHandler
|
||||
@Override
|
||||
public boolean action(PlayerInstance player, WorldObject target, boolean interact)
|
||||
{
|
||||
// See description in TvTEvent.java
|
||||
if (!TvTEvent.onAction(player, target.getObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the PlayerInstance is confused
|
||||
if (player.isOutOfControl())
|
||||
{
|
||||
|
||||
@@ -1,556 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.admincommandhandlers;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent.EventState;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* This class handles following admin commands: - admin = shows menu
|
||||
* @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/04/11 10:06:06 $
|
||||
*/
|
||||
public class AdminEventEngine implements IAdminCommandHandler
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(AdminEventEngine.class.getName());
|
||||
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_event",
|
||||
"admin_event_new",
|
||||
"admin_event_choose",
|
||||
"admin_event_store",
|
||||
"admin_event_set",
|
||||
"admin_event_change_teams_number",
|
||||
"admin_event_announce",
|
||||
"admin_event_panel",
|
||||
"admin_event_control_begin",
|
||||
"admin_event_control_teleport",
|
||||
"admin_add",
|
||||
"admin_event_see",
|
||||
"admin_event_del",
|
||||
"admin_delete_buffer",
|
||||
"admin_event_control_sit",
|
||||
"admin_event_name",
|
||||
"admin_event_control_kill",
|
||||
"admin_event_control_res",
|
||||
"admin_event_control_transform",
|
||||
"admin_event_control_untransform",
|
||||
"admin_event_control_prize",
|
||||
"admin_event_control_chatban",
|
||||
"admin_event_control_kick",
|
||||
"admin_event_control_finish"
|
||||
};
|
||||
|
||||
private static String tempBuffer = "";
|
||||
private static String tempName = "";
|
||||
private static boolean npcsDeleted = false;
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, PlayerInstance activeChar)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(command);
|
||||
final String actualCommand = st.nextToken();
|
||||
try
|
||||
{
|
||||
if (actualCommand.equals("admin_event"))
|
||||
{
|
||||
if (GameEvent.eventState != EventState.OFF)
|
||||
{
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
showMainPage(activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
else if (actualCommand.equals("admin_event_new"))
|
||||
{
|
||||
showNewEventPage(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_add"))
|
||||
{
|
||||
// There is an exception here for not using the ST. We use spaces (ST delim) for the event info.
|
||||
tempBuffer += command.substring(10);
|
||||
showNewEventPage(activeChar);
|
||||
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_see"))
|
||||
{
|
||||
// There is an exception here for not using the ST. We use spaces (ST delim) for the event name.
|
||||
final String eventName = command.substring(16);
|
||||
try
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(Config.DATAPACK_ROOT + "/data/events/" + eventName)));
|
||||
final BufferedReader inbr = new BufferedReader(new InputStreamReader(in));
|
||||
adminReply.setFile(null, "data/html/mods/EventEngine/Participation.htm");
|
||||
adminReply.replace("%eventName%", eventName);
|
||||
adminReply.replace("%eventCreator%", inbr.readLine());
|
||||
adminReply.replace("%eventInfo%", inbr.readLine());
|
||||
adminReply.replace("npc_%objectId%_event_participate", "admin_event"); // Weird, but nice hack, isnt it? :)
|
||||
adminReply.replace("button value=\"Participate\"", "button value=\"Back\"");
|
||||
activeChar.sendPacket(adminReply);
|
||||
inbr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("Problem with AdminEventEngine: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_del"))
|
||||
{
|
||||
// There is an exception here for not using the ST. We use spaces (ST delim) for the event name.
|
||||
final String eventName = command.substring(16);
|
||||
final File file = new File(Config.DATAPACK_ROOT + "/data/events/" + eventName);
|
||||
file.delete();
|
||||
showMainPage(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_name"))
|
||||
{
|
||||
// There is an exception here for not using the ST. We use spaces (ST delim) for the event name.
|
||||
tempName += command.substring(17);
|
||||
showNewEventPage(activeChar);
|
||||
}
|
||||
else if (actualCommand.equalsIgnoreCase("admin_delete_buffer"))
|
||||
{
|
||||
tempBuffer = "";
|
||||
showNewEventPage(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_store"))
|
||||
{
|
||||
try
|
||||
{
|
||||
final FileOutputStream file = new FileOutputStream(new File(Config.DATAPACK_ROOT, "data/events/" + tempName));
|
||||
final PrintStream p = new PrintStream(file);
|
||||
p.println(activeChar.getName());
|
||||
p.println(tempBuffer);
|
||||
file.close();
|
||||
p.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("Problem with AdminEventEngine: " + e.getMessage());
|
||||
}
|
||||
|
||||
tempBuffer = "";
|
||||
tempName = "";
|
||||
showMainPage(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_set"))
|
||||
{
|
||||
// There is an exception here for not using the ST. We use spaces (ST delim) for the event name.
|
||||
GameEvent._eventName = command.substring(16);
|
||||
showEventParameters(activeChar, 2);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_change_teams_number"))
|
||||
{
|
||||
showEventParameters(activeChar, Integer.parseInt(st.nextToken()));
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_panel"))
|
||||
{
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_announce"))
|
||||
{
|
||||
GameEvent._npcId = Integer.parseInt(st.nextToken());
|
||||
GameEvent._teamsNumber = Integer.parseInt(st.nextToken());
|
||||
String temp = " ";
|
||||
String temp2 = "";
|
||||
while (st.hasMoreElements())
|
||||
{
|
||||
temp += st.nextToken() + " ";
|
||||
}
|
||||
|
||||
st = new StringTokenizer(temp, "-");
|
||||
Integer i = 1;
|
||||
|
||||
while (st.hasMoreElements())
|
||||
{
|
||||
temp2 = st.nextToken();
|
||||
if (!temp2.equals(" "))
|
||||
{
|
||||
GameEvent._teamNames.put(i++, temp2.substring(1, temp2.length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.sendMessage(GameEvent.startEventParticipation());
|
||||
Broadcast.toAllOnlinePlayers(activeChar.getName() + " has started an event. You will find a participation NPC somewhere around you.");
|
||||
|
||||
final PlaySound snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
|
||||
activeChar.sendPacket(snd);
|
||||
activeChar.broadcastPacket(snd);
|
||||
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final String replyMSG = "<html><title>[ EVENT ENGINE ]</title><body><br><center>The event <font color=\"LEVEL\">" + GameEvent._eventName + "</font> has been announced, now you can type //event_panel to see the event panel control</center><br></body></html>";
|
||||
adminReply.setHtml(replyMSG);
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_begin"))
|
||||
{
|
||||
// Starts the event and sends a message of the result
|
||||
activeChar.sendMessage(GameEvent.startEvent());
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_finish"))
|
||||
{
|
||||
// Finishes the event and sends a message of the result
|
||||
activeChar.sendMessage(GameEvent.finishEvent());
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_teleport"))
|
||||
{
|
||||
while (st.hasMoreElements()) // Every next ST should be a team number
|
||||
{
|
||||
final int teamId = Integer.parseInt(st.nextToken());
|
||||
for (PlayerInstance player : GameEvent._teams.get(teamId))
|
||||
{
|
||||
player.setTitle(GameEvent._teamNames.get(teamId));
|
||||
player.teleToLocation(activeChar.getLocation(), true);
|
||||
player.setInstanceId(activeChar.getInstanceId());
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_sit"))
|
||||
{
|
||||
while (st.hasMoreElements()) // Every next ST should be a team number
|
||||
{
|
||||
// Integer.parseInt(st.nextToken()) == teamId
|
||||
for (PlayerInstance player : GameEvent._teams.get(Integer.parseInt(st.nextToken())))
|
||||
{
|
||||
if (player.getEventStatus() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
player.getEventStatus().setSitForced(!player.getEventStatus().isSitForced());
|
||||
if (player.getEventStatus().isSitForced())
|
||||
{
|
||||
player.sitDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.standUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_kill"))
|
||||
{
|
||||
while (st.hasMoreElements()) // Every next ST should be a team number
|
||||
{
|
||||
for (PlayerInstance player : GameEvent._teams.get(Integer.parseInt(st.nextToken())))
|
||||
{
|
||||
player.reduceCurrentHp(player.getMaxHp() + player.getMaxCp() + 1, activeChar, null);
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_res"))
|
||||
{
|
||||
while (st.hasMoreElements()) // Every next ST should be a team number
|
||||
{
|
||||
for (PlayerInstance player : GameEvent._teams.get(Integer.parseInt(st.nextToken())))
|
||||
{
|
||||
if ((player == null) || !player.isDead())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
player.restoreExp(100.0);
|
||||
player.doRevive();
|
||||
player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_transform"))
|
||||
{
|
||||
final int teamId = Integer.parseInt(st.nextToken());
|
||||
final int[] transIds = new int[st.countTokens()];
|
||||
int i = 0;
|
||||
while (st.hasMoreElements()) // Every next ST should be a transform ID
|
||||
{
|
||||
transIds[i++] = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
for (PlayerInstance player : GameEvent._teams.get(teamId))
|
||||
{
|
||||
final int transId = transIds[Rnd.get(transIds.length)];
|
||||
if (!TransformData.getInstance().transformPlayer(transId, player))
|
||||
{
|
||||
AdminData.getInstance().broadcastMessageToGMs("EventEngine: Unknow transformation id: " + transId);
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_untransform"))
|
||||
{
|
||||
while (st.hasMoreElements()) // Every next ST should be a team number
|
||||
{
|
||||
for (PlayerInstance player : GameEvent._teams.get(Integer.parseInt(st.nextToken())))
|
||||
{
|
||||
player.stopTransformation(true);
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_kick"))
|
||||
{
|
||||
if (st.hasMoreElements()) // If has next token, it should be player name.
|
||||
{
|
||||
while (st.hasMoreElements())
|
||||
{
|
||||
final PlayerInstance player = World.getInstance().getPlayer(st.nextToken());
|
||||
if (player != null)
|
||||
{
|
||||
GameEvent.removeAndResetPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((activeChar.getTarget() != null) && (activeChar.getTarget().isPlayer()))
|
||||
{
|
||||
GameEvent.removeAndResetPlayer((PlayerInstance) activeChar.getTarget());
|
||||
}
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
else if (actualCommand.startsWith("admin_event_control_prize"))
|
||||
{
|
||||
final int[] teamIds = new int[st.countTokens() - 2];
|
||||
int i = 0;
|
||||
while ((st.countTokens() - 2) > 0) // The last 2 tokens are used for "n" and "item id"
|
||||
{
|
||||
teamIds[i++] = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
final String[] n = st.nextToken().split("\\*");
|
||||
final int itemId = Integer.parseInt(st.nextToken());
|
||||
for (int teamId : teamIds)
|
||||
{
|
||||
rewardTeam(activeChar, teamId, Integer.parseInt(n[0]), itemId, n.length == 2 ? n[1] : "");
|
||||
}
|
||||
showEventControl(activeChar);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
AdminData.getInstance().broadcastMessageToGMs("EventEngine: Error! Possible blank boxes while executing a command which requires a value in the box?");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
|
||||
private String showStoredEvents()
|
||||
{
|
||||
final File dir = new File(Config.DATAPACK_ROOT, "/data/events");
|
||||
if (dir.isFile())
|
||||
{
|
||||
return "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' is a file or is corrupted!</font><br>";
|
||||
}
|
||||
|
||||
String note = "";
|
||||
if (!dir.exists())
|
||||
{
|
||||
note = "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' does not exist!</font><br><font color=\"0099FF\">Trying to create it now...<br></font><br>";
|
||||
if (dir.mkdirs())
|
||||
{
|
||||
note += "<font color=\"006600\">The directory '" + dir.getAbsolutePath() + "' has been created!</font><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
note += "<font color=\"FF0000\">The directory '" + dir.getAbsolutePath() + "' hasn't been created!</font><br>";
|
||||
return note;
|
||||
}
|
||||
}
|
||||
|
||||
final String[] files = dir.list();
|
||||
final StringBuilder result = new StringBuilder(files.length * 500);
|
||||
result.append("<table>");
|
||||
for (String fileName : files)
|
||||
{
|
||||
result.append("<tr><td align=center>");
|
||||
result.append(fileName);
|
||||
result.append(" </td></tr><tr><td><table cellspacing=0><tr><td><button value=\"Select Event\" action=\"bypass -h admin_event_set ");
|
||||
result.append(fileName);
|
||||
result.append("\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"View Event\" action=\"bypass -h admin_event_see ");
|
||||
result.append(fileName);
|
||||
result.append("\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"Delete Event\" action=\"bypass -h admin_event_del ");
|
||||
result.append(fileName);
|
||||
result.append("\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></td></tr><tr><td> </td></tr><tr><td> </td></tr>");
|
||||
}
|
||||
|
||||
result.append("</table>");
|
||||
|
||||
return note + result;
|
||||
}
|
||||
|
||||
public void showMainPage(PlayerInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final String replyMSG = "<html><title>[ L2J EVENT ENGINE ]</title><body><br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><center><br><font color=LEVEL>Stored Events:</font><br></center>" + showStoredEvents() + "</body></html>";
|
||||
adminReply.setHtml(replyMSG);
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
||||
public void showNewEventPage(PlayerInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final StringBuilder replyMSG = new StringBuilder(512);
|
||||
replyMSG.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><br><center><font color=LEVEL>Event name:</font><br>");
|
||||
if (tempName.isEmpty())
|
||||
{
|
||||
replyMSG.append("You can also use //event_name text to insert a new title");
|
||||
replyMSG.append("<center><multiedit var=\"name\" width=260 height=24> <button value=\"Set Event Name\" action=\"bypass -h admin_event_name $name\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
|
||||
}
|
||||
else
|
||||
{
|
||||
replyMSG.append(tempName);
|
||||
}
|
||||
|
||||
replyMSG.append("<br><br><font color=LEVEL>Event description:</font><br></center>");
|
||||
if (tempBuffer.isEmpty())
|
||||
{
|
||||
replyMSG.append("You can also use //add text to add text or //delete_buffer to remove the text.");
|
||||
}
|
||||
else
|
||||
{
|
||||
replyMSG.append(tempBuffer);
|
||||
}
|
||||
|
||||
replyMSG.append("<center><multiedit var=\"txt\" width=270 height=100> <button value=\"Add text\" action=\"bypass -h admin_add $txt\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
|
||||
replyMSG.append("<button value=\"Remove text\" action=\"bypass -h admin_delete_buffer\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
|
||||
if (!(tempName.isEmpty() && tempBuffer.isEmpty()))
|
||||
{
|
||||
replyMSG.append("<br><button value=\"Store Event Data\" action=\"bypass -h admin_event_store\" width=160 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
|
||||
}
|
||||
|
||||
replyMSG.append("</center></body></html>");
|
||||
|
||||
adminReply.setHtml(replyMSG.toString());
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
||||
public void showEventParameters(PlayerInstance activeChar, int teamnumbers)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("<html><body><title>[ L2J EVENT ENGINE ]</title><br><center> Current event: <font color=\"LEVEL\">");
|
||||
sb.append(GameEvent._eventName);
|
||||
sb.append("</font></center><br>INFO: To start an event, you must first set the number of teams, then type their names in the boxes and finally type the NPC ID that will be the event manager (can be any existing npc) next to the \"Announce Event!\" button.<br><table width=100%>");
|
||||
sb.append("<tr><td><button value=\"Announce Event!\" action=\"bypass -h admin_event_announce $event_npcid ");
|
||||
sb.append(teamnumbers);
|
||||
sb.append(" ");
|
||||
for (int i = 1; (i - 1) < teamnumbers; i++) // Event announce params
|
||||
{
|
||||
sb.append("$event_teams_name");
|
||||
sb.append(i);
|
||||
sb.append(" - ");
|
||||
}
|
||||
sb.append("\" width=140 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
|
||||
sb.append("<td><edit var=\"event_npcid\" width=100 height=20></td></tr>");
|
||||
sb.append("<tr><td><button value=\"Set number of teams\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=140 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
|
||||
sb.append("<td><edit var=\"event_teams_number\" width=100 height=20></td></tr>");
|
||||
sb.append("</table><br><center><br><br>");
|
||||
sb.append("<font color=\"LEVEL\">Teams' names:</font><br><table width=100% cellspacing=8>");
|
||||
for (int i = 1; (i - 1) < teamnumbers; i++) // Team names params
|
||||
{
|
||||
sb.append("<tr><td align=center>Team #");
|
||||
sb.append(i);
|
||||
sb.append(" name:</td><td><edit var=\"event_teams_name");
|
||||
sb.append(i);
|
||||
sb.append("\" width=150 height=15></td></tr>");
|
||||
}
|
||||
sb.append("</table></body></html>");
|
||||
|
||||
adminReply.setHtml(sb.toString());
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
||||
private void showEventControl(PlayerInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("<html><title>[ EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
|
||||
sb.append(GameEvent._eventName);
|
||||
sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>");
|
||||
sb.append("<tr><td> </td></tr><tr><td><table width=200>");
|
||||
if (!npcsDeleted)
|
||||
{
|
||||
sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
|
||||
}
|
||||
|
||||
sb.append("<tr><td> </td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td> </td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td> </td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td> </td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td> </td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td> </td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td> </td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td> </td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td> </td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td> </td></tr></table></td></tr></table></body></html>");
|
||||
adminReply.setHtml(sb.toString());
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
||||
private void rewardTeam(PlayerInstance activeChar, int team, int n, int id, String type)
|
||||
{
|
||||
int num = n;
|
||||
for (PlayerInstance player : GameEvent._teams.get(team))
|
||||
{
|
||||
if (type.equalsIgnoreCase("level"))
|
||||
{
|
||||
num = n * player.getLevel();
|
||||
}
|
||||
else if (type.equalsIgnoreCase("kills") && (player.getEventStatus() != null))
|
||||
{
|
||||
num = n * player.getEventStatus().getKills().size();
|
||||
}
|
||||
else
|
||||
{
|
||||
num = n;
|
||||
}
|
||||
|
||||
player.addItem("Event", id, num, activeChar, true);
|
||||
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
adminReply.setHtml("<html><body>CONGRATULATIONS! You should have been rewarded.</body></html>");
|
||||
player.sendPacket(adminReply);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.admincommandhandlers;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEventTeleporter;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTManager;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public class AdminTvTEvent implements IAdminCommandHandler
|
||||
{
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_tvt_add",
|
||||
"admin_tvt_remove",
|
||||
"admin_tvt_advance"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useAdminCommand(String command, PlayerInstance activeChar)
|
||||
{
|
||||
if (command.equals("admin_tvt_add"))
|
||||
{
|
||||
final WorldObject target = activeChar.getTarget();
|
||||
if ((target == null) || !target.isPlayer())
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "You should select a player!");
|
||||
return true;
|
||||
}
|
||||
|
||||
add(activeChar, (PlayerInstance) target);
|
||||
}
|
||||
else if (command.equals("admin_tvt_remove"))
|
||||
{
|
||||
final WorldObject target = activeChar.getTarget();
|
||||
if ((target == null) || !target.isPlayer())
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "You should select a player!");
|
||||
return true;
|
||||
}
|
||||
|
||||
remove(activeChar, (PlayerInstance) target);
|
||||
}
|
||||
else if (command.equals("admin_tvt_advance"))
|
||||
{
|
||||
TvTManager.getInstance().skipDelay();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAdminCommandList()
|
||||
{
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
|
||||
private void add(PlayerInstance activeChar, PlayerInstance playerInstance)
|
||||
{
|
||||
if (playerInstance.isOnEvent())
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Player already participated in the event!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TvTEvent.addParticipant(playerInstance))
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Player instance could not be added, it seems to be null!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TvTEvent.isStarted())
|
||||
{
|
||||
new TvTEventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void remove(PlayerInstance activeChar, PlayerInstance playerInstance)
|
||||
{
|
||||
if (!TvTEvent.removeParticipant(playerInstance.getObjectId()))
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Player is not part of the event!");
|
||||
return;
|
||||
}
|
||||
|
||||
new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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 handlers.bypasshandlers;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class EventEngine implements IBypassHandler
|
||||
{
|
||||
private static final String[] COMMANDS =
|
||||
{
|
||||
"event_participate",
|
||||
"event_unregister"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useBypass(String command, PlayerInstance player, Creature target)
|
||||
{
|
||||
if (!target.isNpc())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (command.equalsIgnoreCase("event_participate"))
|
||||
{
|
||||
GameEvent.registerPlayer(player);
|
||||
return true;
|
||||
}
|
||||
else if (command.equalsIgnoreCase("event_unregister"))
|
||||
{
|
||||
GameEvent.removeAndResetPlayer(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBypassList()
|
||||
{
|
||||
return COMMANDS;
|
||||
}
|
||||
}
|
||||
@@ -100,9 +100,9 @@ public class Observation implements IBypassHandler
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_OBSERVE_A_SIEGE_WITH_A_PET_OR_SERVITOR_SUMMONED);
|
||||
return false;
|
||||
}
|
||||
if (player.isOnEvent())
|
||||
if (player.isRegisteredOnCustomEvent())
|
||||
{
|
||||
player.sendMessage("Cannot use while current Event");
|
||||
player.sendMessage("Cannot use while registered on an event");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class HomeBoard implements IParseBoardHandler
|
||||
break;
|
||||
}
|
||||
}
|
||||
return commandCheck && (player.isCastingNow() || player.isCastingSimultaneouslyNow() || player.isInCombat() || player.isInDuel() || player.isInOlympiadMode() || player.isInsideZone(ZoneId.SIEGE) || player.isInsideZone(ZoneId.PVP) || (player.getPvpFlag() > 0) || player.isAlikeDead() || player.isOnEvent());
|
||||
return commandCheck && (player.isCastingNow() || player.isCastingSimultaneouslyNow() || player.isInCombat() || player.isInDuel() || player.isInOlympiadMode() || player.isInsideZone(ZoneId.SIEGE) || player.isInsideZone(ZoneId.PVP) || (player.getPvpFlag() > 0) || player.isAlikeDead() || player.isOnCustomEvent());
|
||||
};
|
||||
|
||||
private static final Predicate<PlayerInstance> KARMA_CHECK = player -> Config.COMMUNITYBOARD_KARMA_DISABLED && (player.getKarma() > 0);
|
||||
|
||||
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -140,7 +139,7 @@ public class CallPc extends AbstractEffect
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !TvTEvent.onEscapeUse(target.getObjectId()))
|
||||
if (target.isFestivalParticipant() || target.isFlyingMounted() || target.isCombatFlagEquipped() || !target.isOnCustomEvent())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
|
||||
return false;
|
||||
|
||||
@@ -18,7 +18,6 @@ package handlers.itemhandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -41,7 +40,7 @@ public class ItemSkillsTemplate implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TvTEvent.onScrollUse(playable.getObjectId()))
|
||||
if (playable.isOnCustomEvent())
|
||||
{
|
||||
playable.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package handlers.itemhandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.PetDataTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.PetData;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -39,7 +38,7 @@ public class SummonItems extends ItemSkillsTemplate
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TvTEvent.onItemSummon(playable.getObjectId()))
|
||||
if (playable.isOnCustomEvent())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.player.TeleportTask;
|
||||
@@ -185,11 +184,6 @@ public class JailHandler implements IPunishmentHandler
|
||||
{
|
||||
player.setInstanceId(0);
|
||||
|
||||
if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getObjectId()))
|
||||
{
|
||||
TvTEvent.removeParticipant(player.getObjectId());
|
||||
}
|
||||
|
||||
if (Olympiad.getInstance().isRegisteredInComp(player))
|
||||
{
|
||||
Olympiad.getInstance().removeDisconnectedCompetitor(player);
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -101,7 +100,7 @@ public class Clan implements ITargetTypeHandler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TvTEvent.checkForTvTSkill(player, obj, skill))
|
||||
if (player.isOnCustomEvent() && obj.isOnCustomEvent() && (player.getTeam() != obj.getTeam()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -88,7 +87,7 @@ public class CorpseClan implements ITargetTypeHandler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TvTEvent.checkForTvTSkill(player, obj, skill))
|
||||
if (player.isOnCustomEvent() && obj.isOnCustomEvent() && (player.getTeam() != obj.getTeam()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -118,7 +117,7 @@ public class PartyClan implements ITargetTypeHandler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TvTEvent.checkForTvTSkill(player, obj, skill))
|
||||
if (player.isOnCustomEvent() && obj.isOnCustomEvent() && (player.getTeam() != obj.getTeam()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -45,8 +44,7 @@ public class Unstuck implements IUserCommandHandler
|
||||
@Override
|
||||
public boolean useUserCommand(int id, PlayerInstance player)
|
||||
{
|
||||
// Thanks nbd
|
||||
if (!TvTEvent.onEscapeUse(player.getObjectId()))
|
||||
if (player.isRegisteredOnCustomEvent())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
|
||||
@@ -32,8 +32,6 @@ import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.CoupleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -41,7 +39,6 @@ import org.l2jmobius.gameserver.model.sevensigns.SevenSigns;
|
||||
import org.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
|
||||
@@ -292,9 +289,9 @@ public class Wedding implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GameEvent.isParticipant(activeChar))
|
||||
if (activeChar.isRegisteredOnCustomEvent())
|
||||
{
|
||||
activeChar.sendMessage("You are in an event.");
|
||||
activeChar.sendMessage("You are registered in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -328,13 +325,6 @@ public class Wedding implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// Thanks nbd
|
||||
if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
|
||||
{
|
||||
activeChar.sendMessage("You are in area which blocks summoning.");
|
||||
@@ -378,9 +368,9 @@ public class Wedding implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GameEvent.isParticipant(partner))
|
||||
if (partner.isRegisteredOnCustomEvent())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in an event.");
|
||||
activeChar.sendMessage("Your partner is registered in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -437,12 +427,6 @@ public class Wedding implements IVoicedCommandHandler
|
||||
}
|
||||
}
|
||||
|
||||
if (!TvTEvent.onEscapeUse(partner.getObjectId()))
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in area which blocks summoning.");
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
<height normal="23" />
|
||||
</collision>
|
||||
</npc>
|
||||
<npc id="70010" displayId="31606" name="Catrina" usingServerSideName="true" title="TvT Event Manager" usingServerSideTitle="true" type="Npc">
|
||||
<collision>
|
||||
<radius normal="8" />
|
||||
<height normal="15" />
|
||||
</collision>
|
||||
</npc>
|
||||
<npc id="900100" displayId="20432" level="1" name="Elpy" type="EventMonster">
|
||||
<stats str="40" int="21" dex="30" wit="20" con="43" men="20">
|
||||
<vitals hp="40" hpRegen="3" mp="36" mpRegen="1" />
|
||||
|
||||
@@ -139,7 +139,6 @@ public class Config
|
||||
private static final String CUSTOM_SERVER_TIME_CONFIG_FILE = "./config/Custom/ServerTime.ini";
|
||||
private static final String CUSTOM_SCHEME_BUFFER_CONFIG_FILE = "./config/Custom/ShemeBuffer.ini";
|
||||
private static final String CUSTOM_STARTING_LOCATION_CONFIG_FILE = "./config/Custom/StartingLocation.ini";
|
||||
private static final String CUSTOM_TVT_CONFIG_FILE = "./config/Custom/TeamVersusTeam.ini";
|
||||
private static final String CUSTOM_VOTE_REWARD_CONFIG_FILE = "./config/Custom/VoteReward.ini";
|
||||
private static final String CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE = "./config/Custom/WarehouseSorting.ini";
|
||||
private static final String CUSTOM_WEDDING_CONFIG_FILE = "./config/Custom/Wedding.ini";
|
||||
@@ -1106,38 +1105,6 @@ public class Config
|
||||
public static int CHAMPION_REWARD_QTY;
|
||||
public static boolean CHAMPION_ENABLE_VITALITY;
|
||||
public static boolean CHAMPION_ENABLE_IN_INSTANCES;
|
||||
public static boolean TVT_EVENT_ENABLED;
|
||||
public static boolean TVT_EVENT_IN_INSTANCE;
|
||||
public static int TVT_EVENT_INSTANCE_ID;
|
||||
public static String[] TVT_EVENT_INTERVAL;
|
||||
public static int TVT_EVENT_PARTICIPATION_TIME;
|
||||
public static int TVT_EVENT_RUNNING_TIME;
|
||||
public static int TVT_EVENT_PARTICIPATION_NPC_ID;
|
||||
public static int[] TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[4];
|
||||
public static int[] TVT_EVENT_PARTICIPATION_FEE = new int[2];
|
||||
public static int TVT_EVENT_MIN_PLAYERS_IN_TEAMS;
|
||||
public static int TVT_EVENT_MAX_PLAYERS_IN_TEAMS;
|
||||
public static int TVT_EVENT_RESPAWN_TELEPORT_DELAY;
|
||||
public static int TVT_EVENT_START_LEAVE_TELEPORT_DELAY;
|
||||
public static String TVT_EVENT_TEAM_1_NAME;
|
||||
public static int[] TVT_EVENT_TEAM_1_COORDINATES = new int[3];
|
||||
public static String TVT_EVENT_TEAM_2_NAME;
|
||||
public static int[] TVT_EVENT_TEAM_2_COORDINATES = new int[3];
|
||||
public static List<int[]> TVT_EVENT_REWARDS;
|
||||
public static boolean TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;
|
||||
public static boolean TVT_EVENT_SCROLL_ALLOWED;
|
||||
public static boolean TVT_EVENT_POTIONS_ALLOWED;
|
||||
public static boolean TVT_EVENT_SUMMON_BY_ITEM_ALLOWED;
|
||||
public static List<Integer> TVT_DOORS_IDS_TO_OPEN;
|
||||
public static List<Integer> TVT_DOORS_IDS_TO_CLOSE;
|
||||
public static boolean TVT_REWARD_TEAM_TIE;
|
||||
public static byte TVT_EVENT_MIN_LEVEL;
|
||||
public static byte TVT_EVENT_MAX_LEVEL;
|
||||
public static int TVT_EVENT_EFFECTS_REMOVAL;
|
||||
public static Map<Integer, Integer> TVT_EVENT_FIGHTER_BUFFS;
|
||||
public static Map<Integer, Integer> TVT_EVENT_MAGE_BUFFS;
|
||||
public static int TVT_EVENT_MAX_PARTICIPANTS_PER_IP;
|
||||
public static boolean TVT_ALLOW_VOICED_COMMAND;
|
||||
public static boolean ALLOW_WEDDING;
|
||||
public static int WEDDING_PRICE;
|
||||
public static boolean WEDDING_PUNISH_INFIDELITY;
|
||||
@@ -3071,210 +3038,6 @@ public class Config
|
||||
CUSTOM_STARTING_LOC_Y = StartingLocation.getInt("CustomStartingLocY", 147880);
|
||||
CUSTOM_STARTING_LOC_Z = StartingLocation.getInt("CustomStartingLocZ", -3469);
|
||||
|
||||
// Load TeamVersusTeam config file (if exists)
|
||||
final PropertiesParser TeamVersusTeam = new PropertiesParser(CUSTOM_TVT_CONFIG_FILE);
|
||||
TVT_EVENT_ENABLED = TeamVersusTeam.getBoolean("TvTEventEnabled", false);
|
||||
TVT_EVENT_IN_INSTANCE = TeamVersusTeam.getBoolean("TvTEventInInstance", false);
|
||||
TVT_EVENT_INSTANCE_ID = TeamVersusTeam.getInt("TvTEventInstanceId", 3049);
|
||||
TVT_EVENT_INTERVAL = TeamVersusTeam.getString("TvTEventInterval", "20:00").split(",");
|
||||
TVT_EVENT_PARTICIPATION_TIME = TeamVersusTeam.getInt("TvTEventParticipationTime", 3600);
|
||||
TVT_EVENT_RUNNING_TIME = TeamVersusTeam.getInt("TvTEventRunningTime", 1800);
|
||||
TVT_EVENT_PARTICIPATION_NPC_ID = TeamVersusTeam.getInt("TvTEventParticipationNpcId", 0);
|
||||
if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
|
||||
{
|
||||
TVT_EVENT_ENABLED = false;
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcId");
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] tvtNpcCoords = TeamVersusTeam.getString("TvTEventParticipationNpcCoordinates", "0,0,0").split(",");
|
||||
if (tvtNpcCoords.length < 3)
|
||||
{
|
||||
TVT_EVENT_ENABLED = false;
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcCoordinates");
|
||||
}
|
||||
else
|
||||
{
|
||||
TVT_EVENT_REWARDS = new ArrayList<>();
|
||||
TVT_DOORS_IDS_TO_OPEN = new ArrayList<>();
|
||||
TVT_DOORS_IDS_TO_CLOSE = new ArrayList<>();
|
||||
TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[4];
|
||||
TVT_EVENT_TEAM_1_COORDINATES = new int[3];
|
||||
TVT_EVENT_TEAM_2_COORDINATES = new int[3];
|
||||
TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0] = Integer.parseInt(tvtNpcCoords[0]);
|
||||
TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1] = Integer.parseInt(tvtNpcCoords[1]);
|
||||
TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2] = Integer.parseInt(tvtNpcCoords[2]);
|
||||
if (tvtNpcCoords.length == 4)
|
||||
{
|
||||
TVT_EVENT_PARTICIPATION_NPC_COORDINATES[3] = Integer.parseInt(tvtNpcCoords[3]);
|
||||
}
|
||||
TVT_EVENT_MIN_PLAYERS_IN_TEAMS = TeamVersusTeam.getInt("TvTEventMinPlayersInTeams", 1);
|
||||
TVT_EVENT_MAX_PLAYERS_IN_TEAMS = TeamVersusTeam.getInt("TvTEventMaxPlayersInTeams", 20);
|
||||
TVT_EVENT_MIN_LEVEL = TeamVersusTeam.getByte("TvTEventMinPlayerLevel", (byte) 1);
|
||||
TVT_EVENT_MAX_LEVEL = TeamVersusTeam.getByte("TvTEventMaxPlayerLevel", (byte) 80);
|
||||
TVT_EVENT_RESPAWN_TELEPORT_DELAY = TeamVersusTeam.getInt("TvTEventRespawnTeleportDelay", 20);
|
||||
TVT_EVENT_START_LEAVE_TELEPORT_DELAY = TeamVersusTeam.getInt("TvTEventStartLeaveTeleportDelay", 20);
|
||||
TVT_EVENT_EFFECTS_REMOVAL = TeamVersusTeam.getInt("TvTEventEffectsRemoval", 0);
|
||||
TVT_EVENT_MAX_PARTICIPANTS_PER_IP = TeamVersusTeam.getInt("TvTEventMaxParticipantsPerIP", 0);
|
||||
TVT_ALLOW_VOICED_COMMAND = TeamVersusTeam.getBoolean("TvTAllowVoicedInfoCommand", false);
|
||||
TVT_EVENT_TEAM_1_NAME = TeamVersusTeam.getString("TvTEventTeam1Name", "Team1");
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventTeam1Coordinates", "0,0,0").split(",");
|
||||
if (tvtNpcCoords.length < 3)
|
||||
{
|
||||
TVT_EVENT_ENABLED = false;
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam1Coordinates");
|
||||
}
|
||||
else
|
||||
{
|
||||
TVT_EVENT_TEAM_1_COORDINATES[0] = Integer.parseInt(tvtNpcCoords[0]);
|
||||
TVT_EVENT_TEAM_1_COORDINATES[1] = Integer.parseInt(tvtNpcCoords[1]);
|
||||
TVT_EVENT_TEAM_1_COORDINATES[2] = Integer.parseInt(tvtNpcCoords[2]);
|
||||
TVT_EVENT_TEAM_2_NAME = TeamVersusTeam.getString("TvTEventTeam2Name", "Team2");
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventTeam2Coordinates", "0,0,0").split(",");
|
||||
if (tvtNpcCoords.length < 3)
|
||||
{
|
||||
TVT_EVENT_ENABLED = false;
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam2Coordinates");
|
||||
}
|
||||
else
|
||||
{
|
||||
TVT_EVENT_TEAM_2_COORDINATES[0] = Integer.parseInt(tvtNpcCoords[0]);
|
||||
TVT_EVENT_TEAM_2_COORDINATES[1] = Integer.parseInt(tvtNpcCoords[1]);
|
||||
TVT_EVENT_TEAM_2_COORDINATES[2] = Integer.parseInt(tvtNpcCoords[2]);
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventParticipationFee", "0,0").split(",");
|
||||
try
|
||||
{
|
||||
TVT_EVENT_PARTICIPATION_FEE[0] = Integer.parseInt(tvtNpcCoords[0]);
|
||||
TVT_EVENT_PARTICIPATION_FEE[1] = Integer.parseInt(tvtNpcCoords[1]);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (tvtNpcCoords.length > 0)
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationFee");
|
||||
}
|
||||
}
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventReward", "57,100000").split(";");
|
||||
for (String reward : tvtNpcCoords)
|
||||
{
|
||||
final String[] rewardSplit = reward.split(",");
|
||||
if (rewardSplit.length != 2)
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"" + reward + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
TVT_EVENT_REWARDS.add(new int[]
|
||||
{
|
||||
Integer.parseInt(rewardSplit[0]),
|
||||
Integer.parseInt(rewardSplit[1])
|
||||
});
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (!reward.isEmpty())
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"" + reward + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = TeamVersusTeam.getBoolean("TvTEventTargetTeamMembersAllowed", true);
|
||||
TVT_EVENT_SCROLL_ALLOWED = TeamVersusTeam.getBoolean("TvTEventScrollsAllowed", false);
|
||||
TVT_EVENT_POTIONS_ALLOWED = TeamVersusTeam.getBoolean("TvTEventPotionsAllowed", false);
|
||||
TVT_EVENT_SUMMON_BY_ITEM_ALLOWED = TeamVersusTeam.getBoolean("TvTEventSummonByItemAllowed", false);
|
||||
TVT_REWARD_TEAM_TIE = TeamVersusTeam.getBoolean("TvTRewardTeamTie", false);
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTDoorsToOpen", "").split(";");
|
||||
for (String door : tvtNpcCoords)
|
||||
{
|
||||
try
|
||||
{
|
||||
TVT_DOORS_IDS_TO_OPEN.add(Integer.parseInt(door));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (!door.isEmpty())
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTDoorsToOpen \"" + door + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTDoorsToClose", "").split(";");
|
||||
for (String door : tvtNpcCoords)
|
||||
{
|
||||
try
|
||||
{
|
||||
TVT_DOORS_IDS_TO_CLOSE.add(Integer.parseInt(door));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (!door.isEmpty())
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTDoorsToClose \"" + door + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventFighterBuffs", "").split(";");
|
||||
if (!tvtNpcCoords[0].isEmpty())
|
||||
{
|
||||
TVT_EVENT_FIGHTER_BUFFS = new HashMap<>(tvtNpcCoords.length);
|
||||
for (String skill : tvtNpcCoords)
|
||||
{
|
||||
final String[] skillSplit = skill.split(",");
|
||||
if (skillSplit.length != 2)
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventFighterBuffs \"" + skill + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
TVT_EVENT_FIGHTER_BUFFS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (!skill.isEmpty())
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventFighterBuffs \"" + skill + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tvtNpcCoords = TeamVersusTeam.getString("TvTEventMageBuffs", "").split(";");
|
||||
if (!tvtNpcCoords[0].isEmpty())
|
||||
{
|
||||
TVT_EVENT_MAGE_BUFFS = new HashMap<>(tvtNpcCoords.length);
|
||||
for (String skill : tvtNpcCoords)
|
||||
{
|
||||
final String[] skillSplit = skill.split(",");
|
||||
if (skillSplit.length != 2)
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventMageBuffs \"" + skill + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
TVT_EVENT_MAGE_BUFFS.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
if (!skill.isEmpty())
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[Config.load()]: invalid config property -> TvTEventMageBuffs \"" + skill + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load WarehouseSorting config file (if exists)
|
||||
final PropertiesParser WarehouseSorting = new PropertiesParser(CUSTOM_WAREHOUSE_SORTING_CONFIG_FILE);
|
||||
ENABLE_WAREHOUSESORTING_CLAN = WarehouseSorting.getBoolean("EnableWarehouseSortingClan", false);
|
||||
|
||||
@@ -136,7 +136,6 @@ import org.l2jmobius.gameserver.instancemanager.SoIManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.Lottery;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
|
||||
import org.l2jmobius.gameserver.model.AutoSpawnHandler;
|
||||
@@ -436,8 +435,6 @@ public class GameServer
|
||||
|
||||
LOGGER.info("IdManager: Free ObjectID's remaining: " + IdManager.size());
|
||||
|
||||
TvTManager.getInstance();
|
||||
|
||||
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
||||
{
|
||||
OfflineTraderTable.getInstance().restoreOfflineTraders();
|
||||
|
||||
@@ -170,9 +170,9 @@ public class HandysBlockCheckerManager
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.isOnEvent() || player.isInOlympiadMode())
|
||||
if (player.isRegisteredOnCustomEvent() || player.isInOlympiadMode())
|
||||
{
|
||||
player.sendMessage("Couldnt register you due other event participation");
|
||||
player.sendMessage("Couldnt register you due other event participation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class PrecautionaryRestartManager
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.isOnEvent())
|
||||
if (player.isOnCustomEvent())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ public class SellBuffsManager implements IXmlReader
|
||||
player.sendMessage("You can't sell buffs with Olympiad status!");
|
||||
return false;
|
||||
}
|
||||
else if (player.isOnEvent()) // custom event message
|
||||
else if (player.isRegisteredOnCustomEvent()) // custom event message
|
||||
{
|
||||
player.sendMessage("You can't sell buffs while registered in an event!");
|
||||
return false;
|
||||
|
||||
@@ -1,544 +0,0 @@
|
||||
/*
|
||||
* 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.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.SpawnTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.PlayerEventHolder;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
* @Since 2011/05/17 21:51:39
|
||||
*/
|
||||
public class GameEvent
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(GameEvent.class.getName());
|
||||
public static EventState eventState = EventState.OFF;
|
||||
public static String _eventName = "";
|
||||
public static String _eventCreator = "";
|
||||
public static String _eventInfo = "";
|
||||
public static int _teamsNumber = 0;
|
||||
public static final Map<Integer, String> _teamNames = new ConcurrentHashMap<>();
|
||||
public static final Collection<PlayerInstance> _registeredPlayers = ConcurrentHashMap.newKeySet();
|
||||
public static final Map<Integer, List<PlayerInstance>> _teams = new ConcurrentHashMap<>();
|
||||
public static int _npcId = 0;
|
||||
private static final Map<PlayerInstance, PlayerEventHolder> _connectionLossData = new ConcurrentHashMap<>();
|
||||
|
||||
public enum EventState
|
||||
{
|
||||
OFF, // Not running
|
||||
STANDBY, // Waiting for participants to register
|
||||
ON // Registration is over and the event has started.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @return The team ID where the player is in, or -1 if player is null or team not found.
|
||||
*/
|
||||
public static int getPlayerTeamId(PlayerInstance player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (Entry<Integer, List<PlayerInstance>> team : _teams.entrySet())
|
||||
{
|
||||
if (team.getValue().contains(player))
|
||||
{
|
||||
return team.getKey();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static List<PlayerInstance> getTopNKillers(int n)
|
||||
{
|
||||
final Map<PlayerInstance, Integer> tmp = new HashMap<>();
|
||||
for (List<PlayerInstance> teamList : _teams.values())
|
||||
{
|
||||
for (PlayerInstance player : teamList)
|
||||
{
|
||||
if (player.getEventStatus() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
tmp.put(player, player.getEventStatus().getKills().size());
|
||||
}
|
||||
}
|
||||
|
||||
sortByValue(tmp);
|
||||
return tmp.size() <= n ? new ArrayList<>(tmp.keySet()) : (new ArrayList<>(tmp.keySet())).subList(1, n);
|
||||
}
|
||||
|
||||
public static void showEventHtml(PlayerInstance player, String objectid)
|
||||
{
|
||||
// TODO: work on this
|
||||
if (eventState == EventState.STANDBY)
|
||||
{
|
||||
try
|
||||
{
|
||||
final String htmContent;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(Integer.parseInt(objectid));
|
||||
if (_registeredPlayers.contains(player))
|
||||
{
|
||||
htmContent = HtmCache.getInstance().getHtm(player, "data/html/mods/EventEngine/Participating.htm");
|
||||
}
|
||||
else
|
||||
{
|
||||
htmContent = HtmCache.getInstance().getHtm(player, "data/html/mods/EventEngine/Participation.htm");
|
||||
}
|
||||
|
||||
if (htmContent != null)
|
||||
{
|
||||
html.setHtml(htmContent);
|
||||
}
|
||||
|
||||
html.replace("%objectId%", objectid); // Yeah, we need this.
|
||||
html.replace("%eventName%", _eventName);
|
||||
html.replace("%eventCreator%", _eventCreator);
|
||||
html.replace("%eventInfo%", _eventInfo);
|
||||
player.sendPacket(html);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on showEventHtml(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns an event participation NPC near the player. The npc id used to spawning is GameEvent._npcId
|
||||
* @param target
|
||||
*/
|
||||
public static void spawnEventNpc(PlayerInstance target)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Spawn spawn = new Spawn(_npcId);
|
||||
spawn.setXYZ(target.getX() + 50, target.getY() + 50, target.getZ());
|
||||
spawn.setAmount(1);
|
||||
spawn.setHeading(target.getHeading());
|
||||
spawn.stopRespawn();
|
||||
SpawnTable.getInstance().addNewSpawn(spawn, false);
|
||||
spawn.init();
|
||||
spawn.getLastSpawn().setCurrentHp(999999999);
|
||||
spawn.getLastSpawn().setTitle(_eventName);
|
||||
spawn.getLastSpawn().setEventMob(true);
|
||||
// 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(spawn.getLastSpawn());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zoey76: TODO: Rewrite this in a way that doesn't iterate over all spawns.
|
||||
*/
|
||||
public static void unspawnEventNpcs()
|
||||
{
|
||||
SpawnTable.getInstance().forEachSpawn(spawn ->
|
||||
{
|
||||
final Npc npc = spawn.getLastSpawn();
|
||||
if ((npc != null) && npc.isEventMob())
|
||||
{
|
||||
npc.deleteMe();
|
||||
spawn.stopRespawn();
|
||||
SpawnTable.getInstance().deleteSpawn(spawn, false);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @return False: If player is null, his event status is null or the event state is off. True: if the player is inside the _registeredPlayers list while the event state is STANDBY. If the event state is ON, it will check if the player is inside in one of the teams.
|
||||
*/
|
||||
public static boolean isParticipant(PlayerInstance player)
|
||||
{
|
||||
if ((player == null) || (player.getEventStatus() == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (eventState)
|
||||
{
|
||||
case OFF:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
case STANDBY:
|
||||
{
|
||||
return _registeredPlayers.contains(player);
|
||||
}
|
||||
case ON:
|
||||
{
|
||||
for (List<PlayerInstance> teamList : _teams.values())
|
||||
{
|
||||
if (teamList.contains(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the player to the list of participants. If the event state is NOT STANDBY, the player wont be registered.
|
||||
* @param player
|
||||
*/
|
||||
public static void registerPlayer(PlayerInstance player)
|
||||
{
|
||||
if (eventState != EventState.STANDBY)
|
||||
{
|
||||
player.sendMessage("The registration period for this event is over.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP == 0) || AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.L2EVENT_ID, player, Config.DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP))
|
||||
{
|
||||
_registeredPlayers.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("You have reached the maximum allowed participants per IP.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the player from the participating players and the teams and restores his init stats before he registered at the event (loc, pvp, pk, title etc)
|
||||
* @param player
|
||||
*/
|
||||
public static void removeAndResetPlayer(PlayerInstance player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isParticipant(player))
|
||||
{
|
||||
if (player.isDead())
|
||||
{
|
||||
player.restoreExp(100.0);
|
||||
player.doRevive();
|
||||
player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
}
|
||||
|
||||
player.decayMe();
|
||||
player.spawnMe(player.getX(), player.getY(), player.getZ());
|
||||
player.broadcastUserInfo();
|
||||
|
||||
player.stopTransformation(true);
|
||||
}
|
||||
|
||||
if (player.getEventStatus() != null)
|
||||
{
|
||||
player.getEventStatus().restorePlayerStats();
|
||||
}
|
||||
|
||||
player.setEventStatus(null);
|
||||
|
||||
_registeredPlayers.remove(player);
|
||||
final int teamId = getPlayerTeamId(player);
|
||||
if (_teams.containsKey(teamId))
|
||||
{
|
||||
_teams.get(teamId).remove(player);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Error at unregisterAndResetPlayer in the event:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The player's event status will be saved at _connectionLossData
|
||||
* @param player
|
||||
*/
|
||||
public static void savePlayerEventStatus(PlayerInstance player)
|
||||
{
|
||||
_connectionLossData.put(player, player.getEventStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* If _connectionLossData contains the player, it will restore the player's event status. Also it will remove the player from the _connectionLossData.
|
||||
* @param player
|
||||
*/
|
||||
public static void restorePlayerEventStatus(PlayerInstance player)
|
||||
{
|
||||
if (_connectionLossData.containsKey(player))
|
||||
{
|
||||
player.setEventStatus(_connectionLossData.get(player));
|
||||
_connectionLossData.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the event is ON or STANDBY, it will not start. Sets the event state to STANDBY and spawns registration NPCs
|
||||
* @return a string with information if the event participation has been successfully started or not.
|
||||
*/
|
||||
public static String startEventParticipation()
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (eventState)
|
||||
{
|
||||
case ON:
|
||||
{
|
||||
return "Cannot start event, it is already on.";
|
||||
}
|
||||
case STANDBY:
|
||||
{
|
||||
return "Cannot start event, it is on standby mode.";
|
||||
}
|
||||
case OFF: // Event is off, so no problem turning it on.
|
||||
{
|
||||
eventState = EventState.STANDBY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Register the event at AntiFeedManager and clean it for just in case if the event is already registered.
|
||||
AntiFeedManager.getInstance().registerEvent(AntiFeedManager.L2EVENT_ID);
|
||||
AntiFeedManager.getInstance().clear(AntiFeedManager.L2EVENT_ID);
|
||||
|
||||
// Just in case
|
||||
unspawnEventNpcs();
|
||||
_registeredPlayers.clear();
|
||||
// _npcs.clear();
|
||||
if (NpcData.getInstance().getTemplate(_npcId) == null)
|
||||
{
|
||||
return "Cannot start event, invalid npc id.";
|
||||
}
|
||||
|
||||
try (FileReader fr = new FileReader(Config.DATAPACK_ROOT + "/data/events/" + _eventName);
|
||||
BufferedReader br = new BufferedReader(fr))
|
||||
{
|
||||
_eventCreator = br.readLine();
|
||||
_eventInfo = br.readLine();
|
||||
}
|
||||
|
||||
final List<PlayerInstance> temp = new LinkedList<>();
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
if (!player.isOnline())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!temp.contains(player))
|
||||
{
|
||||
spawnEventNpc(player);
|
||||
temp.add(player);
|
||||
}
|
||||
World.getInstance().forEachVisibleObject(player, PlayerInstance.class, playertemp ->
|
||||
{
|
||||
if ((Math.abs(playertemp.getX() - player.getX()) < 1000) && (Math.abs(playertemp.getY() - player.getY()) < 1000) && (Math.abs(playertemp.getZ() - player.getZ()) < 1000))
|
||||
{
|
||||
temp.add(playertemp);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("Event: " + e.getMessage());
|
||||
return "Cannot start event participation, an error has occured.";
|
||||
}
|
||||
|
||||
return "The event participation has been successfully started.";
|
||||
}
|
||||
|
||||
/**
|
||||
* If the event is ON or OFF, it will not start. Sets the event state to ON, creates the teams, adds the registered players ordered by level at the teams and adds a new event status to the players.
|
||||
* @return a string with information if the event has been successfully started or not.
|
||||
*/
|
||||
public static String startEvent()
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (eventState)
|
||||
{
|
||||
case ON:
|
||||
{
|
||||
return "Cannot start event, it is already on.";
|
||||
}
|
||||
case STANDBY:
|
||||
{
|
||||
eventState = EventState.ON;
|
||||
break;
|
||||
}
|
||||
case OFF: // Event is off, so no problem turning it on.
|
||||
{
|
||||
return "Cannot start event, it is off. Participation start is required.";
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the things we will use, just in case.
|
||||
unspawnEventNpcs();
|
||||
_teams.clear();
|
||||
_connectionLossData.clear();
|
||||
|
||||
// Insert empty lists at _teams.
|
||||
for (int i = 0; i < _teamsNumber; i++)
|
||||
{
|
||||
_teams.put(i + 1, new CopyOnWriteArrayList<>());
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (!_registeredPlayers.isEmpty())
|
||||
{
|
||||
// Get the player with the biggest level
|
||||
int max = 0;
|
||||
PlayerInstance biggestLvlPlayer = null;
|
||||
for (PlayerInstance player : _registeredPlayers)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (max < player.getLevel())
|
||||
{
|
||||
max = player.getLevel();
|
||||
biggestLvlPlayer = player;
|
||||
}
|
||||
}
|
||||
|
||||
if (biggestLvlPlayer == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_registeredPlayers.remove(biggestLvlPlayer);
|
||||
_teams.get(i + 1).add(biggestLvlPlayer);
|
||||
biggestLvlPlayer.setEventStatus();
|
||||
i = (i + 1) % _teamsNumber;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("Event: " + e.getMessage());
|
||||
return "Cannot start event, an error has occured.";
|
||||
}
|
||||
|
||||
return "The event has been successfully started.";
|
||||
}
|
||||
|
||||
/**
|
||||
* If the event state is OFF, it will not finish. Sets the event state to OFF, unregisters and resets the players, unspawns and clers the event NPCs, clears the teams, registered players, connection loss data, sets the teams number to 0, sets the event name to empty.
|
||||
* @return a string with information if the event has been successfully stopped or not.
|
||||
*/
|
||||
public static String finishEvent()
|
||||
{
|
||||
switch (eventState)
|
||||
{
|
||||
case OFF:
|
||||
{
|
||||
return "Cannot finish event, it is already off.";
|
||||
}
|
||||
case STANDBY:
|
||||
{
|
||||
for (PlayerInstance player : _registeredPlayers)
|
||||
{
|
||||
removeAndResetPlayer(player);
|
||||
}
|
||||
|
||||
unspawnEventNpcs();
|
||||
// _npcs.clear();
|
||||
_registeredPlayers.clear();
|
||||
_teams.clear();
|
||||
_connectionLossData.clear();
|
||||
_teamsNumber = 0;
|
||||
_eventName = "";
|
||||
eventState = EventState.OFF;
|
||||
return "The event has been stopped at STANDBY mode, all players unregistered and all event npcs unspawned.";
|
||||
}
|
||||
case ON:
|
||||
{
|
||||
for (List<PlayerInstance> teamList : _teams.values())
|
||||
{
|
||||
for (PlayerInstance player : teamList)
|
||||
{
|
||||
removeAndResetPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
eventState = EventState.OFF;
|
||||
AntiFeedManager.getInstance().clear(AntiFeedManager.TVT_ID);
|
||||
unspawnEventNpcs(); // Just in case
|
||||
// _npcs.clear();
|
||||
_registeredPlayers.clear();
|
||||
_teams.clear();
|
||||
_connectionLossData.clear();
|
||||
_teamsNumber = 0;
|
||||
_eventName = "";
|
||||
_npcId = 0;
|
||||
_eventCreator = "";
|
||||
_eventInfo = "";
|
||||
return "The event has been stopped, all players unregistered and all event npcs unspawned.";
|
||||
}
|
||||
}
|
||||
|
||||
return "The event has been successfully finished.";
|
||||
}
|
||||
|
||||
private static Map<PlayerInstance, Integer> sortByValue(Map<PlayerInstance, Integer> unsortMap)
|
||||
{
|
||||
final List<Entry<PlayerInstance, Integer>> list = new LinkedList<>(unsortMap.entrySet());
|
||||
list.sort(Comparator.comparing(Entry::getValue));
|
||||
|
||||
final Map<PlayerInstance, Integer> sortedMap = new LinkedHashMap<>();
|
||||
for (Entry<PlayerInstance, Integer> entry : list)
|
||||
{
|
||||
sortedMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return sortedMap;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.interfaces.IEventListener;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class TvTEventListener implements IEventListener
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
|
||||
protected TvTEventListener(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnEvent()
|
||||
{
|
||||
return TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(_player.getObjectId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockingExit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockingDeathPenalty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRevive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInstance getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class TvTEventPlayer
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
|
||||
protected TvTEventPlayer(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public boolean isOnEvent()
|
||||
{
|
||||
return TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(_player.getObjectId());
|
||||
}
|
||||
|
||||
public boolean isBlockingExit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isBlockingDeathPenalty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canRevive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public PlayerInstance getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* 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.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public class TvTEventTeam
|
||||
{
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
private final String _name;
|
||||
/**
|
||||
* The team spot coordinated
|
||||
*/
|
||||
private int[] _coordinates = new int[3];
|
||||
/**
|
||||
* The points of the team
|
||||
*/
|
||||
private short _points;
|
||||
/** Name and instance of all participated players in map. */
|
||||
private final Map<Integer, PlayerInstance> _participatedPlayers = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* C'tor initialize the team
|
||||
* @param name as String
|
||||
* @param coordinates as int[]
|
||||
*/
|
||||
public TvTEventTeam(String name, int[] coordinates)
|
||||
{
|
||||
_name = name;
|
||||
_coordinates = coordinates;
|
||||
_points = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a player to the team
|
||||
* @param playerInstance as PlayerInstance
|
||||
* @return boolean: true if success, otherwise false
|
||||
*/
|
||||
public boolean addPlayer(PlayerInstance playerInstance)
|
||||
{
|
||||
if (playerInstance == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_participatedPlayers.put(playerInstance.getObjectId(), playerInstance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a player from the team
|
||||
* @param playerObjectId
|
||||
*/
|
||||
public void removePlayer(int playerObjectId)
|
||||
{
|
||||
_participatedPlayers.remove(playerObjectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases the points of the team
|
||||
*/
|
||||
public void increasePoints()
|
||||
{
|
||||
++_points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup the team and make it ready for adding players again
|
||||
*/
|
||||
public void cleanMe()
|
||||
{
|
||||
_participatedPlayers.clear();
|
||||
_points = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is given player in this team?
|
||||
* @param playerObjectId
|
||||
* @return boolean: true if player is in this team, otherwise false
|
||||
*/
|
||||
public boolean containsPlayer(int playerObjectId)
|
||||
{
|
||||
return _participatedPlayers.containsKey(playerObjectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the team
|
||||
* @return String: name of the team
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the coordinates of the team spot
|
||||
* @return int[]: team coordinates
|
||||
*/
|
||||
public int[] getCoordinates()
|
||||
{
|
||||
return _coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points of the team
|
||||
* @return short: team points
|
||||
*/
|
||||
public short getPoints()
|
||||
{
|
||||
return _points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns name and instance of all participated players in Map
|
||||
* @return Map<String, PlayerInstance>: map of players in this team
|
||||
*/
|
||||
public Map<Integer, PlayerInstance> getParticipatedPlayers()
|
||||
{
|
||||
return _participatedPlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns player count of this team
|
||||
* @return int: number of players in team
|
||||
*/
|
||||
public int getParticipatedPlayerCount()
|
||||
{
|
||||
return _participatedPlayers.size();
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.Team;
|
||||
import org.l2jmobius.gameserver.model.Duel;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class TvTEventTeleporter implements Runnable
|
||||
{
|
||||
/** The instance of the player to teleport */
|
||||
private PlayerInstance _playerInstance = null;
|
||||
/** Coordinates of the spot to teleport to */
|
||||
private int[] _coordinates = new int[3];
|
||||
/** Admin removed this player from event */
|
||||
private boolean _adminRemove = false;
|
||||
|
||||
/**
|
||||
* Initialize the teleporter and start the delayed task.
|
||||
* @param playerInstance
|
||||
* @param coordinates
|
||||
* @param fastSchedule
|
||||
* @param adminRemove
|
||||
*/
|
||||
public TvTEventTeleporter(PlayerInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove)
|
||||
{
|
||||
_playerInstance = playerInstance;
|
||||
_coordinates = coordinates;
|
||||
_adminRemove = adminRemove;
|
||||
ThreadPool.schedule(this, fastSchedule ? 0 : (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* The task method to teleport the player<br>
|
||||
* 1. Unsummon pet if there is one<br>
|
||||
* 2. Remove all effects<br>
|
||||
* 3. Revive and full heal the player<br>
|
||||
* 4. Teleport the player<br>
|
||||
* 5. Broadcast status and user info
|
||||
*/
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_playerInstance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Summon summon = _playerInstance.getSummon();
|
||||
if (summon != null)
|
||||
{
|
||||
summon.unSummon(_playerInstance);
|
||||
}
|
||||
|
||||
if ((Config.TVT_EVENT_EFFECTS_REMOVAL == 0) || ((Config.TVT_EVENT_EFFECTS_REMOVAL == 1) && ((_playerInstance.getTeam() == Team.NONE) || (_playerInstance.isInDuel() && (_playerInstance.getDuelState() != Duel.DUELSTATE_INTERRUPTED)))))
|
||||
{
|
||||
_playerInstance.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
}
|
||||
|
||||
if (_playerInstance.isInDuel())
|
||||
{
|
||||
_playerInstance.setDuelState(Duel.DUELSTATE_INTERRUPTED);
|
||||
}
|
||||
|
||||
final int TvTInstance = TvTEvent.getTvTEventInstance();
|
||||
if (TvTInstance != 0)
|
||||
{
|
||||
if (TvTEvent.isStarted() && !_adminRemove)
|
||||
{
|
||||
_playerInstance.setInstanceId(TvTInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerInstance.setInstanceId(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerInstance.setInstanceId(0);
|
||||
}
|
||||
|
||||
_playerInstance.doRevive();
|
||||
|
||||
_playerInstance.teleToLocation((_coordinates[0] + Rnd.get(101)) - 50, (_coordinates[1] + Rnd.get(101)) - 50, _coordinates[2], false);
|
||||
if (TvTEvent.isStarted() && !_adminRemove)
|
||||
{
|
||||
final int teamId = TvTEvent.getParticipantTeamId(_playerInstance.getObjectId()) + 1;
|
||||
switch (teamId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_playerInstance.setTeam(Team.NONE);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
_playerInstance.setTeam(Team.BLUE);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
_playerInstance.setTeam(Team.RED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerInstance.setTeam(Team.NONE);
|
||||
}
|
||||
|
||||
_playerInstance.setCurrentCp(_playerInstance.getMaxCp());
|
||||
_playerInstance.setCurrentHp(_playerInstance.getMaxHp());
|
||||
_playerInstance.setCurrentMp(_playerInstance.getMaxMp());
|
||||
|
||||
_playerInstance.broadcastStatusUpdate();
|
||||
_playerInstance.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
* 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.util.Calendar;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public class TvTManager
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(TvTManager.class.getName());
|
||||
|
||||
/**
|
||||
* Task for event cycles
|
||||
*/
|
||||
private TvTStartTask _task;
|
||||
|
||||
/**
|
||||
* New instance only by getInstance()
|
||||
*/
|
||||
protected TvTManager()
|
||||
{
|
||||
if (Config.TVT_EVENT_ENABLED)
|
||||
{
|
||||
TvTEvent.init();
|
||||
|
||||
scheduleEventStart();
|
||||
LOGGER.info("TvTEventEngine[TvTManager.TvTManager()]: Started.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info("TvTEventEngine[TvTManager.TvTManager()]: Engine is disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize new/Returns the one and only instance
|
||||
* @return TvTManager
|
||||
*/
|
||||
public static TvTManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts TvTStartTask
|
||||
*/
|
||||
public void scheduleEventStart()
|
||||
{
|
||||
try
|
||||
{
|
||||
final Calendar currentTime = Calendar.getInstance();
|
||||
Calendar nextStartTime = null;
|
||||
Calendar testStartTime = null;
|
||||
for (String timeOfDay : Config.TVT_EVENT_INTERVAL)
|
||||
{
|
||||
// Creating a Calendar object from the specified interval value
|
||||
testStartTime = Calendar.getInstance();
|
||||
testStartTime.setLenient(true);
|
||||
final 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;
|
||||
}
|
||||
}
|
||||
if (nextStartTime != null)
|
||||
{
|
||||
_task = new TvTStartTask(nextStartTime.getTimeInMillis());
|
||||
ThreadPool.execute(_task);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("TvTEventEngine[TvTManager.scheduleEventStart()]: Error figuring out a start time. Check TvTEventInterval in config file.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to start participation
|
||||
*/
|
||||
public void startReg()
|
||||
{
|
||||
if (!TvTEvent.startParticipation())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: Event was cancelled.");
|
||||
LOGGER.warning("TvTEventEngine[TvTManager.run()]: Error spawning event npc for participation.");
|
||||
scheduleEventStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: Registration opened for " + Config.TVT_EVENT_PARTICIPATION_TIME + " minute(s).");
|
||||
|
||||
// schedule registration end
|
||||
_task.setStartTime(Chronos.currentTimeMillis() + (60000 * Config.TVT_EVENT_PARTICIPATION_TIME));
|
||||
ThreadPool.execute(_task);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to start the fight
|
||||
*/
|
||||
public void startEvent()
|
||||
{
|
||||
if (!TvTEvent.startFight())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: Event cancelled due to lack of Participation.");
|
||||
LOGGER.info("TvTEventEngine[TvTManager.run()]: Lack of registration, abort event.");
|
||||
scheduleEventStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: Teleporting participants to an arena in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
|
||||
_task.setStartTime(Chronos.currentTimeMillis() + (60000 * Config.TVT_EVENT_RUNNING_TIME));
|
||||
ThreadPool.execute(_task);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to end the event and reward
|
||||
*/
|
||||
public void endEvent()
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(TvTEvent.calculateRewards());
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: Teleporting back to the registration npc in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
|
||||
TvTEvent.stopFight();
|
||||
|
||||
scheduleEventStart();
|
||||
}
|
||||
|
||||
public void skipDelay()
|
||||
{
|
||||
if (_task.nextRun.cancel(false))
|
||||
{
|
||||
_task.setStartTime(Chronos.currentTimeMillis());
|
||||
ThreadPool.execute(_task);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for TvT cycles
|
||||
*/
|
||||
class TvTStartTask implements Runnable
|
||||
{
|
||||
private long _startTime;
|
||||
public ScheduledFuture<?> nextRun;
|
||||
|
||||
public TvTStartTask(long startTime)
|
||||
{
|
||||
_startTime = startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime)
|
||||
{
|
||||
_startTime = startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final int delay = (int) Math.round((_startTime - Chronos.currentTimeMillis()) / 1000.0);
|
||||
if (delay > 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
// start
|
||||
else if (TvTEvent.isInactive())
|
||||
{
|
||||
startReg();
|
||||
}
|
||||
else if (TvTEvent.isParticipating())
|
||||
{
|
||||
startEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
endEvent();
|
||||
}
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
nextRun = ThreadPool.schedule(this, nextMsg * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private void announce(long time)
|
||||
{
|
||||
if ((time >= 3600) && ((time % 3600) == 0))
|
||||
{
|
||||
if (TvTEvent.isParticipating())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: " + (time / 60 / 60) + " hour(s) until registration is closed!");
|
||||
}
|
||||
else if (TvTEvent.isStarted())
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + (time / 60 / 60) + " hour(s) until event is finished!");
|
||||
}
|
||||
}
|
||||
else if (time >= 60)
|
||||
{
|
||||
if (TvTEvent.isParticipating())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: " + (time / 60) + " minute(s) until registration is closed!");
|
||||
}
|
||||
else if (TvTEvent.isStarted())
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + (time / 60) + " minute(s) until the event is finished!");
|
||||
}
|
||||
}
|
||||
else if (TvTEvent.isParticipating())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: " + time + " second(s) until registration is closed!");
|
||||
}
|
||||
else if (TvTEvent.isStarted())
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + time + " second(s) until the event is finished!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final TvTManager INSTANCE = new TvTManager();
|
||||
}
|
||||
}
|
||||
@@ -258,11 +258,6 @@ public class Attackable extends Npc
|
||||
}
|
||||
}
|
||||
|
||||
if (isEventMob())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Add damage and hate to the attacker AggroInfo of the Attackable _aggroList
|
||||
if (attacker != null)
|
||||
{
|
||||
|
||||
@@ -4788,7 +4788,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
{
|
||||
// If the attacker/target is dead or use fake death, notify the AI with EVT_CANCEL
|
||||
// and send a Server->Client packet ActionFailed (if attacker is a PlayerInstance)
|
||||
if ((target == null) || isAlikeDead() || (isNpc() && ((Npc) this).isEventMob()))
|
||||
if ((target == null) || isAlikeDead())
|
||||
{
|
||||
getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
|
||||
return;
|
||||
@@ -6526,7 +6526,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* Dummy method overriden in {@link PlayerInstance}
|
||||
* @return {@code true} if player is on event, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isOnEvent()
|
||||
public boolean isOnCustomEvent()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,6 @@ public class Npc extends Creature
|
||||
private int _castleIndex = -2;
|
||||
/** The fortress index in the array of Fort this NpcInstance belongs to */
|
||||
private int _fortIndex = -2;
|
||||
private boolean _eventMob = false;
|
||||
private boolean _isInTown = false;
|
||||
/** True if this Npc is autoattackable **/
|
||||
private boolean _isAutoAttackable = false;
|
||||
@@ -410,16 +409,6 @@ public class Npc extends Creature
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isEventMob()
|
||||
{
|
||||
return _eventMob;
|
||||
}
|
||||
|
||||
public void setEventMob(boolean value)
|
||||
{
|
||||
_eventMob = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoAttackable(Creature attacker)
|
||||
{
|
||||
|
||||
@@ -1181,4 +1181,10 @@ public abstract class Summon extends Playable
|
||||
}
|
||||
return formId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnCustomEvent()
|
||||
{
|
||||
return (_owner != null) && _owner.isOnCustomEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.instancemanager.DuelManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEventTeam;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
@@ -287,14 +285,13 @@ public class CubicInstance implements IIdentifiable
|
||||
{
|
||||
return;
|
||||
}
|
||||
// TvT event targeting
|
||||
if (TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(_owner.getObjectId()))
|
||||
// Custom event targeting
|
||||
if (_owner.isOnCustomEvent())
|
||||
{
|
||||
final TvTEventTeam enemyTeam = TvTEvent.getParticipantEnemyTeam(_owner.getObjectId());
|
||||
if (ownerTarget.getActingPlayer() != null)
|
||||
{
|
||||
final PlayerInstance target = ownerTarget.getActingPlayer();
|
||||
if (enemyTeam.containsPlayer(target.getObjectId()) && !(target.isDead()))
|
||||
if ((_owner.getTeam() != target.getTeam()) && !(target.isDead()))
|
||||
{
|
||||
_target = (Creature) ownerTarget;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class MonsterInstance extends Attackable
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.isAutoAttackable(attacker) && !isEventMob();
|
||||
return super.isAutoAttackable(attacker);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ public class MonsterInstance extends Attackable
|
||||
@Override
|
||||
public boolean isAggressive()
|
||||
{
|
||||
return getTemplate().isAggressive() && !isEventMob() && !isAffected(EffectFlag.PASSIVE);
|
||||
return getTemplate().isAggressive() && !isAffected(EffectFlag.PASSIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,8 +117,6 @@ import org.l2jmobius.gameserver.instancemanager.RecipeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.AccessLevel;
|
||||
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
@@ -200,7 +198,6 @@ import org.l2jmobius.gameserver.model.fishing.Fishing;
|
||||
import org.l2jmobius.gameserver.model.holders.AdditionalSkillHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.MovieHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.PlayerEventHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||
@@ -719,7 +716,8 @@ public class PlayerInstance extends Playable
|
||||
public ReentrantLock soulShotLock = new ReentrantLock();
|
||||
|
||||
/** Event parameters */
|
||||
private PlayerEventHolder eventStatus = null;
|
||||
private boolean _isRegisteredOnCustomEvent = false;
|
||||
private boolean _isOnCustomEvent = false;
|
||||
|
||||
private byte _handysBlockCheckerEventArena = -1;
|
||||
|
||||
@@ -2954,11 +2952,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void standUp()
|
||||
{
|
||||
if (GameEvent.isParticipant(this) && eventStatus.isSitForced())
|
||||
{
|
||||
sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
|
||||
}
|
||||
else if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
|
||||
if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
|
||||
{
|
||||
if (getEffectList().isAffected(EffectFlag.RELAXING))
|
||||
{
|
||||
@@ -5151,11 +5145,6 @@ public class PlayerInstance extends Playable
|
||||
if (pk != null)
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerPvPKill(pk, this), this);
|
||||
TvTEvent.onKill(killer, this);
|
||||
if (GameEvent.isParticipant(pk))
|
||||
{
|
||||
pk.getEventStatus().getKills().add(this);
|
||||
}
|
||||
|
||||
// pvp/pk item rewards
|
||||
if (!(Config.DISABLE_REWARDS_IN_INSTANCES && (getInstanceId() != 0)) && //
|
||||
@@ -5329,7 +5318,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
private void onDieDropItem(Creature killer)
|
||||
{
|
||||
if (GameEvent.isParticipant(this) || (killer == null))
|
||||
if (isOnCustomEvent() || (killer == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -5697,7 +5686,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
// Calculate the Experience loss
|
||||
long lostExp = 0;
|
||||
if (!GameEvent.isParticipant(this))
|
||||
if (!isOnCustomEvent())
|
||||
{
|
||||
if (lvl < ExperienceData.getInstance().getMaxLevel())
|
||||
{
|
||||
@@ -8348,14 +8337,9 @@ public class PlayerInstance extends Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlockedFromExit())
|
||||
if (isRegisteredOnCustomEvent())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GameEvent.isParticipant(this))
|
||||
{
|
||||
sendMessage("A superior power doesn't allow you to leave the event.");
|
||||
sendMessage("A superior power doesn't allow you to leave.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8435,8 +8419,8 @@ public class PlayerInstance extends Playable
|
||||
return _inOlympiadMode && _olympiadStart && (((PlayerInstance) attacker).getOlympiadGameId() == getOlympiadGameId());
|
||||
}
|
||||
|
||||
// Check if the attacker is in TvT and TvT is started
|
||||
if (isOnEvent())
|
||||
// Check if the attacker is in an event
|
||||
if (isOnCustomEvent())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -10867,8 +10851,6 @@ public class PlayerInstance extends Playable
|
||||
_summon.updateAndBroadcastStatus(0);
|
||||
}
|
||||
|
||||
TvTEvent.onTeleported(this);
|
||||
|
||||
// show movie if available
|
||||
if (_movieHolder != null)
|
||||
{
|
||||
@@ -11511,16 +11493,6 @@ public class PlayerInstance extends Playable
|
||||
LOGGER.log(Level.SEVERE, "deleteMe()", e);
|
||||
}
|
||||
|
||||
// TvT Event removal
|
||||
try
|
||||
{
|
||||
TvTEvent.onLogout(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "deleteMe()", e);
|
||||
}
|
||||
|
||||
// Update database with items in its inventory and remove them from the world
|
||||
try
|
||||
{
|
||||
@@ -11591,12 +11563,6 @@ public class PlayerInstance extends Playable
|
||||
player.removeSnooped(this);
|
||||
}
|
||||
|
||||
// we store all data from players who are disconnected while in an event in order to restore it in the next login
|
||||
if (GameEvent.isParticipant(this))
|
||||
{
|
||||
GameEvent.savePlayerEventStatus(this);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
notifyFriends();
|
||||
@@ -12398,7 +12364,7 @@ public class PlayerInstance extends Playable
|
||||
return;
|
||||
}
|
||||
|
||||
if (isResurrectSpecialAffected() || isLucky() || isBlockedFromDeathPenalty() || isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.SIEGE) || canOverrideCond(PlayerCondOverride.DEATH_PENALTY))
|
||||
if (isResurrectSpecialAffected() || isLucky() || isOnCustomEvent() || isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.SIEGE) || canOverrideCond(PlayerCondOverride.DEATH_PENALTY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -13948,21 +13914,6 @@ public class PlayerInstance extends Playable
|
||||
return _contactList;
|
||||
}
|
||||
|
||||
public void setEventStatus()
|
||||
{
|
||||
eventStatus = new PlayerEventHolder(this);
|
||||
}
|
||||
|
||||
public void setEventStatus(PlayerEventHolder pes)
|
||||
{
|
||||
eventStatus = pes;
|
||||
}
|
||||
|
||||
public PlayerEventHolder getEventStatus()
|
||||
{
|
||||
return eventStatus;
|
||||
}
|
||||
|
||||
public long getNotMoveUntil()
|
||||
{
|
||||
return _notMoveUntil;
|
||||
@@ -14040,13 +13991,6 @@ public class PlayerInstance extends Playable
|
||||
@Override
|
||||
public boolean canRevive()
|
||||
{
|
||||
for (IEventListener listener : _eventListeners)
|
||||
{
|
||||
if (listener.isOnEvent() && !listener.canRevive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return _canRevive;
|
||||
}
|
||||
|
||||
@@ -14060,44 +14004,25 @@ public class PlayerInstance extends Playable
|
||||
_canRevive = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if player is on event, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isRegisteredOnCustomEvent()
|
||||
{
|
||||
return _isRegisteredOnCustomEvent || _isOnCustomEvent;
|
||||
}
|
||||
|
||||
public void setRegisteredOnCustomEvent(boolean value)
|
||||
{
|
||||
_isRegisteredOnCustomEvent = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnEvent()
|
||||
public boolean isOnCustomEvent()
|
||||
{
|
||||
for (IEventListener listener : _eventListeners)
|
||||
{
|
||||
if (listener.isOnEvent())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.isOnEvent();
|
||||
return _isOnCustomEvent;
|
||||
}
|
||||
|
||||
public boolean isBlockedFromExit()
|
||||
public void setOnCustomEvent(boolean value)
|
||||
{
|
||||
for (IEventListener listener : _eventListeners)
|
||||
{
|
||||
if (listener.isOnEvent() && listener.isBlockingExit())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBlockedFromDeathPenalty()
|
||||
{
|
||||
for (IEventListener listener : _eventListeners)
|
||||
{
|
||||
if (listener.isOnEvent() && listener.isBlockingDeathPenalty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
_isOnCustomEvent = value;
|
||||
}
|
||||
|
||||
public void setOriginalCpHpMp(double cp, double hp, double mp)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
@@ -55,7 +54,7 @@ public class ConditionPlayerCallPc extends Condition
|
||||
{
|
||||
canCallPlayer = false;
|
||||
}
|
||||
else if (!TvTEvent.onEscapeUse(player.getObjectId()))
|
||||
else if (player.isOnCustomEvent())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
|
||||
canCallPlayer = false;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -46,7 +45,7 @@ public class ConditionPlayerCanEscape extends Condition
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
else if (!TvTEvent.onEscapeUse(player.getObjectId()))
|
||||
else if (player.isOnCustomEvent())
|
||||
{
|
||||
canTeleport = false;
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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.model.conditions;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerTvTEvent.
|
||||
*/
|
||||
public class ConditionPlayerTvTEvent extends Condition
|
||||
{
|
||||
private final boolean _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player tv t event.
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerTvTEvent(boolean value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, Item item)
|
||||
{
|
||||
final PlayerInstance player = effector.getActingPlayer();
|
||||
return (player == null) || !TvTEvent.isStarted() ? !_value : TvTEvent.isPlayerParticipant(player.getObjectId()) == _value;
|
||||
}
|
||||
}
|
||||
@@ -90,10 +90,6 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.inventory.OnPl
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.inventory.OnPlayerItemPickup;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.inventory.OnPlayerItemTransfer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.trap.OnTrapAction;
|
||||
import org.l2jmobius.gameserver.model.events.impl.events.OnTvTEventFinish;
|
||||
import org.l2jmobius.gameserver.model.events.impl.events.OnTvTEventKill;
|
||||
import org.l2jmobius.gameserver.model.events.impl.events.OnTvTEventRegistrationStart;
|
||||
import org.l2jmobius.gameserver.model.events.impl.events.OnTvTEventStart;
|
||||
import org.l2jmobius.gameserver.model.events.impl.item.OnItemBypassEvent;
|
||||
import org.l2jmobius.gameserver.model.events.impl.item.OnItemCreate;
|
||||
import org.l2jmobius.gameserver.model.events.impl.item.OnItemTalk;
|
||||
@@ -219,13 +215,7 @@ public enum EventType
|
||||
ON_PLAYER_TRANSFORM(OnPlayerTransform.class, void.class),
|
||||
|
||||
// Trap events
|
||||
ON_TRAP_ACTION(OnTrapAction.class, void.class),
|
||||
|
||||
// TvT events.
|
||||
ON_TVT_EVENT_FINISH(OnTvTEventFinish.class, void.class),
|
||||
ON_TVT_EVENT_KILL(OnTvTEventKill.class, void.class),
|
||||
ON_TVT_EVENT_REGISTRATION_START(OnTvTEventRegistrationStart.class, void.class),
|
||||
ON_TVT_EVENT_START(OnTvTEventStart.class, void.class);
|
||||
ON_TRAP_ACTION(OnTrapAction.class, void.class);
|
||||
|
||||
private final Class<? extends IBaseEvent> _eventClass;
|
||||
private final Class<?>[] _returnClass;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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.model.events.impl.events;
|
||||
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnTvTEventFinish implements IBaseEvent
|
||||
{
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_TVT_EVENT_FINISH;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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.model.events.impl.events;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEventTeam;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnTvTEventKill implements IBaseEvent
|
||||
{
|
||||
private final PlayerInstance _killer;
|
||||
private final PlayerInstance _victim;
|
||||
private final TvTEventTeam _killerTeam;
|
||||
|
||||
public OnTvTEventKill(PlayerInstance killer, PlayerInstance victim, TvTEventTeam killerTeam)
|
||||
{
|
||||
_killer = killer;
|
||||
_victim = victim;
|
||||
_killerTeam = killerTeam;
|
||||
}
|
||||
|
||||
public PlayerInstance getKiller()
|
||||
{
|
||||
return _killer;
|
||||
}
|
||||
|
||||
public PlayerInstance getVictim()
|
||||
{
|
||||
return _victim;
|
||||
}
|
||||
|
||||
public TvTEventTeam getKillerTeam()
|
||||
{
|
||||
return _killerTeam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_TVT_EVENT_KILL;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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.model.events.impl.events;
|
||||
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnTvTEventRegistrationStart implements IBaseEvent
|
||||
{
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_TVT_EVENT_REGISTRATION_START;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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.model.events.impl.events;
|
||||
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnTvTEventStart implements IBaseEvent
|
||||
{
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_TVT_EVENT_START;
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* 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.model.holders;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
* Player event holder, meant for restoring player after event has finished.<br>
|
||||
* Allows you to restore following information about player:
|
||||
* <ul>
|
||||
* <li>Name</li>
|
||||
* <li>Title</li>
|
||||
* <li>Clan</li>
|
||||
* <li>Location</li>
|
||||
* <li>PvP Kills</li>
|
||||
* <li>PK Kills</li>
|
||||
* <li>Karma</li>
|
||||
* </ul>
|
||||
* @author Nik, xban1x
|
||||
*/
|
||||
public class PlayerEventHolder
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private final String _name;
|
||||
private final String _title;
|
||||
private final int _clanId;
|
||||
private final Location _loc;
|
||||
private final int _pvpKills;
|
||||
private final int _pkKills;
|
||||
private final int _karma;
|
||||
|
||||
private final Collection<PlayerInstance> _kills = ConcurrentHashMap.newKeySet();
|
||||
private boolean _sitForced;
|
||||
|
||||
public PlayerEventHolder(PlayerInstance player)
|
||||
{
|
||||
this(player, false);
|
||||
}
|
||||
|
||||
public PlayerEventHolder(PlayerInstance player, boolean sitForced)
|
||||
{
|
||||
_player = player;
|
||||
_name = player.getName();
|
||||
_title = player.getTitle();
|
||||
_clanId = player.getClanId();
|
||||
_loc = new Location(player);
|
||||
_pvpKills = player.getPvpKills();
|
||||
_pkKills = player.getPkKills();
|
||||
_karma = player.getKarma();
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public void restorePlayerStats()
|
||||
{
|
||||
_player.setName(_name);
|
||||
_player.setTitle(_title);
|
||||
_player.setClan(ClanTable.getInstance().getClan(_clanId));
|
||||
_player.teleToLocation(_loc, true);
|
||||
_player.setPvpKills(_pvpKills);
|
||||
_player.setPkKills(_pkKills);
|
||||
_player.setKarma(_karma);
|
||||
}
|
||||
|
||||
public void setSitForced(boolean sitForced)
|
||||
{
|
||||
_sitForced = sitForced;
|
||||
}
|
||||
|
||||
public boolean isSitForced()
|
||||
{
|
||||
return _sitForced;
|
||||
}
|
||||
|
||||
public Collection<PlayerInstance> getKills()
|
||||
{
|
||||
return _kills;
|
||||
}
|
||||
}
|
||||
@@ -878,7 +878,7 @@ public class Instance
|
||||
*/
|
||||
public void notifyDeath(PlayerInstance player)
|
||||
{
|
||||
if (!player.isOnEvent() && (_ejectTime > 0))
|
||||
if (!player.isOnCustomEvent() && (_ejectTime > 0))
|
||||
{
|
||||
// Proper system message doesn't exist in epilogue client.
|
||||
player.sendMessage("If you are not resurrected within " + (_ejectTime / 1000 / 60) + " minutes, you will be expelled from the instance zone.");
|
||||
|
||||
@@ -23,11 +23,6 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
*/
|
||||
public interface IEventListener
|
||||
{
|
||||
/**
|
||||
* @return {@code true} if player is on event, {@code false} otherwise.
|
||||
*/
|
||||
boolean isOnEvent();
|
||||
|
||||
/**
|
||||
* @return {@code true} if player is blocked from leaving the game, {@code false} otherwise.
|
||||
*/
|
||||
|
||||
@@ -581,9 +581,9 @@ public class Olympiad extends ListenersContainer
|
||||
noble.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
if (noble.isOnEvent())
|
||||
if (noble.isRegisteredOnCustomEvent())
|
||||
{
|
||||
noble.sendMessage("You can't join olympiad while participating on Events.");
|
||||
noble.sendMessage("You can't join olympiad while participating on events.");
|
||||
return false;
|
||||
}
|
||||
/** End Olympiad Restrictions */
|
||||
@@ -1171,9 +1171,9 @@ public class Olympiad extends ListenersContainer
|
||||
spectator.sendPacket(new SystemMessage(SystemMessageId.YOU_MAY_NOT_OBSERVE_A_GRAND_OLYMPIAD_GAMES_MATCH_WHILE_YOU_ARE_ON_THE_WAITING_LIST));
|
||||
return;
|
||||
}
|
||||
if (spectator.isOnEvent())
|
||||
if (spectator.isRegisteredOnCustomEvent())
|
||||
{
|
||||
spectator.sendMessage("You can not observe games while registered for Events");
|
||||
spectator.sendMessage("You can not observe games while registered on events.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
|
||||
import org.l2jmobius.gameserver.handler.TargetHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
|
||||
import org.l2jmobius.gameserver.model.ExtractableProductItem;
|
||||
import org.l2jmobius.gameserver.model.ExtractableSkill;
|
||||
@@ -1123,7 +1122,7 @@ public class Skill implements IIdentifiable
|
||||
}
|
||||
}
|
||||
|
||||
if (!TvTEvent.checkForTvTSkill(player, targetPlayer, skill))
|
||||
if (player.isOnCustomEvent() && targetPlayer.isOnCustomEvent() && (player.getTeam() == target.getTeam()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.TvTEvent;
|
||||
import org.l2jmobius.gameserver.model.Couple;
|
||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -429,11 +427,6 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
// player.sendPacket(new ExRotation(player.getObjectId(), player.getHeading()));
|
||||
player.getInventory().applyItemSkills();
|
||||
|
||||
if (GameEvent.isParticipant(player))
|
||||
{
|
||||
GameEvent.restorePlayerEventStatus(player);
|
||||
}
|
||||
|
||||
// Wedding Checks
|
||||
if (Config.ALLOW_WEDDING)
|
||||
{
|
||||
@@ -574,8 +567,6 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
client.sendPacket(ExNoticePostArrived.valueOf(false));
|
||||
}
|
||||
|
||||
TvTEvent.onLogin(player);
|
||||
|
||||
if (Config.WELCOME_MESSAGE_ENABLED)
|
||||
{
|
||||
player.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));
|
||||
|
||||
@@ -110,13 +110,6 @@ public class RequestRestart implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
if (player.isBlockedFromExit())
|
||||
{
|
||||
client.sendPacket(RestartResponse.valueOf(false));
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.canLogout())
|
||||
{
|
||||
client.sendPacket(RestartResponse.valueOf(false));
|
||||
|
||||
@@ -24,11 +24,13 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.SiegeClan;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.SiegeFlagInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.residences.ClanHall;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
@@ -90,6 +92,19 @@ public class RequestRestartPoint implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
// Custom event resurrection management.
|
||||
if (player.isOnCustomEvent())
|
||||
{
|
||||
// This is an example, replace EventScriptName with proper event script name.
|
||||
final Quest eventScript = QuestManager.getInstance().getQuest("EventScriptName");
|
||||
if (eventScript != null)
|
||||
{
|
||||
// Notify onAdvEvent ResurrectPlayer event.
|
||||
eventScript.notifyEvent("ResurrectPlayer", null, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastle(player.getX(), player.getY(), player.getZ());
|
||||
if ((castle != null) && castle.getSiege().isInProgress() && (player.getClan() != null) && castle.getSiege().checkIsAttacker(player.getClan()))
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Die implements IClientOutgoingPacket
|
||||
|
||||
if (_creature.isPlayer())
|
||||
{
|
||||
if (!Olympiad.getInstance().isRegistered(_creature.getActingPlayer()) && !_creature.isOnEvent())
|
||||
if (!Olympiad.getInstance().isRegistered(_creature.getActingPlayer()) && !_creature.getActingPlayer().isOnCustomEvent())
|
||||
{
|
||||
_staticRes = _creature.getInventory().haveItemForSelfResurrection();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,6 @@ import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSouls;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerState;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerSubclass;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerTransformationId;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerTvTEvent;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerVehicleMounted;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerWeight;
|
||||
import org.l2jmobius.gameserver.model.conditions.ConditionSiegeZone;
|
||||
@@ -651,12 +650,6 @@ public abstract class DocumentBase
|
||||
cond = joinAnd(cond, new ConditionPlayerIsClanLeader(val));
|
||||
break;
|
||||
}
|
||||
case "ontvtevent":
|
||||
{
|
||||
final boolean val = Boolean.parseBoolean(a.getNodeValue());
|
||||
cond = joinAnd(cond, new ConditionPlayerTvTEvent(val));
|
||||
break;
|
||||
}
|
||||
case "pledgeclass":
|
||||
{
|
||||
final int pledgeClass = Integer.decode(getValue(a.getNodeValue(), null));
|
||||
|
||||
@@ -48,7 +48,7 @@ public class OfflineTradeUtil
|
||||
*/
|
||||
private static boolean offlineMode(PlayerInstance player)
|
||||
{
|
||||
if ((player == null) || player.isInOlympiadMode() || player.isBlockedFromExit() || player.isJailed() || (player.getVehicle() != null))
|
||||
if ((player == null) || player.isInOlympiadMode() || player.isRegisteredOnCustomEvent() || player.isJailed() || (player.getVehicle() != null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user