PageRenderTime 41ms CodeModel.GetById 36ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/datatext/regen.lua

http://github.com/Asphyxia/Tukui
Lua | 31 lines | 25 code | 6 blank | 0 comment | 2 complexity | ed38e443deba363995fc6e233fd27485 MD5 | raw file
 1local T, C, L = unpack(select(2, ...))
 2if not C["datatext"].regen and not C["datatext"].regen > 0 then return end
 3
 4local regen
 5
 6local Stat = CreateFrame("Frame")
 7Stat:SetFrameStrata("HIGH")
 8Stat:SetFrameLevel(3)
 9
10local Text = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
11Text:SetFont(C["media"].pixelfont, C["datatext"].fontsize)
12Text:SetShadowColor(0, 0, 0)
13Text:SetShadowOffset(1.25, -1.25)
14T.PP(C["datatext"].regen, Text)
15
16Stat:RegisterEvent("PLAYER_ENTERING_WORLD")
17Stat:RegisterEvent("PLAYER_REGEN_DISABLED")
18Stat:RegisterEvent("PLAYER_REGEN_ENABLED")
19Stat:RegisterEvent("UNIT_STATS")
20Stat:RegisterEvent("UNIT_AURA")
21Stat:SetScript("OnEvent", function(self)
22	local base, casting = GetManaRegen()
23
24	if InCombatLockdown() then
25		regen = floor(casting*5)
26	else
27		regen = floor(base*5)		
28	end
29	
30	Text:SetText(MANA_REGEN_ABBR.." "..T.datacolor..regen)
31end)