-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleObjectiveProgress.lua
More file actions
36 lines (28 loc) · 1.24 KB
/
SimpleObjectiveProgress.lua
File metadata and controls
36 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--[[
SimpleObjectiveProgress
Developed by: Simca@Malfurion-US (MMOSimca)
]]--
-- Localized function references
local LOP = _G.LibStub("LibObjectiveProgress-1.0")
-- OnTooltipSetUnit hook function
local function SOP_Hook_OnTooltipSetUnit(self)
if not self or not self.NumLines or self:NumLines() == 0 then return end
local name, unit = self:GetUnit()
if not unit then return end
local GUID = UnitGUID(unit)
if not GUID or GUID == "" then return end
local npcID = select(6, ("-"):split(GUID))
if not npcID or npcID == "" then return end
local weightsTable = LOP:GetNPCWeightByCurrentQuests(tonumber(npcID))
if not weightsTable then return end
for questID, npcWeight in next, weightsTable do
local questTitle = QuestUtils_GetQuestName(questID)
for j = 1, self:NumLines() do
if _G["GameTooltipTextLeft" .. j] and _G["GameTooltipTextLeft" .. j]:GetText() == questTitle then
_G["GameTooltipTextLeft" .. j]:SetText(_G["GameTooltipTextLeft" .. j]:GetText() .. " - " .. tostring(math.floor((npcWeight * 100) + 0.5) / 100) .. "%")
end
end
end
end
-- Set our hook function
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, SOP_Hook_OnTooltipSetUnit)