Guest User

NytFall Alpha rev1

a guest
Feb 23rd, 2010
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. --[[
  2.     NytFall.
  3.    
  4.     Currently:
  5.         Displays a message when logging in.
  6.         Prints a message if you fail to move in a raid.
  7.         At the end of combat, sends a list of all people who failed to raid or party.
  8. ]]
  9.  
  10. -- Frames
  11. NytFall = CreateFrame("Frame", "NytFall")
  12. LibFail = LibStub("LibFail-1.0")
  13. local Fails = LibFail:GetSupportedEvents()
  14. local CombatFails = {} -- We'll use this to record fails and report at the end of combat
  15.  
  16. -- Register
  17. NytFall:RegisterEvent("PLAYER_ENTERING_WORLD")
  18. NytFall:RegisterEvent("PLAYER_REGEN_ENABLED")
  19.  
  20. -- Main Funcs
  21.  
  22. function NytFall_OnEvent(self, event, ...)
  23.     if (event == "PLAYER_ENTERING_WORLD") then
  24.         DEFAULT_CHAT_FRAME:AddMessage("NytFall BETA loaded.")
  25.     elseif (event == "PLAYER_REGEN_ENABLED") then
  26.         if (#CombatFails ~= 0) then
  27.             for k, v in pairs(CombatFails) do
  28.                 if (UnitInRaid("player") == true) then
  29.                     SendChatMessage(v, "RAID")
  30.                 else
  31.                     SendChatMessage(v, "PARTY")
  32.                 end
  33.             end
  34.         end
  35.     end
  36. end
  37.  
  38. local function NytFall_OnFail(event, player, type)
  39.     local FailSpell = GetSpellInfo(LibFail:GetEventSpellId(event)) or "" -- Get the spell that killed the player
  40.     local LibFail_Message
  41.     local Count
  42.     if (type == LibFail.FAIL_TYPE_NOTMOVING) then
  43.         LibFail_Message = "%s did not move from %s!"
  44.         CombatFails[player] = LibFail_Message
  45.     end
  46.     print(LibFail_Message:format(player, spell)) -- Replace the first $s with the playername and %s with the Spell name
  47. end
  48.  
  49. -- Other
  50.  
  51. for _, event in ipairs(Fails) do
  52.     LibFail.RegisterCallback("NytFall", event, "NytFall_OnFail")
  53. end
  54.  
  55. NytFall:SetScript("OnEvent", "NytFall_OnEvent")
Advertisement
Add Comment
Please, Sign In to add comment