mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
libtooltip: add tooltop library for extended infos
Add tooltip library, based on the sellvalue item hooks, in order to obtain extended gametooltip data, that can be used to query the current GameTooltip for ItemLink and ItemID.
This commit is contained in:
+3
-110
@@ -1,16 +1,9 @@
|
||||
pfUI:RegisterModule("sellvalue", "vanilla:tbc", function ()
|
||||
pfUI.sellvalue = CreateFrame( "Frame" , "pfGameTooltip", GameTooltip )
|
||||
|
||||
pfUI.sellvalue:SetScript("OnHide", function()
|
||||
GameTooltip.itemLink = nil
|
||||
GameTooltip.itemCount = nil
|
||||
end)
|
||||
|
||||
pfUI.sellvalue:SetScript("OnShow", function()
|
||||
if GameTooltip.itemLink then
|
||||
local _, _, itemID = string.find(GameTooltip.itemLink, "item:(%d+):%d+:%d+:%d+")
|
||||
local itemID = tonumber(itemID)
|
||||
local count = GameTooltip.itemCount or 1
|
||||
if libtooltip:GetItemLink() then
|
||||
local itemID = libtooltip:GetItemID()
|
||||
local count = libtooltip:GetItemCount() or 1
|
||||
|
||||
if pfSellData[itemID] then
|
||||
local _, _, sell, buy = strfind(pfSellData[itemID], "(.*),(.*)")
|
||||
@@ -40,104 +33,4 @@ pfUI:RegisterModule("sellvalue", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local pfHookSetBagItem = GameTooltip.SetBagItem
|
||||
function GameTooltip.SetBagItem(self, container, slot)
|
||||
GameTooltip.itemLink = GetContainerItemLink(container, slot)
|
||||
local _
|
||||
_, GameTooltip.itemCount = GetContainerItemInfo(container, slot)
|
||||
return pfHookSetBagItem(self, container, slot)
|
||||
end
|
||||
|
||||
local pfHookSetQuestLogItem = GameTooltip.SetQuestLogItem
|
||||
function GameTooltip.SetQuestLogItem(self, itemType, index)
|
||||
GameTooltip.itemLink = GetQuestLogItemLink(itemType, index)
|
||||
if not GameTooltip.itemLink then return end
|
||||
return pfHookSetQuestLogItem(self, itemType, index)
|
||||
end
|
||||
|
||||
local pfHookSetQuestItem = GameTooltip.SetQuestItem
|
||||
function GameTooltip.SetQuestItem(self, itemType, index)
|
||||
GameTooltip.itemLink = GetQuestItemLink(itemType, index)
|
||||
return pfHookSetQuestItem(self, itemType, index)
|
||||
end
|
||||
|
||||
local pfHookSetLootItem = GameTooltip.SetLootItem
|
||||
function GameTooltip.SetLootItem(self, slot)
|
||||
GameTooltip.itemLink = GetLootSlotLink(slot)
|
||||
pfHookSetLootItem(self, slot)
|
||||
end
|
||||
|
||||
local pfHookSetInboxItem = GameTooltip.SetInboxItem
|
||||
function GameTooltip.SetInboxItem(self, mailID, attachmentIndex)
|
||||
local itemName, itemTexture, inboxItemCount, inboxItemQuality = GetInboxItem(mailID)
|
||||
GameTooltip.itemLink = GetItemLinkByName(itemName)
|
||||
return pfHookSetInboxItem(self, mailID, attachmentIndex)
|
||||
end
|
||||
|
||||
local pfHookSetInventoryItem = GameTooltip.SetInventoryItem
|
||||
function GameTooltip.SetInventoryItem(self, unit, slot)
|
||||
GameTooltip.itemLink = GetInventoryItemLink(unit, slot)
|
||||
return pfHookSetInventoryItem(self, unit, slot)
|
||||
end
|
||||
|
||||
local pfHookSetLootRollItem = GameTooltip.SetLootRollItem
|
||||
function GameTooltip.SetLootRollItem(self, id)
|
||||
GameTooltip.itemLink = GetLootRollItemLink(id)
|
||||
return pfHookSetLootRollItem(self, id)
|
||||
end
|
||||
|
||||
local pfHookSetLootRollItem = GameTooltip.SetLootRollItem
|
||||
function GameTooltip.SetLootRollItem(self, id)
|
||||
GameTooltip.itemLink = GetLootRollItemLink(id)
|
||||
return pfHookSetLootRollItem(self, id)
|
||||
end
|
||||
|
||||
local pfHookSetMerchantItem = GameTooltip.SetMerchantItem
|
||||
function GameTooltip.SetMerchantItem(self, merchantIndex)
|
||||
GameTooltip.itemLink = GetMerchantItemLink(merchantIndex)
|
||||
return pfHookSetMerchantItem(self, merchantIndex)
|
||||
end
|
||||
|
||||
local pfHookSetCraftItem = GameTooltip.SetCraftItem
|
||||
function GameTooltip.SetCraftItem(self, skill, slot)
|
||||
GameTooltip.itemLink = GetCraftReagentItemLink(skill, slot)
|
||||
return pfHookSetCraftItem(self, skill, slot)
|
||||
end
|
||||
|
||||
local pfHookSetCraftSpell = GameTooltip.SetCraftSpell
|
||||
function GameTooltip.SetCraftSpell(self, slot)
|
||||
GameTooltip.itemLink = GetCraftItemLink(slot)
|
||||
return pfHookSetCraftSpell(self, slot)
|
||||
end
|
||||
|
||||
local pfHookSetTradeSkillItem = GameTooltip.SetTradeSkillItem
|
||||
function GameTooltip.SetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||
if reagentIndex then
|
||||
GameTooltip.itemLink = GetTradeSkillReagentItemLink(skillIndex, reagentIndex)
|
||||
else
|
||||
GameTooltip.itemLink = GetTradeSkillItemLink(skillIndex)
|
||||
end
|
||||
return pfHookSetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||
end
|
||||
|
||||
local pfHookSetAuctionSellItem = GameTooltip.SetAuctionSellItem
|
||||
function GameTooltip.SetAuctionSellItem(self)
|
||||
local itemName, _, itemCount = GetAuctionSellItemInfo()
|
||||
GameTooltip.itemCount = itemCount
|
||||
GameTooltip.itemLink = GetItemLinkByName(itemName)
|
||||
return pfHookSetAuctionSellItem(self)
|
||||
end
|
||||
|
||||
local pfHookSetTradePlayerItem = GameTooltip.SetTradePlayerItem
|
||||
function GameTooltip.SetTradePlayerItem(self, index)
|
||||
GameTooltip.itemLink = GetTradePlayerItemLink(index)
|
||||
return pfHookSetTradePlayerItem(self, index)
|
||||
end
|
||||
|
||||
local pfHookSetTradeTargetItem = GameTooltip.SetTradeTargetItem
|
||||
function GameTooltip.SetTradeTargetItem(self, index)
|
||||
GameTooltip.itemLink = GetTradeTargetItemLink(index)
|
||||
return pfHookSetTradeTargetItem(self, index)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user