-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathThefItemInfo.lua
168 lines (147 loc) · 5.65 KB
/
ThefItemInfo.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
-- Name: ThefItemInfo
-- Revision: $Revision: 0.1.6 $
-- Developed by: Thef (https://www.github.com/thefmade/ThefItemInfo)
-- Description: Shows the content phase of an item
-- Function to return ItemID
local function GetItemID(itemLink)
if not itemLink then return; end
local itemString = string.match(itemLink, "item[%-?%d:]+")
local _, itemID = strsplit(":", itemString)
return tonumber(itemID)
end
-- Function to check if detailed tooltips are activated
local function ThefItemInfoIsDetailedTooltipsActivated()
return GetCVar("UberTooltips") == "1"
end
-- Function to determine the item phase
local function ThefItemInfoGetPhase(itemID)
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, invTexture = GetItemInfo(itemID)
if not itemLevel then return; end
-- hyjal summit, reputation rings
if itemID > 29293 and itemID < 29310 then return 3; end
-- zul'aman, rings
if itemID > 33495 and itemID < 33501 then return 4; end
-- pvp trinkets, badge of justice
if itemID > 34575 and itemID < 34581 then return 4; end
-- pvp items, level 70 rare sets
if itemID > 35327 and itemID < 35417 and itemLevel == 115 then return 2; end
-- pvp items, season 1 late
if itemID > 32449 and itemID < 32997 and itemLevel == 123 then return 1; end
-- pvp items, cloaks, badge of justice
if itemID == 33304 then return 4; end
-- pvp items, season 2
if itemID > 30485 and itemID < 33314 and itemLevel == 136 then return 2; end
-- pvp items, season 1 to season 3, relics
if itemID > 33935 and itemID < 33954 then
if itemLevel == 115 then return 1; end
if itemLevel == 136 then return 2; end
if itemLevel == 146 then return 3; end
end
-- phase 1
if itemID < 31958 and itemLevel < 128 then return 1; end
-- phase 2
if itemID < 30861 and itemLevel < 142 then return 2; end
-- phase 2, ogri'la, items
if (itemID >= 32645 and itemID <= 32654) and itemLevel >= 105 then return 2; end
-- phase 2, ogri'la, gems
if (itemID >= 32634 and itemID <= 32641) and itemLevel == 70 then return 2; end
-- phase 3
if itemID < 33006 then return 3; end
-- hyjal summit, mace from trash
if itemID < 34541 and itemLevel > 140 then return 3; end
-- phase 4
if itemID < 34164 then return 4; end
-- phase 5
if itemLevel >= 115 then return 5; end
return nil
end
-- Function to lookup the item phase
local function ThefItemInfoGetPhaseByTable(itemID)
if not itemID then return; end
return ThefItemInfoPhases[itemID]
end
-- Function to add custom text to the tooltip
local function ThefItemInfoAddTooltipText(tooltip, itemLink)
local itemID = GetItemID(itemLink)
local itemPhaseByTable = ThefItemInfoGetPhaseByTable(itemID)
local itemPhaseByGuess = ThefItemInfoGetPhase(itemID)
local itemPhase = itemPhaseByTable or itemPhaseByGuess
--[[
local itemDebug
if ThefItemInfoGetPhaseByTable(itemID) ~= ThefItemInfoGetPhase(itemID) then
byTable = ThefItemInfoGetPhaseByTable(itemID)
byGuess = ThefItemInfoGetPhase(itemID)
if not byTable and byGuess == 1
if not byTable then byTable = "false"; end
if not byGuess then byGuess = "false"; end
itemDebug = itemID .. ": by table " .. byTable .. " vs. by guess " .. byGuess
-- DEBUG
ChatFrame1:AddMessage(itemDebug)
end
]]
if itemPhase then
tooltip:AppendText(" |cff999999(Phase " .. itemPhase .. ")|r")
-- only add detailed text if UberTooltips is activated in the interface options
if ThefItemInfoIsDetailedTooltipsActivated() then
-- todo: add translation table
tooltip:AddLine("Verfügbar seit Phase " .. itemPhase .. ".")
end
tooltip:Show() -- Ensure the tooltip updates and shows the new line
end
end
-- Function to handle the hook
local function ThefItemInfoInfoLatch(self)
local _, itemLink = self:GetItem()
if itemLink == "" or itemLink == nil then return; end
ThefItemInfoAddTooltipText(self, itemLink)
end
local TooltipList = {
-- standard tooltip
GameTooltip,
--SmallTextTooltip,
-- tooltip of linked items, with close button
ItemRefTooltip,
-- shopping tooltip
--ShoppingTooltip,
ShoppingTooltip1,
ShoppingTooltip2,
-- equip comparison tooltip
ComparisonTooltip,
-- support for EQCompare
--EQCompareTooltip,
-- support for takKompare
--tekKompareTooltip,
-- support for LinkWrangler
--IRR_,
--LinkWrangler,
-- support for MultiTips
-- support for Links
--LinksTooltip,
-- support for AtlasLoot
AtlasLootTooltip,
-- support for ItemMagic
--ItemMagicTooltip,
-- support for Sniff
--SniffTooltip,
-- support for LinkHeaven
--LH_,
-- support for Mirror
--MirrorTooltip,
-- support for TooltipExchange
--TooltipExchange_TooltipShow,
-- support for AtlasQuest
--AtlasQuestTooltip
}
for _, tooltip in pairs(TooltipList) do
tooltip:HookScript("OnTooltipSetItem", ThefItemInfoInfoLatch)
end
--[[
local function FrameCreationHook(frameType, name, parent, inheritFrame)
if frameType == "GameTooltip" and name == "ShoppingTooltip1" then
ChatFrame1:AddMessage("ShoppingTooltip1 erstellt!")
-- Hier kannst du zusätzliche Logik hinzufügen
end
ChatFrame1:AddMessage(frameType .. " created.")
end
hooksecurefunc("CreateFrame", FrameCreationHook)
]]