· 6 years ago · Aug 20, 2019, 01:18 AM
1============================================================================================
2fos_engine.properties
3============================================================================================
4#====================================#
5# Team vs Team #
6#====================================#
7# FortressSiege(Team vs Team) Event: Blue vs Red.
8
9# Setting for Team vs. Team pvp
10# TvTEvenTeams=NO|BALANCE|SHUFFLE
11# NO means: not even teams.
12# BALANCE means: Players can only join team with lowest player count.
13# SHUFFLE means: Players can only participate to tzhe event and not direct to a team. Teams will be schuffeled in teleporting teams.
14FortressSiegeEvenTeams = SHUFFLE
15# players there not participated in FortressSiege can target FortressSiege participants?
16FortressSiegeAllowInterference = False
17# FortressSiege participants can use potions?
18FortressSiegeAllowPotions = True
19# FortressSiege participants can summon by item?
20FortressSiegeAllowSummon = True
21# remove all effects of FortressSiege participants on event start?
22FortressSiegeOnStartRemoveAllEffects = True
23# unsummon pet of FortressSiege participants on event start?
24FortressSiegeOnStartUnsummonPet = True
25# on revive participants regain full hp/mp/cp ?
26FortressSiegeReviveRecovery = True
27# announce all team statistics
28FortressSiegeAnnounceTeamStats = True
29# announce reward
30FortressSiegeAnnounceReward = True
31# give price with 0 kills
32FortressSiegePriceNoKills = True
33# players with cursed weapon are allowed to join ?
34FortressSiegeJoinWithCursedWeapon = False
35# Enable voice command to register on FortressSiege event
36FortressSiegeCommand = True
37# Delay on revive when dead, NOTE: 20000 equals to 20 seconds, minimum 1000 (1 second)
38FortressSiegeReviveDelay = 10000
39
40# FortressSiege Top Killer reward id
41FortressSiegeTopKillerRewardId = 5575
42# FortressSiege Top Killer reward quantity
43FortressSiegeTopKillerRewardQty = 5000000
44# Place an aura on participants team ?
45FortressSiegeAura = True
46# Enable event stats logger
47FortressSiegeStatsLogger = True
48# Remove Buffs on player die
49FortressSiegeRemoveBuffsOnPlayerDie = False
50
51============================================================================================
52 +++head-src\com\l2jfrozen\FService.java
53============================================================================================
54 public static final String IRC_FILE = "./config/frozen/irc.properties";
55+ public static final String FOS_ENGINE_FILE = "./config/frozen/fos_engine.properties";
56
57==============================================================================================
58 +++ head-src/com/l2jfrozen/Config.java
59==============================================================================================
60 // *******************************************************************************************
61 public static final String FOS_ENGINE_FILE = "./config/frozen/fos_engine.properties";
62 // *******************************************************************************************
63+ public static String FortressSiege_EVEN_TEAMS;
64+ public static boolean FortressSiege_SAME_IP_PLAYERS_ALLOWED;
65+ public static boolean FortressSiege_ALLOW_INTERFERENCE;
66+ public static boolean FortressSiege_ALLOW_POTIONS;
67+ public static boolean FortressSiege_ALLOW_SUMMON;
68+ public static boolean FortressSiege_ON_START_REMOVE_ALL_EFFECTS;
69+ public static boolean FortressSiege_ON_START_UNSUMMON_PET;
70+ public static boolean FortressSiege_REVIVE_RECOVERY;
71+ public static boolean FortressSiege_ANNOUNCE_TEAM_STATS;
72+ public static boolean FortressSiege_ANNOUNCE_REWARD;
73+ public static boolean FortressSiege_PRICE_NO_KILLS;
74+ public static boolean FortressSiege_JOIN_CURSED;
75+ public static boolean FortressSiege_COMMAND;
76+ public static long FortressSiege_REVIVE_DELAY;
77+ public static int FortressSiege_TOP_KILLER_REWARD;
78+ public static int FortressSiege_TOP_KILLER_QTY;
79+ public static boolean FortressSiege_AURA;
80+ public static boolean FortressSiege_STATS_LOGGER;
81+ public static boolean FortressSiege_REMOVE_BUFFS_ON_DIE;
82
83+ // *******************************************************************************************
84+ // *******************************************************************************************
85+ public static void loadFosEngineConfig()
86+ {
87+ final String FOS_ENGINE_FILE = FService.FOS_ENGINE_FILE;
88+ try
89+ {
90+ final Properties fosEngineSettings = new Properties();
91+ final InputStream is = new FileInputStream(new File(FOS_ENGINE_FILE));
92+ fosEngineSettings.load(is);
93+ is.close();
94+
95+ FortressSiege_EVEN_TEAMS = fosEngineSettings.getProperty("FortressSiegeEvenTeams", "BALANCE");
96+ FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeSameIPPlayersAllowed", "false"));
97+ FortressSiege_ALLOW_INTERFERENCE = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowInterference", "False"));
98+ FortressSiege_ALLOW_POTIONS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowPotions", "False"));
99+ FortressSiege_ALLOW_SUMMON = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowSummon", "False"));
100+ FortressSiege_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeOnStartRemoveAllEffects", "True"));
101+ FortressSiege_ON_START_UNSUMMON_PET = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeOnStartUnsummonPet", "True"));
102+ FortressSiege_REVIVE_RECOVERY = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeReviveRecovery", "False"));
103+ FortressSiege_ANNOUNCE_TEAM_STATS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAnnounceTeamStats", "False"));
104+ FortressSiege_ANNOUNCE_REWARD = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAnnounceReward", "False"));
105+ FortressSiege_PRICE_NO_KILLS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegePriceNoKills", "False"));
106+ FortressSiege_JOIN_CURSED = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeJoinWithCursedWeapon", "True"));
107+ FortressSiege_COMMAND = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeCommand", "True"));
108+ FortressSiege_REVIVE_DELAY = Long.parseLong(fosEngineSettings.getProperty("FortressSiegeReviveDelay", "20000"));
109+ if (FortressSiege_REVIVE_DELAY < 1000)
110+ FortressSiege_REVIVE_DELAY = 1000; // can't be set less then 1 second
111+
112+ FortressSiege_TOP_KILLER_REWARD = Integer.parseInt(fosEngineSettings.getProperty("FortressSiegeTopKillerRewardId", "5575"));
113+ FortressSiege_TOP_KILLER_QTY = Integer.parseInt(fosEngineSettings.getProperty("FortressSiegeTopKillerRewardQty", "2000000"));
114+ FortressSiege_AURA = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAura", "False"));
115+ FortressSiege_STATS_LOGGER = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeStatsLogger", "true"));
116+
117+ FortressSiege_REMOVE_BUFFS_ON_DIE = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeRemoveBuffsOnPlayerDie", "false"));
118+ }
119+ catch (final Exception e)
120+ {
121+ e.printStackTrace();
122+ throw new Error("Failed to Load " + FOS_ENGINE_FILE + " File.");
123+ }
124+ }
125
126
127// ============================================================
128 public static boolean REBIRTH_ENABLE;
129 public static String[] REBIRTH_ITEM_PRICE;
130
131
132 else if (pName.equalsIgnoreCase("WeddingDivorceCosts"))
133 {
134 L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(pValue);
135 }
136
137
138+ else if (pName.equalsIgnoreCase("FortressSiegeEvenTeams"))
139+ {
140+ FortressSiege_EVEN_TEAMS = pValue;
141+ }
142+ else if (pName.equalsIgnoreCase("FortressSiegeSameIPPlayersAllowed"))
143+ {
144+ FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(pValue);
145+ }
146+ else if (pName.equalsIgnoreCase("FortressSiegeAllowInterference"))
147+ {
148+ FortressSiege_ALLOW_INTERFERENCE = Boolean.parseBoolean(pValue);
149+ }
150+ else if (pName.equalsIgnoreCase("FortressSiegeAllowPotions"))
151+ {
152+ FortressSiege_ALLOW_POTIONS = Boolean.parseBoolean(pValue);
153+ }
154+ else if (pName.equalsIgnoreCase("FortressSiegeAllowSummon"))
155+ {
156+ FortressSiege_ALLOW_SUMMON = Boolean.parseBoolean(pValue);
157+ }
158+ else if (pName.equalsIgnoreCase("FortressSiegeOnStartRemoveAllEffects"))
159+ {
160+ FortressSiege_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(pValue);
161+ }
162+ else if (pName.equalsIgnoreCase("FortressSiegeOnStartUnsummonPet"))
163+ {
164+ FortressSiege_ON_START_UNSUMMON_PET = Boolean.parseBoolean(pValue);
165+ }
166+ else if (pName.equalsIgnoreCase("FortressSiegeReviveDelay"))
167+ {
168+ FortressSiege_REVIVE_DELAY = Long.parseLong(pValue);
169+ }
170
171
172 else if (pName.equalsIgnoreCase("TvTEvenTeams"))
173 {
174 TVT_EVEN_TEAMS = pValue;
175 }
176
177
178+++head-src\com\l2jfrozen\gameserver\model\entity\FortressSiege.java
179package com.l2jfrozen.gameserver.model.entity;
180
181+import java.sql.PreparedStatement;
182+import java.sql.ResultSet;
183+import java.util.List;
184+import java.util.StringTokenizer;
185+import java.util.Vector;
186
187+import javolution.text.TextBuilder;
188
189+import org.apache.log4j.Logger;
190
191+import com.l2jfrozen.Config;
192+import com.l2jfrozen.gameserver.ai.CtrlEvent;
193+import com.l2jfrozen.gameserver.datatables.SkillTable;
194+import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
195+import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
196+import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
197+import com.l2jfrozen.gameserver.datatables.sql.SpawnTable;
198+import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminFortressSiegeEngine;
199+import com.l2jfrozen.gameserver.model.L2Character;
200+import com.l2jfrozen.gameserver.model.L2Effect;
201+import com.l2jfrozen.gameserver.model.L2Party;
202+import com.l2jfrozen.gameserver.model.L2Skill;
203+import com.l2jfrozen.gameserver.model.L2Summon;
204+import com.l2jfrozen.gameserver.model.L2World;
205+import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
206+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
207+import com.l2jfrozen.gameserver.model.actor.instance.L2PetInstance;
208+import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
209+import com.l2jfrozen.gameserver.model.spawn.L2Spawn;
210+import com.l2jfrozen.gameserver.network.SystemMessageId;
211+import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
212+import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
213+import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;
214+import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
215+import com.l2jfrozen.gameserver.network.serverpackets.RelationChanged;
216+import com.l2jfrozen.gameserver.network.serverpackets.Ride;
217+import com.l2jfrozen.gameserver.network.serverpackets.SkillList;
218+import com.l2jfrozen.gameserver.network.serverpackets.SocialAction;
219+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
220+import com.l2jfrozen.gameserver.network.serverpackets.UserInfo;
221+import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
222+import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
223+import com.l2jfrozen.util.CloseUtil;
224+import com.l2jfrozen.util.database.DatabaseUtils;
225+import com.l2jfrozen.util.database.L2DatabaseFactory;
226+import com.l2jfrozen.util.random.Rnd;
227
228+public class FortressSiege
229+{
230+ /** The Constant LOGGER. */
231+ protected static final Logger LOGGER = Logger.getLogger(FortressSiege.class.getName());
232+
233+ /** The _in progress. */
234+ protected static boolean _joining = false, _teleport = false, _started = false, _aborted = false;
235+ // public static boolean _joining = false, _teleport = false, _started = false, _sitForced = false;
236+
237+ public static boolean _sitForced = false;
238+
239+ protected static boolean _inProgress = false;
240+
241+ /** The _max players. */
242+ public static int _FlagNPC = 35062, _npcId = 0, _npcX = 0, _npcY = 0, _npcZ = 0, _npcHeading = 0, _rewardId = 0, _rewardAmount = 0, _minlvl = 0, _maxlvl = 0, _joinTime = 0, _eventTime = 0, _minPlayers = 0, _maxPlayers = 0, _flagX = 0, _flagY = 0, _flagZ = 0, _topScore = 0, eventCenterX = 0,
243+ eventCenterY = 0, eventCenterZ = 0, _door[] = new int[6];
244+
245+ /** The _joining location name. */
246+ public static String _eventName = new String(), _eventDesc = new String(), _joiningLocationName = new String();
247+
248+ /** The _top team. */
249+ private static String _topTeam = new String();
250+
251+ /** The _team event. */
252+ private static boolean _teamEvent = true;
253+
254+ /** The _teams z. */
255+ public static Vector<Integer> _teamPlayersCount = new Vector<>(), _teamColors = new Vector<>(), _teamsX = new Vector<>(), _teamsY = new Vector<>(), _teamsZ = new Vector<>();
256+
257+ /** The _team points count. */
258+ public static Vector<Integer> _teamPointsCount = new Vector<>();
259+
260+ /** The _top kills. */
261+ public static int _topKills = 0;
262+
263+ /** The _save player teams. */
264+ public static Vector<String> _teams = new Vector<>(), _savePlayers = new Vector<>(), _savePlayerTeams = new Vector<>();
265+
266+ /** The _players. */
267+ public static Vector<L2PcInstance> _players = new Vector<>();
268
269+ /** The _players shuffle. */
270+ public static Vector<L2PcInstance> _playersShuffle = new Vector<>();
271+
272+ /** The _npc spawn. */
273+ private static L2Spawn _npcSpawn, _flagSpawn;
274
275+ /** Constructor for FortressSiege Class. Calls an Immediate wipe of all Siege data. */
276+ /**
277+ * Instantiates a new FOS.
278+ */
279+ /** Constructor for FortressSiege Class. Calls an Immediate wipe of all Siege data. */
280+ FortressSiege()
281+ {
282+ resetData();
283+ }
284+
285+ /**
286+ * Resets ALL The Event Siege data.
287+ **/
288+ public static void resetData()
289+ {
290+
291+ healDoors();
292+ closeDoors();
293+ eventCenterX = 0;
294+ eventCenterY = 0;
295+ eventCenterZ = 0;
296+ _topTeam = new String();
297+ _door = new int[6];
298+ _eventName = new String();
299+ _eventDesc = new String();
300+ _joiningLocationName = new String();
301+ _teams = new Vector<>();
302+ _teams.add("");
303+ _teams.add("");
304+ _savePlayers = new Vector<>();
305+ _savePlayerTeams = new Vector<>();
306+
307+ if (_players != null && !_players.isEmpty())
308+ for (L2PcInstance player : _players)
309+ {
310+ if (player == null)
311+ continue;
312+ player._countFOSkills = 0;
313+ removeSealOfRuler(player);
314+ player._inEventFOS = false;
315+ if (player.getKarma() == player._originalKarmaFOS)
316+ player.setKarma(0);
317+ else
318+ player.setKarma(player._originalKarmaFOS);
319+ if (player.getAppearance().getNameColor() == player._originalNameColorFOS)
320+ player.getAppearance().setNameColor(0xFFFFFF);
321+ else
322+ cleanEventPlayer(player);
323+ player.getAppearance().setNameColor(player._originalNameColorFOS);
324+ player.setSiegeState((byte) 0);
325+ player.sendPacket(new UserInfo(player));
326+ for (L2PcInstance p : _players)
327+ p.sendPacket(new RelationChanged(player, player.getRelation(p), player.isAutoAttackable(p)));
328+ player.broadcastUserInfo();
329+ }
330+
331+ if (_playersShuffle != null && !_playersShuffle.isEmpty())
332+ for (L2PcInstance player : _playersShuffle)
333+ {
334+ if (player == null)
335+ continue;
336+ player._countFOSkills = 0;
337+ player._inEventFOS = false;
338+ }
339+
340+ _players = new Vector<>();
341+ _playersShuffle = new Vector<>();
342+ _teamPlayersCount = new Vector<>();
343+ _teamPlayersCount.add(0);
344+ _teamPlayersCount.add(0);
345+ _teamPointsCount = new Vector<>();
346+ _teamPointsCount.add(0);
347+ _teamPointsCount.add(0);
348+ _teamColors = new Vector<>();
349+ _teamColors.add(0xffffff);
350+ _teamColors.add(0xffffff);
351+ _teamsX = new Vector<>();
352+ _teamsX.add(0);
353+ _teamsX.add(0);
354+ _teamsY = new Vector<>();
355+ _teamsY.add(0);
356+ _teamsY.add(0);
357+ _teamsZ = new Vector<>();
358+ _teamsZ.add(0);
359+ _teamsZ.add(0);
360+ _flagSpawn = null;
361+ _flagX = 0;
362+ _flagY = 0;
363+ _flagZ = 0;
364+ _joining = false;
365+ _teleport = false;
366+ _started = false;
367+ _sitForced = false;
368+ _npcId = 0;
369+ _npcX = 0;
370+ _npcY = 0;
371+ _npcZ = 0;
372+ _npcHeading = 0;
373+ _rewardId = 0;
374+ _rewardAmount = 0;
375+ _topKills = 0;
376+ _topScore = 0;
377+ _minlvl = 0;
378+ _maxlvl = 0;
379+ _joinTime = 0;
380+ _eventTime = 0;
381+ _minPlayers = 0;
382+ _maxPlayers = 0;
383+ }
384+
385+ public static void autoLoadData()
386+ {
387+ AdminFortressSiegeEngine a = new AdminFortressSiegeEngine();
388+ a.showSiegeLoadPage(null, true);
389+ }
390+
391+ /**
392+ * Loads Fortress Siege data from MySql, depending on which siege we want
393+ * @param fortressSiege String containing the String siege name which will be loaded
394+ */
395+ @SuppressWarnings("null")
396+ public static void loadData(String fortressSiege)
397+ {
398+ resetData();
399+ java.sql.Connection con = null;
400+ try
401+ {
402+ PreparedStatement statement;
403+ ResultSet rs;
404+ con = L2DatabaseFactory.getInstance().getConnection();
405+ statement = con.prepareStatement("Select * from fortress_siege");
406+ rs = statement.executeQuery();
407+ while (rs.next())
408+ {
409+ _eventName = rs.getString("eventName");
410+ _eventDesc = rs.getString("eventDesc");
411+ _joiningLocationName = rs.getString("joiningLocation");
412+ _minlvl = rs.getInt("minlvl");
413+ _maxlvl = rs.getInt("maxlvl");
414+ _npcId = rs.getInt("npcId");
415+ _npcX = rs.getInt("npcX");
416+ _npcY = rs.getInt("npcY");
417+ _npcZ = rs.getInt("npcZ");
418+ _npcHeading = rs.getInt("npcHeading");
419+ _rewardId = rs.getInt("rewardId");
420+ _rewardAmount = rs.getInt("rewardAmount");
421+ _joinTime = rs.getInt("joinTime");
422+ _eventTime = rs.getInt("eventTime");
423+ _minPlayers = rs.getInt("minPlayers");
424+ _maxPlayers = rs.getInt("maxPlayers");
425+ eventCenterX = rs.getInt("centerX");
426+ eventCenterY = rs.getInt("centerY");
427+ eventCenterZ = rs.getInt("centerZ");
428+ _teams.set(0, rs.getString("team1Name"));
429+ _teamsX.set(0, rs.getInt("team1X"));
430+ _teamsY.set(0, rs.getInt("team1Y"));
431+ _teamsZ.set(0, rs.getInt("team1Z"));
432+ _teamColors.set(0, rs.getInt("team1Color"));
433+ _teams.set(1, rs.getString("team2Name"));
434+ _teamsX.set(1, rs.getInt("team2X"));
435+ _teamsY.set(1, rs.getInt("team2Y"));
436+ _teamsZ.set(1, rs.getInt("team2Z"));
437+ _teamColors.set(1, rs.getInt("team2Color"));
438+ _flagX = rs.getInt("flagX");
439+ _flagY = rs.getInt("flagY");
440+ _flagZ = rs.getInt("flagZ");
441+ _door[0] = rs.getInt("innerDoor1");
442+ _door[1] = rs.getInt("innerDoor2");
443+ _door[2] = rs.getInt("innerDoor3");
444+ _door[3] = rs.getInt("innerDoor4");
445+ _door[4] = rs.getInt("outerDoor1");
446+ _door[5] = rs.getInt("outerDoor2");
447+ if (_eventName.equalsIgnoreCase(fortressSiege))
448+ break;
449+ }
450+ statement.close();
451+ }
452+ catch (Exception e)
453+ {
454+ LOGGER.error("Exception: FortressSiege.loadData(): " + e.toString());
455+ }
456+ finally
457+ {
458+ try
459+ {
460+ con.close();
461+ }
462+ catch (Exception e)
463+ {
464+ }
465+ }
466+ }
467+
468+ /**
469+ * Checks if is _joining.
470+ * @return the _joining
471+ */
472+ public static boolean is_joining()
473+ {
474+ return _joining;
475+ }
476+
477+ /**
478+ * Checks if is _teleport.
479+ * @return the _teleport
480+ */
481+ public static boolean is_teleport()
482+ {
483+ return _teleport;
484+ }
485+
486+ /**
487+ * Checks if is _started.
488+ * @return the _started
489+ */
490+ public static boolean is_started()
491+ {
492+ return _started;
493+ }
494+
495+ /**
496+ * Checks if is _aborted.
497+ * @return the _aborted
498+ */
499+ public static boolean is_aborted()
500+ {
501+ return _aborted;
502+ }
503+
504+ /**
505+ * Checks if is _sit forced.
506+ * @return the _sitForced
507+ */
508+ public static boolean is_sitForced()
509+ {
510+ return _sitForced;
511+ }
512+
513+ /**
514+ * Checks if is _in progress.
515+ * @return the _inProgress
516+ */
517+ public static boolean is_inProgress()
518+ {
519+ return _inProgress;
520+ }
521+
522+ /**
523+ * Gets the _minlvl.
524+ * @return the _minlvl
525+ */
526+ public static int get_minlvl()
527+ {
528+ return _minlvl;
529+ }
530+
531+ /**
532+ * Gets the _maxlvl.
533+ * @return the _maxlvl
534+ */
535+ public static int get_maxlvl()
536+ {
537+ return _maxlvl;
538+ }
539+
540+ /**
541+ * Gets the _join time.
542+ * @return the _joinTime
543+ */
544+ public static int get_joinTime()
545+ {
546+ return _joinTime;
547+ }
548+
549+ /**
550+ * Gets the _event time.
551+ * @return the _eventTime
552+ */
553+ public static int get_eventTime()
554+ {
555+ return _eventTime;
556+ }
557+
558+ /**
559+ * Set_event time.
560+ * @param _eventTime the _eventTime to set
561+ * @return true, if successful
562+ */
563+ public static boolean set_eventTime(final int _eventTime)
564+ {
565+ if (!is_inProgress())
566+ {
567+ FortressSiege._eventTime = _eventTime;
568+ return true;
569+ }
570+ return false;
571+ }
572+
573+ /**
574+ * Gets the _reward amount.
575+ * @return the _rewardAmount
576+ */
577+ public static int get_rewardAmount()
578+ {
579+ return _rewardAmount;
580+ }
581+
582+ /**
583+ * Gets the _reward id.
584+ * @return the _rewardId
585+ */
586+ public static int get_rewardId()
587+ {
588+ return _rewardId;
589+ }
590+
591+ /** Saves Fortress Siege Data to MySQL */
592+
593+ public static void saveData()
594+ {
595+ java.sql.Connection con = null;
596+ try
597+ {
598+ con = L2DatabaseFactory.getInstance().getConnection();
599+ PreparedStatement statement;
600+ statement = con.prepareStatement("REPLACE INTO fortress_siege (eventName, eventDesc, joiningLocation, minlvl, maxlvl, npcId, npcX, npcY, npcZ, npcHeading, rewardId, rewardAmount, joinTime, eventTime, minPlayers, maxPlayers, centerX, centerY, centerZ, team1Name, team1X, team1Y, team1Z, team1Color, team2Name, team2X, team2Y, team2Z, team2Color, flagX, flagY, flagZ, innerDoor1, innerDoor2, innerDoor3, innerDoor4, outerDoor1, outerDoor2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
601+ statement.setString(1, _eventName);
602+ statement.setString(2, _eventDesc);
603+ statement.setString(3, _joiningLocationName);
604+ statement.setInt(4, _minlvl);
605+ statement.setInt(5, _maxlvl);
606+ statement.setInt(6, _npcId);
607+ statement.setInt(7, _npcX);
608+ statement.setInt(8, _npcY);
609+ statement.setInt(9, _npcZ);
610+ statement.setInt(10, _npcHeading);
611+ statement.setInt(11, _rewardId);
612+ statement.setInt(12, _rewardAmount);
613+ statement.setInt(13, _joinTime);
614+ statement.setInt(14, _eventTime);
615+ statement.setInt(15, _minPlayers);
616+ statement.setInt(16, _maxPlayers);
617+ statement.setInt(17, eventCenterX);
618+ statement.setInt(18, eventCenterY);
619+ statement.setInt(19, eventCenterZ);
620+ statement.setString(20, _teams.get(0));
621+ statement.setInt(21, _teamsX.get(0));
622+ statement.setInt(22, _teamsY.get(0));
623+ statement.setInt(23, _teamsZ.get(0));
624+ statement.setInt(24, _teamColors.get(0));
625+ statement.setString(25, _teams.get(1));
626+ statement.setInt(26, _teamsX.get(1));
627+ statement.setInt(27, _teamsY.get(1));
628+ statement.setInt(28, _teamsZ.get(1));
629+ statement.setInt(29, _teamColors.get(1));
630+ statement.setInt(30, _flagX);
631+ statement.setInt(31, _flagY);
632+ statement.setInt(32, _flagZ);
633+ statement.setInt(33, _door[0]);
634+ statement.setInt(34, _door[1]);
635+ statement.setInt(35, _door[2]);
636+ statement.setInt(36, _door[3]);
637+ statement.setInt(37, _door[4]);
638+ statement.setInt(38, _door[5]);
639+ statement.execute();
640+ statement.close();
641+ }
642+ catch (Exception e)
643+ {
644+ LOGGER.error("Exception: FortressSiege.saveData(): " + e.getMessage());
645+ }
646+ finally
647+ {
648+ try
649+ {
650+ con.close();
651+ }
652+ catch (Exception e)
653+ {
654+ }
655+ }
656+ }
657+
658+ /**
659+ * Checks if Minimum level does'nt exceed Maximum level, so Max lvl should be set first
660+ * @param minlvl
661+ * @return
662+ */
663+ public static boolean checkMinLevel(int minlvl)
664+ {
665+ return (_maxlvl >= minlvl);
666+ }
667+
668+ /**
669+ * Checks if Maximum Level is Greater than or Equal to Minimum Level
670+ * @param maxlvl
671+ * @return
672+ */
673+ public static boolean checkMaxLevel(int maxlvl)
674+ {
675+ return (_minlvl <= maxlvl);
676+ }
677+
678+ /**
679+ * Sets team position to the player position.
680+ * @param teamName - String name of the team who's positions are set.
681+ * @param activeChar - The L2PcInstance that sets the position.
682+ */
683+ public static void setTeamPos(String teamName, L2PcInstance activeChar)
684+ {
685+ int index = _teams.indexOf(teamName);
686+ if (index > -1)
687+ {
688+ _teamsX.set(index, activeChar.getX());
689+ _teamsY.set(index, activeChar.getY());
690+ _teamsZ.set(index, activeChar.getZ());
691+ }
692+ else
693+ activeChar.sendMessage("No such team name.");
694+ }
695+
696+ /**
697+ * Dump data.
698+ */
699+ public static void dumpData()
700+ {
701+ LOGGER.info("");
702+ LOGGER.info("");
703+
704+ if (!_joining && !_teleport && !_started)
705+ {
706+ LOGGER.info("<<---------------------------------->>");
707+ LOGGER.info(">> " + _eventName + " Engine infos dump (INACTIVE) <<");
708+ LOGGER.info("<<--^----^^-----^----^^------^^----->>");
709+ }
710+ else if (_joining && !_teleport && !_started)
711+ {
712+ LOGGER.info("<<--------------------------------->>");
713+ LOGGER.info(">> " + _eventName + " Engine infos dump (JOINING) <<");
714+ LOGGER.info("<<--^----^^-----^----^^------^----->>");
715+ }
716+ else if (!_joining && _teleport && !_started)
717+ {
718+ LOGGER.info("<<---------------------------------->>");
719+ LOGGER.info(">> " + _eventName + " Engine infos dump (TELEPORT) <<");
720+ LOGGER.info("<<--^----^^-----^----^^------^^----->>");
721+ }
722+ else if (!_joining && !_teleport && _started)
723+ {
724+ LOGGER.info("<<--------------------------------->>");
725+ LOGGER.info(">> " + _eventName + " Engine infos dump (STARTED) <<");
726+ LOGGER.info("<<--^----^^-----^----^^------^----->>");
727+ }
728+
729+ LOGGER.info("Name: " + _eventName);
730+ LOGGER.info("Desc: " + _eventDesc);
731+ LOGGER.info("Join location: " + _joiningLocationName);
732+ LOGGER.info("Min lvl: " + _minlvl);
733+ LOGGER.info("Max lvl: " + _maxlvl);
734+ LOGGER.info("");
735+ LOGGER.info("##########################");
736+ LOGGER.info("# _teams(Vector<String>) #");
737+ LOGGER.info("##########################");
738+
739+ for (final String team : _teams)
740+ LOGGER.info(team + " Kills Done :" + _teamPointsCount.get(_teams.indexOf(team)));
741+
742+ if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
743+ {
744+ LOGGER.info("");
745+ LOGGER.info("#########################################");
746+ LOGGER.info("# _playersShuffle(Vector<L2PcInstance>) #");
747+ LOGGER.info("#########################################");
748+
749+ for (final L2PcInstance player : _playersShuffle)
750+ {
751+ if (player != null)
752+ LOGGER.info("Name: " + player.getName());
753+ }
754+ }
755+
756+ LOGGER.info("");
757+ LOGGER.info("##################################");
758+ LOGGER.info("# _players(Vector<L2PcInstance>) #");
759+ LOGGER.info("##################################");
760+
761+ synchronized (_players)
762+ {
763+ for (final L2PcInstance player : _players)
764+ {
765+ if (player != null)
766+ LOGGER.info("Name: " + player.getName() + " Team: " + player._teamNameFOS + " Kills Done:" + player._countFOSkills);
767+ }
768+ }
769+
770+ LOGGER.info("");
771+ LOGGER.info("#####################################################################");
772+ LOGGER.info("# _savePlayers(Vector<String>) and _savePlayerTeams(Vector<String>) #");
773+ LOGGER.info("#####################################################################");
774+
775+ for (final String player : _savePlayers)
776+ LOGGER.info("Name: " + player + " Team: " + _savePlayerTeams.get(_savePlayers.indexOf(player)));
777+
778+ LOGGER.info("");
779+ LOGGER.info("");
780+
781+ dumpLocalEventInfo();
782+
783+ }
784+
785+ /**
786+ * Dump local event info.
787+ */
788+ private static void dumpLocalEventInfo()
789+ {
790+
791+ }
792+
793+ public static void startJoin(L2PcInstance activeChar)
794+ {
795+ if (!startJoinOk())
796+ {
797+ activeChar.sendMessage("Event not setted propertly.");
798+ if (LOGGER.isDebugEnabled())
799+ LOGGER.debug("Fortress Siege Engine[startJoin(" + activeChar.getName() + ")]: startJoinOk() = false");
800+ return;
801+ }
802+ _joining = true;
803+ spawnEventNpc();
804+ Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
805+ }
806+
807+ public static boolean startJoin()
808+ {
809+ if (!startJoinOk())
810+ {
811+ LOGGER.warn("Event not setted propertly.");
812+ if (LOGGER.isDebugEnabled())
813+ LOGGER.debug("Fortress Siege Engine[startJoin(startJoinOk() = false");
814+ return false;
815+ }
816+ _joining = true;
817+ spawnEventNpc();
818+ Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
819+
820+ if (Config.FortressSiege_COMMAND)
821+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Commands .fosjoin .fosleave .fosinfo");
822+
823+ return true;
824+ }
825+
826+ public static boolean startJoinOk()
827+ {
828+ if (_started || _teleport || _joining || _teams.size() > 2 || _teams.size() < 1 || _eventName.equals("") || _joiningLocationName.equals("") || _eventDesc.equals("") || _npcId == 0 || _flagX == 0 || _flagY == 0 || _flagZ == 0 || _npcX == 0 || _npcY == 0 || _npcZ == 0 || _rewardId == 0 || _rewardAmount == 0 || _door[0] == 0 || _door[1] == 0 || _door[2] == 0 || _door[3] == 0 || _door[4] == 0 || _door[5] == 0 || _teamsX.contains(0) || _teamsY.contains(0) || _teamsZ.contains(0))
829+ return false;
830+ return true;
831+ }
832+
833+ // New color Announcements 8D for FOS
834+ public static void Announcements(String announce)
835+ {
836+ CreatureSay cs = new CreatureSay(0, 18, "", "Announcements: " + announce);
837+ if (!_started && !_teleport)
838+ for (L2PcInstance player : L2World.getInstance().getAllPlayers())
839+ {
840+ if (player != null)
841+ if (player.isOnline() != 0)
842+ player.sendPacket(cs);
843+ }
844+ else
845+ {
846+ if (_players != null && !_players.isEmpty())
847+ for (L2PcInstance player : _players)
848+ {
849+ if (player != null)
850+ if (player.isOnline() != 0)
851+ player.sendPacket(cs);
852+ }
853+ }
854+ }
855+
856+ private static void spawnEventNpc()
857+ {
858+ L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
859+ try
860+ {
861+ _npcSpawn = new L2Spawn(tmpl);
862+ _npcSpawn.setLocx(_npcX);
863+ _npcSpawn.setLocy(_npcY);
864+ _npcSpawn.setLocz(_npcZ);
865+ _npcSpawn.setAmount(1);
866+ _npcSpawn.setHeading(_npcHeading);
867+ _npcSpawn.setRespawnDelay(1);
868+ SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
869+ _npcSpawn.init();
870+ _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
871+ _npcSpawn.getLastSpawn().setTitle(_eventName);
872+ _npcSpawn.getLastSpawn()._isEventMobFOS = true;
873+ _npcSpawn.getLastSpawn().isAggressive();
874+ _npcSpawn.getLastSpawn().decayMe();
875+ _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
876+ _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUser(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
877+ }
878+ catch (Exception e)
879+ {
880+ LOGGER.error("Fortress Siege Engine[spawnEventNpc(exception: " + e.getMessage());
881+ }
882+ }
883+
884+ public static void unspawnEventNpc()
885+ {
886+ if (_npcSpawn == null)
887+ return;
888+ _npcSpawn.getLastSpawn().deleteMe();
889+ _npcSpawn.stopRespawn();
890+ SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
891+ }
892+
893+ /**
894+ * returns true if max players is higher than, or equal to, participated players
895+ * @param players
896+ * @return
897+ */
898+ public static boolean checkMaxPlayers(int players)
899+ {
900+ return (_maxPlayers >= players);
901+ }
902+
903+ /**
904+ * returns true if there are more players participated than the minimum required
905+ * @param players
906+ * @return
907+ */
908+ public static boolean checkMinPlayers(int players)
909+ {
910+ return (_minPlayers <= players);
911+ }
912+
913+ public static void showArtifactHtml(L2PcInstance eventPlayer, String objectId)
914+ {
915+ if (eventPlayer == null)
916+ return;
917+ try
918+ {
919+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
920+ TextBuilder replyMSG = new TextBuilder("<html><head><body><center>");
921+ replyMSG.append("Sacred Artifact<br><br>");
922+ replyMSG.append("<font color=\"00FF00\">" + _eventName + " Artifact</font><br1>");
923+ if (eventPlayer._teamNameFOS != null && eventPlayer._teamNameFOS.equals(_teams.get(1)))
924+ replyMSG.append("<font color=\"LEVEL\">This is your Sacred Artifact. Defend it!</font><br1>");
925+ else
926+ replyMSG.append("<font color=\"LEVEL\">Use the Seal Of Ruler Skill to Complete this Siege!</font><br1>");
927+ if (!_started)
928+ replyMSG.append("The Siege is not in progress yet.<br>Wait for a Admin/GM to start the event.<br>");
929+ replyMSG.append("</center></body></html>");
930+ adminReply.setHtml(replyMSG.toString());
931+ eventPlayer.sendPacket(adminReply);
932+ }
933+ catch (Exception e)
934+ {
935+ System.out.println("FOS Engine[showArtifactHtml(" + eventPlayer.getName() + ", " + objectId + ")]: exception: " + e.getStackTrace());
936+ }
937+ }
938+
939+ /**
940+ * Shows the Event Html to the player, depending on the stage of the event, minimum/maximum players, and more variables
941+ * @param eventPlayer
942+ * @param objectId
943+ */
944+ public static void showEventHtml(L2PcInstance eventPlayer, String objectId)
945+ {
946+ try
947+ {
948+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
949+ TextBuilder replyMSG = new TextBuilder("<html><title>" + _eventName + "</title><body>");
950+ replyMSG.append("<center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></center><br1>");
951+ replyMSG.append("<center><font color=\"3366CC\">Current event:</font></center><br1>");
952+ replyMSG.append("<center>Name: <font color=\"00FF00\">" + _eventName + "</font></center><br1>");
953+ replyMSG.append("<center>Description: <font color=\"00FF00\">" + _eventDesc + "</font></center><br><br>");
954+ if (!_started && !_joining)
955+ replyMSG.append("<center>Wait till the admin/gm start the participation.</center>");
956+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMaxPlayers(_playersShuffle.size()))
957+ {
958+ if (!_started)
959+ {
960+ replyMSG.append("Currently participated: <font color=\"00FF00\">" + _playersShuffle.size() + ".</font><br>");
961+ replyMSG.append("Max players: <font color=\"00FF00\">" + _maxPlayers + "</font><br><br>");
962+ replyMSG.append("<font color=\"FFFF00\">You can't participate to this event.</font><br>");
963+ }
964+ }
965+ else if (eventPlayer.isCursedWeaponEquipped() && !Config.FortressSiege_JOIN_CURSED)
966+ replyMSG.append("<font color=\"FFFF00\">You can't participate to this event with a cursed Weapon.</font><br>");
967+ else if (!_started && _joining && eventPlayer.getLevel() >= _minlvl && eventPlayer.getLevel() < _maxlvl)
968+ {
969+ if (_players.contains(eventPlayer) || _playersShuffle.contains(eventPlayer) || checkShufflePlayers(eventPlayer))
970+ {
971+ if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
972+ replyMSG.append("You participated already in team <font color=\"LEVEL\">" + eventPlayer._teamNameFOS + "</font><br><br>");
973+
974+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
975+
976+ replyMSG.append("<center><font color=\"3366CC\">You participated already!</font></center><br><br>");
977+ replyMSG.append("<center>Joined Players: <font color=\"00FF00\">" + _playersShuffle.size() + "</font></center><br>");
978+ replyMSG.append("<center><font color=\"3366CC\">Wait till event start or remove your participation!</font><center>");
979+ replyMSG.append("<center><button value=\"Remove\" action=\"bypass -h npc_" + objectId + "_fos_player_leave\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center>");
980+ }
981+ else
982+ {
983+ replyMSG.append("<center><font color=\"3366CC\">You want to participate in the event?</font></center><br>");
984+ replyMSG.append("<center><td width=\"200\">Min lvl: <font color=\"00FF00\">" + _minlvl + "</font></center></td><br>");
985+ replyMSG.append("<center><td width=\"200\">Max lvl: <font color=\"00FF00\">" + _maxlvl + "</font></center></td><br><br>");
986+ replyMSG.append("<center><font color=\"3366CC\">Teams:</font></center><br>");
987+
988+ if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
989+ {
990+ replyMSG.append("<center><table border=\"0\">");
991+ for (String team : _teams)
992+ {
993+ replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font> (" + teamPlayersCount(team) + " joined)</td>");
994+ replyMSG.append("<center><td width=\"60\"><button value=\"Join\" action=\"bypass -h npc_" + objectId + "_fos_player_join " + team + "\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td></tr>");
995+ }
996+ replyMSG.append("</table></center>");
997+ }
998+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
999+ {
1000+ replyMSG.append("<center>");
1001+ for (String team : _teams)
1002+ replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font> </td>");
1003+ replyMSG.append("</center><br>");
1004+ replyMSG.append("<center><button value=\"Join Event\" action=\"bypass -h npc_" + objectId + "_fos_player_join eventShuffle\" width=85 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center>");
1005+ replyMSG.append("<center><font color=\"3366CC\">Teams will be reandomly generated!</font></center><br>");
1006+ replyMSG.append("<center>Joined Players:</font> <font color=\"LEVEL\">" + _playersShuffle.size() + "</center></font><br>");
1007+ replyMSG.append("<center>Reward: <font color=\"LEVEL\">" + _rewardAmount + " " + ItemTable.getInstance().getTemplate(_rewardId).getName() + "</center></font>");
1008+ }
1009+ }
1010+ }
1011+ else if (_started && !_joining)
1012+ replyMSG.append("<center>" + _eventName + " match is in progress.</center>");
1013+ else if (eventPlayer.getLevel() < _minlvl || eventPlayer.getLevel() > _maxlvl)
1014+ {
1015+ replyMSG.append("Your lvl: <font color=\"00FF00\">" + eventPlayer.getLevel() + "</font><br>");
1016+ replyMSG.append("Min lvl: <font color=\"00FF00\">" + _minlvl + "</font><br>");
1017+ replyMSG.append("Max lvl: <font color=\"00FF00\">" + _maxlvl + "</font><br><br>");
1018+ replyMSG.append("<font color=\"FFFF00\">You can't participate to this event.</font><br>");
1019+ }
1020+ replyMSG.append("</body></html>");
1021+ adminReply.setHtml(replyMSG.toString());
1022+ eventPlayer.sendPacket(adminReply);
1023+
1024+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
1025+ eventPlayer.sendPacket(ActionFailed.STATIC_PACKET);
1026+ }
1027+ catch (final Exception e)
1028+ {
1029+ if (Config.ENABLE_ALL_EXCEPTIONS)
1030+ e.printStackTrace();
1031+
1032+ LOGGER.error(_eventName + " Engine[showEventHtlm(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
1033+ }
1034+ }
1035+
1036+ /**
1037+ * Searches the list of shuffled players to find if the eventPlayer is one of them
1038+ * @param eventPlayer
1039+ * @return
1040+ */
1041+ public static boolean checkShufflePlayers(L2PcInstance eventPlayer)
1042+ {
1043+ try
1044+ {
1045+ for (L2PcInstance player : _playersShuffle)
1046+ if (player == null)
1047+ {
1048+ _playersShuffle.remove(player);
1049+ continue;
1050+ }
1051+ else if (player.getObjectId() == eventPlayer.getObjectId())
1052+ {
1053+ eventPlayer._inEventFOS = true;
1054+ eventPlayer._countFOSkills = 0;
1055+ return true;
1056+ }
1057+ // Just incase a player got a new objectid after DC or reconnect
1058+ else if (player.getName().equals(eventPlayer.getName()))
1059+ {
1060+ _playersShuffle.remove(player);
1061+ _playersShuffle.add(eventPlayer);
1062+ eventPlayer._inEventFOS = true;
1063+ eventPlayer._countFOSkills = 0;
1064+ return true;
1065+ }
1066+ }
1067+ catch (Throwable t)
1068+ {
1069+ System.out.println("Error: FortressSiege.checkShufflePlayers: " + t.toString());
1070+ }
1071+ return false;
1072+ }
1073+
1074+ public static int teamPointsCount(String teamName)
1075+ {
1076+ int index = _teams.indexOf(teamName);
1077+ return (index == -1) ? -1 : _teamPointsCount.get(index);
1078+ }
1079+
1080+ public static void setTeamPointsCount(String teamName, int teamPointCount)
1081+ {
1082+ int index = _teams.indexOf(teamName);
1083+ if (index > -1)
1084+ _teamPointsCount.set(index, teamPointCount);
1085+ }
1086+
1087+ /**
1088+ * Adds the player.
1089+ * @param player the player
1090+ * @param teamName the team name
1091+ */
1092+ public static void addPlayer(final L2PcInstance player, final String teamName)
1093+ {
1094+ if (!addPlayerOk(teamName, player))
1095+ return;
1096+
1097+ synchronized (_players)
1098+ {
1099+ if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
1100+ {
1101+ player._teamNameFOS = teamName;
1102+ _players.add(player);
1103+ setTeamPlayersCount(teamName, teamPlayersCount(teamName) + 1);
1104+ }
1105+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
1106+ _playersShuffle.add(player);
1107+ }
1108+ player._inEventFOS = true;
1109+ player._countFOSkills = 0;
1110+ player.sendMessage(_eventName + ": You successfully registered for the event.");
1111+ }
1112+
1113+ /**
1114+ * Finish event ok.
1115+ * @return true, if successful
1116+ */
1117+ private static boolean finishEventOk()
1118+ {
1119+ if (!_started)
1120+ return false;
1121+
1122+ return true;
1123+ }
1124+
1125+ /**
1126+ * Adds the player ok.
1127+ * @param teamName the team name
1128+ * @param eventPlayer the event player
1129+ * @return true, if successful
1130+ */
1131+ private static boolean addPlayerOk(final String teamName, final L2PcInstance eventPlayer)
1132+ {
1133+ if (eventPlayer.isAio() && !Config.ALLOW_AIO_IN_EVENTS)
1134+ {
1135+ eventPlayer.sendMessage("AIO charactes are not allowed to participate in events :/");
1136+ }
1137+ if (checkShufflePlayers(eventPlayer) || eventPlayer._inEventFOS)
1138+ {
1139+ eventPlayer.sendMessage("You already participated in the event!");
1140+ return false;
1141+ }
1142+
1143+ if (eventPlayer._inEventCTF || eventPlayer._inEventDM || eventPlayer._inEventTvT)
1144+ {
1145+ eventPlayer.sendMessage("You already participated in another event!");
1146+ return false;
1147+ }
1148+
1149+ if (Olympiad.getInstance().isRegistered(eventPlayer) || eventPlayer.isInOlympiadMode())
1150+ {
1151+ eventPlayer.sendMessage("You already participated in Olympiad!");
1152+ return false;
1153+ }
1154+
1155+ if (eventPlayer._active_boxes > 1 && !Config.ALLOW_DUALBOX_EVENT)
1156+ {
1157+ final List<String> players_in_boxes = eventPlayer.active_boxes_characters;
1158+
1159+ if (players_in_boxes != null && players_in_boxes.size() > 1)
1160+ for (final String character_name : players_in_boxes)
1161+ {
1162+ final L2PcInstance player = L2World.getInstance().getPlayer(character_name);
1163+
1164+ if (player != null && player._inEventFOS)
1165+ {
1166+ eventPlayer.sendMessage("You already participated in event with another char!");
1167+ return false;
1168+ }
1169+ }
1170+
1171+ /*
1172+ * eventPlayer.sendMessage("Dual Box not allowed in Events"); return false;
1173+ */
1174+ }
1175+
1176+ synchronized (_players)
1177+ {
1178+ for (final L2PcInstance player : _players)
1179+ {
1180+ if (player.getObjectId() == eventPlayer.getObjectId())
1181+ {
1182+ eventPlayer.sendMessage("You already participated in the event!");
1183+ return false;
1184+ }
1185+ else if (player.getName().equalsIgnoreCase(eventPlayer.getName()))
1186+ {
1187+ eventPlayer.sendMessage("You already participated in the event!");
1188+ return false;
1189+ }
1190+ }
1191+
1192+ if (_players.contains(eventPlayer))
1193+ {
1194+ eventPlayer.sendMessage("You already participated in the event!");
1195+ return false;
1196+ }
1197+ }
1198+
1199+ if (Config.FortressSiege_EVEN_TEAMS.equals("NO"))
1200+ return true;
1201+ else if (Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
1202+ {
1203+ boolean allTeamsEqual = true;
1204+ int countBefore = -1;
1205+
1206+ for (final int playersCount : _teamPlayersCount)
1207+ {
1208+ if (countBefore == -1)
1209+ countBefore = playersCount;
1210+
1211+ if (countBefore != playersCount)
1212+ {
1213+ allTeamsEqual = false;
1214+ break;
1215+ }
1216+
1217+ countBefore = playersCount;
1218+ }
1219+
1220+ if (allTeamsEqual)
1221+ return true;
1222+
1223+ countBefore = Integer.MAX_VALUE;
1224+
1225+ for (final int teamPlayerCount : _teamPlayersCount)
1226+ {
1227+ if (teamPlayerCount < countBefore)
1228+ countBefore = teamPlayerCount;
1229+ }
1230+
1231+ final Vector<String> joinableTeams = new Vector<>();
1232+
1233+ for (final String team : _teams)
1234+ {
1235+ if (teamPlayersCount(team) == countBefore)
1236+ joinableTeams.add(team);
1237+ }
1238+
1239+ if (joinableTeams.contains(teamName))
1240+ return true;
1241+ }
1242+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
1243+ return true;
1244+
1245+ eventPlayer.sendMessage("Too many players in team \"" + teamName + "\"");
1246+ return false;
1247+ }
1248+
1249+ /**
1250+ * Removes the player.
1251+ * @param player the player
1252+ */
1253+ public static void removePlayer(final L2PcInstance player)
1254+ {
1255+ if (player._inEventFOS)
1256+ {
1257+ if (!_joining)
1258+ {
1259+ player.getAppearance().setNameColor(player._originalNameColorFOS);
1260+ player.setTitle(player._originalTitleFOS);
1261+ player.setKarma(player._originalKarmaFOS);
1262+ if (Config.FortressSiege_AURA)
1263+ {
1264+ if (_teams.size() >= 2)
1265+ player.setTeam(0);// clear aura :P
1266+ }
1267+ player.broadcastUserInfo();
1268+ }
1269+
1270+ // after remove, all event data must be cleaned in player
1271+ player._originalNameColorFOS = 0;
1272+ player._originalTitleFOS = null;
1273+ player._originalKarmaFOS = 0;
1274+ player._teamNameFOS = new String();
1275+ player._countFOSkills = 0;
1276+ player._inEventFOS = false;
1277+
1278+ synchronized (_players)
1279+ {
1280+ if ((Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")) && _players.contains(player))
1281+ {
1282+ setTeamPlayersCount(player._teamNameFOS, teamPlayersCount(player._teamNameFOS) - 1);
1283+ _players.remove(player);
1284+ }
1285+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && (!_playersShuffle.isEmpty() && _playersShuffle.contains(player)))
1286+ _playersShuffle.remove(player);
1287+
1288+ }
1289+
1290+ player.sendMessage("Your participation in the FortressSiege event has been removed.");
1291+ }
1292+ }
1293+
1294+ /**
1295+ * Removes the offline players.
1296+ */
1297+ public static void removeOfflinePlayers()
1298+ {
1299+ try
1300+ {
1301+ if (_playersShuffle == null || _playersShuffle.isEmpty())
1302+ return;
1303+ else if (_playersShuffle.size() > 0)
1304+ {
1305+ for (final L2PcInstance player : _playersShuffle)
1306+ {
1307+ if (player == null)
1308+ _playersShuffle.remove(player);
1309+ else if (player.isOnline() == 0 || player.isInJail() || player.isInOfflineMode())
1310+ removePlayer(player);
1311+ if (_playersShuffle.size() == 0 || _playersShuffle.isEmpty())
1312+ break;
1313+ }
1314+ }
1315+ }
1316+ catch (final Exception e)
1317+ {
1318+ if (Config.ENABLE_ALL_EXCEPTIONS)
1319+ e.printStackTrace();
1320+
1321+ LOGGER.error(e.getMessage(), e);
1322+ return;
1323+ }
1324+ }
1325+
1326+ /**
1327+ * Clean FortressSiege.
1328+ */
1329+ public static void cleanFortressSiege()
1330+ {
1331+ synchronized (_players)
1332+ {
1333+ for (final L2PcInstance player : _players)
1334+ {
1335+ if (player != null)
1336+ {
1337+
1338+ cleanEventPlayer(player);
1339+
1340+ removePlayer(player);
1341+ if (_savePlayers.contains(player.getName()))
1342+ _savePlayers.remove(player.getName());
1343+ player._inEventFOS = false;
1344+ }
1345+ }
1346+ }
1347+
1348+ if (_playersShuffle != null && !_playersShuffle.isEmpty())
1349+ {
1350+ for (final L2PcInstance player : _playersShuffle)
1351+ {
1352+ if (player != null)
1353+ player._inEventFOS = false;
1354+ }
1355+ }
1356+
1357+ _topKills = 0;
1358+ _topTeam = new String();
1359+ _players = new Vector<>();
1360+ _playersShuffle = new Vector<>();
1361+ _savePlayers = new Vector<>();
1362+ _savePlayerTeams = new Vector<>();
1363+
1364+ _teamPointsCount = new Vector<>();
1365+ _teamPlayersCount = new Vector<>();
1366+
1367+ cleanLocalEventInfo();
1368+
1369+ _inProgress = false;
1370+
1371+ resetData();
1372+ }
1373+
1374+ /**
1375+ * Clean local event info.
1376+ */
1377+ private static void cleanLocalEventInfo()
1378+ {
1379+
1380+ // nothing
1381+ }
1382+
1383+ /**
1384+ * Clean event player.
1385+ * @param player the player
1386+ */
1387+ private static void cleanEventPlayer(final L2PcInstance player)
1388+ {
1389+
1390+ // nothing
1391+
1392+ }
1393+
1394+ public static void startTeleport()
1395+ {
1396+ if (!_joining || _started || _teleport)
1397+ return;
1398+ if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && checkMinPlayers(_playersShuffle.size()))
1399+ {
1400+ removeOfflinePlayers();
1401+ shuffleTeams();
1402+ }
1403+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMinPlayers(_playersShuffle.size()))
1404+ {
1405+ Announcements.getInstance().gameAnnounceToAll("Not enough players for this event. Minimum Requested : " + _minPlayers + ", Participated : " + _playersShuffle.size());
1406+ return;
1407+ }
1408+ _joining = false;
1409+ Announcements.getInstance().gameAnnounceToAll(_eventName + "(FOS): Teleport to team spot in 10 seconds!");
1410+ setUserData();
1411+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
1412+ {
1413+ @Override
1414+ public void run()
1415+ {
1416+ FortressSiege.sit();
1417+ FortressSiege.spawnFlag();
1418+ for (L2PcInstance player : _players)
1419+ {
1420+ if (player != null)
1421+ {
1422+ FortressSiege.setSealOfRuler(player);
1423+ if (Config.FortressSiege_ON_START_UNSUMMON_PET)
1424+ {
1425+ // Remove Summon's buffs
1426+ if (player.getPet() != null)
1427+ {
1428+ L2Summon summon = player.getPet();
1429+ for (L2Effect e : summon.getAllEffects())
1430+ if (e != null)
1431+ e.exit();
1432+ if (summon instanceof L2PetInstance)
1433+ summon.unSummon(player);
1434+ }
1435+ }
1436+ if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS)
1437+ for (L2Effect e : player.getAllEffects())
1438+ if (e != null)
1439+ e.exit();
1440+ // Remove player from his party
1441+ L2Party party = player.getParty();
1442+ if (party != null)
1443+ party.removePartyMember(player);
1444+ player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
1445+ }
1446+ }
1447+ }
1448+ }, 10000);
1449+ _teleport = true;
1450+ }
1451+
1452+ /**
1453+ * Sets the user data.
1454+ */
1455+ public static void setUserData()
1456+ {
1457+
1458+ if (_players == null || _players.isEmpty())
1459+ return;
1460+ for (L2PcInstance player : _players)
1461+ {
1462+ if (player == null)
1463+ continue;
1464+ {
1465+ player._originalNameColorFOS = player.getAppearance().getNameColor();
1466+ player._originalKarmaFOS = player.getKarma();
1467+ player._originalTitleFOS = player.getTitle();
1468+ player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameFOS)));
1469+ player.setKarma(0);
1470+ setTitleSiegeFlags(player);
1471+ player.setTitle("Kills: " + player._countFOSkills);
1472+ if (Config.FortressSiege_AURA)
1473+ {
1474+ if (_teams.size() >= 2)
1475+ player.setTeam(_teams.indexOf(player._teamNameFOS) + 1);
1476+ }
1477+
1478+ if (player.isMounted())
1479+ {
1480+
1481+ if (player.setMountType(0))
1482+ {
1483+ if (player.isFlying())
1484+ {
1485+ player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
1486+ }
1487+
1488+ final Ride dismount = new Ride(player.getObjectId(), Ride.ACTION_DISMOUNT, 0);
1489+ player.broadcastPacket(dismount);
1490+ player.setMountObjectID(0);
1491+ }
1492+
1493+ }
1494+ player.broadcastUserInfo();
1495+ }
1496+ }
1497+
1498+ }
1499+
1500+ public static void setTitleSiegeFlags(L2PcInstance player)
1501+ {
1502+ if (player == null)
1503+ return;
1504+ if (player._teamNameFOS.equals(_teams.get(0)))
1505+ { // attacking team = attackers siege flag sign
1506+ player.setSiegeState((byte) 1);
1507+ player.sendPacket(new UserInfo(player));
1508+ for (L2PcInstance p : _players)
1509+ p.sendPacket(new RelationChanged(player, player.getRelation(p), player.isAutoAttackable(p)));
1510+ }
1511+ if (player._teamNameFOS.equals(_teams.get(1)))
1512+ { // defending team = defender siege flag sign
1513+ player.setSiegeState((byte) 2);
1514+ player.sendPacket(new UserInfo(player));
1515+ for (L2PcInstance p : _players)
1516+ p.sendPacket(new RelationChanged(player, player.getRelation(p), player.isAutoAttackable(p)));
1517+ }
1518+ }
1519+
1520+ public static void refreshSkillList(L2PcInstance player)
1521+ {
1522+ SkillList response = new SkillList();
1523+ L2Skill[] skills = player.getAllSkills();
1524+ for (int i = 0; i < skills.length; i++)
1525+ {
1526+ L2Skill s = skills[i];
1527+ if (s == null)
1528+ continue;
1529+ if (s.getId() > 9000)
1530+ continue; // fake skills to change base stats
1531+ response.addSkill(s.getId(), s.getLevel(), s.isPassive());
1532+ }
1533+ player.sendPacket(response);
1534+ }
1535+
1536+ public static boolean checkIfOkToCastSealOfRule(L2PcInstance player)
1537+ {
1538+ if (!_started)
1539+ return false;
1540+ if (player.getTarget() instanceof L2NpcInstance && ((L2NpcInstance) player.getTarget())._isFOS_Artifact && player._inEventFOS && player._teamNameFOS.equals(_teams.get(0)))
1541+ return true;
1542+ return false;
1543+ }
1544+
1545+ public static void setSealOfRuler(L2PcInstance player)
1546+ {
1547+ try
1548+ {
1549+ L2Skill sealOfRuler = SkillTable.getInstance().getInfo(246, 1);
1550+ if (!player.returnSkills().containsValue(sealOfRuler))
1551+ player.addSkill(sealOfRuler, false);
1552+ else
1553+ // must keep this skill after the semi-siege
1554+ player._FOSRulerSkills = true;
1555+ refreshSkillList(player);
1556+ player.sendMessage("You have been given the Seal Of Ruler skill for this event.");
1557+ }
1558+ catch (Throwable t)
1559+ {
1560+ return;
1561+ }
1562+ }
1563+
1564+ public static void removeSealOfRuler(L2PcInstance player)
1565+ {
1566+ try
1567+ {
1568+ L2Skill sealOfRuler = SkillTable.getInstance().getInfo(246, 1);
1569+ if (player.returnSkills().containsValue(sealOfRuler) && !player._FOSRulerSkills)
1570+ {
1571+ player.removeSkill(sealOfRuler, false);
1572+ refreshSkillList(player);
1573+ }
1574+ else
1575+ player._FOSRulerSkills = false;
1576+ }
1577+ catch (Throwable t)
1578+ {
1579+ return;
1580+ }
1581+ }
1582+
1583+ public static void shuffleTeams()
1584+ {
1585+ int teamCount = 0;
1586+ _teamPlayersCount.set(0, 0);
1587+ _teamPlayersCount.set(1, 0);
1588+ while (true)
1589+ {
1590+ if (_playersShuffle.isEmpty() || _playersShuffle == null)
1591+ break;
1592+ int randomIndex = Rnd.nextInt(_playersShuffle.size());
1593+ L2PcInstance player = _playersShuffle.get(randomIndex);
1594+ player._originalNameColorFOS = player.getAppearance().getNameColor();
1595+ player._originalKarmaFOS = player.getKarma();
1596+ player._teamNameFOS = _teams.get(teamCount);
1597+ _players.add(player);
1598+ _playersShuffle.remove(randomIndex);
1599+ _savePlayers.add(player.getName());
1600+ _savePlayerTeams.add(_teams.get(teamCount));
1601+ _teamPlayersCount.set(teamCount, _teamPlayersCount.get(teamCount) + 1);
1602+ checkForSameIP(player, teamCount); // Checks for more players from the same IP and puts them in the same team
1603+ if (teamCount == (_teams.size() - 1))
1604+ teamCount = 0;
1605+ else
1606+ teamCount++;
1607+ }
1608+ // Since we add same IPs to same teams this may cause the teams to be uneven in numbers.
1609+ // so we shift amount of players until the teams are even.
1610+ while (_teamPlayersCount.get(0) > _teamPlayersCount.get(1) + 1)
1611+ movePlayerFromTeamToTeam(0, 1);
1612+ while (_teamPlayersCount.get(1) > _teamPlayersCount.get(0) + 1)
1613+ {
1614+ movePlayerFromTeamToTeam(1, 0);
1615+ }
1616+ }
1617+
1618+ /**
1619+ * Moves a player from fromTeam team to toTeam team
1620+ * @param fromTeam - index of the team to move a player from
1621+ * @param toTeam - index of the team to move a player to
1622+ */
1623+ private static void movePlayerFromTeamToTeam(int fromTeam, int toTeam)
1624+ {
1625+ int index = 0;
1626+ for (L2PcInstance p : _players)
1627+ if (p._teamNameFOS.equals(_teams.get(fromTeam)))
1628+ {
1629+ index = _players.indexOf(p);
1630+ break;
1631+ }
1632+ L2PcInstance player = _players.get(index);
1633+ player._teamNameFOS = _teams.get(toTeam);
1634+ _savePlayerTeams.set(index, _teams.get(toTeam));
1635+ _teamPlayersCount.set(fromTeam, _teamPlayersCount.get(fromTeam) - 1);
1636+ _teamPlayersCount.set(toTeam, _teamPlayersCount.get(toTeam) + 1);
1637+ }
1638+
1639+ /**
1640+ * Finds all players from the same IP and places them in the same teams, or if FortressSiege_SAME_IP_PLAYERS_ALLOWED reached, throws them from the event ;]
1641+ * @param player L2PcInstance of the player that has already been removed from the queue
1642+ * @param teamNumber
1643+ */
1644+ private static void checkForSameIP(L2PcInstance player, int teamNumber)
1645+ {
1646+ try
1647+ {
1648+ String playerIP = getIP(player);
1649+ if (playerIP == null)
1650+ return;
1651+ for (L2PcInstance same : _playersShuffle)
1652+ {
1653+ if (same == null)
1654+ {
1655+ _playersShuffle.remove(same);
1656+ continue;
1657+ }
1658+ String sameIP = getIP(same);
1659+ if (sameIP == null)
1660+ continue;
1661+ if (!sameIP.equals(playerIP))
1662+ continue;
1663+ // Now we are left with equal IPs:
1664+ if (!Config.FortressSiege_SAME_IP_PLAYERS_ALLOWED)
1665+ {
1666+ String msg = "Admin does not allow players from the same IP to participate. Player " + player.getName() + " from IP " + playerIP + " is already joined. So player " + same.getName() + " may not join this event!";
1667+ player.sendMessage(msg);
1668+ same.sendMessage(msg);
1669+ removePlayer(same);
1670+ continue;
1671+ }
1672+ // So we allow players from the same IP to join the event:
1673+ same._originalNameColorFOS = same.getAppearance().getNameColor();
1674+ same._originalKarmaFOS = same.getKarma();
1675+ same._teamNameFOS = _teams.get(teamNumber);
1676+ _players.add(same);
1677+ _playersShuffle.remove(same);
1678+ _savePlayers.add(same.getName());
1679+ _savePlayerTeams.add(_teams.get(teamNumber));
1680+ _teamPlayersCount.set(teamNumber, _teamPlayersCount.get(teamNumber) + 1);
1681+ }
1682+ }
1683+ catch (Throwable t)
1684+ {
1685+ }
1686+ }
1687+
1688+ private static String getIP(L2PcInstance player)
1689+ {
1690+ String ip = null;
1691+ try
1692+ {
1693+ StringTokenizer clientinfo = new StringTokenizer(player.getClient().toString(), " ]:-[");
1694+ clientinfo.nextToken();
1695+ clientinfo.nextToken();
1696+ clientinfo.nextToken();
1697+ clientinfo.nextToken();
1698+ clientinfo.nextToken();
1699+ ip = clientinfo.nextToken();
1700+ }
1701+ catch (Exception e)
1702+ {
1703+ }
1704+ return ip;
1705+ }
1706+
1707+ /**
1708+ * Sit.
1709+ */
1710+ public static void sit()
1711+ {
1712+ if (_sitForced)
1713+ _sitForced = false;
1714+ else
1715+ _sitForced = true;
1716+
1717+ synchronized (_players)
1718+ {
1719+ for (final L2PcInstance player : _players)
1720+ {
1721+ if (player != null)
1722+ {
1723+ if (_sitForced)
1724+ {
1725+ player.stopMove(null, false);
1726+ player.abortAttack();
1727+ player.abortCast();
1728+
1729+ if (!player.isSitting())
1730+ player.sitDown();
1731+ }
1732+ else
1733+ {
1734+ if (player.isSitting())
1735+ player.standUp();
1736+ }
1737+ }
1738+ }
1739+ }
1740+
1741+ }
1742+
1743+ /** It's not alway random, only for the Artifacts that I didn't know where they should go =P */
1744+ public static int getRandomFlagId()
1745+ {
1746+ int[] flagId =
1747+ {
1748+ 31508,
1749+ 31509,
1750+ 31541,
1751+ 35514,
1752+ 35515,
1753+ 35322,
1754+ 35323,
1755+ 35469,
1756+ 31512
1757+ };
1758+ if (_eventName.contains("Ketra"))
1759+ return 31558;
1760+ else if (_eventName.contains("Varka"))
1761+ return 31560;
1762+ else if (_eventName.contains("Saint"))
1763+ return 31510;
1764+ return flagId[Rnd.get(flagId.length)];
1765+ }
1766+
1767+ public static void spawnFlag()
1768+ {
1769+ L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(getRandomFlagId());
1770+ try
1771+ {
1772+ _flagSpawn = new L2Spawn(tmpl);
1773+ _flagSpawn.setLocx(_flagX);
1774+ _flagSpawn.setLocy(_flagY);
1775+ _flagSpawn.setLocz(_flagZ);
1776+ _flagSpawn.setAmount(1);
1777+ _flagSpawn.setHeading(0);
1778+ _flagSpawn.setRespawnDelay(1);
1779+ SpawnTable.getInstance().addNewSpawn(_flagSpawn, false);
1780+ _flagSpawn.init();
1781+ _flagSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
1782+ _flagSpawn.getLastSpawn().setTitle(_eventName);
1783+ _flagSpawn.getLastSpawn().decayMe();
1784+ _flagSpawn.getLastSpawn().spawnMe(_flagSpawn.getLastSpawn().getX(), _flagSpawn.getLastSpawn().getY(), _flagSpawn.getLastSpawn().getZ());
1785+ _flagSpawn.getLastSpawn()._isFOS_Artifact = true;
1786+ }
1787+ catch (Exception e)
1788+ {
1789+ System.out.println("Fortress Siege Engine[spawnAllFlags()]: exception: " + e.getStackTrace());
1790+ }
1791+ }
1792+
1793+ public static void unspawnFlag()
1794+ {
1795+ try
1796+ {
1797+ if (_flagSpawn == null || _teams == null)
1798+ return;
1799+ _flagSpawn.getLastSpawn().deleteMe();
1800+ _flagSpawn.stopRespawn();
1801+ SpawnTable.getInstance().deleteSpawn(_flagSpawn, true);
1802+ }
1803+ catch (Throwable t)
1804+ {
1805+ return;
1806+ }
1807+ }
1808+
1809+ public static void startEvent(L2PcInstance activeChar)
1810+ {
1811+ if (!startEventOk())
1812+ {
1813+ if (LOGGER.isDebugEnabled())
1814+ LOGGER.debug("Fortress Siege Engine[startEvent(" + activeChar.getName() + ")]: startEventOk() = false");
1815+ return;
1816+ }
1817+ _teleport = false;
1818+ sit();
1819+ _started = true;
1820+ _teamPointsCount.set(1, 1); // Start with 1 point for defenders, then 2 points for each successful siege
1821+ Announcements(_eventName + "(FOS): Started. Let the battles begin!");
1822+ try
1823+ {
1824+ for (int x = 0; x < 4; x++)
1825+ if (DoorTable.getInstance().getDoor(_door[x]) != null)
1826+ DoorTable.getInstance().getDoor(_door[x]).openMe();
1827+ }
1828+ catch (Throwable t)
1829+ {
1830+ return;
1831+ }
1832+ }
1833+
1834+ public static boolean startAutoEvent()
1835+ {
1836+ if (!startEventOk())
1837+ {
1838+ if (LOGGER.isDebugEnabled())
1839+ LOGGER.debug("Fortress Siege Engine[startEvent]: startEventOk() = false");
1840+ return false;
1841+ }
1842+ _teleport = false;
1843+ sit();
1844+ _started = true;
1845+ Announcements(_eventName + "(FOS): Started. Let the battles begin!");
1846+ try
1847+ {
1848+ for (int x = 0; x < 4; x++)
1849+ if (DoorTable.getInstance().getDoor(_door[x]) != null)
1850+ DoorTable.getInstance().getDoor(_door[x]).openMe();
1851+ }
1852+ catch (Throwable t)
1853+ {
1854+ return true;
1855+ }
1856+ return true;
1857+ }
1858+
1859+ /**
1860+ * Start event ok.
1861+ * @return true, if successful
1862+ */
1863+ private static boolean startEventOk()
1864+ {
1865+ if (_joining || !_teleport || _started)
1866+ return false;
1867+ if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
1868+ {
1869+ if (_teamPlayersCount.contains(0))
1870+ return false;
1871+ }
1872+ return true;
1873+ }
1874+
1875+ public static void abortEvent()
1876+ {
1877+ if (!_joining && !_teleport && !_started)
1878+ return;
1879+ if (_joining && !_teleport && !_started)
1880+ {
1881+ unspawnEventNpc();
1882+ resetData();
1883+ _joining = false;
1884+ Announcements(_eventName + "(FOS): Siege aborted!");
1885+ return;
1886+ }
1887+ _joining = false;
1888+ _teleport = false;
1889+ _started = false;
1890+ unspawnEventNpc();
1891+ unspawnFlag();
1892+ Announcements(_eventName + "(FOS): Match aborted!");
1893+ teleportFinish();
1894+ }
1895+
1896+ /**
1897+ * Teleport finish.
1898+ */
1899+ public static void teleportFinish()
1900+ {
1901+ sit();
1902+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Teleport back to participation NPC in 10 seconds!");
1903+
1904+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
1905+ {
1906+ @Override
1907+ public void run()
1908+ {
1909+ synchronized (_players)
1910+ {
1911+
1912+ for (final L2PcInstance player : _players)
1913+ {
1914+ if (player != null)
1915+ {
1916+ player.setSiegeState((byte) 0);
1917+ if (player.isOnline() != 0)
1918+ player.teleToLocation(_npcX, _npcY, _npcZ, false);
1919+ else
1920+ {
1921+ java.sql.Connection con = null;
1922+ try
1923+ {
1924+ con = L2DatabaseFactory.getInstance().getConnection(false);
1925+
1926+ final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
1927+ statement.setInt(1, _npcX);
1928+ statement.setInt(2, _npcY);
1929+ statement.setInt(3, _npcZ);
1930+ statement.setString(4, player.getName());
1931+ statement.execute();
1932+ DatabaseUtils.close(statement);
1933+ }
1934+ catch (final Exception e)
1935+ {
1936+ if (Config.ENABLE_ALL_EXCEPTIONS)
1937+ e.printStackTrace();
1938+
1939+ LOGGER.error(e.getMessage(), e);
1940+ }
1941+ finally
1942+ {
1943+ CloseUtil.close(con);
1944+ con = null;
1945+ }
1946+ }
1947+ }
1948+ }
1949+
1950+ }
1951+
1952+ sit();
1953+ cleanFortressSiege();
1954+ }
1955+ }, 10000);
1956+ }
1957+
1958+ /**
1959+ * Finish event.
1960+ */
1961+ public static void finishEvent()
1962+ {
1963+ if (!finishEventOk())
1964+ {
1965+ if (Config.DEBUG)
1966+ LOGGER.warn(_eventName + " Engine[finishEvent]: finishEventOk() = false");
1967+ return;
1968+ }
1969+
1970+ _started = false;
1971+ _aborted = false;
1972+ unspawnEventNpc();
1973+ unspawnFlag();
1974+ if (_topScore != 0)
1975+ playKneelAnimation(_topTeam);
1976+ if (Config.FortressSiege_ANNOUNCE_TEAM_STATS)
1977+ {
1978+ Announcements(_eventName + " Team Statistics:");
1979+ Announcements("Team: " + _teams.get(0) + " - Successful Sieges: " + _teamPointsCount.get(0));
1980+ Announcements("Team: " + _teams.get(1) + " - Successful Sieges: " + _teamPointsCount.get(1));
1981+ }
1982+ if (_teamEvent)
1983+ {
1984+ processTopTeam();
1985+ synchronized (_players)
1986+ {
1987+ final L2PcInstance bestKiller = findBestKiller(_players);
1988+ final L2PcInstance looser = findLooser(_players);
1989+
1990+ if (_topKills != 0)
1991+ {
1992+
1993+ playKneelAnimation(_topTeam);
1994+
1995+ if (Config.FortressSiege_ANNOUNCE_TEAM_STATS)
1996+ {
1997+ Announcements.getInstance().gameAnnounceToAll(_eventName + " Team Statistics:");
1998+ for (final String team : _teams)
1999+ {
2000+ final int _kills = teamKillsCount(team);
2001+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Team: " + team + " - Kills: " + _kills);
2002+ }
2003+
2004+ if (bestKiller != null)
2005+ {
2006+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Top killer: " + bestKiller.getName() + " - Kills: " + bestKiller._countFOSkills);
2007+ }
2008+ if ((looser != null) && (!looser.equals(bestKiller)))
2009+ {
2010+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Top looser: " + looser.getName() + " - Dies: " + looser._countFOSdies);
2011+ }
2012+ }
2013+
2014+ if (_topTeam != null)
2015+ {
2016+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + _topTeam + "'s win the match! " + _topKills + " kills.");
2017+ }
2018+ else
2019+ {
2020+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": The event finished with a TIE: " + _topKills + " kills by each team!");
2021+ }
2022+ rewardTeam(_topTeam, bestKiller, looser);
2023+
2024+ if (Config.FortressSiege_STATS_LOGGER)
2025+ {
2026+ LOGGER.info("**** " + _eventName + " ****");
2027+ LOGGER.info(_eventName + " Team Statistics:");
2028+ for (final String team : _teams)
2029+ {
2030+ final int _kills = teamKillsCount(team);
2031+ LOGGER.info("Team: " + team + " - Kills: " + _kills);
2032+ }
2033+
2034+ if (bestKiller != null)
2035+ {
2036+ LOGGER.info("Top killer: " + bestKiller.getName() + " - Kills: " + bestKiller._countFOSkills);
2037+ }
2038+ if ((looser != null) && (!looser.equals(bestKiller)))
2039+ {
2040+ LOGGER.info("Top looser: " + looser.getName() + " - Dies: " + looser._countFOSdies);
2041+ }
2042+
2043+ LOGGER.info(_eventName + ": " + _topTeam + "'s win the match! " + _topKills + " kills.");
2044+
2045+ }
2046+
2047+ }
2048+ else
2049+ {
2050+
2051+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": The event finished with a TIE: No team wins the match(nobody killed)!");
2052+
2053+ if (Config.FortressSiege_STATS_LOGGER)
2054+ LOGGER.info(_eventName + ": No team win the match(nobody killed).");
2055+
2056+ rewardTeam(_topTeam, bestKiller, looser);
2057+ }
2058+ }
2059+ }
2060+ else
2061+ {
2062+ processTopTeam();
2063+ }
2064+
2065+ teleportFinish();
2066+ }
2067+
2068+
2069+ /**
2070+ * Find best killer.
2071+ * @param players the players
2072+ * @return the l2 pc instance
2073+ */
2074+ public static L2PcInstance findBestKiller(final Vector<L2PcInstance> players)
2075+ {
2076+ if (players == null)
2077+ {
2078+ return null;
2079+ }
2080+ L2PcInstance bestKiller = null;
2081+ for (final L2PcInstance player : players)
2082+ {
2083+ if ((bestKiller == null) || (bestKiller._countFOSkills < player._countFOSkills))
2084+ bestKiller = player;
2085+ }
2086+ return bestKiller;
2087+ }
2088+
2089+ /**
2090+ * Find looser.
2091+ * @param players the players
2092+ * @return the l2 pc instance
2093+ */
2094+ public static L2PcInstance findLooser(final Vector<L2PcInstance> players)
2095+ {
2096+ if (players == null)
2097+ {
2098+ return null;
2099+ }
2100+ L2PcInstance looser = null;
2101+ for (final L2PcInstance player : players)
2102+ {
2103+ if ((looser == null) || (looser._countFOSdies < player._countFOSdies))
2104+ looser = player;
2105+ }
2106+ return looser;
2107+ }
2108+
2109+ /**
2110+ * The Class FortressSiegeTeam.
2111+ */
2112+ public static class FortressSiegeTeam
2113+ {
2114+
2115+ /** The kill count. */
2116+ private int killCount = -1;
2117+
2118+ /** The name. */
2119+ private String name = null;
2120+
2121+ /**
2122+ * Instantiates a new tv t team.
2123+ * @param name the name
2124+ * @param killCount the kill count
2125+ */
2126+ FortressSiegeTeam(final String name, final int killCount)
2127+ {
2128+ this.killCount = killCount;
2129+ this.name = name;
2130+ }
2131+
2132+ /**
2133+ * Gets the kill count.
2134+ * @return the kill count
2135+ */
2136+ public int getKillCount()
2137+ {
2138+ return this.killCount;
2139+ }
2140+
2141+ /**
2142+ * Sets the kill count.
2143+ * @param killCount the new kill count
2144+ */
2145+ public void setKillCount(final int killCount)
2146+ {
2147+ this.killCount = killCount;
2148+ }
2149+
2150+ /**
2151+ * Gets the name.
2152+ * @return the name
2153+ */
2154+ public String getName()
2155+ {
2156+ return this.name;
2157+ }
2158+
2159+ /**
2160+ * Sets the name.
2161+ * @param name the new name
2162+ */
2163+ public void setName(final String name)
2164+ {
2165+ this.name = name;
2166+ }
2167+ }
2168+
2169+ /**
2170+ * Reward team.
2171+ * @param teamName the team name
2172+ * @param bestKiller the best killer
2173+ * @param looser the looser
2174+ */
2175+ public static void rewardTeam(final String teamName, final L2PcInstance bestKiller, final L2PcInstance looser)
2176+ {
2177+ synchronized (_players)
2178+ {
2179+ for (final L2PcInstance player : _players)
2180+ {
2181+ if (player != null && (player.isOnline() != 0) && (player._inEventFOS) && (!player.equals(looser)) && (player._countFOSkills > 0 || Config.FortressSiege_PRICE_NO_KILLS))
2182+ {
2183+ if ((bestKiller != null) && (bestKiller.equals(player)))
2184+ {
2185+ player.addItem(_eventName + " Event: " + _eventName, _rewardId, _rewardAmount, player, true);
2186+ player.addItem(_eventName + " Event: " + _eventName, Config.FortressSiege_TOP_KILLER_REWARD, Config.FortressSiege_TOP_KILLER_QTY, player, true);
2187+
2188+ }
2189+ else if (teamName != null && (player._teamNameFOS.equals(teamName)))
2190+ {
2191+
2192+ player.addItem(_eventName + " Event: " + _eventName, _rewardId, _rewardAmount, player, true);
2193+
2194+ final NpcHtmlMessage nhm = new NpcHtmlMessage(5);
2195+ final TextBuilder replyMSG = new TextBuilder("");
2196+
2197+ replyMSG.append("<html><body>");
2198+ replyMSG.append("<font color=\"FFFF00\">Your team wins the event. Look in your inventory for the reward.</font>");
2199+ replyMSG.append("</body></html>");
2200+
2201+ nhm.setHtml(replyMSG.toString());
2202+ player.sendPacket(nhm);
2203+
2204+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
2205+ player.sendPacket(ActionFailed.STATIC_PACKET);
2206+
2207+ }
2208+ else if (teamName == null)
2209+ { // TIE
2210+
2211+ int minus_reward = 0;
2212+ if (_topKills != 0)
2213+ minus_reward = _rewardAmount / 2;
2214+ else
2215+ // nobody killed
2216+ minus_reward = _rewardAmount / 4;
2217+
2218+ player.addItem(_eventName + " Event: " + _eventName, _rewardId, minus_reward, player, true);
2219+
2220+ final NpcHtmlMessage nhm = new NpcHtmlMessage(5);
2221+ final TextBuilder replyMSG = new TextBuilder("");
2222+
2223+ replyMSG.append("<html><body>");
2224+ replyMSG.append("<font color=\"FFFF00\">Your team had a tie in the event. Look in your inventory for the reward.</font>");
2225+ replyMSG.append("</body></html>");
2226+
2227+ nhm.setHtml(replyMSG.toString());
2228+ player.sendPacket(nhm);
2229+
2230+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
2231+ player.sendPacket(ActionFailed.STATIC_PACKET);
2232+
2233+ }
2234+ }
2235+ }
2236+ }
2237+
2238+ }
2239+
2240+ /**
2241+ * Process top player.
2242+ */
2243+ private static void processTopPlayer()
2244+ {
2245+ //
2246+ }
2247+
2248+ /**
2249+ * Process top team.
2250+ */
2251+ private static void processTopTeam()
2252+ {
2253+ _topTeam = null;
2254+ for (final String team : _teams)
2255+ {
2256+ if (teamKillsCount(team) == _topKills && _topKills > 0)
2257+ _topTeam = null;
2258+
2259+ if (teamKillsCount(team) > _topKills)
2260+ {
2261+ _topTeam = team;
2262+ _topKills = teamKillsCount(team);
2263+ }
2264+ }
2265+ }
2266+
2267+ /**
2268+ * Sets the team color.
2269+ * @param teamName the team name
2270+ * @param color the color
2271+ */
2272+ public static void setTeamColor(final String teamName, final int color)
2273+ {
2274+ if (is_inProgress())
2275+ return;
2276+
2277+ final int index = _teams.indexOf(teamName);
2278+
2279+ if (index == -1)
2280+ return;
2281+
2282+ _teamColors.set(index, color);
2283+ }
2284+
2285+ /**
2286+ * Team players count.
2287+ * @param teamName the team name
2288+ * @return the int
2289+ */
2290+ public static int teamPlayersCount(final String teamName)
2291+ {
2292+ final int index = _teams.indexOf(teamName);
2293+
2294+ if (index == -1)
2295+ return -1;
2296+
2297+ return _teamPlayersCount.get(index);
2298+ }
2299+
2300+ /**
2301+ * Sets the team players count.
2302+ * @param teamName the team name
2303+ * @param teamPlayersCount the team players count
2304+ */
2305+ public static void setTeamPlayersCount(final String teamName, final int teamPlayersCount)
2306+ {
2307+ final int index = _teams.indexOf(teamName);
2308+
2309+ if (index == -1)
2310+ return;
2311+
2312+ _teamPlayersCount.set(index, teamPlayersCount);
2313+ }
2314+
2315+ /**
2316+ * On disconnect.
2317+ * @param player the player
2318+ */
2319+ public static void onDisconnect(final L2PcInstance player)
2320+ {
2321+
2322+ if (player._inEventFOS)
2323+ {
2324+ removePlayer(player);
2325+ player.teleToLocation(_npcX, _npcY, _npcZ);
2326+ }
2327+ }
2328+
2329+ /**
2330+ * Team kills count.
2331+ * @param teamName the team name
2332+ * @return the int
2333+ */
2334+ public static int teamKillsCount(final String teamName)
2335+ {
2336+ final int index = _teams.indexOf(teamName);
2337+
2338+ if (index == -1)
2339+ return -1;
2340+
2341+ return _teamPointsCount.get(index);
2342+ }
2343+
2344+ /**
2345+ * Sets the team kills count.
2346+ * @param teamName the team name
2347+ * @param teamKillsCount the team kills count
2348+ */
2349+ public static void setTeamKillsCount(final String teamName, final int teamKillsCount)
2350+ {
2351+ final int index = _teams.indexOf(teamName);
2352+
2353+ if (index == -1)
2354+ return;
2355+
2356+ _teamPointsCount.set(index, teamKillsCount);
2357+ }
2358+
2359+ public static void playKneelAnimation(String teamName)
2360+ {
2361+ for (L2PcInstance player : _players)
2362+ if (player != null && player.isOnline() != 0)
2363+ {
2364+ if (!player._teamNameFOS.equals(teamName))
2365+ {
2366+ player.broadcastPacket(new SocialAction(player.getObjectId(), 7));
2367+ player.broadcastPacket(new SocialAction(player.getObjectId(), 13));
2368+ }
2369+ else
2370+ {
2371+ player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
2372+ player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
2373+ }
2374+ }
2375+ }
2376+
2377+ public static void doSwap()
2378+ {
2379+ sit();// stop everything;
2380+ healDoors(); // restore all doors
2381+ closeDoors(); // close all inner doors
2382+ Announcements(_eventName + "(FOS): Teleport to team spots. In 20 seconds the Siege continues!");// announce to players
2383+ _teamPointsCount.set(0, _teamPointsCount.get(0) + 2);// give points to the attacking side
2384+ String team = _teams.get(0);// swap teams
2385+ _teams.set(0, _teams.get(1));
2386+ _teams.set(1, team);
2387+ int points = _teamPointsCount.get(0);// swap points!
2388+ _teamPointsCount.set(0, _teamPointsCount.get(1));
2389+ _teamPointsCount.set(1, points);
2390+ for (L2PcInstance player : _players)
2391+ // swap title flags
2392+ setTitleSiegeFlags(player);
2393+ try
2394+ {
2395+ for (int x = 0; x < 4; x++)
2396+ if (DoorTable.getInstance().getDoor(_door[x]) != null)
2397+ DoorTable.getInstance().getDoor(_door[x]).closeMe();
2398+ }
2399+ catch (Throwable t)
2400+ {
2401+ }
2402+ for (L2PcInstance player : _players)
2403+ player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)), false);
2404+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
2405+ {// teleport players back to reverse positions
2406+ @Override
2407+ public void run()
2408+ {
2409+ try
2410+ {
2411+ for (int x = 0; x < 4; x++)
2412+ if (DoorTable.getInstance().getDoor(_door[x]) != null)
2413+ DoorTable.getInstance().getDoor(_door[x]).openMe();
2414+ }
2415+ catch (Throwable t)
2416+ {
2417+ }
2418+ sit();
2419+ if (Rnd.get(30) < 11)
2420+ Announcements(_eventName + "(FOS): Let the sieges continue!");// announce to players
2421+ else if (Rnd.get(30) < 11)
2422+ Announcements(_eventName + "(FOS): ...and the battles begin again!");// announce to players
2423+ else
2424+ Announcements(_eventName + "(FOS): May the best team win!");// announce to players
2425+ }
2426+ }, 20000);
2427+ }
2428+
2429+ private static void closeDoors()
2430+ {
2431+ try
2432+ {
2433+ for (int x = 0; x < 6; x++)
2434+ if (_door[x] <= 0)
2435+ continue;
2436+ else if (DoorTable.getInstance().getDoor(_door[x]) != null)
2437+ {
2438+ DoorTable.getInstance().getDoor(_door[x]).closeMe();
2439+ }
2440+ }
2441+ catch (Throwable t)
2442+ {
2443+ return;
2444+ }
2445+ }
2446+
2447+ private static void healDoors()
2448+ {
2449+ try
2450+ {
2451+ for (int x = 0; x < 6; x++)
2452+ if (_door[x] <= 0)
2453+ continue;
2454+ else if (DoorTable.getInstance().getDoor(_door[x]) != null)
2455+ {
2456+ DoorTable.getInstance().getDoor(_door[x]).doRevive();
2457+ DoorTable.getInstance().getDoor(_door[x]).spawnMe();
2458+ DoorTable.getInstance().getDoor(_door[x]).getStatus().setCurrentHp(DoorTable.getInstance().getDoor(_door[x]).getMaxHp());
2459+ }
2460+ }
2461+ catch (Throwable t)
2462+ {
2463+ return;
2464+ }
2465+ }
2466+
2467+ public static boolean isDoorAttackable(int id, L2Character attacker)
2468+ {
2469+ if (!_started)
2470+ return false;
2471+ for (int doorId : _door)
2472+ {
2473+ if (doorId != id)
2474+ continue;
2475+ if (attacker instanceof L2PcInstance && ((L2PcInstance) attacker)._inEventFOS)
2476+ return true;
2477+ else if (attacker instanceof L2Summon && ((L2Summon) attacker).getOwner()._inEventFOS)
2478+ return true;
2479+ else if (attacker instanceof L2PetInstance && ((L2PetInstance) attacker).getOwner()._inEventFOS)
2480+ return true;
2481+ }
2482+ return false;
2483+ }
2484+
2485+ /**
2486+ * Returns true if the L2Character is in the protected siege spawn zone (both attacker/defender spawns are protected)
2487+ * @param cha
2488+ * @param attacker
2489+ * @return
2490+ */
2491+ public static boolean inProtectedZone(L2Character cha, L2PcInstance attacker)
2492+ {
2493+ if (cha == null || attacker == null)
2494+ return false;
2495+ // This is the function: isInsideRadius(object.getX(), object.getY(), object.getZ(), radius, checkZ, strictCheck); (corners are left unchecked)
2496+ if (cha.isInsideRadius(eventCenterX, eventCenterY, eventCenterZ, 584, true, true) || cha.isInsideRadius(_teamsX.get(0), _teamsY.get(0), _teamsZ.get(0), 300, true, true))
2497+ {
2498+ attacker.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
2499+ attacker.getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
2500+ attacker.sendPacket(new ActionFailed());
2501+ return true;
2502+ }
2503+ return false;
2504+ }
2505+
2506+ /**
2507+ * Adds the disconnected player.
2508+ * @param player the player
2509+ */
2510+ public static synchronized void addDisconnectedPlayer(final L2PcInstance player)
2511+ {
2512+ if ((Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && (_teleport || _started)) || (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE") && (_teleport || _started)))
2513+ {
2514+ if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS)
2515+ {
2516+ player.stopAllEffects();
2517+
2518+ }
2519+
2520+ player._teamNameFOS = _savePlayerTeams.get(_savePlayers.indexOf(player.getName()));
2521+
2522+ synchronized (_players)
2523+ {
2524+ for (final L2PcInstance p : _players)
2525+ {
2526+ if (p == null)
2527+ {
2528+ continue;
2529+ }
2530+ // check by name incase player got new objectId
2531+ else if (p.getName().equals(player.getName()))
2532+ {
2533+ player._originalNameColorFOS = player.getAppearance().getNameColor();
2534+ player._originalTitleFOS = player.getTitle();
2535+ player._originalKarmaFOS = player.getKarma();
2536+ player._inEventFOS = true;
2537+ player._countFOSkills = p._countFOSkills;
2538+ _players.remove(p); // removing old object id from vector
2539+ _players.add(player); // adding new objectId to vector
2540+ break;
2541+ }
2542+ }
2543+ }
2544+
2545+ player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameFOS)));
2546+ player.setKarma(0);
2547+ setSealOfRuler(player);
2548+ setTitleSiegeFlags(player);
2549+ if (Config.FortressSiege_AURA)
2550+ {
2551+ if (_teams.size() >= 2)
2552+ player.setTeam(_teams.indexOf(player._teamNameFOS) + 1);
2553+ }
2554+ player.broadcastUserInfo();
2555+
2556+ player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
2557+
2558+ afterAddDisconnectedPlayerOperations(player);
2559+
2560+ }
2561+ }
2562+
2563+ /**
2564+ * After add disconnected player operations.
2565+ * @param player the player
2566+ */
2567+ private static void afterAddDisconnectedPlayerOperations(final L2PcInstance player)
2568+ {
2569+
2570+ // nothing
2571+ }
2572+
2573+ /************************** -- Auto Events Engine -- ******************************/
2574+
2575+ /** Starts the autoevent engine, generates a random event and runs it */
2576+ public static void autoEvent()
2577+ {
2578+ if (startAutoJoin())
2579+ {
2580+ if (_joinTime > 0)
2581+ waiter(_joinTime * 60 * 1000); // minutes for join event
2582+ else if (_joinTime <= 0)
2583+ {
2584+ abortEvent();
2585+ return;
2586+ }
2587+ if (teleportAutoStart())
2588+ {
2589+ waiter(1 * 60 * 1000); // 1 min wait time untill start fight after teleported
2590+ if (startAutoEvent())
2591+ {
2592+ waiter(_eventTime * 60 * 1000); // minutes for event time
2593+ finishEvent();
2594+ }
2595+ }
2596+ else if (!teleportAutoStart())
2597+ abortEvent();
2598+ }
2599+ }
2600+
2601+ public static boolean teleportAutoStart()
2602+ {
2603+ if (!_joining || _started || _teleport)
2604+ return false;
2605+ if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && checkMinPlayers(_playersShuffle.size()))
2606+ {
2607+ removeOfflinePlayers();
2608+ shuffleTeams();
2609+ }
2610+ else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMinPlayers(_playersShuffle.size()))
2611+ {
2612+ Announcements("Not enough players for event. Min Requested : " + _minPlayers + ", Participating : " + _playersShuffle.size());
2613+ return false;
2614+ }
2615+ _joining = false;
2616+ Announcements(_eventName + "(FOS): Teleport to team spot in 10 seconds!");
2617+ setUserData();
2618+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
2619+ {
2620+ public void run()
2621+ {
2622+ sit();
2623+ spawnFlag();
2624+ for (L2PcInstance player : _players)
2625+ {
2626+ if (player != null)
2627+ {
2628+ setSealOfRuler(player);
2629+ if (Config.FortressSiege_ON_START_UNSUMMON_PET)
2630+ {
2631+ // Remove Summon's buffs
2632+ if (player.getPet() != null)
2633+ {
2634+ L2Summon summon = player.getPet();
2635+ for (L2Effect e : summon.getAllEffects())
2636+ if (e != null)
2637+ e.exit();
2638+ if (summon instanceof L2PetInstance)
2639+ summon.unSummon(player);
2640+ }
2641+ }
2642+ if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS)
2643+ {
2644+ for (L2Effect e : player.getAllEffects())
2645+ if (e != null)
2646+ e.exit();
2647+ }
2648+ // Remove player from his party
2649+ if (player.getParty() != null)
2650+ {
2651+ L2Party party = player.getParty();
2652+ party.removePartyMember(player);
2653+ }
2654+ player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
2655+ }
2656+ }
2657+ }
2658+ }, 10000);
2659+ _teleport = true;
2660+ return true;
2661+ }
2662+
2663+ public static boolean startAutoJoin()
2664+ {
2665+ if (!startJoinOk())
2666+ {
2667+ if (LOGGER.isDebugEnabled())
2668+ LOGGER.debug("FortressSiege Engine[startJoin]: startJoinOk() = false");
2669+ return false;
2670+ }
2671+ _joining = true;
2672+ spawnEventNpc();
2673+ Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
2674+ return true;
2675+ }
2676+
2677+ /**
2678+ * Waiter.
2679+ * @param interval the interval
2680+ */
2681+ protected static void waiter(final long interval)
2682+ {
2683+ final long startWaiterTime = System.currentTimeMillis();
2684+ int seconds = (int) (interval / 1000);
2685+
2686+ while (startWaiterTime + interval > System.currentTimeMillis() && !_aborted)
2687+ {
2688+ seconds--; // Here because we don't want to see two time announce at the same time
2689+
2690+ if (_joining || _started || _teleport)
2691+ {
2692+ switch (seconds)
2693+ {
2694+ case 3600: // 1 hour left
2695+ removeOfflinePlayers();
2696+
2697+ if (_joining)
2698+ {
2699+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Joinable in " + _joiningLocationName + "!");
2700+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds / 60 / 60 + " hour(s) till registration close!");
2701+ }
2702+ else if (_started)
2703+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds / 60 / 60 + " hour(s) till event finish!");
2704+
2705+ break;
2706+ case 1800: // 30 minutes left
2707+ case 900: // 15 minutes left
2708+ case 600: // 10 minutes left
2709+ case 300: // 5 minutes left
2710+ case 240: // 4 minutes left
2711+ case 180: // 3 minutes left
2712+ case 120: // 2 minutes left
2713+ case 60: // 1 minute left
2714+ // removeOfflinePlayers();
2715+
2716+ if (_joining)
2717+ {
2718+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": Joinable in " + _joiningLocationName + "!");
2719+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds / 60 + " minute(s) till registration close!");
2720+ }
2721+ else if (_started)
2722+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds / 60 + " minute(s) till event finish!");
2723+
2724+ break;
2725+ case 30: // 30 seconds left
2726+ case 15: // 15 seconds left
2727+ case 10: // 10 seconds left
2728+ removeOfflinePlayers();
2729+ case 3: // 3 seconds left
2730+ case 2: // 2 seconds left
2731+ case 1: // 1 seconds left
2732+
2733+ if (_joining)
2734+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds + " second(s) till registration close!");
2735+ else if (_teleport)
2736+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds + " seconds(s) till start fight!");
2737+ else if (_started)
2738+ Announcements.getInstance().gameAnnounceToAll(_eventName + ": " + seconds + " second(s) till event finish!");
2739+
2740+ break;
2741+ }
2742+ }
2743+
2744+ final long startOneSecondWaiterStartTime = System.currentTimeMillis();
2745+
2746+ // Only the try catch with Thread.sleep(1000) give bad countdown on high wait times
2747+ while (startOneSecondWaiterStartTime + 1000 > System.currentTimeMillis())
2748+ {
2749+ try
2750+ {
2751+ Thread.sleep(1);
2752+ }
2753+ catch (final InterruptedException ie)
2754+ {
2755+ if (Config.ENABLE_ALL_EXCEPTIONS)
2756+ ie.printStackTrace();
2757+ }
2758+ }
2759+ }
2760+ }
2761+}
2762
2763===============================================================================================================
2764++++head-src\com\l2jfrozen\gameserver\handler\voicedcommandhandlers\FOSCmd.java
2765================================================================================================================
2766
2767
2768package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
2769
2770+import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
2771+import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
2772+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
2773+import com.l2jfrozen.gameserver.model.entity.FortressSiege;
2774
2775+public class FOSCmd implements IVoicedCommandHandler
2776+{
2777+ private static final String[] VOICED_COMMANDS =
2778+ {
2779+ "fosjoin",
2780+ "fosleave",
2781+ "fosinfo"
2782+ };
2783+
2784+ @Override
2785+ public boolean useVoicedCommand(final String command, final L2PcInstance activeChar, final String target)
2786+ {
2787+ if (command.startsWith("fosjoin"))
2788+ {
2789+ JoinFortressSiege(activeChar);
2790+ }
2791+ else if (command.startsWith("fosleave"))
2792+ {
2793+ LeaveFortressSiege(activeChar);
2794+ }
2795+
2796+ else if (command.startsWith("fosinfo"))
2797+ {
2798+ FortressSiegeinfo(activeChar);
2799+ }
2800+
2801+ return true;
2802+ }
2803+
2804+ @Override
2805+ public String[] getVoicedCommandList()
2806+ {
2807+ return VOICED_COMMANDS;
2808+ }
2809+
2810+ public boolean JoinFortressSiege(final L2PcInstance activeChar)
2811+ {
2812+ if (activeChar == null)
2813+ {
2814+ return false;
2815+ }
2816+
2817+ if (!FortressSiege.is_joining())
2818+ {
2819+ activeChar.sendMessage("There is no Fortress Siege Event in progress.");
2820+ return false;
2821+ }
2822+ else if (FortressSiege.is_joining() && activeChar._inEventFOS)
2823+ {
2824+ activeChar.sendMessage("You are already registered.");
2825+ return false;
2826+ }
2827+ else if (activeChar.isCursedWeaponEquipped())
2828+ {
2829+ activeChar.sendMessage("You are not allowed to participate to the event because you are holding a Cursed Weapon.");
2830+ return false;
2831+ }
2832+ else if (activeChar.isInOlympiadMode())
2833+ {
2834+ activeChar.sendMessage("You are not allowed to participate to the event because you are in Olympiad.");
2835+ return false;
2836+ }
2837+ else if (activeChar.getLevel() < FortressSiege.get_minlvl())
2838+ {
2839+ activeChar.sendMessage("You are not allowed to participate to the event because your level is too low.");
2840+ return false;
2841+ }
2842+ else if (activeChar.getLevel() > FortressSiege.get_maxlvl())
2843+ {
2844+ activeChar.sendMessage("You are not allowed to participate to the event because your level is too high.");
2845+ return false;
2846+ }
2847+ else if (activeChar.getKarma() > 0)
2848+ {
2849+ activeChar.sendMessage("You are not allowed to participate to the event because you have Karma.");
2850+ return false;
2851+ }
2852+ else if (FortressSiege.is_teleport() || FortressSiege.is_started())
2853+ {
2854+ activeChar.sendMessage("Fortress Siege Event registration period is over. You can't register now.");
2855+ return false;
2856+ }
2857+ else
2858+ {
2859+ activeChar.sendMessage("Your participation in the Fortress Siege event has been approved.");
2860+ FortressSiege.addPlayer(activeChar, "");
2861+ return false;
2862+ }
2863+ }
2864+
2865+ public boolean LeaveFortressSiege(final L2PcInstance activeChar)
2866+ {
2867+ if (activeChar == null)
2868+ {
2869+ return false;
2870+ }
2871+
2872+ if (!FortressSiege.is_joining())
2873+ {
2874+ activeChar.sendMessage("There is no FortressSiege Event in progress.");
2875+ return false;
2876+ }
2877+ else if ((FortressSiege.is_teleport() || FortressSiege.is_started()) && activeChar._inEventFOS)
2878+ {
2879+ activeChar.sendMessage("You can not leave now because FortressSiege event has started.");
2880+ return false;
2881+ }
2882+ else if (FortressSiege.is_joining() && !activeChar._inEventFOS)
2883+ {
2884+
2885+ activeChar.sendMessage("You aren't registered in the FortressSiege Event.");
2886+ return false;
2887+ }
2888+ else
2889+ {
2890+ FortressSiege.removePlayer(activeChar);
2891+ activeChar.sendMessage("Your Participation in the FortressSiege Event was removed!.");
2892+ return true;
2893+ }
2894+ }
2895+
2896+ public boolean FortressSiegeinfo(final L2PcInstance activeChar)
2897+ {
2898+ if (activeChar == null)
2899+ {
2900+ return false;
2901+ }
2902+
2903+ if (!FortressSiege.is_joining())
2904+ {
2905+ activeChar.sendMessage("There is no Fortress Siege Event in progress.");
2906+ return false;
2907+ }
2908+ else if (FortressSiege.is_teleport() || FortressSiege.is_started())
2909+ {
2910+ activeChar.sendMessage("I can't provide you this info. Command available only in joining period.");
2911+ return false;
2912+ }
2913+ else
2914+ {
2915+ if (FortressSiege._playersShuffle.size() == 1)
2916+ {
2917+ activeChar.sendMessage("There is " + FortressSiege._playersShuffle.size() + " player participating in this event.");
2918+ activeChar.sendMessage("Reward: " + FortressSiege.get_rewardAmount() + " " + ItemTable.getInstance().getTemplate(FortressSiege.get_rewardId()).getName() + " !");
2919+ activeChar.sendMessage("Player Min lvl: " + FortressSiege.get_minlvl() + ".");
2920+ activeChar.sendMessage("Player Max lvl: " + FortressSiege.get_maxlvl() + ".");
2921+ }
2922+ else
2923+ {
2924+ activeChar.sendMessage("There are " + FortressSiege._playersShuffle.size() + " players participating in this event.");
2925+ activeChar.sendMessage("Reward: " + FortressSiege.get_rewardAmount() + " " + ItemTable.getInstance().getTemplate(FortressSiege.get_rewardId()).getName() + " !");
2926+ activeChar.sendMessage("Player Min lvl: " + FortressSiege.get_minlvl() + ".");
2927+ activeChar.sendMessage("Player Max lvl: " + FortressSiege.get_maxlvl() + ".");
2928+ }
2929+ return true;
2930+ }
2931+ }
2932+}
2933
2934=====================================================================================================
2935package com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminFortressSiegeEngine.java;
2936=====================================================================================================
2937
2938+import java.sql.Connection;
2939+import java.sql.PreparedStatement;
2940+import java.sql.ResultSet;
2941
2942+import javolution.text.TextBuilder;
2943
2944+import com.l2jfrozen.Config;
2945+import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
2946+import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
2947+import com.l2jfrozen.gameserver.model.L2Object;
2948+import com.l2jfrozen.gameserver.model.L2World;
2949+import com.l2jfrozen.gameserver.model.Location;
2950+import com.l2jfrozen.gameserver.model.actor.instance.L2DoorInstance;
2951+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
2952+import com.l2jfrozen.gameserver.model.entity.FortressSiege;
2953+import com.l2jfrozen.gameserver.model.entity.event.TvT;
2954+import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
2955+import com.l2jfrozen.util.database.L2DatabaseFactory;
2956+import com.l2jfrozen.util.random.Rnd;
2957
2958+/**
2959+ * Fortress Siege Event
2960+* @author Darki699
2961+ * @comment: So many fortresses, I hate to see them go to waste ;]
2962+ */
2963
2964+public class AdminFortressSiegeEngine implements IAdminCommandHandler
2965+{
2966+
2967+ private static final String[] ADMIN_COMMANDS =
2968+ {
2969+ "admin_fos_name",
2970+ "admin_fos_teamname",
2971+ "admin_fos_desc",
2972+ "admin_fos_join_loc",
2973+ "admin_fos_minlvl",
2974+ "admin_fos_maxlvl",
2975+ "admin_fos_npc",
2976+ "admin_fos_npc_pos",
2977+ "admin_fos_reward",
2978+ "admin_fos_reward_amount",
2979+ "admin_fos_team_add",
2980+ "admin_fos_team_remove",
2981+ "admin_fos_team_pos",
2982+ "admin_fos_team_flag",
2983+ "admin_fos_team_cent",
2984+ "admin_fos_team_color",
2985+ "admin_fos_join",
2986+ "admin_fos_teleport",
2987+ "admin_fos_start",
2988+ "admin_fos_abort",
2989+ "admin_fos_finish",
2990+ "admin_fos_sit",
2991+ "admin_fos_dump",
2992+ "admin_fos_save",
2993+ "admin_fos_load",
2994+ "admin_fos_jointime",
2995+ "admin_fos_eventtime",
2996+ "admin_fos_autoevent",
2997+ "admin_fos_minplayers",
2998+ "admin_fos_maxplayers",
2999+ "admin_fos",
3000+ "admin_fos_pg2",
3001+ "admin_fos_pg3",
3002+ "admin_fos_tele1",
3003+ "admin_fos_tele2",
3004+ "admin_fos_door6",
3005+ "admin_fos_tele3",
3006+ "admin_fos_tele4",
3007+ "admin_fos_door1",
3008+ "admin_fos_door2",
3009+ "admin_fos_door3",
3010+ "admin_fos_door4",
3011+ "admin_fos_door5"
3012+ };
3013+
3014+ // private static final int REQUIRED_LEVEL = 100;
3015+
3016+ @Override
3017+ @SuppressWarnings("cast")
3018+ public boolean useAdminCommand(final String command, final L2PcInstance activeChar)
3019+ {
3020+
3021+ /*
3022+ * if(!AdminCommandAccessRights.getInstance().hasAccess(command, activeChar.getAccessLevel())){ return false; } if(Config.GMAUDIT) { Logger _logAudit = Logger.getLogger("gmaudit"); LogRecord record = new LogRecord(Level.INFO, command); record.setParameters(new Object[] { "GM: " +
3023+ * activeChar.getName(), " to target [" + activeChar.getTarget() + "] " }); _logAudit.LOGGER(record); }
3024+ */
3025+
3026+ if (command.equals("admin_fos"))
3027+ {
3028+ showMainPage(activeChar);
3029+ }
3030+ else if (command.startsWith("admin_fos_name "))
3031+ {
3032+ FortressSiege._eventName = command.substring(15);
3033+ showMainPage(activeChar);
3034+ }
3035+ else if (command.equals("admin_fos_tele1"))
3036+ {
3037+ if ((((Integer) FortressSiege._teamsX.get(0)).intValue() != 0) || (((Integer) FortressSiege._teamsY.get(0)).intValue() != 0) || (((Integer) FortressSiege._teamsZ.get(0)).intValue() != 0))
3038+ {
3039+ activeChar.teleToLocation(((Integer) FortressSiege._teamsX.get(0)).intValue(), ((Integer) FortressSiege._teamsY.get(0)).intValue(), ((Integer) FortressSiege._teamsZ.get(0)).intValue());
3040+ }
3041+ showMainPage(activeChar);
3042+ }
3043+ else if (command.equals("admin_fos_tele2"))
3044+ {
3045+ if ((((Integer) FortressSiege._teamsX.get(1)).intValue() != 0) || (((Integer) FortressSiege._teamsY.get(1)).intValue() != 0) || (((Integer) FortressSiege._teamsZ.get(1)).intValue() != 0))
3046+ {
3047+ activeChar.teleToLocation(((Integer) FortressSiege._teamsX.get(1)).intValue(), ((Integer) FortressSiege._teamsY.get(1)).intValue(), ((Integer) FortressSiege._teamsZ.get(1)).intValue());
3048+ }
3049+ showMainPage(activeChar);
3050+ }
3051+ else if (command.equals("admin_fos_tele3"))
3052+ {
3053+ if ((FortressSiege._flagX != 0) || (FortressSiege._flagY != 0) || (FortressSiege._flagZ != 0))
3054+ {
3055+ activeChar.teleToLocation(FortressSiege._flagX, FortressSiege._flagY, FortressSiege._flagZ);
3056+ }
3057+ showMainPage(activeChar);
3058+ }
3059+ else if (command.equals("admin_fos_tele4"))
3060+ {
3061+ if ((FortressSiege._npcX != 0) || (FortressSiege._npcY != 0) || (FortressSiege._npcZ != 0))
3062+ {
3063+ activeChar.teleToLocation(FortressSiege._npcX, FortressSiege._npcY, FortressSiege._npcZ);
3064+ }
3065+ showMainPage(activeChar);
3066+ }
3067+ else if (command.startsWith("admin_fos_desc "))
3068+ {
3069+ FortressSiege._eventDesc = command.substring(15);
3070+ showMainPage(activeChar);
3071+ }
3072+ else if (command.startsWith("admin_fos_minlvl "))
3073+ {
3074+ if (!FortressSiege.checkMinLevel(Integer.valueOf(command.substring(17)).intValue()))
3075+ {
3076+ return false;
3077+ }
3078+ FortressSiege._minlvl = Integer.valueOf(command.substring(17)).intValue();
3079+ showMainPage(activeChar);
3080+ }
3081+ else if (command.startsWith("admin_fos_door"))
3082+ {
3083+ L2Object target = activeChar.getTarget();
3084+ if (target == null)
3085+ {
3086+ activeChar.sendMessage("Nothing targeted!");
3087+ }
3088+ else if ((target instanceof L2DoorInstance))
3089+ {
3090+ int doorId = ((L2DoorInstance) target).getDoorId();
3091+ if (doorId > 0)
3092+ {
3093+ FortressSiege._door[(Integer.valueOf(command.substring(14)).intValue() - 1)] = doorId;
3094+ }
3095+ }
3096+ else
3097+ {
3098+ activeChar.sendMessage("Incorrect target.");
3099+ }
3100+ showMainPage(activeChar);
3101+ }
3102+ else if (command.equals("admin_fos_team_flag"))
3103+ {
3104+ FortressSiege._flagX = activeChar.getX();
3105+ FortressSiege._flagY = activeChar.getY();
3106+ FortressSiege._flagZ = activeChar.getZ();
3107+ showMainPage(activeChar);
3108+ }
3109+ else if (command.equals("admin_fos_team_cent"))
3110+ {
3111+ FortressSiege.eventCenterX = activeChar.getX();
3112+ FortressSiege.eventCenterY = activeChar.getY();
3113+ FortressSiege.eventCenterZ = activeChar.getZ();
3114+ showMainPage(activeChar);
3115+ }
3116+ else if (command.startsWith("admin_fos_maxlvl "))
3117+ {
3118+ if (!FortressSiege.checkMaxLevel(Integer.valueOf(command.substring(17)).intValue()))
3119+ {
3120+ return false;
3121+ }
3122+ FortressSiege._maxlvl = Integer.valueOf(command.substring(17)).intValue();
3123+ showMainPage(activeChar);
3124+ }
3125+ else if (command.startsWith("admin_fos_minplayers "))
3126+ {
3127+ FortressSiege._minPlayers = Integer.valueOf(command.substring(21)).intValue();
3128+ showMainPage(activeChar);
3129+ }
3130+ else if (command.startsWith("admin_fos_maxplayers "))
3131+ {
3132+ FortressSiege._maxPlayers = Integer.valueOf(command.substring(21)).intValue();
3133+ showMainPage(activeChar);
3134+ }
3135+ else if (command.startsWith("admin_fos_join_loc "))
3136+ {
3137+ FortressSiege._joiningLocationName = command.substring(19);
3138+ showMainPage(activeChar);
3139+ }
3140+ else if (command.startsWith("admin_fos_npc "))
3141+ {
3142+ FortressSiege._npcId = Integer.valueOf(command.substring(14)).intValue();
3143+ showMainPage(activeChar);
3144+ }
3145+ else if (command.equals("admin_fos_npc_pos"))
3146+ {
3147+ FortressSiege._npcX = activeChar.getX();
3148+ FortressSiege._npcY = activeChar.getY();
3149+ FortressSiege._npcZ = activeChar.getZ();
3150+ showMainPage(activeChar);
3151+ }
3152+ else if (command.startsWith("admin_fos_reward "))
3153+ {
3154+ FortressSiege._rewardId = Integer.valueOf(command.substring(17)).intValue();
3155+ showMainPage(activeChar);
3156+ }
3157+ else if (command.startsWith("admin_fos_reward_amount "))
3158+ {
3159+ FortressSiege._rewardAmount = Integer.valueOf(command.substring(24)).intValue();
3160+ showMainPage(activeChar);
3161+ }
3162+ else if (command.startsWith("admin_fos_jointime "))
3163+ {
3164+ FortressSiege._joinTime = Integer.valueOf(command.substring(19)).intValue();
3165+ showMainPage(activeChar);
3166+ }
3167+ else if (command.startsWith("admin_fos_eventtime "))
3168+ {
3169+ FortressSiege._eventTime = Integer.valueOf(command.substring(20)).intValue();
3170+ showMainPage(activeChar);
3171+ }
3172+ else if (command.startsWith("admin_fos_teamname "))
3173+ {
3174+ String[] params = command.split(" ");
3175+ if (params.length < 3)
3176+ {
3177+ activeChar.sendMessage("Wrong usage: //fos_teamname <1 or 2> <team name>");
3178+ return false;
3179+ }
3180+ FortressSiege._teams.set(Integer.valueOf(params[1]).intValue() - 1, params[2]);
3181+ showMainPage(activeChar);
3182+ }
3183+ else if (command.startsWith("admin_fos_team_pos "))
3184+ {
3185+ String teamName = command.substring(19);
3186+ FortressSiege.setTeamPos(teamName, activeChar);
3187+ showMainPage(activeChar);
3188+ }
3189+ else if (command.startsWith("admin_fos_team_color "))
3190+ {
3191+ String[] params = command.split(" ");
3192+ if (params.length < 3)
3193+ {
3194+ activeChar.sendMessage("Wrong usage: //fos_team_color <colorHex> <team name>");
3195+ return false;
3196+ }
3197+ FortressSiege.setTeamColor(command.substring(params[0].length() + params[1].length() + 2), Integer.decode("0x" + params[1]).intValue());
3198+ showMainPage(activeChar);
3199+ }
3200+ else if (command.equals("admin_fos_join"))
3201+ {
3202+ FortressSiege.startJoin();
3203+ showMainPage(activeChar);
3204+ }
3205+ else if (command.equals("admin_fos_teleport"))
3206+ {
3207+ FortressSiege.startTeleport();
3208+ showMainPage(activeChar);
3209+ }
3210+ else if (command.equals("admin_fos_start"))
3211+ {
3212+ if (FortressSiege.is_joining())
3213+ {
3214+ FortressSiege.startTeleport();
3215+ }
3216+ else if (FortressSiege.is_teleport())
3217+ {
3218+ FortressSiege.startEvent(activeChar);
3219+ }
3220+ showMainPage(activeChar);
3221+ }
3222+ else if (command.equals("admin_fos_abort"))
3223+ {
3224+ activeChar.sendMessage("Aborting event");
3225+ FortressSiege.abortEvent();
3226+ showMainPage(activeChar);
3227+ }
3228+ else if (command.equals("admin_fos_finish"))
3229+ {
3230+ FortressSiege.finishEvent();
3231+ showMainPage(activeChar);
3232+ }
3233+ else if (command.equals("admin_fos_sit"))
3234+ {
3235+ FortressSiege.sit();
3236+ showMainPage(activeChar);
3237+ }
3238+ else if (command.equals("admin_fos_load"))
3239+ {
3240+ showSiegeLoadPage(activeChar, false);
3241+ }
3242+ else if (command.startsWith("admin_fos_load "))
3243+ {
3244+ String siegeName = command.substring(15);
3245+ FortressSiege.loadData(siegeName);
3246+ showMainPage(activeChar);
3247+ }
3248+ else if (command.equals("admin_fos_autoevent"))
3249+ {
3250+ if (FortressSiege.get_joinTime() > 0 && (FortressSiege.get_eventTime() > 0))
3251+ FortressSiege.autoEvent();
3252+ else
3253+ activeChar.sendMessage("Wrong usege: join time or event time invalid.");
3254+
3255+ showMainPage(activeChar);
3256+ }
3257+ else if (command.equals("admin_fos_save"))
3258+ {
3259+ FortressSiege.saveData();
3260+ showMainPage(activeChar);
3261+ }
3262+ else if (command.equals("admin_fos_dump"))
3263+ {
3264+ FortressSiege.dumpData();
3265+ showMainPage(activeChar);
3266+ }
3267+ else if (command.equals("admin_fos_pg2"))
3268+ {
3269+ showEditEventPage(activeChar);
3270+ }
3271+ else if (command.equals("admin_fos_pg3"))
3272+ {
3273+ showControlEventPage(activeChar);
3274+ }
3275+ return true;
3276+ }
3277+
3278+ @Override
3279+ public String[] getAdminCommandList()
3280+ {
3281+ return ADMIN_COMMANDS;
3282+ }
3283+
3284+ @SuppressWarnings("unused")
3285+ private boolean checkLevel(int level)
3286+ {
3287+ return level == 1;
3288+ }
3289+
3290+ public void showSiegeLoadPage(L2PcInstance activeChar, boolean autoLoad)
3291+ {
3292+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
3293+ TextBuilder replyMSG = new TextBuilder("<html><body>");
3294+ replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine ]</font></center><br><br><br>");
3295+ Connection con = null;
3296+ try
3297+ {
3298+ con = L2DatabaseFactory.getInstance().getConnection();
3299+ PreparedStatement statement = con.prepareStatement("Select * from fortress_siege");
3300+ ResultSet rs = statement.executeQuery();
3301+ String _eventName = "";
3302+ while (rs.next())
3303+ {
3304+ _eventName = rs.getString("eventName");
3305+ if ((autoLoad) && (Rnd.get(100) < 10))
3306+ {
3307+ statement.close();
3308+ break;
3309+ }
3310+ rs.getString("eventDesc");
3311+ rs.getString("joiningLocation");
3312+ rs.getInt("minlvl");
3313+ rs.getInt("maxlvl");
3314+ rs.getInt("npcId");
3315+ rs.getInt("npcX");
3316+ rs.getInt("npcY");
3317+ rs.getInt("npcZ");
3318+ rs.getInt("npcHeading");
3319+ rs.getInt("rewardId");
3320+ rs.getInt("rewardAmount");
3321+ rs.getInt("joinTime");
3322+ rs.getInt("eventTime");
3323+ rs.getInt("minPlayers");
3324+ rs.getInt("maxPlayers");
3325+ rs.getInt("centerX");
3326+ rs.getInt("centerY");
3327+ rs.getInt("centerZ");
3328+ rs.getString("team1Name");
3329+ rs.getInt("team1X");
3330+ rs.getInt("team1Y");
3331+ rs.getInt("team1Z");
3332+ rs.getInt("team1Color");
3333+ rs.getString("team2Name");
3334+ rs.getInt("team2X");
3335+ rs.getInt("team2Y");
3336+ rs.getInt("team2Z");
3337+ rs.getInt("team2Color");
3338+ rs.getInt("flagX");
3339+ rs.getInt("flagY");
3340+ rs.getInt("flagZ");
3341+ if ((FortressSiege._eventName != null) && (FortressSiege._eventName.equals(_eventName)))
3342+ {
3343+ replyMSG.append("<a action=\"bypass -h admin_fos_load " + _eventName + "\"><font color=\"FF0000\">" + _eventName + "</font><font color=\"LEVEL\"><-- *loaded*</font></a><br1>");
3344+ }
3345+ else
3346+ {
3347+ replyMSG.append("<a action=\"bypass -h admin_fos_load " + _eventName + "\"><font color=\"00FF00\">" + _eventName + "</font></a><br1>");
3348+ }
3349+ }
3350+ statement.close();
3351+ if (autoLoad)
3352+ {
3353+ FortressSiege.loadData(_eventName);
3354+ if (activeChar != null)
3355+ {
3356+ showMainPage(activeChar);
3357+ }
3358+ }
3359+ else
3360+ {
3361+ replyMSG.append("<center><button value=\"Back\" action=\"bypass -h admin_fos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
3362+ replyMSG.append("</body></html>");
3363+ adminReply.setHtml(replyMSG.toString());
3364+ if (activeChar != null)
3365+ {
3366+ activeChar.sendPacket(adminReply);
3367+ }
3368+ }
3369+ return;
3370+ }
3371+ catch (Exception e)
3372+ {
3373+ System.out.println("Exception: AdminFortressSiegeEngine.showSiegeLoadPage: " + e.getMessage());
3374+ }
3375+ finally
3376+ {
3377+ try
3378+ {
3379+ con.close();
3380+ }
3381+ catch (Exception e)
3382+ {
3383+ }
3384+ }
3385+ }
3386+
3387+ public void showEditEventPage(L2PcInstance activeChar)
3388+ {
3389+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
3390+ TextBuilder replyMSG = new TextBuilder("<html><body>");
3391+ try
3392+ {
3393+ replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine ]</font></center><br><br><br>");
3394+ replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
3395+ replyMSG.append("<table border=\"0\"><tr>");
3396+ replyMSG.append("<td width=\"100\"><button value=\"Name\" action=\"bypass -h admin_fos_name $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3397+ replyMSG.append("<td width=\"100\"><button value=\"Description\" action=\"bypass -h admin_fos_desc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3398+ replyMSG.append("<td width=\"100\"><button value=\"Join Location\" action=\"bypass -h admin_fos_join_loc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3399+ replyMSG.append("</tr></table><br><table><tr>");
3400+ replyMSG.append("<td width=\"100\"><button value=\"Max level\" action=\"bypass -h admin_fos_maxlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3401+ replyMSG.append("<td width=\"100\"><button value=\"Min level\" action=\"bypass -h admin_fos_minlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3402+ replyMSG.append("</tr></table><br><table><tr>");
3403+ replyMSG.append("<td width=\"100\"><button value=\"Max players\" action=\"bypass -h admin_fos_maxplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3404+ replyMSG.append("<td width=\"100\"><button value=\"Min players\" action=\"bypass -h admin_fos_minplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3405+ replyMSG.append("</tr></table><br><table><tr>");
3406+ replyMSG.append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_fos_npc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3407+ replyMSG.append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_fos_npc_pos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3408+ replyMSG.append("</tr></table><br><table><tr>");
3409+ replyMSG.append("<td width=\"100\"><button value=\"Reward\" action=\"bypass -h admin_fos_reward $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3410+ replyMSG.append("<td width=\"100\"><button value=\"Reward Amount\" action=\"bypass -h admin_fos_reward_amount $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3411+ replyMSG.append("</tr></table><br><table><tr>");
3412+ replyMSG.append("<td width=\"100\"><button value=\"Join Time\" action=\"bypass -h admin_fos_jointime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3413+ replyMSG.append("<td width=\"100\"><button value=\"Event Time\" action=\"bypass -h admin_fos_eventtime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3414+ replyMSG.append("</tr></table><br><table>Position:<br1><tr>");
3415+ replyMSG.append("<td width=\"100\"><button value=\"Siege Flag\" action=\"bypass -h admin_fos_team_flag\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3416+ replyMSG.append("<td width=\"100\"><button value=\"Central\" action=\"bypass -h admin_fos_team_cent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3417+ replyMSG.append("</tr></table><table><tr>");
3418+ replyMSG.append("<td width=\"100\"><button value=\"Team Name\" action=\"bypass -h admin_fos_teamname $input1 $input2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3419+ replyMSG.append("<td width=\"100\"><button value=\"Team Color\" action=\"bypass -h admin_fos_team_color $input1 $input2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3420+ replyMSG.append("<td width=\"100\"><button value=\"Team Pos\" action=\"bypass -h admin_fos_team_pos $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3421+ replyMSG.append("<td></td></tr></table><br>");
3422+ replyMSG.append("Doors: (target a door)<br1><table><tr>");
3423+ replyMSG.append("<td width=\"100\"><button value=\"Outer #1\" action=\"bypass -h admin_fos_door5\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3424+ replyMSG.append("<td width=\"100\"><button value=\"Outer #2\" action=\"bypass -h admin_fos_door6\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3425+ replyMSG.append("<td width=\"100\"><button value=\"Inner #1\" action=\"bypass -h admin_fos_door1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3426+ replyMSG.append("</tr></table><table><tr>");
3427+ replyMSG.append("<td width=\"100\"><button value=\"Inner #2\" action=\"bypass -h admin_fos_door2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3428+ replyMSG.append("<td width=\"100\"><button value=\"Inner #3\" action=\"bypass -h admin_fos_door3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3429+ replyMSG.append("<td width=\"100\"><button value=\"Inner #4\" action=\"bypass -h admin_fos_door4\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3430+ replyMSG.append("</tr></table><br>");
3431+ replyMSG.append("<center><button value=\"Back\" action=\"bypass -h admin_fos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
3432+ replyMSG.append("</body></html>");
3433+ adminReply.setHtml(replyMSG.toString());
3434+ activeChar.sendPacket(adminReply);
3435+ }
3436+ catch (Throwable t)
3437+ {
3438+ try
3439+ {
3440+ replyMSG.append("</body></html>");
3441+ adminReply.setHtml(replyMSG.toString());
3442+ activeChar.sendPacket(adminReply);
3443+ }
3444+ catch (Throwable e)
3445+ {
3446+ }
3447+ }
3448+ }
3449+
3450+ public void showControlEventPage(L2PcInstance activeChar)
3451+ {
3452+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
3453+ TextBuilder replyMSG = new TextBuilder("<html><body>");
3454+ try
3455+ {
3456+ replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine ]</font></center><br><br><br>");
3457+ replyMSG.append("<table border=\"0\"><tr>");
3458+ replyMSG.append("<td width=\"100\"><button value=\"Join\" action=\"bypass -h admin_fos_join\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3459+ replyMSG.append("<td width=\"100\"><button value=\"Teleport\" action=\"bypass -h admin_fos_teleport\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3460+ replyMSG.append("<td width=\"100\"><button value=\"Start\" action=\"bypass -h admin_fos_start\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3461+ replyMSG.append("</tr></table><table><tr>");
3462+ replyMSG.append("<td width=\"100\"><button value=\"Abort\" action=\"bypass -h admin_fos_abort\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3463+ replyMSG.append("<td width=\"100\"><button value=\"Finish\" action=\"bypass -h admin_fos_finish\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3464+ replyMSG.append("<td width=\"100\"><button value=\"Sit Force\" action=\"bypass -h admin_fos_sit\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3465+ replyMSG.append("</tr></table><br><table><tr>");
3466+ replyMSG.append("<td width=\"100\"><button value=\"Dump\" action=\"bypass -h admin_fos_dump\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3467+ replyMSG.append("</tr></table><br><br><table><tr>");
3468+ replyMSG.append("<td width=\"100\"><button value=\"Save\" action=\"bypass -h admin_fos_save\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3469+ replyMSG.append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_fos_load\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3470+ replyMSG.append("<td width=\"100\"><button value=\"Auto Event\" action=\"bypass -h admin_fos_autoevent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3471+ replyMSG.append("</tr></table><br><br><table><tr>");
3472+ replyMSG.append("<td width=\"100\"><button value=\"Tele>Team1\" action=\"bypass -h admin_fos_tele1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3473+ replyMSG.append("<td width=\"100\"><button value=\"Tele>Team2\" action=\"bypass -h admin_fos_tele2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3474+ replyMSG.append("<td width=\"100\"><button value=\"Tele>Artif\" action=\"bypass -h admin_fos_tele3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3475+ replyMSG.append("</tr><tr>");
3476+ replyMSG.append("<td width=\"100\"><button value=\"Tele>NPC\" action=\"bypass -h admin_fos_tele4\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
3477+ replyMSG.append("</table><br><center><button value=\"Back\" action=\"bypass -h admin_fos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>");
3478+ adminReply.setHtml(replyMSG.toString());
3479+ activeChar.sendPacket(adminReply);
3480+ }
3481+ catch (Throwable t)
3482+ {
3483+ try
3484+ {
3485+ replyMSG.append("</body></html>");
3486+ adminReply.setHtml(replyMSG.toString());
3487+ activeChar.sendPacket(adminReply);
3488+ }
3489+ catch (Throwable e)
3490+ {
3491+ }
3492+ }
3493+ }
3494+
3495+ public void showMainPage(L2PcInstance activeChar)
3496+ {
3497+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
3498+ TextBuilder replyMSG = new TextBuilder("<html><body>");
3499+ try
3500+ {
3501+ replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine ]</font></center><br><br><br>");
3502+ replyMSG.append("<table border=\"0\"><tr>");
3503+ replyMSG.append("<td width=\"100\"><button value=\"Edit\" action=\"bypass -h admin_fos_pg2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td></td>");
3504+ replyMSG.append("<td width=\"100\"><button value=\"Control\" action=\"bypass -h admin_fos_pg3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
3505+ replyMSG.append("</tr></table><br><br>");
3506+ replyMSG.append("Current event...<br1>");
3507+ replyMSG.append(" ... name: <font color=\"00FF00\">" + FortressSiege._eventName + "</font><br1>");
3508+ replyMSG.append(" ... description: <font color=\"00FF00\">" + FortressSiege._eventDesc + "</font><br1>");
3509+ replyMSG.append(" ... joining location name: <font color=\"00FF00\">" + FortressSiege._joiningLocationName + "</font><br1>");
3510+ replyMSG.append(" ... joining NPC ID: <font color=\"00FF00\">" + FortressSiege._npcId + " on pos " + FortressSiege._npcX + "," + FortressSiege._npcY + "," + FortressSiege._npcZ + "</font>");
3511+ replyMSG.append("<td width=\"100\"><button value=\"Tele>NPC\" action=\"bypass -h admin_fos_tele4\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><br1>");
3512+ replyMSG.append(" ... reward ID : <font color=\"00FF00\">" + FortressSiege._rewardId + "</font><br1>");
3513+ if (ItemTable.getInstance().getTemplate(FortressSiege._rewardId) != null)
3514+ {
3515+ replyMSG.append(" ... reward Item: <font color=\"00FF00\">" + ItemTable.getInstance().getTemplate(FortressSiege._rewardId).getName() + "</font><br1>");
3516+ }
3517+ else
3518+ {
3519+ replyMSG.append(" ... reward Item: <font color=\"00FF00\">(unknown)</font><br1>");
3520+ }
3521+ replyMSG.append(" ... reward Amount: <font color=\"00FF00\">" + FortressSiege._rewardAmount + "</font><br><br>");
3522+ replyMSG.append(" ... Min lvl: <font color=\"00FF00\">" + FortressSiege._minlvl + "</font><br1>");
3523+ replyMSG.append(" ... Max lvl: <font color=\"00FF00\">" + FortressSiege._maxlvl + "</font><br>");
3524+ replyMSG.append(" ... Min Players: <font color=\"00FF00\">" + FortressSiege._minPlayers + "</font><br1>");
3525+ replyMSG.append(" ... Max Players: <font color=\"00FF00\">" + FortressSiege._maxPlayers + "</font><br>");
3526+ replyMSG.append(" ... Joining Time: <font color=\"00FF00\">" + FortressSiege._joinTime + "</font><br1>");
3527+ replyMSG.append(" ... Event Time : <font color=\"00FF00\">" + FortressSiege._eventTime + "</font><br>");
3528+ replyMSG.append("Current teams:<br1>");
3529+ replyMSG.append("<center><table border=\"0\">");
3530+ if ((FortressSiege._teams != null) && (!FortressSiege._teams.isEmpty()))
3531+ {
3532+ for (String team : FortressSiege._teams)
3533+ {
3534+ replyMSG.append("<tr><td width=\"100\">Name:<font color=\"LEVEL\">" + team + "</font>");
3535+ if ((Config.FortressSiege_EVEN_TEAMS.equals("NO")) || (Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")))
3536+ {
3537+ replyMSG.append(" (" + FortressSiege._teamPlayersCount.get(FortressSiege._teams.indexOf(team)) + " joined)");
3538+ }
3539+ else if ((Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")) && ((FortressSiege.is_teleport()) || (FortressSiege.is_started())))
3540+ {
3541+ replyMSG.append(" (" + FortressSiege._teamPlayersCount.get(FortressSiege._teams.indexOf(team)) + " in)");
3542+ }
3543+ replyMSG.append("</td></tr><tr><td>");
3544+ String c = Integer.toHexString(((Integer) FortressSiege._teamColors.get(FortressSiege._teams.indexOf(team))).intValue());
3545+ while (c.length() < 6)
3546+ {
3547+ c = "0" + c;
3548+ }
3549+ replyMSG.append("Color: <font color=\"00FF00\">0x" + c.toUpperCase() + "</font><font color=\"" + c + "\"> 8D </font>");
3550+ replyMSG.append("</td></tr><tr><td>");
3551+ replyMSG.append("Position: <font color=\"00FF00\">(" + FortressSiege._teamsX.get(FortressSiege._teams.indexOf(team)) + ", " + FortressSiege._teamsY.get(FortressSiege._teams.indexOf(team)) + ", " + FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(team)) + ")</font>");
3552+ replyMSG.append("</td></tr><tr>");
3553+ if (team.equals(FortressSiege._teams.get(0)))
3554+ {
3555+ replyMSG.append("<td width=\"100\"><button value=\"Tele>Team1\" action=\"bypass -h admin_fos_tele1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
3556+ }
3557+ if (team.equals(FortressSiege._teams.get(1)))
3558+ {
3559+ replyMSG.append("<td width=\"100\"><button value=\"Tele>Team2\" action=\"bypass -h admin_fos_tele2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
3560+ }
3561+ }
3562+ }
3563+ replyMSG.append("<tr><td>Artifact: <font color=\"00FF00\">(" + FortressSiege._flagX + ", " + FortressSiege._flagY + ", " + FortressSiege._flagZ + ")</font></td></tr>");
3564+ replyMSG.append("<tr><td width=\"100\"><button value=\"Tele>Artif\" action=\"bypass -h admin_fos_tele3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
3565+ replyMSG.append("<tr><td>Center Room: <font color=\"00FF00\">(" + FortressSiege.eventCenterX + ", " + FortressSiege.eventCenterY + ", " + FortressSiege.eventCenterZ + ")</font></td></tr>");
3566+ replyMSG.append("<tr><td>Fortress Door Ids: <font color=\"00FF00\">(" + FortressSiege._door[4] + ", " + FortressSiege._door[5] + ")</font></td></tr>");
3567+ replyMSG.append("<tr><td>Inner Door Ids : </td></tr>");
3568+ replyMSG.append("<tr><td><font color=\"00FF00\">(" + FortressSiege._door[0] + ", " + FortressSiege._door[1] + "),</td></tr>");
3569+ replyMSG.append("<tr><td>(" + FortressSiege._door[2] + ", " + FortressSiege._door[3] + ")</font></td></tr>");
3570+ replyMSG.append("</table></center>");
3571+ if ((Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")) && (FortressSiege.is_joining()))
3572+ {
3573+ replyMSG.append("<br1>");
3574+ replyMSG.append(FortressSiege._playersShuffle.size() + " players participating. Waiting to shuffle teams (done on teleport)");
3575+ replyMSG.append("<br><br>");
3576+ }
3577+ replyMSG.append("</body></html>");
3578+ adminReply.setHtml(replyMSG.toString());
3579+ activeChar.sendPacket(adminReply);
3580+ }
3581+ catch (Throwable t)
3582+ {
3583+ try
3584+ {
3585+ replyMSG.append("</body></html>");
3586+ adminReply.setHtml(replyMSG.toString());
3587+ activeChar.sendPacket(adminReply);
3588+ }
3589+ catch (Throwable e)
3590+ {
3591+ }
3592+ }
3593+ }
3594+}
3595
3596===============================================================================
3597head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ArtefactInstance.java
3598===============================================================================
3599
3600
3601@Override
3602 public void onAction(final L2PcInstance player)
3603 {
3604+ if (_isFOS_Artifact && player._inEventFOS)
3605 {
3606 super.onAction(player);
3607 return;
3608 }
3609 if (!canTarget(player))
3610 return;
3611
3612
3613
3614===============================================================================
3615head-src/com/l2jfrozen/gameserver/model/actor/appearance/PcAppearance.java
3616===============================================================================
3617
3618
3619
3620
3621
3622/** The hexadecimal Color of players name (white is 0xFFFFFF) */
3623 private int _titleColor = 0xFFFF77;
3624+ protected Object _originalTitleFOS;
3625
3626 // =========================================================
3627 // Constructor
3628 public PcAppearance(final byte Face, final byte HColor, final byte HStyle, final boolean Sex)
3629
3630
3631
3632===============================================================================
3633head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
3634===============================================================================
3635import com.l2jfrozen.gameserver.model.entity.event.L2Event;
3636+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
3637import com.l2jfrozen.gameserver.model.entity.event.Lottery;
3638
3639
3640/** The castle index in the array of L2Castle this L2NpcInstance belongs to. */
3641 private int _castleIndex = -2;
3642
3643 /** The fortress index in the array of L2Fort this L2NpcInstance belongs to. */
3644 private int _fortIndex = -2;
3645
3646- public boolean isEventMob = false, _isEventMobTvT = false, _isEventVIPNPC = false, _isEventVIPNPCEnd = false, _isEventMobDM = false, _isEventMobCTF = false, _isCTF_throneSpawn = false, _isCTF_Flag = false;
3647+ public boolean isEventMob = false, _isEventMobFOS = false, _isFOS_Artifact = false, _isEventMobTvT = false, _isEventVIPNPC = false, _isEventVIPNPCEnd = false, _isEventMobDM = false, _isEventMobCTF = false, _isCTF_throneSpawn = false, _isCTF_Flag = false;
3648
3649 /** The _is in town. */
3650 private boolean _isInTown = false;
3651
3652 /** The _ ct f_ flag team name. */
3653 public String _CTF_FlagTeamName;
3654
3655
3656
3657
3658 if (player.isSitting() || player.isDead() || player.isFakeDeath() || player.getActiveTradeList() != null)
3659 return;
3660
3661 // Send a Server->Client packet SocialAction to the all L2PcInstance on the _knownPlayer of the L2NpcInstance to display a social action of the L2NpcInstance on their client
3662 final SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
3663 broadcastPacket(sa);
3664 // Open a chat window on client with the text of the L2NpcInstance
3665 if (isEventMob)
3666 {
3667 L2Event.showEventHtml(player, String.valueOf(getObjectId()));
3668 }
3669+ else if (_isEventMobFOS)
3670+ {
3671+ FortressSiege.showEventHtml(player, String.valueOf(this.getObjectId()));
3672+ }
3673+ else if (_isFOS_Artifact)
3674+ {
3675+ FortressSiege.showArtifactHtml(player, String.valueOf(getObjectId()));
3676+ }
3677 else if (_isEventMobTvT)
3678 {
3679 TvT.showEventHtml(player, String.valueOf(getObjectId()));
3680 }
3681 else if (_isEventMobDM)
3682 {
3683 DM.showEventHtml(player, String.valueOf(this.getObjectId()));
3684 }
3685
3686
3687 // Send a Server->Client packet SocialAction to the all L2PcInstance on the _knownPlayer of the L2NpcInstance to display a social action of the L2NpcInstance on their client
3688 final SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
3689 broadcastPacket(sa);
3690 // Open a chat window on client with the text of the L2NpcInstance
3691 if (isEventMob)
3692 {
3693 L2Event.showEventHtml(player, String.valueOf(getObjectId()));
3694 }
3695+ else if (_isEventMobFOS)
3696+ {
3697+ FortressSiege.showEventHtml(player, String.valueOf(this.getObjectId()));
3698+ }
3699+ else if (_isFOS_Artifact)
3700+ {
3701+ FortressSiege.showArtifactHtml(player, String.valueOf(getObjectId()));
3702+ }
3703 else if (_isEventMobTvT)
3704 {
3705 TvT.showEventHtml(player, String.valueOf(getObjectId()));
3706 }
3707
3708
3709===============================================================================
3710
3711===============================================================================
3712import com.l2jfrozen.gameserver.model.base.SubClass;
3713import com.l2jfrozen.gameserver.model.entity.Announcements;
3714import com.l2jfrozen.gameserver.model.entity.Duel;
3715+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
3716
3717
3718
3719@Override
3720 public void doAttack(final L2Character target)
3721 {
3722 if (isInsidePeaceZone(L2PcInstance.this, target))
3723 {
3724 sendPacket(ActionFailed.STATIC_PACKET);
3725 return;
3726 }
3727
3728 // during teleport phase, players cant do any attack
3729- if ((TvT.is_teleport() && _inEventTvT) || (CTF.is_teleport() && _inEventCTF) || (DM.is_teleport() && _inEventDM))
3730+ if ((TvT.is_teleport() && _inEventTvT) || (FortressSiege.is_teleport() && _inEventFOS) || (CTF.is_teleport() && _inEventCTF) || (DM.is_teleport() && _inEventDM))
3731 {
3732 sendPacket(ActionFailed.STATIC_PACKET);
3733 return;
3734 }
3735
3736 // Pk protection config
3737 if (!isGM() && target instanceof L2PcInstance && ((L2PcInstance) target).getPvpFlag() == 0 && ((L2PcInstance) target).getKarma() == 0 && (getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL || target.getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL))
3738 {
3739 sendMessage("You can't hit a player that is lower level from you. Target's level: " + String.valueOf(Config.ALT_PLAYER_PROTECTION_LEVEL) + ".");
3740 sendPacket(ActionFailed.STATIC_PACKET);
3741 return;
3742 }
3743
3744 // Like L2OFF you can use cupid bow skills on peace zone
3745 // Like L2OFF players can use TARGET_AURA skills on peace zone, all targets will be ignored.
3746 if (skill.isOffensive() && (isInsidePeaceZone(L2PcInstance.this, getTarget()) && skill.getTargetType() != SkillTargetType.TARGET_AURA) && (skill.getId() != 3261 && skill.getId() != 3260 && skill.getId() != 3262)) // check limited to active target
3747 {
3748 sendPacket(ActionFailed.STATIC_PACKET);
3749 return;
3750
3751 }
3752
3753 // during teleport phase, players cant do any attack
3754- if ((TvT.is_teleport() && _inEventTvT) || (CTF.is_teleport() && _inEventCTF) || (DM.is_teleport() && _inEventDM))
3755+ if ((TvT.is_teleport() && _inEventTvT) || (FortressSiege.is_teleport() && _inEventFOS) || (CTF.is_teleport() && _inEventCTF) || (DM.is_teleport() && _inEventDM))
3756 {
3757 sendPacket(ActionFailed.STATIC_PACKET);
3758 return;
3759 }
3760
3761 super.doCast(skill);
3762
3763/** The _in event tv t. */
3764 public boolean _inEventTvT = false;
3765 //
3766+ /** FortressSiege Engine parameters. */
3767+ public String _teamNameFOS, _originalTitleFOS;
3768+
3769+ /** The _original karma FortressSiege. */
3770+ public int _originalNameColorFOS = 0, _countFOSkills, _countFOSdies, _originalKarmaFOS;
3771+
3772+ /** The _in event FortressSiege. */
3773+ public boolean _inEventFOS, _FOSRulerSkills = false;
3774
3775 /** CTF Engine parameters. */
3776 public String _teamNameCTF, _teamNameHaveFlagCTF, _originalTitleCTF;
3777
3778
3779
3780 if (L2Event.active && eventSitForced)
3781 {
3782 sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
3783 }
3784+ else if (FortressSiege._sitForced && _inEventFOS)
3785+ {
3786+ sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
3787+ }
3788 else if ((TvT.is_sitForced() && _inEventTvT) || (CTF.is_sitForced() && _inEventCTF) || (DM.is_sitForced() && _inEventDM))
3789 {
3790 sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
3791 }
3792 else if (VIP._sitForced && _inEventVIP)
3793
3794
3795
3796
3797 * @param player The player that start an action on this L2PcInstance
3798 */
3799 @Override
3800 public void onAction(final L2PcInstance player)
3801 {
3802 // if ((TvT._started && !Config.TVT_ALLOW_INTERFERENCE) || (CTF._started && !Config.CTF_ALLOW_INTERFERENCE) || (DM._started && !Config.DM_ALLOW_INTERFERENCE))
3803 // no Interaction with not participant to events
3804 if (((TvT.is_started() || TvT.is_teleport()) && !Config.TVT_ALLOW_INTERFERENCE) || ((CTF.is_started() || CTF.is_teleport()) && !Config.CTF_ALLOW_INTERFERENCE) || ((FortressSiege.is_started() && !Config.FortressSiege_ALLOW_INTERFERENCE)) || ((DM.is_started() || DM.is_teleport()) && !Config.DM_ALLOW_INTERFERENCE))
3805 {
3806 if ((_inEventTvT && !player._inEventTvT) || (!_inEventTvT && player._inEventTvT))
3807 {
3808 player.sendPacket(ActionFailed.STATIC_PACKET);
3809 return;
3810 }
3811+ else if ((_inEventFOS && !player._inEventFOS) || (!_inEventFOS && player._inEventFOS))
3812+
3813+ {
3814+ player.sendPacket(ActionFailed.STATIC_PACKET);
3815+ return;
3816+ }
3817
3818 else if ((_inEventCTF && !player._inEventCTF) || (!_inEventCTF && player._inEventCTF))
3819
3820
3821
3822
3823
3824 // Like L2OFF set the target of the L2PcInstance player
3825 {
3826- if (((TvT.is_started() || TvT.is_teleport()) && !Config.TVT_ALLOW_INTERFERENCE) || ((CTF.is_started() || CTF.is_teleport()) && !Config.CTF_ALLOW_INTERFERENCE) || ((DM.is_started() || DM.is_teleport()) && !Config.DM_ALLOW_INTERFERENCE))
3827+ if (((TvT.is_started() || TvT.is_teleport()) && !Config.TVT_ALLOW_INTERFERENCE) || ((FortressSiege.is_started() || FortressSiege.is_teleport()) && !Config.FortressSiege_ALLOW_INTERFERENCE) || ((CTF.is_started() || CTF.is_teleport()) && !Config.CTF_ALLOW_INTERFERENCE) || ((DM.is_started() || DM.is_teleport()) && !Config.DM_ALLOW_INTERFERENCE))
3828 {
3829 if ((_inEventTvT && !player._inEventTvT) || (!_inEventTvT && player._inEventTvT))
3830 {
3831 player.sendPacket(ActionFailed.STATIC_PACKET);
3832 return;
3833 }
3834+ if ((_inEventFOS && !player._inEventFOS) || (!_inEventFOS && player._inEventFOS))
3835+ {
3836+ player.sendPacket(ActionFailed.STATIC_PACKET);
3837+ return;
3838+ }
3839 else if ((_inEventCTF && !player._inEventCTF) || (!_inEventCTF && player._inEventCTF))
3840 {
3841 player.sendPacket(ActionFailed.STATIC_PACKET);
3842 return;
3843 }
3844 else if ((_inEventDM && !player._inEventDM) || (!_inEventDM && player._inEventDM))
3845 {
3846 player.sendPacket(ActionFailed.STATIC_PACKET);
3847 return;
3848 }
3849 }
3850 // Check if the L2PcInstance is confused
3851 if (player.isOutOfControl())
3852
3853
3854
3855
3856
3857 public boolean isInFunEvent()
3858 {
3859- return (atEvent || isInStartedTVTEvent() || isInStartedDMEvent() || isInStartedCTFEvent() || isInStartedVIPEvent());
3860+ return (atEvent || isInStartedTVTEvent() || isInStartedFortressSiegeEvent() || isInStartedDMEvent() || isInStartedCTFEvent() || isInStartedVIPEvent());
3861 }
3862
3863+ public boolean isInStartedFortressSiegeEvent()
3864+ {
3865+ return (FortressSiege.is_started() && _inEventFOS);
3866+ }
3867+
3868+ public boolean isRegisteredInFortressSiegeEvent()
3869+ {
3870+ return _inEventFOS;
3871+ }
3872
3873 public boolean isInStartedTVTEvent()
3874 {
3875 return (TvT.is_started() && _inEventTvT);
3876 }
3877
3878
3879 /**
3880 * Checks if is registered in fun event.
3881 * @return true, if is registered in fun event
3882 */
3883 public boolean isRegisteredInFunEvent()
3884 {
3885- return (atEvent || (_inEventTvT) || (_inEventDM) || (_inEventCTF) || (_inEventVIP) || Olympiad.getInstance().isRegistered(this));
3886+ return (atEvent || (_inEventFOS) || (_inEventTvT) || (_inEventDM) || (_inEventCTF) || (_inEventVIP) || Olympiad.getInstance().isRegistered(this));
3887 }
3888
3889
3890
3891
3892
3893 if (killer != null)
3894 {
3895 final L2PcInstance pk = killer.getActingPlayer();
3896 if (pk != null)
3897 {
3898 if (Config.ENABLE_PK_INFO)
3899 {
3900 doPkInfo(pk);
3901 }
3902
3903 if (atEvent)
3904 {
3905 pk.kills.add(getName());
3906 }
3907
3908+ if ((pk instanceof L2PcInstance && ((L2PcInstance) pk)._inEventFOS) && _inEventFOS)
3909+ {
3910+ if (_inEventFOS && pk._inEventFOS)
3911+ {
3912+ if (FortressSiege.is_teleport() || FortressSiege.is_started())
3913+
3914+ {
3915+ if (!(pk._teamNameFOS.equals(_teamNameFOS)))
3916+ {
3917+ final PlaySound ps = new PlaySound(0, "ItemSound.quest_itemget", 1, getObjectId(), getX(), getY(), getZ());
3918+ _countFOSdies++;
3919+ pk._countFOSkills++;
3920+ pk.setTitle("Kills: " + pk._countFOSkills);
3921+ pk.sendPacket(ps);
3922+ pk.broadcastUserInfo();
3923+ FortressSiege.setTeamKillsCount(pk._teamNameFOS, FortressSiege.teamKillsCount(pk._teamNameFOS) + 1);
3924+ pk.broadcastUserInfo();
3925+ }
3926+ else
3927+ {
3928+ pk.sendMessage("You are a teamkiller !!! Teamkills not counting.");
3929+ }
3930+ sendMessage("You will be revived and teleported to team spot in " + Config.FortressSiege_REVIVE_DELAY / 1000 + " seconds!");
3931+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
3932+ {
3933+ @Override
3934+ public void run()
3935+ {
3936+ teleToLocation(FortressSiege._teamsX.get(FortressSiege._teams.indexOf(_teamNameFOS)) + Rnd.get(201) - 100, FortressSiege._teamsY.get(FortressSiege._teams.indexOf(_teamNameFOS)) + Rnd.get(201) - 100, FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(_teamNameFOS)), false);
3937+ doRevive();
3938+ }
3939+ }, Config.FortressSiege_REVIVE_DELAY);
3940+ }
3941+ }
3942+ else if (_inEventFOS)
3943+ {
3944+ if (FortressSiege.is_teleport() || FortressSiege.is_started())
3945+ {
3946+ sendMessage("You will be revived and teleported to team spot in " + Config.TVT_REVIVE_DELAY / 1000 + " seconds!");
3947+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
3948+ {
3949+ @Override
3950+ public void run()
3951+ {
3952+ teleToLocation(FortressSiege._teamsX.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsY.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(_teamNameFOS)), false);
3953+ doRevive();
3954+ broadcastPacket(new SocialAction(getObjectId(), 15));
3955+ }
3956+ }, Config.FortressSiege_REVIVE_DELAY);
3957+ }
3958+ }
3959+ }
3960+
3961 if (_inEventTvT && pk._inEventTvT)
3962 {
3963 if (TvT.is_teleport() || TvT.is_started())
3964
3965
3966private void onDieDropItem(final L2Character killer)
3967 {
3968- if (atEvent || (TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP) || killer == null)
3969+ if (atEvent || (FortressSiege.is_started() && _inEventFOS) || (TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP) || killer == null)
3970 return;
3971
3972 if (getKarma() <= 0 && killer instanceof L2PcInstance && ((L2PcInstance) killer).getClan() != null && getClan() != null && ((L2PcInstance) killer).getClan().isAtWarWith(getClanId()))
3973 // || this.getClan().isAtWarWith(((L2PcInstance)killer).getClanId()))
3974 return;
3975
3976 if (!isInsideZone(ZONE_PVP) && (!isGM() || Config.KARMA_DROP_GM))
3977
3978
3979public void onKillUpdatePvPKarma(final L2Character target)
3980 {
3981 if (target == null)
3982 return;
3983
3984 if (!(target instanceof L2PlayableInstance))
3985 return;
3986- if ((_inEventCTF && CTF.is_started()) || (_inEventTvT && TvT.is_started()) || (_inEventVIP && VIP._started) || (_inEventDM && DM.is_started()))
3987+ if ((_inEventCTF && CTF.is_started()) || (_inEventFOS && FortressSiege.is_started()) || (_inEventTvT && TvT.is_started()) || (_inEventVIP && VIP._started) || (_inEventDM && DM.is_started()))
3988 return;
3989
3990 if (isCursedWeaponEquipped())
3991
3992
3993
3994 // 'No war' or 'One way war' -> 'Normal PK'
3995- if (!(_inEventTvT && TvT.is_started()) || !(_inEventCTF && CTF.is_started()) || !(_inEventVIP && VIP._started) || !(_inEventDM && DM.is_started()))
3996+ if (!(_inEventTvT && TvT.is_started()) || !(_inEventFOS && FortressSiege.is_started()) || !(_inEventCTF && CTF.is_started()) || !(_inEventVIP && VIP._started) || !(_inEventDM && DM.is_started()))
3997 {
3998 if (targetPlayer.getKarma() > 0) // Target player has karma
3999 {
4000 if (Config.KARMA_AWARD_PK_KILL)
4001 {
4002 increasePvpKills();
4003 }
4004
4005
4006
4007 getInventory().addItem("TownWar", Config.TW_ITEM_ID, Config.TW_ITEM_AMOUNT, this, this);
4008 sendMessage("You received your prize for a town war kill!");
4009 }
4010 }
4011- if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP))
4012+ if ((TvT.is_started() && _inEventTvT) || (FortressSiege.is_started() && _inEventFOS) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP))
4013 return;
4014
4015 // Add karma to attacker and increase its PK counter
4016
4017
4018
4019 * @param targLVL : level of the killed player
4020 */
4021 public void increasePkKillsAndKarma(final int targLVL)
4022 {
4023- if ((TvT.is_started() && _inEventTvT) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP))
4024+ if ((TvT.is_started() && _inEventTvT) || (FortressSiege.is_started() && _inEventFOS) || (DM.is_started() && _inEventDM) || (CTF.is_started() && _inEventCTF) || (VIP._started && _inEventVIP))
4025 return;
4026
4027 final int baseKarma = Config.KARMA_MIN_KARMA;
4028
4029
4030 /**
4031 * Update pvp status.
4032 */
4033 public void updatePvPStatus()
4034 {
4035- if ((TvT.is_started() && _inEventTvT) || (CTF.is_started() && _inEventCTF) || (DM.is_started() && _inEventDM) || (VIP._started && _inEventVIP))
4036+ if ((TvT.is_started() && _inEventTvT) || (FortressSiege.is_started() && _inEventFOS) || (CTF.is_started() && _inEventCTF) || (DM.is_started() && _inEventDM) || (VIP._started && _inEventVIP))
4037 return;
4038
4039 if (isInsideZone(ZONE_PVP))
4040 return;
4041
4042 setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
4043
4044
4045
4046
4047 else if (target instanceof L2Summon)
4048 {
4049 player_target = ((L2Summon) target).getOwner();
4050 }
4051
4052 if (player_target == null)
4053 return;
4054- if ((TvT.is_started() && _inEventTvT && player_target._inEventTvT) || (DM.is_started() && _inEventDM && player_target._inEventDM) || (CTF.is_started() && _inEventCTF && player_target._inEventCTF) || (VIP._started && _inEventVIP && player_target._inEventVIP))
4055+ if ((TvT.is_started() && _inEventTvT && player_target._inEventTvT) || (_inEventFOS && FortressSiege.is_started() && player_target._inEventFOS) || (DM.is_started() && _inEventDM && player_target._inEventDM) || (CTF.is_started() && _inEventCTF && player_target._inEventCTF) || (VIP._started && _inEventVIP && player_target._inEventVIP))
4056 return;
4057
4058 if (isInDuel() && player_target.getDuelId() == getDuelId())
4059 if (getPvpFlag() == 0)
4060
4061
4062 // Calculate the Experience loss
4063 long lostExp = 0;
4064- if (!atEvent && !(_inEventTvT && TvT.is_started()) && !(_inEventDM && DM.is_started()) && !(_inEventCTF && CTF.is_started()) && !(_inEventVIP && VIP._started))
4065+ if (!atEvent && !(_inEventFOS && FortressSiege.is_started()) && !(_inEventTvT && TvT.is_started()) && !(_inEventDM && DM.is_started()) && !(_inEventCTF && CTF.is_started()) && !(_inEventVIP && VIP._started))
4066 {
4067 final byte maxLvl = ExperienceData.getInstance().getMaxLevel();
4068 if (lvl < maxLvl)
4069 {
4070 lostExp = Math.round((getStat().getExpForLevel(lvl + 1) - getStat().getExpForLevel(lvl)) * percentLost / 100);
4071 }
4072 else
4073 {
4074 lostExp = Math.round((getStat().getExpForLevel(maxLvl) - getStat().getExpForLevel(maxLvl - 1)) * percentLost / 100);
4075 }
4076
4077 if (player.isInFunEvent())
4078 {
4079
4080 // checks for events
4081- if ((_inEventTvT && player._inEventTvT && TvT.is_started() && !_teamNameTvT.equals(player._teamNameTvT)) || (_inEventCTF && player._inEventCTF && CTF.is_started() && !_teamNameCTF.equals(player._teamNameCTF)) || (_inEventDM && player._inEventDM && DM.is_started()) || (_inEventVIP && player._inEventVIP && VIP._started))
4082+ if ((_inEventTvT && player._inEventTvT && TvT.is_started() && !_teamNameTvT.equals(player._teamNameTvT)) || (_inEventFOS && player._inEventFOS && FortressSiege.is_started() && !_teamNameFOS.equals(player._teamNameFOS)) || (_inEventCTF && player._inEventCTF && CTF.is_started() && !_teamNameCTF.equals(player._teamNameCTF)) || (_inEventDM && player._inEventDM && DM.is_started()) || (_inEventVIP && player._inEventVIP && VIP._started))
4083 {
4084 return true;
4085 }
4086 return false;
4087 }
4088 return false;
4089 }
4090 }
4091
4092 if (L2Character.isInsidePeaceZone(attacker, this))
4093
4094
4095
4096if (skill.isOffensive() && target instanceof L2DoorInstance)
4097 {
4098 final boolean isCastle = (((L2DoorInstance) target).getCastle() != null && ((L2DoorInstance) target).getCastle().getCastleId() > 0 && ((L2DoorInstance) target).getCastle().getSiege().getIsInProgress());
4099- final boolean isFort = (((L2DoorInstance) target).getFort() != null && ((L2DoorInstance) target).getFort().getFortId() > 0 && ((L2DoorInstance) target).getFort().getSiege().getIsInProgress());
4100+ final boolean isFort = (((L2DoorInstance) target).getFort() != null && ((L2DoorInstance) target).getFort().getFortId() > 0 && (_inEventFOS && FortressSiege.is_started()) || ((L2DoorInstance) target).getFort().getSiege().getIsInProgress());
4101 if ((!isCastle && !isFort))
4102 return;
4103
4104// Check if a Forced ATTACK is in progress on non-attackable target
4105 // if (!target.isAutoAttackable(this) && !forceUse && !(_inEventTvT && TvT._started) && !(_inEventDM && DM._started) && !(_inEventCTF && CTF._started) && !(_inEventVIP && VIP._started)
4106- if (!target.isAutoAttackable(this) && (!forceUse && (skill.getId() != 3261 && skill.getId() != 3260 && skill.getId() != 3262)) && !(_inEventTvT && TvT.is_started()) && !(_inEventDM && DM.is_started()) && !(_inEventCTF && CTF.is_started()) && !(_inEventVIP && VIP._started) && sklTargetType != SkillTargetType.TARGET_AURA && sklTargetType != SkillTargetType.TARGET_CLAN && sklTargetType != SkillTargetType.TARGET_ALLY && sklTargetType != SkillTargetType.TARGET_PARTY && sklTargetType != SkillTargetType.TARGET_SELF && sklTargetType != SkillTargetType.TARGET_GROUND)
4107+ if (!target.isAutoAttackable(this) && (!forceUse && (skill.getId() != 3261 && skill.getId() != 3260 && skill.getId() != 3262)) && !(_inEventFOS && FortressSiege.is_started()) && !(_inEventTvT && TvT.is_started()) && !(_inEventDM && DM.is_started()) && !(_inEventCTF && CTF.is_started()) && !(_inEventVIP && VIP._started) && sklTargetType != SkillTargetType.TARGET_AURA && sklTargetType != SkillTargetType.TARGET_CLAN && sklTargetType != SkillTargetType.TARGET_ALLY && sklTargetType != SkillTargetType.TARGET_PARTY && sklTargetType != SkillTargetType.TARGET_SELF && sklTargetType != SkillTargetType.TARGET_GROUND)
4108
4109 {
4110 // Send a Server->Client packet ActionFailed to the L2PcInstance
4111 sendPacket(ActionFailed.STATIC_PACKET);
4112 return;
4113 }
4114
4115 * @return False if the skill is a pvpSkill and target is not a valid pvp target
4116 */
4117 public boolean checkPvpSkill(final L2Object target, final L2Skill skill)
4118 {
4119+ if ((_inEventFOS && FortressSiege.is_started()))
4120+ return true;
4121 return checkPvpSkill(target, skill, false);
4122 }
4123
4124
4125public boolean checkPvpSkill(L2Object target, final L2Skill skill, final boolean srcIsSummon)
4126 {
4127 // Check if player and target are in events and on the same team.
4128 if (target instanceof L2PcInstance)
4129 {
4130- if (skill.isOffensive() && (_inEventTvT && ((L2PcInstance) target)._inEventTvT && TvT.is_started() && !_teamNameTvT.equals(((L2PcInstance) target)._teamNameTvT)) || (_inEventCTF && ((L2PcInstance) target)._inEventCTF && CTF.is_started() && !_teamNameCTF.equals(((L2PcInstance) target)._teamNameCTF)) || (_inEventDM && ((L2PcInstance) target)._inEventDM && DM.is_started()) || (_inEventVIP && ((L2PcInstance) target)._inEventVIP && VIP._started))
4131+ if (skill.isOffensive() && (_inEventTvT && ((L2PcInstance) target)._inEventTvT && TvT.is_started() && !_teamNameTvT.equals(((L2PcInstance) target)._teamNameTvT)) || (_inEventFOS && ((L2PcInstance) target)._inEventFOS && FortressSiege.is_started() && !_teamNameFOS.equals(((L2PcInstance) target)._teamNameFOS)) || (_inEventCTF && ((L2PcInstance) target)._inEventCTF && CTF.is_started() && !_teamNameCTF.equals(((L2PcInstance) target)._teamNameCTF)) || (_inEventDM && ((L2PcInstance) target)._inEventDM && DM.is_started()) || (_inEventVIP && ((L2PcInstance) target)._inEventVIP && VIP._started))
4132 {
4133 return true;
4134 }
4135 else if (isInFunEvent() && skill.isOffensive()) // same team return false
4136
4137
4138
4139public boolean isNoble()
4140 {
4141 return _noble;
4142 }
4143
4144+ public boolean checkFOS()
4145+ {
4146+ return FortressSiege.checkIfOkToCastSealOfRule(this);
4147+ }
4148
4149 public Map<Integer, L2Skill> returnSkills()
4150 {
4151 return _skills;
4152 }
4153
4154
4155public Map<Integer, L2Skill> returnSkills()
4156 {
4157 return _skills;
4158 }
4159
4160+ public void updateFOSTitleFlag()
4161+ {
4162+ FortressSiege.setTitleSiegeFlags(this);
4163+ }
4164
4165 /**
4166 * Sets the noble.
4167 * @param val the new noble
4168
4169
4170- if ((_inEventTvT && TvT.is_started() && Config.TVT_REVIVE_RECOVERY) || (_inEventCTF && CTF.is_started() && Config.CTF_REVIVE_RECOVERY) || (_inEventDM && DM.is_started() && Config.DM_REVIVE_RECOVERY))
4171+ if ((_inEventTvT && TvT.is_started() && Config.TVT_REVIVE_RECOVERY) || (_inEventFOS && FortressSiege.is_started() && Config.FortressSiege_REVIVE_RECOVERY) || (_inEventCTF && CTF.is_started() && Config.CTF_REVIVE_RECOVERY) || (_inEventDM && DM.is_started() && Config.DM_REVIVE_RECOVERY))
4172 {
4173 getStatus().setCurrentHp(getMaxHp());
4174 getStatus().setCurrentMp(getMaxMp());
4175 getStatus().setCurrentCp(getMaxCp());
4176 }
4177 }
4178
4179
4180
4181else if (_inEventTvT)
4182 {
4183 TvT.onDisconnect(this);
4184 }
4185+ else if (_inEventFOS)
4186+ {
4187+ FortressSiege.onDisconnect(this);
4188+ }
4189 else if (_inEventVIP)
4190 {
4191 VIP.onDisconnect(this)
4192
4193
4194=================================================================================================
4195com.l2jfrozen.gameserver.model.CursedWeapon.java
4196=================================================================================================
4197import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4198+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4199import com.l2jfrozen.gameserver.model.entity.event.CTF;
4200
4201 if (player._inEventTvT)
4202 TvT.removePlayer(player);
4203 }
4204
4205+ if ((player._inEventFOS && !Config.FortressSiege_JOIN_CURSED))
4206+ {
4207+ if (player._inEventFOS)
4208+ FortressSiege.removePlayer(player);
4209+ }
4210
4211 if ((player._inEventCTF && !Config.CTF_JOIN_CURSED))
4212
4213==================================================================================================
4214com.l2jfrozen.gameserver.model.L2Character.java
4215==================================================================================================
4216import com.l2jfrozen.gameserver.model.entity.Duel;
4217+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4218import com.l2jfrozen.gameserver.model.entity.event.CTF;
4219
4220
4221
4222if (_isPendingRevive)
4223 {
4224 doRevive();
4225 }
4226+ if (FortressSiege.is_started() && (this instanceof L2PcInstance) && ((L2PcInstance) this)._inEventFOS)
4227+ FortressSiege.setTitleSiegeFlags((L2PcInstance) this);
4228 final L2Summon pet = getPet();
4229
4230 if (Config.TVT_REMOVE_BUFFS_ON_DIE)
4231 stopAllEffects();
4232 }
4233+ else if (player._inEventFOS && FortressSiege.is_started())
4234+ {
4235+ if (Config.FortressSiege_REMOVE_BUFFS_ON_DIE)
4236+ stopAllEffects();
4237+ }
4238 else if (player._inEventCTF && CTF.is_started())
4239 {
4240 if (Config.CTF_REMOVE_BUFFS_ON_DIE)
4241
4242
4243
4244 ((L2PcInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
4245 return;
4246 }
4247- else if ((TvT.is_sitForced() && ((L2PcInstance) this)._inEventTvT) || (CTF.is_sitForced() && ((L2PcInstance) this)._inEventCTF) || (DM.is_sitForced() && ((L2PcInstance) this)._inEventDM))
4248+ else if ((TvT.is_sitForced() && ((L2PcInstance) this)._inEventTvT) || (FortressSiege.is_sitForced() && ((L2PcInstance) this)._inEventFOS) || (CTF.is_sitForced() && ((L2PcInstance) this)._inEventCTF) || (DM.is_sitForced() && ((L2PcInstance) this)._inEventDM))
4249 {
4250 ((L2PcInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
4251 ((L2PcInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
4252 return;
4253 }
4254 else if (VIP._sitForced && ((L2PcInstance) this)._inEventVIP)
4255
4256
4257
4258 ((L2Attackable) player).overhitEnabled(true);
4259 }
4260
4261 player = null;
4262 }
4263 }
4264
4265
4266+ if (skill.getTargetType() == SkillTargetType.TARGET_HOLY && this instanceof L2PcInstance && FortressSiege.checkIfOkToCastSealOfRule((L2PcInstance) this))
4267+ {
4268+ FortressSiege.Announcements(getName() + " finished casting Seal Of Ruler. " + ((L2PcInstance) this)._teamNameFOS + " has taken " + FortressSiege._eventName + "!");
4269+ if (!((L2PcInstance) this).isHero())
4270+ {
4271+ ((L2PcInstance) this).sendMessage("You have been rewarded with a Hero status from this event");
4272+ ((L2PcInstance) this).setHero(true);
4273+ ((L2PcInstance) this).setFakeHero(true); // Since it's only for the event, we don't want him to get Hero gear from the event manager.
4274+ }
4275
4276// Get the skill handler corresponding to the skill type (PDAM, MDAM, SWEEP...) started in gameserver
4277 handler = SkillHandler.getInstance().getSkillHandler(skill.getSkillType());
4278========================================================================================================
4279com.l2jfrozen.gameserver.model.L2Skill.java
4280========================================================================================================
4281import com.l2jfrozen.gameserver.model.base.ClassId;
4282+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4283import com.l2jfrozen.gameserver.model.entity.event.CTF;
4284import com.l2jfrozen.gameserver.model.entity.event.DM;
4285
4286
4287 return new L2Character[]
4288 {
4289 (L2ArtefactInstance) activeChar.getTarget()
4290 };
4291+ else if ( ((L2PcInstance)activeChar).checkFOS())
4292 {
4293 return new L2Character[] {(L2NpcInstance) activeChar.getTarget()};
4294
4295
4296
4297
4298 final L2PcInstance trg = (L2PcInstance) obj;
4299 if (trg == src)
4300 {
4301 continue;
4302 }
4303
4304 // if src is in event and trg not OR viceversa:
4305 // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
4306- if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
4307+ if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventFOS || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventFOS && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventFOS || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventFOS && !src._inEventTvT && !src._inEventVIP)))
4308 {
4309 continue;
4310 }
4311
4312 }
4313 else if (obj instanceof L2Summon)
4314
4315
4316
4317 final L2PcInstance trg = ((L2Summon) obj).getOwner();
4318 if (trg == src)
4319 {
4320 continue;
4321 }
4322
4323 // if src is in event and trg not OR viceversa:
4324 // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
4325- if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
4326+ if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventFOS || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventFOS && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventFOS || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventFOS && !src._inEventTvT && !src._inEventVIP)))
4327 {
4328 continue;
4329 }
4330
4331
4332 if (((TvT.is_started() && !Config.TVT_ALLOW_INTERFERENCE) || (FortressSiege.is_started() && !Config.FortressSiege_ALLOW_INTERFERENCE)|| (CTF.is_started() && !Config.CTF_ALLOW_INTERFERENCE) || (DM.is_started() && !Config.DM_ALLOW_INTERFERENCE))/* && !player.isGM() */)
4333 {
4334 if ((partyMember._inEventTvT && !player._inEventTvT) || (!partyMember._inEventTvT && player._inEventTvT))
4335 {
4336 continue;
4337 }
4338+ if ((partyMember._inEventFOS && !player._inEventFOS) || (!partyMember._inEventFOS && player._inEventFOS))
4339+ {
4340+ continue;
4341+ }
4342 if ((partyMember._inEventCTF && !player._inEventCTF) || (!partyMember._inEventCTF && player._inEventCTF))
4343 {
4344
4345
4346
4347 final L2PcInstance trg = partyMember;
4348
4349 // if src is in event and trg not OR viceversa:
4350 // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
4351 if (src != null)
4352- if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
4353+ if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventFOS || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventFOS && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventFOS || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventFOS && !src._inEventTvT && !src._inEventVIP)))
4354 {
4355 continue;
4356 }
4357
4358 targetList.add(partyMember);
4359
4360
4361 if (playerTarget == src)
4362 {
4363 continue;
4364 }
4365
4366 // if src is in event and trg not OR viceversa:
4367 // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
4368- if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
4369+ if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventFOS || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventFOS && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventFOS || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventFOS && !src._inEventTvT && !src._inEventVIP)))
4370 {
4371 continue;
4372 }
4373
4374 }
4375=========================================================================================================
4376com.l2jfrozen.gameserver.network.clientpackets.AttackRequest.java
4377=========================================================================================================
4378
4379import com.l2jfrozen.gameserver.model.actor.instance.L2SummonInstance;
4380+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4381import com.l2jfrozen.gameserver.model.entity.event.CTF;
4382
4383
4384 // During teleport phase, players cant do any attack
4385- if ((TvT.is_teleport() && activeChar._inEventTvT) || (CTF.is_teleport() && activeChar._inEventCTF) || (DM.is_teleport() && activeChar._inEventDM))
4386+ if ((TvT.is_teleport() && activeChar._inEventTvT) || (FortressSiege.is_teleport() && activeChar._inEventFOS) || (CTF.is_teleport() && activeChar._inEventCTF) || (DM.is_teleport() && activeChar._inEventDM))
4387 {
4388 activeChar.sendPacket(ActionFailed.STATIC_PACKET);
4389
4390
4391 // No attacks to same team in Event
4392+ if (FortressSiege.is_started())
4393+ {
4394+ if (target instanceof L2PcInstance)
4395+ {
4396+ if ((activeChar._inEventFOS && ((L2PcInstance) target)._inEventFOS) && activeChar._teamNameFOS.equals(((L2PcInstance) target)._teamNameFOS))
4397+ {
4398+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
4399+ return;
4400+ }
4401+ }
4402+ else if (target instanceof L2SummonInstance)
4403+ {
4404+ if ((activeChar._inEventFOS && ((L2SummonInstance) target).getOwner()._inEventFOS) && activeChar._teamNameFOS.equals(((L2SummonInstance) target).getOwner()._teamNameFOS))
4405+ {
4406+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
4407+ return;
4408+ }
4409+ }
4410+ }
4411+ return;
4412+ }
4413
4414// No attacks to same team in Event
4415 if (CTF.is_started())
4416
4417===========================================================================================================
4418com.l2jfrozen.gameserver.network.clientpackets.RequestBypassToServer.java
4419===========================================================================================================
4420mport com.l2jfrozen.gameserver.model.actor.position.L2CharPosition;
4421+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4422import com.l2jfrozen.gameserver.model.entity.event.CTF;
4423import com.l2jfrozen.gameserver.model.entity.event.DM;
4424
4425
4426 TvT.removePlayer(activeChar);
4427 }
4428 else
4429 {
4430 activeChar.sendMessage("The event is already started. You can not leave now!");
4431 }
4432 }
4433
4434+ else if (_command.substring(endOfId + 1).startsWith("fos_player_join "))
4435+ {
4436+ final String teamName = _command.substring(endOfId + 1).substring(16);
4437+
4438+ if (FortressSiege.is_joining())
4439+ {
4440+ FortressSiege.addPlayer(activeChar, teamName);
4441+ }
4442+ else
4443+ {
4444+ activeChar.sendMessage("The event is already started. You can not join now!");
4445+ }
4446+ }
4447+
4448+ else if (_command.substring(endOfId + 1).startsWith("fos_player_leave"))
4449+ {
4450+ if (FortressSiege.is_joining())
4451+ {
4452+ FortressSiege.removePlayer(activeChar);
4453+ }
4454+ else
4455+ {
4456+ activeChar.sendMessage("The event is already started. You can not leave now!");
4457+ }
4458+ }
4459
4460 else if (_command.substring(endOfId + 1).startsWith("dmevent_player_join"))
4461 {
4462 if (DM.is_joining())
4463
4464
4465
4466====================================================================================================
4467com.l2jfrozen.gameserver.network.clientpackets.RequestJoinParty.java
4468====================================================================================================
4469import com.l2jfrozen.gameserver.model.L2World;
4470import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4471+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4472import com.l2jfrozen.gameserver.model.entity.event.CTF;
4473
4474
4475if ((requestor._inEventDM && (DM.is_teleport() || DM.is_started())) || (target._inEventDM && (DM.is_teleport() || DM.is_started())))
4476 {
4477 requestor.sendMessage("You can't invite that player in party!");
4478 return;
4479 }
4480- if ((requestor._inEventTvT && !target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (!requestor._inEventTvT && target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (requestor._inEventCTF && !target._inEventCTF && (CTF.is_started() || CTF.is_teleport())) || (!requestor._inEventCTF && target._inEventCTF && (CTF.is_started() || CTF.is_teleport())))
4481+ if ((requestor._inEventTvT && !target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (!requestor._inEventTvT && target._inEventTvT && (TvT.is_started() || TvT.is_teleport())) || (requestor._inEventFOS && !target._inEventFOS && (FortressSiege.is_started() || FortressSiege.is_teleport())) || (!requestor._inEventFOS && target._inEventFOS && (FortressSiege.is_started() || FortressSiege.is_teleport())) || (requestor._inEventCTF && !target._inEventCTF && (CTF.is_started() || CTF.is_teleport())) || (!requestor._inEventCTF && target._inEventCTF && (CTF.is_started() || CTF.is_teleport())))
4482 {
4483 requestor.sendMessage("You can't invite that player in party: you or your target are in Event");
4484 return;
4485 }
4486
4487 if (target.isInParty())
4488=====================================================================================================
4489com.l2jfrozen.gameserver.network.clientpackets.RequestRestart.java
4490=====================================================================================================
4491
4492
4493// Check if player is in Event
4494- if (player._inEventCTF || player._inEventDM || player._inEventTvT || player._inEventVIP)
4495+ if (player._inEventCTF || player._inEventDM || player._inEventFOS || player._inEventTvT || player._inEventVIP)
4496 {
4497 player.sendMessage("You can't restart during Event.");
4498 sendPacket(RestartResponse.valueOf(false));
4499 return;
4500 }
4501
4502 // Fix against exploit anti-target
4503 if (player.isCastingNow())
4504=====================================================================================================
4505com.l2jfrozen.gameserver.network.clientpackets.RequestRestartPoint.java
4506=====================================================================================================
4507import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4508import com.l2jfrozen.gameserver.model.entity.ClanHall;
4509+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4510import com.l2jfrozen.gameserver.model.entity.event.CTF;
4511
4512
4513
4514DeathTask(final L2PcInstance _activeChar)
4515 {
4516 activeChar = _activeChar;
4517 }
4518
4519 @Override
4520 public void run()
4521 {
4522- if ((activeChar._inEventTvT && TvT.is_started()) || (activeChar._inEventDM && DM.is_started()) || (activeChar._inEventCTF && CTF.is_started()))
4523+ if ((activeChar._inEventTvT && TvT.is_started()) || (activeChar._inEventFOS && FortressSiege.is_started()) || (activeChar._inEventDM && DM.is_started()) || (activeChar._inEventCTF && CTF.is_started()))
4524 {
4525 activeChar.sendMessage("You can't restart in Event!");
4526 return;
4527 }
4528 try
4529 {
4530 Location loc = null;
4531 Castle castle = null;
4532 Fort fort = null;
4533=====================================================================================================
4534com.l2jfrozen.gameserver.network.serverpackets.Die.java
4535=====================================================================================================
4536import com.l2jfrozen.gameserver.model.L2SiegeClan;
4537import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4538+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4539import com.l2jfrozen.gameserver.model.entity.event.CTF;
4540
4541
4542 final L2PcInstance player = (L2PcInstance) cha;
4543 _access = player.getAccessLevel();
4544 _clan = player.getClan();
4545- _canTeleport = !((TvT.is_started() && player._inEventTvT) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) || player.isInFunEvent() || player.isPendingRevive());
4546+ _canTeleport = !((TvT.is_started() && player._inEventTvT) || (FortressSiege.is_started() && player._inEventFOS) || (DM.is_started() && player._inEventDM) || (CTF.is_started() && player._inEventCTF) || player.isInFunEvent() || player.isPendingRevive()||(player.isInsideZone(L2Character.ZONE_MULTIFUNCTION) && L2MultiFunctionZone.revive));
4547 }
4548 _charObjId = cha.getObjectId();
4549 _fake = !cha.isDead();
4550 if (cha instanceof L2Attackable)
4551
4552=====================================================================================================
4553com.l2jfrozen.gameserver.network.L2GameClient.java
4554=====================================================================================================
4555import com.l2jfrozen.gameserver.model.L2World;
4556import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4557+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4558import com.l2jfrozen.gameserver.model.entity.event.CTF;
4559import com.l2jfrozen.gameserver.model.entity.event.DM;
4560
4561else if (player._inEventTvT)
4562 {
4563 TvT.onDisconnect(player);
4564 }
4565+ else if (player._inEventFOS)
4566+ {
4567+ FortressSiege.onDisconnect(player);
4568+ }
4569 else if (player._inEventVIP)
4570 {
4571 VIP.onDisconnect(player);
4572 }
4573
4574
4575
4576
4577L2Event.connectionLossData.put(player.getName(), data);
4578 data = null;
4579 }
4580 else
4581 {
4582
4583 if (player._inEventCTF)
4584 {
4585 CTF.onDisconnect(player);
4586 }
4587 else if (player._inEventDM)
4588 {
4589 DM.onDisconnect(player);
4590 }
4591 else if (player._inEventTvT)
4592 {
4593 TvT.onDisconnect(player);
4594 }
4595+ else if (player._inEventFOS)
4596+ {
4597+ FortressSiege.onDisconnect(player);
4598+ }
4599 else if (player._inEventVIP)
4600 {
4601 VIP.onDisconnect(player);
4602 }
4603
4604 }
4605=====================================================================================================
4606com.l2jfrozen.gameserver.powerpak.Buffer.BuffHandler.java
4607=====================================================================================================
4608import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4609+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4610import com.l2jfrozen.gameserver.model.entity.event.CTF;
4611
4612else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
4613 msg = "Buffer is not available in TVT";
4614+ else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("FortressSiege") && activeChar._inEventFOS && FortressSiege.is_started())
4615+ msg = "Buffer is not available in this Event";
4616 else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
4617 msg = "Buffer is not available in CTF";
4618=====================================================================================================
4619com.l2jfrozen.gameserver.powerpak.globalGK.GKHandler.java
4620=====================================================================================================
4621import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4622+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4623import com.l2jfrozen.gameserver.model.entity.event.CTF;
4624import com.l2jfrozen.gameserver.model.entity.event.DM;
4625
4626else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
4627 msg = "Gatekeeper is not available in TVT";
4628+ else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("FortressSiege") && activeChar._inEventFOS && FortressSiege.is_started())
4629+ msg = "Gatekeeper is not available in This Event";
4630 else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
4631 msg = "Gatekeeper is not available in CTF";
4632=====================================================================================================
4633com.l2jfrozen.gameserver.powerpak.gmshop.GMShop.java
4634=====================================================================================================
4635import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
4636+ import com.l2jfrozen.gameserver.model.entity.FortressSiege;
4637import com.l2jfrozen.gameserver.model.entity.event.CTF;
4638import com.l2jfrozen.gameserver.model.entity.event.DM;
4639
4640
4641
4642
4643else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
4644 msg = "GMShop is not available in TVT";
4645+ else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("FortressSiege") && activeChar._inEventFOS && FortressSiege.is_started())
4646+ msg = "GMShop is not available in this Event";
4647 else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
4648 msg = "GMShop is not available in CTF";
4649
4650=====================================================================================================
4651Sql Comando de ADM
4652=====================================================================================================
4653/*
4654Navicat MySQL Data Transfer
4655
4656Source Server : localhost
4657Source Server Version : 50149
4658Source Host : localhost:3306
4659Source Database : spawnn
4660
4661Target Server Type : MYSQL
4662Target Server Version : 50149
4663File Encoding : 65001
4664
4665Date: 2019-08-19 22:05:49
4666*/
4667
4668SET FOREIGN_KEY_CHECKS=0;
4669-- ----------------------------
4670-- Table structure for `admin_command_access_rights`
4671-- ----------------------------
4672DROP TABLE IF EXISTS `admin_command_access_rights`;
4673CREATE TABLE `admin_command_access_rights` (
4674 `adminCommand` varchar(255) NOT NULL DEFAULT 'admin_',
4675 `accessLevels` varchar(255) NOT NULL,
4676 PRIMARY KEY (`adminCommand`)
4677) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4678
4679-- ----------------------------
4680-- Records of admin_command_access_rights
4681-- ---------------------------
4682INSERT INTO `admin_command_access_rights` VALUES ('admin_fos', '2');
4683INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_abort', '2');
4684INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_autoevent', '2');
4685INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_desc', '2');
4686INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door1', '2');
4687INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door2', '2');
4688INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door3', '2');
4689INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door4', '2');
4690INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door5', '2');
4691INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_door6', '2');
4692INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_dump', '2');
4693INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_eventtime', '2');
4694INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_finish', '2');
4695INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_join', '2');
4696INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_jointime', '2');
4697INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_join_loc', '2');
4698INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_load', '2');
4699INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_maxlvl', '2');
4700INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_maxplayers', '2');
4701INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_minlvl', '2');
4702INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_minplayers', '2');
4703INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_name', '2');
4704INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_npc', '2');
4705INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_npc_pos', '2');
4706INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_pg2', '2');
4707INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_pg3', '2');
4708INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_reward', '2');
4709INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_reward_amount', '2');
4710INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_save ', '2');
4711INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_sit', '2');
4712INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_start', '2');
4713INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_teamname', '2');
4714INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_team_color', '2');
4715INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_team_flag', '2');
4716INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_team_flags', '2');
4717INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_team_pos', '2');
4718INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_tele1 ', '2');
4719INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_tele2', '2');
4720INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_tele3', '2');
4721INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_tele4', '2');
4722INSERT INTO `admin_command_access_rights` VALUES ('admin_fos_teleport', '2');
4723
4724=====================================================================================================
4725Sql FortressSiege
4726=====================================================================================================
4727/*
4728Navicat MySQL Data Transfer
4729
4730Source Server : localhost
4731Source Server Version : 50149
4732Source Host : localhost:3306
4733Source Database : spawnn
4734
4735Target Server Type : MYSQL
4736Target Server Version : 50149
4737File Encoding : 65001
4738
4739Date: 2019-08-16 18:27:35
4740*/
4741
4742SET FOREIGN_KEY_CHECKS=0;
4743-- ----------------------------
4744-- Table structure for `fortress_siege`
4745-- ----------------------------
4746DROP TABLE IF EXISTS `fortress_siege`;
4747CREATE TABLE `fortress_siege` (
4748 `eventName` varchar(255) NOT NULL DEFAULT '',
4749 `eventDesc` varchar(255) NOT NULL DEFAULT '',
4750 `joiningLocation` varchar(255) NOT NULL DEFAULT '',
4751 `minlvl` int(4) NOT NULL DEFAULT '0',
4752 `maxlvl` int(4) NOT NULL DEFAULT '0',
4753 `npcId` int(8) NOT NULL DEFAULT '0',
4754 `npcX` int(11) NOT NULL DEFAULT '0',
4755 `npcY` int(11) NOT NULL DEFAULT '0',
4756 `npcZ` int(11) NOT NULL DEFAULT '0',
4757 `npcHeading` int(11) NOT NULL DEFAULT '0',
4758 `rewardId` int(11) NOT NULL DEFAULT '0',
4759 `rewardAmount` int(11) NOT NULL DEFAULT '0',
4760 `joinTime` int(11) NOT NULL DEFAULT '0',
4761 `eventTime` int(11) NOT NULL DEFAULT '0',
4762 `minPlayers` int(4) NOT NULL DEFAULT '0',
4763 `maxPlayers` int(4) NOT NULL DEFAULT '0',
4764 `centerX` int(11) NOT NULL DEFAULT '0',
4765 `centerY` int(11) NOT NULL DEFAULT '0',
4766 `centerZ` int(11) NOT NULL DEFAULT '0',
4767 `team1Name` varchar(255) NOT NULL DEFAULT '',
4768 `team1X` int(11) NOT NULL DEFAULT '0',
4769 `team1Y` int(11) NOT NULL DEFAULT '0',
4770 `team1Z` int(11) NOT NULL DEFAULT '0',
4771 `team1Color` int(11) NOT NULL DEFAULT '0',
4772 `team2Name` varchar(255) NOT NULL DEFAULT '',
4773 `team2X` int(11) NOT NULL DEFAULT '0',
4774 `team2Y` int(11) NOT NULL DEFAULT '0',
4775 `team2Z` int(11) NOT NULL DEFAULT '0',
4776 `team2Color` int(11) NOT NULL DEFAULT '0',
4777 `flagX` int(11) NOT NULL DEFAULT '0',
4778 `flagY` int(11) NOT NULL DEFAULT '0',
4779 `flagZ` int(11) NOT NULL DEFAULT '0',
4780 `innerDoor1` int(11) NOT NULL DEFAULT '0',
4781 `innerDoor2` int(11) NOT NULL DEFAULT '0',
4782 `innerDoor3` int(11) NOT NULL DEFAULT '0',
4783 `innerDoor4` int(11) NOT NULL DEFAULT '0',
4784 `outerDoor1` int(11) NOT NULL DEFAULT '0',
4785 `outerDoor2` int(11) NOT NULL DEFAULT '0',
4786 PRIMARY KEY (`eventName`)
4787) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4788
4789-- ----------------------------
4790-- Records of fortress_siege
4791-- ----------------------------
4792INSERT INTO `fortress_siege` VALUES ('Abandoned Camp Fortress Siege', 'Siege the Abandoned Fortress', 'Gludin Village', '76', '81', '30373', '-84801', '150939', '-3129', '0', '6391', '400', '10', '30', '2', '200', '-52766', '156487', '-2079', 'Blue', '-45494', '156091', '-1489', '16711680', 'Red', '-53000', '156581', '-1897', '6684927', '-52767', '156503', '-1131', '18220003', '18220002', '18220005', '18220004', '18220008', '18220001');
4793INSERT INTO `fortress_siege` VALUES ('Alligator Beach Fortress Siege', 'Siege the Alligator Isle Fortress', 'Town of Heine', '76', '81', '30290', '111372', '218705', '-3466', '0', '6391', '400', '10', '30', '2', '200', '118417', '204933', '-3333', 'Blue', '124978', '210106', '-1855', '16711680', 'Red', '118622', '205071', '-3176', '6684927', '118425', '204922', '-2410', '23240002', '23240003', '23240007', '23240006', '23240008', '23240001');
4794INSERT INTO `fortress_siege` VALUES ('Bandit Stronghold', 'Siege the Bandit Stronghold', 'Town of Oren', '76', '81', '30990', '83137', '53328', '-1440', '0', '6391', '400', '10', '30', '2', '200', '80428', '-15418', '-704', 'Blue', '87500', '-23341', '-995', '16711680', 'Red', '80428', '-15418', '-704', '6684927', '80127', '-15404', '-1805', '22170004', '22170003', '22170004', '22170003', '22170001', '22170002');
4795INSERT INTO `fortress_siege` VALUES ('Border Outpost Fortress Siege', 'Siege the Outpost Fortress', 'Town of Oren', '76', '81', '31285', '81504', '53674', '-1487', '0', '6391', '400', '10', '30', '2', '200', '111364', '-15154', '-1021', 'Blue', '110369', '-20863', '-462', '16711680', 'Red', '111371', '-14834', '-838', '6684927', '111359', '-15120', '-72', '23170004', '23170005', '23170009', '23170008', '23170001', '23170012');
4796INSERT INTO `fortress_siege` VALUES ('Cruma Tower Fortress Siege', 'Siege the Cruma Fortress', 'Elven Village', '76', '81', '30109', '45656', '50440', '-3016', '0', '6391', '400', '10', '30', '2', '200', '11546', '94970', '-3426', 'Blue', '8802', '101977', '-2489', '16711680', 'Red', '11548', '95305', '-3269', '6684927', '11518', '95004', '-2503', '20200002', '20200003', '20200007', '20200006', '20200008', '20200001');
4797INSERT INTO `fortress_siege` VALUES ('Devastated Castle', 'Siege the Devastated Castle', 'Town of Aden', '76', '81', '35421', '147473', '26014', '-2039', '0', '6391', '400', '10', '30', '2', '200', '177839', '-18598', '-2240', 'Blue', '184872', '-15882', '-1522', '16711680', 'Red', '177856', '-18615', '-2240', '6684927', '178298', '-17623', '-2201', '25170006', '25170005', '25170004', '25170003', '25170002', '25170001');
4798INSERT INTO `fortress_siege` VALUES ('Devils Pass Fortress Siege', 'Siege the Devils Pass Fortress', 'Town of Goddard', '76', '81', '30849', '147694', '-55540', '-2734', '0', '6391', '400', '10', '30', '2', '200', '100708', '-55336', '-645', 'Blue', '95458', '-63046', '-174', '16711680', 'Red', '100426', '-55292', '-514', '6684927', '100720', '-55334', '277', '23160006', '23160007', '23160005', '23160004', '23160001', '23160008');
4799INSERT INTO `fortress_siege` VALUES ('Devotion Fortress Siege', 'Siege the Fortress of Devotion', 'Dark Elf Village', '76', '81', '30462', '12116', '16656', '-4584', '0', '6391', '400', '10', '30', '2', '200', '-53247', '91214', '-2821', 'Blue', '-55768', '84623', '-1925', '16711680', 'Red', '-53240', '91548', '-2664', '6684927', '-53229', '91221', '-1898', '18200002', '18200003', '18200012', '18200011', '18200010', '18200001');
4800INSERT INTO `fortress_siege` VALUES ('Field of Silence Fortress Siege', 'Siege the Silenced Field Fortress', 'Heine', '76', '81', '30288', '111389', '219491', '-3546', '0', '6391', '400', '10', '30', '2', '200', '73112', '185973', '-2607', 'Blue', '65929', '175231', '-2138', '16711680', 'Red', '72945', '186225', '-2450', '6684927', '73121', '185988', '-1658', '22230004', '22230005', '22230007', '22230006', '22230008', '22230001');
4801INSERT INTO `fortress_siege` VALUES ('Floran Agricultural Fortress Siege', 'Siege the Floran Fortress', 'Town of Dion', '76', '81', '30187', '15820', '142833', '-2706', '0', '6391', '400', '10', '30', '2', '200', '5615', '149754', '-2889', 'Blue', '338', '140472', '-1608', '16711680', 'Red', '5332', '149737', '-2732', '6684927', '5607', '149760', '-1966', '20220024', '20220025', '20220023', '20220022', '20220021', '20220026');
4802INSERT INTO `fortress_siege` VALUES ('Forsaken Plains Fortress Siege', 'Siege the Forsaken Fortress', 'Town of Aden', '76', '81', '30474', '147141', '26170', '-2048', '0', '6391', '400', '10', '30', '2', '200', '189926', '39731', '-3410', 'Blue', '184375', '43263', '-2884', '16711680', 'Red', '189935', '40059', '-3253', '6684927', '189928', '39748', '-2487', '25190006', '25190007', '25190009', '25190008', '25190001', '25190012');
4803INSERT INTO `fortress_siege` VALUES ('Fortress of the Dead', 'Siege the Fortress of the Dead', 'Rune Township', '76', '81', '31538', '44104', '-48539', '-797', '0', '6391', '400', '10', '30', '2', '200', '58149', '-27479', '578', 'Blue', '59555', '-37667', '403', '16711680', 'Red', '58153', '-27485', '578', '6684927', '57953', '-25830', '592', '21170004', '21170003', '21170004', '21170003', '21170002', '21170006');
4804INSERT INTO `fortress_siege` VALUES ('Giran Arena Fortress Siege', 'Siege the Giran Fortress', 'Town of Dion', '76', '81', '31321', '15788', '142848', '-2706', '0', '6391', '400', '10', '30', '2', '200', '15794', '142916', '-2732', 'Blue', '52771', '138768', '-1235', '16711680', 'Red', '60332', '139719', '-1623', '6684927', '60280', '139448', '-857', '21220006', '21220007', '21220002', '21220003', '21220001', '21220008');
4805INSERT INTO `fortress_siege` VALUES ('Giran DVC Fortress Siege', 'Siege the Giran DVC Fortress', 'Town of Giran', '76', '81', '30066', '83025', '148627', '-3495', '0', '6391', '400', '10', '30', '2', '200', '126085', '123330', '-2585', 'Blue', '122293', '118941', '-2241', '16711680', 'Red', '126089', '123591', '-2429', '6684927', '126085', '123342', '-1662', '23210007', '23210006', '23210011', '23210010', '23210001', '23210012');
4806INSERT INTO `fortress_siege` VALUES ('Hunters Fortress Siege', 'Siege the Hunters Village Fortress', 'Hunters Village', '76', '81', '30026', '117817', '76627', '-2600', '0', '6391', '400', '10', '30', '2', '200', '125241', '95126', '-2140', 'Blue', '133079', '100462', '-991', '16711680', 'Red', '125237', '95416', '-1984', '6684927', '125250', '95162', '-1217', '23200003', '23200002', '23200009', '23200008', '23200001', '23200012');
4807INSERT INTO `fortress_siege` VALUES ('Ketra Orcs Fortress Siege', 'Siege the Ketra Fortress', 'Town of Goddard', '76', '81', '30862', '147715', '-55515', '-2734', '0', '6391', '400', '10', '30', '2', '200', '159155', '-70315', '-2864', 'Blue', '156275', '-66893', '-1696', '16711680', 'Red', '158901', '-70140', '-2707', '6684927', '159127', '-70286', '-1942', '24150004', '24150005', '24150006', '24150007', '24150003', '24150008');
4808INSERT INTO `fortress_siege` VALUES ('Langk Fortress Siege', 'Siege the Langk Fortress', 'Gludin Village', '76', '81', '30297', '-82112', '150625', '-3129', '0', '6391', '400', '10', '30', '2', '200', '-22707', '219807', '-3236', 'Blue', '-15316', '205368', '-2362', '16711680', 'Red', '-22401', '219796', '-3079', '6684927', '-22693', '219801', '-2313', '19240006', '19240007', '19240008', '19240009', '19240005', '19240010');
4809INSERT INTO `fortress_siege` VALUES ('Narsell Lake Fortress Siege', 'Siege the Lake Fortress', 'Town of Aden', '76', '81', '30689', '147422', '26009', '-2013', '0', '6391', '400', '10', '30', '2', '200', '154908', '55311', '-3254', 'Blue', '162137', '61611', '-1945', '16711680', 'Red', '154700', '55473', '-3098', '6684927', '154863', '55320', '-2331', '24190009', '24190008', '24190007', '24190006', '24190010', '24190005');
4810INSERT INTO `fortress_siege` VALUES ('Northern Waterfall Fortress Siege', 'Siege the Waterfall Fortress', 'Town of Oren', '76', '81', '30699', '83114', '53833', '-1465', '0', '6391', '400', '10', '30', '2', '200', '72859', '4267', '-3045', 'Blue', '71847', '-3991', '-2711', '16711680', 'Red', '72695', '4468', '-2888', '6684927', '72840', '4283', '-2122', '22180004', '22180005', '22180002', '22180003', '22180008', '22180001');
4811INSERT INTO `fortress_siege` VALUES ('Oren Fortress Siege', 'Siege the Oren Fortress', 'Town of Oren', '76', '81', '30008', '83130', '53329', '-1440', '0', '6391', '400', '10', '30', '2', '200', '79232', '91045', '-2884', 'Blue', '86997', '104410', '-1259', '16711680', 'Red', '79504', '91195', '-2727', '6684927', '79262', '91069', '-1961', '22200005', '22200004', '22200007', '22200006', '22200001', '22200012');
4812INSERT INTO `fortress_siege` VALUES ('Plunderous Plain Fortress Siege', 'Siege the Plunderous Fortress', 'Schuttgart', '76', '81', '30910', '87416', '-143124', '-1293', '0', '6391', '400', '10', '30', '2', '200', '109483', '-141223', '-2983', 'Blue', '90058', '-140574', '-911', '16711680', 'Red', '109213', '-141148', '-2800', '6684927', '109469', '-141216', '-2034', '23130005', '23130004', '23130003', '23130002', '23130006', '23130001');
4813INSERT INTO `fortress_siege` VALUES ('Race Track Fortress Siege', 'Siege the Race Track Fortress', 'Town of Dion', '76', '81', '30195', '16218', '144166', '-2981', '0', '6391', '400', '10', '30', '2', '200', '16582', '188047', '-2924', 'Blue', '23365', '179858', '-1839', '16711680', 'Red', '16757', '188340', '-2767', '6684927', '16587', '188072', '-2002', '20230005', '20230004', '20230009', '20230008', '20230003', '20230003');
4814INSERT INTO `fortress_siege` VALUES ('Swamp of Screams Fortress Siege', 'Siege the Screaming Fortress', 'Rune Township', '76', '81', '30900', '43957', '-47711', '-823', '0', '6391', '400', '10', '30', '2', '200', '69833', '-61430', '-2786', 'Blue', '76854', '-50916', '-1971', '16711680', 'Red', '69964', '-61124', '-2630', '6684927', '69834', '-61434', '-1863', '22160005', '22160004', '22160009', '22160008', '22160001', '22160012');
4815INSERT INTO `fortress_siege` VALUES ('Valley of Saints Fortress Siege', 'Siege the Saint Fortress', 'Rune Township', '76', '81', '31276', '43561', '-48758', '-798', '0', '6391', '400', '10', '30', '2', '200', '72160', '-94767', '-1428', 'Blue', '69088', '-85022', '-1372', '16711680', 'Red', '72301', '-94461', '-1272', '6684927', '72169', '-94737', '-505', '22150006', '22150007', '22150002', '22150003', '22150008', '22150001');