Guest User

Quest purgatory

a guest
Aug 15th, 2015
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.36 KB | None | 0 0
  1. quest blazingpurgatory begin
  2.     state start begin
  3.         when 20394.chat."Les Gorges du Pugatoire" begin
  4.             say_title("Gardien du Purgatoire:")
  5.             say("Le Dieu de tous les démons, Razador, s'est")
  6.             say("réveillé, la fin de l'humanité est proche!")
  7.             say("Lutte, vaillant guerrier, avec l'aide de ton")
  8.             say("groupe pour sauver le monde de la")
  9.             say("destruction de ce nouveau mal !")
  10.             say("")
  11.             say("")
  12.             say("")
  13.             wait()
  14.             say_title("Gardien du Purgatoire:")
  15.             say("Pour accéder au Purgatoire vous devez")
  16.             say(" être au minimum lvl 90, être dans un")
  17.             say("groupe et que le chef demande à rejoindre les")
  18.             say("Gorges en ayant les")
  19.             say_reward("Larmes de Baljit-Elvedin dans son inventaire.")
  20.             say("")
  21.             say(" Êtes vous prêt à entrer dans les lieux ?")
  22.             say("")
  23.             say("")
  24.             wait()
  25.             say_title("Gardien du Purgatoire:")
  26.             if pc.get_level() < 100 then
  27.                 say("Désolé, le chef du groupe n'est pas lvl 100.")
  28.                 party.chat("Le chef du groupe doit être lvl 100.")
  29.                 return
  30.             end -- if
  31.             --if not party.is_party() then
  32.                 --say("Vous devez être dans un groupe pour rejoindre")
  33.                 --say("les Gorges du Purgatoire.")
  34.                 --return
  35.             --end
  36.             --if not party.is_leader() then
  37.                 --say("Amenez moi le chef de votre groupe...")
  38.                 --say("je vais lui transmettre ce que je sais.")
  39.                 --return
  40.             --end
  41.             if pc.count_item(30189) == 0 then
  42.                 say_reward("Il vous faut des larmes pour entrer") --- à modifier
  43.             else
  44.                 say("Parfait, vous avez toutes les qualitées pour")
  45.                 say("entrer, voulez vous essayer de vaincre Razador ?")
  46.                 local x = select("Oui !", "Non")
  47.                 if x == 2 then
  48.                     return
  49.                 elseif x == 1 then
  50.                     d.join(251) --- ID purgatoires: 235
  51.                 end
  52.             end
  53.         end
  54.  
  55.         when login with pc.get_map_index() == 251 begin
  56.          notice_all("Le groupe de "..pc.name.." s'engage dans l'antre de de Razador !")
  57.             say("L'instance est maintenant commencée.")
  58.             say("Que le combat commence !")
  59.             say("")
  60.             d.setf("temps", get_time()) --- Utilisé pour le temps à la fin de l'instance
  61.  
  62.             if party.is_party() then
  63.                 if party.is_leader() then
  64.                     blazingpurgatory.start()
  65.                 end
  66.             else
  67.                 if pc.is_gm() then
  68.                     blazingpurgatory.start()
  69.                 end
  70.             end
  71.         end
  72.          
  73.         function start()
  74.             d.regen_file("data/dungeon/blazingpurgatory/npc.txt")
  75.             d.setf("purgatory_gate_sequence",number(1,7))
  76.             local sequence = {{1,2,3,4,5,6},{4,1,3,2,5,6},{2,5,3,1,4,6},{3,1,6,2,4,5},{5,3,2,4,6,1},{6,1,5,2,4,3},{6,3,5,3,1,4}}  --- charge aléaoirement une de ces séquences, les étapes sont donc aléatoires
  77.             for i = 1, 6 do
  78.                 d.regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_"..sequence[d.getf('purgatory_gate_sequence')][i]..".txt") --- charge la regen correspondant à l'étape où on est
  79.             end
  80.             d.setf("actual_round",0)
  81.             d.setf("time", get_time()+60*60*1)
  82.             server_timer("purgatorytime",3600,pc.get_map_index())
  83.             server_loop_timer("purgatorytimenotice",300,pc.get_map_index())
  84.             blazingpurgatory.NoticeTime()
  85.         end            
  86.          
  87.         when purgatorytimenotice.server_timer begin
  88.             if d.select(get_server_timer_arg()) then
  89.                 blazingpurgatory.NoticeTime()
  90.             end
  91.         end
  92.  
  93.         when purgatorytime.server_timer begin
  94.             if d.select(get_server_timer_arg()) then
  95.                 d.notice("Le temps est écoulé ! ")
  96.                 d.exit_all()
  97.             end
  98.         end
  99.          
  100.         when 20385.click with pc.get_map_index() == 251 and d.getf("block_altar") == 0 begin
  101.             if d.getf("purgatory_level") == 7 then
  102.                 d.setf("block_altar",1)
  103.                 d.setf("actual_round",7)
  104.                 d.notice("Vous pensiez que c'était fini ?!")
  105.                 d.notice("NON !")
  106.                 d.notice("Vous allez maintenant rejoindre Razador.") --- boss
  107.                 timer("warp_to_boss",5)
  108.             else
  109.                      
  110.                 d.setf("purgatory_level",d.getf("purgatory_level")+1)
  111.                 blazingpurgatory.purge()
  112.                 blazingpurgatory.LoadStage()
  113.                 d.setf("block_altar",1)
  114.                  
  115.                 blazingpurgatory.NoticeTime()
  116.                 d.notice("Un nouvel étage est maintenant ouvert!")
  117.             end
  118.         end
  119.  
  120.         when warp_to_boss.timer begin
  121.             d.jump_all(8111,6864) --- coordonnées de la salle du boss, laisser comme tel
  122.             d.notice("Razador:")
  123.             d.notice("Inutile de me résister, vous allez périr !")
  124.             d.set_regen_file("data/dungeon/flame_dungeon/fd_fild_boss.txt")
  125.             blazingpurgatory.NoticeTime()
  126.         end    
  127.        
  128.         when 6091.kill with pc.get_map_index() == 251 begin --- ID map
  129.             temps = get_time() - d.getf("temps") --- Prend le temps à partir du moment que "temps" est activé (début de l'instance)
  130.             sec = math.mod(temps, 60)
  131.             min = (temps-sec)/60
  132.             notice_all("Le groupe de "..pc.name.." a terminé les Gorges du Purgatoire en "..min.." minutes et "..sec.." secondes !")
  133.             d.notice("Vous serez téléporté hors du donjon dans 1 minute !")
  134.             timer("purgatoires_fin", 60) --- temps en secondes avant de sortir de l'instance
  135.         end
  136.        
  137.         when purgatoires_fin.timer begin --- Au bout de 60 secondes téléporte tout le monde hors de l'instance
  138.             d.exit_all()
  139.         end
  140.          
  141.         when kill with pc.get_map_index() == 251 begin
  142.             if d.getf("actual_round") == 1 or d.getf("actual_round") == 3 then
  143.                 d.setf("kill_count_bp1",d.getf("kill_count_bp1") +1)
  144.                 if d.getf("kill_count_bp1") == d.getf("bp_kill_to_next") then --- il faut tuer 241 mobs
  145.                     d.notice("Retournez au près des Gorges d'Am-Heh au centre de la map!")
  146.                     blazingpurgatory.purge()
  147.                 end
  148.             elseif d.getf("actual_round") == 2 or d.getf("actual_round") == 5 then
  149.                 d.setf("kill_count_bp",d.getf("kill_count_bp") +1)
  150.                 if d.getf("kill_count_bp") == d.getf("kill_to_drop_key") then --- au bout de 50 kill on drop une clé
  151.                     game.drop_item_with_ownership(50084,1)
  152.                     d.setf("kill_count_bp",0)
  153.                 end
  154.             elseif d.getf("actual_round") == 4 and npc.get_race() == 6009 then --- on kill un mini boss
  155.                 if number(1,5) == 1 then
  156.                     d.notice("Retournez au près des Gorges d'Am-Heh au centre de la map!")
  157.                     blazingpurgatory.purge()
  158.                 end
  159.             elseif d.getf("actual_round") == 6 and npc.get_race() == 8057 then --- on kill une metin
  160.                 d.notice("Retournez au près des Gorges d'Am-Heh au centre de la map!")
  161.                 blazingpurgatory.purge()    
  162.             elseif d.getf("actual_round") == 7 and npc.get_race() == 6091 then --- on kill le boss
  163.                 d.notice("Razador est mort !")
  164.                 d.clear_regen()
  165.                 d.kill_all()
  166.             end
  167.         end
  168.  
  169.         when 20081.take with pc.get_map_index() == 251  begin --- on pose l'item 50084 sur un pillier (clé dropée précédemment)
  170.             if item.get_vnum() == 50084 then
  171.                 if d.getf("actual_round") == 2 then
  172.                     pc.remove_item(item.get_vnum(),1)
  173.                     if number(1,8) == 1 then
  174.                         npc.purge()
  175.                         d.notice("Retournez au près des Gorges d'Am-Heh au centre de la map!")
  176.                         blazingpurgatory.purge()
  177.                     else
  178.                         syschat("Cette pierre d'ouverture est endommagée!")
  179.                         syschat("Trouvez en une autre !")
  180.                     end
  181.                 elseif d.getf("actual_round") == 5 then
  182.                     local sequence = {{1,2,3,4,5,5},{4,3,2,1,5,5},{4,5,3,1,2,2},{5,3,4,2,1,1},{5,1,3,4,2,2}}
  183.                     if blazingpurgatory.GetPillarID() == sequence[d.getf("sequence")][d.getf("pillarcount")] then
  184.                         pc.remove_item(item.get_vnum(),1)
  185.                         npc.purge()
  186.                         d.setf("pillarcount", d.getf("pillarcount")+1)
  187.                         if d.getf("pillarcount") == 6 then
  188.                             d.notice("Retournez au près des Gorges d'Am-Heh au centre de la map!")
  189.                             blazingpurgatory.purge()
  190.                         else
  191.                             d.notice("Continuez comme ça, il reste "..6-d.getf("pillarcount").." pilliers à ouvrir !")
  192.                         end
  193.                     elseif blazingpurgatory.GetPillarID() == false then
  194.                         syschat("Rapprochez vous du pillier !") --- Pas sûr de cette traduction
  195.                     elseif blazingpurgatory.GetPillarID() != sequence[d.getf("sequence")][d.getf("pillarcount")] then
  196.                         pc.remove_item(item.get_vnum(),1)
  197.                         syschat("Cet item ne fonctionne pas!")
  198.                     end
  199.                 end
  200.             end
  201.         end
  202.                      
  203.         function LoadStage() --- gère chaque étape et les regen
  204.             if d.getf("actual_round") == 1 then -- Alle Monster tötenw
  205.                 d.regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_1.txt")
  206.                 d.setf("bp_kill_to_next",230)
  207.                 d.setf("kill_count_bp1",0)
  208.             elseif d.getf("actual_round") == 2 then
  209.                 d.set_regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_2.txt")
  210.                 d.setf("kill_to_drop_key",50)
  211.                 d.spawn_mob(20081,195,352)
  212.             elseif d.getf("actual_round") == 3 then
  213.                 d.regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_3.txt")
  214.                 d.setf("bp_kill_to_next",230)
  215.                 d.setf("kill_count_bp1",0)
  216.             elseif d.getf("actual_round") == 4 then
  217.                 d.set_regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_4.txt")
  218.             elseif d.getf("actual_round") == 5 then
  219.                 d.set_regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_5.txt")
  220.                 local sequence = {{1,2,3,4,5},{4,3,2,1,5},{4,5,3,1,2},{5,3,4,2,1},{5,1,3,4,2}}
  221.                 local n = number(1,5)
  222.                 local coords = {{502,354},{517,354},{487,354},{502,339},{502,369}}
  223.                 for i = 1, 5 do
  224.                     d.spawn_mob(20081, coords[i][1],coords[i][2])
  225.                 end
  226.                 d.setf("pillarcount", 1)
  227.                 d.setf("sequence",n)
  228.                 d.setf("kill_to_drop_key",100)
  229.             elseif d.getf("actual_round") == 6 then
  230.                 d.set_regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_6.txt")
  231.                 d.spawn_mob(8057,507,489)
  232.             end
  233.         end    
  234.  
  235.         function purge() --- purge tout puis remet les PNJ en place
  236.             d.setf("block_altar",0)
  237.             d.clear_regen()
  238.             d.kill_all()
  239.             blazingpurgatory.LoadGates()
  240.             d.regen_file("data/dungeon/flame_dungeon/npc.txt")
  241.             if d.getf("purgatory_level") == 6 then
  242.                 d.setf("purgatory_level",7)
  243.             end
  244.         end        
  245.  
  246.         function LoadGates()
  247.             local sequence = {{1,2,3,4,5,6},{4,1,3,2,5,6},{2,5,3,1,4,6},{3,1,6,2,4,5},{5,3,2,4,6,1},{6,1,5,2,4,3},{6,3,5,3,1,4}}
  248.             for i = 1, 6-d.getf("purgatory_level") do
  249.                 d.regen_file("data/dungeon/flame_dungeon/blazingpurgatory_gate_"..sequence[d.getf("purgatory_gate_sequence")][i]..".txt")
  250.             end
  251.             d.setf("actual_round",sequence[d.getf("purgatory_gate_sequence")][7-d.getf("purgatory_level")])
  252.         end        
  253.          
  254.         function NoticeTime()
  255.             local secondsLeft = (d.getf("time") - get_time())
  256.             local minutesLeft = math.ceil(secondsLeft / 60)
  257.             d.notice("Il reste "..minutesLeft.." minute(s) !")
  258.         end
  259.  
  260.         function GetPillarID()
  261.             if pc.get_local_x() >= 502 - 5 and pc.get_local_x() <= 502 + 5 and pc.get_local_y() >= 354 - 5 and pc.get_local_y() <= 354 + 5 then
  262.                 return 1
  263.             elseif pc.get_local_x() >= 517 - 5 and pc.get_local_x() <= 517 + 5 and pc.get_local_y() >= 354 - 5 and pc.get_local_y() <= 354 + 5 then
  264.                 return 2
  265.             elseif pc.get_local_x() >= 487 - 5 and pc.get_local_x() <= 487 + 5 and pc.get_local_y() >= 354 - 5 and pc.get_local_y() <= 354 + 5 then
  266.                 return 3
  267.             elseif pc.get_local_x() >= 502 - 5 and pc.get_local_x() <= 502 + 5 and pc.get_local_y() >= 339 - 5 and pc.get_local_y() <= 339 + 5 then
  268.                 return 4
  269.             elseif pc.get_local_x() >= 502 - 5 and pc.get_local_x() <= 502 + 5 and pc.get_local_y() >= 369 - 5 and pc.get_local_y() <= 369 + 5 then
  270.                 return 5
  271.             else
  272.                 return false
  273.             end
  274.         end    
  275.     end
  276. end
Advertisement
Add Comment
Please, Sign In to add comment