/Tukui/modules/datatext/profession.lua

http://github.com/Asphyxia/Tukui · Lua · 40 lines · 32 code · 5 blank · 3 comment · 6 complexity · 6b664320640624d5c99f49f1a21fb4ce MD5 · raw file

  1. --------------------------------------------------------------------
  2. -- Professions
  3. --------------------------------------------------------------------
  4. local T, C, L = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
  5. if not C["datatext"].profession or C["datatext"].profession == 0 then return end
  6. local Stat = CreateFrame("Frame")
  7. Stat:EnableMouse(true)
  8. Stat:SetFrameStrata("HIGH")
  9. Stat:SetFrameLevel(3)
  10. local Text = T.SetFontString(TukuiInfoLeft, C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  11. T.PP(C["datatext"].profession, Text)
  12. local function Update(self)
  13. for _, v in pairs({GetProfessions()}) do
  14. if v ~= nil then
  15. local name, texture, rank, maxRank = GetProfessionInfo(v)
  16. Text:SetFormattedText(T.datacolor.."Profession")
  17. end
  18. end
  19. self:SetAllPoints(Text)
  20. end
  21. Stat:SetScript("OnEnter", function()
  22. local anchor, panel, xoff, yoff = T.DataTextTooltipAnchor(Text)
  23. GameTooltip:SetOwner(panel, anchor, xoff, yoff)
  24. GameTooltip:ClearLines()
  25. GameTooltip:AddLine(T.myname.."'s Professions", .4,.78,1)
  26. for _, v in pairs({GetProfessions()}) do
  27. if v ~= nil then
  28. local name, texture, rank, maxRank = GetProfessionInfo(v)
  29. GameTooltip:AddDoubleLine(name, rank.." / "..maxRank,.75,.9,1,.3,1,.3)
  30. end
  31. end
  32. GameTooltip:Show()
  33. end)
  34. Stat:SetScript("OnUpdate", Update)
  35. Stat:SetScript("OnLeave", function() GameTooltip:Hide() end)