Advertisement
Guest User

TvT Event

a guest
May 23rd, 2014
1,622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.98 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/model/entity/TvTEvent.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/model/entity/TvTEvent.java (revision 0)
  6. +++ java/net/sf/l2j/gameserver/model/entity/TvTEvent.java (revision 0)
  7. @@ -0,0 +1,773 @@
  8. +/*
  9. + * This program is free software; you can redistribute it and/or modify
  10. + * it under the terms of the GNU General Public License as published by
  11. + * the Free Software Foundation; either version 2, or (at your option)
  12. + * any later version.
  13. + *
  14. + * This program is distributed in the hope that it will be useful,
  15. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. + * GNU General Public License for more details.
  18. + *
  19. + * You should have received a copy of the GNU General Public License
  20. + * along with this program; if not, write to the Free Software
  21. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  22. + * 02111-1307, USA.
  23. + *
  24. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  25. + */
  26. +package net.sf.l2j.gameserver.model.entity;
  27. +
  28. +import net.sf.l2j.Config;
  29. +import net.sf.l2j.gameserver.datatables.DoorTable;
  30. +import net.sf.l2j.gameserver.datatables.ItemTable;
  31. +import net.sf.l2j.gameserver.datatables.NpcTable;
  32. +import net.sf.l2j.gameserver.datatables.SpawnTable;
  33. +import net.sf.l2j.gameserver.model.actor.L2Character;
  34. +import net.sf.l2j.gameserver.model.L2Spawn;
  35. +import net.sf.l2j.gameserver.model.actor.L2Summon;
  36. +import net.sf.l2j.gameserver.model.L2World;
  37. +import net.sf.l2j.gameserver.model.itemcontainer.PcInventory;
  38. +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
  39. +import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
  40. +import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  41. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  42. +import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  43. +import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;
  44. +import net.sf.l2j.gameserver.network.SystemMessageId;
  45. +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  46. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  47. +import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
  48. +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  49. +import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
  50. +import net.sf.l2j.util.Rnd;
  51. +
  52. +/**
  53. + * @author FBIagent
  54. + */
  55. +public class TvTEvent
  56. +{
  57. + enum EventState
  58. + {
  59. + INACTIVE,
  60. + INACTIVATING,
  61. + PARTICIPATING,
  62. + STARTING,
  63. + STARTED,
  64. + REWARDING
  65. + }
  66. +
  67. + /** The teams of the TvTEvent<br> */
  68. + private static TvTEventTeam[] _teams = new TvTEventTeam[2]; // event only allow max 2 teams
  69. + /** The state of the TvTEvent<br> */
  70. + private static EventState _state = EventState.INACTIVE;
  71. + /** The spawn of the participation npc<br> */
  72. + private static L2Spawn _npcSpawn = null;
  73. + /** the npc instance of the participation npc<br> */
  74. + private static L2NpcInstance _lastNpcSpawn = null;
  75. +
  76. + /**
  77. + * No instance of this class!<br>
  78. + */
  79. + private TvTEvent()
  80. + {}
  81. +
  82. + /**
  83. + * Teams initializing<br>
  84. + */
  85. + public static void init()
  86. + {
  87. + _teams[0] = new TvTEventTeam(Config.TVT_EVENT_TEAM_1_NAME, Config.TVT_EVENT_TEAM_1_COORDINATES);
  88. + _teams[1] = new TvTEventTeam(Config.TVT_EVENT_TEAM_2_NAME, Config.TVT_EVENT_TEAM_2_COORDINATES);
  89. + }
  90. +
  91. + /**
  92. + * Starts the participation of the TvTEvent<br>
  93. + * 1. Get L2NpcTemplate by Config.TVT_EVENT_PARTICIPATION_NPC_ID<br>
  94. + * 2. Try to spawn a new npc of it<br><br>
  95. + *
  96. + * @return boolean<br>
  97. + */
  98. + public static boolean startParticipation()
  99. + {
  100. + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.TVT_EVENT_PARTICIPATION_NPC_ID);
  101. +
  102. + if (tmpl == null)
  103. + {
  104. + System.out.println("TvTEventEngine[TvTEvent.startParticipation()]: L2NpcTemplate is a NullPointer -> Invalid npc id in configs?");
  105. + return false;
  106. + }
  107. +
  108. + try
  109. + {
  110. + _npcSpawn = new L2Spawn(tmpl);
  111. +
  112. + _npcSpawn.setLocx(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0]);
  113. + _npcSpawn.setLocy(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1]);
  114. + _npcSpawn.setLocz(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
  115. + _npcSpawn.getAmount();
  116. + _npcSpawn.setHeading(0);
  117. + _npcSpawn.setRespawnDelay(1);
  118. + // later no need to delete spawn from db, we don't store it (false)
  119. + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
  120. + _npcSpawn.init();
  121. + _lastNpcSpawn = (L2NpcInstance) _npcSpawn.getLastSpawn();
  122. + _lastNpcSpawn.setCurrentHp(_lastNpcSpawn.getMaxHp());
  123. + _lastNpcSpawn.setTitle("TvT Event Participation");
  124. + _lastNpcSpawn.isAggressive();
  125. + _lastNpcSpawn.decayMe();
  126. + _lastNpcSpawn.spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
  127. + _lastNpcSpawn.broadcastPacket(new MagicSkillUse(_lastNpcSpawn, _lastNpcSpawn, 1034, 1, 1, 1));
  128. + }
  129. + catch (Exception e)
  130. + {
  131. + System.out.println("TvTEventEngine[TvTEvent.startParticipation()]: exception: " + e);
  132. + return false;
  133. + }
  134. +
  135. + setState(EventState.PARTICIPATING);
  136. + return true;
  137. + }
  138. +
  139. + /**
  140. + * Starts the TvTEvent fight<br>
  141. + * 1. Set state EventState.STARTING<br>
  142. + * 2. Close doors specified in configs<br>
  143. + * 3. Abort if not enought participants(return false)<br>
  144. + * 4. Set state EventState.STARTED<br>
  145. + * 5. Teleport all participants to team spot<br><br>
  146. + *
  147. + * @return boolean<br>
  148. + */
  149. + public static boolean startFight()
  150. + {
  151. + setState(EventState.STARTING);
  152. +
  153. + // not enought participants
  154. + if (_teams[0].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS || _teams[1].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS)
  155. + {
  156. + setState(EventState.INACTIVE);
  157. + _teams[0].cleanMe();
  158. + _teams[1].cleanMe();
  159. + unSpawnNpc();
  160. + return false;
  161. + }
  162. +
  163. + closeDoors();
  164. + setState(EventState.STARTED); // set state to STARTED here, so TvTEventTeleporter know to teleport to team spot
  165. +
  166. + // teleport all participants to there team spot
  167. + for (TvTEventTeam team : _teams)
  168. + {
  169. + for (String playerName : team.getParticipatedPlayerNames())
  170. + {
  171. + L2PcInstance playerInstance = team.getParticipatedPlayers().get(playerName);
  172. +
  173. + if (playerInstance == null)
  174. + continue;
  175. +
  176. + // implements Runnable and starts itself in constructor
  177. + new TvTEventTeleporter(playerInstance, team.getCoordinates(), false, false);
  178. + }
  179. + }
  180. +
  181. + return true;
  182. + }
  183. +
  184. + /**
  185. + * Calculates the TvTEvent reward<br>
  186. + * 1. If both teams are at a tie(points equals), send it as system message to all participants, if one of the teams have 0 participants left online abort rewarding<br>
  187. + * 2. Wait till teams are not at a tie anymore<br>
  188. + * 3. Set state EvcentState.REWARDING<br>
  189. + * 4. Reward team with more points<br>
  190. + * 5. Show win html to wining team participants<br><br>
  191. + *
  192. + * @return String<br>
  193. + */
  194. + public static String calculateRewards()
  195. + {
  196. + if (_teams[0].getPoints() == _teams[1].getPoints())
  197. + {
  198. + if (_teams[0].getParticipatedPlayerCount() == 0 || _teams[1].getParticipatedPlayerCount() == 0)
  199. + {
  200. + // the fight cannot be completed
  201. + setState(EventState.REWARDING);
  202. + return "TvT Event: Event finish. No team won, cause of inactivity!";
  203. + }
  204. +
  205. + sysMsgToAllParticipants("TvT Event: Both teams are at a tie, next team to get a kill wins!");
  206. + }
  207. +
  208. + while (_teams[0].getPoints() == _teams[1].getPoints())
  209. + {
  210. + try
  211. + {
  212. + Thread.sleep(1);
  213. + }
  214. + catch (InterruptedException ie)
  215. + {}
  216. + }
  217. +
  218. + setState(EventState.REWARDING); // after state REWARDING is set, nobody can point anymore
  219. +
  220. + byte teamId = (byte)(_teams[0].getPoints() > _teams[1].getPoints() ? 0 : 1); // which team wins?
  221. + TvTEventTeam team = _teams[teamId];
  222. +
  223. + for (String playerName : team.getParticipatedPlayerNames())
  224. + {
  225. + L2PcInstance playerInstance = team.getParticipatedPlayers().get(playerName);
  226. +
  227. + for (int[] reward : Config.TVT_EVENT_REWARDS)
  228. + {
  229. + if (playerInstance == null)
  230. + continue;
  231. +
  232. + PcInventory inv = playerInstance.getInventory();
  233. +
  234. + if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
  235. + inv.addItem("TvT Event", reward[0], reward[1], playerInstance, playerInstance);
  236. + else
  237. + {
  238. + for (int i=0;i<reward[1];i++)
  239. + inv.addItem("TvT Event", reward[0], 1, playerInstance, playerInstance);
  240. + }
  241. +
  242. + SystemMessage systemMessage = null;
  243. +
  244. + if (reward[1] > 1)
  245. + {
  246. + systemMessage = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
  247. + systemMessage.addItemName(reward[0]);
  248. + systemMessage.addNumber(reward[1]);
  249. + }
  250. + else
  251. + {
  252. + systemMessage = new SystemMessage(SystemMessageId.EARNED_ITEM_S1);
  253. + systemMessage.addItemName(reward[0]);
  254. + }
  255. +
  256. + playerInstance.sendPacket(systemMessage);
  257. + }
  258. +
  259. + StatusUpdate statusUpdate = new StatusUpdate(playerInstance);
  260. +
  261. + statusUpdate.addAttribute(StatusUpdate.CUR_LOAD, playerInstance.getCurrentLoad());
  262. + playerInstance.sendPacket(statusUpdate);
  263. +
  264. + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
  265. +
  266. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your team won the event. Look in your inventory, there should be your reward.</body></html>");
  267. + playerInstance.sendPacket(npcHtmlMessage);
  268. + }
  269. +
  270. + return "TvT Event: Event finish. Team " + team.getName() + " won with " + team.getPoints() + " kills.";
  271. + }
  272. +
  273. + /**
  274. + * Stops the TvTEvent fight<br>
  275. + * 1. Set state EventState.INACTIVATING<br>
  276. + * 2. Remove tvt npc from world<br>
  277. + * 3. Open doors specified in configs<br>
  278. + * 4. Teleport all participants back to participation npc location<br>
  279. + * 5. Teams cleaning<br>
  280. + * 6. Set state EventState.INACTIVE<br>
  281. + */
  282. + public static void stopFight()
  283. + {
  284. + setState(EventState.INACTIVATING);
  285. + unSpawnNpc();
  286. + openDoors();
  287. +
  288. + for (TvTEventTeam team : _teams)
  289. + {
  290. + for (String playerName : team.getParticipatedPlayerNames())
  291. + {
  292. + L2PcInstance playerInstance = team.getParticipatedPlayers().get(playerName);
  293. +
  294. + if (playerInstance == null)
  295. + continue;
  296. +
  297. + new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, false, false);
  298. + }
  299. + }
  300. +
  301. + _teams[0].cleanMe();
  302. + _teams[1].cleanMe();
  303. + setState(EventState.INACTIVE);
  304. + }
  305. +
  306. + /**
  307. + * Adds a player to a TvTEvent team<br>
  308. + * 1. Calculate the id of the team in which the player should be added<br>
  309. + * 2. Add the player to the calculated team
  310. + * @param playerInstance
  311. + * @return boolean
  312. + */
  313. + public static synchronized boolean addParticipant(L2PcInstance playerInstance)
  314. + {
  315. + if (playerInstance == null)
  316. + return false;
  317. +
  318. + byte teamId = 0;
  319. +
  320. + if (_teams[0].getParticipatedPlayerCount() == _teams[1].getParticipatedPlayerCount())
  321. + teamId = (byte)(Rnd.get(2));
  322. + else
  323. + teamId = (byte)(_teams[0].getParticipatedPlayerCount() > _teams[1].getParticipatedPlayerCount() ? 1 : 0);
  324. +
  325. + return _teams[teamId].addPlayer(playerInstance);
  326. + }
  327. +
  328. + /**
  329. + * Removes a TvTEvent player from it's team<br>
  330. + * 1. Get team id of the player<br>
  331. + * 2. Remove player from it's team
  332. + * @param playerName
  333. + * @return boolean
  334. + */
  335. + public static boolean removeParticipant(String playerName)
  336. + {
  337. + byte teamId = getParticipantTeamId(playerName);
  338. +
  339. + if (teamId == -1)
  340. + return false;
  341. +
  342. + _teams[teamId].removePlayer(playerName);
  343. + return true;
  344. + }
  345. +
  346. + /**
  347. + * Send a SystemMessage to all participated players<br>
  348. + * 1. Send the message to all players of team number one<br>
  349. + * 2. Send the message to all players of team number two
  350. + * @param message
  351. + */
  352. + public static void sysMsgToAllParticipants(String message)
  353. + {
  354. + for (L2PcInstance playerInstance : _teams[0].getParticipatedPlayers().values())
  355. + {
  356. + if (playerInstance != null)
  357. + playerInstance.sendMessage(message);
  358. + }
  359. +
  360. + for (L2PcInstance playerInstance : _teams[1].getParticipatedPlayers().values())
  361. + {
  362. + if (playerInstance != null)
  363. + playerInstance.sendMessage(message);
  364. + }
  365. + }
  366. +
  367. + /**
  368. + * Close doors specified in configs
  369. + */
  370. + private static void closeDoors()
  371. + {
  372. + for (int doorId : Config.TVT_EVENT_DOOR_IDS)
  373. + {
  374. + L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
  375. +
  376. + if (doorInstance != null)
  377. + doorInstance.closeMe();
  378. + }
  379. + }
  380. +
  381. + /**
  382. + * Open doors specified in configs
  383. + */
  384. + private static void openDoors()
  385. + {
  386. + for (int doorId : Config.TVT_EVENT_DOOR_IDS)
  387. + {
  388. + L2DoorInstance doorInstance = DoorTable.getInstance().getDoor(doorId);
  389. +
  390. + if (doorInstance != null)
  391. + doorInstance.openMe();
  392. + }
  393. + }
  394. +
  395. + /**
  396. + * UnSpawns the TvTEvent npc
  397. + */
  398. + private static void unSpawnNpc()
  399. + {
  400. + _lastNpcSpawn.deleteMe();
  401. + _npcSpawn.stopRespawn();
  402. + _npcSpawn = null;
  403. + _lastNpcSpawn = null;
  404. + }
  405. +
  406. + /**
  407. + * Called when a player logs in
  408. + * @param playerInstance
  409. + */
  410. + public static void onLogin(L2PcInstance playerInstance)
  411. + {
  412. + if (playerInstance == null || (!isStarting() && !isStarted()))
  413. + return;
  414. +
  415. + byte teamId = getParticipantTeamId(playerInstance.getName());
  416. +
  417. + if (teamId == -1)
  418. + return;
  419. +
  420. + _teams[teamId].addPlayer(playerInstance);
  421. + new TvTEventTeleporter(playerInstance, _teams[teamId].getCoordinates(), true, false);
  422. + }
  423. +
  424. + /**
  425. + * Called when a player logs out
  426. + * @param playerInstance
  427. + */
  428. + public static void onLogout(L2PcInstance playerInstance)
  429. + {
  430. + if (playerInstance == null || (!isStarting() && !isStarted()))
  431. + return;
  432. +
  433. + removeParticipant(playerInstance.getName());
  434. + }
  435. +
  436. + /**
  437. + * Called on every bypass by npc of type L2TvTEventNpc<br>
  438. + * Needs synchronization cause of the max player check
  439. + * @param command
  440. + * @param playerInstance
  441. + */
  442. + public static synchronized void onBypass(String command, L2PcInstance playerInstance)
  443. + {
  444. + if (playerInstance == null || !isParticipating())
  445. + return;
  446. +
  447. + if (command.equals("tvt_event_participation"))
  448. + {
  449. + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
  450. + int playerLevel = playerInstance.getLevel();
  451. +
  452. + if (playerInstance.isCursedWeaponEquipped())
  453. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Cursed weapon owners are not allowed to participate.</body></html>");
  454. + else if (OlympiadManager.getInstance().isRegisteredInComp(playerInstance))
  455. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Olympiad participants can't register.</body></html>");
  456. + else if (playerInstance.getKarma() > 0)
  457. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Chaotic players are not allowed to participate.</body></html>");
  458. + else if (_teams[0].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)
  459. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Sorry the event is full!</body></html>");
  460. + else if (playerLevel < Config.TVT_EVENT_MIN_LVL || playerLevel > Config.TVT_EVENT_MAX_LVL)
  461. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Only players from level " + Config.TVT_EVENT_MIN_LVL + " to level " + Config.TVT_EVENT_MAX_LVL + " are allowed tro participate.</body></html>");
  462. + else if (_teams[0].getParticipatedPlayerCount() > 19 && _teams[1].getParticipatedPlayerCount() > 19)
  463. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>The event is full! Maximum of " + Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS + " player are allowed in one team.</body></html>");
  464. + else if (addParticipant(playerInstance))
  465. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>You are on the registration list now.</body></html>");
  466. + else // addParticipant returned false cause playerInstance == null
  467. + return;
  468. +
  469. + playerInstance.sendPacket(npcHtmlMessage);
  470. + }
  471. + else if (command.equals("tvt_event_remove_participation"))
  472. + {
  473. + removeParticipant(playerInstance.getName());
  474. +
  475. + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
  476. +
  477. + npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>You are not longer on the registration list.</body></html>");
  478. + playerInstance.sendPacket(npcHtmlMessage);
  479. + }
  480. + }
  481. +
  482. + /**
  483. + * Called on every onAction in L2PcIstance
  484. + * @param playerName
  485. + * @param targetPlayerName
  486. + * @return boolean
  487. + */
  488. + public static boolean onAction(String playerName, String targetPlayerName)
  489. + {
  490. + if (!isStarted())
  491. + return true;
  492. +
  493. + L2PcInstance playerInstance = L2World.getInstance().getPlayer(playerName);
  494. +
  495. + if (playerInstance == null)
  496. + return false;
  497. +
  498. + if (playerInstance.isGM())
  499. + return true;
  500. +
  501. + byte playerTeamId = getParticipantTeamId(playerName);
  502. + byte targetPlayerTeamId = getParticipantTeamId(targetPlayerName);
  503. +
  504. + if ((playerTeamId != -1 && targetPlayerTeamId == -1) ||
  505. + (playerTeamId == -1 && targetPlayerTeamId != -1))
  506. + return false;
  507. +
  508. + if (playerTeamId != -1 && targetPlayerTeamId != -1 && playerTeamId == targetPlayerTeamId && !Config.TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED)
  509. + return false;
  510. +
  511. + return true;
  512. + }
  513. +
  514. + /**
  515. + * Called on every potion use
  516. + * @param playerName
  517. + * @return boolean
  518. + */
  519. + public static boolean onPotionUse(String playerName)
  520. + {
  521. + if (!isStarted())
  522. + return true;
  523. +
  524. + if (isPlayerParticipant(playerName) && !Config.TVT_EVENT_POTIONS_ALLOWED)
  525. + return false;
  526. +
  527. + return true;
  528. + }
  529. +
  530. + /**
  531. + * Called on every escape use(thanks to nbd)
  532. + * @param playerName
  533. + * @return boolean
  534. + */
  535. + public static boolean onEscapeUse(String playerName)
  536. + {
  537. + if (!isStarted())
  538. + return true;
  539. +
  540. + if (isPlayerParticipant(playerName))
  541. + return false;
  542. +
  543. + return true;
  544. + }
  545. +
  546. + /**
  547. + * Called on every summon item use
  548. + * @param playerName
  549. + * @return boolean
  550. + */
  551. + public static boolean onItemSummon(String playerName)
  552. + {
  553. + if (!isStarted())
  554. + return true;
  555. +
  556. + if (isPlayerParticipant(playerName) && !Config.TVT_EVENT_SUMMON_BY_ITEM_ALLOWED)
  557. + return false;
  558. +
  559. + return true;
  560. + }
  561. +
  562. + /**
  563. + * Is called when a player is killed
  564. + * @param killerCharacter
  565. + * @param killedPlayerInstance
  566. + */
  567. + public static void onKill(L2Character killerCharacter, L2PcInstance killedPlayerInstance)
  568. + {
  569. + if (killerCharacter == null || killedPlayerInstance == null ||
  570. + (!(killerCharacter instanceof L2PcInstance) &&
  571. + !(killerCharacter instanceof L2PetInstance) &&
  572. + !(killerCharacter instanceof L2SummonInstance)) ||
  573. + !isStarted())
  574. + return;
  575. +
  576. + L2PcInstance killerPlayerInstance = null;
  577. +
  578. + if (killerCharacter instanceof L2PetInstance || killerCharacter instanceof L2SummonInstance)
  579. + {
  580. + killerPlayerInstance = ((L2Summon)killerCharacter).getOwner();
  581. +
  582. + if (killerPlayerInstance == null)
  583. + return;
  584. + }
  585. + else
  586. + killerPlayerInstance = (L2PcInstance)killerCharacter;
  587. +
  588. + String playerName = killerPlayerInstance.getName();
  589. + byte killerTeamId = getParticipantTeamId(playerName);
  590. +
  591. + playerName = killedPlayerInstance.getName();
  592. +
  593. + byte killedTeamId = getParticipantTeamId(playerName);
  594. +
  595. + if (killerTeamId != -1 && killedTeamId != -1 && killerTeamId != killedTeamId)
  596. + _teams[killerTeamId].increasePoints();
  597. +
  598. + if (killedTeamId != -1)
  599. + new TvTEventTeleporter(killedPlayerInstance, _teams[killedTeamId].getCoordinates(), false, false);
  600. + }
  601. +
  602. + /**
  603. + * Sets the TvTEvent state
  604. + * @param state
  605. + */
  606. + private static void setState(EventState state)
  607. + {
  608. + synchronized (_state)
  609. + {
  610. + _state = state;
  611. + }
  612. + }
  613. +
  614. + /**
  615. + * Is TvTEvent inactive?
  616. + * @return boolean
  617. + */
  618. + public static boolean isInactive()
  619. + {
  620. + boolean isInactive;
  621. +
  622. + synchronized (_state)
  623. + {
  624. + isInactive = _state == EventState.INACTIVE;
  625. + }
  626. +
  627. + return isInactive;
  628. + }
  629. +
  630. + /**
  631. + * Is TvTEvent in inactivating?
  632. + * @return boolean
  633. + */
  634. + public static boolean isInactivating()
  635. + {
  636. + boolean isInactivating;
  637. +
  638. + synchronized (_state)
  639. + {
  640. + isInactivating = _state == EventState.INACTIVATING;
  641. + }
  642. +
  643. + return isInactivating;
  644. + }
  645. +
  646. + /**
  647. + * Is TvTEvent in participation?
  648. + * @return boolean
  649. + */
  650. + public static boolean isParticipating()
  651. + {
  652. + boolean isParticipating;
  653. +
  654. + synchronized (_state)
  655. + {
  656. + isParticipating = _state == EventState.PARTICIPATING;
  657. + }
  658. +
  659. + return isParticipating;
  660. + }
  661. +
  662. + /**
  663. + * Is TvTEvent starting?
  664. + * @return boolean
  665. + */
  666. + public static boolean isStarting()
  667. + {
  668. + boolean isStarting;
  669. +
  670. + synchronized (_state)
  671. + {
  672. + isStarting = _state == EventState.STARTING;
  673. + }
  674. +
  675. + return isStarting;
  676. + }
  677. +
  678. + /**
  679. + * Is TvTEvent started?
  680. + * @return boolean
  681. + */
  682. + public static boolean isStarted()
  683. + {
  684. + boolean isStarted;
  685. +
  686. + synchronized (_state)
  687. + {
  688. + isStarted = _state == EventState.STARTED;
  689. + }
  690. +
  691. + return isStarted;
  692. + }
  693. +
  694. + /**
  695. + * Is TvTEvent rewarding?
  696. + * @return boolean
  697. + */
  698. + public static boolean isRewarding()
  699. + {
  700. + boolean isRewarding;
  701. +
  702. + synchronized (_state)
  703. + {
  704. + isRewarding = _state == EventState.REWARDING;
  705. + }
  706. +
  707. + return isRewarding;
  708. + }
  709. +
  710. + /**
  711. + * Returns the team id of a player, if player is not participant it returns -1
  712. + * @param playerName
  713. + * @return byte
  714. + */
  715. + public static byte getParticipantTeamId(String playerName)
  716. + {
  717. + return (byte)(_teams[0].containsPlayer(playerName) ? 0 : (_teams[1].containsPlayer(playerName) ? 1 : -1));
  718. + }
  719. +
  720. + /**
  721. + * Returns the team coordinates in which the player is in, if player is not in a team return null
  722. + * @param playerName
  723. + * @return int[]
  724. + */
  725. + public static int[] getParticipantTeamCoordinates(String playerName)
  726. + {
  727. + return _teams[0].containsPlayer(playerName) ? _teams[0].getCoordinates() : (_teams[1].containsPlayer(playerName) ? _teams[1].getCoordinates() : null);
  728. + }
  729. +
  730. +
  731. + /**
  732. + * Is given player participant of the event?
  733. + * @param playerName
  734. + * @return boolean
  735. + */
  736. + public static boolean isPlayerParticipant(String playerName)
  737. + {
  738. + return _teams[0].containsPlayer(playerName) || _teams[1].containsPlayer(playerName);
  739. + }
  740. +
  741. + /**
  742. + * Returns participated player count<br><br>
  743. + *
  744. + * @return int<br>
  745. + */
  746. + public static int getParticipatedPlayersCount()
  747. + {
  748. + return _teams[0].getParticipatedPlayerCount() + _teams[1].getParticipatedPlayerCount();
  749. + }
  750. +
  751. + /**
  752. + * Returns teams names<br><br>
  753. + *
  754. + * @return String[]<br>
  755. + */
  756. + public static String[] getTeamNames()
  757. + {
  758. + return new String[]{_teams[0].getName(), _teams[1].getName()};
  759. + }
  760. +
  761. + /**
  762. + * Returns player count of both teams<br><br>
  763. + *
  764. + * @return int[]<br>
  765. + */
  766. + public static int[] getTeamsPlayerCounts()
  767. + {
  768. + return new int[]{_teams[0].getParticipatedPlayerCount(), _teams[1].getParticipatedPlayerCount()};
  769. + }
  770. +
  771. + /**
  772. + * Returns points count of both teams
  773. + *
  774. + * @return int[]
  775. + */
  776. + public static int[] getTeamsPoints()
  777. + {
  778. + return new int[]{_teams[0].getPoints(), _teams[1].getPoints()};
  779. + }
  780. +}
  781. ### Eclipse Workspace Patch 1.0
  782. #P aCis_gameserver
  783. Index: java/net/sf/l2j/gameserver/model/entity/TvTEventTeam.java
  784. ===================================================================
  785. --- java/net/sf/l2j/gameserver/model/entity/TvTEventTeam.java (revision 0)
  786. +++ java/net/sf/l2j/gameserver/model/entity/TvTEventTeam.java (revision 0)
  787. @@ -0,0 +1,204 @@
  788. +/*
  789. + * This program is free software; you can redistribute it and/or modify
  790. + * it under the terms of the GNU General Public License as published by
  791. + * the Free Software Foundation; either version 2, or (at your option)
  792. + * any later version.
  793. + *
  794. + * This program is distributed in the hope that it will be useful,
  795. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  796. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  797. + * GNU General Public License for more details.
  798. + *
  799. + * You should have received a copy of the GNU General Public License
  800. + * along with this program; if not, write to the Free Software
  801. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  802. + * 02111-1307, USA.
  803. + *
  804. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  805. + */
  806. +package net.sf.l2j.gameserver.model.entity;
  807. +
  808. +import java.util.Map;
  809. +import java.util.Vector;
  810. +
  811. +import java.util.HashMap;
  812. +
  813. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  814. +
  815. +/**
  816. + * @author FBIagent
  817. + */
  818. +public class TvTEventTeam
  819. +{
  820. + /** The name of the team<br> */
  821. + private String _name;
  822. + /** The team spot coordinated<br> */
  823. + private int[] _coordinates = new int[3];
  824. + /** The points of the team<br> */
  825. + private short _points;
  826. + /** Name and instance of all participated players in FastMap<br> */
  827. + private Map<String, L2PcInstance> _participatedPlayers = new HashMap<String, L2PcInstance>();
  828. + /** Name of all participated players in Vector<br> */
  829. + private Vector<String> _participatedPlayerNames = new Vector<String>();
  830. +
  831. + /**
  832. + * C'tor initialize the team
  833. + * @param name
  834. + * @param coordinates
  835. + */
  836. + public TvTEventTeam(String name, int[] coordinates)
  837. + {
  838. + _name = name;
  839. + _coordinates = coordinates;
  840. + _points = 0;
  841. + }
  842. +
  843. + /**
  844. + * Adds a player to the team
  845. + *
  846. + * @param playerInstance
  847. + * @return boolean
  848. + */
  849. + public boolean addPlayer(L2PcInstance playerInstance)
  850. + {
  851. + if (playerInstance == null)
  852. + return false;
  853. +
  854. + synchronized (_participatedPlayers)
  855. + {
  856. + String playerName = playerInstance.getName();
  857. +
  858. + _participatedPlayers.put(playerName, playerInstance);
  859. +
  860. + if (!_participatedPlayerNames.contains(playerName))
  861. + _participatedPlayerNames.add(playerName);
  862. + }
  863. +
  864. + return true;
  865. + }
  866. +
  867. + /**
  868. + * Removes a player from the team
  869. + * @param playerName
  870. + */
  871. + public void removePlayer(String playerName)
  872. + {
  873. + synchronized (_participatedPlayers)
  874. + {
  875. + _participatedPlayers.remove(playerName);
  876. + _participatedPlayerNames.remove(playerName);
  877. + }
  878. + }
  879. +
  880. + /**
  881. + * Increases the points of the team<br>
  882. + */
  883. + public void increasePoints()
  884. + {
  885. + _points++;
  886. + }
  887. +
  888. + /**
  889. + * Cleanup the team and make it ready for adding players again<br>
  890. + */
  891. + public void cleanMe()
  892. + {
  893. + _participatedPlayers.clear();
  894. + _participatedPlayerNames.clear();
  895. + _participatedPlayers = new HashMap<String, L2PcInstance>();
  896. + _participatedPlayerNames = new Vector<String>();
  897. + _points = 0;
  898. + }
  899. +
  900. + /**
  901. + * Is given player in this team?
  902. + * @param playerName
  903. + * @return boolean
  904. + */
  905. + public boolean containsPlayer(String playerName)
  906. + {
  907. + boolean containsPlayer;
  908. +
  909. + synchronized (_participatedPlayers)
  910. + {
  911. + containsPlayer = _participatedPlayerNames.contains(playerName);
  912. + }
  913. +
  914. + return containsPlayer;
  915. + }
  916. +
  917. + /**
  918. + * Returns the name of the team
  919. + * @return String
  920. + */
  921. + public String getName()
  922. + {
  923. + return _name;
  924. + }
  925. +
  926. + /**
  927. + * Returns the coordinates of the team spot
  928. + * @return int[]
  929. + */
  930. + public int[] getCoordinates()
  931. + {
  932. + return _coordinates;
  933. + }
  934. +
  935. + /**
  936. + * Returns the points of the team
  937. + * @return short
  938. + */
  939. + public short getPoints()
  940. + {
  941. + return _points;
  942. + }
  943. +
  944. + /**
  945. + * Returns name and instance of all participated players in FastMap
  946. + * @return Map<String, L2PcInstance>
  947. + */
  948. + public Map<String, L2PcInstance> getParticipatedPlayers()
  949. + {
  950. + Map<String, L2PcInstance> participatedPlayers = null;
  951. +
  952. + synchronized (_participatedPlayers)
  953. + {
  954. + participatedPlayers = _participatedPlayers;
  955. + }
  956. +
  957. + return participatedPlayers;
  958. + }
  959. +
  960. + /**
  961. + * Returns name of all participated players in Vector
  962. + * @return Vector<String>
  963. + */
  964. + public Vector<String> getParticipatedPlayerNames()
  965. + {
  966. + Vector<String> participatedPlayerNames = null;
  967. +
  968. + synchronized (_participatedPlayers)
  969. + {
  970. + participatedPlayerNames = _participatedPlayerNames;
  971. + }
  972. +
  973. + return participatedPlayerNames;
  974. + }
  975. +
  976. + /**
  977. + * Returns player count of this team
  978. + * @return int
  979. + */
  980. + public int getParticipatedPlayerCount()
  981. + {
  982. + int participatedPlayerCount;
  983. +
  984. + synchronized (_participatedPlayers)
  985. + {
  986. + participatedPlayerCount = _participatedPlayers.size();
  987. + }
  988. +
  989. + return participatedPlayerCount;
  990. + }
  991. +}
  992. ### Eclipse Workspace Patch 1.0
  993. #P aCis_gameserver
  994. Index: java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java
  995. ===================================================================
  996. --- java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java (revision 0)
  997. +++ java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java (revision 0)
  998. @@ -0,0 +1,99 @@
  999. +/*
  1000. + * This program is free software; you can redistribute it and/or modify
  1001. + * it under the terms of the GNU General Public License as published by
  1002. + * the Free Software Foundation; either version 2, or (at your option)
  1003. + * any later version.
  1004. + *
  1005. + * This program is distributed in the hope that it will be useful,
  1006. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1007. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1008. + * GNU General Public License for more details.
  1009. + *
  1010. + * You should have received a copy of the GNU General Public License
  1011. + * along with this program; if not, write to the Free Software
  1012. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1013. + * 02111-1307, USA.
  1014. + *
  1015. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  1016. + */
  1017. +package net.sf.l2j.gameserver.model.entity;
  1018. +
  1019. +import net.sf.l2j.Config;
  1020. +import net.sf.l2j.gameserver.ThreadPoolManager;
  1021. +import net.sf.l2j.gameserver.model.L2Effect;
  1022. +import net.sf.l2j.gameserver.model.actor.L2Summon;
  1023. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1024. +
  1025. +public class TvTEventTeleporter implements Runnable
  1026. +{
  1027. + /** The instance of the player to teleport */
  1028. + private L2PcInstance _playerInstance;
  1029. + /** Coordinates of the spot to teleport to */
  1030. + private int[] _coordinates = new int[3];
  1031. + /** Admin removed this player from event */
  1032. + private boolean _adminRemove;
  1033. +
  1034. + /**
  1035. + * Initialize the teleporter and start the delayed task
  1036. + * @param playerInstance
  1037. + * @param coordinates
  1038. + * @param fastSchedule
  1039. + * @param adminRemove
  1040. + */
  1041. + public TvTEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove)
  1042. + {
  1043. + _playerInstance = playerInstance;
  1044. + _coordinates = coordinates;
  1045. + _adminRemove = adminRemove;
  1046. +
  1047. + // in config as seconds
  1048. + long delay = (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000;
  1049. +
  1050. + if (fastSchedule)
  1051. + delay = 0;
  1052. +
  1053. + ThreadPoolManager.getInstance().scheduleGeneral(this, delay);
  1054. + }
  1055. +
  1056. + /**
  1057. + * The task method to teleport the player<br>
  1058. + * 1. Unsummon pet if there is one
  1059. + * 2. Remove all effects
  1060. + * 3. Revive and full heal the player
  1061. + * 4. Teleport the player
  1062. + * 5. Broadcast status and user info
  1063. + *
  1064. + * @see java.lang.Runnable#run()
  1065. + */
  1066. + @Override
  1067. + public void run()
  1068. + {
  1069. + if (_playerInstance == null)
  1070. + return;
  1071. +
  1072. + L2Summon summon = _playerInstance.getPet();
  1073. +
  1074. + if (summon != null)
  1075. + summon.unSummon(_playerInstance);
  1076. +
  1077. + for (L2Effect effect : _playerInstance.getAllEffects())
  1078. + {
  1079. + if (effect != null)
  1080. + effect.exit();
  1081. + }
  1082. +
  1083. + _playerInstance.doRevive();
  1084. + _playerInstance.setCurrentCp(_playerInstance.getMaxCp());
  1085. + _playerInstance.setCurrentHp(_playerInstance.getMaxHp());
  1086. + _playerInstance.setCurrentMp(_playerInstance.getMaxMp());
  1087. + _playerInstance.teleToLocation(_coordinates[0], _coordinates[1], _coordinates[2], 0);
  1088. +
  1089. + if (TvTEvent.isStarted() && !_adminRemove)
  1090. + _playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getName())+1);
  1091. + else
  1092. + _playerInstance.setTeam(0);
  1093. +
  1094. + _playerInstance.broadcastStatusUpdate();
  1095. + _playerInstance.broadcastUserInfo();
  1096. + }
  1097. +}
  1098. ### Eclipse Workspace Patch 1.0
  1099. #P aCis_gameserver
  1100. Index: java/net/sf/l2j/gameserver/model/entity/TvTManager.java
  1101. ===================================================================
  1102. --- java/net/sf/l2j/gameserver/model/entity/TvTManager.java (revision 0)
  1103. +++ java/net/sf/l2j/gameserver/model/entity/TvTManager.java (revision 0)
  1104. @@ -0,0 +1,170 @@
  1105. +/*
  1106. + * This program is free software; you can redistribute it and/or modify
  1107. + * it under the terms of the GNU General Public License as published by
  1108. + * the Free Software Foundation; either version 2, or (at your option)
  1109. + * any later version.
  1110. + *
  1111. + * This program is distributed in the hope that it will be useful,
  1112. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1113. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1114. + * GNU General Public License for more details.
  1115. + *
  1116. + * You should have received a copy of the GNU General Public License
  1117. + * along with this program; if not, write to the Free Software
  1118. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1119. + * 02111-1307, USA.
  1120. + *
  1121. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  1122. + */
  1123. +package net.sf.l2j.gameserver.model.entity;
  1124. +
  1125. +import net.sf.l2j.Config;
  1126. +import net.sf.l2j.gameserver.Announcements;
  1127. +import net.sf.l2j.gameserver.ThreadPoolManager;
  1128. +
  1129. +/**
  1130. + * @author FBIagent
  1131. + */
  1132. +public class TvTManager implements Runnable
  1133. +{
  1134. + /** The one and only instance of this class<br> */
  1135. + private static TvTManager _instance = null;
  1136. +
  1137. + /**
  1138. + * New instance only by getInstance()<br>
  1139. + */
  1140. + private TvTManager()
  1141. + {
  1142. + if (Config.TVT_EVENT_ENABLED)
  1143. + {
  1144. + ThreadPoolManager.getInstance().scheduleGeneral(this, 0);
  1145. + System.out.println("TvTEventEngine[TvTManager.TvTManager()]: Started.");
  1146. + }
  1147. + else
  1148. + System.out.println("TvTEventEngine[TvTManager.TvTManager()]: Engine is disabled.");
  1149. + }
  1150. +
  1151. + /**
  1152. + * Initialize new/Returns the one and only instance<br><br>
  1153. + *
  1154. + * @return TvTManager<br>
  1155. + */
  1156. + public static TvTManager getInstance()
  1157. + {
  1158. + if (_instance == null)
  1159. + _instance = new TvTManager();
  1160. +
  1161. + return _instance;
  1162. + }
  1163. +
  1164. + /**
  1165. + * The task method to handle cycles of the event
  1166. + * @see java.lang.Runnable#run()
  1167. + */
  1168. + @Override
  1169. + public void run()
  1170. + {
  1171. + TvTEvent.init();
  1172. +
  1173. + for (;;)
  1174. + {
  1175. + waiter(Config.TVT_EVENT_INTERVAL * 60); // in config given as minutes
  1176. +
  1177. + if (!TvTEvent.startParticipation())
  1178. + {
  1179. + Announcements.announceToAll("TvT Event: Event was canceled.");
  1180. + System.out.println("TvTEventEngine[TvTManager.run()]: Error spawning event npc for participation.");
  1181. + continue;
  1182. + }
  1183. + Announcements.announceToAll("TvT Event: Registration opened for " + Config.TVT_EVENT_PARTICIPATION_TIME + " minute(s).");
  1184. +
  1185. + waiter(Config.TVT_EVENT_PARTICIPATION_TIME * 60); // in config given as minutes
  1186. +
  1187. + if (!TvTEvent.startFight())
  1188. + {
  1189. + Announcements.announceToAll("TvT Event: Event canceled due to lack of Participation.");
  1190. + System.out.println("TvTEventEngine[TvTManager.run()]: Lack of registration, abort event.");
  1191. + continue;
  1192. + }
  1193. + Announcements.announceToAll("TvT Event: Registration closed!");
  1194. + TvTEvent.sysMsgToAllParticipants("TvT Event: Teleporting participants to an arena in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
  1195. +
  1196. + waiter(Config.TVT_EVENT_RUNNING_TIME * 60); // in config given as minutes
  1197. + Announcements.announceToAll(TvTEvent.calculateRewards());
  1198. + TvTEvent.sysMsgToAllParticipants("TvT Event: Teleporting back to the registration npc in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s).");
  1199. + TvTEvent.stopFight();
  1200. + }
  1201. + }
  1202. +
  1203. + /**
  1204. + * This method waits for a period time delay
  1205. + * @param seconds
  1206. + */
  1207. + void waiter(int seconds)
  1208. + {
  1209. + while (seconds > 1)
  1210. + {
  1211. + seconds--; // here because we don't want to see two time announce at the same time
  1212. +
  1213. + if (TvTEvent.isParticipating() || TvTEvent.isStarted())
  1214. + {
  1215. + switch (seconds)
  1216. + {
  1217. + case 3600: // 1 hour left
  1218. + if (TvTEvent.isParticipating())
  1219. + Announcements.announceToAll("TvT Event: " + seconds / 60 / 60 + " hour(s) umtil registration is closed!");
  1220. + else if (TvTEvent.isStarted())
  1221. + TvTEvent.sysMsgToAllParticipants("TvT Event: " + seconds / 60 / 60 + " hour(s) until event is finished!");
  1222. +
  1223. + break;
  1224. + case 1800: // 30 minutes left
  1225. + case 900: // 15 minutes left
  1226. + case 600: // 10 minutes left
  1227. + case 300: // 5 minutes left
  1228. + case 240: // 4 minutes left
  1229. + case 180: // 3 minutes left
  1230. + case 120: // 2 minutes left
  1231. + case 60: // 1 minute left
  1232. + if (TvTEvent.isParticipating())
  1233. + Announcements.announceToAll("TvT Event: " + seconds / 60 + " minute(s) until registration is closed!");
  1234. + else if (TvTEvent.isStarted())
  1235. + TvTEvent.sysMsgToAllParticipants("TvT Event: " + seconds / 60 + " minute(s) until the event is finished!");
  1236. +
  1237. + break;
  1238. + case 30: // 30 seconds left
  1239. + /**
  1240. + * case 15: // 15 seconds left
  1241. + * case 10: // 10 seconds left
  1242. + */
  1243. + case 5: // 5 seconds left
  1244. +
  1245. + /**
  1246. + *
  1247. + * case 4: // 4 seconds left
  1248. + * case 3: // 3 seconds left
  1249. + * case 2: // 2 seconds left
  1250. + * case 1: // 1 seconds left
  1251. + */
  1252. + if (TvTEvent.isParticipating())
  1253. + Announcements.announceToAll("TvT Event: " + seconds + " second(s) until registration is closed!");
  1254. + else if (TvTEvent.isStarted())
  1255. + TvTEvent.sysMsgToAllParticipants("TvT Event: " + seconds + " second(s) until the event is finished!");
  1256. +
  1257. + break;
  1258. + }
  1259. + }
  1260. +
  1261. + long oneSecWaitStart = System.currentTimeMillis();
  1262. +
  1263. + while (oneSecWaitStart + 1000L > System.currentTimeMillis())
  1264. + {
  1265. + try
  1266. + {
  1267. + Thread.sleep(1);
  1268. + }
  1269. + catch (InterruptedException ie)
  1270. + {}
  1271. + }
  1272. + }
  1273. + }
  1274. +}
  1275. ### Eclipse Workspace Patch 1.0
  1276. #P aCis_gameserver
  1277. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  1278. ===================================================================
  1279. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2)
  1280. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  1281. @@ -126,6 +126,7 @@
  1282. import net.sf.l2j.gameserver.model.entity.Duel;
  1283. import net.sf.l2j.gameserver.model.entity.Hero;
  1284. import net.sf.l2j.gameserver.model.entity.Siege;
  1285. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1286. import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
  1287. import net.sf.l2j.gameserver.model.itemcontainer.ItemContainer;
  1288. import net.sf.l2j.gameserver.model.itemcontainer.PcFreight;
  1289. @@ -396,6 +397,7 @@
  1290.  
  1291. private boolean _isInWater;
  1292. private boolean _isIn7sDungeon = false;
  1293. + public boolean atEvent = false;
  1294.  
  1295. private PunishLevel _punishLevel = PunishLevel.NONE;
  1296. private long _punishTimer = 0;
  1297. @@ -3301,6 +3303,12 @@
  1298. @Override
  1299. public void onAction(L2PcInstance player)
  1300. {
  1301. + if (!TvTEvent.onAction(player.getName(), getName()))
  1302. + {
  1303. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1304. + return;
  1305. + }
  1306. +
  1307. // Check if the player already target this L2PcInstance
  1308. if (player.getTarget() != this)
  1309. {
  1310. @@ -4060,6 +4068,8 @@
  1311. stopFakeDeath(true);
  1312. }
  1313.  
  1314. + TvTEvent.onKill(killer, this);
  1315. +
  1316. if (killer != null)
  1317. {
  1318. L2PcInstance pk = killer.getActingPlayer();
  1319. @@ -4216,6 +4226,11 @@
  1320. }
  1321. }
  1322.  
  1323. + public boolean isInFunEvent()
  1324. + {
  1325. + return (atEvent ||(TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(getName())) && !isGM());
  1326. + }
  1327. +
  1328. private void onDieUpdateKarma()
  1329. {
  1330. // Karma lose for server that does not allow delevel
  1331. @@ -4471,7 +4486,8 @@
  1332. // Calculate the Experience loss
  1333. long lostExp = 0;
  1334.  
  1335. - if (lvl < Experience.MAX_LEVEL)
  1336. + if (!atEvent)
  1337. + if (lvl < Experience.MAX_LEVEL)
  1338. lostExp = Math.round((getStat().getExpForLevel(lvl + 1) - getStat().getExpForLevel(lvl)) * percentLost / 100);
  1339. else
  1340. lostExp = Math.round((getStat().getExpForLevel(Experience.MAX_LEVEL) - getStat().getExpForLevel(Experience.MAX_LEVEL - 1)) * percentLost / 100);
  1341. ### Eclipse Workspace Patch 1.0
  1342. #P aCis_gameserver
  1343. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java
  1344. ===================================================================
  1345. --- java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (revision 2)
  1346. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (working copy)
  1347. @@ -25,6 +25,8 @@
  1348. import net.sf.l2j.gameserver.model.actor.L2Character;
  1349. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1350. import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  1351. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1352. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1353. import net.sf.l2j.gameserver.skills.Formulas;
  1354. import net.sf.l2j.gameserver.taskmanager.DecayTaskManager;
  1355. import net.sf.l2j.gameserver.templates.skills.L2SkillType;
  1356. @@ -68,6 +70,13 @@
  1357. return;
  1358. }
  1359.  
  1360. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getName()))
  1361. + {
  1362. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1363. + return;
  1364. + }
  1365. +
  1366. +
  1367. for (L2Character cha : targetToRes)
  1368. {
  1369. if (activeChar instanceof L2PcInstance)
  1370. ### Eclipse Workspace Patch 1.0
  1371. #P aCis_gameserver
  1372. Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
  1373. ===================================================================
  1374. --- java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java (revision 2)
  1375. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java (working copy)
  1376. @@ -35,6 +35,7 @@
  1377. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1378. import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  1379. import net.sf.l2j.gameserver.model.actor.instance.L2XmassTreeInstance;
  1380. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1381. import net.sf.l2j.gameserver.network.SystemMessageId;
  1382. import net.sf.l2j.gameserver.network.serverpackets.MagicSkillLaunched;
  1383. import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  1384. @@ -52,6 +53,9 @@
  1385. if (!(playable instanceof L2PcInstance))
  1386. return;
  1387.  
  1388. + if (!TvTEvent.onItemSummon(playable.getName()))
  1389. + return;
  1390. +
  1391. final L2PcInstance activeChar = (L2PcInstance) playable;
  1392.  
  1393. if (activeChar.isSitting())
  1394. ### Eclipse Workspace Patch 1.0
  1395. #P aCis_gameserver
  1396. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java
  1397. ===================================================================
  1398. --- java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java (revision 2)
  1399. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2OlympiadManagerInstance.java (working copy)
  1400. @@ -19,6 +19,7 @@
  1401. import net.sf.l2j.gameserver.model.L2ItemInstance;
  1402. import net.sf.l2j.gameserver.model.L2Multisell;
  1403. import net.sf.l2j.gameserver.model.entity.Hero;
  1404. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1405. import net.sf.l2j.gameserver.model.olympiad.CompetitionType;
  1406. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  1407. import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
  1408. @@ -208,6 +209,13 @@
  1409. }
  1410. else if (command.startsWith("Olympiad"))
  1411. {
  1412. + if (TvTEvent.isParticipating())
  1413. + {
  1414. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1415. + player.sendMessage("You can't do that while in a event");
  1416. + return;
  1417. + }
  1418. +
  1419. int val = Integer.parseInt(command.substring(9, 10));
  1420.  
  1421. NpcHtmlMessage reply = new NpcHtmlMessage(getObjectId());
  1422. @@ -243,6 +251,14 @@
  1423. break;
  1424.  
  1425. case 3: // Spectator overview
  1426. +
  1427. + if (TvTEvent.isParticipating() || TvTEvent.isStarting() || TvTEvent.isStarted())
  1428. + {
  1429. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1430. + player.sendMessage("You can't do that while in a event");
  1431. + return;
  1432. + }
  1433. +
  1434. StringBuilder list = new StringBuilder(2000);
  1435. OlympiadGameTask task;
  1436.  
  1437. ### Eclipse Workspace Patch 1.0
  1438. #P aCis_gameserver
  1439. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  1440. ===================================================================
  1441. --- java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 2)
  1442. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (working copy)
  1443. @@ -32,6 +32,7 @@
  1444. import net.sf.l2j.gameserver.model.base.PlayerClass;
  1445. import net.sf.l2j.gameserver.model.base.SubClass;
  1446. import net.sf.l2j.gameserver.model.entity.Siege;
  1447. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1448. import net.sf.l2j.gameserver.model.quest.QuestState;
  1449. import net.sf.l2j.gameserver.network.SystemMessageId;
  1450. import net.sf.l2j.gameserver.network.serverpackets.AcquireSkillList;
  1451. @@ -163,6 +164,13 @@
  1452. }
  1453. else if (command.startsWith("Subclass"))
  1454. {
  1455. +
  1456. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getName()))
  1457. + {
  1458. + player.sendMessage("You can not change sub class while registered at TvT");
  1459. + return;
  1460. + }
  1461. +
  1462. // Subclasses may not be changed while a skill is in use.
  1463. if (player.isCastingNow() || player.isAllSkillsDisabled())
  1464. {
  1465. ### Eclipse Workspace Patch 1.0
  1466. #P aCis_gameserver
  1467. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
  1468. ===================================================================
  1469. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (revision 2)
  1470. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (working copy)
  1471. @@ -18,10 +18,12 @@
  1472. import net.sf.l2j.gameserver.SevenSignsFestival;
  1473. import net.sf.l2j.gameserver.model.L2Party;
  1474. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1475. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1476. import net.sf.l2j.gameserver.model.zone.ZoneId;
  1477. import net.sf.l2j.gameserver.network.L2GameClient;
  1478. import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
  1479. import net.sf.l2j.gameserver.network.SystemMessageId;
  1480. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1481. import net.sf.l2j.gameserver.network.serverpackets.CharSelectInfo;
  1482. import net.sf.l2j.gameserver.network.serverpackets.RestartResponse;
  1483. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  1484. @@ -47,6 +49,13 @@
  1485. return;
  1486. }
  1487.  
  1488. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getName()))
  1489. + {
  1490. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1491. + player.sendMessage("You can not restart when you registering in TvTEvent.");
  1492. + return;
  1493. + }
  1494. +
  1495. if (player.isLocked())
  1496. {
  1497. sendPacket(RestartResponse.valueOf(false));
  1498. ### Eclipse Workspace Patch 1.0
  1499. #P aCis_gameserver
  1500. Index: java/net/sf/l2j/gameserver/network/serverpackets/Die.java
  1501. ===================================================================
  1502. --- java/net/sf/l2j/gameserver/network/serverpackets/Die.java (revision 2)
  1503. +++ java/net/sf/l2j/gameserver/network/serverpackets/Die.java (working copy)
  1504. @@ -32,6 +32,7 @@
  1505. private L2AccessLevel _access = AccessLevels._userAccessLevel;
  1506. private L2Clan _clan;
  1507. L2Character _activeChar;
  1508. + private boolean _funEvent;
  1509.  
  1510. public Die(L2Character cha)
  1511. {
  1512. @@ -41,6 +42,8 @@
  1513. L2PcInstance player = (L2PcInstance) cha;
  1514. _access = player.getAccessLevel();
  1515. _clan = player.getClan();
  1516. + _funEvent = !player.isInFunEvent();
  1517. +
  1518.  
  1519. }
  1520. _charObjId = cha.getObjectId();
  1521. @@ -58,9 +61,9 @@
  1522.  
  1523. writeC(0x06);
  1524. writeD(_charObjId);
  1525. - writeD(0x01); // to nearest village
  1526. + writeD(_funEvent ? 0x01 : 0); // 6d 00 00 00 00 - to nearest village
  1527.  
  1528. - if (_clan != null)
  1529. + if (_funEvent && _clan != null)
  1530. {
  1531. L2SiegeClan siegeClan = null;
  1532. boolean isInDefense = false;
  1533. ### Eclipse Workspace Patch 1.0
  1534. #P aCis_gameserver
  1535. Index: java/net/sf/l2j/Config.java
  1536. ===================================================================
  1537. --- java/net/sf/l2j/Config.java (revision 2)
  1538. +++ java/net/sf/l2j/Config.java (working copy)
  1539. @@ -206,6 +206,29 @@
  1540. public static boolean WEDDING_SAMESEX;
  1541. public static boolean WEDDING_FORMALWEAR;
  1542.  
  1543. + /** Team vs. Team Event Engine */
  1544. + public static boolean TVT_EVENT_ENABLED;
  1545. + public static int TVT_EVENT_INTERVAL;
  1546. + public static int TVT_EVENT_PARTICIPATION_TIME;
  1547. + public static int TVT_EVENT_RUNNING_TIME;
  1548. + public static int TVT_EVENT_PARTICIPATION_NPC_ID;
  1549. + public static int[] TVT_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];
  1550. + public static int TVT_EVENT_MIN_PLAYERS_IN_TEAMS;
  1551. + public static int TVT_EVENT_MAX_PLAYERS_IN_TEAMS;
  1552. + public static int TVT_EVENT_RESPAWN_TELEPORT_DELAY;
  1553. + public static int TVT_EVENT_START_LEAVE_TELEPORT_DELAY;
  1554. + public static String TVT_EVENT_TEAM_1_NAME;
  1555. + public static int[] TVT_EVENT_TEAM_1_COORDINATES = new int[3];
  1556. + public static String TVT_EVENT_TEAM_2_NAME;
  1557. + public static int[] TVT_EVENT_TEAM_2_COORDINATES = new int[3];
  1558. + public static List<int[]> TVT_EVENT_REWARDS = new ArrayList<int[]>();
  1559. + public static boolean TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;
  1560. + public static boolean TVT_EVENT_POTIONS_ALLOWED;
  1561. + public static boolean TVT_EVENT_SUMMON_BY_ITEM_ALLOWED;
  1562. + public static List<Integer> TVT_EVENT_DOOR_IDS = new ArrayList<Integer>();
  1563. + public static byte TVT_EVENT_MIN_LVL;
  1564. + public static byte TVT_EVENT_MAX_LVL;
  1565. +
  1566. /** Lottery */
  1567. public static int ALT_LOTTERY_PRIZE;
  1568. public static int ALT_LOTTERY_TICKET_PRICE;
  1569. @@ -870,6 +893,111 @@
  1570. ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
  1571. ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
  1572.  
  1573. + TVT_EVENT_ENABLED = events.getProperty("TvTEventEnabled", false);
  1574. + TVT_EVENT_INTERVAL = events.getProperty("TvTEventInterval", 18000);
  1575. + TVT_EVENT_PARTICIPATION_TIME = events.getProperty("TvTEventParticipationTime", 3600);
  1576. + TVT_EVENT_RUNNING_TIME = events.getProperty("TvTEventRunningTime", 1800);
  1577. + TVT_EVENT_PARTICIPATION_NPC_ID = events.getProperty("TvTEventParticipationNpcId", 0);
  1578. +
  1579. + if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
  1580. + {
  1581. + TVT_EVENT_ENABLED = false;
  1582. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcId");
  1583. + }
  1584. + else
  1585. + {
  1586. + String[] propertySplit = events.getProperty("TvTEventParticipationNpcCoordinates", "0,0,0").split(",");
  1587. +
  1588. + if (propertySplit.length < 3)
  1589. + {
  1590. + TVT_EVENT_ENABLED = false;
  1591. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventParticipationNpcCoordinates");
  1592. + }
  1593. + else
  1594. + {
  1595. + TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
  1596. + TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
  1597. + TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
  1598. +
  1599. + TVT_EVENT_MIN_PLAYERS_IN_TEAMS = Integer.parseInt(events.getProperty("TvTEventMinPlayersInTeams", "1"));
  1600. + TVT_EVENT_MAX_PLAYERS_IN_TEAMS = Integer.parseInt(events.getProperty("TvTEventMaxPlayersInTeams", "20"));
  1601. + TVT_EVENT_MIN_LVL = (byte)Integer.parseInt(events.getProperty("TvTEventMinPlayerLevel", "1"));
  1602. + TVT_EVENT_MAX_LVL = (byte)Integer.parseInt(events.getProperty("TvTEventMaxPlayerLevel", "80"));
  1603. + TVT_EVENT_RESPAWN_TELEPORT_DELAY = Integer.parseInt(events.getProperty("TvTEventRespawnTeleportDelay", "20"));
  1604. + TVT_EVENT_START_LEAVE_TELEPORT_DELAY = Integer.parseInt(events.getProperty("TvTEventStartLeaveTeleportDelay", "20"));
  1605. +
  1606. + TVT_EVENT_TEAM_1_NAME = events.getProperty("TvTEventTeam1Name", "Team1");
  1607. + propertySplit = events.getProperty("TvTEventTeam1Coordinates", "0,0,0").split(",");
  1608. +
  1609. + if (propertySplit.length < 3)
  1610. + {
  1611. + TVT_EVENT_ENABLED = false;
  1612. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam1Coordinates");
  1613. + }
  1614. + else
  1615. + {
  1616. + TVT_EVENT_TEAM_1_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
  1617. + TVT_EVENT_TEAM_1_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
  1618. + TVT_EVENT_TEAM_1_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
  1619. +
  1620. + TVT_EVENT_TEAM_2_NAME = events.getProperty("TvTEventTeam2Name", "Team2");
  1621. + propertySplit = events.getProperty("TvTEventTeam2Coordinates", "0,0,0").split(",");
  1622. +
  1623. + if (propertySplit.length < 3)
  1624. + {
  1625. + TVT_EVENT_ENABLED= false;
  1626. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventTeam2Coordinates");
  1627. + }
  1628. + else
  1629. + {
  1630. + TVT_EVENT_TEAM_2_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
  1631. + TVT_EVENT_TEAM_2_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
  1632. + TVT_EVENT_TEAM_2_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
  1633. + propertySplit = events.getProperty("TvTEventReward", "57,100000").split(";");
  1634. +
  1635. + for (String reward : propertySplit)
  1636. + {
  1637. + String[] rewardSplit = reward.split(",");
  1638. +
  1639. + if (rewardSplit.length != 2)
  1640. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"" + reward + "\"");
  1641. + else
  1642. + {
  1643. + try
  1644. + {
  1645. + TVT_EVENT_REWARDS.add(new int[]{Integer.valueOf(rewardSplit[0]), Integer.valueOf(rewardSplit[1])});
  1646. + }
  1647. + catch (NumberFormatException nfe)
  1648. + {
  1649. + if (!reward.equals(""))
  1650. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventReward \"" + reward + "\"");
  1651. + }
  1652. + }
  1653. + }
  1654. +
  1655. + TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = Boolean.parseBoolean(events.getProperty("TvTEventTargetTeamMembersAllowed", "true"));
  1656. + TVT_EVENT_POTIONS_ALLOWED = Boolean.parseBoolean(events.getProperty("TvTEventPotionsAllowed", "false"));
  1657. + TVT_EVENT_SUMMON_BY_ITEM_ALLOWED = Boolean.parseBoolean(events.getProperty("TvTEventSummonByItemAllowed", "false"));
  1658. + propertySplit = events.getProperty("TvTEventDoorsCloseOpenOnStartEnd", "").split(";");
  1659. +
  1660. + for (String door : propertySplit)
  1661. + {
  1662. + try
  1663. + {
  1664. + TVT_EVENT_DOOR_IDS.add(Integer.valueOf(door));
  1665. + }
  1666. + catch (NumberFormatException nfe)
  1667. + {
  1668. + if (!door.equals(""))
  1669. + System.out.println("TvTEventEngine[Config.load()]: invalid config property -> TvTEventDoorsCloseOpenOnStartEnd \"" + door + "\"");
  1670. + }
  1671. + }
  1672. + }
  1673. + }
  1674. + }
  1675. + }
  1676. +
  1677. +
  1678. // FloodProtector
  1679. ExProperties security = load(FLOOD_PROTECTOR_FILE);
  1680. loadFloodProtectorConfig(security, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");
  1681. ### Eclipse Workspace Patch 1.0
  1682. #P aCis_gameserver
  1683. Index: java/net/sf/l2j/gameserver/GameServer.java
  1684. ===================================================================
  1685. --- java/net/sf/l2j/gameserver/GameServer.java (revision 2)
  1686. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  1687. @@ -92,6 +91,7 @@
  1688. import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
  1689. import net.sf.l2j.gameserver.model.entity.Castle;
  1690. import net.sf.l2j.gameserver.model.entity.Hero;
  1691. +import net.sf.l2j.gameserver.model.entity.TvTManager;
  1692. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  1693. import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
  1694. import net.sf.l2j.gameserver.network.L2GameClient;
  1695. @@ -237,8 +237,8 @@
  1696. Olympiad.getInstance();
  1697. Hero.getInstance();
  1698.  
  1699. - Util.printSection("Four Sepulchers");
  1700. - FourSepulchersManager.getInstance().init();
  1701. + Util.printSection("TvT Event");
  1702. + TvTManager.getInstance();
  1703.  
  1704. Util.printSection("Quests & Scripts");
  1705. QuestManager.getInstance();
  1706. ### Eclipse Workspace Patch 1.0
  1707. #P aCis_gameserver
  1708. Index: java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java
  1709. ===================================================================
  1710. --- java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java (revision 2)
  1711. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java (working copy)
  1712. @@ -23,7 +23,9 @@
  1713. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1714. import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  1715. import net.sf.l2j.gameserver.model.entity.Castle;
  1716. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1717. import net.sf.l2j.gameserver.network.SystemMessageId;
  1718. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1719. import net.sf.l2j.gameserver.skills.SkillHolder;
  1720.  
  1721. public class ScrollOfResurrection implements IItemHandler
  1722. @@ -41,6 +43,12 @@
  1723. return;
  1724. }
  1725.  
  1726. + if (!TvTEvent.onEscapeUse(activeChar.getName()))
  1727. + {
  1728. + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  1729. + return;
  1730. + }
  1731. +
  1732. if (activeChar.isMovementDisabled())
  1733. return;
  1734.  
  1735. ### Eclipse Workspace Patch 1.0
  1736. #P aCis_gameserver
  1737. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java
  1738. ===================================================================
  1739. --- java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (revision 2)
  1740. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (working copy)
  1741. @@ -25,6 +25,8 @@
  1742. import net.sf.l2j.gameserver.model.actor.L2Character;
  1743. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1744. import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
  1745. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1746. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1747. import net.sf.l2j.gameserver.skills.Formulas;
  1748. import net.sf.l2j.gameserver.taskmanager.DecayTaskManager;
  1749. import net.sf.l2j.gameserver.templates.skills.L2SkillType;
  1750. @@ -68,6 +70,13 @@
  1751. return;
  1752. }
  1753.  
  1754. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getName()))
  1755. + {
  1756. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1757. + return;
  1758. + }
  1759. +
  1760. +
  1761. for (L2Character cha : targetToRes)
  1762. {
  1763. if (activeChar instanceof L2PcInstance)
  1764. ### Eclipse Workspace Patch 1.0
  1765. #P aCis_gameserver
  1766. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java
  1767. ===================================================================
  1768. --- java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (revision 2)
  1769. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (working copy)
  1770. @@ -19,7 +19,9 @@
  1771. import net.sf.l2j.gameserver.model.L2Skill;
  1772. import net.sf.l2j.gameserver.model.actor.L2Character;
  1773. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1774. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1775. import net.sf.l2j.gameserver.network.SystemMessageId;
  1776. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1777. import net.sf.l2j.gameserver.network.serverpackets.ConfirmDlg;
  1778. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  1779. import net.sf.l2j.gameserver.templates.skills.L2SkillType;
  1780. @@ -46,6 +48,12 @@
  1781. if (!L2PcInstance.checkSummonerStatus(activePlayer))
  1782. return;
  1783.  
  1784. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(activePlayer.getName()))
  1785. + {
  1786. + activePlayer.sendPacket(ActionFailed.STATIC_PACKET);
  1787. + return;
  1788. + }
  1789. +
  1790. for (L2Object obj : targets)
  1791. {
  1792. if (!(obj instanceof L2Character))
  1793. ### Eclipse Workspace Patch 1.0
  1794. #P aCis_gameserver
  1795. Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
  1796. ===================================================================
  1797. --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 2)
  1798. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy)
  1799. @@ -18,7 +18,9 @@
  1800. import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  1801. import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
  1802. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1803. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1804. import net.sf.l2j.gameserver.network.SystemMessageId;
  1805. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1806. import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
  1807.  
  1808. public class Escape implements IUserCommandHandler
  1809. @@ -31,6 +33,12 @@
  1810. @Override
  1811. public boolean useUserCommand(int id, L2PcInstance activeChar)
  1812. {
  1813. + if (!TvTEvent.onEscapeUse(activeChar.getName()))
  1814. + {
  1815. + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  1816. + return false;
  1817. + }
  1818. +
  1819. if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || GrandBossManager.isInBossZone(activeChar))
  1820. {
  1821. activeChar.sendMessage("Your current state doesn't allow you to use the /unstuck command.");
  1822. ### Eclipse Workspace Patch 1.0
  1823. #P aCis_gameserver
  1824. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java
  1825. ===================================================================
  1826. --- java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java (revision 0)
  1827. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java (revision 0)
  1828. @@ -0,0 +1,99 @@
  1829. +/*
  1830. + * This program is free software; you can redistribute it and/or modify
  1831. + * it under the terms of the GNU General Public License as published by
  1832. + * the Free Software Foundation; either version 2, or (at your option)
  1833. + * any later version.
  1834. + *
  1835. + * This program is distributed in the hope that it will be useful,
  1836. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1837. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1838. + * GNU General Public License for more details.
  1839. + *
  1840. + * You should have received a copy of the GNU General Public License
  1841. + * along with this program; if not, write to the Free Software
  1842. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  1843. + * 02111-1307, USA.
  1844. + *
  1845. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  1846. + */
  1847. +package net.sf.l2j.gameserver.model.actor.instance;
  1848. +
  1849. +import net.sf.l2j.Config;
  1850. +import net.sf.l2j.gameserver.cache.HtmCache;
  1851. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1852. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1853. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  1854. +import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
  1855. +
  1856. +public class L2TvTEventNpcInstance extends L2NpcInstance
  1857. +{
  1858. + public L2TvTEventNpcInstance(int objectId, L2NpcTemplate template)
  1859. + {
  1860. + super(objectId, template);
  1861. + }
  1862. +
  1863. + @Override
  1864. + public void onBypassFeedback(L2PcInstance playerInstance, String command)
  1865. + {
  1866. + TvTEvent.onBypass(command, playerInstance);
  1867. + }
  1868. +
  1869. + @Override
  1870. + public void showChatWindow(L2PcInstance playerInstance, int val)
  1871. + {
  1872. + if (playerInstance == null)
  1873. + return;
  1874. +
  1875. + if (TvTEvent.isParticipating())
  1876. + {
  1877. + String htmFile = "data/html/mods/";
  1878. +
  1879. + if (!TvTEvent.isPlayerParticipant(playerInstance.getName()))
  1880. + htmFile += "TvTEventParticipation";
  1881. + else
  1882. + htmFile += "TvTEventRemoveParticipation";
  1883. +
  1884. + htmFile += ".htm";
  1885. +
  1886. + String htmContent = HtmCache.getInstance().getHtm(htmFile);
  1887. +
  1888. + if (htmContent != null)
  1889. + {
  1890. + int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
  1891. + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
  1892. +
  1893. + npcHtmlMessage.setHtml(htmContent);
  1894. + npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
  1895. + npcHtmlMessage.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
  1896. + npcHtmlMessage.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
  1897. + npcHtmlMessage.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
  1898. + npcHtmlMessage.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
  1899. + playerInstance.sendPacket(npcHtmlMessage);
  1900. + }
  1901. + }
  1902. + else if (TvTEvent.isStarting() || TvTEvent.isStarted())
  1903. + {
  1904. + String htmFile = "data/html/mods/TvTEventStatus.htm";
  1905. + String htmContent = HtmCache.getInstance().getHtm(htmFile);
  1906. +
  1907. + if (htmContent != null)
  1908. + {
  1909. + int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
  1910. + int[] teamsPointsCounts = TvTEvent.getTeamsPoints();
  1911. + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
  1912. +
  1913. + npcHtmlMessage.setHtml(htmContent);
  1914. + //npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
  1915. + npcHtmlMessage.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
  1916. + npcHtmlMessage.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
  1917. + npcHtmlMessage.replace("%team1points%", String.valueOf(teamsPointsCounts[0]));
  1918. + npcHtmlMessage.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
  1919. + npcHtmlMessage.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
  1920. + npcHtmlMessage.replace("%team2points%", String.valueOf(teamsPointsCounts[1])); // <---- array index from 0 to 1 thx DaRkRaGe
  1921. + playerInstance.sendPacket(npcHtmlMessage);
  1922. + }
  1923. + }
  1924. +
  1925. + playerInstance.sendPacket(ActionFailed.STATIC_PACKET);
  1926. + }
  1927. +}
  1928. ### Eclipse Workspace Patch 1.0
  1929. #P aCis_gameserver
  1930. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2WeddingManagerInstance.java
  1931. ===================================================================
  1932. --- java/net/sf/l2j/gameserver/model/actor/instance/L2WeddingManagerInstance.java (revision 2)
  1933. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2WeddingManagerInstance.java (working copy)
  1934. @@ -27,6 +27,7 @@
  1935. import net.sf.l2j.gameserver.model.L2World;
  1936. import net.sf.l2j.gameserver.model.actor.L2Npc;
  1937. import net.sf.l2j.gameserver.model.entity.Couple;
  1938. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1939. import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1940. import net.sf.l2j.gameserver.network.serverpackets.ConfirmDlg;
  1941. import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
  1942. @@ -143,7 +144,7 @@
  1943. }
  1944.  
  1945. // Simple checks to avoid exploits
  1946. - if (partner.isInJail() || partner.isInOlympiadMode() || partner.isInDuel() || partner.isFestivalParticipant() || (partner.isInParty() && partner.getParty().isInDimensionalRift()) || partner.inObserverMode())
  1947. + if (!TvTEvent.onEscapeUse(partner.getName()) || partner.isInJail() || partner.isInOlympiadMode() || partner.isInDuel() || partner.isFestivalParticipant() || (partner.isInParty() && partner.getParty().isInDimensionalRift()) || partner.inObserverMode())
  1948. {
  1949. player.sendMessage("Due to the current partner's status, the teleportation failed.");
  1950. return;
  1951. ### Eclipse Workspace Patch 1.0
  1952. #P aCis_gameserver
  1953. Index: java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java
  1954. ===================================================================
  1955. --- java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (revision 2)
  1956. +++ java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (working copy)
  1957. @@ -22,7 +22,9 @@
  1958.  
  1959. import net.sf.l2j.Config;
  1960. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1961. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1962. import net.sf.l2j.gameserver.network.SystemMessageId;
  1963. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1964. import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  1965. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  1966. import net.sf.l2j.gameserver.templates.StatsSet;
  1967. @@ -259,6 +261,13 @@
  1968. return false;
  1969. }
  1970.  
  1971. + if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(player.getName()))
  1972. + {
  1973. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1974. + player.sendMessage("You can not register in olympiad while registered at TvT.");
  1975. + return false;
  1976. + }
  1977. +
  1978. if (player.isSubClassActive())
  1979. {
  1980. player.sendPacket(SystemMessageId.YOU_CANT_JOIN_THE_OLYMPIAD_WITH_A_SUB_JOB_CHARACTER);
  1981. ### Eclipse Workspace Patch 1.0
  1982. #P aCis_gameserver
  1983. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  1984. ===================================================================
  1985. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 2)
  1986. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  1987. @@ -34,6 +34,7 @@
  1988. import net.sf.l2j.gameserver.model.entity.ClanHall;
  1989. import net.sf.l2j.gameserver.model.entity.Couple;
  1990. import net.sf.l2j.gameserver.model.entity.Siege;
  1991. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  1992. import net.sf.l2j.gameserver.model.olympiad.Olympiad;
  1993. import net.sf.l2j.gameserver.model.quest.Quest;
  1994. import net.sf.l2j.gameserver.model.quest.QuestState;
  1995. @@ -229,6 +230,8 @@
  1996. // Attacker or spectator logging into a siege zone will be ported at town.
  1997. if (!activeChar.isGM() && (!activeChar.isInSiege() || activeChar.getSiegeState() < 2) && activeChar.isInsideZone(ZoneId.SIEGE))
  1998. activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  1999. +
  2000. + TvTEvent.onLogin(activeChar);
  2001. }
  2002.  
  2003. private static void engage(L2PcInstance cha)
  2004. ### Eclipse Workspace Patch 1.0
  2005. #P aCis_gameserver
  2006. Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
  2007. ===================================================================
  2008. --- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (revision 2)
  2009. +++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (working copy)
  2010. @@ -18,6 +18,7 @@
  2011. import net.sf.l2j.gameserver.SevenSignsFestival;
  2012. import net.sf.l2j.gameserver.model.L2Party;
  2013. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  2014. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  2015. import net.sf.l2j.gameserver.model.zone.ZoneId;
  2016. import net.sf.l2j.gameserver.network.SystemMessageId;
  2017. import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  2018. @@ -88,6 +89,7 @@
  2019.  
  2020. // Remove player from Boss Zone
  2021. player.removeFromBossZone();
  2022. + TvTEvent.onLogout(player);
  2023.  
  2024. player.logout();
  2025. }
  2026. ### Eclipse Workspace Patch 1.0
  2027. #P aCis_gameserver
  2028. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTvTEvent.java
  2029. ===================================================================
  2030. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTvTEvent.java (revision 0)
  2031. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTvTEvent.java (revision 0)
  2032. @@ -0,0 +1,107 @@
  2033. +/*
  2034. + * This program is free software; you can redistribute it and/or modify
  2035. + * it under the terms of the GNU General Public License as published by
  2036. + * the Free Software Foundation; either version 2, or (at your option)
  2037. + * any later version.
  2038. + *
  2039. + * This program is distributed in the hope that it will be useful,
  2040. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2041. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2042. + * GNU General Public License for more details.
  2043. + *
  2044. + * You should have received a copy of the GNU General Public License
  2045. + * along with this program; if not, write to the Free Software
  2046. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  2047. + * 02111-1307, USA.
  2048. + *
  2049. + * [URL]http://www.gnu.org/copyleft/gpl.html[/URL]
  2050. + */
  2051. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  2052. +
  2053. +import net.sf.l2j.Config;
  2054. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  2055. +import net.sf.l2j.gameserver.model.L2Object;
  2056. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  2057. +import net.sf.l2j.gameserver.model.entity.TvTEvent;
  2058. +import net.sf.l2j.gameserver.model.entity.TvTEventTeleporter;
  2059. +import net.sf.l2j.gameserver.util.GMAudit;
  2060. +
  2061. +/**
  2062. + * @author FBIagent
  2063. + *
  2064. + * The class handles administrator commands for the TvT Engine which was first implemented by FBIagent
  2065. + */
  2066. +public class AdminTvTEvent implements IAdminCommandHandler
  2067. +{
  2068. + private static final String[] ADMIN_COMMANDS = {"admin_tvt_add", "admin_tvt_remove"};
  2069. +
  2070. + @Override
  2071. + public boolean useAdminCommand(String command, L2PcInstance adminInstance)
  2072. + {
  2073. +
  2074. + GMAudit.auditGMAction(adminInstance.getName(), command, (adminInstance.getTarget() != null ? adminInstance.getTarget().getName() : "no-target"), "");
  2075. +
  2076. + if (command.equals("admin_tvt_add"))
  2077. + {
  2078. + L2Object target = adminInstance.getTarget();
  2079. +
  2080. + if (target == null || !(target instanceof L2PcInstance))
  2081. + {
  2082. + adminInstance.sendMessage("You should select a player!");
  2083. + return true;
  2084. + }
  2085. +
  2086. + add(adminInstance, (L2PcInstance)target);
  2087. + }
  2088. + else if (command.equals("admin_tvt_remove"))
  2089. + {
  2090. + L2Object target = adminInstance.getTarget();
  2091. +
  2092. + if (target == null || !(target instanceof L2PcInstance))
  2093. + {
  2094. + adminInstance.sendMessage("You should select a player!");
  2095. + return true;
  2096. + }
  2097. +
  2098. + remove(adminInstance, (L2PcInstance)target);
  2099. + }
  2100. +
  2101. + return true;
  2102. + }
  2103. +
  2104. + @Override
  2105. + public String[] getAdminCommandList()
  2106. + {
  2107. + return ADMIN_COMMANDS;
  2108. + }
  2109. +
  2110. + private static void add(L2PcInstance adminInstance, L2PcInstance playerInstance)
  2111. + {
  2112. + if (TvTEvent.isPlayerParticipant(playerInstance.getName()))
  2113. + {
  2114. + adminInstance.sendMessage("Player already participated in the event!");
  2115. + return;
  2116. + }
  2117. +
  2118. + if (!TvTEvent.addParticipant(playerInstance))
  2119. + {
  2120. + adminInstance.sendMessage("Player instance could not be added, it seems to be null!");
  2121. + return;
  2122. + }
  2123. +
  2124. + if (TvTEvent.isStarted())
  2125. + // we don't need to check return value of TvTEvent.getParticipantTeamCoordinates() for null, TvTEvent.addParticipant() returned true so target is in event
  2126. + new TvTEventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getName()), true, false);
  2127. + }
  2128. +
  2129. + private static void remove(L2PcInstance adminInstance, L2PcInstance playerInstance)
  2130. + {
  2131. + if (!TvTEvent.removeParticipant(playerInstance.getName()))
  2132. + {
  2133. + adminInstance.sendMessage("Player is not part of the event!");
  2134. + return;
  2135. + }
  2136. +
  2137. + new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
  2138. + }
  2139. +}
  2140. ### Eclipse Workspace Patch 1.0
  2141. #P aCis_gameserver
  2142. Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  2143. ===================================================================
  2144. --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 2)
  2145. +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
  2146. @@ -65,6 +65,7 @@
  2147. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSpawn;
  2148. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
  2149. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
  2150. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTvTEvent;
  2151. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
  2152. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
  2153.  
  2154. @@ -127,6 +128,7 @@
  2155. registerAdminCommandHandler(new AdminSpawn());
  2156. registerAdminCommandHandler(new AdminTarget());
  2157. registerAdminCommandHandler(new AdminTeleport());
  2158. + registerAdminCommandHandler(new AdminTvTEvent());
  2159. registerAdminCommandHandler(new AdminUnblockIp());
  2160. registerAdminCommandHandler(new AdminZone());
  2161. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement