From 6bb6377315f05547b001703c2c166338f1f9b25c Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 28 Mar 2025 22:52:21 -0400 Subject: [PATCH] Add stubs for the other two starting City-States Also document how to access and play these scenes in USAGE. --- USAGE.md | 4 +++ resources/scripts/opening/OpeningGridania.lua | 27 +++++++++++++++++++ .../scripts/opening/OpeningLimsaLominsa.lua | 27 +++++++++++++++++++ src/world/chat_handler.rs | 16 ++++++++--- 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 resources/scripts/opening/OpeningGridania.lua create mode 100644 resources/scripts/opening/OpeningLimsaLominsa.lua diff --git a/USAGE.md b/USAGE.md index 79136aa..184a7a3 100644 --- a/USAGE.md +++ b/USAGE.md @@ -82,6 +82,10 @@ These special debug commands start with `!` and are custom to Kawari. * `!spawnactor`: Spawn another actor for debugging * `!spawnnpc`: Spawn a NPC for debugging * `!spawnmonster`: Spawn a monster for debugging +* `!playscene `: Plays an event. Only some events are supported for now: + * Territory `181`, Event `1245185` plays the Limsa opening sequence + * Territory `182`, Event `1245187` plays the Ul'dah opening sequence + * Territory `183`, Event `1245186` plays the Gridania opening sequence ### GM commands diff --git a/resources/scripts/opening/OpeningGridania.lua b/resources/scripts/opening/OpeningGridania.lua new file mode 100644 index 0000000..2baa625 --- /dev/null +++ b/resources/scripts/opening/OpeningGridania.lua @@ -0,0 +1,27 @@ +--- TODO: find a way to hardcode it this way +EVENT_ID = 1245186 + +--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it' +POS_START = 2299848 + +function Scene00000(player) +player:play_scene(EVENT_ID, 00000, 4959237, 1) +end + +function Scene00001(player) +player:play_scene(EVENT_ID, 00001, 4959237, 1) +end + +function onEnterTerritory(player, zone) +--- move the player into the starting position +start_pos = zone:get_pop_range(POS_START) +player:set_position(start_pos) + +Scene00000(player); +end + +function onSceneFinished(player, scene) +if scene == 0 then + Scene00001(player) + end + end diff --git a/resources/scripts/opening/OpeningLimsaLominsa.lua b/resources/scripts/opening/OpeningLimsaLominsa.lua new file mode 100644 index 0000000..c029462 --- /dev/null +++ b/resources/scripts/opening/OpeningLimsaLominsa.lua @@ -0,0 +1,27 @@ +--- TODO: find a way to hardcode it this way +EVENT_ID = 1245185 + +--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it' +POS_START = 4101800 + +function Scene00000(player) + player:play_scene(EVENT_ID, 00000, 4959237, 1) +end + +function Scene00001(player) + player:play_scene(EVENT_ID, 00001, 4959237, 1) +end + +function onEnterTerritory(player, zone) + --- move the player into the starting position + start_pos = zone:get_pop_range(POS_START) + player:set_position(start_pos) + + Scene00000(player); +end + +function onSceneFinished(player, scene) + if scene == 0 then + Scene00001(player) + end +end diff --git a/src/world/chat_handler.rs b/src/world/chat_handler.rs index 8abd31a..af12c14 100644 --- a/src/world/chat_handler.rs +++ b/src/world/chat_handler.rs @@ -274,7 +274,8 @@ impl ChatHandler { } } "!playscene" => { - // only works in ul'dah opening + let parts: Vec<&str> = chat_message.message.split(' ').collect(); + let event_id = parts[1].parse::().unwrap(); // Load the game script for this event on the client { @@ -290,9 +291,9 @@ impl ChatHandler { object_type: 0, }, event_type: 15, - event_id: 0x130003, + event_id, flags: 0, - event_arg: 182, + event_arg: 182, // zone? }), }; @@ -329,7 +330,14 @@ impl ChatHandler { .await; } - connection.event = Some(Event::new("opening/OpeningUldah.lua")); + let event = match event_id { + 1245185 => Event::new("opening/OpeningLimsaLominsa.lua"), + 1245186 => Event::new("opening/OpeningGridania.lua"), + 1245187 => Event::new("opening/OpeningUldah.lua"), + _ => panic!("Unsupported event!"), + }; + + connection.event = Some(event); connection .event .as_mut()