-
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
What version(s) of WoW are you using?
Retail
What problem are you experiencing that led to you asking for this feature?
This adds the auction house data from the TSM plugin and puts the price for the item button in a 3 digit + 1 decimal place + Millions or thousands or nothing suffix to show how much an item sells (mostly) currently on the auction house. Hides the decimal if the number is like 300M or 30.0M too. Does not show anything if the price is less than 10 gold, or if the item is warbound/soulbound. I'm sorry if this is formatted/written wrong I never developed a wow addon before.
What solution would you like?
-- Format copper into short gold string like 3.1M / 300K / 3.1K / 500
local function ShortGold(copper)
local gold = floor(copper / 10000) -- copper to gold
if gold >= 1000000 then
return string.format("%.1fm", gold / 1000000):gsub("%.0m", "m") -- 3.0m -> 3m
elseif gold >= 1000 then
return string.format("%.1fk", gold / 1000):gsub("%.0k", "k") -- 2.0k -> 2k
else
return tostring(gold)
end
end
local function IsCurrentlyBound(details)
if details.bagID and details.slotID then
local itemLoc = ItemLocation:CreateFromBagAndSlot(details.bagID, details.slotID)
if C_Item.IsBound(itemLoc) then
return true
end
end
return false
end
Baganator.API.RegisterCornerWidget("tsmPrice", "TSM Price",
function(widget, details)
if details.itemLink
and not IsCurrentlyBound(details) -- hide if soulbound/warbound/account bound
and TSM_API
and TSM_API.ToItemString
then
local itemString = TSM_API.ToItemString(details.itemLink)
if itemString then
local price = TSM_API.GetCustomPriceValue("DBMarket", itemString)
if price and price > 100000 then
widget:SetText(ShortGold(price))
return true
end
end
end
return false
end,
function(itemButton)
local text = itemButton:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
text:SetTextColor(1, 0.82, 0)
local fontFile, fontSize = text:GetFont()
text:SetFont(fontFile, fontSize, "OUTLINE")
text:SetShadowOffset(1, -1)
text:SetShadowColor(0, 0, 0, 0.8)
text.sizeFont = true
return text
end
)
Any alternatives you can think of?
also add auctionator support?
Anything else?
No response