PageRenderTime 30ms CodeModel.GetById 26ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/Tukui/modules/datatext/haste.lua

http://github.com/Asphyxia/Tukui
Lua | 39 lines | 29 code | 7 blank | 3 comment | 4 complexity | 9cddefdf14be9dff3d0a21e078166315 MD5 | raw file
 1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
 2--------------------------------------------------------------------
 3-- player haste
 4--------------------------------------------------------------------
 5
 6if C["datatext"].haste and C["datatext"].haste > 0 then
 7	local Stat = CreateFrame("Frame")
 8	Stat:SetFrameStrata("HIGH")
 9	Stat:SetFrameLevel(3)
10
11	local Text  = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
12	Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
13	T.PP(C["datatext"].haste, Text)
14
15	local int = 1
16
17	local function Update(self, t)
18		spellhaste = GetCombatRating(20)
19		rangedhaste = GetCombatRating(19)
20		attackhaste = GetCombatRating(18)
21		
22		if attackhaste > spellhaste and select(2, UnitClass("Player")) ~= "HUNTER" then
23			haste = attackhaste
24		elseif select(2, UnitClass("Player")) == "HUNTER" then
25			haste = rangedhaste
26		else
27			haste = spellhaste
28		end
29		
30		int = int - t
31		if int < 0 then
32			Text:SetText(SPELL_HASTE_ABBR..": "..T.datacolor..haste)
33			int = 1
34		end     
35	end
36
37	Stat:SetScript("OnUpdate", Update)
38	Update(Stat, 10)
39end