-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatrizztrap.lua
55 lines (43 loc) · 1.65 KB
/
catrizztrap.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
-------------------------------------------------------------------------------
-- init
aura_env.stanceResponses = { [1] = { "roar" }, -- bear
[2] = { "hiss", "meow", "purr" }, -- cat
[4] = { "cuddle" } } -- boomkin (usually)
-------------------------------------------------------------------------------
-- TSU: CHAT_MSG_TEXT_EMOTE
function(allstates, event, message, senderName)
if event ~= "CHAT_MSG_TEXT_EMOTE" then
return false
end
local fullSenderName
if message:match(" pets you.$") or message:match("gently pats you.$") then
fullSenderName = message:match("^([^ ]+)")
else
return false
end
local state = allstates[fullSenderName]
if state ~= nil then
-- The sender is spamming. Ignore this emote from them until the state
-- expires.
return false
end
local duration = 1
state = { ["show"] = true,
["changed"] = true,
["progressType"] = "timed",
["duration"] = duration,
["expirationTime"] = GetTime() + duration,
["autoHide"] = true,
["fullSenderName"] = fullSenderName }
allstates[fullSenderName] = state
return true
end
-------------------------------------------------------------------------------
-- on show
local sender = aura_env.states[1]["fullSenderName"]
local stance = aura_env.states[2]["form"]
local stanceResponseOptions = aura_env.stanceResponses[stance]
if stanceResponseOptions then
local index = random(#stanceResponseOptions)
DoEmote(stanceResponseOptions[index], sender)
end