Files
wow-weakauras/Complete Projects/Legion/Chat.lua

48 lines
1.9 KiB
Lua

--CHAT_MSG_SAY, CHAT_MSG_PARTY, CHAT_MSG_PARTY_LEADER, CHAT_MSG_RAID, CHAT_MSG_RAID_LEADER, CHAT_MSG_WHISPER, CHAT_MSG_WHISPER_INFORM
function(event,msg,sender)
local isAnna = 0
local date = date()
local localtime = date:match("%d%d%/%d%d%/%d%d%s(%d%d%p%d%d%p%d%d)")
local sender = sender:match("%a+")
local year = date:match("%d%d%/%d%d/(%d%d)") + 2000 --01/07/(19) 14:36:42
local month = date:match("(%d%d)") --(01)/07/19 14:36:42
local day = date:match("%d%d%/(%d%d)") --01/(07)/19 14:36:42
--Remove first place zeros
if day:find("0") == 1 then
day = day:gsub("0", "")
end
if month:find("0") == 1 then
month = month:gsub("0", "")
end
local localdate = day .. "." .. month .. "." .. year
if IsInGroup() and GetNumGroupMembers() == 2 and (UnitName("party1") == "Alurielle" or UnitName("party1") == "Eilishie") and event ~= "CHAT_MSG_WHISPER" and event ~= "CHAT_MSG_WHISPER_INFORM" then --If in group/raid with Anna
isAnna = 1
else
for i = 1, 40 do
if UnitExists("nameplate" .. i) and (UnitName("nameplate" .. i) == "Alurielle" or UnitName("nameplate" .. i) == "Eilishie") then --If not in group but near Anna --TODO: only save playername and Alurielle /s
if sender == "Alurielle" or sender == "Eilishie" or sender == UnitName("player") then
isAnna = 1
end
end
end
end
if event == "CHAT_MSG_WHISPER" then --If whisper from Anna
if sender == "Alurielle" or sender == "Eilishie" then
isAnna = 1
end
end
if event == "CHAT_MSG_WHISPER_INFORM" then --If whispering Anna
if sender == "Alurielle" or sender == "Eilishie" then --Actually whisper target
local output = "[" .. localdate .. "][" .. localtime .. "]" .. "[" .. UnitName("player") .. "]: " .. msg
AnnaBoo[#AnnaBoo + 1] = output
end
end
if isAnna == 1 then
local output = "[" .. localdate .. "][" .. localtime .. "]" .. "[" .. sender .. "]: " .. msg
AnnaBoo[#AnnaBoo + 1] = output
end
end