/Tukui/modules/datatext/power.lua
http://github.com/Asphyxia/Tukui · Lua · 56 lines · 42 code · 11 blank · 3 comment · 9 complexity · 23ff8444654b1a537a179024aab9efd3 MD5 · raw file
- local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
- --------------------------------------------------------------------
- -- player power (attackpower or power depending on what you have more of)
- --------------------------------------------------------------------
- if C["datatext"].power and C["datatext"].power > 0 then
- local Stat = CreateFrame("Frame")
- Stat:SetFrameStrata("HIGH")
- Stat:SetFrameLevel(3)
- local Text = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
- Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
- T.PP(C["datatext"].power, Text)
- local int = 1
- local function Update(self, t)
- int = int - t
- local base, posBuff, negBuff = UnitAttackPower("player")
- local effective = base + posBuff + negBuff
- local Rbase, RposBuff, RnegBuff = UnitRangedAttackPower("player")
- local Reffective = Rbase + RposBuff + RnegBuff
- healpwr = GetSpellBonusHealing()
- Rattackpwr = Reffective
- spellpwr2 = GetSpellBonusDamage(7)
- attackpwr = effective
- if healpwr > spellpwr2 then
- spellpwr = healpwr
- else
- spellpwr = spellpwr2
- end
- if attackpwr > spellpwr and select(2, UnitClass("Player")) ~= "HUNTER" then
- pwr = attackpwr
- tp_pwr = L.datatext_playerap
- elseif select(2, UnitClass("Player")) == "HUNTER" then
- pwr = Reffective
- tp_pwr = L.datatext_playerap
- else
- pwr = spellpwr
- tp_pwr = L.datatext_playersp
- end
- if int < 0 then
- Text:SetText(tp_pwr.." "..T.datacolor.. pwr)
- int = 1
- end
- end
- Stat:SetScript("OnUpdate", Update)
- Update(Stat, 10)
- end