Code:
quest minasmorgul begin state start begin when login begin send_letter("minasmorgul") end when button or info begin local s = select(1,2,3,4,5,6,"Abbrechen") if s == 7 then return else local coords = {{9031,9033},{9100,9531},{11161,11463},{11289,12071},{16801,17077},{16738,17943}} pc.warp(coords[s][1]*100,coords[s][2]*100) end end when 20377.chat."Die Stunde der Abrechnung!" with pc.get_map_index() == 150 begin say_title("Admiral Chuong") say("Es ist nun soweit die Stunde der Abrechnung") say("hat begonnen, wir werden den Zerstörer der") say("Welten stellen und vernichten!") say("") wait() say_title("Admiral Chuong") say("Es wird nicht leicht werden den Flammenschlund") say("zu erreichen, denn wir müssen uns durch Minas Morgul") say("die Eiskrone und dann durch die horden der Legion") say("schlagen!") say("") if pc.is_party_and_leader_or_no_party_and_gm() then wait() say_title("Admiral Chuong") say_reward("Werdet ihr uns im Kampf unterstützen?") if select("Ja, auf in die Schlacht!","Nein") == 1 then say_title("Admiral Chuong") say("So möge es sein, die Schlacht um die Freiheit") say("dieser Welt hat soeben begonnen!") say("") timer("start_first",5) end end end -------------------------------------------------------------------------------------- -- Login-Events ---------------------------------------------------------------------- -------------------------------------------------------------------------------------- when login with pc.is_in_dungeon(150) begin if pc.is_party_and_leader_or_no_party_and_gm() then party.setf("hour_of_revenge",pc.get_map_index()) --d.set_regen_file() -- NPC's --d.set_regen_file() -- Mobs d.set_unique("boss1",d.spawn_mob(3291,239,643)) minasmorgul.SpawnStones() --server_timer("close_morgulrun",time_min_to_sec(60),pc.get_map_index()) --server_loop_timer("notice_morgultime",time_min_to_sec(5),pc.get_map_index()) server_loop_timer("check_tp_from_boss_one",5,pc.get_map_index()) timer("notice_message_from_first_boss",3) for i = 1, 150 do d.spawn_mob(number(4501,4503),number(287,387),number(627,662)) end for i = 1, 150 do d.spawn_mob(number(4501,4503),number(400,500),number(627,662)) end for i = 1, 150 do d.spawn_mob(number(4501,4503),number(500,600),number(627,662)) end for i = 1, 150 do d.spawn_mob(number(4501,4503),number(600,750),number(627,662)) end for i = 1, 100 do d.spawn_mob(number(4501,4503),number(788,536),number(519,615)) end for i = 1, 150 do d.spawn_mob(number(4501,4503),number(837,875),number(224,344)) end end end when login with pc.is_in_dungeon(151) begin if pc.is_party_and_leader_or_no_party_and_gm() then party.setf("hour_of_revenge",pc.get_map_index()) d.setf("stage3_tree_mobs",20) d.setf("stage3_tree_boss",5) d.setf("stage3_count",1) minasmorgul.create_regen_for_stage3(1) party.setf("morgul_level",1) end end when login with pc.is_in_dungeon(154) begin if pc.is_party_and_leader_or_no_party_and_gm() then party.setf("hour_of_revenge",pc.get_map_index()) party.setf("morgul_level",1) d.notice("Admiral Chuong") d.notice("Wir müssen den Metin der Niedertracht finden und zerstören!") d.notice("Wenn ihr ihn zerstört habt werdet ihr mitsicherheit die Aufmerksamkeit") d.notice("des Gnoll-Lords auf euch ziehen! Seit vorsichtig!") d.set_unique("chuong",d.spawn_mob(20377,135,406)) local coords = { {435,409},{540,483},{591,417},{716,469},{757,389},{830,406},{1006,410},{966,496},{906,495},{1138,407},{1194,485},{1272,366},{1203,274}, {1064,203},{948,220},{838,341},{742,245},{608,208},{275,200},{460,311},{358,570},{529,488},{711,605},{812,608},{990,588},{1169,556} } local zufall = number(1,table.getn(coords)) d.spawn_mob(8056,coords[zufall][1],coords[zufall][2]) if pc.is_gm() then d.notice(coords[zufall][1]..","..coords[zufall][2]) end end end -------------------------------------------------------------------------------------- -- Kill-Events ---------------------------------------------------------------------- -------------------------------------------------------------------------------------- when kill with pc.is_in_dungeon(150) begin if npc.get_race() == 8051 then if minasmorgul.GetPos() == d.getf("morgulstone_boss") then d.setf("morgulstone_boss",0) d.set_unique("boss1",d.spawn_mob(3291,pc.get_local_x()+number(10,15),pc.get_local_y()+number(10,15))) d.setf("morgulstone_count",d.getf("morgulstone_count")-1) end elseif npc.get_race() == 3291 then d.notice("Martyaxwar") d.notice("Ich habe versagt Meister! Doch ihr werdet soweiso nie zum Weltenbrecher kommen...") timer("warp_to_stage2",5) d.notice("warp_to_stage2.timer start") end end when kill with pc.is_in_dungeon(151) begin if npc.get_race() == 3901 then d.setf("stage3_tree_kill_count",d.getf("stage3_tree_kill_count")+1) if d.getf("stage3_tree_kill_count") == d.getf("stage3_tree_needkills") then d.setf("stage3_tree_kill_count",0) d.setf("stage3_tree_needkills",0) timer("stage3_warp_to_next",5) d.kill_all() end elseif npc.get_race() >= 3001 and npc.get_race() <= 3005 then d.setf("stage4_gnoll_kill_count",d.getf("stage4_gnoll_kill_count")+1) --d.notice("count "..d.getf("stage4_gnoll_kill_count")) if d.getf("stage4_gnoll_kill_count") == d.getf("gnollcounter") then --d.notice("complete") d.setf("invasion_count",d.getf("invasion_count")+1) --d.notice("invasion "..d.getf("invasion_count")) if d.getf("invasion_count") == 5 then d.notice("Admiral Chuong") d.notice("Gute Arbeit! Das Lager ist gesichert, nun können wir weiter...") timer("warp_to_stage4",10) else d.setf("stage4_gnoll_kill_count",0) server_timer("spawn_new_gnolls",10,pc.get_map_index()) --d.notice("spawn_new_gnolls.server_timer startet") end end end end when kill with pc.is_in_dungeon(154) begin if npc.get_race() == 8056 then d.notice("Gnoll-Lord") d.notice("Ihr habt euch gut geschlagen, doch jetzt ist es vorbei! Undzwar endgültig der Kataklysmus hat begonnen!") --d.notice("change_environment") for i = 1, 50 do d.spawn_mob(number(3001,3005),number(1343,1382),number(423,458)) end for i = 1, 10 do d.spawn_mob(3901,number(1343,1382),number(423,458)) end for i = 1, 70 do d.spawn_mob(number(3201,2205),number(1343,1382),number(423,458)) end d.spawn_mob(3091,1350,442) elseif npc.get_race() == 3091 then d.kill_all() d.spawn_mob(20377,1350,442) d.notice("Admiral Chuong") d.notice("Jetzt können wir Rakshasa herausfordern und danach zur Eiskrone!") d.notice("Wir müssen uns nun aber beeilen bevor der Kataklysmus unsere Welt zerstört...") d.spawn_goto_mob(1392,443,72,1277) d.set_unique("rakshasa",d.spawn_mob(3290,385,1277)) server_loop_timer("controll_raks_tp",5,pc.get_map_index()) elseif npc.get_race() == 3290 then if pc.get_local_x() >= 371 and pc.get_local_x() <= 398 and pc.get_local_y() >= 1264 and pc.get_local_y() <= 1290 then local items = {{19,1},{29,1}} for i = 1, table.getn(items) do game.drop_item_with_ownership(items[i][1],items[i][2]) end d.notice("Admiral Chuong") d.notice("Ihr habt ihn besiegt, damit steht nun Minas Morgul unter unserer kontrolle!") d.kill_all() else d.notice("Rakshasa kann nur zwischen den 4 Säulen getötet werden!") d.set_unique("rakshasa",d.spawn_mob(3290,385,1277)) local coords = { {370,392,1298,1377}, {370,392,1159,1255}, {419,558,1272,1289} } for i = 1, 3 do for i2 = 1, 50 do d.spawn_mob(number(3201,3205),number(coords[i][1],coords[i][2]),number(coords[i][3],coords[i][4])) end end end end end -------------------------------------------------------------------------------------- -- Timer-Events ---------------------------------------------------------------------- -------------------------------------------------------------------------------------- when start_first.timer begin if not party.is_party() and pc.is_gm() then local s = select("Group","All") if s == 1 then d.join(150) else d.new_jump_all(150,9100,9531) end else d.new_jump_party(150,9100,9531) end end when notice_message_from_first_boss.timer begin d.notice("Martyaxwar") d.notice("Euer Wiederstand ist zwecklos, aktzeptiert das Ende denn der Kataklysmus naht!") end when check_tp_from_boss_one.server_timer begin if d.select(get_server_timer_arg()) then if d.unique_get_hp_perc("boss1") < 50 then --d.notice(d.unique_get_hp_perc("boss1")) if d.getf("morgulstone_boss") == 0 then if d.getf("morgulstone_count") > 0 then for i = 1, 5 do if not d.is_unique_dead("morgulstone_"..i) and d.getf("morgulstone_boss") == 0 then d.setf("morgulstone_boss",i) d.purge_unique("boss1") end end else clear_server_timer("check_tp_from_boss_one",get_server_timer_arg()) end end end else clear_server_timer("check_tp_from_boss_one",get_server_timer_arg()) end end when stage3_warp_to_next.timer begin d.setf("stage3_count",d.getf("stage3_count")+1) party.setf("morgul_level",party.getf("morgul_level")+1) if d.getf("stage3_count") == 7 then d.notice("Rakshasa") d.notice("Eure Ausdauer ist bewundernswert doch vergeblich, ihr werdet Minas Morgul nicht lebent durchqueren!") timer("warp_to_stage3",8) else d.setf("stage3_tree_mobs",d.getf("stage3_tree_mobs")+number(10,15)) d.setf("stage3_tree_boss",d.getf("stage3_tree_boss")+5) local coords = {{11373,11387},{11515,11380},{11652,11379},{11806,11447},{11857,11583}} d.jump_all(coords[d.getf("stage3_count")-1][1],coords[d.getf("stage3_count")-1][2]) minasmorgul.create_regen_for_stage3(d.getf("stage3_count")) end end when warp_to_stage2.timer begin d.new_jump_all(151,11161,11463) end when warp_to_stage3.timer begin d.jump_all(11288,12063) d.notice("Admiral Chuong") d.notice("Schnell!!! Helft uns bei der Verteidigung gegen die Gnolle!") d.regen_file("data/dungeon/minasmorgul/lager.txt") d.spawn_mob(20377,222,801) d.spawn_mob(20378,222,811) timer("next_invasion",10) d.setf("gnollcounter",50) d.setf("defend_lager",get_time()+time_min_to_sec(10)) server_loop_timer("notice_lager_life",30,pc.get_map_index()) server_timer("spawn_new_gnolls",10,pc.get_map_index()) server_timer("lager_is_down",time_min_to_sec(10),pc.get_map_index()) end when warp_to_stage4.timer begin d.new_jump_all(154,16792,17076) end when spawn_new_gnolls.server_timer begin if d.select(get_server_timer_arg()) then local zufall = number(1,4) local text = {"Die Gnolle greifen vom Norden aus an!","Wir haben Gnolle an der Ostseite","Achtung! Gnolle aus dem Süden!","Die Gnolle kommen jetzt vom Westen!"} d.notice("Soldat") d.notice(text[zufall]) local coords = {{213,242,770,750},{242,256,781,810},{201,230,819,836},{187,202,789,817}} for i = 1, d.getf("gnollcounter") do d.spawn_mob(number(3001,3005),number(coords[zufall][1],coords[zufall][2]),number(coords[zufall][3],coords[zufall][4])) d.setf("gnoll_need_kills",d.getf("gnoll_need_kills")+1) end end end when notice_lager_life.server_timer begin if d.select(get_server_timer_arg()) then local secondsLeft = (d.getf("defend_lager") - get_time()) local minutesLeft = math.ceil(secondsLeft / 60) d.notice("Das Lager hällt noch "..minutesLeft.." Minuten durch!") end end when lager_is_down.server_timer begin if d.select(get_server_timer_arg()) then d.notice("Ihr habt versagt, das Lager wurde von den Gnollen überannt!") d.exit_all() end end when controll_raks_tp.server_timer begin if d.select(get_server_timer_arg()) then if d.unique_get_hp_perc("rakshasa") < 50 then local coords = { {370,392,1298,1377}, {370,392,1159,1255}, {419,558,1272,1289} } for i = 1, 3 do for i2 = 1, 50 do d.spawn_mob(number(3201,3205),number(coords[i][1],coords[i][2]),number(coords[i][3],coords[i][4])) end end clear_server_timer("controll_raks_tp",get_server_timer_arg()) end end end -------------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------- -------------------------------------------------------------------------------------- function SpawnStones() local coords = {{298,655},{497,644},{667,626},{824,429},{854,236}} for i = 1, table.getn(coords) do d.set_unique("morgulstone_"..i,d.spawn_mob(8051,coords[i][1],coords[i][2])) d.setf("morgulstone_count",d.getf("morgulstone_count")+1) end end function GetPos() local coords = {{298,655},{497,644},{667,626},{824,429},{854,236}} for i = 1, table.getn(coords) do if pc.get_local_x() >= coords[i][1]-15 and pc.get_local_x() <= coords[i][1]+15 and pc.get_local_y() >= coords[i][2]-15 and pc.get_local_y() <= coords[i][2]+15 then return i end end end function create_regen_for_stage3(num) local index = {{145,195,270,313},{266,325,261,309},{404,470,262,316},{544,635,257,312},{694,770,306,393},{693,822,476,604}} for i = 1, d.getf("stage3_tree_boss") do d.setf("stage3_tree_needkills",d.getf("stage3_tree_needkills")+1) d.spawn_mob(3901,number(index[num][1],index[num][2]),number(index[num][3],index[num][4])) end for i = 1, d.getf("stage3_tree_mobs") do d.spawn_mob(number(7025,7028),number(index[num][1],index[num][2]),number(index[num][3],index[num][4])) end end function join_morgulrun() local mids = {150,151,154} if party.getf("morgulrun_mid") >= mids[1] * 10000 and party.getf("morgulrun_mid") <= (mids[1] * 10000) + 990 then pc.warp(910000,953100,party.getf("morgulrun_mid")) elseif party.getf("morgulrun_mid") >= mids[2] * 10000 and party.getf("morgulrun_mid") <= (mids[2] * 10000) + 990 then local coords = {{11161,11463},{11373,11387},{11515,11380},{11652,11379},{11806,11447},{11857,11583},{11289,12071}} pc.warp(coords[party.getf("morgul_level")][1]*100,coords[party.getf("morgul_level")][2]*100,party.getf("morgulrun_mid")) elseif party.getf("morgulrun_mid") >= mids[3] * 10000 and party.getf("morgulrun_mid") <= (mids[3] * 10000) + 990 then if party.getf("morgul_level") == 1 then pc.warp(1679200,1707600,party.getf("morgulrun_mid")) else pc.warp(1673800,1794300,party.getf("morgulrun_mid")) end end end -------------------------------------------------------------------------------------- -- DevFunctions ---------------------------------------------------------------------- -------------------------------------------------------------------------------------- --[[ Ebene 3 Ebene 2: 11373,11387 Ebene 3: 11515,11380 Ebene 4: 11652,11379 Ebene 5: 11806,11447 Ebene 6: 11857,11583 ]] when 20377.chat."Ebene 1 überspringen" with pc.is_in_dungeon(150) begin npc.purge() if select("Überspringen","Abbrechen") == 1 then timer("warp_to_stage2",5) end end when 20377.chat."Ebene 2 überspringen" with pc.is_in_dungeon(151) and d.getf("stage3_count") < 7 begin npc.purge() if select("Überspringen","Abbrechen") == 1 then timer("warp_to_stage3",5) end end when 20377.chat."Regen neuladen" with pc.is_in_dungeon(151) begin npc.purge() if select("Überspringen","Abbrechen") == 1 then d.kill_all() d.regen_file("data/dungeon/minasmorgul/lager.txt") end end -- 72, 1277 end end