Advertisement
Guest User

Untitled

a guest
Dec 7th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.54 KB | None | 0 0
  1. --[[
  2.  
  3. -- Init - Azrael Catacomb class
  4.  
  5. ]]
  6.  
  7. AzraelCatacomb = {};
  8.  
  9. AzraelCatacomb.ReturnData = function()
  10. if (AzraelCatacomb.data == nil) then
  11. AzraelCatacomb.data = {
  12. ["min_level"] = 75,
  13.  
  14. ["inside_index"] = 216,
  15. ["outside_index"] = 65,
  16.  
  17. ["enter_Pos"] = {["x"] = 3145, ["y"] = 13188},
  18. ["outside_Pos"] = {["x"] = 5919, ["y"] = 1002},
  19.  
  20. ["NeededItem"] = {["vnum"] = 30319, ["count"] = 1},
  21. ["MinimumMemebersParty"] = 2,
  22.  
  23. ["boss_Posit"] = {["x"] = 74, ["y"] = 1104},
  24. ["KingVnum"] = 2591,
  25.  
  26. ["AzraelVnum"] = 2598,
  27.  
  28. ["time_until_you_got_kicked"] = time_min_to_sec(20),
  29. ["time_after_you_complete_the_dungeon"] = time_min_to_sec(60)
  30. };
  31. end
  32.  
  33. return AzraelCatacomb.data;
  34. end
  35.  
  36. AzraelCatacomb.isInDungeon = function()
  37. local pMapIndex = pc.get_map_index();
  38. local map_index = AzraelCatacomb.ReturnData()["inside_index"];
  39.  
  40. return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
  41. end
  42.  
  43. AzraelCatacomb.ClearDungeon = function()
  44. if (pc.in_dungeon()) then
  45. d.clear_regen();
  46. d.kill_all();
  47. end
  48. end
  49.  
  50. AzraelCatacomb.setWatingTime = function(pids)
  51. local data = AzraelCatacomb.ReturnData();
  52. local ownPid = pc.get_player_id();
  53.  
  54. if party.is_party() then
  55. for index, pid in next, pids, nil do
  56. return game.set_event_flag("devilcatacomb_cooldown_"..pid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  57. end
  58. end
  59.  
  60. return game.set_event_flag("devilcatacomb_cooldown_"..ownPid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  61. end
  62.  
  63. AzraelCatacomb.CheckInfo = function()
  64. local data = AzraelCatacomb.ReturnData();
  65. local dataMinLev = data["min_level"];
  66. local dataItem = data["NeededItem"];
  67.  
  68. if party.is_party() then
  69. local pids = party_get_member_pids();
  70. local timeTable, timeCheck, minLev, minLevCheck, itemNeed, itemNeedCheck = {}, true, {}, true, {}, true;
  71.  
  72. if (not party.is_leader()) then
  73. say("Would you like to enter Azrael Dungeon,[ENTER]let me speak with the leader first!")
  74. return false;
  75. end
  76.  
  77. if (party.get_near_count() < data["MinimumMemebersParty"]) then
  78. say(string.format("To enter the Devil's Catacomb,[ENTER]you need %d players in your group", data["MinimumMemebersParty"]))
  79. return false;
  80. end
  81.  
  82. for index, pid in ipairs(pids) do
  83. q.begin_other_pc_block(pid);
  84. if (pc.get_level() < dataMinLev) then
  85. table.insert(minLev, pc.get_name());
  86. minLevCheck = false;
  87. end
  88.  
  89. local cd_flag = game.get_event_flag("devilcatacomb_cooldown_"..pid.."");
  90. local cur_time = get_time();
  91.  
  92. if (cd_flag > cur_time) then
  93. table.insert(timeTable, string.format("%s - %s", pc.get_name(), get_time_format(cd_flag - cur_time)));
  94. timeCheck = false;
  95. end
  96.  
  97. if (pc.count_item(dataItem["vnum"]) < dataItem["count"]) then
  98. table.insert(itemNeed, string.format("%s", pc.get_name()));
  99. itemNeedCheck = false;
  100. end
  101. q.end_other_pc_block();
  102. end
  103.  
  104. if (not timeCheck) then
  105. say(string.format("To enter the Devil's Catacomb,[ENTER]each member needs to wait %s.[ENTER][ENTER]The next members didn't wait long enough::", get_time_format(data["time_after_you_complete_the_dungeon"])))
  106. for i, str in next, timeTable, nil do
  107. say(string.format("- %s", str))
  108. end
  109. return false;
  110. end
  111.  
  112. if (not minLevCheck) then
  113. say(string.format("To enter the Devil's Catacomb,[ENTER]each member needs to have the level %d.[ENTER][ENTER]The next members don't have the required level:", dataMinLev))
  114. for i, str in next, minLev, nil do
  115. say(string.format("- %s", str))
  116. end
  117. return false;
  118. end
  119.  
  120. if (not itemNeedCheck) then
  121. say(string.format("To enter the Devil's Catacomb,[ENTER]each member needs to have x%d - %s.[ENTER][ENTER]The next members don't have", dataItem["count"], item_name(dataItem["vnum"])))
  122. for i, str in next, itemNeed, nil do
  123. say(string.format("- %s", str))
  124. end
  125. return false;
  126. end
  127.  
  128. return true;
  129. end
  130.  
  131.  
  132.  
  133. if (pc.get_level () <dataMinLev) then
  134. say (string.format ("Minimum level to enter Devil's Catacomb [ENTER] is% d.", dataMinLev))
  135. returns false;
  136. The end
  137.  
  138. local ownPid = pc.get_player_id ();
  139. local cd_flag = game.get_event_flag ("devilcatacomb_cooldown _" .. ownPid .. "");
  140. local cur_time = get_time ();
  141.  
  142. if (cd_flag> cur_time) then
  143. say (string.format ("To enter the Devil's Catacomb [ENTER] you still have to wait% s.", get_time_format (cd_flag - cur_time)))
  144. returns false;
  145. The end
  146.  
  147. if (pc.count_item (dataItem ["vnum"]) <dataItem ["count"]) then
  148. say (string.format ("To enter the Devil's Catacomb [ENTER] you must have x% d -% s.", dataItem ["count"], item_name (dataItem ["vnum"])))
  149. returns false;
  150. The end
  151.  
  152. true return;
  153. The end
  154.  
  155. AzraelCatacomb.EnterInDungeon = function()
  156. local data = AzraelCatacomb.ReturnData();
  157. local dataItem = data["NeededItem"];
  158. local enter_coords = data["enter_Pos"];
  159.  
  160. if party.is_party() then
  161. local pids = party_get_member_pids();
  162.  
  163. for i, pid in next, pids, nil do
  164. q.begin_other_pc_block(pid)
  165. pc.remove_item(dataItem["vnum"], dataItem["count"])
  166. q.end_other_pc_block()
  167. end
  168.  
  169. return d.new_jump_party(data["inside_index"], enter_coords["x"], enter_coords["y"]);
  170. end
  171.  
  172.  
  173. return d.new_jump(data["inside_index"], enter_coords["x"]*100, enter_coords["y"]*100), pc.remove_item(dataItem["vnum"], dataItem["count"]);
  174. end
  175.  
  176. DragonLair = {};
  177.  
  178. DragonLair.ReturnData = function()
  179. if (DragonLair.data == nil) then
  180. DragonLair.data = {
  181. ["min_level"] = 75,
  182.  
  183. ["inside_index"] = 207,
  184. ["outside_index"] = 73,
  185.  
  186. ["enter_Pos"] = {["x"] = 8432, ["y"] = 10669},
  187. ["outside_Pos"] = {["x"] = 1815, ["y"] = 12206},
  188.  
  189. ["NeededItem"] = {["vnum"] = 30179, ["count"] = 3},
  190. ["Blue_DragonVnum"] = 2493,
  191.  
  192. ["time_until_you_got_kicked"] = time_min_to_sec(20),
  193. };
  194. end
  195.  
  196. return DragonLair.data;
  197. end
  198.  
  199. DragonLair.isInDungeon = function()
  200. local pMapIndex = pc.get_map_index();
  201. local map_index = DragonLair.ReturnData()["inside_index"];
  202.  
  203. return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
  204. end
  205.  
  206. DragonLair.ClearDungeon = function()
  207. if (pc.in_dungeon()) then
  208. d.clear_regen();
  209. d.kill_all();
  210. end
  211. end
  212.  
  213. DragonLair.isInDragonRoom = function()
  214. local pMapIndex = pc.get_map_index();
  215. local map_index = DragonLair.ReturnData()["inside_index"];
  216.  
  217. return not pc.in_dungeon() and pMapIndex == map_index;
  218. end
  219.  
  220. DragonLair.getRoomPassword = function()
  221. return game.get_event_flag("DragonLairRoomPass");
  222. end
  223.  
  224. DragonLair.isRoomBlocked = function()
  225. return game.get_event_flag("DragonLairRoomBlocked") ~= 0;
  226. end
  227.  
  228. DragonLair.DragonLairInput = function(inp)
  229. if (tonumber(inp) == nil) or tonumber(inp) > 50000 or tonumber(inp) <= 0 then
  230. say("Oops, there was an error, try again later[ENTER]adding a new code!")
  231. return false;
  232. end
  233.  
  234. return true;
  235. end
  236.  
  237. DragonLair.MakeDragonLairDungeon = function(inp)
  238. game.set_event_flag("DragonLairRoomPass", inp);
  239. game.set_event_flag("DragonLairRoomBlocked", 1);
  240. game.set_event_flag("DragonLairFirstLevelTime", get_time() + 300);
  241.  
  242. notice_all(string.format("Dragon's room was locked by %s on channel %d!", pc.get_name(), pc.get_channel_id()))
  243. end
  244.  
  245. DragonLair.EnterAfterCode = function(inp)
  246. local data = DragonLair.ReturnData();
  247.  
  248. pc.setqf("DragonLairWarpFrom", 0);
  249. pc.warp(data["enter_Pos"]["x"]*100, data["enter_Pos"]["y"]*100);
  250. end
  251.  
  252. DragonLair.CheckInfo = function(mbVnum)
  253. local data = DragonLair.ReturnData();
  254.  
  255. say_title(string.format("%s:[ENTER]", mob_name(mbVnum)))
  256. if get_time() > game.get_event_flag("DragonLairFirstLevelTime") and DragonLair.isRoomBlocked() then
  257. say("The previous player stayed for too long at[ENTER]the first level, time expired and now the room is clear.")
  258. return game.set_event_flag("DragonLairRoomBlocked", 0);
  259. end
  260.  
  261. if pc.get_level() < data["min_level"] then
  262. say(string.format("To enter inside the Dragon Cave, you need[ENTER]to have a minimum level of %d.", data["min_level"]))
  263. return false;
  264. end
  265.  
  266. if pc.count_item(data["NeededItem"]["vnum"]) < data["NeededItem"]["count"] then
  267. say(string.format("To enter inside the Dragon Cave, you need[ENTER]to have x%d - %s.", data["NeededItem"]["count"], item_name(data["NeededItem"]["vnum"])))
  268. return false;
  269. end
  270.  
  271. if not DragonLair.isRoomBlocked() then
  272. say("The room is free, write a code if you'd like [ENTER]to block the room so you and your [ENTER]friends can enter...")
  273. local str_input = input();
  274. if not DragonLair.DragonLairInput(str_input) then
  275. return false;
  276. end
  277.  
  278. if DragonLair.isRoomBlocked() then
  279. say("The room was locked in[ENTER]by another person, if you'd like[ENTER]you can write the code inserted by the [ENTER]player and move on.")
  280. return false;
  281. end
  282. return DragonLair.MakeDragonLairDungeon(tonumber(str_input));
  283. end
  284. local roomPass = DragonLair.getRoomPassword();
  285.  
  286. say("The room was locked, if you'd like to enter[ENTER]enter the code choosen by other person[ENTER]locked the room...")
  287. local str_input = input();
  288. if not DragonLair.DragonLairInput(str_input) then
  289. return false;
  290. end
  291.  
  292. if tonumber(str_input) ~= roomPass then
  293. say("The password was wrong[ENTER]try again later.")
  294. return false;
  295. end
  296.  
  297. if not DragonLair.isRoomBlocked() then
  298. say("The room was unlocked meanwhile,[ENTER]now you can write your own password[ENTER]for your and your team")
  299. return false;
  300. end
  301. return DragonLair.EnterAfterCode(), pc.remove_item(data["NeededItem"]["vnum"] ,data["NeededItem"]["count"]);
  302. end
  303.  
  304. BlazingPurgatory = {};
  305.  
  306. BlazingPurgatory.ReturnData = function()
  307. if (BlazingPurgatory.data == nil) then
  308. BlazingPurgatory.data = {
  309. ["min_level"] = 90,
  310.  
  311. ["inside_index"] = 235,
  312. ["outside_index"] = 62,
  313.  
  314. ["enter_Pos"] = {["x"] = 8111, ["y"] = 6864},
  315. ["outside_Pos"] = {["x"] = 5993, ["y"] = 7072},
  316.  
  317. ["NeededItem"] = {["vnum"] = 71173, ["count"] = 1},
  318. ["MinimumMemebersParty"] = 2,
  319.  
  320. ["boss_Posit"] = {["x"] = 686, ["y"] = 620},
  321. ["PurgatoryKing"] = 6091,
  322.  
  323. ["time_until_you_got_kicked"] = time_min_to_sec(20),
  324. ["time_after_you_complete_the_dungeon"] = time_min_to_sec(60)
  325. };
  326. end
  327.  
  328. return BlazingPurgatory.data;
  329. end
  330.  
  331. BlazingPurgatory.isInDungeon = function()
  332. local pMapIndex = pc.get_map_index();
  333. local map_index = BlazingPurgatory.ReturnData()["inside_index"];
  334.  
  335. return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
  336. end
  337.  
  338. BlazingPurgatory.ClearDungeon = function()
  339. if (pc.in_dungeon()) then
  340. d.clear_regen();
  341. d.kill_all();
  342. end
  343. end
  344.  
  345. BlazingPurgatory.setWatingTime = function(pids)
  346. local data = BlazingPurgatory.ReturnData();
  347. local ownPid = pc.get_player_id();
  348.  
  349. if party.is_party() then
  350. for index, pid in next, pids, nil do
  351. return game.set_event_flag("blazingpurgatory_cooldown_"..pid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  352. end
  353. end
  354.  
  355. return game.set_event_flag("blazingpurgatory_cooldown_"..ownPid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  356. end
  357.  
  358. BlazingPurgatory.CheckInfo = function()
  359. local data = BlazingPurgatory.ReturnData();
  360. local dataMinLev = data["min_level"];
  361. local dataItem = data["NeededItem"];
  362.  
  363. if party.is_party() then
  364. local pids = party_get_member_pids();
  365. local timeTable, timeCheck, minLev, minLevCheck, itemNeed, itemNeedCheck = {}, true, {}, true, {}, true;
  366.  
  367. if (not party.is_leader()) then
  368. say("If you would like to enter Razador's[ENTER]Purgatory,[ENTER]let me speak with the group leader first")
  369. return false;
  370. end
  371.  
  372. if (party.get_near_count() < data["MinimumMemebersParty"]) then
  373. say(string.format("If you would like to enter Razador's[ENTER]Purgatory,[ENTER]the %d players around you need to be in the same group with you.", data["MinimumMemebersParty"]))
  374. return false;
  375. end
  376.  
  377. for index, pid in ipairs(pids) do
  378. q.begin_other_pc_block(pid);
  379. if (pc.get_level() < dataMinLev) then
  380. table.insert(minLev, pc.get_name());
  381. minLevCheck = false;
  382. end
  383.  
  384. local cd_flag = game.get_event_flag("blazingpurgatory_cooldown_"..pid.."");
  385. local cur_time = get_time();
  386.  
  387. if (cd_flag > cur_time) then
  388. table.insert(timeTable, string.format("%s - %s", pc.get_name(), get_time_format(cd_flag - cur_time)));
  389. timeCheck = false;
  390. end
  391.  
  392. if (pc.count_item(dataItem["vnum"]) < dataItem["count"]) then
  393. table.insert(itemNeed, string.format("%s", pc.get_name()));
  394. itemNeedCheck = false;
  395. end
  396. q.end_other_pc_block();
  397. end
  398.  
  399. if (not timeCheck) then
  400. say(string.format("If you would like to enter Razador's[ENTER]Purgatory,[ENTER]each member needs to wait %s.[ENTER][ENTER]The next members didn't wait long enough", get_time_format(data["time_after_you_complete_the_dungeon"])))
  401. for i, str in next, timeTable, nil do
  402. say(string.format("- %s", str))
  403. end
  404. return false;
  405. end
  406.  
  407. if (not minLevCheck) then
  408. say(string.format("If you would like to enter Razador's[ENTER]Purgatory,[ENTER]each member needs to have the minimum level of %d.[ENTER][ENTER]The next members don't have the required level.", dataMinLev))
  409. for i, str in next, minLev, nil do
  410. say(string.format("- %s", str))
  411. end
  412. return false;
  413. end
  414.  
  415. if (not itemNeedCheck) then
  416. say(string.format("If you would like to enter Razador's[ENTER]Purgatory,[ENTER]each member needs to have x%d - %s.[ENTER][ENTER]The next members don't have", dataItem["count"], item_name(dataItem["vnum"])))
  417. for i, str in next, itemNeed, nil do
  418. say(string.format("- %s", str))
  419. end
  420. return false;
  421. end
  422.  
  423. return true;
  424. end
  425.  
  426. if (pc.get_level() < dataMinLev) then
  427. say(string.format("The minimum level to enter in the Razador's[ENTER]Purgatory is %d.", dataMinLev))
  428. return false;
  429. end
  430.  
  431. local ownPid = pc.get_player_id();
  432. local cd_flag = game.get_event_flag("blazingpurgatory_cooldown_"..ownPid.."");
  433. local cur_time = get_time();
  434.  
  435. if (cd_flag > cur_time) then
  436. say(string.format("If you would like to enter Razador's[ENTER]Purgatory, you need to wait %s.", get_time_format(cd_flag - cur_time)))
  437. return false;
  438. end
  439.  
  440. if (pc.count_item(dataItem["vnum"]) < dataItem["count"]) then
  441. say(string.format("If you would like to enter Razador's[ENTER]Purgatory, you need to have x%d - %s.", dataItem["count"], item_name(dataItem["vnum"])))
  442. return false;
  443. end
  444.  
  445. return true;
  446. end
  447.  
  448. BlazingPurgatory.EnterInDungeon = function()
  449. local data = BlazingPurgatory.ReturnData();
  450. local dataItem = data["NeededItem"];
  451. local enter_coords = data["enter_Pos"];
  452.  
  453. if party.is_party() then
  454. local pids = party_get_member_pids();
  455.  
  456. for i, pid in next, pids, nil do
  457. q.begin_other_pc_block(pid)
  458. pc.remove_item(dataItem["vnum"], dataItem["count"])
  459. q.end_other_pc_block()
  460. end
  461.  
  462. return d.new_jump_party(data["inside_index"], enter_coords["x"], enter_coords["y"]);
  463. end
  464.  
  465.  
  466. return d.new_jump(data["inside_index"], enter_coords["x"]*100, enter_coords["y"]*100), pc.remove_item(dataItem["vnum"], dataItem["count"]);
  467. end
  468.  
  469. SnowDungeon = {};
  470.  
  471. SnowDungeon.ReturnData = function()
  472. if (SnowDungeon.data == nil) then
  473. SnowDungeon.data = {
  474. ["min_level"] = 90,
  475.  
  476. ["inside_index"] = 240,
  477. ["outside_index"] = 61,
  478.  
  479. ["enter_Pos"] = {["x"] = 5120+928, ["y"] = 1536+390},
  480. ["outside_Pos"] = {["x"] = 4321, ["y"] = 1649},
  481.  
  482. ["NeededItem"] = {["vnum"] = 71173, ["count"] = 1},
  483. ["MinimumMemebersParty"] = 2,
  484.  
  485. ["boss_Posit"] = {["x"] = 927, ["y"] = 323},
  486. ["TowerKing"] = 6191,
  487.  
  488. ["time_until_you_got_kicked"] = time_min_to_sec(20),
  489. ["time_after_you_complete_the_dungeon"] = time_min_to_sec(60)
  490. };
  491. end
  492.  
  493. return SnowDungeon.data;
  494. end
  495.  
  496. SnowDungeon.isInDungeon = function()
  497. local pMapIndex = pc.get_map_index();
  498. local map_index = SnowDungeon.ReturnData()["inside_index"];
  499.  
  500. return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
  501. end
  502.  
  503. SnowDungeon.ClearDungeon = function()
  504. if (pc.in_dungeon()) then
  505. d.clear_regen();
  506. d.kill_all();
  507. end
  508. end
  509.  
  510. SnowDungeon.setWatingTime = function(pids)
  511. local data = SnowDungeon.ReturnData();
  512. local ownPid = pc.get_player_id();
  513.  
  514. if party.is_party() then
  515. for index, pid in next, pids, nil do
  516. return game.set_event_flag("snowdungeon_cooldown_"..pid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  517. end
  518. end
  519.  
  520. return game.set_event_flag("snowdungeon_cooldown_"..ownPid.."", data["time_after_you_complete_the_dungeon"] + get_time());
  521. end
  522.  
  523. SnowDungeon.CheckInfo = function()
  524. local data = SnowDungeon.ReturnData();
  525. local dataMinLev = data["min_level"];
  526. local dataItem = data["NeededItem"];
  527.  
  528. if party.is_party() then
  529. local pids = party_get_member_pids();
  530. local timeTable, timeCheck, minLev, minLevCheck, itemNeed, itemNeedCheck = {}, true, {}, true, {}, true;
  531.  
  532. if (not party.is_leader()) then
  533. say("If you want to enter in Nemere's[ENTER]Tower,[ENTER]let me speak with the group leader first!")
  534. return false;
  535. end
  536.  
  537. if (party.get_near_count() < data["MinimumMemebersParty"]) then
  538. say(string.format(""If you want to enter in Nemere's[ENTER]Tower,[ENTER]the players around you need %d to be in the same group as you!", data["MinimumMemebersParty"]))
  539. return false;
  540. end
  541.  
  542. for index, pid in ipairs(pids) do
  543. q.begin_other_pc_block(pid);
  544. if (pc.get_level() < dataMinLev) then
  545. table.insert(minLev, pc.get_name());
  546. minLevCheck = false;
  547. end
  548.  
  549. local cd_flag = game.get_event_flag("snowdungeon_cooldown_"..pid.."");
  550. local cur_time = get_time();
  551.  
  552. if (cd_flag > cur_time) then
  553. table.insert(timeTable, string.format("%s - %s", pc.get_name(), get_time_format(cd_flag - cur_time)));
  554. timeCheck = false;
  555. end
  556.  
  557. if (pc.count_item(dataItem["vnum"]) < dataItem["count"]) then
  558. table.insert(itemNeed, string.format("%s", pc.get_name()));
  559. itemNeedCheck = false;
  560. end
  561. q.end_other_pc_block();
  562. end
  563.  
  564. if (not timeCheck) then
  565. say(string.format(""If you want to enter in Nemere's[ENTER]Tower, [ENTER]each member needs to wait %s.[ENTER][ENTER]The next members didn't wait long enough", get_time_format(data["time_after_you_complete_the_dungeon"])))
  566. for i, str in next, timeTable, nil do
  567. say(string.format("- %s", str))
  568. end
  569. return false;
  570. end
  571.  
  572. if (not minLevCheck) then
  573. say(string.format(""If you want to enter in Nemere's[ENTER]Tower, [ENTER]eachj member needs to have a minimum level of %d.[ENTER][ENTER]The following members don't have the required level:", dataMinLev))
  574. for i, str in next, minLev, nil do
  575. say(string.format("- %s", str))
  576. end
  577. return false;
  578. end
  579.  
  580. if (not itemNeedCheck) then
  581. say(string.format(""If you want to enter in Nemere's[ENTER]Tower, [ENTER]each member needs to have x%d - %s.[ENTER][ENTER]Next members don't have the neccessary objects", dataItem["count"], item_name(dataItem["vnum"])))
  582. for i, str in next, itemNeed, nil do
  583. say(string.format("- %s", str))
  584. end
  585. return false;
  586. end
  587.  
  588. return true;
  589. end
  590.  
  591. if (pc.get_level() < dataMinLev) then
  592. say(string.format("The minimum level to enter into the Nemere's[ENTER]Tower is %d.", dataMinLev))
  593. return false;
  594. end
  595.  
  596. local ownPid = pc.get_player_id();
  597. local cd_flag = game.get_event_flag("snowdungeon_cooldown_"..ownPid.."");
  598. local cur_time = get_time();
  599.  
  600. if (cd_flag > cur_time) then
  601. say(string.format(""If you want to enter in Nemere's[ENTER]Tower you need to wait %s.", get_time_format(cd_flag - cur_time)))
  602. return false;
  603. end
  604.  
  605. if (pc.count_item(dataItem["vnum"]) < dataItem["count"]) then
  606. say(string.format(""If you want to enter in Nemere's[ENTER]Tower, you need to have x%d - %s.", dataItem["count"], item_name(dataItem["vnum"])))
  607. return false;
  608. end
  609.  
  610. return true;
  611. end
  612.  
  613. SnowDungeon.EnterInDungeon = function()
  614. local data = SnowDungeon.ReturnData();
  615. local dataItem = data["NeededItem"];
  616. local enter_coords = data["enter_Pos"];
  617.  
  618. if party.is_party() then
  619. local pids = party_get_member_pids();
  620.  
  621. for i, pid in next, pids, nil do
  622. q.begin_other_pc_block(pid)
  623. pc.remove_item(dataItem["vnum"], dataItem["count"])
  624. q.end_other_pc_block()
  625. end
  626.  
  627. return d.new_jump_party(data["inside_index"], enter_coords["x"], enter_coords["y"]);
  628. end
  629.  
  630. return d.new_jump(data["inside_index"], enter_coords["x"]*100, enter_coords["y"]*100), pc.remove_item(dataItem["vnum"], dataItem["count"]);
  631. end
  632.  
  633. DeleteTimeScroll = {};
  634.  
  635. DeleteTimeScroll.ReturnData = function()
  636. if (DeleteTimeScroll.data == nil) then
  637. DeleteTimeScroll.data = {
  638. ["dungeonTimerData"] = {"snowdungeon_cooldown_", "blazingpurgatory_cooldown_", "devilcatacomb_cooldown_", "spidernest_cooldown_"},
  639. ["dungeonsName"] = {"Nemere's Tower", "Razador's Purgatory", "Devil's Catacomb", "Spider cave"},
  640. };
  641. end
  642.  
  643. return DeleteTimeScroll.data;
  644. end
  645.  
  646. DeleteTimeScroll.InsertWindow = function()
  647. local data = DeleteTimeScroll.ReturnData();
  648. local ownPid = pc.get_player_id();
  649. local window = {["data"] = {}, ["index"] = {}};
  650.  
  651. for index, value in ipairs(data["dungeonTimerData"]) do
  652. if game.get_event_flag(""..value..""..ownPid.."") > 0 then
  653. table.insert(window["data"], string.format("%s - %s", data["dungeonsName"][index], get_time_format(game.get_event_flag(""..value..""..ownPid.."")-get_time())))
  654. table.insert(window["index"], index)
  655. end
  656. end
  657. table.insert(window["data"], "Renunta");
  658.  
  659. return window;
  660. end
  661.  
  662.  
  663. DeleteTimeScroll.MainWindow = function(iNum)
  664. local data = DeleteTimeScroll.ReturnData();
  665. local InsertedWindowTable = DeleteTimeScroll.InsertWindow()["data"];
  666. local ownPid = pc.get_player_id();
  667.  
  668. say_title(string.format("%s:[ENTER]", item_name(iNum)))
  669. if (table.getn(InsertedWindowTable) < 2) then
  670. say("You don't need to wait[ENTER]for any dungeon.")
  671. return false;
  672. end
  673.  
  674. say("Choose the dungeon you would like to reset the time:")
  675. local FirstWindow = select_table(InsertedWindowTable);
  676. if (FirstWindow != table.getn(InsertedWindowTable)) then
  677. local InsertedWindowIndex = DeleteTimeScroll.InsertWindow()["index"][FirstWindow];
  678.  
  679. say(string.format("You need to wait %s to enter into the %s...[ENTER]would you like to reset the time?", get_time_format(game.get_event_flag(""..data["dungeonTimerData"][InsertedWindowIndex]..""..ownPid.."")-get_time()), data["dungeonsName"][InsertedWindowIndex]))
  680. if (select("Da", "Nu") == 1) then
  681. say(string.format("Time was reseted succesfuly, now[ENTER]now you can enter again %s", data["dungeonsName"][InsertedWindowIndex]))
  682.  
  683. return game.set_event_flag(""..data["dungeonTimerData"][InsertedWindowIndex]..""..ownPid.."", 0), pc.remove_item(iNum, 1);
  684. end
  685. end
  686. end
  687.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement