mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-12 14:47:46 +00:00
Create GenericWarp script to handle simple warps
It turns out that most warps are just a yes/no, and can be handled by one single script. I scripted the lift attendants from Bulwark Hall <-> Airship Landing <-> Drowning Wench this way.
This commit is contained in:
parent
6dc8194aa8
commit
e237cbe84d
11 changed files with 21 additions and 30 deletions
|
@ -3,6 +3,8 @@ function onBeginLogin(player)
|
||||||
player:send_message("Welcome to Kawari!")
|
player:send_message("Welcome to Kawari!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- please keep these ids sorted!
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
registerAction(3, "actions/Sprint.lua")
|
registerAction(3, "actions/Sprint.lua")
|
||||||
registerAction(9, "actions/FastBlade.lua")
|
registerAction(9, "actions/FastBlade.lua")
|
||||||
|
@ -11,10 +13,13 @@ registerAction(9, "actions/FastBlade.lua")
|
||||||
registerAction(6221, "items/Fantasia.lua")
|
registerAction(6221, "items/Fantasia.lua")
|
||||||
|
|
||||||
-- Events
|
-- Events
|
||||||
|
registerEvent(131078, "warp/WarpInnGridania.lua")
|
||||||
|
registerEvent(131079, "warp/WarpInnLimsaLominsa.lua")
|
||||||
|
registerEvent(131082, "common/GenericWarp.lua")
|
||||||
|
registerEvent(131092, "common/GenericWarp.lua")
|
||||||
|
registerEvent(131093, "common/GenericWarp.lua")
|
||||||
|
registerEvent(131094, "common/GenericWarp.lua")
|
||||||
|
registerEvent(720916, "custom/000/cmndefinnbed_00020.lua")
|
||||||
registerEvent(1245185, "opening/OpeningLimsaLominsa.lua")
|
registerEvent(1245185, "opening/OpeningLimsaLominsa.lua")
|
||||||
registerEvent(1245186, "opening/OpeningGridania.lua")
|
registerEvent(1245186, "opening/OpeningGridania.lua")
|
||||||
registerEvent(1245187, "opening/OpeningUldah.lua")
|
registerEvent(1245187, "opening/OpeningUldah.lua")
|
||||||
registerEvent(131078, "warp/WarpInnGridania.lua")
|
|
||||||
registerEvent(131079, "warp/WarpInnLimsaLominsa.lua")
|
|
||||||
registerEvent(131082, "tosort/LimsaInnDoor.lua")
|
|
||||||
registerEvent(720916, "custom/000/cmndefinnbed_00020.lua")
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
--- TODO: find a way to hardcode it this way
|
-- generic warp, use this for most warps that are just a yes/no option
|
||||||
EVENT_ID = 131082
|
|
||||||
|
|
||||||
-- TODO: it seems that these all might share one common function, and the only difference is the event id
|
|
||||||
|
|
||||||
function onTalk(target, player)
|
function onTalk(target, player)
|
||||||
--- prompt to exit the inn
|
|
||||||
player:play_scene(target, EVENT_ID, 00000, 8192, 0)
|
player:play_scene(target, EVENT_ID, 00000, 8192, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,6 +9,6 @@ function onReturn(scene, results, player)
|
||||||
|
|
||||||
if results[1] == 1 then
|
if results[1] == 1 then
|
||||||
-- get warp
|
-- get warp
|
||||||
player:warp(EVENT_ID)
|
player:warp(EVENT_ID)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -28,6 +28,9 @@ function onReturn(scene, results, player)
|
||||||
|
|
||||||
player:finish_event(EVENT_ID)
|
player:finish_event(EVENT_ID)
|
||||||
elseif scene == 1 then -- sleep anim
|
elseif scene == 1 then -- sleep anim
|
||||||
|
-- play log out scene
|
||||||
|
player:play_scene(player.id, EVENT_ID, 2, 8192, 0)
|
||||||
|
elseif scene == 2 then -- log out
|
||||||
player:finish_event(EVENT_ID)
|
player:finish_event(EVENT_ID)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
--- 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'
|
--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it'
|
||||||
POS_START = 2299848
|
POS_START = 2299848
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
--- 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'
|
--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it'
|
||||||
POS_START = 4101800
|
POS_START = 4101800
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
--- TODO: find a way to hardcode it this way
|
|
||||||
EVENT_ID = 1245187
|
|
||||||
|
|
||||||
--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it'
|
--- load defines from Opening Excel sheet, which has this and we don't need to hardcode it'
|
||||||
POS_START = 4101669
|
POS_START = 4101669
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
--- TODO: find a way to hardcode it this way
|
|
||||||
EVENT_ID = 131079 -- TODO: wrong, i was testing in limsa
|
|
||||||
|
|
||||||
function onTalk(actorId, player)
|
function onTalk(actorId, player)
|
||||||
-- has inn access
|
-- has inn access
|
||||||
-- player:play_scene(131079, 00001, 1, 0)
|
-- player:play_scene(131079, 00001, 1, 0)
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
--- TODO: find a way to hardcode it this way
|
|
||||||
EVENT_ID = 131079
|
|
||||||
|
|
||||||
function onTalk(target, player)
|
function onTalk(target, player)
|
||||||
-- has inn access
|
-- has inn access
|
||||||
player:play_scene(target, EVENT_ID, 00001, 8192, 0)
|
player:play_scene(target, EVENT_ID, 00001, 8192, 0)
|
||||||
|
|
|
@ -733,7 +733,7 @@ async fn client_loop(
|
||||||
if let Some(event_script) =
|
if let Some(event_script) =
|
||||||
state.event_scripts.get(event_id)
|
state.event_scripts.get(event_id)
|
||||||
{
|
{
|
||||||
connection.event = Some(Event::new(&event_script));
|
connection.event = Some(Event::new(*event_id, &event_script));
|
||||||
connection
|
connection
|
||||||
.event
|
.event
|
||||||
.as_mut()
|
.as_mut()
|
||||||
|
|
|
@ -301,9 +301,9 @@ impl ChatHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
let event = match event_id {
|
let event = match event_id {
|
||||||
1245185 => Event::new("opening/OpeningLimsaLominsa.lua"),
|
1245185 => Event::new(1245185, "opening/OpeningLimsaLominsa.lua"),
|
||||||
1245186 => Event::new("opening/OpeningGridania.lua"),
|
1245186 => Event::new(1245186, "opening/OpeningGridania.lua"),
|
||||||
1245187 => Event::new("opening/OpeningUldah.lua"),
|
1245187 => Event::new(1245187, "opening/OpeningUldah.lua"),
|
||||||
_ => panic!("Unsupported event!"),
|
_ => panic!("Unsupported event!"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub struct Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
pub fn new(path: &str) -> Self {
|
pub fn new(id: u32, path: &str) -> Self {
|
||||||
let lua = Lua::new();
|
let lua = Lua::new();
|
||||||
|
|
||||||
let config = get_config();
|
let config = get_config();
|
||||||
|
@ -19,6 +19,8 @@ impl Event {
|
||||||
.exec()
|
.exec()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
lua.globals().set("EVENT_ID", id).unwrap();
|
||||||
|
|
||||||
Self { lua }
|
Self { lua }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue