Guest User

TvT System

a guest
Nov 30th, 2013
1,910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 36.24 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/GameServer.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/GameServer.java  (wersja 16)
  6. +++ java/net/sf/l2j/gameserver/GameServer.java  (kopia robocza)
  7. @@ -58,6 +58,7 @@
  8.  import net.sf.l2j.gameserver.datatables.StaticObjects;
  9.  import net.sf.l2j.gameserver.datatables.SummonItemsData;
  10.  import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
  11. +import net.sf.l2j.gameserver.events.EventManager;
  12.  import net.sf.l2j.gameserver.handler.AdminCommandHandler;
  13.  import net.sf.l2j.gameserver.handler.ChatHandler;
  14.  import net.sf.l2j.gameserver.handler.ItemHandler;
  15. @@ -290,6 +291,9 @@
  16.         if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED)
  17.             FishingChampionshipManager.getInstance();
  18.        
  19. +       Util.printSection("Event Manager");
  20. +       EventManager.getInstance();
  21. +      
  22.         Util.printSection("System");
  23.         TaskManager.getInstance();
  24.        
  25. Index: java/net/sf/l2j/Config.java
  26. ===================================================================
  27. --- java/net/sf/l2j/Config.java (wersja 16)
  28. +++ java/net/sf/l2j/Config.java (kopia robocza)
  29. @@ -24,6 +24,7 @@
  30.  import java.math.BigInteger;
  31.  import java.util.ArrayList;
  32.  import java.util.Arrays;
  33. +import java.util.HashMap;
  34.  import java.util.List;
  35.  import java.util.Properties;
  36.  import java.util.StringTokenizer;
  37. @@ -251,6 +252,14 @@
  38.     public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
  39.     public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
  40.    
  41. +   /** TvT Event */
  42. +   public static boolean ALLOW_TVT_EVENT;
  43. +   public static String TVT_EVENT_TIMES;
  44. +   public static HashMap<Integer, Integer> TVT_EVENT_REWARDS = new HashMap<>();
  45. +   public static HashMap<String, int[]> TVT_TEAMS_DATA = new HashMap<>();
  46. +   public static int TVT_RES_SECONDS;
  47. +   public static ArrayList<Integer> TVT_DOORS = new ArrayList<>();
  48. +  
  49.     // --------------------------------------------------
  50.     // HexID
  51.     // --------------------------------------------------
  52. @@ -886,6 +895,38 @@
  53.             ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
  54.             ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
  55.            
  56. +           ALLOW_TVT_EVENT = events.getProperty("AllowTvtEvent", false);
  57. +           TVT_EVENT_TIMES = events.getProperty("TvtEventTimes", "12:00,14:00,16:00");
  58. +           String TVT_EVENT_REWARDS_VALUE = events.getProperty("TvtEventRewards", "57,1;");
  59. +           String[] tvt_event_rewards_splitted_1 = TVT_EVENT_REWARDS_VALUE.split(";");
  60. +           for (String i : tvt_event_rewards_splitted_1)
  61. +           {
  62. +               String[] tvt_event_rewards_splitted_2 = i.split(",");
  63. +               TVT_EVENT_REWARDS.put(Integer.parseInt(tvt_event_rewards_splitted_2[0]),
  64. +                       Integer.parseInt(tvt_event_rewards_splitted_2[1]));
  65. +           }
  66. +           String tvt_teams_data = events.getProperty("TvtTeamsData", "Good_0,0,0;Evil_0,0,0");
  67. +           String[] ttd_splitted = tvt_teams_data.split(";");
  68. +           for (String s : ttd_splitted)
  69. +           {
  70. +               String[] ss = s.split("_");
  71. +               String name = ss[0];
  72. +               String[] sss = ss[1].split(",");
  73. +               int x = Integer.parseInt(sss[0]);
  74. +               int y = Integer.parseInt(sss[1]);
  75. +               int z = Integer.parseInt(sss[2]);
  76. +              
  77. +               TVT_TEAMS_DATA.put(name, new int[] { x, y, z });
  78. +           }
  79. +           TVT_RES_SECONDS = events.getProperty("TvtResSeconds", 10);
  80. +           String tvt_doors = events.getProperty("TvtDoors", "24190001,24190002,24190003,24190004");
  81. +           String[] tvt_doors_split = tvt_doors.split(",");
  82. +           for (String s : tvt_doors_split)
  83. +           {
  84. +               int i = Integer.parseInt(s);
  85. +               TVT_DOORS.add(i);
  86. +           }
  87. +          
  88.             // FloodProtector
  89.             ExProperties security = load(FLOOD_PROTECTOR_FILE);
  90.             loadFloodProtectorConfig(security, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");
  91. Index: java/net/sf/l2j/gameserver/events/TvTEvent.java
  92. ===================================================================
  93. --- java/net/sf/l2j/gameserver/events/TvTEvent.java (wersja 0)
  94. +++ java/net/sf/l2j/gameserver/events/TvTEvent.java (wersja 0)
  95. @@ -0,0 +1,239 @@
  96. +/*
  97. + * This program is free software: you can redistribute it and/or modify it under
  98. + * the terms of the GNU General Public License as published by the Free Software
  99. + * Foundation, either version 3 of the License, or (at your option) any later
  100. + * version.
  101. + *
  102. + * This program is distributed in the hope that it will be useful, but WITHOUT
  103. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  104. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  105. + * details.
  106. + *
  107. + * You should have received a copy of the GNU General Public License along with
  108. + * this program. If not, see <http://www.gnu.org/licenses/>.
  109. + */
  110. +package net.sf.l2j.gameserver.events;
  111. +
  112. +import java.util.ArrayList;
  113. +import java.util.LinkedList;
  114. +
  115. +import net.sf.l2j.Config;
  116. +import net.sf.l2j.gameserver.Announcements;
  117. +import net.sf.l2j.gameserver.datatables.DoorTable;
  118. +import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
  119. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  120. +
  121. +/**
  122. + * @author Anarchy
  123. + */
  124. +public class TvTEvent implements IEvent
  125. +{
  126. +   public ArrayList<L2PcInstance> _players;
  127. +   private EventState _state = EventState.INACTIVE;
  128. +   private final ArrayList<EventTeam> _teams;
  129. +   private final ArrayList<L2DoorInstance> _doors;
  130. +  
  131. +   public TvTEvent()
  132. +   {
  133. +       _players = new ArrayList<>();
  134. +       _teams = new ArrayList<>();
  135. +       _doors = new ArrayList<>();
  136. +   }
  137. +  
  138. +   @Override
  139. +   public void runEvent()
  140. +   {
  141. +       if (EventManager.getInstance().getCurrentEvent() != null)
  142. +       {
  143. +           return;
  144. +       }
  145. +      
  146. +       EventManager.getInstance().setCurrentEvent(this);
  147. +      
  148. +       Announcements.announceToAll("Registrations for the TvT Event are opened for 2 minutes. Type /join to register and /leave to withdraw.");
  149. +       _state = EventState.REGISTERING;
  150. +      
  151. +       sleep(120);
  152. +      
  153. +       if (!check())
  154. +       {
  155. +           EventManager.getInstance().setCurrentEvent(null);
  156. +           return;
  157. +       }
  158. +      
  159. +       Announcements.announceToAll("Registrations for the TvT Event are closed. Teams will be teleported in 10 seconds.");
  160. +       _state = EventState.RUNNING;
  161. +      
  162. +       sleep(10);
  163. +      
  164. +       split();
  165. +      
  166. +       for (EventTeam et : _teams)
  167. +       {
  168. +           et.teleportTeam(Config.TVT_TEAMS_DATA.get(et.getName())[0], Config.TVT_TEAMS_DATA.get(et.getName())[1], Config.TVT_TEAMS_DATA.get(et.getName())[2], true);
  169. +          
  170. +           et.paralize(true);
  171. +       }
  172. +       closeDoors();
  173. +       Announcements.announceToAll("Teams have been teleported. Fight begins in 5 seconds.");
  174. +      
  175. +       sleep(5);
  176. +      
  177. +       for (EventTeam et : _teams)
  178. +       {
  179. +           et.paralize(false);
  180. +       }
  181. +       Announcements.announceToAll("The fight has started!");
  182. +       Announcements.announceToAll("The event will last for 1 minute(s).");
  183. +      
  184. +       sleep(60); // tvt time in sec
  185. +      
  186. +       rewardAndClear();
  187. +       openDoors();
  188. +       _state = EventState.INACTIVE;
  189. +      
  190. +       EventManager.getInstance().setCurrentEvent(null);
  191. +   }
  192. +  
  193. +   private void openDoors()
  194. +   {
  195. +       if (_doors.isEmpty())
  196. +       {
  197. +           for (int i : Config.TVT_DOORS)
  198. +           {
  199. +               L2DoorInstance door = DoorTable.getInstance().getDoor(i);
  200. +               door.openMe();
  201. +           }
  202. +       }
  203. +       else
  204. +       {
  205. +           for (L2DoorInstance door : _doors)
  206. +           {
  207. +               door.deleteMe();
  208. +           }
  209. +       }
  210. +   }
  211. +  
  212. +   private static void closeDoors()
  213. +   {
  214. +       for (int i : Config.TVT_DOORS)
  215. +       {
  216. +           L2DoorInstance door = DoorTable.getInstance().getDoor(i);
  217. +           door.closeMe();
  218. +       }
  219. +   }
  220. +  
  221. +   public void rewardAndClear()
  222. +   {
  223. +       int i = 0;
  224. +       EventTeam winner = null;
  225. +      
  226. +       for (EventTeam et : _teams)
  227. +       {
  228. +           et.teleportTeam(82698, 148638, -3473, true);
  229. +          
  230. +           for (L2PcInstance p : et.getPlayers())
  231. +           {
  232. +               EventCommons.getInstance().removePlayer(p);
  233. +           }
  234. +          
  235. +           if (et.getPoints() > i)
  236. +           {
  237. +               i = et.getPoints();
  238. +               winner = et;
  239. +           }
  240. +       }
  241. +      
  242. +       if (winner != null)
  243. +       {
  244. +           for (int ii : Config.TVT_EVENT_REWARDS.keySet())
  245. +           {
  246. +               winner.rewardTeam(ii, Config.TVT_EVENT_REWARDS.get(ii));
  247. +           }
  248. +      
  249. +           Announcements.announceToAll(winner.getName() + " team has won the event.");
  250. +       }
  251. +       else
  252. +           Announcements.announceToAll("Event ended with no winner.");
  253. +       return;
  254. +   }
  255. +  
  256. +   public boolean check()
  257. +   {
  258. +       if (EventCommons.getInstance().getRegisteredPlayersSize(TvTEvent.class) < Config.TVT_TEAMS_DATA.size() * 1)
  259. +       {
  260. +           Announcements.announceToAll("The event has been canceled due to lack of participants.");
  261. +           EventCommons.getInstance().removeRegisteredPlayers(TvTEvent.class);
  262. +           _state = EventState.INACTIVE;
  263. +           return false;
  264. +       }
  265. +      
  266. +       return true;
  267. +   }
  268. +  
  269. +   public void split()
  270. +   {
  271. +       int i = Config.TVT_TEAMS_DATA.size() - 1;
  272. +       LinkedList<LinkedList<L2PcInstance>> temp = new LinkedList<>();
  273. +      
  274. +       for (int ii = Config.TVT_TEAMS_DATA.size(); ii > 0; ii--)
  275. +       {
  276. +           LinkedList<L2PcInstance> t = new LinkedList<>();
  277. +           temp.add(t);
  278. +       }
  279. +      
  280. +       for (L2PcInstance p : EventCommons.getInstance().getRegisteredPlayers(TvTEvent.class))
  281. +       {
  282. +           temp.get(i).add(p);
  283. +           i--;
  284. +          
  285. +           if (i == -1)
  286. +           {
  287. +               i = Config.TVT_TEAMS_DATA.size();
  288. +           }
  289. +          
  290. +           EventCommons.getInstance().addPlayer(p, this);
  291. +       }
  292. +      
  293. +       for (String s : Config.TVT_TEAMS_DATA.keySet())
  294. +       {
  295. +           EventTeam et = new EventTeam(temp.getLast(), s, 0, new int[]
  296. +           {
  297. +               Config.TVT_TEAMS_DATA.get(s)[0], Config.TVT_TEAMS_DATA.get(s)[1], Config.TVT_TEAMS_DATA.get(s)[2]
  298. +           });
  299. +           temp.remove(temp.getLast());
  300. +          
  301. +           _teams.add(et);
  302. +       }
  303. +   }
  304. +  
  305. +   private static void sleep(int seconds)
  306. +   {
  307. +       try
  308. +       {
  309. +           Thread.sleep(seconds * 1000);
  310. +       }
  311. +       catch (InterruptedException e)
  312. +       {
  313. +           e.printStackTrace();
  314. +       }
  315. +   }
  316. +  
  317. +   @Override
  318. +   public EventState getState()
  319. +   {
  320. +       return _state;
  321. +   }
  322. +  
  323. +   @Override
  324. +   public String getTimes()
  325. +   {
  326. +       return Config.TVT_EVENT_TIMES;
  327. +   }
  328. +  
  329. +   @Override
  330. +   public int getId()
  331. +   {
  332. +       return 1;
  333. +   }
  334. +}
  335. Index: config/events.properties
  336. ===================================================================
  337. --- config/events.properties    (wersja 16)
  338. +++ config/events.properties    (kopia robocza)
  339. @@ -251,4 +251,22 @@
  340.  AltFishChampionshipReward2 = 500000
  341.  AltFishChampionshipReward3 = 300000
  342.  AltFishChampionshipReward4 = 200000
  343. -AltFishChampionshipReward5 = 100000
  344. \ No newline at end of file
  345. +AltFishChampionshipReward5 = 100000
  346. +
  347. +#=============================================================
  348. +#                     TvT Event
  349. +#=============================================================
  350. +# Enable or disable the TvT Event.
  351. +AllowTvtEvent = True
  352. +# Times of day that the event will take place.
  353. +TvtEventTimes = 12:00,14:00,16:00
  354. +# Rewards.
  355. +TvtEventRewards = 57,1000;
  356. +# Team data. Should be like this: teamname_x,y,z;teamname_x,y,z.
  357. +# Note: You can add as many teams as you like.
  358. +TvtTeamsData = Angels_148404,46718,-3414;Demons_150545,46718,-3414
  359. +# Time to res after death.
  360. +TvtResSeconds = 5
  361. +# Doors to close when event starts.
  362. +# Default doors: Coliseum
  363. +TvtDoors = 24190001,24190002,24190003,24190004
  364. \ No newline at end of file
  365. Index: java/net/sf/l2j/gameserver/network/serverpackets/Die.java
  366. ===================================================================
  367. --- java/net/sf/l2j/gameserver/network/serverpackets/Die.java   (wersja 16)
  368. +++ java/net/sf/l2j/gameserver/network/serverpackets/Die.java   (kopia robocza)
  369. @@ -15,6 +15,7 @@
  370.  package net.sf.l2j.gameserver.network.serverpackets;
  371.  
  372.  import net.sf.l2j.gameserver.datatables.AccessLevels;
  373. +import net.sf.l2j.gameserver.events.EventCommons;
  374.  import net.sf.l2j.gameserver.instancemanager.CastleManager;
  375.  import net.sf.l2j.gameserver.model.L2AccessLevel;
  376.  import net.sf.l2j.gameserver.model.L2Clan;
  377. @@ -58,7 +59,14 @@
  378.        
  379.         writeC(0x06);
  380.         writeD(_charObjId);
  381. -       writeD(0x01); // to nearest village
  382. +       if (_activeChar instanceof L2PcInstance && EventCommons.getInstance().showDiePacket((L2PcInstance)_activeChar))
  383. +       {
  384. +           writeD(0x01); // to nearest village
  385. +       }
  386. +       else
  387. +       {
  388. +           writeD(0x00);
  389. +       }
  390.        
  391.         if (_clan != null)
  392.         {
  393. Index: java/net/sf/l2j/gameserver/events/EventCommons.java
  394. ===================================================================
  395. --- java/net/sf/l2j/gameserver/events/EventCommons.java (wersja 0)
  396. +++ java/net/sf/l2j/gameserver/events/EventCommons.java (wersja 0)
  397. @@ -0,0 +1,274 @@
  398. +/*
  399. + * This program is free software: you can redistribute it and/or modify it under
  400. + * the terms of the GNU General Public License as published by the Free Software
  401. + * Foundation, either version 3 of the License, or (at your option) any later
  402. + * version.
  403. + *
  404. + * This program is distributed in the hope that it will be useful, but WITHOUT
  405. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  406. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  407. + * details.
  408. + *
  409. + * You should have received a copy of the GNU General Public License along with
  410. + * this program. If not, see <http://www.gnu.org/licenses/>.
  411. + */
  412. +package net.sf.l2j.gameserver.events;
  413. +
  414. +import java.util.ArrayList;
  415. +import java.util.HashMap;
  416. +
  417. +import net.sf.l2j.Config;
  418. +import net.sf.l2j.gameserver.ThreadPoolManager;
  419. +import net.sf.l2j.gameserver.model.actor.L2Character;
  420. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  421. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  422. +
  423. +/**
  424. + * @author Anarchy
  425. + *
  426. + *This class contains restrictions and general methods for all events.
  427. + */
  428. +public final class EventCommons
  429. +{
  430. +   public final HashMap<L2PcInstance, IEvent> _players;
  431. +   private final HashMap<L2PcInstance, Class<?>> _registeredPlayers;
  432. +  
  433. +   public static EventCommons getInstance()
  434. +   {
  435. +       return SingletonHolder._instance;
  436. +   }
  437. +  
  438. +   protected EventCommons()
  439. +   {
  440. +       _players = new HashMap<>();
  441. +       _registeredPlayers = new HashMap<>();
  442. +   }
  443. +  
  444. +   public void registerPlayer(L2PcInstance player, Class<?> c)
  445. +   {
  446. +       if (_registeredPlayers.containsKey(player))
  447. +       {
  448. +           player.sendMessage("You have already registered for the event.");
  449. +           return;
  450. +       }
  451. +      
  452. +       _registeredPlayers.put(player, c);
  453. +   }
  454. +  
  455. +   public void unregisterPlayer(L2PcInstance player, Class<?> c)
  456. +   {
  457. +       if (!_registeredPlayers.containsKey(player))
  458. +       {
  459. +           player.sendMessage("You have not registered for the event.");
  460. +           return;
  461. +       }
  462. +      
  463. +       _registeredPlayers.remove(player);
  464. +   }
  465. +  
  466. +   public boolean showDiePacket(L2PcInstance player)
  467. +   {
  468. +       if (_players.containsKey(player))
  469. +       {
  470. +           if (_players.get(player) instanceof TvTEvent)
  471. +           {
  472. +               return false;
  473. +           }
  474. +       }
  475. +      
  476. +       return true;
  477. +   }
  478. +  
  479. +   public boolean canUnstuck(L2PcInstance player)
  480. +   {
  481. +       if (_players.containsKey(player))
  482. +       {
  483. +           return false;
  484. +       }
  485. +      
  486. +       return true;
  487. +   }
  488. +  
  489. +   public boolean canRes(L2PcInstance victim)
  490. +   {
  491. +       if (_players.containsKey(victim))
  492. +       {
  493. +           return false;
  494. +       }
  495. +      
  496. +       return true;
  497. +   }
  498. +  
  499. +   public boolean canRecall(L2PcInstance victim)
  500. +   {
  501. +       if (_players.containsKey(victim))
  502. +       {
  503. +           return false;
  504. +       }
  505. +      
  506. +       return true;
  507. +   }
  508. +  
  509. +   public void doDie(L2Character killer, L2PcInstance victim)
  510. +   {
  511. +       if (_players.containsKey(victim))
  512. +       {
  513. +           if (killer != null && killer instanceof L2PcInstance)
  514. +           {
  515. +               L2PcInstance kl = (L2PcInstance)killer;
  516. +              
  517. +               if (_players.containsKey(kl))
  518. +               {
  519. +                   if (_players.get(victim) == _players.get(kl))
  520. +                   {
  521. +                       // TvT event kills.
  522. +                       if (_players.get(victim) instanceof TvTEvent)
  523. +                       {
  524. +                           if (kl.getEventTeam() != victim.getEventTeam())
  525. +                           {
  526. +                               kl.getEventTeam().addPoints(1);
  527. +                           }
  528. +                          
  529. +                           ThreadPoolManager.getInstance().scheduleGeneral(new ResTask(victim.getEventTeam().getRespawnX(), victim.getEventTeam().getRespawnY(), victim.getEventTeam().getRespawnZ(), victim, true),Config.TVT_RES_SECONDS * 1000);
  530. +                       }
  531. +                   }
  532. +               }
  533. +           }
  534. +       }
  535. +   }
  536. +  
  537. +   public boolean canTarget(L2PcInstance player, L2PcInstance target)
  538. +   {
  539. +       if ((!_players.containsKey(player) && _players.containsKey(target))
  540. +               || (_players.containsKey(player) && !_players.containsKey(target)))
  541. +       {
  542. +           player.setTarget(null);
  543. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  544. +           return false;
  545. +       }
  546. +      
  547. +       if (_players.get(player) != _players.get(target))
  548. +       {
  549. +           player.setTarget(null);
  550. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  551. +           return false;
  552. +       }
  553. +      
  554. +       if ((target.getEventTeam() != null && player.getEventTeam() == null))
  555. +       {
  556. +           player.setTarget(null);
  557. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  558. +           return false;
  559. +       }
  560. +      
  561. +       if (target.getEventTeam() == null && player.getEventTeam() != null)
  562. +       {
  563. +           player.setTarget(null);
  564. +           player.sendPacket(ActionFailed.STATIC_PACKET);
  565. +           return false;
  566. +       }
  567. +      
  568. +       return true;
  569. +   }
  570. +  
  571. +   public void addPlayer(L2PcInstance player, IEvent event)
  572. +   {
  573. +       if (!_players.containsKey(player))
  574. +       {
  575. +           _players.put(player, event);
  576. +       }
  577. +   }
  578. +  
  579. +   public void removePlayer(L2PcInstance player)
  580. +   {
  581. +       if (_players.containsKey(player))
  582. +       {
  583. +           _players.remove(player);
  584. +       }
  585. +   }
  586. +  
  587. +   public int getRegisteredPlayersSize(Class<?> c)
  588. +   {
  589. +       int i = 0;
  590. +       for (L2PcInstance p : _registeredPlayers.keySet())
  591. +       {
  592. +           if (_registeredPlayers.get(p) == c)
  593. +           {
  594. +               i++;
  595. +           }
  596. +       }
  597. +      
  598. +       return i;
  599. +   }
  600. +  
  601. +   public void removeRegisteredPlayers(Class<?> c)
  602. +   {
  603. +       ArrayList<L2PcInstance> temp = new ArrayList<>();
  604. +      
  605. +       for (L2PcInstance p : _registeredPlayers.keySet())
  606. +       {
  607. +           if (_registeredPlayers.get(p) == c)
  608. +           {
  609. +               temp.add(p);
  610. +           }
  611. +       }
  612. +      
  613. +       for (L2PcInstance p : temp)
  614. +       {
  615. +           _registeredPlayers.remove(p);
  616. +       }
  617. +   }
  618. +  
  619. +   public HashMap<L2PcInstance, Class<?>> getRegisteredPlayers()
  620. +   {
  621. +       return _registeredPlayers;
  622. +   }
  623. +  
  624. +   public ArrayList<L2PcInstance> getRegisteredPlayers(Class<?> c)
  625. +   {
  626. +       ArrayList<L2PcInstance> temp = new ArrayList<>();
  627. +      
  628. +       for (L2PcInstance p : _registeredPlayers.keySet())
  629. +       {
  630. +           if (_registeredPlayers.get(p) == c)
  631. +           {
  632. +               temp.add(p);
  633. +           }
  634. +       }
  635. +      
  636. +       return temp;
  637. +   }
  638. +  
  639. +   public class ResTask implements Runnable
  640. +   {
  641. +       private final int _x, _y, _z;
  642. +       private final L2PcInstance _player;
  643. +       private final boolean _heal;
  644. +      
  645. +       public ResTask(int x, int y, int z, L2PcInstance player, boolean heal)
  646. +       {
  647. +           _x = x;
  648. +           _y = y;
  649. +           _z = z;
  650. +           _player = player;
  651. +           _heal = heal;
  652. +       }
  653. +      
  654. +       @Override
  655. +       public void run()
  656. +       {
  657. +           _player.doRevive();
  658. +           _player.teleToLocation(_x, _y, _z, 0);
  659. +           if (_heal)
  660. +           {
  661. +               _player.setCurrentHpMp(_player.getMaxHp(), _player.getMaxMp());
  662. +               _player.setCurrentCp(_player.getMaxCp());
  663. +           }
  664. +       }
  665. +   }
  666. +  
  667. +   private static class SingletonHolder
  668. +   {
  669. +       protected static final EventCommons _instance = new EventCommons();
  670. +   }
  671. +}
  672. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  673. ===================================================================
  674. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (wersja 16)
  675. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (kopia robocza)
  676. @@ -66,6 +66,8 @@
  677.  import net.sf.l2j.gameserver.datatables.SkillTable;
  678.  import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
  679.  import net.sf.l2j.gameserver.datatables.SkillTreeTable;
  680. +import net.sf.l2j.gameserver.events.EventCommons;
  681. +import net.sf.l2j.gameserver.events.EventTeam;
  682.  import net.sf.l2j.gameserver.handler.IItemHandler;
  683.  import net.sf.l2j.gameserver.handler.ItemHandler;
  684.  import net.sf.l2j.gameserver.instancemanager.CastleManager;
  685. @@ -250,6 +252,18 @@
  686.   */
  687.  public final class L2PcInstance extends L2Playable
  688.  {
  689. +   private EventTeam _eventTeam = null;
  690. +  
  691. +   public EventTeam getEventTeam()
  692. +   {
  693. +       return _eventTeam;
  694. +   }
  695. +  
  696. +   public void setEventTeam(EventTeam val)
  697. +   {
  698. +       _eventTeam = val;
  699. +   }
  700. +  
  701.     // Character Skill SQL String Definitions:
  702.     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
  703.     private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
  704. @@ -3319,6 +3333,10 @@
  705.     @Override
  706.     public void onAction(L2PcInstance player)
  707.     {
  708. +       if (!EventCommons.getInstance().canTarget(player, this))
  709. +       {
  710. +           return;
  711. +       }
  712.         // Check if the player already target this L2PcInstance
  713.         if (player.getTarget() != this)
  714.         {
  715. @@ -4078,6 +4096,8 @@
  716.                 stopFakeDeath(true);
  717.         }
  718.        
  719. +       EventCommons.getInstance().doDie(killer, this);
  720. +      
  721.         if (killer != null)
  722.         {
  723.             L2PcInstance pk = killer.getActingPlayer();
  724. Index: java/net/sf/l2j/gameserver/events/IEvent.java
  725. ===================================================================
  726. --- java/net/sf/l2j/gameserver/events/IEvent.java   (wersja 0)
  727. +++ java/net/sf/l2j/gameserver/events/IEvent.java   (wersja 0)
  728. @@ -0,0 +1,29 @@
  729. +/*
  730. + * This program is free software: you can redistribute it and/or modify it under
  731. + * the terms of the GNU General Public License as published by the Free Software
  732. + * Foundation, either version 3 of the License, or (at your option) any later
  733. + * version.
  734. + *
  735. + * This program is distributed in the hope that it will be useful, but WITHOUT
  736. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  737. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  738. + * details.
  739. + *
  740. + * You should have received a copy of the GNU General Public License along with
  741. + * this program. If not, see <http://www.gnu.org/licenses/>.
  742. + */
  743. +package net.sf.l2j.gameserver.events;
  744. +
  745. +/**
  746. + * @author Anarchy
  747. + */
  748. +public interface IEvent
  749. +{
  750. +   public void runEvent();
  751. +  
  752. +   public EventState getState();
  753. +  
  754. +   public String getTimes();
  755. +  
  756. +   public int getId();
  757. +}
  758. Index: java/net/sf/l2j/gameserver/events/EventState.java
  759. ===================================================================
  760. --- java/net/sf/l2j/gameserver/events/EventState.java   (wersja 0)
  761. +++ java/net/sf/l2j/gameserver/events/EventState.java   (wersja 0)
  762. @@ -0,0 +1,27 @@
  763. +/*
  764. + * This program is free software: you can redistribute it and/or modify it under
  765. + * the terms of the GNU General Public License as published by the Free Software
  766. + * Foundation, either version 3 of the License, or (at your option) any later
  767. + * version.
  768. + *
  769. + * This program is distributed in the hope that it will be useful, but WITHOUT
  770. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  771. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  772. + * details.
  773. + *
  774. + * You should have received a copy of the GNU General Public License along with
  775. + * this program. If not, see <http://www.gnu.org/licenses/>.
  776. + */
  777. +package net.sf.l2j.gameserver.events;
  778. +
  779. +/**
  780. + * @author Anarchy
  781. + *
  782. + * This class should contain all the necessary states for an event.
  783. + */
  784. +public enum EventState
  785. +{
  786. +   INACTIVE,
  787. +   REGISTERING,
  788. +   RUNNING
  789. +}
  790. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java
  791. ===================================================================
  792. --- java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (wersja 16)
  793. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (kopia robocza)
  794. @@ -17,6 +17,7 @@
  795.  import java.util.ArrayList;
  796.  import java.util.List;
  797.  
  798. +import net.sf.l2j.gameserver.events.EventCommons;
  799.  import net.sf.l2j.gameserver.handler.ISkillHandler;
  800.  import net.sf.l2j.gameserver.model.L2Object;
  801.  import net.sf.l2j.gameserver.model.L2Skill;
  802. @@ -56,6 +57,9 @@
  803.                     if (player.getClanId() != ((L2PcInstance) target).getClanId())
  804.                         continue;
  805.                 }
  806. +              
  807. +               if (!EventCommons.getInstance().canRes((L2PcInstance)target))
  808. +                   continue;
  809.             }
  810.            
  811.             if (target.isVisible())
  812. Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/EventCommands.java
  813. ===================================================================
  814. --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/EventCommands.java   (wersja 0)
  815. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/EventCommands.java   (wersja 0)
  816. @@ -0,0 +1,67 @@
  817. +/*
  818. + * This program is free software: you can redistribute it and/or modify it under
  819. + * the terms of the GNU General Public License as published by the Free Software
  820. + * Foundation, either version 3 of the License, or (at your option) any later
  821. + * version.
  822. + *
  823. + * This program is distributed in the hope that it will be useful, but WITHOUT
  824. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  825. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  826. + * details.
  827. + *
  828. + * You should have received a copy of the GNU General Public License along with
  829. + * this program. If not, see <http://www.gnu.org/licenses/>.
  830. + */
  831. +package net.sf.l2j.gameserver.handler.usercommandhandlers;
  832. +
  833. +import net.sf.l2j.gameserver.events.EventCommons;
  834. +import net.sf.l2j.gameserver.events.EventManager;
  835. +import net.sf.l2j.gameserver.events.EventState;
  836. +import net.sf.l2j.gameserver.events.TvTEvent;
  837. +import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  838. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  839. +
  840. +/**
  841. + * @author Anarchy
  842. + */
  843. +public class EventCommands implements IUserCommandHandler
  844. +{
  845. +   private static final int[] COMMAND_IDS =
  846. +   {
  847. +       114, 115
  848. +   };
  849. +  
  850. +   @Override
  851. +   public boolean useUserCommand(int id, L2PcInstance activeChar)
  852. +   {
  853. +       if (activeChar.isInOlympiadMode())
  854. +       {
  855. +           return false;
  856. +       }
  857. +      
  858. +       if (id == 114)
  859. +       {
  860. +           if (EventManager.getInstance().getCurrentEvent() == null || EventManager.getInstance().getCurrentEvent().getState() != EventState.REGISTERING)
  861. +               return false;
  862. +          
  863. +           EventCommons.getInstance().registerPlayer(activeChar, TvTEvent.class);
  864. +           activeChar.sendMessage("You have registered successfully.");
  865. +
  866. +       }
  867. +       else if (id == 115)
  868. +       {
  869. +           if (EventCommons.getInstance().getRegisteredPlayers().containsKey(activeChar))
  870. +               EventCommons.getInstance().unregisterPlayer(activeChar,EventCommons.getInstance().getRegisteredPlayers().get(activeChar));
  871. +          
  872. +           activeChar.sendMessage("You have canceled your registration.");
  873. +       }
  874. +      
  875. +       return true;
  876. +   }
  877. +  
  878. +   @Override
  879. +   public int[] getUserCommandList()
  880. +   {
  881. +       return COMMAND_IDS;
  882. +   }
  883. +}
  884. Index: java/net/sf/l2j/gameserver/events/EventTeam.java
  885. ===================================================================
  886. --- java/net/sf/l2j/gameserver/events/EventTeam.java    (wersja 0)
  887. +++ java/net/sf/l2j/gameserver/events/EventTeam.java    (wersja 0)
  888. @@ -0,0 +1,128 @@
  889. +/*
  890. + * This program is free software: you can redistribute it and/or modify it under
  891. + * the terms of the GNU General Public License as published by the Free Software
  892. + * Foundation, either version 3 of the License, or (at your option) any later
  893. + * version.
  894. + *
  895. + * This program is distributed in the hope that it will be useful, but WITHOUT
  896. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  897. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  898. + * details.
  899. + *
  900. + * You should have received a copy of the GNU General Public License along with
  901. + * this program. If not, see <http://www.gnu.org/licenses/>.
  902. + */
  903. +package net.sf.l2j.gameserver.events;
  904. +
  905. +import java.util.List;
  906. +
  907. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  908. +import net.sf.l2j.gameserver.skills.AbnormalEffect;
  909. +
  910. +/**
  911. + * @author Anarchy
  912. + *
  913. + */
  914. +public class EventTeam
  915. +{
  916. +   private final List<L2PcInstance> _players;
  917. +   private final String _name;
  918. +   private int _points;
  919. +   private final int[] _respawnLoc;
  920. +  
  921. +   public EventTeam(List<L2PcInstance> players, String name, int points, int[] respawnLoc)
  922. +   {
  923. +       _players = players;
  924. +       _name = name;
  925. +       _points = points;
  926. +       _respawnLoc = respawnLoc;
  927. +      
  928. +       for (L2PcInstance p : _players)
  929. +       {
  930. +           p.setEventTeam(this);
  931. +       }
  932. +   }
  933. +  
  934. +   public void teleportTeam(int x, int y, int z, boolean sendMessage)
  935. +   {
  936. +       for (L2PcInstance p : _players)
  937. +       {
  938. +           p.teleToLocation(x, y, z, 1);
  939. +           if (sendMessage)
  940. +               p.sendMessage("You have been teleported.");
  941. +       }
  942. +   }
  943. +  
  944. +   public void paralize(boolean val)
  945. +   {
  946. +       if (val)
  947. +       {
  948. +           for (L2PcInstance p : _players)
  949. +           {
  950. +               p.startAbnormalEffect(AbnormalEffect.ROOT);
  951. +               p.setIsParalyzed(true);
  952. +           }
  953. +       }
  954. +       else
  955. +       {
  956. +           for (L2PcInstance p : _players)
  957. +           {
  958. +               p.stopAbnormalEffect(AbnormalEffect.ROOT);
  959. +               p.setIsParalyzed(false);
  960. +           }
  961. +       }
  962. +   }
  963. +  
  964. +   public void rewardTeam(int itemId, int count)
  965. +   {
  966. +       for (L2PcInstance p : _players)
  967. +       {
  968. +           p.addItem("Event Reward", itemId, count, null, true);
  969. +       }
  970. +   }
  971. +  
  972. +   public void addPoints(int val)
  973. +   {
  974. +       _points += val;
  975. +   }
  976. +  
  977. +   public void removePoints(int val)
  978. +   {
  979. +       _points -= val;
  980. +   }
  981. +  
  982. +   public int getPoints()
  983. +   {
  984. +       return _points;
  985. +   }
  986. +  
  987. +   public int getRespawnX()
  988. +   {
  989. +       return _respawnLoc[0];
  990. +   }
  991. +  
  992. +   public int getRespawnY()
  993. +   {
  994. +       return _respawnLoc[1];
  995. +   }
  996. +  
  997. +   public int getRespawnZ()
  998. +   {
  999. +       return _respawnLoc[2];
  1000. +   }
  1001. +  
  1002. +   public String getName()
  1003. +   {
  1004. +       return _name;
  1005. +   }
  1006. +  
  1007. +   public List<L2PcInstance> getPlayers()
  1008. +   {
  1009. +       return _players;
  1010. +   }
  1011. +  
  1012. +   public boolean containsPlayer(L2PcInstance p)
  1013. +   {
  1014. +       return _players.contains(p);
  1015. +   }
  1016. +}
  1017. Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
  1018. ===================================================================
  1019. --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java  (wersja 16)
  1020. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java  (kopia robocza)
  1021. @@ -15,6 +15,7 @@
  1022.  package net.sf.l2j.gameserver.handler.usercommandhandlers;
  1023.  
  1024.  import net.sf.l2j.gameserver.datatables.SkillTable;
  1025. +import net.sf.l2j.gameserver.events.EventCommons;
  1026.  import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  1027.  import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
  1028.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1029. @@ -31,7 +32,7 @@
  1030.     @Override
  1031.     public boolean useUserCommand(int id, L2PcInstance activeChar)
  1032.     {
  1033. -       if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || GrandBossManager.isInBossZone(activeChar))
  1034. +       if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || GrandBossManager.isInBossZone(activeChar)|| !EventCommons.getInstance().canUnstuck(activeChar))
  1035.         {
  1036.             activeChar.sendMessage("Your current state doesn't allow you to use the /unstuck command.");
  1037.             return false;
  1038. Index: java/net/sf/l2j/gameserver/events/EventManager.java
  1039. ===================================================================
  1040. --- java/net/sf/l2j/gameserver/events/EventManager.java (wersja 0)
  1041. +++ java/net/sf/l2j/gameserver/events/EventManager.java (wersja 0)
  1042. @@ -0,0 +1,144 @@
  1043. +/*
  1044. + * This program is free software: you can redistribute it and/or modify it under
  1045. + * the terms of the GNU General Public License as published by the Free Software
  1046. + * Foundation, either version 3 of the License, or (at your option) any later
  1047. + * version.
  1048. + *
  1049. + * This program is distributed in the hope that it will be useful, but WITHOUT
  1050. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1051. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1052. + * details.
  1053. + *
  1054. + * You should have received a copy of the GNU General Public License along with
  1055. + * this program. If not, see <http://www.gnu.org/licenses/>.
  1056. + */
  1057. +package net.sf.l2j.gameserver.events;
  1058. +
  1059. +import java.util.Calendar;
  1060. +import java.util.HashMap;
  1061. +import java.util.logging.Logger;
  1062. +
  1063. +import net.sf.l2j.Config;
  1064. +import net.sf.l2j.gameserver.ThreadPoolManager;
  1065. +
  1066. +/**
  1067. + * @author Anarchy
  1068. + *
  1069. + * Just a class that will handle the registering and loading of events.
  1070. + */
  1071. +public final class EventManager
  1072. +{
  1073. +   private static final Logger _log = Logger.getLogger(EventManager.class.getName());
  1074. +  
  1075. +   public static int TVT = 1;
  1076. +  
  1077. +   private int _events = 0;
  1078. +   public HashMap<IEvent, Integer> _eventsTasks;
  1079. +   private IEvent _currentEvent = null;
  1080. +  
  1081. +   public static EventManager getInstance()
  1082. +   {
  1083. +       return SingletonHolder._instance;
  1084. +   }
  1085. +  
  1086. +   protected EventManager()
  1087. +   {
  1088. +       _eventsTasks = new HashMap<>();
  1089. +      
  1090. +       if (Config.ALLOW_TVT_EVENT)
  1091. +           registerEvent(Config.TVT_EVENT_TIMES, TvTEvent.class);
  1092. +      
  1093. +       _log.info("Loaded " + _events + " events.");
  1094. +   }
  1095. +  
  1096. +   public void registerEvent(final String times, final Class<?> type)
  1097. +   {
  1098. +       _events++;
  1099. +      
  1100. +       int i = 0;
  1101. +      
  1102. +       for (String time : times.split(","))
  1103. +       {
  1104. +           final IEvent event;
  1105. +          
  1106. +           try
  1107. +           {
  1108. +               event = (IEvent)type.newInstance();
  1109. +           }
  1110. +           catch (InstantiationException | IllegalAccessException ea)
  1111. +           {
  1112. +               ea.printStackTrace();
  1113. +               return;
  1114. +           }
  1115. +          
  1116. +           String[] timeArray = time.split(":");
  1117. +           int hours = Integer.parseInt(timeArray[0]);
  1118. +           int minutes = Integer.parseInt(timeArray[1]);
  1119. +          
  1120. +           Calendar cld = Calendar.getInstance();
  1121. +          
  1122. +           cld.set(Calendar.HOUR_OF_DAY, hours);
  1123. +           cld.set(Calendar.MINUTE, minutes);
  1124. +           cld.set(Calendar.SECOND, 0);
  1125. +          
  1126. +           if (cld.getTimeInMillis() - System.currentTimeMillis() < 0)
  1127. +           {
  1128. +               cld.set(Calendar.DAY_OF_MONTH, cld.get(Calendar.DAY_OF_MONTH) + 1);
  1129. +               cld.set(Calendar.HOUR_OF_DAY, hours);
  1130. +               cld.set(Calendar.MINUTE, minutes);
  1131. +               cld.set(Calendar.SECOND, 0);
  1132. +           }
  1133. +          
  1134. +           if (cld.getTimeInMillis() - System.currentTimeMillis() > 0)
  1135. +           {
  1136. +               i++;
  1137. +              
  1138. +               if (_eventsTasks.containsKey(event))
  1139. +               {
  1140. +                   _eventsTasks.remove(event);
  1141. +                   _eventsTasks.put(event, i);
  1142. +               }
  1143. +               else
  1144. +               {
  1145. +                   _eventsTasks.put(event, i);
  1146. +               }
  1147. +              
  1148. +               ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  1149. +               {
  1150. +                   @Override
  1151. +                   public void run()
  1152. +                   {
  1153. +                       if (_eventsTasks.get(event) == 1)
  1154. +                       {
  1155. +                           _eventsTasks.remove(event);
  1156. +                           registerEvent(times, type);
  1157. +                       }
  1158. +                       else
  1159. +                       {
  1160. +                           int t = _eventsTasks.get(event);
  1161. +                           _eventsTasks.remove(event);
  1162. +                           _eventsTasks.put(event, t--);
  1163. +                       }
  1164. +                      
  1165. +                       event.runEvent();
  1166. +                   }
  1167. +               }, cld.getTimeInMillis() - System.currentTimeMillis());
  1168. +           }
  1169. +       }
  1170. +   }
  1171. +  
  1172. +   public IEvent getCurrentEvent()
  1173. +   {
  1174. +       return _currentEvent;
  1175. +   }
  1176. +  
  1177. +   public void setCurrentEvent(IEvent event)
  1178. +   {
  1179. +       _currentEvent = event;
  1180. +   }
  1181. +  
  1182. +   private static class SingletonHolder
  1183. +   {
  1184. +       protected static final EventManager _instance = new EventManager();
  1185. +   }
  1186. +}
  1187. Index: java/net/sf/l2j/gameserver/handler/UserCommandHandler.java
  1188. ===================================================================
  1189. --- java/net/sf/l2j/gameserver/handler/UserCommandHandler.java  (wersja 16)
  1190. +++ java/net/sf/l2j/gameserver/handler/UserCommandHandler.java  (kopia robocza)
  1191. @@ -26,6 +26,7 @@
  1192.  import net.sf.l2j.gameserver.handler.usercommandhandlers.ClanWarsList;
  1193.  import net.sf.l2j.gameserver.handler.usercommandhandlers.DisMount;
  1194.  import net.sf.l2j.gameserver.handler.usercommandhandlers.Escape;
  1195. +import net.sf.l2j.gameserver.handler.usercommandhandlers.EventCommands;
  1196.  import net.sf.l2j.gameserver.handler.usercommandhandlers.Loc;
  1197.  import net.sf.l2j.gameserver.handler.usercommandhandlers.Mount;
  1198.  import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
  1199. @@ -58,6 +59,7 @@
  1200.         registerUserCommandHandler(new ChannelLeave());
  1201.         registerUserCommandHandler(new ChannelDelete());
  1202.         registerUserCommandHandler(new ChannelListUpdate());
  1203. +       registerUserCommandHandler(new EventCommands());
  1204.     }
  1205.    
  1206.     public void registerUserCommandHandler(IUserCommandHandler handler)
  1207. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/GetPlayer.java
  1208. ===================================================================
  1209. --- java/net/sf/l2j/gameserver/handler/skillhandlers/GetPlayer.java (wersja 16)
  1210. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/GetPlayer.java (kopia robocza)
  1211. @@ -14,6 +14,7 @@
  1212.   */
  1213.  package net.sf.l2j.gameserver.handler.skillhandlers;
  1214.  
  1215. +import net.sf.l2j.gameserver.events.EventCommons;
  1216.  import net.sf.l2j.gameserver.handler.ISkillHandler;
  1217.  import net.sf.l2j.gameserver.model.L2Object;
  1218.  import net.sf.l2j.gameserver.model.L2Skill;
  1219. @@ -43,6 +44,9 @@
  1220.             if (victim == null || victim.isAlikeDead())
  1221.                 continue;
  1222.            
  1223. +           if (!EventCommons.getInstance().canRecall(victim))
  1224. +               continue;
  1225. +          
  1226.             victim.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0);
  1227.         }
  1228.     }
Advertisement
Add Comment
Please, Sign In to add comment