PageRenderTime 1ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/Tukui/modules/chat/spam.lua

http://github.com/Asphyxia/Tukui
Lua | 47 lines | 26 code | 11 blank | 10 comment | 7 complexity | 8039bc480c0cb2a869bd0fa9c213e4dc MD5 | raw file
 1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
 2if C["chat"].enable ~= true then return end
 3
 4-- This file is used for enGB or enUS client only.
 5-- translate or do anything you want if you want to 
 6-- use this feature on others clients.
 7
 8if T.client ~= "enUS" and T.client ~= "enGB" then return end
 9
10----------------------------------------------------------------------------------
11-- Hide annoying chat text when talent switch.
12----------------------------------------------------------------------------------
13
14function T.SPELL_FILTER(self, event, arg1)
15    if strfind(arg1,"You have unlearned") or strfind(arg1,"You have learned a new spell:") or strfind(arg1,"You have learned a new ability:") or strfind(arg1,"Your pet has unlearned") then
16        return true
17    end
18end
19ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", T.SPELL_FILTER)
20
21----------------------------------------------------------------------------------
22-- Hide annoying /sleep commands from goldspammer 
23-- with their hacks for multiple chars.
24----------------------------------------------------------------------------------
25
26local function GOLDSPAM_FILTER()
27	if GetMinimapZoneText() == "Valley of Strength" or GetMinimapZoneText() == "Trade District" then
28		ChatFrame_AddMessageEventFilter("CHAT_MSG_TEXT_EMOTE", T.FUCKYOU_GOLDSPAMMERS)
29	else
30		ChatFrame_RemoveMessageEventFilter("CHAT_MSG_TEXT_EMOTE", T.FUCKYOU_GOLDSPAMMERS)
31	end
32end
33
34function T.FUCKYOU_GOLDSPAMMERS(self, event, arg1)
35    if strfind(arg1, "falls asleep. Zzzzzzz.") then
36		return true
37    end
38end
39
40local GOLDSPAM = CreateFrame("Frame")
41GOLDSPAM:RegisterEvent("PLAYER_ENTERING_WORLD")
42GOLDSPAM:RegisterEvent("ZONE_CHANGED_INDOORS")
43GOLDSPAM:RegisterEvent("ZONE_CHANGED_NEW_AREA")
44GOLDSPAM:SetScript("OnEvent", GOLDSPAM_FILTER)
45
46
47