Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions Source_Classic/CraftingInfo/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,28 @@ local function CraftCostString()
end

local function ProfitString(profit)
local price
local toCraft = GetSkillReagentsTotal()

local percentageValue = 0
if toCraft > 0 then
percentageValue = math.floor((profit / toCraft) * 100 * 100 + 0.5) / 100
end

local priceText
if profit >= 0 then
price = WHITE_FONT_COLOR:WrapTextInColorCode(GetMoneyString(profit, true))
priceText = WHITE_FONT_COLOR:WrapTextInColorCode(GetMoneyString(profit, true))
else
price = RED_FONT_COLOR:WrapTextInColorCode("-" .. GetMoneyString(-profit, true))
priceText = RED_FONT_COLOR:WrapTextInColorCode("-" .. GetMoneyString(-profit, true))
end

return AUCTIONATOR_L_PROFIT_COLON .. " " .. price


local percentageText
if percentageValue >= 0 then
percentageText = WHITE_FONT_COLOR:WrapTextInColorCode(percentageValue .. "%")
else
percentageText = RED_FONT_COLOR:WrapTextInColorCode(percentageValue .. "%")
end

return AUCTIONATOR_L_PROFIT_COLON .. " " .. priceText .. " (" .. percentageText .. ")"
end

function Auctionator.CraftingInfo.GetInfoText()
Expand Down
25 changes: 19 additions & 6 deletions Source_Mainline/CraftingInfo/Professions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,28 @@ local function CheapestQualityCostString(schematicForm)
end

local function ProfitString(profit)
local price
local toCraft = GetSkillReagentsTotal()

local percentageValue = 0
if toCraft > 0 then
percentageValue = math.floor((profit / toCraft) * 100 * 100 + 0.5) / 100
end

local priceText
if profit >= 0 then
price = WHITE_FONT_COLOR:WrapTextInColorCode(GetMoneyString(profit, true))
priceText = WHITE_FONT_COLOR:WrapTextInColorCode(GetMoneyString(profit, true))
else
price = RED_FONT_COLOR:WrapTextInColorCode("-" .. GetMoneyString(-profit, true))
priceText = RED_FONT_COLOR:WrapTextInColorCode("-" .. GetMoneyString(-profit, true))
end

return AUCTIONATOR_L_PROFIT_COLON .. " " .. price


local percentageText
if percentageValue >= 0 then
percentageText = WHITE_FONT_COLOR:WrapTextInColorCode(percentageValue .. "%")
else
percentageText = RED_FONT_COLOR:WrapTextInColorCode(percentageValue .. "%")
end

return AUCTIONATOR_L_PROFIT_COLON .. " " .. priceText .. " (" .. percentageText .. ")"
end

function Auctionator.CraftingInfo.GetInfoText(schematicForm, showProfit)
Expand Down