Guest User

Untitled

a guest
Jul 4th, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.51 KB | None | 0 0
  1. Index: java/net/l2jalpha/gameserver/network/clientpackets/Logout.java
  2. ===================================================================
  3. --- java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (revision 31)
  4. +++ java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (working copy)
  5. @@ -27,6 +27,7 @@
  6. import net.l2jalpha.gameserver.datatables.xml.SkillTable;
  7. import net.l2jalpha.gameserver.model.L2World;
  8. import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  9. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  10. import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
  11. import net.l2jalpha.gameserver.network.SystemMessageId;
  12. import net.l2jalpha.gameserver.network.serverpackets.ActionFailed;
  13. @@ -56,6 +57,13 @@
  14.  
  15. if (player == null)
  16. return;
  17. +
  18. + if (CoastGuard.getInstance().getPlayers().contains(player))
  19. + {
  20. + player.sendMessage("You cannot logout while participating at Coast Guard event.");
  21. + player.sendPacket(ActionFailed.STATIC_PACKET);
  22. + return;
  23. + }
  24.  
  25. player.getInventory().updateDatabase();
  26.  
  27. Index: java/net/l2jalpha/gameserver/GameServer.java
  28. ===================================================================
  29. --- java/net/l2jalpha/gameserver/GameServer.java (revision 31)
  30. +++ java/net/l2jalpha/gameserver/GameServer.java (working copy)
  31. @@ -84,6 +84,7 @@
  32. import net.l2jalpha.gameserver.model.L2Manor;
  33. import net.l2jalpha.gameserver.model.L2World;
  34. import net.l2jalpha.gameserver.model.entity.Hero;
  35. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  36. import net.l2jalpha.gameserver.model.entity.addons.events.QuizEvent;
  37. import net.l2jalpha.gameserver.model.olympiad.Olympiad;
  38. import net.l2jalpha.gameserver.model.olympiad.OlympiadGameManager;
  39. @@ -313,6 +314,7 @@
  40. {
  41. _log.config("Quiz Event is disabled.");
  42. }
  43. + CoastGuard.getInstance();
  44.  
  45. printSection("Other");
  46. TaskManager.getInstance();
  47. Index: java/net/l2jalpha/gameserver/model/actor/L2Character.java
  48. ===================================================================
  49. --- java/net/l2jalpha/gameserver/model/actor/L2Character.java (revision 31)
  50. +++ java/net/l2jalpha/gameserver/model/actor/L2Character.java (working copy)
  51. @@ -72,6 +72,8 @@
  52. import net.l2jalpha.gameserver.model.actor.stat.CharStat;
  53. import net.l2jalpha.gameserver.model.actor.status.CharStatus;
  54. import net.l2jalpha.gameserver.model.entity.Duel;
  55. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  56. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
  57. import net.l2jalpha.gameserver.model.quest.Quest;
  58. import net.l2jalpha.gameserver.model.quest.QuestState;
  59. import net.l2jalpha.gameserver.network.SystemMessageId;
  60. @@ -591,7 +593,12 @@
  61. {
  62. if (Config.DEBUG)
  63. _log.fine(getName()+" doAttack: target="+target);
  64. -
  65. +
  66. + if (CoastGuard.getInstance().getState() != EventState.INACTIVE && ((L2Attackable)this).getNpcId() == 65534)
  67. + {
  68. + getKnownList().addKnownObject(target);
  69. + }
  70. +
  71. if (isAlikeDead() || target == null || (this instanceof L2Npc && target.isAlikeDead())
  72. || (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath())
  73. || !getKnownList().knowsObject(target)
  74. Index: java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java
  75. ===================================================================
  76. --- java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java (revision 0)
  77. +++ java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java (working copy)
  78. @@ -0,0 +1,48 @@
  79. +/* This program is free software; you can redistribute it and/or modify
  80. + * it under the terms of the GNU General Public License as published by
  81. + * the Free Software Foundation; either version 2, or (at your option)
  82. + * any later version.
  83. + *
  84. + * This program is distributed in the hope that it will be useful,
  85. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  86. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  87. + * GNU General Public License for more details.
  88. + *
  89. + * You should have received a copy of the GNU General Public License
  90. + * along with this program; if not, write to the Free Software
  91. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  92. + * 02111-1307, USA.
  93. + *
  94. + * http://www.gnu.org/copyleft/gpl.html
  95. + */
  96. +package net.l2jalpha.gameserver.model.actor.instance;
  97. +
  98. +import net.l2jalpha.gameserver.ai.CtrlIntention;
  99. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  100. +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
  101. +
  102. +/**
  103. + *
  104. + * @author Anarchy
  105. + */
  106. +public class L2CoastMonsterInstance extends L2MonsterInstance
  107. +{
  108. + public L2CoastMonsterInstance(int objectId, L2NpcTemplate template)
  109. + {
  110. + super(objectId, template);
  111. + }
  112. +
  113. + @Override
  114. + public boolean isAggressive()
  115. + {
  116. + return true;
  117. + }
  118. +
  119. + @Override
  120. + public void onSpawn()
  121. + {
  122. + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, CoastGuard.getInstance().getFlag());
  123. +
  124. + super.onSpawn();
  125. + }
  126. +}
  127. Index: java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java
  128. ===================================================================
  129. --- java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java (revision 0)
  130. +++ java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java (working copy)
  131. @@ -0,0 +1,300 @@
  132. +/* This program is free software; you can redistribute it and/or modify
  133. + * it under the terms of the GNU General Public License as published by
  134. + * the Free Software Foundation; either version 2, or (at your option)
  135. + * any later version.
  136. + *
  137. + * This program is distributed in the hope that it will be useful,
  138. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  139. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  140. + * GNU General Public License for more details.
  141. + *
  142. + * You should have received a copy of the GNU General Public License
  143. + * along with this program; if not, write to the Free Software
  144. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  145. + * 02111-1307, USA.
  146. + *
  147. + * http://www.gnu.org/copyleft/gpl.html
  148. + */
  149. +package net.l2jalpha.gameserver.model.entity.addons.events;
  150. +
  151. +import java.util.concurrent.ScheduledFuture;
  152. +import java.util.logging.Logger;
  153. +
  154. +import javolution.util.FastList;
  155. +import net.l2jalpha.gameserver.Announcements;
  156. +import net.l2jalpha.gameserver.ThreadPoolManager;
  157. +import net.l2jalpha.gameserver.ai.CtrlIntention;
  158. +import net.l2jalpha.gameserver.datatables.sql.NpcTable;
  159. +import net.l2jalpha.gameserver.datatables.sql.SpawnTable;
  160. +import net.l2jalpha.gameserver.model.L2Spawn;
  161. +import net.l2jalpha.gameserver.model.actor.L2Npc;
  162. +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  163. +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
  164. +import net.l2jalpha.util.Rnd;
  165. +
  166. +/**
  167. + *
  168. + * @author Anarchy
  169. + */
  170. +public class CoastGuard
  171. +{
  172. + private static Logger _log = Logger.getLogger(CoastGuard.class.getName());
  173. +
  174. + public enum EventState
  175. + {
  176. + INACTIVE,
  177. + REGISTERING,
  178. + RUNNING
  179. + }
  180. +
  181. + private EventState state = EventState.INACTIVE;
  182. + private FastList<L2PcInstance> _players = new FastList<>();
  183. + private ScheduledFuture<?> _monstersSpawnTask = null;
  184. + protected L2Npc _flag = null;
  185. + protected FastList<L2Npc> _monsters = new FastList<>();
  186. +
  187. + public static CoastGuard getInstance()
  188. + {
  189. + return SingletonHolder._instance;
  190. + }
  191. +
  192. + protected CoastGuard()
  193. + {
  194. + _log.info("Coast Guard event loaded.");
  195. + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  196. + {
  197. + @Override
  198. + public void run()
  199. + {
  200. + runEvent();
  201. + }
  202. + }, 1000*60*60/2, 1000*60*60);
  203. + }
  204. +
  205. + public EventState getState()
  206. + {
  207. + return state;
  208. + }
  209. +
  210. + public void setState(EventState s)
  211. + {
  212. + state = s;
  213. + }
  214. +
  215. + public void runEvent()
  216. + {
  217. + Announcements.getInstance().announceToAll("Coast Guard event registrations have started. Type .register to join and .leave to leave.");
  218. + Announcements.getInstance().announceToAll("The registrations will close in 5 minutes.");
  219. + setState(EventState.REGISTERING);
  220. +
  221. + sleep(60*5);
  222. +
  223. + Announcements.getInstance().announceToAll("The registrations have closed.");
  224. + if (teleportPlayers())
  225. + {
  226. + Announcements.getInstance().announceToAll("The players have been teleported. 5 minutes till the event finish.");
  227. + }
  228. + else
  229. + {
  230. + setState(EventState.INACTIVE);
  231. + return;
  232. + }
  233. + spawnFlag();
  234. + _monstersSpawnTask = startMonstersSpawn();
  235. + setState(EventState.RUNNING);
  236. +
  237. + sleep(60*5);
  238. +
  239. + if (getState() == EventState.INACTIVE)
  240. + {
  241. + return;
  242. + }
  243. +
  244. + endEvent(true);
  245. + }
  246. +
  247. + public void removePlayer(L2PcInstance p)
  248. + {
  249. + if (getState() != EventState.REGISTERING)
  250. + {
  251. + p.sendMessage("You cannot remove your participation from the event right now.");
  252. + return;
  253. + }
  254. +
  255. + _players.remove(p);
  256. + p.sendMessage("You have successfully removed your participation from Coast Guard event.");
  257. + }
  258. +
  259. + public void registerPlayer(L2PcInstance p)
  260. + {
  261. + if (getState() != EventState.REGISTERING || p.isInOlympiadMode())
  262. + {
  263. + p.sendMessage("You cannot participate in the event right now.");
  264. + return;
  265. + }
  266. +
  267. + _players.add(p);
  268. + p.sendMessage("You have successfully registered for Coast Guard event.");
  269. + }
  270. +
  271. + public void endEvent(boolean won)
  272. + {
  273. + if (!won)
  274. + {
  275. + Announcements.getInstance().announceToAll("The event has finished. Monsters have won.");
  276. + if (!_monstersSpawnTask.isCancelled())
  277. + {
  278. + _monstersSpawnTask.cancel(true);
  279. + }
  280. + for (L2PcInstance p : _players)
  281. + {
  282. + p.sendMessage("You have lost!");
  283. + p.teleToLocation(38017, -48154, 896, true);
  284. + }
  285. + _players.clear();
  286. + _flag.deleteMe();
  287. + _flag = null;
  288. + for (L2Npc m : _monsters)
  289. + {
  290. + m.deleteMe();
  291. + }
  292. + _monsters.clear();
  293. + setState(EventState.INACTIVE);
  294. + }
  295. + else
  296. + {
  297. + Announcements.getInstance().announceToAll("The event has finished. Players have won.");
  298. + if (!_monstersSpawnTask.isCancelled())
  299. + {
  300. + _monstersSpawnTask.cancel(true);
  301. + }
  302. + for (L2PcInstance p : _players)
  303. + {
  304. + p.addItem("Won event.", 57, 1, p, true);
  305. + p.sendMessage("You have won!");
  306. + p.teleToLocation(38017, -48154, 896, true);
  307. + }
  308. + _players.clear();
  309. + _flag.deleteMe();
  310. + _flag = null;
  311. + for (L2Npc m : _monsters)
  312. + {
  313. + m.deleteMe();
  314. + }
  315. + _monsters.clear();
  316. + setState(EventState.INACTIVE);
  317. + }
  318. + }
  319. +
  320. + private ScheduledFuture<?> startMonstersSpawn()
  321. + {
  322. + return ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  323. + {
  324. + @Override
  325. + public void run()
  326. + {
  327. + L2NpcTemplate t = NpcTable.getInstance().getTemplate(65534);
  328. + try
  329. + {
  330. + L2Spawn sp = new L2Spawn(t);
  331. + switch (Rnd.get(3))
  332. + {
  333. + case 0:
  334. + sp.setLocx(38966);
  335. + sp.setLocy(-48203);
  336. + sp.setLocz(896);
  337. + break;
  338. + case 1:
  339. + sp.setLocx(38907);
  340. + sp.setLocy(-48525);
  341. + sp.setLocz(896);
  342. + break;
  343. + case 2:
  344. + sp.setLocx(38412);
  345. + sp.setLocy(-48362);
  346. + sp.setLocz(896);
  347. + break;
  348. + }
  349. + sp.setAmount(1);
  350. + sp.setHeading(_flag.getHeading());
  351. + sp.setRespawnDelay(40);
  352. + SpawnTable.getInstance().addNewSpawn(sp, false);
  353. + sp.init();
  354. + sp.stopRespawn();
  355. + sp.getLastSpawn().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, _flag);
  356. + _monsters.add(sp.getLastSpawn());
  357. + }
  358. + catch (Exception e)
  359. + {
  360. + e.printStackTrace();
  361. + }
  362. + }
  363. + }, 3000, 2500);
  364. + }
  365. +
  366. + private void spawnFlag()
  367. + {
  368. + L2NpcTemplate t = NpcTable.getInstance().getTemplate(65535);
  369. + try
  370. + {
  371. + L2Spawn sp = new L2Spawn(t);
  372. + sp.setLocx(38667);
  373. + sp.setLocy(-48392);
  374. + sp.setLocz(896);
  375. + sp.setAmount(1);
  376. + sp.setHeading(_players.getFirst().getHeading());
  377. + sp.setRespawnDelay(40);
  378. + SpawnTable.getInstance().addNewSpawn(sp, false);
  379. + sp.init();
  380. + sp.stopRespawn();
  381. + _flag = sp.getLastSpawn();
  382. + }
  383. + catch (Exception e)
  384. + {
  385. + e.printStackTrace();
  386. + }
  387. + }
  388. +
  389. + private boolean teleportPlayers()
  390. + {
  391. + if (_players.size() < 2)
  392. + {
  393. + Announcements.getInstance().announceToAll("The event was cancelled due to low participation.");
  394. + _players.clear();
  395. + return false;
  396. + }
  397. +
  398. + for (L2PcInstance p : _players)
  399. + {
  400. + p.teleToLocation(38681, -48234, 896, true);
  401. + p.sendMessage("You have 5 minutes left to defend the flag!");
  402. + }
  403. +
  404. + return true;
  405. + }
  406. +
  407. + public L2Npc getFlag()
  408. + {
  409. + return _flag;
  410. + }
  411. +
  412. + public FastList<L2PcInstance> getPlayers()
  413. + {
  414. + return _players;
  415. + }
  416. +
  417. + private void sleep(int secs)
  418. + {
  419. + try
  420. + {
  421. + Thread.sleep(secs*1000);
  422. + }
  423. + catch (InterruptedException e)
  424. + { }
  425. + }
  426. +
  427. + private static class SingletonHolder
  428. + {
  429. + protected static final CoastGuard _instance = new CoastGuard();
  430. + }
  431. +}
  432. Index: java/net/l2jalpha/gameserver/ai/L2AttackableAI.java
  433. ===================================================================
  434. --- java/net/l2jalpha/gameserver/ai/L2AttackableAI.java (revision 31)
  435. +++ java/net/l2jalpha/gameserver/ai/L2AttackableAI.java (working copy)
  436. @@ -46,6 +46,8 @@
  437. import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  438. import net.l2jalpha.gameserver.model.actor.instance.L2PenaltyMonsterInstance;
  439. import net.l2jalpha.gameserver.model.actor.instance.L2RaidBossInstance;
  440. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  441. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
  442. import net.l2jalpha.gameserver.templates.L2Weapon;
  443. import net.l2jalpha.gameserver.templates.L2WeaponType;
  444. import net.l2jalpha.util.Rnd;
  445. @@ -479,7 +481,7 @@
  446. _attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
  447. }
  448. }
  449. -
  450. +
  451. // Check if target is dead or if timeout is expired to stop this attack
  452. if (getAttackTarget() == null || getAttackTarget().isAlikeDead()
  453. || _attackTimeout < GameTimeController.getGameTicks())
  454. @@ -502,7 +504,6 @@
  455. if (((L2Npc) _actor).getFactionId() != null)
  456. {
  457. String faction_id = ((L2Npc) _actor).getFactionId();
  458. -
  459. // Go through all L2Object that belong to its faction
  460. for (L2Object obj : _actor.getKnownList().getKnownObjects().values())
  461. {
  462. @@ -522,6 +523,7 @@
  463. && (npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE
  464. || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE))
  465. {
  466. + System.out.println("Fourth pass.");
  467. // Notify the L2Object AI with EVT_AGGRESSION
  468. npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
  469. }
  470. @@ -583,6 +585,11 @@
  471. L2Character hated;
  472. if (_actor.isConfused()) hated = getAttackTarget();
  473. else hated = ((L2Attackable) _actor).getMostHated();
  474. +
  475. + if (CoastGuard.getInstance().getState() != EventState.INACTIVE && ((L2Attackable)_actor).getNpcId() == 65534)
  476. + {
  477. + hated = CoastGuard.getInstance().getFlag();
  478. + }
  479.  
  480. if (hated == null)
  481. {
  482. Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java
  483. ===================================================================
  484. --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (revision 31)
  485. +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (working copy)
  486. @@ -22,6 +22,7 @@
  487. import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
  488. import net.l2jalpha.gameserver.datatables.xml.SkillTable;
  489. import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  490. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  491. import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
  492. import net.l2jalpha.gameserver.network.L2GameClient;
  493. import net.l2jalpha.gameserver.network.SystemMessageId;
  494. @@ -56,6 +57,12 @@
  495. _log.warning("[RequestRestart] activeChar null!?");
  496. return;
  497. }
  498. +
  499. + if (CoastGuard.getInstance().getPlayers().contains(player))
  500. + {
  501. + player.sendMessage("You cannot restart while participating at Coast Guard event.");
  502. + return;
  503. + }
  504.  
  505. if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(player))
  506. {
  507. Index: java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java
  508. ===================================================================
  509. --- java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java (revision 0)
  510. +++ java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java (working copy)
  511. @@ -0,0 +1,60 @@
  512. +/* This program is free software; you can redistribute it and/or modify
  513. + * it under the terms of the GNU General Public License as published by
  514. + * the Free Software Foundation; either version 2, or (at your option)
  515. + * any later version.
  516. + *
  517. + * This program is distributed in the hope that it will be useful,
  518. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  519. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  520. + * GNU General Public License for more details.
  521. + *
  522. + * You should have received a copy of the GNU General Public License
  523. + * along with this program; if not, write to the Free Software
  524. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  525. + * 02111-1307, USA.
  526. + *
  527. + * http://www.gnu.org/copyleft/gpl.html
  528. + */
  529. +package net.l2jalpha.gameserver.model.actor.instance;
  530. +
  531. +import net.l2jalpha.gameserver.model.actor.L2Character;
  532. +import net.l2jalpha.gameserver.model.actor.L2Npc;
  533. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  534. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
  535. +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
  536. +
  537. +/**
  538. + *
  539. + * @author Anarchy
  540. + */
  541. +public class L2CoastFlagInstance extends L2Npc
  542. +{
  543. + public L2CoastFlagInstance(int objectId, L2NpcTemplate template)
  544. + {
  545. + super(objectId, template);
  546. + getAI();
  547. + }
  548. +
  549. + @Override
  550. + public boolean isAutoAttackable(L2Character attacker)
  551. + {
  552. + return true;
  553. + }
  554. +
  555. + @Override
  556. + public boolean isAttackable()
  557. + {
  558. + return true;
  559. + }
  560. +
  561. + @Override
  562. + public boolean doDie(L2Character killer)
  563. + {
  564. + if (CoastGuard.getInstance().getState() != EventState.INACTIVE)
  565. + {
  566. + CoastGuard.getInstance().endEvent(false);
  567. + }
  568. +
  569. + return true;
  570. + }
  571. +}
  572. #P l2jalpha_datapack_mxc
  573. Index: sql/npc.sql
  574. ===================================================================
  575. --- sql/npc.sql (revision 31)
  576. +++ sql/npc.sql (working copy)
  577. @@ -6263,7 +6263,9 @@
  578. (35653,35653,'Court Magician',0,'Innadril',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
  579. (35654,35654,'Court Magician',0,'Goddard',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
  580. (35655,35655,'Court Magician',0,'Rune',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
  581. - (35656,35656,'Court Magician',0,'Schuttgart',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT');
  582. + (35656,35656,'Court Magician',0,'Schuttgart',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
  583. + (65535,35062,'Flag',0,'Coast Guard',0,'Deco.flag_a',21.00,82.00,1,'etc','L2CoastFlag',40,158000,989,3.16,0.91,40,43,30,21,20,10,0,0,652,753,358,295,423,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'),
  584. + (65534,22124,'Monster',0,'Coast Guard',0,'Monster3.solina_brother',20.00,25.00,80,'male','L2CoastMonster',80,4609,2085,13.43,3.09,40,43,30,21,20,10,10198,1158,1972,574,1182,477,278,0,333,8212,0,0,88,132,NULL,0,0,0,'LAST_HIT');
  585.  
  586. INSERT INTO `npc` VALUES
  587. (50007,31324,'Andromeda',1,'Wedding Manager',1,'NPC.a_casino_FDarkElf',8.00,23.00,70,'female','L2WeddingManager',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,316,0,0,55,132,NULL,0,1,0,'LAST_HIT');
  588. \ No newline at end of file
  589. Index: data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java
  590. ===================================================================
  591. --- data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java (revision 0)
  592. +++ data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java (working copy)
  593. @@ -0,0 +1,49 @@
  594. +/* This program is free software; you can redistribute it and/or modify
  595. + * it under the terms of the GNU General Public License as published by
  596. + * the Free Software Foundation; either version 2, or (at your option)
  597. + * any later version.
  598. + *
  599. + * This program is distributed in the hope that it will be useful,
  600. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  601. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  602. + * GNU General Public License for more details.
  603. + *
  604. + * You should have received a copy of the GNU General Public License
  605. + * along with this program; if not, write to the Free Software
  606. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  607. + * 02111-1307, USA.
  608. + *
  609. + * http://www.gnu.org/copyleft/gpl.html
  610. + */
  611. +package handlers.voicedcommandhandlers;
  612. +
  613. +import net.l2jalpha.gameserver.handler.IVoicedCommandHandler;
  614. +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  615. +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
  616. +
  617. +public class CoastGuardCommands implements IVoicedCommandHandler
  618. +{
  619. + private static final String[] VOICED_COMMANDS = { "register", "leave" };
  620. +
  621. + @Override
  622. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  623. + {
  624. + if (command.equals("register"))
  625. + {
  626. + CoastGuard.getInstance().registerPlayer(activeChar);
  627. + }
  628. +
  629. + if (command.equals("leave"))
  630. + {
  631. + CoastGuard.getInstance().removePlayer(activeChar);
  632. + }
  633. +
  634. + return true;
  635. + }
  636. +
  637. + @Override
  638. + public String[] getVoicedCommandList()
  639. + {
  640. + return VOICED_COMMANDS;
  641. + }
  642. +}
  643. Index: data/scripts/handlers/MasterHandler.java
  644. ===================================================================
  645. --- data/scripts/handlers/MasterHandler.java (revision 31)
  646. +++ data/scripts/handlers/MasterHandler.java (working copy)
  647. @@ -152,6 +152,7 @@
  648. import handlers.usercommandhandlers.OlympiadStat;
  649. import handlers.usercommandhandlers.PartyInfo;
  650. import handlers.usercommandhandlers.Time;
  651. +import handlers.voicedcommandhandlers.CoastGuardCommands;
  652.  
  653. import java.util.logging.Logger;
  654.  
  655. @@ -276,7 +277,7 @@
  656.  
  657. private static void loadVoicedHandlers()
  658. {
  659. - //VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Name());
  660. + VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new CoastGuardCommands());
  661.  
  662. _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " voiced command handlers.");
  663. }
Advertisement
Add Comment
Please, Sign In to add comment