/Tukui/modules/chat/spam.lua

http://github.com/Asphyxia/Tukui · Lua · 47 lines · 26 code · 11 blank · 10 comment · 15 complexity · 8039bc480c0cb2a869bd0fa9c213e4dc MD5 · raw file

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. if C["chat"].enable ~= true then return end
  3. -- This file is used for enGB or enUS client only.
  4. -- translate or do anything you want if you want to
  5. -- use this feature on others clients.
  6. if T.client ~= "enUS" and T.client ~= "enGB" then return end
  7. ----------------------------------------------------------------------------------
  8. -- Hide annoying chat text when talent switch.
  9. ----------------------------------------------------------------------------------
  10. function T.SPELL_FILTER(self, event, arg1)
  11. 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
  12. return true
  13. end
  14. end
  15. ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", T.SPELL_FILTER)
  16. ----------------------------------------------------------------------------------
  17. -- Hide annoying /sleep commands from goldspammer
  18. -- with their hacks for multiple chars.
  19. ----------------------------------------------------------------------------------
  20. local function GOLDSPAM_FILTER()
  21. if GetMinimapZoneText() == "Valley of Strength" or GetMinimapZoneText() == "Trade District" then
  22. ChatFrame_AddMessageEventFilter("CHAT_MSG_TEXT_EMOTE", T.FUCKYOU_GOLDSPAMMERS)
  23. else
  24. ChatFrame_RemoveMessageEventFilter("CHAT_MSG_TEXT_EMOTE", T.FUCKYOU_GOLDSPAMMERS)
  25. end
  26. end
  27. function T.FUCKYOU_GOLDSPAMMERS(self, event, arg1)
  28. if strfind(arg1, "falls asleep. Zzzzzzz.") then
  29. return true
  30. end
  31. end
  32. local GOLDSPAM = CreateFrame("Frame")
  33. GOLDSPAM:RegisterEvent("PLAYER_ENTERING_WORLD")
  34. GOLDSPAM:RegisterEvent("ZONE_CHANGED_INDOORS")
  35. GOLDSPAM:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  36. GOLDSPAM:SetScript("OnEvent", GOLDSPAM_FILTER)