Advertisement
tazerman

Untitled

Jan 13th, 2017
1,579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.28 KB | None | 0 0
  1. gameserver.java
  2. ------------------------
  3.  
  4. ChaoticZone.getInstance();
  5.  
  6. ------------------------
  7. NpcHtmlMessage.java
  8. ------------------------
  9. inside to
  10. public void replace(String pattern, String value)
  11.  
  12. use this
  13. // Code by L2jLuna Dev.
  14. String ZoneCheck;
  15. switch (ChaoticZone.getInstance().state)
  16. {
  17. case ISLOADING:
  18. ZoneCheck = "Chaotic Zone is Loading...";
  19. case INCHANGE:
  20. ZoneCheck = "The Chaotic Zone is change soon!";
  21. break;
  22. default:
  23. ZoneCheck = String.valueOf("<center>Time Next Map: " + new SimpleDateFormat("mm:ss").format(ChaoticZone.getInstance().getTime())+"<br><a action=\"bypass -h npc_%objectId%_goto 50001\">CHAOTIC ZONE</a></center>");
  24. break;
  25. }
  26. //show time in npc and status
  27. _html = _html.replace("%ChaoticMap%", ZoneCheck);
  28.  
  29. ------------------------
  30. ChaoticZone.java
  31. ------------------------
  32. /*
  33. * This program is free software: you can redistribute it and/or modify it under
  34. * the terms of the GNU General Public License as published by the Free Software
  35. * Foundation, either version 3 of the License, or (at your option) any later
  36. * version.
  37. *
  38. * This program is distributed in the hope that it will be useful, but WITHOUT
  39. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  40. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  41. * details.
  42. *
  43. * You should have received a copy of the GNU General Public License along with
  44. * this program. If not, see <http://www.gnu.org/licenses/>.
  45. */
  46. package com.l2jfrozen.gameserver.model.zone;
  47.  
  48. import java.util.concurrent.ScheduledFuture;
  49. import java.util.concurrent.TimeUnit;
  50.  
  51. import org.apache.log4j.Logger;
  52.  
  53. import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
  54. import com.l2jfrozen.gameserver.model.L2Character;
  55. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  56. import com.l2jfrozen.gameserver.model.entity.Announcements;
  57. import com.l2jfrozen.gameserver.model.zone.type.L2ChaoticZone;
  58. import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  59. import com.l2jfrozen.util.random.Rnd;
  60.  
  61. /**
  62. * @author L2jLuna
  63. */
  64. public class ChaoticZone
  65. {
  66. private static Logger LOGGER = Logger.getLogger(L2ChaoticZone.class);
  67. private static ChaoticZone _instance;
  68. private ScheduledFuture<?> _startThread = null;
  69. private ScheduledFuture<?> _timer = null;
  70. int seconds;
  71.  
  72. public static enum Map
  73. {
  74. CHAOTIC_ZONE,
  75. CHAOTIC_ZONE_NO1,
  76. CHAOTIC_ZONE_NO2,
  77. CHAOTIC_ZONE_NO3,
  78. CHAOTIC_ZONE_NO4,
  79. CHAOTIC_ZONE_NO5,
  80. NONE
  81. }
  82.  
  83. public static enum CheckIsChange
  84. {
  85. INACTIVE,
  86. ISLOADING,
  87. INCHANGE,
  88. NORMAL
  89. }
  90.  
  91. private static L2Character Zchar;
  92. public static Map currentMap = Map.CHAOTIC_ZONE;
  93. public CheckIsChange state = CheckIsChange.ISLOADING;
  94.  
  95. public static int Random = Rnd.get(1, 5);
  96.  
  97. public static ChaoticZone getInstance()
  98. {
  99. if (_instance == null)
  100. {
  101. _instance = new ChaoticZone();
  102. }
  103.  
  104. return _instance;
  105. }
  106.  
  107. public ChaoticZone()
  108. {
  109. LOGGER.info("Chaotic Zone is start!");
  110. if (state == CheckIsChange.ISLOADING)
  111. {
  112. seconds = 130;
  113. CounterStart();
  114. }
  115. }
  116.  
  117. public void CounterStart()
  118. {
  119. _startThread = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new Runnable()
  120. {
  121. @Override
  122. public void run()
  123. {
  124. countDown();
  125. }
  126. }, 1000 * 5, 1000);
  127. }
  128.  
  129. public void countDown()
  130. {
  131. switch (seconds)
  132. {
  133. case 3600: // 1 hour left
  134. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Has Changed!");
  135. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Next Map Change 1 hour!");
  136. state = CheckIsChange.INACTIVE;
  137. _timer = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  138. {
  139. @Override
  140. public void run()
  141. {
  142. }
  143. }, 1000*seconds);
  144. break;
  145. case 300: // 5 minutes left
  146. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Change 5 minute(s)!");
  147. break;
  148. case 120: // 2 minutes left
  149. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Change 2 minute(s)!");
  150. break;
  151. case 30: // 30 seconds left
  152. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Change 30 second(s)!");
  153. state = CheckIsChange.INCHANGE;
  154. break;
  155. case 10: // 10 seconds left
  156. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Change 10 second(s)!");
  157. break;
  158. case 1: // 1 seconds left
  159. Announcements.getInstance().gameAnnounceToAll("Chaotic Zone: Change 1 second(s)!");
  160. ChangeMap();
  161. break;
  162. case 0:
  163. ChangeZone();
  164. _startThread.cancel(true);
  165. }
  166. seconds--;
  167. }
  168.  
  169. public void ChangeZone()
  170. {
  171. int tempR = Random;
  172. while (tempR == Random)
  173. tempR = Rnd.get(1, 5);
  174. Random = tempR;
  175.  
  176. switch (Random)
  177. {
  178. case 1:
  179. currentMap = Map.CHAOTIC_ZONE;
  180. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map has added!");
  181. break;
  182. case 2:
  183. currentMap = Map.CHAOTIC_ZONE_NO1;
  184. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map No(1) has added!");
  185. break;
  186. case 3:
  187. currentMap = Map.CHAOTIC_ZONE_NO2;
  188. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map No(2) has added!");
  189. break;
  190. case 4:
  191. currentMap = Map.CHAOTIC_ZONE_NO3;
  192. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map No(3) has added!");
  193. break;
  194. case 5:
  195. currentMap = Map.CHAOTIC_ZONE_NO4;
  196. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map No(4) has added!");
  197. break;
  198. case 6:
  199. currentMap = Map.CHAOTIC_ZONE_NO5;
  200. Announcements.getInstance().gameAnnounceToAll("The Chaotic Map No(5) has added!");
  201. break;
  202. default:
  203. currentMap = Map.NONE;
  204. break;
  205. }
  206. seconds = 3610;
  207. CounterStart();
  208. }
  209.  
  210. public void ChangeMap()
  211. {
  212. state = CheckIsChange.ISLOADING;
  213. Announcements.getInstance().gameAnnounceToAll("The Map Change soon!");
  214. /**
  215. * Check player if is inside zone teleport him in town.
  216. */
  217.  
  218. if (Zchar instanceof L2PcInstance)
  219. {
  220. L2PcInstance CheckChar = (L2PcInstance) Zchar;
  221.  
  222. if (CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC) || CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC1) || CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC2) || CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC3) || CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC4) || CheckChar.isInsideZone(L2Character.ZONE_CHAOTIC5))
  223. {
  224. if (CheckChar.isOnline() == 1)
  225. {
  226. CheckChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
  227. }
  228. CheckChar.sendMessage("Chaotic Zone: Automatical teleport in town. The map chance soon.");
  229. }
  230. }
  231. }
  232.  
  233. public long getTime()
  234. {
  235. if (_timer != null)
  236. {
  237. return _timer.getDelay(TimeUnit.MILLISECONDS);
  238. }
  239.  
  240. return 0;
  241. }
  242. }
  243. --------------------------------
  244. L2ChaoticZone.java
  245. --------------------------------
  246. /* L2jFrozen Project - www.l2jfrozen.com
  247. *
  248. * This program is free software; you can redistribute it and/or modify
  249. * it under the terms of the GNU General Public License as published by
  250. * the Free Software Foundation; either version 2, or (at your option)
  251. * any later version.
  252. *
  253. * This program is distributed in the hope that it will be useful,
  254. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  255. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  256. * GNU General Public License for more details.
  257. *
  258. * You should have received a copy of the GNU General Public License
  259. * along with this program; if not, write to the Free Software
  260. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  261. * 02111-1307, USA.
  262. *
  263. * http://www.gnu.org/copyleft/gpl.html
  264. */
  265. package com.l2jfrozen.gameserver.model.zone.type;
  266.  
  267. import com.l2jfrozen.Config;
  268. import com.l2jfrozen.gameserver.model.L2Character;
  269. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  270. import com.l2jfrozen.gameserver.model.zone.ChaoticZone;
  271. import com.l2jfrozen.gameserver.model.zone.ChaoticZone.Map;
  272. import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  273. import com.l2jfrozen.util.random.Rnd;
  274.  
  275. /**
  276. * @author L2jLuna
  277. */
  278. public class L2ChaoticZone extends L2ZoneType
  279. {
  280. public L2ChaoticZone(int id)
  281. {
  282. super(id);
  283. }
  284.  
  285. @Override
  286. public void setParameter(String name, String value)
  287. {
  288. super.setParameter(name, value);
  289. }
  290.  
  291. @Override
  292. protected void onEnter(final L2Character character)
  293. {
  294. character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);
  295.  
  296. switch (ChaoticZone.currentMap)
  297. {
  298. case CHAOTIC_ZONE:
  299. if (character instanceof L2PcInstance)
  300. {
  301. L2PcInstance aChar = (L2PcInstance) character;
  302. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC))
  303. {
  304. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO1)
  305. {
  306. int[] loc = Config.SPAWN_LOC1[Rnd.get(Config.SPAWN_LOC1.length)];
  307. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  308. }
  309. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO2)
  310. {
  311. int[] loc = Config.SPAWN_LOC2[Rnd.get(Config.SPAWN_LOC2.length)];
  312. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  313. }
  314. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO3)
  315. {
  316. int[] loc = Config.SPAWN_LOC3[Rnd.get(Config.SPAWN_LOC3.length)];
  317. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  318. }
  319. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO4)
  320. {
  321. int[] loc = Config.SPAWN_LOC4[Rnd.get(Config.SPAWN_LOC4.length)];
  322. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  323. }
  324. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO5)
  325. {
  326. int[] loc = Config.SPAWN_LOC5[Rnd.get(Config.SPAWN_LOC5.length)];
  327. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  328. }
  329. else
  330. {
  331. character.setInsideZone(L2Character.ZONE_CHAOTIC, true);
  332.  
  333. }
  334. }
  335. }
  336. break;
  337. case CHAOTIC_ZONE_NO1:
  338. if (character instanceof L2PcInstance)
  339. {
  340. L2PcInstance aChar = (L2PcInstance) character;
  341. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC1))
  342. {
  343. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE)
  344. {
  345. int[] loc = Config.SPAWN_LOC[Rnd.get(Config.SPAWN_LOC.length)];
  346. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  347. }
  348. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO2)
  349. {
  350. int[] loc = Config.SPAWN_LOC2[Rnd.get(Config.SPAWN_LOC2.length)];
  351. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  352. }
  353. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO3)
  354. {
  355. int[] loc = Config.SPAWN_LOC3[Rnd.get(Config.SPAWN_LOC3.length)];
  356. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  357. }
  358. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO4)
  359. {
  360. int[] loc = Config.SPAWN_LOC4[Rnd.get(Config.SPAWN_LOC4.length)];
  361. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  362. }
  363. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO5)
  364. {
  365. int[] loc = Config.SPAWN_LOC5[Rnd.get(Config.SPAWN_LOC5.length)];
  366. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  367. }
  368. else
  369. {
  370. character.setInsideZone(L2Character.ZONE_CHAOTIC1, true);
  371. }
  372. }
  373. }
  374. break;
  375. case CHAOTIC_ZONE_NO2:
  376. if (character instanceof L2PcInstance)
  377. {
  378. L2PcInstance aChar = (L2PcInstance) character;
  379. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC2))
  380. {
  381. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO1)
  382. {
  383. int[] loc = Config.SPAWN_LOC1[Rnd.get(Config.SPAWN_LOC1.length)];
  384. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  385. }
  386. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE)
  387. {
  388. int[] loc = Config.SPAWN_LOC[Rnd.get(Config.SPAWN_LOC.length)];
  389. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  390. }
  391. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO3)
  392. {
  393. int[] loc = Config.SPAWN_LOC3[Rnd.get(Config.SPAWN_LOC3.length)];
  394. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  395. }
  396. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO4)
  397. {
  398. int[] loc = Config.SPAWN_LOC4[Rnd.get(Config.SPAWN_LOC4.length)];
  399. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  400. }
  401. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO5)
  402. {
  403. int[] loc = Config.SPAWN_LOC5[Rnd.get(Config.SPAWN_LOC5.length)];
  404. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  405. }
  406. else
  407. {
  408. character.setInsideZone(L2Character.ZONE_CHAOTIC2, true);
  409. }
  410. }
  411. }
  412. break;
  413. case CHAOTIC_ZONE_NO3:
  414. if (character instanceof L2PcInstance)
  415. {
  416. L2PcInstance aChar = (L2PcInstance) character;
  417. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC3))
  418. {
  419. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO1)
  420. {
  421. int[] loc = Config.SPAWN_LOC1[Rnd.get(Config.SPAWN_LOC1.length)];
  422. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  423. }
  424. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO2)
  425. {
  426. int[] loc = Config.SPAWN_LOC2[Rnd.get(Config.SPAWN_LOC2.length)];
  427. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  428. }
  429. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE)
  430. {
  431. int[] loc = Config.SPAWN_LOC[Rnd.get(Config.SPAWN_LOC.length)];
  432. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  433. }
  434. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO4)
  435. {
  436. int[] loc = Config.SPAWN_LOC4[Rnd.get(Config.SPAWN_LOC4.length)];
  437. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  438. }
  439. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO5)
  440. {
  441. int[] loc = Config.SPAWN_LOC5[Rnd.get(Config.SPAWN_LOC5.length)];
  442. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  443. }
  444. else
  445. {
  446. character.setInsideZone(L2Character.ZONE_CHAOTIC3, true);
  447. }
  448. }
  449. }
  450. break;
  451. case CHAOTIC_ZONE_NO4:
  452. if (character instanceof L2PcInstance)
  453. {
  454. L2PcInstance aChar = (L2PcInstance) character;
  455. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC4))
  456. {
  457. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO1)
  458. {
  459. int[] loc = Config.SPAWN_LOC1[Rnd.get(Config.SPAWN_LOC1.length)];
  460. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  461. }
  462. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO2)
  463. {
  464. int[] loc = Config.SPAWN_LOC2[Rnd.get(Config.SPAWN_LOC2.length)];
  465. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  466. }
  467. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO3)
  468. {
  469. int[] loc = Config.SPAWN_LOC3[Rnd.get(Config.SPAWN_LOC3.length)];
  470. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  471. }
  472. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE)
  473. {
  474. int[] loc = Config.SPAWN_LOC[Rnd.get(Config.SPAWN_LOC.length)];
  475. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  476. }
  477. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO5)
  478. {
  479. int[] loc = Config.SPAWN_LOC5[Rnd.get(Config.SPAWN_LOC5.length)];
  480. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  481. }
  482. else
  483. {
  484. character.setInsideZone(L2Character.ZONE_CHAOTIC4, true);
  485. }
  486. }
  487. }
  488. break;
  489. case CHAOTIC_ZONE_NO5:
  490. if (character instanceof L2PcInstance)
  491. {
  492. L2PcInstance aChar = (L2PcInstance) character;
  493. if (aChar.isInsideZone(L2Character.ZONE_CHAOTIC5))
  494. {
  495. if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO1)
  496. {
  497. int[] loc = Config.SPAWN_LOC1[Rnd.get(Config.SPAWN_LOC1.length)];
  498. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  499. }
  500. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO2)
  501. {
  502. int[] loc = Config.SPAWN_LOC2[Rnd.get(Config.SPAWN_LOC2.length)];
  503. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  504. }
  505. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO3)
  506. {
  507. int[] loc = Config.SPAWN_LOC3[Rnd.get(Config.SPAWN_LOC3.length)];
  508. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  509. }
  510. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE_NO4)
  511. {
  512. int[] loc = Config.SPAWN_LOC4[Rnd.get(Config.SPAWN_LOC4.length)];
  513. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  514. }
  515. else if (ChaoticZone.currentMap == Map.CHAOTIC_ZONE)
  516. {
  517. int[] loc = Config.SPAWN_LOC[Rnd.get(Config.SPAWN_LOC.length)];
  518. aChar.teleToLocation(loc[0] + Rnd.get(-100, 200), loc[1] + Rnd.get(-100, 200), loc[2]);
  519. }
  520. else
  521. {
  522. character.setInsideZone(L2Character.ZONE_CHAOTIC5, true);
  523. }
  524. }
  525. }
  526. break;
  527. }
  528. }
  529.  
  530. @Override
  531. protected void onExit(final L2Character character)
  532. {
  533. character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);
  534. character.setInsideZone(L2Character.ZONE_CHAOTIC, false);
  535. character.setInsideZone(L2Character.ZONE_CHAOTIC1, false);
  536. character.setInsideZone(L2Character.ZONE_CHAOTIC2, false);
  537. character.setInsideZone(L2Character.ZONE_CHAOTIC3, false);
  538. character.setInsideZone(L2Character.ZONE_CHAOTIC4, false);
  539. character.setInsideZone(L2Character.ZONE_CHAOTIC5, false);
  540. }
  541.  
  542. @Override
  543. protected void onDieInside(final L2Character character)
  544. {
  545.  
  546. }
  547.  
  548. static void heal(L2PcInstance activeChar)
  549. {
  550.  
  551. }
  552.  
  553. @Override
  554. protected void onReviveInside(final L2Character character)
  555. {
  556. onEnter(character);
  557. }
  558.  
  559. /**
  560. * @return
  561. */
  562. public static int getInstance()
  563. {
  564.  
  565. return 0;
  566. }
  567. }
  568. -----------------------------
  569. Config.java
  570. -----------------------------
  571. public static int[][] SPAWN_LOC;
  572. public static int[][] SPAWN_LOC1;
  573. public static int[][] SPAWN_LOC2;
  574. public static int[][] SPAWN_LOC3;
  575. public static int[][] SPAWN_LOC4;
  576. public static int[][] SPAWN_LOC5;
  577.  
  578. public static void ChaoticConfig()
  579. {
  580. final String CZoneConfig = "./config/fun/L2ChaoticZone.properties";
  581. try
  582. {
  583. final Properties Chaotic = new Properties();
  584. final InputStream is = new FileInputStream(new File(CZoneConfig));
  585. Chaotic.load(is);
  586. is.close();
  587.  
  588. SPAWN_LOC = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  589. SPAWN_LOC1 = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  590. SPAWN_LOC2 = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  591. SPAWN_LOC3 = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  592. SPAWN_LOC4 = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  593. SPAWN_LOC5 = ChaoticSpawn(Chaotic.getProperty("SpawnLoc", "150111,144740,-12248"));
  594.  
  595. }
  596. catch (final Exception e)
  597. {
  598. e.printStackTrace();
  599. throw new Error("Failed to Load " + CZoneConfig + " File.");
  600. }
  601. }
  602.  
  603. private static int[][] ChaoticSpawn(String line)
  604. {
  605. final String[] propertySplit = line.split(";");
  606. if (propertySplit.length == 0)
  607. return null;
  608.  
  609. int i = 0;
  610. String[] valueSplit;
  611. final int[][] result = new int[propertySplit.length][];
  612. for (String value : propertySplit)
  613. {
  614. valueSplit = value.split(",");
  615. if (valueSplit.length != 3)
  616. {
  617. return null;
  618. }
  619.  
  620. result[i] = new int[3];
  621. try
  622. {
  623. result[i][0] = Integer.parseInt(valueSplit[0]);
  624. }
  625. catch (NumberFormatException e)
  626. {
  627. return null;
  628. }
  629. try
  630. {
  631. result[i][1] = Integer.parseInt(valueSplit[1]);
  632. }
  633. catch (NumberFormatException e)
  634. {
  635. return null;
  636. }
  637. try
  638. {
  639. result[i][2] = Integer.parseInt(valueSplit[2]);
  640. }
  641. catch (NumberFormatException e)
  642. {
  643. return null;
  644. }
  645. i++;
  646. }
  647. return result;
  648. }
  649.  
  650. inside here
  651. public static void load()
  652. {
  653. if (ServerType.serverMode == ServerType.MODE_GAMESERVER)
  654. {
  655. put this
  656. //L2jLuna Dev.
  657. ChaoticConfig();
  658.  
  659. ---------------------------------------
  660. L2Chatacter.java
  661. ---------------------------------------
  662. find this
  663. ZONE_NOSTORE
  664. and put this after
  665. public static final int ZONE_CHAOTIC = 67230; // The id from zone 1
  666. public static final int ZONE_CHAOTIC1 = 67231; // The id from zone 2
  667. public static final int ZONE_CHAOTIC2 = 67232; // The id from zone 3
  668. public static final int ZONE_CHAOTIC3 = 67233; // The id from zone 4
  669. public static final int ZONE_CHAOTIC4 = 67234; // The id from zone 5
  670. public static final int ZONE_CHAOTIC5 = 67235; // The id from zone 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement