WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Make TSM show craft price and profit on all craftable items. (https://www.wowinterface.com/forums/showthread.php?t=57717)

hasnogaems 12-06-19 11:43 PM

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.

myrroddin 12-07-19 11:55 PM

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.

mooslemike 01-22-21 12:39 PM

Were you ever able to figure this out?

myrroddin 01-22-21 01:29 PM

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.


All times are GMT -6. The time now is 04:57 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI