From feb0ffb8695108e8f5e1399f5fbc8d3a31235197 Mon Sep 17 00:00:00 2001 From: The Dax Date: Tue, 24 Jun 2025 18:23:01 -0400 Subject: [PATCH] Implement the aethernet for aetherytes and ensure both aetherytes and aethernet shards do better about not yeeting you into invalid zones, crashing the client, or softlocking --- .../scripts/common/GenericAethernetShard.lua | 28 ++++++++--- resources/scripts/common/GenericAetheryte.lua | 48 ++++++++++++++++--- 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/resources/scripts/common/GenericAethernetShard.lua b/resources/scripts/common/GenericAethernetShard.lua index f0b1960..bfa1b64 100644 --- a/resources/scripts/common/GenericAethernetShard.lua +++ b/resources/scripts/common/GenericAethernetShard.lua @@ -1,18 +1,32 @@ -- generic aetheryte, use this for all of the aethernet shards ---- scene 02 - aetheryte menu ---- scene 03 - "you have aethernet access" message and vfx +--- scene 00000 - does nothing +--- scene 00001 - does nothing +--- scene 00002 - aetheryte menu +--- scene 00003 - "you have aethernet access" message and vfx +--- scene 00100 - "According to the message engraved in the base, special permission is required to use this aetheryte." (Eulmore-specific) +--- scene 00200 - "The aetheryte has ceased functioning." (Eulmore-specific) + +SCENE_SHOW_MENU = 00002 +SCENE_HAVE_AETHERNET_ACCESS = 00003 function onTalk(target, player) - player:play_scene(target, EVENT_ID, 00002, 8192, 0) + player:play_scene(target, EVENT_ID, SCENE_SHOW_MENU, 8192, 0) end function onReturn(scene, results, player) local AETHERNET_MENU_CANCEL = 0 local destination = results[1] - player:finish_event(EVENT_ID) - - if destination ~= AETHERNET_MENU_CANCEL then - player:warp_aetheryte(destination) + + if scene == SCENE_SHOW_MENU then + if destination ~= AETHERNET_MENU_CANCEL then + player:finish_event(EVENT_ID) -- Need to finish the event here, because warping does not return to this callback (the game will crash or softlock otherwise) + player:warp_aetheryte(destination) + return + end + --elseif scene == HAVE_AETHERNET_ACCESS then + -- TODO: attunement logic end + + player:finish_event(EVENT_ID) end diff --git a/resources/scripts/common/GenericAetheryte.lua b/resources/scripts/common/GenericAetheryte.lua index d3518ac..6c60479 100644 --- a/resources/scripts/common/GenericAetheryte.lua +++ b/resources/scripts/common/GenericAetheryte.lua @@ -1,16 +1,52 @@ -- generic aetheryte, use this for all of the big aetherytes ---- scene 02 - aetheryte menu ---- scene 03 - "you have aethernet access" message and vfx ---- scene 100 - "According to the message engraved in the base, special permission is required to use this aetheryte." (Eulmore-specific) ---- scene 200 - "The aetheryte has ceased functioning." (Eulmore-specific) +--- scene 00000 - display main menu ("Welcome to .") +--- scene 00001 - softlocks, unknown purpose +--- scene 00002 - aethernet menu (used only by aethernet shards? scene 00 for big aetherytes display the aethernet submenu without needing an additional play_scene) +--- scene 00003 - "you have aethernet access" message and vfx +--- scene 00100 - "According to the message engraved in the base, special permission is required to use this aetheryte." (Eulmore-specific) +--- scene 00200 - "The aetheryte has ceased functioning." (Eulmore-specific) + +SCENE_SHOW_MENU = 00000 +SCENE_HAVE_AETHERNET_ACCESS = 00003 function onTalk(target, player) --- param has to be 1 for the menu to even show up - player:play_scene(target, EVENT_ID, 00000, 8192, 1) + player:play_scene(target, EVENT_ID, SCENE_SHOW_MENU, 8192, 1) end function onReturn(scene, results, player) - --- results [3] is 1 if the player requested to set it as their home point + local AETHERNET_SUBMENU = 4 + local AETHERNET_SUBMENU_CANCEL = 0 + local SET_HOME_POINT = 1 + local HOME_PNT_YES = 1 + local HOME_PNT_NO = 0 + -- local REGISTER_FAVORITE_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless + -- local REGISTER_SECURITY_TOKEN_DSTN = ??? -- Unable to obtain right now, seems to return 0 regardless + + local resultc = table.getn(results) -- TODO: Do we need to check this still? Can the favorite/security menus return more than 2, once they work? + + local menu_option = results[1] + local decision = results[2] + + if scene == SCENE_SHOW_MENU then -- main aetheryte prompt scene + if menu_option == SET_HOME_POINT then + -- TODO: logic for setting home point + --[[ if decision == HOME_PNT_YES then + else + end ]] + elseif menu_option == AETHERNET_SUBMENU then + if decision ~= AETHERNET_SUBMENU_CANCEL then + player:finish_event(EVENT_ID) -- Need to finish the event here, because warping does not return to this callback (the game will crash or softlock otherwise) + player:warp_aetheryte(decision) + return + end + --[[elseif menu_option == REGISTER_FAVORITE_DSTN then + -- TODO: Favorite Destination logic + else -- REGISTER_SECURITY_TOKEN_DSTN + -- TODO: Security Token Free Destination logic ]] + end + end + player:finish_event(EVENT_ID) end