/Tukui/modules/datatext/regen.lua

http://github.com/Asphyxia/Tukui · Lua · 31 lines · 25 code · 6 blank · 0 comment · 3 complexity · ed38e443deba363995fc6e233fd27485 MD5 · raw file

  1. local T, C, L = unpack(select(2, ...))
  2. if not C["datatext"].regen and not C["datatext"].regen > 0 then return end
  3. local regen
  4. local Stat = CreateFrame("Frame")
  5. Stat:SetFrameStrata("HIGH")
  6. Stat:SetFrameLevel(3)
  7. local Text = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
  8. Text:SetFont(C["media"].pixelfont, C["datatext"].fontsize)
  9. Text:SetShadowColor(0, 0, 0)
  10. Text:SetShadowOffset(1.25, -1.25)
  11. T.PP(C["datatext"].regen, Text)
  12. Stat:RegisterEvent("PLAYER_ENTERING_WORLD")
  13. Stat:RegisterEvent("PLAYER_REGEN_DISABLED")
  14. Stat:RegisterEvent("PLAYER_REGEN_ENABLED")
  15. Stat:RegisterEvent("UNIT_STATS")
  16. Stat:RegisterEvent("UNIT_AURA")
  17. Stat:SetScript("OnEvent", function(self)
  18. local base, casting = GetManaRegen()
  19. if InCombatLockdown() then
  20. regen = floor(casting*5)
  21. else
  22. regen = floor(base*5)
  23. end
  24. Text:SetText(MANA_REGEN_ABBR.." "..T.datacolor..regen)
  25. end)