/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

  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. --------------------------------------------------------------------
  3. -- player power (attackpower or power depending on what you have more of)
  4. --------------------------------------------------------------------
  5. if C["datatext"].power and C["datatext"].power > 0 then
  6. local Stat = CreateFrame("Frame")
  7. Stat:SetFrameStrata("HIGH")
  8. Stat:SetFrameLevel(3)
  9. local Text = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
  10. Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  11. T.PP(C["datatext"].power, Text)
  12. local int = 1
  13. local function Update(self, t)
  14. int = int - t
  15. local base, posBuff, negBuff = UnitAttackPower("player")
  16. local effective = base + posBuff + negBuff
  17. local Rbase, RposBuff, RnegBuff = UnitRangedAttackPower("player")
  18. local Reffective = Rbase + RposBuff + RnegBuff
  19. healpwr = GetSpellBonusHealing()
  20. Rattackpwr = Reffective
  21. spellpwr2 = GetSpellBonusDamage(7)
  22. attackpwr = effective
  23. if healpwr > spellpwr2 then
  24. spellpwr = healpwr
  25. else
  26. spellpwr = spellpwr2
  27. end
  28. if attackpwr > spellpwr and select(2, UnitClass("Player")) ~= "HUNTER" then
  29. pwr = attackpwr
  30. tp_pwr = L.datatext_playerap
  31. elseif select(2, UnitClass("Player")) == "HUNTER" then
  32. pwr = Reffective
  33. tp_pwr = L.datatext_playerap
  34. else
  35. pwr = spellpwr
  36. tp_pwr = L.datatext_playersp
  37. end
  38. if int < 0 then
  39. Text:SetText(tp_pwr.." "..T.datacolor.. pwr)
  40. int = 1
  41. end
  42. end
  43. Stat:SetScript("OnUpdate", Update)
  44. Update(Stat, 10)
  45. end