summaryrefslogtreecommitdiffstats
path: root/data/scripts/libs/libtmw.lua
diff options
context:
space:
mode:
Diffstat (limited to 'data/scripts/libs/libtmw.lua')
-rw-r--r--data/scripts/libs/libtmw.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/data/scripts/libs/libtmw.lua b/data/scripts/libs/libtmw.lua
index 5df9e3c..251e20a 100644
--- a/data/scripts/libs/libtmw.lua
+++ b/data/scripts/libs/libtmw.lua
@@ -123,6 +123,12 @@ function get_quest_var(ch, name)
return coroutine.yield(3, name)
end
+-- Gets the post for a user.
+function getpost(ch)
+ tmw.chr_get_post(ch)
+ return coroutine.yield(3)
+end
+
-- Processes as much of an NPC handler as possible.
local function process_npc(w, ...)
local co = w[2]
@@ -234,6 +240,19 @@ function quest_reply(ch, name, value)
states[ch] = nil
end
+function post_reply(ch, sender, letter)
+ local w = states[ch]
+ if w then
+ local w3 = w[3]
+ if (w3 == 3 or w3 == 4) then
+ if process_npc(w, sender, letter) then
+ return
+ end
+ end
+ end
+ states[ch] = nil
+end
+
-- Called by the game every tick for each NPC.
function npc_update(npc)
local h = npc_update_functs[npc];