diff --git a/resources/scripts/Global.lua b/resources/scripts/Global.lua index 3b7981a..6e2c013 100644 --- a/resources/scripts/Global.lua +++ b/resources/scripts/Global.lua @@ -16,3 +16,4 @@ registerEvent(1245186, "opening/OpeningGridania.lua") registerEvent(1245187, "opening/OpeningUldah.lua") registerEvent(131078, "warp/WarpInnGridania.lua") registerEvent(131079, "warp/WarpInnLimsaLominsa.lua") +registerEvent(131082, "tosort/LimsaInnDoor.lua") diff --git a/resources/scripts/tosort/LimsaInnDoor.lua b/resources/scripts/tosort/LimsaInnDoor.lua new file mode 100644 index 0000000..a76d9a2 --- /dev/null +++ b/resources/scripts/tosort/LimsaInnDoor.lua @@ -0,0 +1,16 @@ +--- TODO: find a way to hardcode it this way +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) + --- prompt to exit the inn + player:play_scene(target, EVENT_ID, 00000, 8192, 0) +end + +function onReturn(results, player) + if results[1] == 1 then + -- get warp + player:warp(EVENT_ID) + end +end diff --git a/src/world/lua.rs b/src/world/lua.rs index a47f533..a85a632 100644 --- a/src/world/lua.rs +++ b/src/world/lua.rs @@ -1,7 +1,7 @@ -use mlua::{FromLua, Lua, LuaSerdeExt, UserData, UserDataMethods, Value}; +use mlua::{FromLua, Lua, LuaSerdeExt, UserData, UserDataFields, UserDataMethods, Value}; use crate::{ - common::{ObjectTypeId, Position, timestamp_secs, workdefinitions::RemakeMode}, + common::{ObjectId, ObjectTypeId, Position, timestamp_secs, workdefinitions::RemakeMode}, ipc::zone::{ ActionEffect, DamageElement, DamageKind, DamageType, EffectKind, EventScene, ServerZoneIpcData, ServerZoneIpcSegment, Warp, @@ -154,6 +154,15 @@ impl UserData for LuaPlayer { Ok(()) }); } + + fn add_fields>(fields: &mut F) { + fields.add_field_method_get("id", |_, this| { + Ok(ObjectTypeId { + object_id: ObjectId(this.player_data.actor_id), + object_type: 0, + }) + }); + } } impl UserData for Position {}