slightly better tooltip
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
## Notes: Shows possible loot from dungeon bosses and other sources.
|
## Notes: Shows possible loot from dungeon bosses and other sources.
|
||||||
## Author: Shagu (pfUI update code), Lexie (Turtle WoW fixes/updates), Otari (overhaul/revamp, menu changes, bugfixes/updates)
|
## Author: Shagu (pfUI update code), Lexie (Turtle WoW fixes/updates), Otari (overhaul/revamp, menu changes, bugfixes/updates)
|
||||||
## LegacyAuthor: Daviesh, Pompa (Turtle WoW World Bosses), Xerron (Turtle WoW World Bosses), Gurky (Turtle WoW 1.16/1.16.1 Dungeons)
|
## LegacyAuthor: Daviesh, Pompa (Turtle WoW World Bosses), Xerron (Turtle WoW World Bosses), Gurky (Turtle WoW 1.16/1.16.1 Dungeons)
|
||||||
## Version: 3.1.2
|
## Version: 3.1.3
|
||||||
## SavedVariablesPerCharacter: AtlasLootCharDB
|
## SavedVariablesPerCharacter: AtlasLootCharDB
|
||||||
## OptionalDeps: Alphamap, AtlasLoader, LootLink, ItemSync, HewdropLib, Ace2, EquipCompare, EQCompare
|
## OptionalDeps: Alphamap, AtlasLoader, LootLink, ItemSync, HewdropLib, Ace2, EquipCompare, EQCompare
|
||||||
|
|
||||||
|
|||||||
+163
-131
@@ -4,144 +4,181 @@ local strfind = string.find
|
|||||||
local GetItemInfo = GetItemInfo
|
local GetItemInfo = GetItemInfo
|
||||||
local GREY = "|cff999999"
|
local GREY = "|cff999999"
|
||||||
|
|
||||||
local lastSearchName = nil
|
local lastSearchName
|
||||||
local lastSearchID = nil
|
local lastSearchID
|
||||||
|
|
||||||
local function GetItemIDByName(name)
|
local function GetItemIDByName(name)
|
||||||
if name ~= lastSearchName then
|
if not name then return nil end
|
||||||
for itemID = 1, 99999 do
|
if name ~= lastSearchName then
|
||||||
local itemName = GetItemInfo(itemID)
|
for itemID = 1, 99999 do
|
||||||
if (itemName and itemName == name) then
|
local itemName = GetItemInfo(itemID)
|
||||||
lastSearchID = itemID
|
if (itemName and itemName == name) then
|
||||||
break
|
lastSearchID = itemID
|
||||||
end
|
break
|
||||||
end
|
end
|
||||||
lastSearchName = name
|
end
|
||||||
end
|
lastSearchName = name
|
||||||
return lastSearchID
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetItemRef = SetItemRef
|
|
||||||
SetItemRef = function(link, text, button)
|
|
||||||
local item, _, id = string.find(link, "item:(%d+)")
|
|
||||||
ItemRefTooltip.itemID = id
|
|
||||||
HookSetItemRef(link, text, button)
|
|
||||||
if not IsShiftKeyDown() and not IsControlKeyDown() and item then
|
|
||||||
AtlasLootTip.extendTooltip(ItemRefTooltip)
|
|
||||||
end
|
end
|
||||||
|
return lastSearchID
|
||||||
end
|
end
|
||||||
|
|
||||||
local HookSetHyperlink = GameTooltip.SetHyperlink
|
local function HookTooltip(tooltip)
|
||||||
function GameTooltip.SetHyperlink(self, arg1)
|
local original_SetLootRollItem = tooltip.SetLootRollItem
|
||||||
if arg1 then
|
local original_SetLootItem = tooltip.SetLootItem
|
||||||
local _, _, linktype = string.find(arg1, "^(.-):(.+)$")
|
local original_SetMerchantItem = tooltip.SetMerchantItem
|
||||||
if linktype == "item" then
|
local original_SetQuestLogItem = tooltip.SetQuestLogItem
|
||||||
local _, _, id = string.find(arg1,"item:(%d+)")
|
local original_SetQuestItem = tooltip.SetQuestItem
|
||||||
GameTooltip.itemID = id
|
local original_SetHyperlink = tooltip.SetHyperlink
|
||||||
|
local original_SetBagItem = tooltip.SetBagItem
|
||||||
|
local original_SetInboxItem = tooltip.SetInboxItem
|
||||||
|
local original_SetInventoryItem = tooltip.SetInventoryItem
|
||||||
|
local original_SetCraftItem = tooltip.SetCraftItem
|
||||||
|
local original_SetCraftSpell = tooltip.SetCraftSpell
|
||||||
|
local original_SetTradeSkillItem = tooltip.SetTradeSkillItem
|
||||||
|
local original_SetAuctionItem = tooltip.SetAuctionItem
|
||||||
|
local original_SetAuctionSellItem = tooltip.SetAuctionSellItem
|
||||||
|
local original_SetTradePlayerItem = tooltip.SetTradePlayerItem
|
||||||
|
local original_SetTradeTargetItem = tooltip.SetTradeTargetItem
|
||||||
|
|
||||||
|
local original_OnHide = tooltip:GetScript("OnHide")
|
||||||
|
|
||||||
|
tooltip:SetScript("OnHide", function()
|
||||||
|
if original_OnHide then original_OnHide() end
|
||||||
|
this.itemID = nil
|
||||||
|
end)
|
||||||
|
|
||||||
|
function tooltip.SetLootRollItem(self, rollID)
|
||||||
|
original_SetLootRollItem(self, rollID)
|
||||||
|
local _, _, id = strfind(GetLootRollItemLink(rollID) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetHyperlink(self, arg1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetBagItem = GameTooltip.SetBagItem
|
function tooltip.SetLootItem(self, slot)
|
||||||
function GameTooltip.SetBagItem(self, container, slot)
|
original_SetLootItem(self, slot)
|
||||||
if GetContainerItemLink(container, slot) then
|
local _, _, id = strfind(GetLootSlotLink(slot) or "", "item:(%d+)")
|
||||||
local _, _, id = string.find(GetContainerItemLink(container, slot),"item:(%d+)")
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = id
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetBagItem(self, container, slot)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetInboxItem = GameTooltip.SetInboxItem
|
function tooltip.SetMerchantItem(self, merchantIndex)
|
||||||
function GameTooltip.SetInboxItem(self, mailID, attachmentIndex)
|
original_SetMerchantItem(self, merchantIndex)
|
||||||
local itemName = GetInboxItem(mailID)
|
local _, _, id = strfind(GetMerchantItemLink(merchantIndex) or "", "item:(%d+)")
|
||||||
if itemName then
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = GetItemIDByName(itemName)
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetInboxItem(self, mailID, attachmentIndex)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetInventoryItem = GameTooltip.SetInventoryItem
|
function tooltip.SetQuestLogItem(self, itemType, index)
|
||||||
function GameTooltip.SetInventoryItem(self, unit, slot)
|
original_SetQuestLogItem(self, itemType, index)
|
||||||
if GetInventoryItemLink(unit, slot) then
|
local _, _, id = strfind(GetQuestLogItemLink(itemType, index) or "", "item:(%d+)")
|
||||||
local _, _, id = string.find(GetInventoryItemLink(unit, slot),"item:(%d+)")
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = id
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetInventoryItem(self, unit, slot)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetCraftItem = GameTooltip.SetCraftItem
|
function tooltip.SetQuestItem(self, itemType, index)
|
||||||
function GameTooltip.SetCraftItem(self, skill, slot)
|
original_SetQuestItem(self, itemType, index)
|
||||||
if GetCraftReagentItemLink(skill, slot) then
|
local _, _, id = strfind(GetQuestItemLink(itemType, index) or "", "item:(%d+)")
|
||||||
local _, _, id = string.find(GetCraftReagentItemLink(skill, slot),"item:(%d+)")
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = id
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetCraftItem(self, skill, slot)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetTradeSkillItem = GameTooltip.SetTradeSkillItem
|
function tooltip.SetHyperlink(self, arg1)
|
||||||
function GameTooltip.SetTradeSkillItem(self, skillIndex, reagentIndex)
|
original_SetHyperlink(self, arg1)
|
||||||
if reagentIndex then
|
local _, _, id = strfind(arg1 or "", "item:(%d+)")
|
||||||
if GetTradeSkillReagentItemLink(skillIndex, reagentIndex) then
|
self.itemID = tonumber(id)
|
||||||
local _, _, id = string.find(GetTradeSkillReagentItemLink(skillIndex, reagentIndex),"item:(%d+)")
|
AtlasLootTip.extendTooltip(self)
|
||||||
GameTooltip.itemID = id
|
end
|
||||||
end
|
|
||||||
else
|
|
||||||
if GetTradeSkillItemLink(skillIndex) then
|
|
||||||
local _, _, id = string.find(GetTradeSkillItemLink(skillIndex),"item:(%d+)")
|
|
||||||
GameTooltip.itemID = id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return HookSetTradeSkillItem(self, skillIndex, reagentIndex)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetAuctionItem = GameTooltip.SetAuctionItem
|
function tooltip.SetBagItem(self, container, slot)
|
||||||
function GameTooltip.SetAuctionItem(self, atype, index)
|
local hasCooldown, repairCost = original_SetBagItem(self, container, slot)
|
||||||
local itemName = GetAuctionItemInfo(atype, index)
|
local _, _, id = strfind(GetContainerItemLink(container, slot) or "", "item:(%d+)")
|
||||||
if itemName then
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = GetItemIDByName(itemName)
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
return hasCooldown, repairCost
|
||||||
return HookSetAuctionItem(self, atype, index)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetAuctionSellItem = GameTooltip.SetAuctionSellItem
|
function tooltip.SetInboxItem(self, mailID, attachmentIndex)
|
||||||
function GameTooltip.SetAuctionSellItem(self)
|
original_SetInboxItem(self, mailID, attachmentIndex)
|
||||||
local itemName = GetAuctionSellItemInfo()
|
local itemName = GetInboxItem(mailID)
|
||||||
if itemName then
|
self.itemID = GetItemIDByName(itemName)
|
||||||
GameTooltip.itemID = GetItemIDByName(itemName)
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetAuctionSellItem(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetTradePlayerItem = GameTooltip.SetTradePlayerItem
|
function tooltip.SetInventoryItem(self, unit, slot)
|
||||||
function GameTooltip.SetTradePlayerItem(self, index)
|
local hasItem, hasCooldown, repairCost = original_SetInventoryItem(self, unit, slot)
|
||||||
if GetTradePlayerItemLink(index) then
|
local _, _, id = strfind(GetInventoryItemLink(unit, slot) or "", "item:(%d+)")
|
||||||
local _, _, id = string.find(GetTradePlayerItemLink(index),"item:(%d+)")
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = id
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
return hasItem, hasCooldown, repairCost
|
||||||
return HookSetTradePlayerItem(self, index)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local HookSetTradeTargetItem = GameTooltip.SetTradeTargetItem
|
function tooltip.SetCraftItem(self, skill, slot)
|
||||||
function GameTooltip.SetTradeTargetItem(self, index)
|
original_SetCraftItem(self, skill, slot)
|
||||||
if GetTradeTargetItemLink(index) then
|
local _, _, id = strfind(GetCraftReagentItemLink(skill, slot) or "", "item:(%d+)")
|
||||||
local _, _, id = string.find(GetTradeTargetItemLink(index),"item:(%d+)")
|
self.itemID = tonumber(id)
|
||||||
GameTooltip.itemID = id
|
AtlasLootTip.extendTooltip(self)
|
||||||
end
|
end
|
||||||
return HookSetTradeTargetItem(self, index)
|
|
||||||
|
function tooltip.SetCraftSpell(self, slot)
|
||||||
|
original_SetCraftSpell(self, slot)
|
||||||
|
local _, _, id = strfind(GetCraftItemLink(slot) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tooltip.SetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||||
|
original_SetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||||
|
if reagentIndex then
|
||||||
|
local _, _, id = strfind(GetTradeSkillReagentItemLink(skillIndex, reagentIndex) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
else
|
||||||
|
local _, _, id = strfind(GetTradeSkillItemLink(skillIndex) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
end
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tooltip.SetAuctionItem(self, atype, index)
|
||||||
|
original_SetAuctionItem(self, atype, index)
|
||||||
|
local itemName = GetAuctionItemInfo(atype, index)
|
||||||
|
self.itemID = GetItemIDByName(itemName)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tooltip.SetAuctionSellItem(self)
|
||||||
|
original_SetAuctionSellItem(self)
|
||||||
|
local itemName = GetAuctionSellItemInfo()
|
||||||
|
self.itemID = GetItemIDByName(itemName)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tooltip.SetTradePlayerItem(self, index)
|
||||||
|
original_SetTradePlayerItem(self, index)
|
||||||
|
local _, _, id = strfind(GetTradePlayerItemLink(index) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tooltip.SetTradeTargetItem(self, index)
|
||||||
|
original_SetTradeTargetItem(self, index)
|
||||||
|
local _, _, id = strfind(GetTradeTargetItemLink(index) or "", "item:(%d+)")
|
||||||
|
self.itemID = tonumber(id)
|
||||||
|
AtlasLootTip.extendTooltip(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sets = {
|
local sets = {
|
||||||
["SpiritofEskhandar"]=true,
|
["SpiritofEskhandar"] = true,
|
||||||
["HakkariBlades"]=true,
|
["HakkariBlades"] = true,
|
||||||
["PrimalBlessing"]=true,
|
["PrimalBlessing"] = true,
|
||||||
["ShardOfGods"]=true,
|
["ShardOfGods"] = true,
|
||||||
["DalRend"]=true,
|
["DalRend"] = true,
|
||||||
["SpiderKiss"]=true,
|
["SpiderKiss"] = true,
|
||||||
["UnobMounts"]=true,
|
["UnobMounts"] = true,
|
||||||
["Legendaries"]=true,
|
["Legendaries"] = true,
|
||||||
["Artifacts"]=true,
|
["Artifacts"] = true,
|
||||||
["ZGRings"]=true,
|
["ZGRings"] = true,
|
||||||
["Tabards"]=true,
|
["Tabards"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function SetContains(set, key)
|
local function SetContains(set, key)
|
||||||
@@ -153,7 +190,7 @@ end
|
|||||||
|
|
||||||
local lastItemID, lastSourceStr, lastDropRate
|
local lastItemID, lastSourceStr, lastDropRate
|
||||||
function AtlasLootTip.extendTooltip(tooltip)
|
function AtlasLootTip.extendTooltip(tooltip)
|
||||||
if AtlasLootCharDB.ShowSource ~= true or IsShiftKeyDown() then
|
if not AtlasLootCharDB.ShowSource then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tooltipName = tooltip:GetName()
|
local tooltipName = tooltip:GetName()
|
||||||
@@ -451,10 +488,8 @@ function AtlasLootTip.extendTooltip(tooltip)
|
|||||||
tooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
AtlasLootTip:SetScript("OnHide", function()
|
HookTooltip(GameTooltip)
|
||||||
GameTooltip.itemID = nil
|
HookTooltip(ItemRefTooltip)
|
||||||
ItemRefTooltip.itemID = nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
AtlasLootTip:SetScript("OnShow", function()
|
AtlasLootTip:SetScript("OnShow", function()
|
||||||
if aux_frame and aux_frame:IsVisible() then
|
if aux_frame and aux_frame:IsVisible() then
|
||||||
@@ -465,8 +500,8 @@ AtlasLootTip:SetScript("OnShow", function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
AtlasLootTip.extendTooltip(GameTooltip)
|
||||||
end
|
end
|
||||||
AtlasLootTip.extendTooltip(GameTooltip)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- adapted from http://shagu.org/ShaguTweaks/
|
-- adapted from http://shagu.org/ShaguTweaks/
|
||||||
@@ -485,8 +520,5 @@ AtlasLootTip.HookAddonOrVariable = function(addon, func)
|
|||||||
end
|
end
|
||||||
|
|
||||||
AtlasLootTip.HookAddonOrVariable("Tmog", function()
|
AtlasLootTip.HookAddonOrVariable("Tmog", function()
|
||||||
local tmog = CreateFrame("Frame", nil, TmogTooltip)
|
HookTooltip(TmogTooltip)
|
||||||
tmog:SetScript("OnShow", function()
|
|
||||||
AtlasLootTip.extendTooltip(TmogTooltip)
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user