Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.34 KB | None | 0 0
  1. quest deviltower_zone begin
  2.     state start begin
  3.         when login begin
  4.             if pc.get_map_index() == 66 then
  5.                 if pc.get_x() < 2048+88 or pc.get_y() < 6656+577 or pc.get_x() > 2048+236 or pc.get_y() > 6656+737 then
  6.                     pc.warp(590500, 110500)
  7.                 end
  8.                 pc.set_warp_location(65, 5905, 1105)
  9.             elseif pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 then
  10.                 pc.set_warp_location(65, 5905, 1105)               
  11.                 deviltower_zone.register_player(pc.get_vid())
  12.             end
  13.         end
  14.  
  15.     when logout begin
  16.         if pc.count_item(30300) >= 1 then
  17.             pc.remove_item(30300, pc.count_item(30300))
  18.         end
  19.         if pc.count_item(30302) >= 1 then
  20.             pc.remove_item(30302, pc.count_item(30302))
  21.         end            
  22.         if pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 then
  23.             deviltower_zone.unregister_player(pc.get_vid())    
  24.         end
  25.     end
  26.     when deviltower_man.chat."Wieża Demonów Lv.40+" begin
  27.                 if pc.get_level() < 40 then
  28.                         say_blekit("Strażnik Wieży Demonów:")
  29.                         say_cialo("")
  30.                         say_cialo("Ta wieża jest wypełniona demonami.")
  31.                         say_cialo("Tylko najsilniejsi dojdą na szczyt wieży.")
  32.                         say_cialo("Pamiętaj, każdy kto próbował przejść ")
  33.                         say_cialo("wieżę nie wrócił na dół żywy.")
  34.                         say_cialo("Nie możesz wejść do wieży")
  35.                         say_cialo("ponieważ nie osiągnąłeś 40 poziomu.")
  36.                 else
  37.                         say_blekit("Strażnik Wieży Demonów:")
  38.                         say_cialo("")
  39.                         say_cialo("Ta wieża jest wypełniona demonami.")
  40.                         say_cialo("Tylko najsilniejsi dojdą na szczyt wieży.")
  41.                         say_cialo("Pamiętaj, każdy kto próbował przejść ")
  42.                         say_cialo("wieżę nie wrócił na dół żywy.")
  43.                         say_cialo("Czy nadal chcesz wejść do wieży?")
  44.                         say_cialo("")
  45.                         local s = select("Wchodzę.", "Anuluj.")
  46.                         if s == 1 then
  47.                                 pc.warp(216500,727000)
  48.                         end
  49.             end
  50.         end
  51.         when devil_stone1.kill begin
  52.             timer("devil_stone1_1", 8)
  53.         end
  54.         when devil_stone1_1.timer begin
  55.             d.new_jump_all(66, special.devil_tower[1][1], special.devil_tower[1][2])
  56.             d.regen_file("data/dungeon/deviltower2_regen.txt")
  57.             d.set_warp_at_eliminate(4, d.get_map_index(), special.devil_tower[2][1], special.devil_tower[2][2], "data/dungeon/deviltower3_regen.txt")
  58.         end
  59.         when devil_stone3.kill begin
  60.             d.set_warp_at_eliminate(4, d.get_map_index(), special.devil_tower[3][1], special.devil_tower[3][2], "data/dungeon/deviltower4_regen.txt")
  61.             d.check_eliminated()
  62.         end
  63.         function get_4floor_stone_pos()
  64.         local positions =
  65.             {
  66.                 {368, 629}, {419, 630}, {428, 653}, {422, 679},
  67.                 {395, 689}, {369, 679}, {361, 658},
  68.             }
  69.             for i = 1, 6 do
  70.                 local j = number(i, 7)
  71.                 if i != j then
  72.                     local t = positions[i];
  73.                     positions[i] = positions[j];
  74.                     positions[j] = t;
  75.                 end
  76.             end
  77.             return positions
  78.         end
  79.         when 8016.kill with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  80.             d.setf("level", 4)
  81.             local positions = deviltower_zone.get_4floor_stone_pos()
  82.             for i = 1, 6 do
  83.                 d.set_unique("fake" .. i , d.spawn_mob(8017, positions[i][1], positions[i][2]))
  84.             end
  85.             local vid = d.spawn_mob(8017, positions[7][1], positions[7][2])
  86.             d.set_unique("real", vid)
  87.         server_loop_timer('devil_stone4_update', 10, pc.get_map_index())
  88.         server_timer('devil_stone4_fail1', 15*60, pc.get_map_index())
  89.  
  90.             d.notice("Przybyłeś do Bramy Wyboru na 4 piętrze.");
  91.             d.notice("Znajduje się tu wiele fałszywych metinów.");
  92.             d.notice("Masz 15 minut na znalezienie prawdziwego metina.");
  93.             d.notice("To jedyna droga na górę.");
  94.         end
  95.  
  96.         when devil_stone4_fail1.server_timer begin
  97.             if d.select(get_server_timer_arg()) then
  98.                 d.notice("Pozostało minut: 10")
  99.         server_timer('devil_stone4_fail2', 10*60, get_server_timer_arg())
  100.             end
  101.         end
  102.  
  103.         when devil_stone4_fail2.server_timer begin
  104.             if d.select(get_server_timer_arg()) then
  105.                 d.notice("Pozostało minut: 5")
  106.         server_timer('devil_stone4_fail', 5*60, get_server_timer_arg())
  107.             end
  108.         end
  109.  
  110.         when devil_stone4_fail.server_timer begin
  111.             if d.select(get_server_timer_arg()) and d.getf("level") == 4 then
  112.                 d.notice("Czas się skończył...")
  113.                 d.exit_all()
  114.             end
  115.         end
  116.  
  117.         when devil_stone4_update.server_timer begin
  118.             if d.select(get_server_timer_arg()) then
  119.                 if not d.is_unique_dead("real") then
  120.                     for i = 1, 6 do
  121.                         if d.getf("fakedead" .. i) == 0 then
  122.                             if d.unique_get_hp_perc("fake" .. i) < 50 then
  123.                                 d.purge_unique("fake" .. i)
  124.                                 d.setf("fakedead" .. i, 1)
  125.                                 d.notice("Ten metin jest fałszywy...");
  126.                             end
  127.                         end
  128.                     end
  129.                 else
  130.                     server_timer("devil_stone4_end", 5, get_server_timer_arg())
  131.                    
  132.                     d.notice("Poradziłeś sobie, posiadasz bardzo dobry instynkt.");
  133.                     d.notice("Zniszczyłeś prawdziwy kamień metin.")
  134.                     d.purge()
  135.                 end
  136.             else
  137.         server_timer('devil_stone4_stop_timer', 1, get_server_timer_arg())
  138.             end
  139.         end
  140.  
  141.         when devil_stone4_stop_timer.server_timer begin
  142.         clear_server_timer('devil_stone4_update', get_server_timer_arg())
  143.         end
  144.  
  145.         when devil_stone4_end.server_timer begin
  146.             if d.select(get_server_timer_arg()) then
  147.             clear_server_timer('devil_stone4_update', get_server_timer_arg())
  148.             clear_server_timer('devil_stone4_fail1', get_server_timer_arg())
  149.             clear_server_timer('devil_stone4_fail2', get_server_timer_arg())
  150.             clear_server_timer('devil_stone4_fail', get_server_timer_arg())
  151.  
  152.                 d.setf("level", 5)
  153.                 d.setf("stone_count", 5)
  154.                
  155.                 d.jump_all(special.devil_tower[4][1], special.devil_tower[4][2])
  156.                 d.notice("Przybyłeś do Magicznej Bramy na 5 piętrze.")
  157.                 d.notice("Zabijaj potwory aby zdobyć Pieczęć Otwarcia,")
  158.                 d.notice("następnie używaj jej do otwarcia Pieczęci.")
  159.                 d.notice("Otwórz wszystkie 5 pieczęci aby przejść dalej!")
  160.                 d.notice("Masz 20 minut!")
  161.                
  162.         server_timer('devil_stone5_fail1', 20*60, get_server_timer_arg())
  163.         clear_server_timer('devil_stone4_update', get_server_timer_arg())
  164.  
  165.                 d.set_regen_file("data/dungeon/deviltower5_regen.txt")
  166.  
  167.                 d.spawn_mob(20073, 421, 452)
  168.                 d.spawn_mob(20073, 380, 460)
  169.                 d.spawn_mob(20073, 428, 414)
  170.                 d.spawn_mob(20073, 398, 392)
  171.                 d.spawn_mob(20073, 359, 426)
  172.             end
  173.         end
  174.         when devil_stone5_fail1.server_timer begin
  175.             if d.select(get_server_timer_arg()) then
  176.                 d.notice("Pozostało minut: 15")
  177.         server_timer('devil_stone5_fail2', 15*60, get_server_timer_arg())
  178.             end
  179.         end
  180.  
  181.         when devil_stone5_fail2.server_timer begin
  182.             if d.select(get_server_timer_arg()) then
  183.                 d.notice("Pozostało minut: 10")
  184.         server_timer('devil_stone5_fail3', 10*60, get_server_timer_arg())
  185.             end
  186.         end
  187.  
  188.         when devil_stone5_fail3.server_timer begin
  189.             if d.select(get_server_timer_arg()) then
  190.                 d.notice("Pozostało minut: 5")
  191.         server_timer('devil_stone5_fail', 5*60, get_server_timer_arg())
  192.             end
  193.         end
  194.  
  195.         when devil_stone5_fail.server_timer begin
  196.             if d.select(get_server_timer_arg()) and d.getf("level") == 5 then
  197.         d.notice("Czas się skończył...")
  198.         d.exit_all()
  199.             end
  200.         end
  201.  
  202.         when 1062.kill with pc.in_dungeon() and d.getf("level") == 5 begin
  203.             local KILL_COUNT_FOR_DROP_KEY = 50
  204.             local n =d.getf("count") + 1
  205.             d.setf("count", n)
  206.             if n == KILL_COUNT_FOR_DROP_KEY then
  207.                 game.drop_item(50084, 1)
  208.                 d.setf("count", 0)
  209.             end
  210.         end
  211.         when devil_stone5.take with item.vnum == 50084 begin
  212.             npc.purge()
  213.             item.remove()
  214.             d.setf("stone_count", d.getf("stone_count") - 1)
  215.             if d.getf("stone_count") <= 0 then
  216.                 d.clear_regen()
  217.                 d.kill_all()
  218.                 d.notice("Otwarłeś wszystkie Pieczęci.")
  219.                 d.notice("Przechodzisz na 6 piętro!")
  220.  
  221.         clear_server_timer('devil_stone5_fail1', get_server_timer_arg())
  222.         clear_server_timer('devil_stone5_fail2', get_server_timer_arg())
  223.         clear_server_timer('devil_stone5_fail3', get_server_timer_arg())
  224.         clear_server_timer('devil_stone5_fail', get_server_timer_arg())
  225.        
  226.                 d.setf("level", 6)
  227.                 d.jump_all(special.devil_tower[5][1], special.devil_tower[5][2])
  228.         d.regen_file("data/dungeon/deviltower6_regen.txt")
  229.        
  230.                 d.notice("Zabij wszystkie potwory z piętra 6,")
  231.                 d.notice("następnie zabij Króla!")
  232.  
  233.             else
  234.                 d.notice("Pieczęć otwarta! Pozostało "..d.getf("stone_count").." pieczęci.")
  235.             end
  236.         end
  237.  
  238.         when devil_stone6.kill begin
  239.             d.kill_all()
  240.             d.check_eliminated()
  241.             local reward_alchemist = {20074, 20075, 20076}
  242.             d.spawn_mob(reward_alchemist[number(1,3)], 425, 216);
  243.             d.setqf("can_refine", 1)
  244.         end
  245.  
  246.    
  247.     when 20074.chat."Przejdź na 7 piętro" with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 and npc.lock() begin
  248.           say_blekit(""..mob_name(20074)..":")
  249.           say_cialo("")
  250.           say_cialo("Znalazłeś drogę na 7 piętro.")
  251.           say_cialo("Musisz posiadać duże umiejętności aby tam iść.")
  252.           say_cialo("Hmmmm...")
  253.           wait()
  254.           if pc.level >=75 then
  255.           say_blekit(""..mob_name(20074)..":")
  256.           say_cialo("")
  257.               say_cialo("Jesteś wystarczająco silny.")
  258.               say_cialo("Zaraz zaprowadzę cię na 7 piętro..")
  259.               timer("devil_jump_7", 6)
  260.               npc.unlock()
  261.               d.purge()
  262.               return
  263.           end
  264.           say_blekit(""..mob_name(20074)..":")
  265.           say_cialo("")
  266.           say_cialo("Niestety twoje umiejętności są zbyt słabe.")
  267.           say_cialo("Wróć gdy będziesz bardziej doświadczony.")
  268.  
  269.         say_cialo("")
  270.         wait()
  271.         pc.warp(590500, 110500)
  272.     return
  273.         end
  274.     when 20075.chat."Przejdź na 7 piętro" with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 and npc.lock() begin
  275.           say_blekit(""..mob_name(20074)..":")
  276.           say_cialo("")
  277.           say_cialo("Znalazłeś drogę na 7 piętro.")
  278.           say_cialo("Musisz posiadać duże umiejętności aby tam iść.")
  279.           say_cialo("Hmmmm...")
  280.           wait()
  281.           if pc.level >=75 then
  282.           say_blekit(""..mob_name(20074)..":")
  283.           say_cialo("")
  284.               say_cialo("Jesteś wystarczająco silny.")
  285.               say_cialo("Zaraz zaprowadzę cię na 7 piętro..")
  286.               timer("devil_jump_7", 6)
  287.               npc.unlock()
  288.               d.purge()
  289.               return
  290.           end
  291.           say_blekit(""..mob_name(20074)..":")
  292.           say_cialo("")
  293.           say_cialo("Niestety twoje umiejętności są zbyt słabe.")
  294.           say_cialo("Wróć gdy będziesz bardziej doświadczony.")
  295.  
  296.         say_cialo("")
  297.         wait()
  298.         pc.warp(590500, 110500)
  299.     return
  300.         end
  301.     when 20076.chat."Przejdź na 7 piętro" with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 and npc.lock() begin
  302.           say_blekit(""..mob_name(20074)..":")
  303.           say_cialo("")
  304.           say_cialo("Znalazłeś drogę na 7 piętro.")
  305.           say_cialo("Musisz posiadać duże umiejętności aby tam iść.")
  306.           say_cialo("Hmmmm...")
  307.           wait()
  308.           if pc.level >=75 then
  309.           say_blekit(""..mob_name(20074)..":")
  310.           say_cialo("")
  311.               say_cialo("Jesteś wystarczająco silny.")
  312.               say_cialo("Zaraz zaprowadzę cię na 7 piętro..")
  313.               timer("devil_jump_7", 6)
  314.               npc.unlock()
  315.               d.purge()
  316.               return
  317.           end
  318.           say_blekit(""..mob_name(20074)..":")
  319.           say_cialo("")
  320.           say_cialo("Niestety twoje umiejętności są zbyt słabe.")
  321.           say_cialo("Wróć gdy będziesz bardziej doświadczony.")
  322.  
  323.         say_cialo("")
  324.         wait()
  325.         pc.warp(590500, 110500)
  326.     return
  327.         end
  328.  
  329.    when devil_jump_7.timer begin
  330.         d.clear_regen()
  331.  
  332.         d.spawn_mob(8018, 639, 658)
  333.         d.spawn_mob(8018, 611, 637)
  334.         d.spawn_mob(8018, 596, 674)
  335.         d.spawn_mob(8018, 629, 670)
  336.  
  337.         d.setf("level", 7)
  338.  
  339.         d.jump_all(2048+590, 6656+638)
  340.     end
  341.    
  342.     when 8018.kill with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  343.         local cont = d.getf("7_stone_kill") + 1
  344.         d.setf("7_stone_kill", cont)
  345.  
  346.         if cont >= 4 then
  347.             d.setf("7_stone_kill", 0)
  348.             d.set_regen_file("data/dungeon/deviltower7_regen.txt")
  349.         end
  350.     end
  351.  
  352.     when 8019.kill with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  353.         game.drop_item(30300, 1)
  354.     end
  355.  
  356.     when 30300.use with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  357.         pc.remove_item("30300", 1)
  358.  
  359.         local pct = number(1,8)
  360.  
  361.         if pct == 1 then
  362.             game.drop_item(30302, 1)
  363.             d.clear_regen()
  364.         else
  365.             game.drop_item(30301, 1)
  366.            
  367.         end
  368.     end
  369.  
  370.     when 30302.use with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  371.             if d.getf( "level" ) != 7 then
  372.                 pc.remove_item( "30302", 1)
  373.                 return
  374.             end
  375.            
  376.         say_cialo("Zostaniesz przeniesiony na 8 piętro!")
  377.         pc.remove_item("30302", 1)
  378.         timer("devil_jump_8", 6)
  379.         d.clear_regen()
  380.     end
  381.                        
  382.     --------------------------------------------
  383.     -- 8Ăţ ÁřŔÔşÎĹÍ 9Ăţ ±îÁö
  384.     --------------------------------------------
  385.     when devil_jump_8.timer begin
  386.         d.setf("level", 8)
  387.         d.jump_all(2048+590, 6656+403)
  388.         d.set_regen_file("data/dungeon/deviltower8_regen.txt")
  389.         d.spawn_mob(20366, 640, 460)
  390.         local _count = pc.count_item(30302)
  391.         pc.remove_item(30302,_count)
  392.        
  393.     end
  394.  
  395.     when 1040.kill with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  396.         if d.getf("level") < 9 then
  397.             local pct1 = number(1, 10)
  398.             if pct1 == 1 then
  399.                 local pct2 = number(1, 4)
  400.                 if pct2 == 1 then
  401.                     -- ÁřÂĄ ż­Ľč µĺ·Ó
  402.                     game.drop_item(30304, 1)
  403.                 else
  404.                     -- °ˇÂĄ ż­Ľč µĺ·Ó
  405.                     game.drop_item(30303, 1)
  406.                 end
  407.             else
  408.                 return
  409.             end
  410.         end
  411.     end
  412.  
  413.     when 20366.take with item.vnum == 30304 begin
  414.         -- şŔŔÎ ÇŘĂĽ 9Ăţ ¤ˇ¤ˇ
  415.         npc.purge()
  416.         item.remove()
  417.         timer("devil_jump_9", 8)
  418.     end
  419.  
  420.     ---------------------------------------------
  421.     -- 9Ăţ ÁřŔÔşÎĹÍ żĎ·á±îÁö
  422.     ---------------------------------------------
  423.     when devil_jump_9.timer begin
  424.         d.setf("level", 9)
  425.         d.jump_all(2048+590, 6656+155)
  426.         d.regen_file("data/dungeon/deviltower9_regen.txt")
  427.     end
  428.  
  429.     when 1093.kill with pc.in_dungeon() and pc.get_map_index() >= 660000 and pc.get_map_index() < 670000 begin
  430.         d.kill_all()
  431.         timer("devil_end_jump", 30)
  432.     end
  433.  
  434.     when devil_end_jump.timer begin
  435.         d.exit_all()
  436.     end
  437.     function register_player(vid)
  438.         local player_count = d.getf("player_count")
  439.         player_count = player_count + 1
  440.         d.setf("player_count", tonumber(player_count))
  441.         d.setf(string.format("player%d", player_count), tonumber(vid))
  442.     end
  443.     function unregister_player(vid)
  444.         local player_count = d.getf("player_count")
  445.         local found = false
  446.         for i = 1, player_count, 1 do
  447.             if found == true then
  448.                 d.setf(string.format("player%d", tonumber(i)), d.getf(string.format("player%d", i+1)))
  449.             end
  450.             p = d.getf("player"..tostring(i))
  451.             if p == vid then
  452.                 i = i -1
  453.                 found = true
  454.             end
  455.         end
  456.         if found == true then
  457.             d.setf("player_count", tonumber(player_count - 1))
  458.         end
  459.     end
  460.     function get_players()
  461.         local players = {}
  462.         local player_count = d.getf("player_count")
  463.         for i = 1, player_count, 1 do
  464.             players[i] = d.getf("player"..tostring(i))
  465.         end
  466.         return players
  467.     end
  468.     function give_dc_access(pindex)
  469.         local self_checked = false
  470.         local self = pc.select(d.getf("player"..tostring(pindex)))
  471.         --pc.setqf("dcenter", 1)
  472.         pc.setf("deviltower_zone", "dcenter", 1)
  473.         pc.select(self)
  474.     end
  475. end
  476. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement