Guest User

Untitled

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