panther75

RimKamaloka

Nov 26th, 2022 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: dist/game/data/scripts/instances/RimKamaloka/32484.htm
  2. ===================================================================
  3. --- dist/game/data/scripts/instances/RimKamaloka/32484.htm  (nonexistent)
  4. +++ dist/game/data/scripts/instances/RimKamaloka/32484.htm  (working copy)
  5. @@ -0,0 +1,5 @@
  6. +<html><body>Pathfinder Worker:<br>
  7. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  8. +<a Action="bypass -h npc_%objectId%_Chat 3">Ask about Rim Kamaloka</a> <br>
  9. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Delusion Chamber.</a>
  10. +</body></html>
  11. \ No newline at end of file
  12. Index: dist/game/data/scripts/instances/RimKamaloka/32485.htm
  13. ===================================================================
  14. --- dist/game/data/scripts/instances/RimKamaloka/32485.htm  (nonexistent)
  15. +++ dist/game/data/scripts/instances/RimKamaloka/32485.htm  (working copy)
  16. @@ -0,0 +1,7 @@
  17. +<html><body>Pathfinder Worker:<br>
  18. +Battle is over!<br>
  19. +To you it seems strange that I appeared in you sleep? Don't warry! We, Pathfinders, are trained many skills, which heer occurs. I simply controlled your thoughts...<br>
  20. +I shall describe to you, what you reached, and I shall help to get out from here.<br>
  21. +With to know you results?<br>
  22. +<a action="bypass -h npc_%objectId%_Quest RimKamaloka">view results.</a>
  23. +</body></html>
  24. \ No newline at end of file
  25. Index: dist/game/data/scripts/instances/RimKamaloka/Dion.htm
  26. ===================================================================
  27. --- dist/game/data/scripts/instances/RimKamaloka/Dion.htm   (nonexistent)
  28. +++ dist/game/data/scripts/instances/RimKamaloka/Dion.htm   (working copy)
  29. @@ -0,0 +1,9 @@
  30. +<html><body>Pathfinder Worker:<br>
  31. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  32. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  33. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  34. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  35. +<a action="bypass -h Quest RimKamaloka 0">Enter Hall of Abyss (20~30 levels)</a><br>
  36. +<a action="bypass -h Quest RimKamaloka 1">Enter Hall of Abyss (25~35 levels)</a><br>
  37. +<a action="bypass -h Quest RimKamaloka 2">Enter Hall of Abyss (30~40 levels)</a>
  38. +</body></html>
  39. \ No newline at end of file
  40. Index: dist/game/data/scripts/instances/RimKamaloka/Gludio.htm
  41. ===================================================================
  42. --- dist/game/data/scripts/instances/RimKamaloka/Gludio.htm (nonexistent)
  43. +++ dist/game/data/scripts/instances/RimKamaloka/Gludio.htm (working copy)
  44. @@ -0,0 +1,8 @@
  45. +<html><body>Pathfinder Worker:<br>
  46. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  47. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  48. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  49. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  50. +<a action="bypass -h Quest RimKamaloka 0">Enter Hall of Abyss (20~30 levels)</a><br>
  51. +<a action="bypass -h Quest RimKamaloka 1">Enter Hall of Abyss (25~35 levels)</a>
  52. +</body></html>
  53. \ No newline at end of file
  54. Index: dist/game/data/scripts/instances/RimKamaloka/GradeA.htm
  55. ===================================================================
  56. --- dist/game/data/scripts/instances/RimKamaloka/GradeA.htm (nonexistent)
  57. +++ dist/game/data/scripts/instances/RimKamaloka/GradeA.htm (working copy)
  58. @@ -0,0 +1,9 @@
  59. +<html><body>Pathfinder Worker:<br>
  60. +Your result: %count%<br>
  61. +<center>Rank A</center><br>
  62. +It is magnificent. You strongly lowered the rate of the intrusion through Kamaloka.<br>
  63. +As in any other battle, the main thing to protect itself, when you inside the Environments of Kamaloka. We they must not attack rash.<br>
  64. +We, pathfinders, prepared reward for those, who it reached the impressive results, in order to in following time they could carry out task still better.<br>
  65. +You do want to obtain the reward, which corresponds to your level?<br>
  66. +<a action="bypass -h Quest RimKamaloka Reward">Obtain the reward.</a>
  67. +</body></html>
  68. \ No newline at end of file
  69. Index: dist/game/data/scripts/instances/RimKamaloka/GradeB.htm
  70. ===================================================================
  71. --- dist/game/data/scripts/instances/RimKamaloka/GradeB.htm (nonexistent)
  72. +++ dist/game/data/scripts/instances/RimKamaloka/GradeB.htm (working copy)
  73. @@ -0,0 +1,9 @@
  74. +<html><body>Pathfinder Worker:<br>
  75. +Your result: %count%<br>
  76. +<center>Rank B</center><br>
  77. +Very well. Your experience will help other to the finders of adventures.<br>
  78. +Battle with Kanabions is deliberately weaker you.. You they are assured, it is worthwhile to enter precisely thus? We, pathfinders, consider that this is the simply waste of time.<br>
  79. +We, pathfinders, prepared reward for those, who it reached the impressive results, in order to in following time they could carry out task still better.<br>
  80. +You do want to obtain the reward, which corresponds to your level?<br>
  81. +<a action="bypass -h Quest RimKamaloka Reward">Obtain the reward.</a>
  82. +</body></html>
  83. \ No newline at end of file
  84. Index: dist/game/data/scripts/instances/RimKamaloka/GradeC.htm
  85. ===================================================================
  86. --- dist/game/data/scripts/instances/RimKamaloka/GradeC.htm (nonexistent)
  87. +++ dist/game/data/scripts/instances/RimKamaloka/GradeC.htm (working copy)
  88. @@ -0,0 +1,9 @@
  89. +<html><body>Pathfinder Worker:<br>
  90. +Your result: %count%<br>
  91. +<center>Rank C</center><br>
  92. +Good work. If the remaining finders adventures will show such results, this it will return to us hope.<br>
  93. +It cannot be always rely on the aid of others. Sometimes for you it is necessary to act independently.<br>
  94. +We, pathfinders, prepared reward for those, who it reached the impressive results, in order to in following time they could carry out task still better.<br>
  95. +You do want to obtain the reward, which corresponds to your level?<br>
  96. +<a action="bypass -h Quest RimKamaloka Reward">Obtain the reward.</a>
  97. +</body></html>
  98. \ No newline at end of file
  99. Index: dist/game/data/scripts/instances/RimKamaloka/GradeD.htm
  100. ===================================================================
  101. --- dist/game/data/scripts/instances/RimKamaloka/GradeD.htm (nonexistent)
  102. +++ dist/game/data/scripts/instances/RimKamaloka/GradeD.htm (working copy)
  103. @@ -0,0 +1,9 @@
  104. +<html><body>Pathfinder Worker:<br>
  105. +Your result: %count%<br>
  106. +<center>Rank D</center><br>
  107. +This is poor result.<br>
  108. +Me you seemed you will be better.<br>
  109. +We, pathfinders, prepared reward for those, who it reached the impressive results, in order to in following time they could carry out task still better.<br>
  110. +Do you want to obtain the reward, which corresponds to your level?<br>
  111. +<a action="bypass -h Quest RimKamaloka Reward">Obtain the reward.</a>
  112. +</body></html>
  113. \ No newline at end of file
  114. Index: dist/game/data/scripts/instances/RimKamaloka/GradeF.htm
  115. ===================================================================
  116. --- dist/game/data/scripts/instances/RimKamaloka/GradeF.htm (nonexistent)
  117. +++ dist/game/data/scripts/instances/RimKamaloka/GradeF.htm (working copy)
  118. @@ -0,0 +1,8 @@
  119. +<html><body>Pathfinder Worker:<br>
  120. +Your result: %count%<br>
  121. +Here's your reward.<br>
  122. +We were able to collect some essences Kanabionov. Here, hold.<br>
  123. +We are in the chronology of your activities. If you want, we will tell you how effective the activities around Kamaloka, and who made the biggest contribution to our common cause.<br>
  124. +First, leave the area.<br>
  125. +<a Action="bypass -h Quest RimKamaloka Exit">Exit.</a>
  126. +</body></html>
  127. \ No newline at end of file
  128. Index: dist/game/data/scripts/instances/RimKamaloka/GradeS.htm
  129. ===================================================================
  130. --- dist/game/data/scripts/instances/RimKamaloka/GradeS.htm (nonexistent)
  131. +++ dist/game/data/scripts/instances/RimKamaloka/GradeS.htm (working copy)
  132. @@ -0,0 +1,9 @@
  133. +<html><body>Pathfinder Worker:<br>
  134. +Your result: %count%<br>
  135. +<center>Rank S</center><br>
  136. +This... These are the great reaching, is worthy of the heroes legends!<br>
  137. +I see, you understood the essence of our matter and it is wonderful they managed the task assigned to you.<br>
  138. +We, pathfinders, prepared reward for those, who it reached the impressive results, in order to in following time they could carry out task still better.<br>
  139. +You do want to obtain the reward, which corresponds to your level?<br>
  140. +<a action="bypass -h Quest RimKamaloka Reward">Obtain the reward.</a>
  141. +</body></html>
  142. \ No newline at end of file
  143. Index: dist/game/data/scripts/instances/RimKamaloka/Heine.htm
  144. ===================================================================
  145. --- dist/game/data/scripts/instances/RimKamaloka/Heine.htm  (nonexistent)
  146. +++ dist/game/data/scripts/instances/RimKamaloka/Heine.htm  (working copy)
  147. @@ -0,0 +1,9 @@
  148. +<html><body>Pathfinder Worker:<br>
  149. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  150. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  151. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  152. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  153. +<a action="bypass -h Quest RimKamaloka 2">Enter Hall of Abyss (30~40 levels)</a><br>
  154. +<a action="bypass -h Quest RimKamaloka 3">Enter Hall of Abyss (35~45 levels)</a><br>
  155. +<a action="bypass -h Quest RimKamaloka 4">Enter Hall of Abyss (40~50 levels)</a>
  156. +</body></html>
  157. \ No newline at end of file
  158. Index: dist/game/data/scripts/instances/RimKamaloka/Innadril.htm
  159. ===================================================================
  160. --- dist/game/data/scripts/instances/RimKamaloka/Innadril.htm   (nonexistent)
  161. +++ dist/game/data/scripts/instances/RimKamaloka/Innadril.htm   (working copy)
  162. @@ -0,0 +1,9 @@
  163. +<html><body>Pathfinder Worker:<br>
  164. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  165. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  166. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  167. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  168. +<a action="bypass -h Quest RimKamaloka 2">Enter Hall of Abyss (30~40 levels)</a><br>
  169. +<a action="bypass -h Quest RimKamaloka 3">Enter Hall of Abyss (35~45 levels)</a><br>
  170. +<a action="bypass -h Quest RimKamaloka 4">Enter Hall of Abyss (40~50 levels)</a>
  171. +</body></html>
  172. Index: dist/game/data/scripts/instances/RimKamaloka/Oren.htm
  173. ===================================================================
  174. --- dist/game/data/scripts/instances/RimKamaloka/Oren.htm   (nonexistent)
  175. +++ dist/game/data/scripts/instances/RimKamaloka/Oren.htm   (working copy)
  176. @@ -0,0 +1,10 @@
  177. +<html><body>Pathfinder Worker:<br>
  178. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  179. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  180. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  181. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  182. +<a action="bypass -h Quest RimKamaloka 3">Enter Hall of Abyss (35~45 levels)</a><br>
  183. +<a action="bypass -h Quest RimKamaloka 4">Enter Hall of Abyss (40~50 levels)</a><br>
  184. +<a action="bypass -h Quest RimKamaloka 5">Enter Hall of Abyss (45~55 levels)</a><br>
  185. +<a action="bypass -h Quest RimKamaloka 6">Enter Hall of Abyss (50~60 levels)</a>
  186. +</body></html>
  187. \ No newline at end of file
  188. Index: dist/game/data/scripts/instances/RimKamaloka/Rewarded.htm
  189. ===================================================================
  190. --- dist/game/data/scripts/instances/RimKamaloka/Rewarded.htm   (nonexistent)
  191. +++ dist/game/data/scripts/instances/RimKamaloka/Rewarded.htm   (working copy)
  192. @@ -0,0 +1,7 @@
  193. +<html><body>Pathfinder Worker:<br>
  194. +Here is your reward.<br>
  195. +We succeeded in gathering a little the essences devastated by you Kanabions. Here, you hold.<br>
  196. +We conduct the chronology of your activity. If you want, we will describe to you, to what extent is effective activity in the Environments of Kamaloka, and who made the largest contribution to our common work.<br>
  197. +First leave this place.<br>
  198. +<a action="bypass -h Quest RimKamaloka Exit">Exit.</a>
  199. +</body></html>
  200. \ No newline at end of file
  201. Index: dist/game/data/scripts/instances/RimKamaloka/RimKamaloka.java
  202. ===================================================================
  203. --- dist/game/data/scripts/instances/RimKamaloka/RimKamaloka.java   (nonexistent)
  204. +++ dist/game/data/scripts/instances/RimKamaloka/RimKamaloka.java   (working copy)
  205. @@ -0,0 +1,1122 @@
  206. +/*
  207. + * Copyright (C) 2004-2019 L2J DataPack
  208. + *
  209. + * This file is part of L2J DataPack.
  210. + *
  211. + * L2J DataPack is free software: you can redistribute it and/or modify
  212. + * it under the terms of the GNU General Public License as published by
  213. + * the Free Software Foundation, either version 3 of the License, or
  214. + * (at your option) any later version.
  215. + *
  216. + * L2J DataPack is distributed in the hope that it will be useful,
  217. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  218. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  219. + * General Public License for more details.
  220. + *
  221. + * You should have received a copy of the GNU General Public License
  222. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  223. + */
  224. +package instances.RimKamaloka;
  225. +
  226. +import java.util.ArrayList;
  227. +import java.util.Calendar;
  228. +import java.util.HashMap;
  229. +import java.util.List;
  230. +import java.util.Map;
  231. +import java.util.concurrent.ScheduledFuture;
  232. +import java.util.logging.Logger;
  233. +
  234. +import org.l2jmobius.commons.threads.ThreadPool;
  235. +import org.l2jmobius.commons.util.Rnd;
  236. +import org.l2jmobius.gameserver.ai.CtrlIntention;
  237. +import org.l2jmobius.gameserver.data.xml.NpcData;
  238. +import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
  239. +import org.l2jmobius.gameserver.instancemanager.InstanceManager;
  240. +import org.l2jmobius.gameserver.model.Location;
  241. +import org.l2jmobius.gameserver.model.Party;
  242. +import org.l2jmobius.gameserver.model.Spawn;
  243. +import org.l2jmobius.gameserver.model.World;
  244. +import org.l2jmobius.gameserver.model.actor.Attackable;
  245. +import org.l2jmobius.gameserver.model.actor.Npc;
  246. +import org.l2jmobius.gameserver.model.actor.Player;
  247. +import org.l2jmobius.gameserver.model.actor.instance.Monster;
  248. +import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
  249. +import org.l2jmobius.gameserver.model.instancezone.Instance;
  250. +import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
  251. +import org.l2jmobius.gameserver.network.SystemMessageId;
  252. +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
  253. +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
  254. +
  255. +import instances.AbstractInstance;
  256. +
  257. +//@formatter:off
  258. +/**
  259. + * Instance Rim Pailaka.
  260. + * @author MaGa, GuruGel
  261. + * Instance level 80-85 is doesn't work because is not supported by the client.
  262. + */
  263. +public class RimKamaloka extends AbstractInstance
  264. +{
  265. +   private static final Logger _log = Logger.getLogger(RimKamaloka.class.getName());
  266. +   /*
  267. +    * Reset time for all Rimkamaloka Default: 6:30AM on server time
  268. +    */
  269. +   private static final int RESET_HOUR = 6;
  270. +   private static final int RESET_MIN = 30;
  271. +  
  272. +   // NPC
  273. +   private static final int START_NPC = 32484;
  274. +   private static final int REWARDER = 32485;
  275. +  
  276. +   /*
  277. +    * Duration of the instance, minutes
  278. +    */
  279. +   private static final int DURATION = 20;
  280. +  
  281. +   /*
  282. +    * Time after which instance without players will be destroyed Default: 5 minutes
  283. +    */
  284. +   private static final int EMPTY_DESTROY_TIME = 5;
  285. +  
  286. +   /*
  287. +    * Time to destroy instance (and eject player away) Default: 5 minutes
  288. +    */
  289. +   private static final int EXIT_TIME = 5;
  290. +  
  291. +   /*
  292. +    * Maximum level difference between players level and kamaloka level Default: 5
  293. +    */
  294. +   private static final int MAX_LEVEL_DIFFERENCE = 5;
  295. +  
  296. +   private static final int RESPAWN_DELAY = 10;
  297. +  
  298. +   private static final int DESPAWN_DELAY = 10000;
  299. +  
  300. +   /*
  301. +    * Hardcoded instance ids for kamaloka
  302. +    */
  303. +   private static final int[] TEMPLATE_IDS =
  304. +   {
  305. +       46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56
  306. +   };
  307. +  
  308. +   /*
  309. +    * Level of the kamaloka
  310. +    */
  311. +   private static final int[] LEVEL =
  312. +   {
  313. +       25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80
  314. +   };
  315. +  
  316. +   /*
  317. +    * Teleport points into instances x, y, z
  318. +    */
  319. +   private static final Location[] TELEPORTS =
  320. +   {
  321. +       new Location(9264, -220641, -8032), // 25 (Town of Gludio, Town of Dion)
  322. +       new Location(16436, -220654, -8032), // 30 (Town of Gludio, Town of Dion)
  323. +       new Location(23486, -220839, -7808), // 35 (Town of Dion, Heine)
  324. +       new Location(9307, -213681, -7808), // 40 (Heine, Town of Oren)
  325. +       new Location(16603, -213720, -7808), // 45 (Heine, Town of Oren)
  326. +       new Location(23651, -213584, -8016), // 50 (Town of Oren, Town of Schuttgart)
  327. +       new Location(9134, -206264, -8016), // 55 (Town of Oren, Town of Schuttgart)
  328. +       new Location(16505, -206244, -8016), // 60 (Rune Township, Town of Schuttgart)
  329. +       new Location(23246, -206950, -8000), // 65 (Rune Township, Town of Schuttgart)
  330. +       new Location(42423, -220443, -8768), // 70 (Rune Township)
  331. +       new Location(49050, -220440, -8768), // 75 (Rune Township)
  332. +       new Location(49050, -220440, -8768) // 80 (Rune Township)
  333. +   };
  334. +  
  335. +   private static final int[][] KANABIONS =
  336. +   {
  337. +       {22452,22453,22454}, // 25
  338. +       {22455,22456,22457}, // 30
  339. +       {22458,22459,22460}, // 35
  340. +       {22461,22462,22463}, // 40
  341. +       {22464,22465,22466}, // 45
  342. +       {22467,22468,22469}, // 50
  343. +       {22470,22471,22472}, // 55
  344. +       {22473,22474,22475}, // 60
  345. +       {22476,22477,22478}, // 65
  346. +       {22479,22480,22481}, // 70
  347. +       {22482,22483,22484}, // 75
  348. +       {2081, 2082, 2083} //80
  349. +   };
  350. +  
  351. +   private static final int[][][] SPAWNLIST =
  352. +   {
  353. +       {// 25 level
  354. +           { 8971, -219546, -8021 },
  355. +           { 9318, -219644, -8021 },
  356. +           { 9266, -220208, -8021 },
  357. +           { 9497, -220054, -8024 }
  358. +       },
  359. +       {// 30 level
  360. +           { 16107, -219574, -8021 },
  361. +           { 16769, -219885, -8021 },
  362. +           { 16363, -220219, -8021 },
  363. +           { 16610, -219523, -8021 }
  364. +       },
  365. +       {// 35 level
  366. +           { 23019, -219730, -7803 },
  367. +           { 23351, -220455, -7803 },
  368. +           { 23900, -219864, -7803 },
  369. +           { 23851, -220294, -7803 }
  370. +       },
  371. +       {// 40 level
  372. +           { 9514, -212478, -7803 },
  373. +           { 9236, -213348, -7803 },
  374. +           { 8868, -212683, -7803 },
  375. +           { 9719, -213042, -7803 }
  376. +       },
  377. +       {// 45 level
  378. +           { 16925, -212811, -7803 },
  379. +           { 16885, -213199, -7802 },
  380. +           { 16487, -213339, -7803 },
  381. +           { 16337, -212529, -7803 }
  382. +       },
  383. +       {// 50 level
  384. +           { 23958, -213282, -8009 },
  385. +           { 23292, -212782, -8012 },
  386. +           { 23844, -212781, -8009 },
  387. +           { 23533, -213301, -8009 }
  388. +       },
  389. +       {// 55 level
  390. +           { 8828, -205518, -8009 },
  391. +           { 8895, -205989, -8009 },
  392. +           { 9398, -205967, -8009 },
  393. +           { 9393, -205409, -8009 }
  394. +       },
  395. +       {// 60 level
  396. +           { 16185, -205472, -8009 },
  397. +           { 16808, -205929, -8009 },
  398. +           { 16324, -206042, -8009 },
  399. +           { 16782, -205454, -8009 }
  400. +       },
  401. +       {// 65 level
  402. +           { 23476, -206310, -7991 },
  403. +           { 23230, -205861, -7991 },
  404. +           { 22644, -205888, -7994 },
  405. +           { 23078, -206714, -7991 }
  406. +       },
  407. +       {// 70 level
  408. +           { 42981, -219308, -8759 },
  409. +           { 42320, -220160, -8759 },
  410. +           { 42434, -219181, -8759 },
  411. +           { 42101, -219550, -8759 },
  412. +           { 41859, -220236, -8759 },
  413. +           { 42881, -219942, -8759 }
  414. +       },
  415. +       {// 75 level
  416. +           { 48770, -219304, -8759 },
  417. +           { 49036, -220190, -8759 },
  418. +           { 49363, -219814, -8759 },
  419. +           { 49393, -219102, -8759 },
  420. +           { 49618, -220490, -8759 },
  421. +           { 48526, -220493, -8759 }
  422. +       },
  423. +       {// 80 level
  424. +           { 48770, -219304, -8759 },
  425. +           { 49036, -220190, -8759 },
  426. +           { 49363, -219814, -8759 },
  427. +           { 49393, -219102, -8759 },
  428. +           { 49618, -220490, -8759 },
  429. +           { 48526, -220493, -8759 }
  430. +       }
  431. +   };
  432. +  
  433. +   public static final int[][] REWARDERS =
  434. +   {
  435. +       {9252,-219908,-8032},// 25 level
  436. +       {16419,-219934,-8032},// 30 level
  437. +       {23479,-220080,-7808},// 35 level
  438. +       {9296,-212995,-7808},// 40 level
  439. +       {16594,-212997,-7808},// 45 level
  440. +       {23655,-213043,-8016},// 50 level
  441. +       {9137,-205732,-8016},// 55 level
  442. +       {16510,-205735,-8016},// 60 level
  443. +       {23244,-206317,-8000},// 65 level
  444. +       {42429,-219785,-8768},// 70 level
  445. +       {49052,-219762,-8768},// 75 level
  446. +       {49052, -219762, -8768}// 80 level
  447. +   };
  448. +  
  449. +   private static final int[][][] REWARDS =
  450. +   {
  451. +       { // 20-30
  452. +           null,
  453. +           {13002,6,12824,1},
  454. +           {13002,12,10836,1},
  455. +           {13002,19,10837,1},
  456. +           {13002,26,10838,1},
  457. +           {13002,32,10844,1}},
  458. +       { // 25-35
  459. +           null,
  460. +           {13002,6,12825,1},
  461. +           {13002,12,10837,1},
  462. +           {13002,19,10838,1},
  463. +           {13002,26,10841,1},
  464. +           {13002,32,12827,1}},
  465. +       { // 30-40
  466. +           null,
  467. +           {13002,6,10840,1},
  468. +           {13002,12,10841,1},
  469. +           {13002,19,10842,1},
  470. +           {13002,26,10843,1},
  471. +           {13002,32,10844,1}},
  472. +       { // 35-45
  473. +           null,
  474. +           {13002,6,12826,1},
  475. +           {13002,12,10842,1},
  476. +           {13002,19,10843,1},
  477. +           {13002,26,10846,1},
  478. +           {13002,32,10829,1}},
  479. +       { // 40-50
  480. +           null,
  481. +           {13002,6,10845,1},
  482. +           {13002,12,10846,1},
  483. +           {13002,19,10847,1},
  484. +           {13002,26,10848,1},
  485. +           {13002,32,10849,1}},
  486. +       { // 45-55
  487. +           null,
  488. +           {13002,6,12828,1},
  489. +           {13002,12,10847,1},
  490. +           {13002,19,10848,1},
  491. +           {13002,26,10851,1},
  492. +           {13002,32,10831,1}},
  493. +       { // 50-60
  494. +           null,
  495. +           {13002,6,10850,1},
  496. +           {13002,12,10851,1},
  497. +           {13002,19,10852,1},
  498. +           {13002,26,10853,1},
  499. +           {13002,32,10854,1}},
  500. +       { // 55-65
  501. +           null,
  502. +           {13002,6,12830,1},
  503. +           {13002,12,10852,1},
  504. +           {13002,19,10853,1},
  505. +           {13002,26,10856,1},
  506. +           {13002,32,10833,1}},
  507. +       { // 60-70
  508. +           null,
  509. +           {13002,6,12855,1},
  510. +           {13002,12,10856,1},
  511. +           {13002,19,10857,1},
  512. +           {13002,26,10858,1},
  513. +           {13002,32,10859,1}},
  514. +       { // 65-75
  515. +           null,
  516. +           {13002,6,12832,1},
  517. +           {13002,12,10857,1},
  518. +           {13002,19,10858,1},
  519. +           {13002,26,10861,1},
  520. +           {13002,32,12834,1}},
  521. +       { // 70-80
  522. +           null,
  523. +           {13002,6,10860,1},
  524. +           {13002,12,10861,1},
  525. +           {13002,19,10862,1},
  526. +           {13002,26,10864,1},
  527. +           {13002,32,10865,1}},
  528. +       { // 80-85
  529. +           null,
  530. +           {13002,6,10864,1},
  531. +           {13002,12,10865,1},
  532. +           {13002,19,10865,1},
  533. +           {13002,26,10865,1},
  534. +           {13002,32,10865,1}}
  535. +   };
  536. +  
  537. +   private class RimKamaWorld extends InstanceWorld
  538. +   {
  539. +       public int index;
  540. +       public int KANABION;
  541. +       public int DOPPLER;
  542. +       public int VOIDER;
  543. +      
  544. +       public int kanabionsCount = 0;
  545. +       public int dopplersCount = 0;
  546. +       public int voidersCount = 0;
  547. +       public int grade = 0;
  548. +       public boolean isFinished = false;
  549. +       public boolean isRewarded = false;
  550. +      
  551. +       public ScheduledFuture<?> finishTask = null;
  552. +      
  553. +       public List<Monster> spawnedMobs = new ArrayList<>();
  554. +       public Map<Integer, Long> lastAttack = new HashMap<>();
  555. +       public ScheduledFuture<?> despawnTask = null;
  556. +   }
  557. +  
  558. +   private RimKamaloka()
  559. +   {
  560. +       addStartNpc(START_NPC);
  561. +       addFirstTalkId(START_NPC);
  562. +       addFirstTalkId(REWARDER);
  563. +       addTalkId(START_NPC);
  564. +       addTalkId(REWARDER);
  565. +      
  566. +       for (int[] list : KANABIONS)
  567. +       {
  568. +           addFactionCallId(list[0]);
  569. +           for (int mob : list)
  570. +           {
  571. +               addAttackId(mob);
  572. +               addKillId(mob);
  573. +           }
  574. +       }
  575. +       LOGGER.info("RimKamaloka: is load");
  576. +   }
  577. +  
  578. +   /**
  579. +    * Check if party with player as leader allowed to enter
  580. +    * @param player party leader
  581. +    * @param index (0-17) index of the kamaloka in arrays
  582. +    * @return true if party allowed to enter
  583. +    */
  584. +   protected boolean checkConditions(Player player, int index)
  585. +   {
  586. +       final Party party = player.getParty();
  587. +       // player must not be in party
  588. +       if (party != null)
  589. +       {
  590. +           player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
  591. +           return false;
  592. +       }
  593. +      
  594. +       // get level of the instance
  595. +       final int level = LEVEL[index];
  596. +       // and client name
  597. +       final String instanceName = InstanceManager.getInstance().getInstanceIdName(TEMPLATE_IDS[index]);
  598. +      
  599. +       // player level must be in range
  600. +       if (Math.abs(player.getLevel() - level) > MAX_LEVEL_DIFFERENCE)
  601. +       {
  602. +           SystemMessage sm = new SystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
  603. +           sm.addPcName(player);
  604. +           player.sendPacket(sm);
  605. +           return false;
  606. +       }
  607. +       // get instances reenter times for player
  608. +       final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player.getObjectId());
  609. +       if (instanceTimes != null)
  610. +       {
  611. +           for (int id : instanceTimes.keySet())
  612. +           {
  613. +               // find instance with same name (kamaloka or labyrinth)
  614. +               if (!instanceName.equals(InstanceManager.getInstance().getInstanceIdName(id)))
  615. +               {
  616. +                   continue;
  617. +               }
  618. +               // if found instance still can't be reentered - exit
  619. +               if (System.currentTimeMillis() < instanceTimes.get(id))
  620. +               {
  621. +                   SystemMessage sm = new SystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
  622. +                   sm.addPcName(player);
  623. +                   player.sendPacket(sm);
  624. +                   return false;
  625. +               }
  626. +           }
  627. +       }
  628. +       return true;
  629. +   }
  630. +  
  631. +   /**
  632. +    * Handling enter of the players into kamaloka
  633. +    * @param player party leader
  634. +    * @param index (0-17) kamaloka index in arrays
  635. +    */
  636. +   @Override
  637. +   protected synchronized final void enterInstance(Player player, int index)
  638. +   {
  639. +       int templateId;
  640. +       try
  641. +       {
  642. +           templateId = TEMPLATE_IDS[index];
  643. +       }
  644. +       catch (ArrayIndexOutOfBoundsException e)
  645. +       {
  646. +           LOGGER.warning("Problem with RimKamaloka: " + e.getMessage());
  647. +           return;
  648. +       }
  649. +      
  650. +       // check for existing instances for this player
  651. +       InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  652. +       // player already in the instance
  653. +       if (world != null)
  654. +       {
  655. +           // but not in kamaloka
  656. +           if (!(world instanceof RimKamaWorld) || (world.getTemplateId() != templateId))
  657. +           {
  658. +               player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
  659. +               return;
  660. +           }
  661. +           // check for level difference again on reenter
  662. +           if (Math.abs(player.getLevel() - LEVEL[((RimKamaWorld) world).index]) > MAX_LEVEL_DIFFERENCE)
  663. +           {
  664. +               SystemMessage sm = new SystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
  665. +               sm.addPcName(player);
  666. +               player.sendPacket(sm);
  667. +               return;
  668. +           }
  669. +           // check what instance still exist
  670. +           Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
  671. +           if (inst != null)
  672. +           {
  673. +               teleportPlayer(player, TELEPORTS[index], world.getInstanceId());
  674. +           }
  675. +       }
  676. +       // Creating new RimKamaloka instance
  677. +       if (!checkConditions(player, index))
  678. +       {
  679. +           return;
  680. +       }
  681. +      
  682. +       // Creating new instanceWorld, using our instanceId and templateId
  683. +       world = new RimKamaWorld();
  684. +       final Instance instance = InstanceManager.getInstance().createDynamicInstance(templateId);
  685. +       world.setInstance(instance);
  686. +      
  687. +       // set return location
  688. +       instance.setExitLoc(new Location(player));
  689. +       // disable summon friend into instance
  690. +       instance.setAllowSummon(false);
  691. +       // set duration and empty destroy time
  692. +       instance.setDuration(DURATION * 60000);
  693. +       instance.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
  694. +      
  695. +       // set index for easy access to the arrays
  696. +       ((RimKamaWorld) world).index = index;
  697. +       InstanceManager.getInstance().addWorld(world);
  698. +       // spawn npcs
  699. +       spawnKama((RimKamaWorld) world);
  700. +       // Task
  701. +       ((RimKamaWorld) world).finishTask = ThreadPool.schedule(new FinishTask((RimKamaWorld) world), DURATION * 60000);
  702. +       ((RimKamaWorld) world).despawnTask = ThreadPool.scheduleAtFixedRate(new DespawnTask((RimKamaWorld) world), 1000, 1000);
  703. +      
  704. +       InstanceManager.getInstance().addWorld(world);
  705. +      
  706. +       teleportPlayer(player, TELEPORTS[index], world.getInstanceId());
  707. +   }
  708. +  
  709. +   /**
  710. +    * Spawn all NPCs in kamaloka
  711. +    * @param world instanceWorld
  712. +    */
  713. +   private static final void spawnKama(RimKamaWorld world)
  714. +   {
  715. +       int[][] spawnlist;
  716. +       final int index = world.index;
  717. +       world.KANABION = KANABIONS[index][0];
  718. +       world.DOPPLER = KANABIONS[index][1];
  719. +       world.VOIDER = KANABIONS[index][2];
  720. +      
  721. +       try
  722. +       {
  723. +           final NpcTemplate mob1 = NpcData.getInstance().getTemplate(world.KANABION);
  724. +          
  725. +           spawnlist = SPAWNLIST[index];
  726. +           final int length = spawnlist.length;
  727. +          
  728. +           Spawn spawn;
  729. +           for (int i = 0; i < length; i++)
  730. +           {
  731. +               final int[] loc = spawnlist[i];
  732. +               spawn = new Spawn(mob1);
  733. +               spawn.setInstanceId(world.getInstanceId());
  734. +               spawn.setXYZ(loc[0], loc[1], loc[2]);
  735. +               spawn.setHeading(-1);
  736. +               spawn.setRespawnDelay(Rnd.get(RESPAWN_DELAY, 5));
  737. +               spawn.setAmount(1);
  738. +               spawn.startRespawn();
  739. +               spawn.doSpawn();
  740. +           }
  741. +       }
  742. +       catch (Exception e)
  743. +       {
  744. +           _log.warning("RimKamaloka: error during spawn: ");
  745. +       }
  746. +   }
  747. +  
  748. +   private static final void spawnNextMob(RimKamaWorld world, Npc oldNpc, int npcId, Player player)
  749. +   {
  750. +       if (world.isFinished)
  751. +       {
  752. +           return;
  753. +       }
  754. +      
  755. +       Monster monster = null;
  756. +       if (!world.spawnedMobs.isEmpty())
  757. +       {
  758. +           for (Monster mob : world.spawnedMobs)
  759. +           {
  760. +               if ((mob == null) || !mob.isDecayed() || (mob.getId() != npcId))
  761. +               {
  762. +                   continue;
  763. +               }
  764. +               mob.setDecayed(false);
  765. +               mob.setDead(false);
  766. +               mob.overhitEnabled(false);
  767. +               mob.refreshId();
  768. +               monster = mob;
  769. +               break;
  770. +           }
  771. +       }
  772. +      
  773. +       if (monster == null)
  774. +       {
  775. +           final NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
  776. +           monster = new Monster(template);
  777. +           world.spawnedMobs.add(monster);
  778. +       }
  779. +      
  780. +       synchronized (world.lastAttack)
  781. +       {
  782. +           world.lastAttack.put(monster.getObjectId(), System.currentTimeMillis());
  783. +       }
  784. +      
  785. +       monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp());
  786. +       monster.setHeading(oldNpc.getHeading());
  787. +       monster.setInstanceId(oldNpc.getInstanceId());
  788. +       monster.spawnMe(oldNpc.getX(), oldNpc.getY(), oldNpc.getZ() + 20);
  789. +       monster.setRunning();
  790. +       monster.addDamageHate(player, 0, 9999);
  791. +       monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
  792. +   }
  793. +  
  794. +   private synchronized final void rewardPlayer(RimKamaWorld world, Npc npc)
  795. +   {
  796. +       final Instance instance = InstanceManager.getInstance().getInstance(world.getInstanceId());
  797. +       if (!world.isFinished || world.isRewarded)
  798. +       {
  799. +           return;
  800. +       }
  801. +       world.isRewarded = true;
  802. +
  803. +       final int[][] allRewards = REWARDS[world.index];
  804. +       world.grade = Math.min(world.grade, allRewards.length);
  805. +       final int[] reward = allRewards[world.grade];
  806. +       if (reward == null)
  807. +       {
  808. +           return;
  809. +       }
  810. +       for (int objectId : instance.getPlayers())
  811. +       {
  812. +           Player player = World.getInstance().getPlayer(objectId);
  813. +               if ((player != null) && player.isOnline())
  814. +           {
  815. +               player.sendMessage("Grade:"+world.grade);
  816. +               for (int i = 0; i < reward.length; i+=2)
  817. +               {
  818. +                   player.addItem("Reward", reward[i], reward[i+1], npc, true);
  819. +               }
  820. +           }
  821. +       }
  822. +   }
  823. +  
  824. +   class LockTask implements Runnable
  825. +   {
  826. +       private final RimKamaWorld _world;
  827. +      
  828. +       LockTask(RimKamaWorld world)
  829. +       {
  830. +           _world = world;
  831. +       }
  832. +      
  833. +       @Override
  834. +       public void run()
  835. +       {
  836. +           if (_world != null)
  837. +           {
  838. +               Calendar reenter = Calendar.getInstance();
  839. +               reenter.set(Calendar.MINUTE, RESET_MIN);
  840. +               // if time is >= RESET_HOUR - roll to the next day
  841. +               if (reenter.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR)
  842. +               {
  843. +                   reenter.roll(Calendar.DATE, true);
  844. +               }
  845. +               reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  846. +              
  847. +               SystemMessage sm = new SystemMessage(SystemMessageId.INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
  848. +               sm.addString(InstanceManager.getInstance().getInstanceIdName(_world.getTemplateId()));
  849. +              
  850. +               // set instance reenter time for all allowed players
  851. +               boolean found = false;
  852. +               for (Player plr : _world.getAllowed())
  853. +               {
  854. +                   if (plr != null)
  855. +                   {
  856. +                       InstanceManager.getInstance().setInstanceTime(plr.getObjectId(), _world.getTemplateId(), reenter.getTimeInMillis());
  857. +                       if (plr.isOnline())
  858. +                       {
  859. +                           plr.sendPacket(sm);
  860. +                       }
  861. +                   }
  862. +               }
  863. +               if (!found)
  864. +               {
  865. +                   _world.isFinished = true;
  866. +                   _world.spawnedMobs.clear();
  867. +                   _world.lastAttack.clear();
  868. +                   if (_world.finishTask != null)
  869. +                   {
  870. +                       _world.finishTask.cancel(false);
  871. +                       _world.finishTask = null;
  872. +                   }
  873. +                   if (_world.despawnTask != null)
  874. +                   {
  875. +                       _world.despawnTask.cancel(false);
  876. +                       _world.despawnTask = null;
  877. +                   }
  878. +                  
  879. +                   InstanceManager.getInstance().destroyInstance(_world.getInstanceId());
  880. +               }
  881. +           }
  882. +       }
  883. +   }
  884. +  
  885. +   class FinishTask implements Runnable
  886. +   {  
  887. +       private final RimKamaWorld _world;
  888. +      
  889. +       FinishTask(RimKamaWorld world)
  890. +       {
  891. +           _world = world;
  892. +       }
  893. +      
  894. +       @Override
  895. +       public void run()
  896. +       {
  897. +           if (_world != null)
  898. +           {
  899. +               _world.isFinished = true;
  900. +               if (_world.despawnTask != null)
  901. +               {
  902. +                   _world.despawnTask.cancel(false);
  903. +                   _world.despawnTask = null;
  904. +               }
  905. +               _world.spawnedMobs.clear();
  906. +               _world.lastAttack.clear();
  907. +               // destroy instance after EXIT_TIME
  908. +               final Instance inst = InstanceManager.getInstance().getInstance(_world.getInstanceId());
  909. +               if (inst != null)
  910. +               {
  911. +                   inst.removeNpcs();
  912. +                   inst.setDuration(EXIT_TIME * 60000);
  913. +                   if (inst.getPlayers().isEmpty())
  914. +                   {
  915. +                       inst.setDuration(EMPTY_DESTROY_TIME * 60000);
  916. +                   }
  917. +                   else
  918. +                   {
  919. +                       inst.setDuration(EXIT_TIME * 60000);
  920. +                       inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
  921. +                   }
  922. +               }
  923. +              
  924. +               // calculate reward
  925. +                if ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) < 20)
  926. +               {
  927. +                   _world.grade = 0;
  928. +               }
  929. +               else if (((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) > 20) && ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) < 40))
  930. +               {
  931. +                   _world.grade = 1;
  932. +               }
  933. +               else if (((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) > 40) && ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) < 50))
  934. +               {
  935. +                   _world.grade = 2;
  936. +               }
  937. +               else if (((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) > 50) && ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) < 100))
  938. +               {
  939. +                   _world.grade = 3;
  940. +               }
  941. +               else if (((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) > 100) && ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) < 200))
  942. +               {
  943. +                   _world.grade = 4;
  944. +               }
  945. +               else if ((_world.kanabionsCount + _world.dopplersCount + _world.voidersCount) > 200)
  946. +               {
  947. +                   _world.grade = 5;
  948. +               }
  949. +              
  950. +               final int index = _world.index;
  951. +               // spawn rewarder npc
  952. +               addSpawn(REWARDER, REWARDERS[index][0], REWARDERS[index][1], REWARDERS[index][2], 0, false, 0, false, _world.getInstanceId());
  953. +           }
  954. +       }
  955. +   }
  956. +  
  957. +   class DespawnTask implements Runnable
  958. +   {
  959. +       private final RimKamaWorld _world;
  960. +      
  961. +       DespawnTask(RimKamaWorld world)
  962. +       {
  963. +           _world = world;
  964. +       }
  965. +      
  966. +       @Override
  967. +       public void run()
  968. +       {
  969. +           if ((_world != null) && !_world.isFinished && !_world.lastAttack.isEmpty() && !_world.spawnedMobs.isEmpty())
  970. +           {
  971. +               final long time = System.currentTimeMillis();
  972. +               for (Monster mob : _world.spawnedMobs)
  973. +               {
  974. +                   if ((mob == null) || mob.isDead())
  975. +                   {
  976. +                       continue;
  977. +                   }
  978. +                   if (_world.lastAttack.containsKey(mob.getObjectId()) && ((time - _world.lastAttack.get(mob.getObjectId())) > DESPAWN_DELAY))
  979. +                   {
  980. +                       mob.deleteMe();
  981. +                       synchronized (_world.lastAttack)
  982. +                       {
  983. +                           _world.lastAttack.remove(mob.getObjectId());
  984. +                       }
  985. +                   }
  986. +               }
  987. +           }
  988. +       }
  989. +   }
  990. +  
  991. +   @Override
  992. +   public final String onAdvEvent(String event, Npc npc, Player player)
  993. +   {
  994. +       if ((npc == null) || (player == null))
  995. +       {
  996. +           return null;
  997. +       }
  998. +
  999. +       if (event.equalsIgnoreCase("Exit"))
  1000. +       {
  1001. +           final InstanceWorld inst = InstanceManager.getInstance().getWorld(player);
  1002. +           if (inst instanceof RimKamaWorld)
  1003. +           {
  1004. +               final RimKamaWorld world = ((RimKamaWorld) inst);
  1005. +               Instance inst1 = InstanceManager.getInstance().getInstance(world.getInstanceId());
  1006. +               world.removeAllowed(player);
  1007. +               teleportPlayer(player, inst1.getExitLoc(), 0);
  1008. +           }
  1009. +       }
  1010. +       else if (event.equalsIgnoreCase("Reward"))
  1011. +       {
  1012. +           try
  1013. +           {
  1014. +               final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  1015. +               if ((world instanceof RimKamaWorld) && world.isAllowed(player))
  1016. +               {
  1017. +                   rewardPlayer((RimKamaWorld)world, npc);
  1018. +               }
  1019. +           }
  1020. +           catch (Exception e)
  1021. +           {
  1022. +               _log.warning("RimKamaloka: problem with reward: ");
  1023. +           }
  1024. +           return "Rewarded.htm";
  1025. +       }
  1026. +       else if (event.equalsIgnoreCase("Winner"))
  1027. +       {
  1028. +           final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
  1029. +          
  1030. +           packet.setHtml(getHtm(player, "Winner.htm"));
  1031. +          
  1032. +           if(GlobalVariablesManager.getInstance().getInt(player.getName() + "_") < 50)
  1033. +           {
  1034. +               packet.replace("%name%", GlobalVariablesManager.getInstance().getString(player.getName()));
  1035. +               packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1036. +           }
  1037. +           else
  1038. +           {
  1039. +               packet.replace("%name%","No winner");
  1040. +               packet.replace("%count%","No winner");
  1041. +           }
  1042. +           if(GlobalVariablesManager.getInstance().getInt(player.getName() + "_") >= 200)
  1043. +           {
  1044. +               packet.replace("%name1%", GlobalVariablesManager.getInstance().getString(player.getName()));
  1045. +           }
  1046. +           else
  1047. +           {
  1048. +               packet.replace("%name1%","No winner");
  1049. +               packet.replace("%count1%","No winner");
  1050. +           }
  1051. +           if((GlobalVariablesManager.getInstance().getInt(player.getName() + "_") >= 100) && (GlobalVariablesManager.getInstance().getInt(player.getName() + "_") <= 200))
  1052. +           {
  1053. +               packet.replace("%name2%", GlobalVariablesManager.getInstance().getString(player.getName()));
  1054. +           }
  1055. +           else
  1056. +           {
  1057. +               packet.replace("%name2%","No winner");
  1058. +               packet.replace("%count2%","No winner");
  1059. +           }
  1060. +           if((GlobalVariablesManager.getInstance().getInt(player.getName() + "_") >= 50)  && (GlobalVariablesManager.getInstance().getInt(player.getName() + "_") < 100))
  1061. +           {
  1062. +               packet.replace("%name3%", GlobalVariablesManager.getInstance().getString(player.getName()));
  1063. +               packet.replace("%count3%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1064. +           }
  1065. +           else
  1066. +           {
  1067. +               packet.replace("%name3%","No winner");
  1068. +               packet.replace("%count3%","No winner");
  1069. +           }
  1070. +
  1071. +           player.sendPacket(packet);
  1072. +       }
  1073. +
  1074. +       try
  1075. +       {
  1076. +           enterInstance(player, Integer.parseInt(event));
  1077. +       }
  1078. +       catch (Exception e)
  1079. +       {
  1080. +       }
  1081. +       return null;
  1082. +   }
  1083. +  
  1084. +   @Override
  1085. +   public final String onFactionCall(Npc npc, Npc caller, Player attacker, boolean isPet)
  1086. +   {
  1087. +       if ((npc == null) || (caller == null))
  1088. +       {
  1089. +           return null;
  1090. +       }
  1091. +
  1092. +       if (npc.getId() == caller.getId())
  1093. +       {
  1094. +           return null;
  1095. +       }
  1096. +
  1097. +       return super.onFactionCall(npc, caller, attacker, isPet);
  1098. +   }
  1099. +  
  1100. +   @Override
  1101. +   public final String onTalk(Npc npc, Player player)
  1102. +   {
  1103. +       if (npc == null)
  1104. +       {
  1105. +           return null;
  1106. +       }
  1107. +       if ((npc.getId() == START_NPC) && !player.hasPremiumStatus())
  1108. +       {
  1109. +           return "noPC.htm";
  1110. +       }
  1111. +      
  1112. +       if (npc.getId() == START_NPC)
  1113. +       {
  1114. +           return npc.getCastle().getName() + ".htm";
  1115. +       }
  1116. +       else if (npc.getId() == REWARDER)
  1117. +       {
  1118. +           final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  1119. +           if (tmpWorld instanceof RimKamaWorld)
  1120. +           {
  1121. +               final RimKamaWorld world = (RimKamaWorld) tmpWorld;
  1122. +               if (!world.isFinished)
  1123. +               {
  1124. +                   return "";
  1125. +               }
  1126. +               final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
  1127. +               switch (world.grade)
  1128. +               {
  1129. +                   case 0:
  1130. +                       packet.setHtml(getHtm(player, "GradeF.htm"));
  1131. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1132. +                   case 1:
  1133. +                       packet.setHtml(getHtm(player, "GradeD.htm"));
  1134. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1135. +                   case 2:
  1136. +                       packet.setHtml(getHtm(player, "GradeC.htm"));
  1137. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1138. +                   case 3:
  1139. +                       packet.setHtml(getHtm(player, "GradeB.htm"));
  1140. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1141. +                   case 4:
  1142. +                       packet.setHtml(getHtm(player, "GradeA.htm"));
  1143. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1144. +                   case 5:
  1145. +                       packet.setHtml(getHtm(player, "GradeS.htm"));
  1146. +                       packet.replace("%count%", GlobalVariablesManager.getInstance().getInt(player.getName() + "_"));
  1147. +               }
  1148. +               player.sendPacket(packet);
  1149. +           }
  1150. +       }
  1151. +      
  1152. +       return null;
  1153. +   }
  1154. +  
  1155. +   @Override
  1156. +   public final String onFirstTalk(Npc npc, Player player)
  1157. +   {
  1158. +       return String.valueOf(npc.getId()) + ".htm";
  1159. +   }
  1160. +  
  1161. +   @Override
  1162. +   public final String onAttack(Npc npc, Player attacker, int damage, boolean isPet)
  1163. +   {
  1164. +       if ((npc == null) || (attacker == null))
  1165. +       {
  1166. +           return null;
  1167. +       }
  1168. +      
  1169. +       final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  1170. +       if (tmpWorld instanceof RimKamaWorld)
  1171. +       {
  1172. +           final RimKamaWorld world = (RimKamaWorld) tmpWorld;
  1173. +           synchronized (world.lastAttack)
  1174. +           {
  1175. +               world.lastAttack.put(npc.getObjectId(), System.currentTimeMillis());
  1176. +           }
  1177. +          
  1178. +           final int maxHp = npc.getMaxHp();
  1179. +           if (npc.getCurrentHp() == maxHp)
  1180. +           {
  1181. +               if (((damage * 100) / maxHp) > 40)
  1182. +               {
  1183. +                   final int npcId = npc.getId();
  1184. +                   final int chance = Rnd.get(100);
  1185. +                   int nextId = 0;
  1186. +                  
  1187. +                   if (npcId == world.KANABION)
  1188. +                   {
  1189. +                       if (chance < 10)
  1190. +                       {
  1191. +                           nextId = world.DOPPLER;
  1192. +                       }
  1193. +                   }
  1194. +                   else if (npcId == world.DOPPLER)
  1195. +                   {
  1196. +                       if (chance < 10)
  1197. +                       {
  1198. +                           nextId = world.DOPPLER;
  1199. +                       }
  1200. +                       else if (chance < 15)
  1201. +                       {
  1202. +                           nextId = world.VOIDER;
  1203. +                       }
  1204. +                   }
  1205. +                   else if (npcId == world.VOIDER)
  1206. +                   {
  1207. +                       if (chance < 10)
  1208. +                       {
  1209. +                           nextId = world.VOIDER;
  1210. +                       }
  1211. +                   }
  1212. +                  
  1213. +                   if (nextId > 0)
  1214. +                   {
  1215. +                       spawnNextMob(world, npc, nextId, attacker);
  1216. +                   }
  1217. +               }
  1218. +           }
  1219. +       }
  1220. +      
  1221. +       return super.onAttack(npc, attacker, damage, isPet);
  1222. +   }
  1223. +  
  1224. +   @Override
  1225. +   public final String onKill(Npc npc, Player player, boolean isPet)
  1226. +   {
  1227. +       if ((npc == null) || (player == null))
  1228. +       {
  1229. +           return null;
  1230. +       }
  1231. +      
  1232. +       final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  1233. +       if (tmpWorld instanceof RimKamaWorld)
  1234. +       {
  1235. +           final RimKamaWorld world = (RimKamaWorld) tmpWorld;
  1236. +           synchronized (world.lastAttack)
  1237. +           {
  1238. +               world.lastAttack.remove(npc.getObjectId());
  1239. +           }
  1240. +          
  1241. +           final int npcId = npc.getId();
  1242. +           final int chance = Rnd.get(100);
  1243. +           int nextId = 0;
  1244. +          
  1245. +           if (npcId == world.KANABION)
  1246. +           {
  1247. +               world.kanabionsCount++;
  1248. +               if (((Attackable) npc).isOverhit())
  1249. +               {
  1250. +                   if (chance < 30)
  1251. +                   {
  1252. +                       nextId = world.DOPPLER;
  1253. +                   }
  1254. +                   else if (chance < 40)
  1255. +                   {
  1256. +                       nextId = world.VOIDER;
  1257. +                   }
  1258. +               }
  1259. +               else if (chance < 15)
  1260. +               {
  1261. +                   nextId = world.DOPPLER;
  1262. +               }
  1263. +           }
  1264. +           else if (npcId == world.DOPPLER)
  1265. +           {
  1266. +               world.dopplersCount++;
  1267. +               if (((Attackable) npc).isOverhit())
  1268. +               {
  1269. +                   if (chance < 30)
  1270. +                   {
  1271. +                       nextId = world.DOPPLER;
  1272. +                   }
  1273. +                   else if (chance < 60)
  1274. +                   {
  1275. +                       nextId = world.VOIDER;
  1276. +                   }
  1277. +               }
  1278. +               else
  1279. +               {
  1280. +                   if (chance < 10)
  1281. +                   {
  1282. +                       nextId = world.DOPPLER;
  1283. +                   }
  1284. +                   else if (chance < 20)
  1285. +                   {
  1286. +                       nextId = world.VOIDER;
  1287. +                   }
  1288. +               }
  1289. +           }
  1290. +           else if (npcId == world.VOIDER)
  1291. +           {
  1292. +               world.voidersCount++;
  1293. +               if (((Attackable) npc).isOverhit())
  1294. +               {
  1295. +                   if (chance < 50)
  1296. +                   {
  1297. +                       nextId = world.VOIDER;
  1298. +                   }
  1299. +               }
  1300. +               else if (chance < 20)
  1301. +               {
  1302. +                   nextId = world.VOIDER;
  1303. +               }
  1304. +           }
  1305. +          
  1306. +           if (nextId > 0)
  1307. +           {
  1308. +               spawnNextMob(world, npc, nextId, player);
  1309. +           }
  1310. +           GlobalVariablesManager.getInstance().set(player.getName(), player.getName());
  1311. +           GlobalVariablesManager.getInstance().set(player.getName() + "_", world.voidersCount + world.dopplersCount + world.kanabionsCount);
  1312. +       }
  1313. +      
  1314. +       return super.onKill(npc, player, isPet);
  1315. +   }
  1316. +  
  1317. +   @Override
  1318. +   public void onEnterInstance(Player player, InstanceWorld world, boolean firstEntrance)
  1319. +   {
  1320. +       // Managed by script.
  1321. +   }
  1322. +  
  1323. +   public static void main(String[] args)
  1324. +   {
  1325. +       new RimKamaloka();
  1326. +   }
  1327. +}
  1328. \ No newline at end of file
  1329. Index: dist/game/data/scripts/instances/RimKamaloka/Rune.htm
  1330. ===================================================================
  1331. --- dist/game/data/scripts/instances/RimKamaloka/Rune.htm   (nonexistent)
  1332. +++ dist/game/data/scripts/instances/RimKamaloka/Rune.htm   (working copy)
  1333. @@ -0,0 +1,11 @@
  1334. +<html><body>Pathfinder Worker:<br>
  1335. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  1336. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  1337. +They are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  1338. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  1339. +<a action="bypass -h Quest RimKamaloka 7">Enter Hall of Abyss (55~65 levels)</a><br>
  1340. +<a action="bypass -h Quest RimKamaloka 8">Enter Hall of Abyss  (60~70 levels)</a><br>
  1341. +<a action="bypass -h Quest RimKamaloka 9">Enter Hall of Abyss  (65~75 levels)</a><br>
  1342. +<a action="bypass -h Quest RimKamaloka 10">Enter Hall of Abyss (70~80 levels)</a><br>
  1343. +<a action="bypass -h Quest RimKamaloka 11">Enter Hall of Abyss (80~85 levels)</a>
  1344. +</body></html>
  1345. \ No newline at end of file
  1346. Index: dist/game/data/scripts/instances/RimKamaloka/Schuttgart.htm
  1347. ===================================================================
  1348. --- dist/game/data/scripts/instances/RimKamaloka/Schuttgart.htm (nonexistent)
  1349. +++ dist/game/data/scripts/instances/RimKamaloka/Schuttgart.htm (working copy)
  1350. @@ -0,0 +1,10 @@
  1351. +<html><body>Pathfinder Worker:<br>
  1352. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  1353. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  1354. +hey are this is what the Environment of Kamaloka. After the visit of the peace of dreams you you will not be able again to enter into it to the complete the restoration of soul. Know this.<br>
  1355. +(In the Environment of Kamaloka it is possible to enter <font color="LEVEL">only once a day</font>.)<br>
  1356. +<a action="bypass -h Quest RimKamaloka 5">Enter Hall of Abyss (45~55 levels)</a><br>
  1357. +<a action="bypass -h Quest RimKamaloka 6">Enter Hall of Abyss (50~60 levels)</a><br>
  1358. +<a action="bypass -h Quest RimKamaloka 7">Enter Hall of Abyss (55~65 levels)</a><br>
  1359. +<a action="bypass -h Quest RimKamaloka 8">Enter Hall of Abyss (60~70 levels)</a>
  1360. +</body></html>
  1361. \ No newline at end of file
  1362. Index: dist/game/data/scripts/instances/RimKamaloka/Winner.htm
  1363. ===================================================================
  1364. --- dist/game/data/scripts/instances/RimKamaloka/Winner.htm (nonexistent)
  1365. +++ dist/game/data/scripts/instances/RimKamaloka/Winner.htm (working copy)
  1366. @@ -0,0 +1,8 @@
  1367. +<html><body>Pathfinder Worker:<br>
  1368. +Do you want to view the names of the adventurers who accomplished great things in battle against Rim Kamaloka<font color="LEVEL"> today</font>? If your name is among them, you are elegible to receive a special Blessing.<br>
  1369. +<font color="LEVEL">Pathfinder Savior</font>          %name1%<br><br>
  1370. +<font color="LEVEL">Pathfinder Supporter</font>          %name2%.<br>
  1371. +<center> %name3%          %count3%<br>
  1372. +        %name%          %count%<br>
  1373. +(These records are reset every day. It may take some time for updates to be posted.)
  1374. +</body></html>
  1375. \ No newline at end of file
  1376. Index: dist/game/data/scripts/instances/RimKamaloka/noPC.htm
  1377. ===================================================================
  1378. --- dist/game/data/scripts/instances/RimKamaloka/noPC.htm   (nonexistent)
  1379. +++ dist/game/data/scripts/instances/RimKamaloka/noPC.htm   (working copy)
  1380. @@ -0,0 +1,8 @@
  1381. +<html><body>Pathfinder Worker:<br>
  1382. +We Pathfinders were dispatched by the Ivory Tower to defend dreams against attack. We have been waiting for an adventurer like you!<br>
  1383. +<a action="bypass -h npc_%objectId%_Chat 1">Ask about the Chamber of Delusion.</a><br>
  1384. +Only those who have already experienced dreams may enter the Rim Kamaloka. The dream of which I speak is that of the Darkness that seeks to destroy.<br>
  1385. +If you have had that dream, a trace of it -- the "Piece of Dream" -- will have been left on your soul. Based on that trace, we can guide adventurers to the Rim Kamaloka.<br>
  1386. +However...I sense no such trace in you...<br>
  1387. +(You may only enter the Rim Kamaloka from a PC Cafe.)
  1388. +</body></html>
  1389. \ No newline at end of file
  1390.  
Tags: RimKamaloka
Advertisement
Add Comment
Please, Sign In to add comment