sellvalue: show sellprice on bag item tooltips

This commit is contained in:
shagu
2016-12-21 13:02:47 +01:00
parent b40ba83717
commit b210b07a0e
4 changed files with 1951 additions and 1 deletions
+13
View File
@@ -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
+1892
View File
File diff suppressed because it is too large Load Diff
+44
View File
@@ -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)
+2 -1
View File
@@ -20,7 +20,7 @@ env\locales_ruRU.lua
env\colors.lua
env\functions.lua
env\fonts.lua
env\hacks.lua
env\selldata.lua
# modules
modules\config.lua
@@ -53,3 +53,4 @@ modules\buff.lua
modules\nameplates.lua
modules\loot.lua
modules\infight.lua
modules\sellvalue.lua