-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMount.lua
45 lines (39 loc) · 1.39 KB
/
Mount.lua
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
37
38
39
40
41
42
43
44
45
local LibEvent = LibStub:GetLibrary("LibEvent.7000")
local LibSchedule = LibStub:GetLibrary("LibSchedule.7000")
local mounts = {}
if (not C_MountJournal) then return end
local function GetAllMountSource()
local mountIDs = C_MountJournal.GetMountIDs()
local _, spellID, isCollected, source
for i, mountID in ipairs(mountIDs) do
_, spellID, _, _, _, _, _, _, _, _, isCollected = C_MountJournal.GetMountInfoByID(mountID)
_, _, source = C_MountJournal.GetMountInfoExtraByID(mountID)
mounts[spellID] = {
source = source,
isCollected = isCollected,
}
end
if (#mounts > 0) then return true end
end
LibEvent:attachEvent("VARIABLES_LOADED", function()
LibSchedule:AddTask({
identity = "GetAllMountSource",
elasped = 10,
begined = GetTime() + 10,
expired = GetTime() + 100,
override = true,
onExecute = GetAllMountSource,
})
end)
hooksecurefunc(GameTooltip, "SetUnitBuff", function(self, ...)
local spellID = select(10, UnitBuff(...))
if (mounts[spellID]) then
self:AddLine(" ")
if (mounts[spellID].isCollected) then
self:AddDoubleLine(mounts[spellID].source, COLLECTED, 1, 1, 1, 0.1, 1, 0.1)
else
self:AddLine(mounts[spellID].source, 1, 1, 1)
end
self:Show()
end
end)