Thread Tools Display Modes
12-06-19, 11:43 PM   #1
hasnogaems
A Flamescale Wyrmkin
 
hasnogaems's Avatar
Join Date: Apr 2016
Posts: 109
Make TSM show craft price and profit on all craftable items.

In wow classic. I'm trying to edit file that I think must regulate its behaviour, so far my tinkering made TSM crafting tab completely dissapear from tooltips.
Default behaviour is showing crafting tab only for learned recipes.
https://imgur.com/a/v9w5bxw

Here is the code:
Code:
-- ------------------------------------------------------------------------------ --
--                                TradeSkillMaster                                --
--                http://www.curse.com/addons/wow/tradeskill-master               --
--                                                                                --
--             A TradeSkillMaster Addon (http://tradeskillmaster.com)             --
--    All Rights Reserved* - Detailed license information included with addon.    --
-- ------------------------------------------------------------------------------ --

local _, TSM = ...
local Crafting = TSM.Tooltip:NewPackage("Crafting")
local L = TSM.L
local private = {}
local DEFAULTS = {
	craftingCost = true,
	matPrice = false,
	detailedMats = false,
}



-- ============================================================================
-- Module Functions
-- ============================================================================

function Crafting.OnInitialize()
	TSM.Tooltip.Register("Crafting", DEFAULTS, private.LoadTooltip)
end



-- ============================================================================
-- Private Helper Functions
-- ============================================================================

function private.LoadTooltip(tooltip, itemString, options)
	itemString = TSMAPI_FOUR.Item.ToBaseItemString(itemString)

	if TSM.Crafting.CanCraftItem(itemString) and options.craftingCost then
		local cost, spellId = TSM.Crafting.Cost.GetLowestCostByItem(itemString)
		if cost then
			local buyout = TSM.Crafting.Cost.GetCraftedItemValue(itemString)
			local profit = buyout and (buyout - cost) or nil

			local costText = cost and tooltip:FormatMoney(cost) or "|cffffffff---|r"
			local profitColor = (profit or 0) < 0 and "|cffff0000" or "|cff00ff00"
			local profitText = profit and tooltip:FormatMoney(profit, profitColor) or "|cffffffff---|r"
			tooltip:AddLine(L["Crafting Cost"], format(L["%s (%s profit)"], costText, profitText))

			if options.detailedMats then
				tooltip:StartSection()
				local numResult = TSM.Crafting.GetNumResult(spellId)
				for _, matItemString, matQuantity in TSM.Crafting.MatIterator(spellId) do
					local name = TSMAPI_FOUR.Item.GetName(matItemString)
					local matCost = TSM.Crafting.Cost.GetMatCost(matItemString)
					local quality = TSMAPI_FOUR.Item.GetQuality(matItemString)
					if name and matCost and quality then
						tooltip:AddSubItemValueLine(matItemString, matCost, matQuantity / numResult)
					end
				end
				tooltip:EndSection()
			end
		end
	end

	-- add mat price
	if options.matPrice then
		local matCost = TSM.Crafting.Cost.GetMatCost(itemString)
		if matCost then
			tooltip:AddItemValueLine(L["Mat Cost"], matCost)
		end
	end
end
I highlighted the line that I want to be displayed on every craftable item, not only on which I can craft myself.

Last edited by hasnogaems : 12-16-19 at 11:52 PM.
  Reply With Quote
12-07-19, 11:55 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Your best bet is post a pastebin or link this thread to the TSM/Woweconomy Discord server. Use the #Classic-Support channel.

https://discord.gg/FJ4877H

http://support.tradeskillmaster.com/ to get the Discord link again. It's at the bottom middle. The TSM devs watch for support there.
  Reply With Quote
01-22-21, 12:39 PM   #3
mooslemike
A Defias Bandit
Join Date: Oct 2019
Posts: 2
Were you ever able to figure this out?
  Reply With Quote
01-22-21, 01:29 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
It isn't possible. Blizzard removed all access to recipes and professions you haven't learned during Cataclysm. Since Classic uses the retail API, no version of the game can show you costs or profit for unlearned recipes.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Make TSM show craft price and profit on all craftable items.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off