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

311 lines
11 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function warp_cubric_gate()
local isPartyRequired = tonumber(get_env("game.cubric_required_party")) or 1
local cubricNeededLevel = tonumber(get_env("game.cubric_required_level")) or 150
local playerLevel = gv("level")
if isPartyRequired == 0 then
if playerLevel >= cubricNeededLevel then
cprint( "@9830" ) -- <#6DD66D>Only players from your party will be able to join you inside the dungeon.<(version:7.4)>
dlg_special( 'confirm_window', 'warp_to_instance_dungeon(30000)', '@9825\v#@dungeon_name@#\v@80030000' )
else
cprint( "@9831" ) -- Only parties with Lv 150 and above characters can enter
return
end
else
if gv("party_id") == 0 or playerLevel < cubricNeededLevel then
cprint( "@9831" ) -- Only parties with Lv 150 and above characters can enter
return
else
cprint( "@9830" ) -- <#6DD66D>Only players from your party will be able to join you inside the dungeon.<(version:7.4)>
dlg_special( 'confirm_window', 'warp_to_instance_dungeon(30000)', '@9825\v#@dungeon_name@#\v@80030000' )
end
end
end
function on_create_cubric_instance( layer )
-- Cubric instance dungeon ID: 30000
set_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount', 0 ) -- Track number of players currently doing quest 3607
set_instance_dungeon_flag( 30000, layer, 'AdditionalBossRespawned', 0 ) -- Track additional boss respawns to prevent overlapping spawns
set_instance_dungeon_flag( 30000, layer, 'ExitPropRespawned', 0 ) -- Track final exit prop respawn to prevent duplicates
set_instance_dungeon_flag( 30000, layer, 'MissionRevealed', 0 ) -- Track if the mission (kill both Arxha) has been revealed to players: 0: not activated, 1: active, 2: mission completed
end
-- If the joining player has the tracked quest, update internal dungeon variables
function on_join_cubric( layer )
-- If the newly joined player is currently doing quest 3607, reflect that in the dungeon state
-- If a player accepted the quest earlier but left before completing, they are counted
-- If the quest is already completed, they are not counted as in-progress
-- Return values for get_quest_progress:
-- -1: nothing / 0: accepted / 1: in-progress / 2: can complete / 100: failed / 255: already completed
if get_quest_progress( 3607 ) == 1 then
-- Cubric instance dungeon ID: 30000
set_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount', get_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount' ) + 1 )
end
-- If the mission UI is already active, display it for the joining player
if get_instance_dungeon_flag( 30000, layer, 'MissionRevealed' ) == 1 then
-- Mission title
send_mission_title( '@1234' )
-- 0: Haksa on the west
send_mission_objective( 0, 1, '@1235' )
-- 1: Haksa on the east
send_mission_objective( 1, 1, '@1236' )
-- 2: Boss room
send_mission_objective( 2, 1, '@1237' )
-- Mission reward info
send_mission_reward( '@1238' )
-- Update mission progress display for the player
update_cubric_mission( false, layer )
end
end
function on_leave_cubric( layer )
-- If the user who just left was on quest 3607, update the dungeon state variable
-- Users who accepted the quest but leave without completing it are counted
-- Users who have completed the quest are not counted as in-progress
-- (e.g., accepted quest, killed mobs, eligible for reward but left without claiming)
-- Return values: -1: nothing / 0: accepted / 1: in-progress / 2: can complete / 100: failed / 255: already completed
if get_quest_progress( 3607 ) == 1 then
-- Cubric instance dungeon ID: 30000
set_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount', get_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount' ) - 1 )
end
-- If the mission UI was active, close it
if get_instance_dungeon_flag( 30000, layer, 'MissionRevealed' ) == 1 then
send_mission_title( '' )
end
end
function cubric_check_respawn_group_clear( respawn_group, x, y, layer )
-- If a sub-boss group monster dies (respawn_group 1 or 2)
if respawn_group == 1 or respawn_group == 2 then
-- Open the prop that returns players to the branch room when a sub-boss dies
add_field_prop( 60156, 0, x, y, layer, 0 )
-- Update mission UI if necessary
update_cubric_mission( true, layer )
-- If a boss group monster dies (respawn_group 3)
elseif respawn_group == 3 then
-- Boss respawns only once, so no need to check if all are dead
-- If the Cubric dungeon quest is in progress, do not create an exit prop
-- If no players are currently on the quest, open a portal so players can leave
-- The quest used to determine progress is [ID:3607 <(version:7.4)> [Cubric] Demon Cube]
-- (Set up using QuestResource.script_start_text, script_end_text, script_drop_text)
if get_instance_dungeon_flag( 30000, layer, 'QuestInProgressCount' ) == 0 then
add_field_prop( 60102, 0, 99954, 31539, layer, 0 )
set_instance_dungeon_flag( 30000, layer, 'ExitPropRespawned', 1 )
end
end
end
function warp_to_cubric_branch_room( side )
local layer = gv( 'layer' )
-- Warp to the central room depending on the chosen side
if side == 1 then
warp( 98858, 30827, layer )
elseif side == 2 then
warp( 99180, 30825, layer )
end
-- If the mission UI is not yet active, activate it
if get_instance_dungeon_flag( 30000, layer, 'MissionRevealed' ) == 0 then
set_instance_dungeon_flag( 30000, layer, 'MissionRevealed', 1 )
-- Set the mission title
broadcast_mission_title( 1, '@1234', 30000, layer )
-- 0: Haksa on the west
broadcast_mission_objective( 1, 0, 1, '@1235', 30000, layer )
-- 1: Haksa on the east
broadcast_mission_objective( 1, 1, 1, '@1236', 30000, layer )
-- 2: Enter the boss room
broadcast_mission_objective( 1, 2, 1, '@1237', 30000, layer )
-- Show mission reward info
broadcast_mission_reward( 1, '@1238', 30000, layer )
-- Update mission progress
update_cubric_mission( true, layer )
end
end
-- Teleport to the boss room after killing both Haska
function warp_to_cubric_boss_room()
local layer = gv( 'layer' )
-- Warp into the boss room
warp( 99711, 31535, layer )
if get_instance_dungeon_flag( 30000, layer, 'MissionRevealed' ) == 1 then
-- Mission Completed
broadcast_mission_objective_progress( 1, 2, 1, 30000, layer )
-- Distribute mission rewards
do_each_player_in_instance_dungeon( 30000, layer, 'cubric_reward_distributer()' )
-- Change flag so mission UI is no longer active
set_instance_dungeon_flag( 30000, layer, 'MissionRevealed', 2 )
-- Deactivate mission UI
broadcast_mission_title( 1, '', 30000, layer )
end
end
function cubric_reward_distributer()
-- Quest reward: Level 150, around 1%
insert_gold( 300000 )
add_exp_jp( 5131363, 884717 )
cprint( '@1239' )
end
function update_cubric_mission( broadcast, layer )
-- If a mission isnt in progress, theres nothing in particular to notify
if get_instance_dungeon_flag( 30000, layer, 'MissionRevealed' ) ~= 1 then
return
end
if broadcast == true then
broadcast_mission_objective_progress( 1, 0, 1 - get_alive_instance_respawn_group_monster_count( 30000, layer, 1 ), 30000, layer )
broadcast_mission_objective_progress( 1, 1, 1 - get_alive_instance_respawn_group_monster_count( 30000, layer, 2 ), 30000, layer )
broadcast_mission_objective_progress( 1, 2, 0, 30000, layer )
else
send_mission_objective_progress( 0, 1 - get_alive_instance_respawn_group_monster_count( 30000, layer, 1 ) )
send_mission_objective_progress( 1, 1 - get_alive_instance_respawn_group_monster_count( 30000, layer, 2 ) )
send_mission_objective_progress( 2, 0 )
end
end
--------------------------------------------------------------------------------
----------------------------- Cubric dungeon props -----------------------------
--------------------------------------------------------------------------------
function cubric_dungeon_prop_activate( prop_id )
local cubricNeededLevel = tonumber(get_env("game.cubric_required_level")) or 150
local layer = gv("layer")
if prop_id == 60110 then -- Stone Door 8
warp_to_cubric_branch_room( 1 )
elseif prop_id == 60111 then -- Stone Door 8 (Butkadah's Door)
if get_alive_instance_respawn_group_monster_count( 30000, layer, 1 ) == 0 and get_alive_instance_respawn_group_monster_count( 30000, layer, 2 ) == 0 then
-- You touch the once-sealed door to Butkadah's chamber and a loud creak echoes through the room. Are you sure you want to enter?
dlg_special( 'confirm_window', 'warp_to_cubric_boss_room()', '@9828' )
else
dlg_general( '@9827' ) -- The door is sealed by the barriers Haksa and Askah have created.
return
end
elseif prop_id == 60144 then -- Stone Door 9-1
if get_quest_progress(3606) == 1 then -- <(version:7.4)>Escape Plan #2
set_quest_status( 3606, 1, 1 )
cprint( "@90605055" ) -- <#6DD66D>The ground shakes under your feet.
else
-- Entrance 9-1
warp(99018 , 30995, layer )
end
elseif prop_id == 60145 then -- Stone Door 10-1
warp_to_cubric_branch_room( 2 )
elseif prop_id == 60155 then -- Askah Portal
-- You sense that this portal will take you to the entrance to Butkadah's chamber. Do you want to step through the portal?
dlg_special( 'confirm_window', 'warp_to_cubric_branch_room( 1 )', '@9829' )
elseif prop_id == 60156 then -- Haksa Portal
-- You sense that this portal will take you to the entrance to Butkadah's chamber. Do you want to step through the portal?
dlg_special( 'confirm_window', 'warp_to_cubric_branch_room( 2 )', '@9829' )
else
local propsMap = {}
propsMap[60103] = { 97636, 29721 } -- Stone Door 1
propsMap[60104] = { 98246, 30030 } -- Stone Door 2
propsMap[60105] = { 98259, 30744 } -- Stone Door 3
propsMap[60106] = { 98246, 31311 } -- Stone Door 4
propsMap[60107] = { 98672, 31728 } -- Stone Door 5
propsMap[60108] = { 97806, 31540 } -- Stone Door 6 (Haksa's Door)
propsMap[60109] = { 97640, 30964 } -- Stone Door 7
propsMap[60112] = { 99866, 30628 } -- Stone Door 10
propsMap[60113] = { 99969, 30079 } -- Stone Door 11
propsMap[60114] = { 100455, 29927 } -- Stone Door 12
propsMap[60115] = { 100566, 30354 } -- Stone Door 13
propsMap[60116] = { 100945, 30479 } -- Stone Door 14
propsMap[60117] = { 101069, 30053 } -- Stone Door 15
propsMap[60118] = { 100682, 29926 } -- Stone Door 16
propsMap[60119] = { 101517, 30243 } -- Stone Door 17
propsMap[60120] = { 101511, 31012 } -- Stone Door 18 (Askah's Door)
propsMap[60136] = { 97307, 29997 } -- Stone Door 1-1
propsMap[60137] = { 97880, 29729 } -- Stone Door 2-1
propsMap[60138] = { 98248, 30374 } -- Stone Door 3-1
propsMap[60139] = { 98259, 30978 } -- Stone Door 4-1
propsMap[60140] = { 98388, 31423 } -- Stone Door 5-1
propsMap[60141] = { 98147, 31425 } -- Stone Door 6-1
propsMap[60142] = { 97623, 31352 } -- Stone Door 7-1
propsMap[60143] = { 98386, 30851 } -- Stone Door 8-1
propsMap[60146] = { 99967, 30507 } -- Stone Door 11-1
propsMap[60147] = { 100144, 29929 } -- Stone Door 12-1
propsMap[60148] = { 100567, 30053 } -- Stone Door 13-1
propsMap[60149] = { 100687, 30476 } -- Stone Door 14-1
propsMap[60150] = { 101069, 30363 } -- Stone Door 15-1
propsMap[60151] = { 100950, 29928 } -- Stone Door 16-1
propsMap[60152] = { 101195, 30477 } -- Stone Door 17-1
propsMap[60153] = { 101067, 30597 } -- Stone Door 18-1
local coordinates = propsMap[prop_id]
if coordinates then
warp(coordinates[1], coordinates[2], layer )
else
private_notice("[Error] Prop not found! Prop ID: " .. prop_id .. "! Contact developers please!")
end
end
end