mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-01 11:20:01 +00:00
sellvalue: show sellprice on bag item tooltips
This commit is contained in:
Vendored
+13
@@ -22,3 +22,16 @@ function strsplit(delimiter, subject)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function CreateGoldString(money)
|
||||
local gold = floor(money/ 100 / 100)
|
||||
local silver = floor(mod((money/100),100))
|
||||
local copper = floor(mod(money,100))
|
||||
|
||||
local string = ""
|
||||
if gold > 0 then string = string .. "|cffffffff" .. gold .. "|cffffd700g" end
|
||||
if silver > 0 then string = string .. "|cffffffff " .. silver .. "|cffc7c7cfs" end
|
||||
string = string .. "|cffffffff " .. copper .. "|cffeda55fc"
|
||||
|
||||
return string
|
||||
end
|
||||
|
||||
Vendored
+1892
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
pfUI:RegisterModule("sellvalue", function ()
|
||||
pfUI.sellvalue = CreateFrame( "Frame" , "pfUIsellvalue", GameTooltip )
|
||||
|
||||
pfUI.sellvalue:SetScript("OnShow", function()
|
||||
if GetMouseFocus() and GetMouseFocus():GetParent() then
|
||||
local bag = GetMouseFocus():GetParent():GetID()
|
||||
local slot = GetMouseFocus():GetID()
|
||||
local _, count = GetContainerItemInfo(bag, slot)
|
||||
local itemLink = GetContainerItemLink(bag, slot);
|
||||
if not itemLink then return end
|
||||
|
||||
local _, _, iid = string.find(itemLink, "item:(%d+):%d+:%d+:%d+")
|
||||
local _, _, itemLink = string.find(itemLink, "(item:%d+:%d+:%d+:%d+)");
|
||||
local itemName = GetItemInfo(itemLink)
|
||||
|
||||
if pfSellData[tonumber(iid)] and itemName == getglobal("GameTooltipTextLeft1"):GetText() then
|
||||
local _, _, sell, buy = strfind(pfSellData[tonumber(iid)], "(.*),(.*)")
|
||||
sell = sell * count
|
||||
buy = buy * count
|
||||
|
||||
if not MerchantFrame:IsShown() then
|
||||
SetTooltipMoney(GameTooltip, sell)
|
||||
end
|
||||
|
||||
if IsShiftKeyDown() then
|
||||
GameTooltip:AddLine(" ")
|
||||
|
||||
if count > 1 then
|
||||
GameTooltip:AddDoubleLine("Sell:", CreateGoldString(sell / count) .. "|cff555555 // " .. CreateGoldString(sell), 1, 1, 1);
|
||||
else
|
||||
GameTooltip:AddDoubleLine("Sell:", CreateGoldString(sell), 1, 1, 1);
|
||||
end
|
||||
|
||||
if count > 1 then
|
||||
GameTooltip:AddDoubleLine("Buy:", CreateGoldString(buy / count) .. "|cff555555 // " .. CreateGoldString(buy), 1, 1, 1);
|
||||
else
|
||||
GameTooltip:AddDoubleLine("Buy:", CreateGoldString(buy), 1, 1, 1);
|
||||
end
|
||||
end
|
||||
GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user