-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOnyfansLoot.lua
98 lines (91 loc) · 3.91 KB
/
OnyfansLoot.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
local util = OnyFansLoot.util
local function SetItemRefHook(link,name,button)
if (link and name and ItemRefTooltip) then
if (strsub(link, 1, 6) ~= "Player") then
if (ItemRefTooltip:IsVisible()) then
if (not DressUpFrame:IsVisible()) then
local itemName, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(link)
if itemName then
AddLootListToToolTip(ItemRefTooltip, string.lower(itemName))
end
end
ItemRefTooltip.isDisplayDone = nil
end
end
end
end
OnyFansLoot:SecureHook("SetItemRef",SetItemRefHook)
function AddLootListToToolTip(Tooltip, itemName)
local lootTable = OnyFansLoot.isStaged and StagedOfLoot or OfLoot
local listVersion = OnyFansLoot.util:GetListVersion(lootTable)
if OnyFansLoot.util:DoesTableContainKey(lootTable, string.lower(itemName)) and itemName and IsAltKeyDown() then
CheckVersionAddLine(listVersion,Tooltip, itemName)
local list = OnyFansLoot.util:CreateItemList(lootTable, string.lower(itemName))
if OnyFansLoot.util:IsEmptyString(list) then
Tooltip:AddLine("1: Free Roll" ,1,0,0)
else
Tooltip:AddLine(OnyFansLoot.util:TitleCase(list),1,0,0)
end
Tooltip:Show()
elseif itemName == "broken boar tusk" and IsAltKeyDown() then
Tooltip:AddLine("1: Goblin Loot" ,1,0,0)
Tooltip:Show()
elseif IsAltKeyDown() then
CheckVersionAddLine(listVersion,Tooltip, itemName)
Tooltip:AddLine("1: Free Roll" ,1,0,0)
Tooltip:Show()
end
end
function CheckVersionAddLine(listVersion, Tooltip, itemName)
local numExlusions = OnyFansLoot.util:GetNumOfExlusions(itemName)
local listDate
if OnyFansLoot.isStaged then
Tooltip:AddLine("Staged: Uncommited changes",1,0,0)
end
if OfLoot["version"] == nil then
listDate = date("%m-%d-%y")
else
listDate = OfLoot["version"][2]
end
local listTitle = "|cffFF0000List#|r"
local dateTitle = "|cffFF0000#Date#|r"
local excludingTitle = "|cffFF0000#Excluding#|r"
local namesFoot = "|cffFF0000#Names|r"
local pListVersion = "|cff9482c9" .. listVersion .. "|r"
local pDate = "|cff9482c9" .. listDate .. "|r"
local pNumExclusions = "|cff9482c9" .. numExlusions .. "|r"
if listVersion > 0 then
Tooltip:AddLine(listTitle ..pListVersion ..dateTitle .. pDate .. excludingTitle .. pNumExclusions .. namesFoot)
else
Tooltip:AddLine("No List Installed",1,0,0)
end
end
OnyfansGameTooltip = CreateFrame("Frame","OnyfansGameToolTip",GameTooltip)
OnyfansGameTooltip:SetScript("OnShow", function (self)
if GameTooltip and GameTooltip.itemLink then
local itemString = OnyFansLoot.util:ItemLinkToItemString(GameTooltip.itemLink)
if itemString then
local itemName, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemString)
if itemName then
AddLootListToToolTip(GameTooltip, itemName)
end
end
end
end)
OnyFansLoot:SecureHook(GameTooltip, "SetLootItem", function(this, slot)
local itemString = OnyFansLoot.util:ItemLinkToItemString(GetLootSlotLink(slot))
local itemName, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemString)
if itemName then
AddLootListToToolTip(GameTooltip, string.lower(itemName))
end
end)
if AtlasLoot then
OnyFansLoot:SecureHook("AtlasLootItem_OnEnter", function()
if this.itemID then
local itemName, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(this.itemID)
if itemName and AtlasLootTooltip then
AddLootListToToolTip(AtlasLootTooltip, itemName)
end
end
end)
end