Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.10 KB | None | 0 0
  1. define DUNGEON_MAN 20397
  2. define ENTRY_MAN 20395
  3. define DUNGEON_MAP_INDEX 225
  4. define ENTER_LIMIT_TIME 60
  5. define ENTRY_MAP_INDEX 61
  6. define FINAL_BOSS 6191
  7. --define LEVEL2_FAKEKEY 30303
  8. define LEVEL2_REALKEY 30331 -- Ice Key
  9. define LEVEL2_STONE 20386
  10. define LEVEL4_TARGET 6151
  11. define LEVEL4_TARGET_GROUP 6063
  12. define LEVEL5_REALKEY 30332 -- Three ice seal dismantling
  13. define LEVEL5_STONE 20398 -- Bing Sealing Stone
  14. define LEVEL5_GEN_LIMIT 100
  15. define LEVEL6_TARGET 8058 -- Manastone Bing
  16. define LEVEL7_BOSSMOB 6151
  17. define LEVEL8_REALKEY 30333 --
  18. define LEVEL8_STONE 20386
  19. define LEVEL9_TARGET 20399 --White Dragon grindstone
  20. define MOB_REGEN_FILE_PATH = 'data/dungeon/nemereses/'
  21. define PASS_TICKET 70304
  22.  
  23. quest snow_dungeon begin
  24. state start begin
  25. function setting()
  26. return
  27. {
  28. ['dungeon_entry_pos'] = {5291, 1814},-- Where the first coming in the dungeon
  29. ['DUNGEON_MAN_pos'] = {172,261},
  30. ['TEST_MAN_pos'] = {
  31. {173,278},
  32. {422,261},
  33. {764,264},
  34. {175,535},
  35. {422,538},
  36. {748,540},
  37. {305,708},
  38. {571,701},
  39. {851,693}
  40. },
  41. ['WARP_pos'] = {
  42. {5291,1814},
  43. {5540,1797},
  44. {5882,1800},
  45. {5293,2071},
  46. {5540,2074},
  47. {5866,2076},
  48. {5423,2244},
  49. {5689,2237},
  50. {5969,2229},
  51. {6047,1924}
  52. },
  53. ['LEVEL2_STONE_pos'] = {421,191},
  54. ['LEVEL4_TARGET_pos'] = {171,496},
  55. ['LEVEL5_STONE_pos'] = {
  56. {449, 488},
  57. {455, 445},
  58. {419, 422},
  59. {382, 444},
  60. {389, 488}
  61. },
  62. ['LEVEL6_TARGET_pos'] = {747,494},
  63. ['LEVEL7_BOSSMOB_pos'] = {
  64. {302, 678},
  65. {281, 657},
  66. {303, 635},
  67. {324, 656}
  68. },
  69. ['LEVEL8_STONE_pos'] = {
  70. {570, 650}
  71. },
  72. ['LEVEL9_TARGET_pos'] = {
  73. {849, 660}
  74. },
  75. ['boss_pos'] = {927,333},
  76.  
  77. ['outside_entry_pos'] = {4322,1655} --The position where a kid standing
  78. }
  79. end
  80. function make_dungeon() -- Creating a dungeon
  81. -- 1 party positions
  82. -- 2. Dungeons NPC summon progress
  83. -- 3 Step 1 Set
  84. -- 1 Summon Monster
  85. -- 2 Check the timer setting monster destroyed
  86. local setting = snow_dungeon.setting()
  87. d.new_jump_party(DUNGEON_MAP_INDEX, setting.dungeon_entry_pos[1], setting.dungeon_entry_pos[2])
  88. d.set_item_group ('fd_pass_ticket', 1, PASS_TICKET, 1)
  89. if is_test_server() then
  90. for i = 1,9 do
  91. d.spawn_mob(DUNGEON_MAN, setting.TEST_MAN_pos[i][1] , setting.TEST_MAN_pos[i][2]) -- Test
  92. end
  93. end
  94. d.spawn_mob_ac_dir(DUNGEON_MAN, setting.DUNGEON_MAN_pos[1], setting.DUNGEON_MAN_pos[2], 1)
  95. end
  96. function clear_timer(inx) -- Clear the timer
  97. clear_server_timer ('snow_dungeon_ticket_remove', inx)
  98. clear_server_timer ('snow_dungeon_0m_left_timer', inx)
  99. clear_server_timer ('snow_dungeon_1m_left_timer', inx)
  100. clear_server_timer ('snow_dungeon_5m_left_timer', inx)
  101. clear_server_timer ('snow_dungeon_10m_left_timer', inx)
  102. clear_server_timer ('snow_dungeon_15m_left_timer', inx)
  103. clear_server_timer ('snow_dungeon_30m_left_timer', inx)
  104. clear_server_timer ('snow_dungeon_45m_left_timer', inx)
  105. clear_server_timer ('snow_dungeon_end_timer', inx)
  106. clear_server_timer ('snow_dungeon_level2_start', inx)
  107. clear_server_timer ('snow_dungeon_level3_start', inx)
  108. clear_server_timer ('snow_dungeon_level4_start', inx)
  109. clear_server_timer ('snow_dungeon_level5_start', inx)
  110. clear_server_timer ('snow_dungeon_level6_start', inx)
  111. clear_server_timer ('snow_dungeon_level7_start', inx)
  112. clear_server_timer ('snow_dungeon_level8_start', inx)
  113. clear_server_timer ('snow_dungeon_level9_start', inx)
  114. clear_server_timer ('snow_dungeon_BOSS_start', inx)
  115. clear_server_timer ('snow_dungeon_killed_A_1', inx)
  116. clear_server_timer ('snow_dungeon_killed_A_2', inx)
  117. clear_server_timer ('snow_dungeon_killed_B_1', inx)
  118. clear_server_timer ('snow_dungeon_killed_B_2', inx)
  119. clear_server_timer ('snow_dungeon_leader_out_timer', inx)
  120. end
  121. function set_dungeon_level(lvl)
  122. if lvl == 1 then
  123. d.regen_file (MOB_REGEN_FILE_PATH..'id_1f.txt')
  124. server_timer('snow_dungeon_30m_left_timer', 15*60, get_server_timer_arg())
  125. server_timer ('snow_dungeon_killed_A_1', 6, d.get_map_index())
  126. server_timer ('snow_dungeon_45m_left_timer',15*60, d.get_map_index())
  127.  
  128. -- Pass processes involved
  129. -- Entries thrown out after people for lost tickets using the ticket to remove the timer.
  130. d.say_diff_by_item_group ('fd_pass_ticket', locale.snow_dungeon.say_2, locale.snow_dungeon.say_3)
  131. server_timer ('snow_dungeon_ticket_remove', 5, d.get_map_index())
  132.  
  133. -- Dungeon party and stores information about each other.
  134. party.setf('dungeon_index', d.get_map_index())
  135. d.setf('party_leader_pid', party.get_leader_pid())
  136. return
  137. end
  138.  
  139. if lvl == 10 then
  140. local setting = snow_dungeon.setting()
  141. d.setf('level',10)
  142. d.jump_all(setting.WARP_pos[10][1],setting.WARP_pos[10][2])
  143. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_boss.txt')
  144. d.spawn_mob(FINAL_BOSS,setting.boss_pos[1],setting.boss_pos[2])
  145. d.notice(locale.snow_dungeon.say_46)
  146. return
  147. end
  148. server_timer('snow_dungeon_level'..lvl..'_start',1,d.get_map_index())
  149. end
  150.  
  151. function is_snowd(idx) -- White Dragon ensure that gender
  152. return idx >= DUNGEON_MAP_INDEX * 10000 and idx < (DUNGEON_MAP_INDEX + 1) *10000
  153. end
  154. function level_clear() -- Level awoke, the Regent clear, clear area
  155. d.clear_regen()
  156. d.purge_area(520000,155000,612000,228600) -- Map the entire -- d.purge() Consider using
  157. end
  158. when login begin
  159. -- 1 if the command pops coming out of the dungeon.
  160. -- 2 in the normal way if you entered the dungeon
  161. -- 1. Dungeon before proceeding
  162. -- 1 entry timeout
  163. -- 2 pass inspection
  164. -- 3 level check
  165. local idx = pc.get_map_index()
  166. local setting = snow_dungeon.setting()
  167. if idx == DUNGEON_MAP_INDEX and not is_test_server() then -- If the command is entered the dungeon.
  168. notice('Wrong Access')
  169. timer('snow_dungeon_warp_timer', 5)
  170. elseif snow_dungeon.is_snowd(idx) then -- Dungeon position, the boss room admission exception
  171. ------------------------------------------------------------------------------------------------------------------------------------------------------
  172. -- In the following two lines to use on the line when the end of the dungeon again returns to its original position. If you enable the line below us out of the dungeon to dungeon if you quit.
  173. -- If you exit the dungeon again to return to the original position, the need to create a way to get out of the dungeon, so non-oily white dragon is enabled, should try to get out of.
  174. ------------------------------------------------------------------------------------------------------------------------------------------------------
  175. -- pc.set_warp_location(0, 0 , 0) --Make a come back when twinggyeot part
  176. pc.set_warp_location(ENTRY_MAP_INDEX, setting.outside_entry_pos[1] , setting.outside_entry_pos[2]) --And when bouncing out of the dungeon geham
  177.  
  178. if d.getf('dungeon_enter') == 0 then -- Or in progress
  179. if get_global_time() - pc.getf('snow_dungeon','exit_time') < ENTER_LIMIT_TIME * 60 then -- Entry limited time
  180. d.notice(locale.dungeon.time_limit_party)
  181. say(locale.dungeon.time_limit)
  182. timer('snow_dungeon_warp_timer', 5)
  183. elseif pc.count_item(PASS_TICKET) < 1 then -- If you do not have a pass
  184. d.notice(locale.dungeon.no_ticket_party)
  185. say(locale.dungeon.no_ticket)
  186. timer('snow_dungeon_warp_timer', 5)
  187. elseif pc.get_level() < 100 then
  188. d.notice(string.format(locale.dungeon.level_limit_party, 100))
  189. say(string.format(locale.dungeon.level_limit, 100))
  190. timer('snow_dungeon_warp_timer', 5)
  191. end
  192. elseif d.getf('dungeon_enter') == 1 then
  193. chat("logout time = "..d.getf('dungeon_enter_time'))
  194. if get_time() > d.getf('dungeon_enter_time') then
  195. pc.setf('snow_dungeon','exit_time',get_global_time())
  196. return
  197. else
  198. snow_dungeon.set_dungeon_level(d.getf('level'))
  199. chat("dung lvl = "..d.getf('level'))
  200. end
  201. else
  202. if pc.getf('snow_dungeon','ticket_delete') == 0 then -- If the ticket is not cleared, but the progress
  203. -- Log out five minutes off timer party.
  204. if party.is_party() and party.is_leader() then
  205. clear_server_timer ('snow_dungeon_leader_out_timer', idx)
  206. end
  207. pc.remove_item(PASS_TICKET, 1)
  208. pc.setf('snow_dungeon','ticket_delete',1)
  209. end
  210. end
  211. else
  212. pc.setf('snow_dungeon','ticket_delete',0)
  213. end
  214. end
  215. when logout begin
  216. local idx = pc.get_map_index()
  217. if snow_dungeon.is_snowd(idx) then
  218. d.setqf("dungeon_enter_time",get_time()+2*60)
  219.  
  220. if d.getf('dungeon_enter') == 2 then -- Log out of position after a normal dungeon
  221. pc.setf('snow_dungeon','exit_time',get_global_time()) -- Instance, the last time in history, but because of the time limit should not intolerant or just record snapped
  222. end
  223.  
  224. if party.is_leader() then
  225. server_timer ('snow_dungeon_leader_out_timer',5*60, d.get_map_index())
  226. end
  227. end
  228. end
  229. -- Out parts thrown out.
  230. when snow_dungeon_warp_timer.timer begin
  231. local setting = snow_dungeon.setting()
  232. pc.warp(setting.outside_entry_pos[1]*100, setting.outside_entry_pos[2] * 100, ENTRY_MAP_INDEX)
  233. end
  234. -- <<<<Starting Dungeon>>>>
  235. when DUNGEON_MAN.chat.locale.snow_dungeon.say_1 with pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 and d.getf('level') == 0 begin
  236. if party.is_leader() then
  237. -- Related settings in the dungeon progress
  238. d.setf('level',1)
  239. snow_dungeon.set_dungeon_level(1)
  240. else
  241. say(locale.dungeon.leader_can_go)
  242. end
  243. end
  244. -- <A pass is not thrown out functions of the person>
  245. -- Inspect the entry pass bounced off stage, but not before starting the position that I could be a pass.
  246. -- After admission pass for two missing people thrown out at the start of the dungeon.
  247. -- Holding the position before entry if the missing boy malicious intent, so it seems more care is required.
  248. when snow_dungeon_ticket_remove.server_timer begin
  249. if d.select(get_server_timer_arg()) then
  250. d.exit_all_by_item_group('fd_pass_ticket')
  251. d.delete_item_in_item_group_from_all ('fd_pass_ticket')
  252. d.setqf2('snow_dungeon','ticket_delete',1)
  253. d.setf('dungeon_enter',d.getf('dungeon_enter')+1)
  254.  
  255. d.notice(locale.snow_dungeon.say_37)
  256. end
  257. end
  258. when DUNGEON_MAN.chat."Test : Current Status" with is_test_server() and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  259. say("Remain Mob : "..d.count_monster())
  260. say("level : "..d.getf("level"))
  261. say("Dmap index : "..d.get_map_index())
  262. say("Pmap index : "..pc.get_map_index())
  263. say("access limit : "..pc.getf('snow_dungeon','exit_time'))
  264. say("global time : "..get_global_time())
  265. if snow_dungeon.is_snowd(d.get_map_index()) then
  266. say("in dungeon") -- is_snowd ?? ??
  267. end
  268. end
  269. when DUNGEON_MAN.chat."Test : Quit" with is_test_server() and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  270. say("After 10s")
  271. d.notice("After 10s")
  272. server_timer('snow_dungeon_end_timer',10,d.get_map_index())
  273. end
  274. when DUNGEON_MAN.chat."Test : 6th floor" with is_test_server() and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  275. say("10s")
  276. d.notice(locale.snow_dungeon.say_18)
  277. server_timer('snow_dungeon_level6_start',10,d.get_map_index())
  278. d.setf('dungeon_enter',d.getf('dungeon_enter')+1)
  279. end
  280. when DUNGEON_MAN.chat."Test : 9th floor" with is_test_server() and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  281. say("10s")
  282. d.notice(locale.snow_dungeon.say_22)
  283. server_timer('snow_dungeon_level9_start',10,d.get_map_index())
  284. d.setf('dungeon_enter',d.getf('dungeon_enter')+1)
  285. end
  286. when DUNGEON_MAN.chat."Test : Boss" with is_test_server() and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  287. say("BOSS")
  288. d.notice(locale.snow_dungeon.say_4)
  289. server_timer('snow_dungeon_BOSS_start',10,d.get_map_index())
  290. d.setf('dungeon_enter',d.getf('dungeon_enter')+1)
  291. end
  292. --Position
  293. when ENTRY_MAN.chat.locale.snow_dungeon.say_5 with pc.get_map_index() == ENTRY_MAP_INDEX begin
  294. if party.is_party() then
  295. --If you continue to allow re-entry during the dungeon
  296. local party_check = 0
  297. if d.find(party.getf("dungeon_index")) then
  298. party_check = (d.getf_from_map_index("party_leader_pid", party.getf("dungeon_index")) == party.get_leader_pid())
  299. end
  300.  
  301. if d.find(party.getf("dungeon_index")) and party_check then
  302. if get_global_time() - pc.getf("snow_dungeon","exit_time") < 5 * 60 then -- Re not allowed to exceed 5 minutes
  303. local dungeon_level = d.getf_from_map_index("level", party.getf("dungeon_index"))
  304. local setting = snow_dungeon.setting()
  305. pc.warp(setting.WARP_pos[dungeon_level][1] * 100, setting.WARP_pos[dungeon_level][2] * 100, party.getf("dungeon_index"))
  306. else -- Re not allowed to exceed 5 minutes
  307. say(locale.snow_dungeon.say_47)
  308. say(locale.snow_dungeon.say_29)
  309. end
  310. else
  311. if party.is_leader() then
  312. say(locale.snow_dungeon.say_6)
  313. local warp = select(locale.dungeon.enter_yes,locale.dungeon.enter_no)
  314. if warp == 1 then
  315. party.setf("snow_dungeon_boss_kill_count", 0)
  316. snow_dungeon.make_dungeon()
  317. end
  318. else
  319. say(locale.dungeon.leader_can_enter)
  320. end
  321. end
  322.  
  323. else
  324. say(locale.dungeon.party_can_enter)
  325. end
  326. end
  327. when ENTRY_MAN.chat."TEST : Init Access Limit Time" with is_test_server() and pc.get_map_index() == ENTRY_MAP_INDEX begin -- Test
  328. pc.setf('snow_dungeon','exit_time',get_global_time()-1800)
  329. say("Done")
  330. end
  331. when ENTRY_MAN.chat."TEST : Time Info" with is_test_server() and pc.get_map_index() == ENTRY_MAP_INDEX begin -- Test
  332. local exit_time = pc.getf('snow_dungeon', 'exit_time')
  333. exit_time_d = exit_time / (60 * 60 * 24)
  334. exit_time_h = math.mod(exit_time / (60 * 60), 24)
  335. exit_time_m = math.mod(exit_time / 60, 60)
  336.  
  337. local remain_time = (ENTER_LIMIT_TIME * 60) - (get_global_time() - exit_time)
  338. remain_time_m = math.mod(remain_time / 60, 60)
  339. if remain_time_m < 0 then
  340. remain_time_m = 0
  341. end
  342.  
  343. local current_time = get_global_time()
  344. current_time_d = current_time / (60 * 60 * 24)
  345. current_time_h = math.mod(current_time / (60 * 60), 24)
  346. current_time_m = math.mod(current_time / 60, 60)
  347.  
  348. say("<Exit Time>")
  349. say(string.format(" D : %d, HH:MM : %02d:%02d",exit_time_d, exit_time_h,exit_time_m))
  350. say("<Remain Time>")
  351. say(string.format(" M : %d",remain_time_m))
  352. say("<Current Time>")
  353. say(string.format(" D : %d, HH:MM : %02d:%02d",current_time_d,current_time_h,current_time_m))
  354. end
  355. -- <1st floor, 3rd floor, 4th floor, 6th floor>
  356. --Monster annihilation detection timer
  357. when snow_dungeon_killed_A_1.server_timer begin -- Turn timer 1 (level1, level3)
  358. if d.select(get_server_timer_arg()) then
  359. local setting = snow_dungeon.setting()
  360. if d.count_monster() <= 0 then -- Drehen Sie den Timer 2 (1 und 2 zuruck, um abwechselnd)
  361. if d.getf('level') == 1 then
  362. -- d.notice("level 1 clear")
  363. d.notice(locale.snow_dungeon.say_7)
  364. server_timer('snow_dungeon_level2_start',10,d.get_map_index())
  365. elseif d.getf('level') == 3 then
  366. -- d.notice("level 3 clear")
  367. d.notice(locale.snow_dungeon.say_8)
  368. server_timer('snow_dungeon_level4_start',10,d.get_map_index())
  369. elseif d.getf('level') == 4 then
  370. if d.getf('level4_boss_gen') == 0 then
  371. d.setf('level4_boss_gen', 1)
  372. d.spawn_group(LEVEL4_TARGET_GROUP,setting.LEVEL4_TARGET_pos[1],setting.LEVEL4_TARGET_pos[2], 1, true, 1)
  373. d.regen_file (MOB_REGEN_FILE_PATH..'id_4f.txt')
  374. server_timer ('snow_dungeon_killed_A_2', 6, get_server_timer_arg())
  375. elseif d.getf('level4_boss_gen') == 1 then
  376. -- d.notice("level 4 clear")
  377. d.notice(locale.snow_dungeon.say_9)
  378. server_timer('snow_dungeon_level5_start',10,d.get_map_index())
  379. end
  380. elseif d.getf('level') == 6 then
  381. d.notice(locale.snow_dungeon.say_10)
  382. d.spawn_mob(LEVEL6_TARGET,setting.LEVEL6_TARGET_pos[1],setting.LEVEL6_TARGET_pos[2])
  383. end
  384. else
  385. server_timer ('snow_dungeon_killed_A_2', 6, get_server_timer_arg())
  386. end
  387. end
  388. end
  389. when snow_dungeon_killed_A_2.server_timer begin -- Turn the timer 2 (1 and 2 return to alternately)
  390. if d.select(get_server_timer_arg()) then
  391. local setting = snow_dungeon.setting()
  392. if d.count_monster() <= 0 then -- City wiped out one level monsters
  393. if d.getf('level') == 1 then
  394. --d.notice("level 1 clear")
  395. d.notice(locale.snow_dungeon.say_7)
  396. server_timer('snow_dungeon_level2_start',10,d.get_map_index())
  397. elseif d.getf('level') == 3 then
  398. --d.notice("level 3 clear")
  399. d.notice(locale.snow_dungeon.say_8)
  400. server_timer('snow_dungeon_level4_start',10,d.get_map_index())
  401. elseif d.getf('level') == 4 then
  402. if d.getf('level4_boss_gen') == 0 then
  403. d.setf('level4_boss_gen', 1)
  404. d.spawn_group(LEVEL4_TARGET_GROUP,setting.LEVEL4_TARGET_pos[1],setting.LEVEL4_TARGET_pos[2], 1, true, 1)
  405. d.regen_file (MOB_REGEN_FILE_PATH..'id_4f.txt')
  406. server_timer ('snow_dungeon_killed_A_1', 6, get_server_timer_arg())
  407. elseif d.getf('level4_boss_gen') == 1 then
  408. ---- d.notice("level 4 clear")
  409. d.notice(locale.snow_dungeon.say_9)
  410. server_timer('snow_dungeon_level5_start',10,d.get_map_index())
  411. end
  412. elseif d.getf('level') == 6 then
  413. d.notice(locale.snow_dungeon.say_10)
  414. d.spawn_mob(LEVEL6_TARGET,setting.LEVEL6_TARGET_pos[1],setting.LEVEL6_TARGET_pos[2])
  415. end
  416. else
  417. server_timer ('snow_dungeon_killed_A_1', 6, get_server_timer_arg())
  418. end
  419. end
  420. end
  421. -- <2 stories>
  422. -- Condition: sealed off (Key: 30304)
  423. when snow_dungeon_level2_start.server_timer begin
  424. if d.select(get_server_timer_arg()) then
  425. local setting = snow_dungeon.setting()
  426. d.setf('level',2)
  427. d.jump_all(setting.WARP_pos[2][1],setting.WARP_pos[2][2])
  428. --d.spawn_mob(LEVEL2_STONE,setting.LEVEL2_STONE_pos[1],setting.LEVEL2_STONE_pos[2])
  429. --d.regen_file (MOB_REGEN_FILE_PATH..'id_2f.txt')
  430. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_2f.txt')
  431. d.notice(locale.snow_dungeon.say_38)
  432. end
  433. end
  434. when kill with snow_dungeon.is_snowd(pc.get_map_index()) and d.getf('level') == 2 begin -- Sealing Stone Drop 2 level key
  435. local i = number(1, 65) -- 100/1 chance for drop
  436. if i == 1 then
  437. -- local j = number(1,3) -- 1/5 chance to really key
  438. -- if j == 1 then
  439. -- game.drop_item (LEVEL2_REALKEY, 1)
  440. -- else
  441. -- game.drop_item (LEVEL2_FAKEKEY, 1)
  442. -- end
  443. game.drop_item (LEVEL2_REALKEY, 1)
  444. end
  445. end
  446. -- when LEVEL2_STONE.take with snow_dungeon.is_snowd(pc.get_map_index()) and item.vnum == LEVEL2_REALKEY and d.getf('level') == 2 begin -- Ingestion two-level real key
  447. -- item.remove()
  448. -- local j = number(1,3) -- 1/5 chance to really key
  449. -- if j == 1 then
  450. -- npc.purge()
  451. -- d.notice("level 2 clear")
  452. -- snow_dungeon.level_clear()
  453. -- d.notice(locale.snow_dungeon.say_11)
  454. -- server_timer('snow_dungeon_level3_start',10,d.get_map_index())
  455. -- else
  456. -- say(locale.snow_dungeon.say_12)
  457. -- end
  458. -- end
  459. -- when LEVEL2_STONE.take with snow_dungeon.is_snowd(pc.get_map_index()) and item.vnum == LEVEL2_FAKEKEY and d.getf('level') == 2 begin -- Ingestion fake two-level key
  460. -- item.remove()
  461. -- say(locale.snow_dungeon.say_12)
  462. -- end
  463. when LEVEL2_REALKEY.use with d.getf('level') == 2 and snow_dungeon.is_snowd(pc.get_map_index()) begin
  464. if pc.get_job() == 3 then
  465. if d.getf('level2_clear') == 0 then
  466. local j = number(1,5) -- 1/5 chance to really key
  467. if j == 1 then
  468. -- d.notice("level 2 clear")
  469. item.remove()
  470. snow_dungeon.level_clear()
  471. d.notice(locale.snow_dungeon.say_11)
  472. server_timer('snow_dungeon_level3_start',10,d.get_map_index())
  473. d.setf('level2_clear', 1)
  474. else
  475. syschat(locale.snow_dungeon.say_12)
  476. d.notice(locale.snow_dungeon.say_12)
  477. item.remove()
  478. end
  479. end
  480. else
  481. syschat("Nie jesteś Szamanem!")
  482. end
  483. end
  484. -- <3 stories>
  485. -- Condition: monster destroyed areas
  486. when snow_dungeon_level3_start.server_timer begin
  487. if d.select(get_server_timer_arg()) then
  488. local setting = snow_dungeon.setting()
  489. d.setf('level',3)
  490. d.jump_all(setting.WARP_pos[3][1],setting.WARP_pos[3][2])
  491. d.regen_file (MOB_REGEN_FILE_PATH..'id_3f.txt')
  492. server_timer ('snow_dungeon_killed_A_1', 6, d.get_map_index())
  493. d.notice(locale.snow_dungeon.say_37)
  494. end
  495. end
  496. -- <4 Floor>
  497. -- Condition: Target monster to catch X
  498. -- Condition: monster destroyed areas (just as there is a boss)
  499. when snow_dungeon_level4_start.server_timer begin
  500. if d.select(get_server_timer_arg()) then
  501. local setting = snow_dungeon.setting()
  502. d.setf('level',4)
  503. d.jump_all(setting.WARP_pos[4][1],setting.WARP_pos[4][2])
  504. --d.spawn_mob(LEVEL4_TARGET,setting.LEVEL4_TARGET_pos[1],setting.LEVEL4_TARGET_pos[2])
  505. --d.set_regen_file (MOB_REGEN_FILE_PATH..'id_4f.txt')
  506. d.regen_file (MOB_REGEN_FILE_PATH..'id_4f.txt')
  507. server_timer ('snow_dungeon_killed_A_1', 6, d.get_map_index())
  508. d.notice(locale.snow_dungeon.say_39)
  509. end
  510. end
  511. -- when LEVEL4_TARGET.kill with snow_dungeon.is_snowd(pc.get_map_index()) and d.getf('level') == 4 begin -- Dingo when he killed
  512. -- d.notice("level 4 clear")
  513. -- snow_dungeon.level_clear()
  514. -- d.notice(locale.snow_dungeon.say_9)
  515. -- server_timer('snow_dungeon_level5_start',10,d.get_map_index())
  516. -- end
  517.  
  518. -- <5 stories>
  519. -- Condition: Sealing Stone five areas in order to meet the installed release (Key: 30312)
  520. when snow_dungeon_level5_start.server_timer begin
  521. if d.select(get_server_timer_arg()) then
  522. local setting = snow_dungeon.setting()
  523.  
  524. d.setf('level',5)
  525. d.jump_all(setting.WARP_pos[5][1],setting.WARP_pos[5][2])
  526. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_5f.txt')
  527. d.notice(locale.snow_dungeon.say_40)
  528. d.notice(locale.snow_dungeon.say_41)
  529.  
  530. local vis = { 0,0,0,0,0}
  531. for i = 1, 5 do -- ???? ???
  532. local ran = number(1,5)
  533. local st = 0
  534. for j = 1, 50 do
  535. st = st + 1
  536. if st > 5 then
  537. st = 1
  538. end
  539. if vis[st] == 0 then
  540. ran = ran - 1
  541. if ran == 0 then
  542. vis[st] = 1
  543. d.set_unique('stone5_'..st, d.spawn_mob(LEVEL5_STONE, setting.LEVEL5_STONE_pos[i][1], setting.LEVEL5_STONE_pos[i][2]))
  544. break
  545. end
  546. end
  547. end
  548. end
  549. end
  550. end
  551. when kill with snow_dungeon.is_snowd(pc.get_map_index()) and d.getf('level') == 5 begin -- Sealing Stone Key Level 5 drop
  552. local i = number(1, 70) -- 1/100 chance to drop a key
  553. if i == 1 then
  554. game.drop_item (LEVEL5_REALKEY, 1)
  555. end
  556. end
  557. when LEVEL5_STONE.take with snow_dungeon.is_snowd(d.get_map_index()) and item.vnum == LEVEL5_REALKEY and d.getf('level') == 5 begin -- Ingestion real key level 5
  558. local setting = snow_dungeon.setting()
  559. if npc.get_vid() == d.get_unique_vid('stone5_1') then -- The first thing that should be required prior eopeuni kkeoneun find haejum removed as soon as
  560. npc.purge()
  561. item.remove()
  562. say(locale.snow_dungeon.say_13)
  563. d.setf('stonekill',2) --Kill 2 stone
  564.  
  565. if d.count_monster() < LEVEL5_GEN_LIMIT then
  566. d.regen_file (MOB_REGEN_FILE_PATH..'id_5f.txt')
  567. end
  568. elseif npc.get_vid() == d.get_unique_vid('stone5_2') then
  569. if d.getf('stonekill') == 2 then -- Ryende beondol kill two car keys to eat when he was two beondol
  570. npc.purge()
  571. item.remove()
  572. say(locale.snow_dungeon.say_14)
  573. d.setf('stonekill',3)
  574. if d.count_monster() < LEVEL5_GEN_LIMIT then
  575. d.regen_file (MOB_REGEN_FILE_PATH..'id_5f.txt')
  576. end
  577. else
  578. item.remove()
  579. say(locale.snow_dungeon.say_15)
  580. if is_test_server() then
  581. say("Test : 2")
  582. end
  583. end
  584. elseif npc.get_vid() == d.get_unique_vid('stone5_3') then
  585. if d.getf('stonekill') == 3 then
  586. npc.purge()
  587. item.remove()
  588. say(locale.snow_dungeon.say_16)
  589. d.setf('stonekill',4)
  590. if d.count_monster() < LEVEL5_GEN_LIMIT then
  591. d.regen_file (MOB_REGEN_FILE_PATH..'id_5f.txt')
  592. end
  593. else
  594. item.remove()
  595. say(locale.snow_dungeon.say_15)
  596. if is_test_server() then
  597. say("Test : 3")
  598. end
  599. end
  600. elseif npc.get_vid() == d.get_unique_vid('stone5_4') then
  601. if d.getf('stonekill') == 4 then
  602. npc.purge()
  603. item.remove()
  604. say(locale.snow_dungeon.say_17)
  605. d.setf('stonekill',5)
  606. if d.count_monster() < LEVEL5_GEN_LIMIT then
  607. d.regen_file (MOB_REGEN_FILE_PATH..'id_5f.txt')
  608. end
  609. else
  610. item.remove()
  611. say(locale.snow_dungeon.say_15)
  612. if is_test_server() then
  613. say("Test : 4")
  614. end
  615. end
  616. else
  617. if d.getf('stonekill') == 5 then
  618. npc.purge()
  619. item.remove()
  620. -- d.notice("level 5 clear")
  621. d.notice(locale.snow_dungeon.say_18)
  622. snow_dungeon.level_clear()
  623. server_timer('snow_dungeon_level6_start',10,d.get_map_index())
  624. else
  625. item.remove()
  626. say(locale.snow_dungeon.say_15)
  627. if is_test_server() then
  628. say("Test : 5")
  629. end
  630. end
  631. end
  632. end
  633. -- <6 stories>
  634. -- Three methine areas appeared the target when the monster destroyed
  635. when snow_dungeon_level6_start.server_timer begin
  636. if d.select(get_server_timer_arg()) then
  637. local setting = snow_dungeon.setting()
  638. d.setf('level',6)
  639. d.jump_all(setting.WARP_pos[6][1],setting.WARP_pos[6][2])
  640. d.regen_file (MOB_REGEN_FILE_PATH..'id_6f.txt')
  641. server_timer ('snow_dungeon_killed_A_1', 6, d.get_map_index())
  642. d.notice(locale.snow_dungeon.say_42)
  643. end
  644. end
  645. when LEVEL6_TARGET.kill with snow_dungeon.is_snowd(d.get_map_index()) and d.getf('level') == 6 begin
  646. -- d.notice("level 6 clear")
  647. d.notice(locale.snow_dungeon.say_19)
  648. snow_dungeon.level_clear()
  649. server_timer('snow_dungeon_level7_start',10,d.get_map_index())
  650. end
  651. -- <7 stories>
  652. -- Gene areas of monsters defeated bosses
  653. -- Fake, HP 1/2, the disappearance
  654. when snow_dungeon_level7_start.server_timer begin
  655. if d.select(get_server_timer_arg()) then
  656. local setting = snow_dungeon.setting()
  657. d.setf('level',7)
  658. d.jump_all(setting.WARP_pos[7][1],setting.WARP_pos[7][2])
  659. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_7f.txt')
  660. d.notice(locale.snow_dungeon.say_43)
  661.  
  662. local vis = { 0,0,0,0}
  663. for i=1,3 do
  664. vis[i] = 0
  665. end
  666. for i = 1, 4 do -- Summon monsters randomly
  667. local ran = number(1,4)
  668. local st = 0
  669. for j = 1, 50 do
  670. st = st + 1
  671. if st > 4 then
  672. st = 1
  673. end
  674. if vis[st] == 0 then
  675. ran = ran - 1
  676. if ran == 0 then
  677. vis[st] = 1
  678. d.set_unique('boss7_'..st, d.spawn_mob(LEVEL7_BOSSMOB, setting.LEVEL7_BOSSMOB_pos[i][1], setting.LEVEL7_BOSSMOB_pos[i][2]))
  679. break
  680. end
  681. end
  682. end
  683. end
  684. server_timer('snow_dungeon_killed_B_1', 6, d.get_map_index())
  685. end
  686. end
  687. -- Timer detects a fake monster hp.
  688. when snow_dungeon_killed_B_1.server_timer begin -- Turn timer 1 (level1, level3)
  689. if d.select(get_server_timer_arg()) then
  690. for i =1, 3 do
  691. if not d.is_unique_dead('boss7_'..i) then
  692. if d.unique_get_hp_perc('boss7_'..i) < 50 then
  693. d.purge_unique('boss7_'..i)
  694. d.notice(locale.snow_dungeon.say_20)
  695. end
  696. end
  697. end
  698. if d.is_unique_dead('boss7_4') then
  699. snow_dungeon.level_clear()
  700. -- d.notice("level 8 clear")
  701. d.notice(locale.snow_dungeon.say_21)
  702. server_timer('snow_dungeon_level8_start',10,d.get_map_index())
  703. else
  704. server_timer ('snow_dungeon_killed_B_2', 3, get_server_timer_arg())
  705. end
  706. end
  707. end
  708. when snow_dungeon_killed_B_2.server_timer begin --Turn the timer 2 (1 and 2 return to alternately)
  709. if d.select(get_server_timer_arg()) then
  710. for i =1, 3 do
  711. if not d.is_unique_dead('boss7_'..i) then
  712. if d.unique_get_hp_perc('boss7_'..i) < 50 then
  713. d.purge_unique('boss7_'..i)
  714. d.notice(locale.snow_dungeon.say_20)
  715. end
  716. end
  717. end
  718. if d.is_unique_dead('boss7_4') then
  719. snow_dungeon.level_clear()
  720. -- d.notice("level 8 clear")
  721. d.notice(locale.snow_dungeon.say_21)
  722. server_timer('snow_dungeon_level8_start',10,d.get_map_index())
  723. else
  724. server_timer ('snow_dungeon_killed_B_1', 3, get_server_timer_arg())
  725. end
  726. end
  727. end
  728. -- <8th Floor>
  729. -- Sealed off (Key: 30312)
  730. when snow_dungeon_level8_start.server_timer begin
  731. if d.select(get_server_timer_arg()) then
  732. local setting = snow_dungeon.setting()
  733. d.setf('level',8)
  734. d.jump_all(setting.WARP_pos[8][1],setting.WARP_pos[8][2])
  735. --d.spawn_mob(LEVEL8_STONE,setting.LEVEL8_STONE_pos[1][1],setting.LEVEL8_STONE_pos[1][2])
  736. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_8f.txt')
  737. d.notice(locale.snow_dungeon.say_44)
  738. end
  739. end
  740. when kill with snow_dungeon.is_snowd(pc.get_map_index()) and d.getf('level') == 8 begin -- 8 levels drop Sealing Stone Key
  741. local i = number(1, 60) -- 1/100 chance to drop a key
  742. if i == 1 then
  743. game.drop_item (LEVEL8_REALKEY, 1)
  744. end
  745. end
  746. -- when LEVEL8_STONE.take with snow_dungeon.is_snowd(d.get_map_index()) and item.vnum == LEVEL8_REALKEY and d.getf('level') == 8 begin -- Ingestion real key 08 level
  747. -- item.remove()
  748. -- if number(1,3) == 1 then
  749. -- npc.purge()
  750. -- d.notice("level 8 clear")
  751. -- snow_dungeon.level_clear()
  752. -- d.notice(locale.snow_dungeon.say_22)
  753. -- server_timer('snow_dungeon_level9_start',10,d.get_map_index())
  754.  
  755.  
  756. -- --102 levels related code
  757. -- if party.is_party() then
  758. -- party.setf("snow_dungeon_room_enter", 9)
  759. -- end
  760. -- else
  761. -- say(locale.snow_dungeon.say_12)
  762. -- end
  763. -- end
  764. when LEVEL8_REALKEY.use with snow_dungeon.is_snowd(d.get_map_index()) and d.getf('level') == 8 begin
  765. if pc.get_job() == 1 or pc.get_job() == 3 then
  766. if d.getf('level8_clear') == 0 then
  767. if number(1,5) == 1 then
  768. -- d.notice("level 8 clear")
  769. item.remove()
  770. snow_dungeon.level_clear()
  771. d.notice(locale.snow_dungeon.say_22)
  772. server_timer('snow_dungeon_level9_start',10,d.get_map_index())
  773.  
  774. d.setf('level8_clear', 1)
  775.  
  776. -- 102 level-specific code
  777. if party.is_party() then
  778. party.setf('snow_dungeon_room_enter', 9)
  779. end
  780.  
  781. else
  782. syschat(locale.snow_dungeon.say_12)
  783. d.notice(locale.snow_dungeon.say_12)
  784. item.remove()
  785. end
  786. end
  787. else
  788. syschat("Nie jesteś Szamanem ani Ninją")
  789. end
  790. end
  791. -- <9th Floor>
  792. -- White Dragon grindstone destruction (methine seats)
  793. when snow_dungeon_level9_start.server_timer begin
  794. if d.select(get_server_timer_arg()) then
  795. local setting = snow_dungeon.setting()
  796. d.setf('level',9)
  797. d.jump_all(setting.WARP_pos[9][1],setting.WARP_pos[9][2])
  798. d.set_regen_file (MOB_REGEN_FILE_PATH..'id_9f.txt')
  799. d.spawn_mob(LEVEL9_TARGET,setting.LEVEL9_TARGET_pos[1][1],setting.LEVEL9_TARGET_pos[1][2])
  800. d.notice(locale.snow_dungeon.say_45)
  801. end
  802. end
  803. when LEVEL9_TARGET.kill with snow_dungeon.is_snowd(pc.get_map_index()) and d.getf('level') == 9 begin
  804. local setting = snow_dungeon.setting()
  805.  
  806. -- d.notice("level 9 clear")
  807. snow_dungeon.level_clear()
  808. d.spawn_mob_ac_dir(DUNGEON_MAN,849, 641, 1)
  809. end
  810.  
  811. -- <Boss Room>
  812. -- Boss Kills
  813. when DUNGEON_MAN.chat.locale.snow_dungeon.say_36 with d.getf('level') == 9 and pc.get_map_index() >= DUNGEON_MAP_INDEX * 10000 and pc.get_map_index() < (DUNGEON_MAP_INDEX + 1) *10000 begin
  814. local setting = snow_dungeon.setting()
  815. if !party.is_leader() then
  816. say(locale.dungeon.leader_can_go)
  817. else
  818. if pc.get_level() < 99 then --Level Check
  819. say(locale.snow_dungeon.say_31)
  820. say(locale.snow_dungeon.say_28)
  821. d.notice(locale.snow_dungeon.say_31)
  822. d.notice(locale.snow_dungeon.say_28)
  823.  
  824. server_timer('snow_dungeon_end_timer',10,d.get_map_index())
  825. else
  826. if pc.get_level() > 99 then
  827. -- Quest check prior
  828. say(locale.snow_dungeon.say_33)
  829. local warp = select(locale.snow_dungeon.say_34,locale.snow_dungeon.say_35)
  830. if warp == 1 then
  831. d.setf('level',10)
  832. snow_dungeon.set_dungeon_level(10)
  833. end
  834. else
  835. say(locale.snow_dungeon.say_32)
  836. say(locale.snow_dungeon.say_28)
  837. d.notice(locale.snow_dungeon.say_32)
  838. d.notice(locale.snow_dungeon.say_28)
  839.  
  840. server_timer('snow_dungeon_end_timer',10,d.get_map_index())
  841. end
  842. end
  843. end
  844. end
  845. when snow_dungeon_BOSS_start.server_timer begin
  846. if d.select(get_server_timer_arg()) then
  847. snow_dungeon.set_dungeon_level(10)
  848. end
  849. end
  850. when FINAL_BOSS.kill with snow_dungeon.is_snowd(d.get_map_index()) and d.getf('level') ==10 begin -- When the boss killed
  851. d.notice(locale.snow_dungeon.say_23)
  852. d.notice(locale.snow_dungeon.say_24)
  853. notice_all("".. pc.get_name() .." hat mit seiner Gruppe Nemeres bezwungen!")
  854. server_timer('snow_dungeon_end_timer', 60,d.get_map_index())
  855. snow_dungeon.level_clear()
  856.  
  857. -- Of the party, catching yamacheon Quest (104 representatives and 105 rep quest) quest progress if people are to be cleared.
  858. if party.is_party() then
  859. party.setf("snow_dungeon_boss_kill_count", 1)
  860. end
  861. end
  862.  
  863. -- <Period elapsed timer>
  864. when snow_dungeon_45m_left_timer.server_timer begin
  865. if d.select(get_server_timer_arg()) then
  866. d.notice(string.format(locale.snow_dungeon.say_26, 45))
  867. d.notice(locale.snow_dungeon.say_25)
  868. server_timer('snow_dungeon_30m_left_timer', 15*60, get_server_timer_arg())
  869. end
  870. end
  871. when snow_dungeon_30m_left_timer.server_timer begin
  872. if d.select(get_server_timer_arg()) then
  873. d.notice(string.format(locale.snow_dungeon.say_26, 30))
  874. d.notice(locale.snow_dungeon.say_25)
  875. server_timer('snow_dungeon_15m_left_timer', 15*60, get_server_timer_arg())
  876. end
  877. end
  878. when snow_dungeon_15m_left_timer.server_timer begin
  879. if d.select(get_server_timer_arg()) then
  880. d.notice(string.format(locale.snow_dungeon.say_26, 15))
  881. d.notice(locale.snow_dungeon.say_25)
  882. server_timer('snow_dungeon_5m_left_timer', 10*60, get_server_timer_arg())
  883. end
  884. end
  885. when snow_dungeon_5m_left_timer.server_timer begin
  886. if d.select(get_server_timer_arg()) then
  887. d.notice(string.format(locale.snow_dungeon.say_26, 5))
  888. d.notice(locale.snow_dungeon.say_25)
  889. server_timer('snow_dungeon_1m_left_timer', 4*60, get_server_timer_arg())
  890. end
  891. end
  892. when snow_dungeon_1m_left_timer.server_timer begin
  893. if d.select(get_server_timer_arg()) then
  894. d.notice(string.format(locale.snow_dungeon.say_26, 1))
  895. d.notice(locale.snow_dungeon.say_25)
  896. server_timer ('snow_dungeon_0m_left_timer', 60, get_server_timer_arg())
  897. end
  898. end
  899. when snow_dungeon_0m_left_timer.server_timer begin
  900. local setting = snow_dungeon.setting()
  901. if d.select(get_server_timer_arg()) then
  902. d.notice(locale.snow_dungeon.say_27)
  903. d.notice(locale.snow_dungeon.say_28)
  904. server_timer('snow_dungeon_end_timer',10,d.get_map_index())
  905. end
  906. end
  907. when snow_dungeon_end_timer.server_timer begin -- Shutdown Timer (after getting out)
  908. local setting = snow_dungeon.setting()
  909. if d.select(get_server_timer_arg()) then
  910. d.setf("party_leader_pid", 0)
  911. snow_dungeon.clear_timer(d.get_map_index())
  912. d.set_warp_location(ENTRY_MAP_INDEX, setting.outside_entry_pos[1] , setting.outside_entry_pos[2])
  913. d.exit_all()
  914. end
  915. end
  916. when snow_dungeon_leader_out_timer.server_timer begin
  917. local setting = snow_dungeon.setting()
  918. if d.select(get_server_timer_arg()) then
  919. say_in_map(get_server_timer_arg(), locale.snow_dungeon.say_30..locale.snow_dungeon.say_28)
  920. server_timer("snow_dungeon_end_timer",10,d.get_map_index())
  921. end
  922. end
  923. end
  924. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement