Files
2026-06-01 12:46:52 +02:00

458 lines
16 KiB
Lua

------------------------------------------------------------------------------------------------------------
function NPC_DevildomDungeon()
local npc_name = "@"..get_npc_type().."|@"..get_npc_name()
dlg_title(npc_name)
dlg_text( "@90610399" )
local stage = get_instance_dungeon_flag( 80000, gv('layer'), 'stage' )
if stage >= 11 then
dlg_menu( "@90610400", "warp( 22626, 54881, gv('layer'))" )
end
if stage >= 21 then
dlg_menu( "@90610401", "warp( 19129, 58384, gv('layer') )" )
end
if stage >= 31 then
dlg_menu( "@90610855", "warp( 25028, 61184, gv('layer') )" )
end
if stage >= 41 then
dlg_menu( "@90610856", "warp( 28028, 56184, gv('layer') )" )
end
if stage >= 51 then
dlg_menu( "@90610857", "warp( 25028, 51184, gv('layer') )" )
end
dlg_menu( "@90610402", "exit_indun( 0 )" )
dlg_menu( "@90010002", " " ) -- 대화종료
dlg_show()
end
function MMT_init(layer, stage)
if layer == -1 then
layer = gv('layer')
end
set_instance_dungeon_flag( 80000, layer, 'stage', stage )
set_instance_dungeon_flag( 80000, layer, 'boss', stage )
local pgate =
{ -- 1번방 출구
19128,51629,0, 19128,52329,0, 19128,53029,0, 19128,53729,0, 19373,54184,-1.57,
20073,54184,-1.57, 20773,54184,-1.57, 21473,54184,-1.57, 22173,54184,-1.57, 22628,54429,0,
22628,55129,0, 22628,55829,0, 22628,56529,0, 22628,57229,0, 22383,57684,1.57,
21683,57684,1.57, 20983,57684,1.57, 20283,57684,1.57, 19583,57684,1.57, 19128,57929,0,
19128,58629,0, 19128,59329,0, 19128,60029,0, 19128,60729,0, 19373,61184,-1.57,
20370,61184,-1.57, 21370,61184,-1.57, 22370,61184,-1.57, 23370,61184,-1.57, 24370,61184,-1.57,
25370,61184,-1.57, 26370,61184,-1.57, 27370,61184,-1.57, 28370,61184,-1.57, 29028,60842,3.14,
29028,59842,3.14, 29028,58842,3.14, 29028,57842,3.14, 29028,56842,3.14, 28686,56184,1.57,
27686,56184,1.57, 26686,56184,1.57, 25686,56184,1.57, 24686,56184,1.57, 24028,55842,3.14,
24028,54842,3.14, 24028,53842,3.14, 24028,52842,3.14, 24028,51842,3.14, 24370,51184,-1.57,
25370,51184,-1.57, 26370,51184,-1.57, 27370,51184,-1.57, 28370,51184,-1.57, 29028,51526,0,
29028,52526,0, 29028,53526,0, 28686,54184,1.57, 27686,54184,1.57, 26686,54184,1.57,
25686,54184,1.57 -- 마지막문 미사용
}
local prop = 10300
local dur = 0
local height = 280
local cnt = table.getn(pgate)/3 -1
for i = stage, cnt do
local posx = pgate[1+(i-1)*3+0]
local posy = pgate[1+(i-1)*3+1]
local dir = pgate[1+(i-1)*3+2]
add_field_prop(prop+i,dur,posx,posy,layer,height,0,0,dir)
end
if stage == 1 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 0 )
elseif stage == 11 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 101 )
elseif stage == 21 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 202 )
elseif stage == 31 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 303 )
elseif stage == 41 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 355 )
elseif stage == 51 then
set_instance_dungeon_flag( 80000, layer, 'monster_count', 407 )
end
end
function MMT_open_door(stage)
local layer = gv('layer')
--LOG
--notice(get_instance_dungeon_flag( 80000, layer, 'monster_count' ))
--
MMT_action(layer,stage+1)
set_instance_dungeon_flag( 80000, layer, 'stage', stage+1 )
end
--- stage:2 는 2번방 몬스터 생성
function MMT_action(layer,stage)
local state_code = get_local_info()
if layer == -1 then
layer = gv('layer')
end
local type, monster
if math.mod(stage, 5) ~= 0 and math.mod(stage, 5) ~= 1 then -- 중보, 보스, 시작방 빼고
type = math.random(1, 8)
if stage <= 30 then
monster = math.random(22000185, 22000191) + math.floor( stage / 10 )*11
else
local Marray =
{ 0, 22000315, 22000318, 22000321, 0, 0, 22000324, 22000327, 22000330, 0, -- 31층
0, 22000333, 22000336, 22000339, 0, 0, 22000342, 22000345, 22000348, 0, -- 41층
0, 22000351, 22000354, 22000357, 0, 0, 22000360, 22000363, 22000366, 0, -- 51층
}
local regen_monster = Marray[stage-30]
monster = math.random(regen_monster, regen_monster+2) -- 31층 이상 일반몹...
end
MMT_regen(layer,stage, type, monster)
elseif math.mod(stage+5, 10) == 0 then -- 중보
if stage <= 30 then
type = math.random(21, 22)
else
if state_code == 8192 then
type = 23
else
type = math.random( 47, 48 )
end
end
MMT_regen(layer,stage, type, 0)
elseif math.mod(stage, 10) == 0 and stage ~= 60 then --보스 // 마지막 방은 포함 안되도록
if stage <= 30 then
type = math.random(31, 32)
else
if state_code == 8192 then
type = 23
else
type = math.random( 47, 48 )
end
end
MMT_regen(layer,stage, type, 0)
elseif stage == 60 then
type = math.random(41, 45)
if state_code == 4 or state_code == 8 or state_code == 128 or state_code == 16384 or state_code == 32768 or state_code == 65536 then
local awBelt = find_item( 3100048 )
if awBelt >= 1 then
MMT_regen(layer,stage, 46, 0)
set_instance_dungeon_flag( 80000, layer, 'final_count' ,459 )
else
MMT_regen(layer,stage, type, 0)
set_instance_dungeon_flag( 80000, layer, 'final_count' ,457 )
end
else
MMT_regen(layer,stage, type, 0)
set_instance_dungeon_flag( 80000, layer, 'final_count' ,457 )
end
elseif math.mod(stage, 5) == 1 then
--cprint("쉬어가셈")
end
end
function MMT_regen(layer, stage, generate_type, monster_id)
local parray =
{ 19128,51384,2, 19128,52084,2, 19128,52784,2, 19128,53484,2, 19128,54184,2,
19828,54184,1, 20528,54184,1, 21228,54184,1, 21928,54184,1, 22628,54184,1,
22628,54884,2, 22628,55584,2, 22628,56284,2, 22628,56984,2, 22628,57684,2,
21928,57684,3, 21228,57684,3, 20528,57684,3, 19828,57684,3, 19128,57684,3,
19128,58384,2, 19128,59084,2, 19128,59784,2, 19128,60484,2, 19128,61184,2,
20028,61184,1, 21028,61184,1, 22028,61184,1, 23028,61184,1, 24028,61184,1,
25028,61184,1, 26028,61184,1, 27028,61184,1, 28028,61184,1, 29028,61184,1,
29028,60184,0, 29028,59184,0, 29028,58184,0, 29028,57184,0, 29028,56184,0,
28028,56184,3, 27028,56184,3, 26028,56184,3, 25028,56184,3, 24028,56184,3,
24028,55184,0, 24028,54184,0, 24028,53184,0, 24028,52184,0, 24028,51184,0,
25028,51184,1, 26028,51184,1, 27028,51184,1, 28028,51184,1, 29028,51184,1,
29028,52184,2, 29028,53184,2, 29028,54184,2, 28028,54184,3, 27028,54184,3,
}
local count = 2
if stage >= 31 then
count = 1
end
local dur = 0
local base_idx = 1+(stage-1) * 3
local base_x = parray[base_idx+0]
local base_y = parray[base_idx+1]
local tdir = parray[base_idx+2]
local ppattern1 = { -18,-2, -10,3, -15,14, -4,18, 4,18, 15,14, 10,3, 18,-2 }
local ppattern2 = { -14,-8, -14,-3, -14,3, -14,8, 14,8, 14,3, 14,-3, 14,-8 }
local ppattern3 = { -11,15, -6,11, -7,18, -2,18, 2,18, 7,18, 11,15, 6,11 }
local ppattern4 = { 0,-6, -5,-3, -5,3, 0,6, 5,3, 5,-3, -10,16, 10,16 }
local ppattern5 = { -16,-10, -16,-4, -7,10, -4,17, 4,17, 7,10, 16,-4, 16,-10 }
local ppattern6 = { -9,12, -9,18, -4,18, -4,12, 4,18, 4,12, 9,18, 9,12 }
local ppattern7 = { 0,-4, -6,-2, 6,-2, 0,2, -8,16, -3,16, 3,16, 8,16 }
local ppattern8 = { -4,-1, 4,-1, 0,9, -11,17, -7,9, 0,18, 7,9, 11,17 }
local ppattern21 = { 0,8,22000194, -10,0,22000192} -- 중보, 푸른
local ppattern22 = { 0,8,22000194, 10,0,22000193} -- 중보, 붉은
local ppattern23 = { 0,0,22000370, 0,2,22000369} -- 31층 이상 중보, 쫄보
local ppattern31 = { 0,0,22000195, 0,12,22000193, -10,0,22000192} -- 보스, 붉은, 푸른
local ppattern32 = { 0,0,22000195, 0,12,22000192, 10,0,22000193} -- 보스, 푸른, 붉
local ppattern41 = { 0,0,22000384, -2,0,22000379, 2,0,22000380, 0,-2,22000381} -- 보스, 보스쫄 3마리
local ppattern42 = { 0,0,22000384, -2,0,22000380, 2,0,22000381, 0,-2,22000382} -- 보스, 보스쫄 3마리
local ppattern43 = { 0,0,22000384, -2,0,22000381, 2,0,22000382, 0,-2,22000383} -- 보스, 보스쫄 3마리
local ppattern44 = { 0,0,22000384, -2,0,22000379, 2,0,22000382, 0,-2,22000383} -- 보스, 보스쫄 3마리
local ppattern45 = { 0,0,22000384, -2,0,22000379, 2,0,22000380, 0,-2,22000383} -- 보스, 보스쫄 3마리
local ppattern46 = { 0,0,22000384, -2,0,22000379, 2,0,22000380, 0,-2,22000381, -2,-2,22000382, 2,2,22000383} -- If user has another world belt. Will spawn all monsters. (Webzen)
local ppattern47 = { 0,0,22000370, 0,2,22000369 } -- Room 31 onwards (Webzen)
local ppattern48 = { 0,0,22000370, 0,2,22000403 } -- Room 31 onwards with Yushiva (Webzen)
local xv, yv
if stage <= 25 then
xv = 10
yv = 10
else
xv = 10
yv = 10
end
--cprint("패턴"..generate_type)
if generate_type==1 then
MMT_add_npc( base_x,base_y,monster_id,ppattern1,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==2 then
MMT_add_npc( base_x,base_y,monster_id,ppattern2,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==3 then
MMT_add_npc( base_x,base_y,monster_id,ppattern3,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==4 then
MMT_add_npc( base_x,base_y,monster_id,ppattern4,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==5 then
MMT_add_npc( base_x,base_y,monster_id,ppattern5,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==6 then
MMT_add_npc( base_x,base_y,monster_id,ppattern6,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==7 then
MMT_add_npc( base_x,base_y,monster_id,ppattern7,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==8 then
MMT_add_npc( base_x,base_y,monster_id,ppattern8,xv,yv,tdir,count,dur,layer,stage)
elseif generate_type==21 then
MMT_add_npc_boss( base_x,base_y,ppattern21,xv,yv,tdir,dur,layer,stage)
elseif generate_type==22 then
MMT_add_npc_boss( base_x,base_y,ppattern22,xv,yv,tdir,dur,layer,stage)
elseif generate_type==23 then
MMT_add_npc_boss( base_x,base_y,ppattern23,xv,yv,tdir,dur,layer,stage)
elseif generate_type==31 then
MMT_add_npc_boss( base_x,base_y,ppattern31,xv,yv,tdir,dur,layer,stage)
elseif generate_type==32 then
MMT_add_npc_boss( base_x,base_y,ppattern32,xv,yv,tdir,dur,layer,stage)
elseif generate_type==41 then
MMT_add_npc_boss( base_x,base_y,ppattern41,xv,yv,tdir,dur,layer,stage)
elseif generate_type==42 then
MMT_add_npc_boss( base_x,base_y,ppattern42,xv,yv,tdir,dur,layer,stage)
elseif generate_type==43 then
MMT_add_npc_boss( base_x,base_y,ppattern44,xv,yv,tdir,dur,layer,stage)
elseif generate_type==44 then
MMT_add_npc_boss( base_x,base_y,ppattern44,xv,yv,tdir,dur,layer,stage)
elseif generate_type==45 then
MMT_add_npc_boss( base_x,base_y,ppattern45,xv,yv,tdir,dur,layer,stage)
elseif generate_type==46 then
MMT_add_npc_boss( base_x,base_y,ppattern46,xv,yv,tdir,dur,layer,stage)
elseif generate_type==47 then -- Webzen only
MMT_add_npc_boss( base_x,base_y,ppattern47,xv,yv,tdir,dur,layer,stage)
elseif generate_type==48 then -- Webzen only
MMT_add_npc_boss( base_x,base_y,ppattern48,xv,yv,tdir,dur,layer,stage)
end
end
function MMT_broadcast_mission( layer,total )
broadcast_mission_title( 1, '@1224', 80000,layer )
broadcast_mission_reward( 1, '@90610864',80000,layer )
broadcast_mission_objective( 1, 0, total, '@1224',80000,layer) -- 미션 목표도 항상 '모든 몬스터를 섬멸하라'에 최대 몬스터 수는 6(4층인 경우만 1이 됨)
set_instance_dungeon_flag( 80000, layer, 'total' ,total )
set_instance_dungeon_flag( 80000, layer, 'current' ,0 )
end
function MMT_add_npc( base_x,base_y,monster_id,ppattern,xv,yv,tdir,count,dur,layer,stage)
local total = 0
local cnt = table.getn(ppattern)/2
for i = 1, cnt do
local idx
idx = (i-1)*2+1
local xx = (ppattern[idx]*xv)
idx = (i-1)*2+2
local yy = (ppattern[idx]*yv)
local temp_xx = xx
local temp_yy = yy
if tdir == 0 then -- ahead west
temp_xx = -xx
temp_yy = -yy
elseif tdir == 1 then -- ahead west
temp_xx = yy
temp_yy = -xx
elseif tdir == 2 then -- ahead south
temp_xx = xx
temp_yy = yy
elseif tdir == 3 then -- ahead eash
temp_xx = -yy
temp_yy = xx
end
if stage <= 30 then
monster = math.random(22000185, 22000191) + math.floor( stage / 10 )*11
else
local Marray =
{ 0, 22000315, 22000318, 22000321, 0, 0, 22000324, 22000327, 22000330, 0, -- 31층
0, 22000333, 22000336, 22000339, 0, 0, 22000342, 22000345, 22000348, 0, -- 41층
0, 22000351, 22000354, 22000357, 0, 0, 22000360, 22000363, 22000366, 0, -- 51층
}
local regen_monster = Marray[stage-30]
monster = math.random(regen_monster, regen_monster+2) -- 31층 이상 일반몹...
end
xx = base_x + temp_xx
yy = base_y + temp_yy
add_npc( xx,yy,monster,count,dur,layer)
total = total + count
--cprint(xx.." "..yy.." "..monster_id.." "..count.." "..dur.." "..layer)
end
MMT_broadcast_mission(layer,total)
end
function MMT_add_npc_boss( base_x,base_y,ppattern,xv,yv,tdir,dur,layer,stage)
local total = 0
local cnt = table.getn(ppattern)/3
for i = 1, cnt do
local idx
idx = (i-1)*3+1
local xx = (ppattern[idx]*xv)
idx = (i-1)*3+2
local yy = (ppattern[idx]*yv)
local temp_xx = xx
local temp_yy = yy
if tdir == 0 then -- ahead west
temp_xx = -xx
temp_yy = -yy
elseif tdir == 1 then -- ahead west
temp_xx = yy
temp_yy = -xx
elseif tdir == 2 then -- ahead south
temp_xx = xx
temp_yy = yy
elseif tdir == 3 then -- ahead eash
temp_xx = -yy
temp_yy = xx
end
local monster_id
if stage <= 30 then
monster_id = ppattern[(i-1)*3+3] + (math.floor( (stage / 10)-0.5 ))*11
elseif stage == 60 then
monster_id = ppattern[(i-1)*3+3]
else
monster_id = ppattern[(i-1)*3+3] + ((stage-35)/5)*2 -- 31층 이상 중보 보스...
end
xx = base_x + temp_xx
yy = base_y + temp_yy
add_npc( xx,yy,monster_id,1,dur,layer)
total = total + 1
end
MMT_broadcast_mission(layer,total)
end
------------------------------------------------------------------------------------------------------------
function MMT_on_leave( layer ) -- 이탈시호출
------------------------------------------------------------------------------------------------------------
send_mission_title( '' )
end
------------------------------------------------------------------------------------------------------------
function MMT_on_join( layer ) -- 각 방마다 호출
------------------------------------------------------------------------------------------------------------
local total = get_instance_dungeon_flag( 80000, layer, 'total' )
local current = get_instance_dungeon_flag( 80000, layer, 'current' )
if total ~= nil and total ~= "" then
send_mission_title( '@1224' ) -- 미션 제목은 항상 '모든 몬스터를 섬멸하라'
send_mission_reward( '@90610864')
send_mission_objective( 0, total, '@1224' ) -- 미션 목표도 항상 '모든 몬스터를 섬멸하라'에 최대 몬스터 수는 6(4층인 경우만 1이 됨)
send_mission_objective_progress( 0, current )
end
end
function devildom_count(quest1, parm1, quest2, parm2)
local layer = get_value('layer')
if quest1~=nil then
--cprint( 'quest1:' .. quest1 .. " parm1:".. parm1)
do_each_player_in_instance_dungeon( 80000,layer, 'set_quest_status(' .. quest1 ..','.. parm1 ..',1)', gv('x'), gv('y') )
end
if quest2~=nil then
--cprint( 'quest2:' .. quest2 .. " parm2:".. parm2)
do_each_player_in_instance_dungeon( 80000,layer, 'set_quest_status(' .. quest2 ..','.. parm2 ..',1)', gv('x'), gv('y') )
end
local monster_count = get_instance_dungeon_flag( 80000, layer, 'monster_count' )
set_instance_dungeon_flag( 80000, layer, 'monster_count', monster_count+1 )
local current = get_instance_dungeon_flag( 80000, layer, 'current' )
current = current + 1;
set_instance_dungeon_flag( 80000, layer , 'current', current )
broadcast_mission_objective_progress( 1, 0, current, 80000,layer )
if get_instance_dungeon_flag( 80000, layer, 'final_count' ) == monster_count then
add_field_prop( 10361, 0, 26748, 54183, gv('layer'), 250, 0, 0, 1.58, 1, 1, 1 )
end
end
function Call_Script_tula_Death()
devildom_count( 4035, 1, 4036, 1 )
end
function Call_Script_Barga_Death()
devildom_count( 4037, 1, 4038, 1 )
end
function Call_Script_Kainen_Death()
devildom_count( 4039, 1, 4040, 1 )
end
function Call_Script_DevilWood_Death()
devildom_count( 4041, 1, 4045, 1 )
end
function Call_Script_Slaughterer_Death()
devildom_count( 4041, 2, 4045, 2 )
end
function Call_Script_StoneGargoyle_Death()
devildom_count( 4042, 1, 4046, 1 )
end
function Call_Script_MagmaGolem_Death()
devildom_count( 4042, 2, 4046, 2)
end
function Call_Script_CrazyHagen_Death()
devildom_count( 4043, 1, 4044, 1 )
end
function Call_Script_DevilReviac_Death()
devildom_count( 4043, 2, 4044, 2 )
end