Quantcast Getting required profession levels for Recipes/Patterns/Plans/Schematics etc.? - WoWInterface
Thread Tools Display Modes
10-02-18, 04:54 AM   #1
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Getting required profession levels for Recipes/Patterns/Plans/Schematics etc.?

I know that for items in general it is possilbe to get the required minimum player level with GetItemInfo().

But is there a similarly easy way to get the minimum profession skill level for a Recipe/Pattern/Plan/Schematic etc.? E.g. that you need "Cooking (120)" to learn a certain recipe?

Or is scanning the item's tooltip the only way here?
If so, how do I get the localized term to search for "Required ..."?

Thanks.
  Reply With Quote
10-02-18, 09:29 AM   #2
MuffinManKen
A Black Drake
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 80
I assumed that C_TradeSkill would have something, but I don't see it. The closest is C_TradeSkillUI.GetRecipeSourceText which would probably be faster than tooltip scanning, but I'm pretty sure it would only work for Trainer-learned recipes.

LibPeriodicTable would have helped before Blizzard split the Tradeskills into the different expansion-based categories.

So from what I can see, scanning tooltips is the best option. I'm not positive, but I think the global ITEM_MIN_SKILL is what you want to look for. It's equal to "Requires %s (%d)" in enUS.
  Reply With Quote
10-02-18, 12:21 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
I haven't played with it myself but these functions look like they may prove useful.

local recipeIDs = C_TradeSkillUI.GetAllRecipeIDs();

for i, recipeID in ipairs(recipeIDs) do
local recipeInfo = C_TradeSkillUI.GetRecipeInfo(recipeID);
end


These were found in this file:
https://www.townlong-yak.com/framexm...RecipeList.lua

But looking at :
https://wow.gamepedia.com/API_C_Trad....GetRecipeInfo
There is no level check in the recipe info table

So the question is where they are getting the level reference from. Possibly behind the scene database if not in one of the api commands. The API Documentation looks to be incomplete for the tradeskills so there may be other functions/variables/data that they haven't used themselves.
__________________
  Reply With Quote
10-10-18, 06:43 AM   #4
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Thanks for your replies.

I guess I have to go for scanning the tooltip then.
But more questions arise. Maybe you can help me again?

What I am working on is an addon that will color the item icons of all recipes red, if the player character does not fulfill the required skill level to learn it.

So

1.) How can I get the current player skill level for a profession? How can I differentiate between the different expansions?

2.) When I scan the recipe tooltip, ITEM_MIN_SKILL = "Requires %s (%d)" seems to be the right global to scan for (thanks @MuffinManKen). But when I want to know what expansion it is about, I would need the globals for the expansion names (Outland, Northrend, Cataclysm, Pandaria, Legion, Zandalari/Kul Tiras) as well, right? What would these globals be?

Thanks again!
  Reply With Quote
10-10-18, 07:07 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
I haven't looked at tradeskills since before Legion so the changes added then and in BfA have changed that knowledge. But, they did have a way of getting that information but I can't locate it in the blizzard code at https://www.townlong-yak.com/framexml/live/. You may want to see if another addon does something similar and see how theirs is doing it.
__________________
  Reply With Quote
10-10-18, 06:13 PM   #6
Nimhfree
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 247
Blizzard has the values EXPANSION_NAME0 through EXPANSION_NAME7 at the moment.
  Reply With Quote
10-10-18, 06:23 PM   #7
Nimhfree
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 247
I have not converted Grail to using the new profession system, but in general you get the professions the user has with:
Code:
local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
And then you can call:
Code:
GetProfessionInfo(professionId)
where the professionId is each of the items returned from the first call. Historically it was good enough to use the first return value (the profession name), and the third return value (the profession skill level). However, now that skill level is only within the specific expansion value. I believe the fourth return value is the maximum skill in that expansion value, so third and fourth values of 13 and 150 would mean you have skill 13/150 in the specific expansion. However, I do not know what value tells me the expansion yet.
  Reply With Quote
10-10-18, 06:38 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
Ah yeah that's the one I played with before.

It may be that the nth item will be the nth expansion. How does the profession name display per n item, seeing as for the most part the name includes the expansion name so should help confirm if that is the case. ? If it is the case, export to an indexed table and use that table for ease of use.

Thanks Nimh,
__________________
  Reply With Quote
10-11-18, 03:31 PM   #9
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Originally Posted by Nimhfree View Post
Blizzard has the values EXPANSION_NAME0 through EXPANSION_NAME7 at the moment.
Thanks for the hint! But these values apparently include the actual expansion names:

Code:
0 "Classic"
1 "The Burning Crusade"
2 "Wrath of the Lich King"
3 "Cataclysm"
4 "Mist of Pandaria"
5 "Warlords of Draenor"
6 "Legion"
7 "Battle for Azeroth"
However, when I want to know what expansion skill bar a recipe belongs to by scanning the recipe's tooltip, I would need the localised versions of:

Code:
0 ""
1 "Outland"
2 "Northrend"
3 "Cataclysm"
4 "Pandaria"
5 "Draenor"
6 "Legion"
7 (Horde) "Zandalari"
7 (Alliance) "Kul Tiras"
Any idea where I could find these?

But it is getting more complicated. See e.g. the follwing tooltip line in different languages:

Code:
English:  Requires Outland Jewelcrafting (25)
German:   Benötigt Juwelierskunst der Scherbenwelt (25)
Spanish:  Requiere Joyería de Terrallende (25)
Italian:  Richiede Oreficeria delle Terre Esterne (25)
Frensh:   Joaillerie de l’Outreterre (25) requis
The problem is that the profession name and the expansion name appear in different orders.
ITEM_MIN_SKILL = "Requires %s (%d)" only has one placeholder %s for both. So even if I knew the localised version of the profession and expansion names, I would still have to trial and error in which order they occur, right?

Or is there a way that does not require scanning the tooltip?

Last edited by LudiusMaximus : 10-11-18 at 04:21 PM.
  Reply With Quote
10-11-18, 04:37 PM   #10
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
The EXPANSIONx values are localised...

Work out which index you need from the localised names and display that instead.

Here is how I do it in my mageports addon.


Code:
addonData.Expansion = 
{
    [0] = EXPANSION_NAME0,  -- Classic
    [1] = EXPANSION_NAME1,  -- The Burning Crusade
    [2] = EXPANSION_NAME2,  -- Wrath of the Lich King
    [3] = EXPANSION_NAME3,  -- Cataclysm
    [4] = EXPANSION_NAME4,  -- Mists of Pandaria
    [5] = EXPANSION_NAME5,  -- Warlords of Draenor
    [6] = EXPANSION_NAME6,  -- Legion
    [7] = EXPANSION_NAME7,  -- Battle for Azeroth
}

addonData.Spells = {
    -- Expansion 0
    [3561] = {faction = "Alliance", expansion = 0, level = 17, map = 13, isPortal = false}, -- Teleport:Stormwind  (Alliance)
}
As you can see the expansion value informs the addon to look at index 0 of the Expansion list whenever I need to access the name for display purposes.

Hmm, you would use the following line but none of it shows an ID unless skillLine returns something useful.


Code:
local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo(index)
However, because of the different way languages work even a search for the string may not work as some languages change some words dependent on the usage. But it may be worth trying in case this example proves otherwise.
__________________

Last edited by Xrystal : 10-11-18 at 04:40 PM.
  Reply With Quote
10-11-18, 04:54 PM   #11
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Originally Posted by Xrystal View Post
The EXPANSIONx values are localised...
Work out which index you need from the localised names and display that instead.
Thanks for your suggestion, but I am not quite sure if I understand.

The expansion names of EXPANSIONx are no use to me.

I do not need to display anything yet, I first of all need to identify the expansion of a recipe by scanning its tooltip (because there seems to be no other way...).

And I cannot derive e.g. "Outland" (English), "der Scherbenwelt" (German), "de Terrallende" (Spanish), "delle Terre Esterne" (Italian), "de l’Outreterre" (Frensh) etc. just from EXPANSION1 = "The Burning Crusade"...
  Reply With Quote
10-11-18, 05:24 PM   #12
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Originally Posted by Nimhfree View Post
I have not converted Grail to using the new profession system, but in general you get the professions the user has with:
Code:
local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
And then you can call:
Code:
GetProfessionInfo(professionId)
where the professionId is each of the items returned from the first call. Historically it was good enough to use the first return value (the profession name), and the third return value (the profession skill level). However, now that skill level is only within the specific expansion value. I believe the fourth return value is the maximum skill in that expansion value, so third and fourth values of 13 and 150 would mean you have skill 13/150 in the specific expansion. However, I do not know what value tells me the expansion yet.

Apparently, GetProfessionInfo() only gives you the values for the one skill bar, WoW deems appropriate for your character level. So when I am a lvl 100 demon hunter that has just learned cooking, GetProfessionInfo() will only give me the values of my "Legion Cooking" skill bar. :-(

Any idea how I can access the values for the other skill bars?

But for my addon I only need to know if my character's skill level is high enough to learn a recipe. I don't care how far I am from reaching it. So I am thinking about simply using GetTextColor() in the tooltip scan. If the "Requires ... Cooking (...)" line is red, I know that my character cannot learn the recipe yet. A little cumbersome, but this would do the trick I guess.
  Reply With Quote
10-11-18, 05:51 PM   #13
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
That actually sounds easier than trying to figure out how to do it the less cumbersome way. You can always change how it finds out the info when you figure out a way to do it, if any.

And yes, with Burning Crusade I can see the problem and it further enforces the decision to use the color value of the text.

Although, I just noticed something on RecipeInfo function returns. Maybe the recipe is disabled if it is unlearnable by the player. Also, categoryID, if you haven't checked already, may be the expansion it is for. The learned value to see if it is already learned, obviously. Just a thought.

Code:
categoryID	Number	ID of the category the recipe belongs to.
craftable	Boolean	Indicates if the recipe can be crafted.
difficulty	String	"trivial", "easy", "optimal", or "medium"
disabled	Boolean	Indicates if the recipe is disabled.
favorite	Boolean	Indicates if the recipe is marked as a favorite.
hiddenUnlessLearned	Boolean	Indicates if the recipe should be hidden if it has yet to be learned.
icon	Number	ID of the recipe's icon.
learned	Boolean	Indicates if the character has learned the recipe.
name	String	Name of the recipe.
nextRecipeID	Number	ID of next recipe in the list.
numAvailable	Number	The number that can be created with the available reagents.
numIndents	Number	Number of indents when displaying under categories.
numSkillUps	Number	The number of skillups from creating the recipe.
previousRecipeID	Number	ID of the previous recipe in the list.
recipeID	Number	ID of the recipe.
sourceType	Number	Source of the recipe.
type	String	Type of recipe
alternateVerb	String	Alternate verb used for the recipe (such as enchants, or engineering tinkers)
__________________
  Reply With Quote
10-12-18, 05:44 AM   #14
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Originally Posted by Xrystal View Post
That actually sounds easier than trying to figure out how to do it the less cumbersome way. You can always change how it finds out the info when you figure out a way to do it, if any.
Yeah, I find it hard to believe that Blizzard is not providing any way to obtain the skill levels for all expansions. Let's see if there will be a solution to that at some point.

Originally Posted by Xrystal View Post
And yes, with Burning Crusade I can see the problem and it further enforces the decision to use the color value of the text.
Unfortunately, the color value of the tooltip text does not solve this problem. I want to know what expansion the required skill of a recipe belongs to. If this is only possible via scanning the tooltip, and there are no globals containing the localised phrases (Outland, der Scherbenwelt, de Terrallende, delle Terre Esterne, de l’Outreterre, etc.) I could only hardcode these phrases into my addon. But I am hesitant to do so. Anyway, the purpose of my addon is only useful while leveling alts that have a lot of items and recipes in their bank they cannot use/learn yet. For endgame players, there is no real benefit. So I think I will not put much more effort into it...

Originally Posted by Xrystal View Post
Although, I just noticed something on RecipeInfo function returns. Maybe the recipe is disabled if it is unlearnable by the player. Also, categoryID, if you haven't checked already, may be the expansion it is for.
I would like to give that a try. But a stupid question, if I may: How do I get the recipeID when I only have an itemLink to start with??

Thanks again!
  Reply With Quote
10-12-18, 06:41 AM   #15
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
This might help you. It details how to understand the parts of the itemstring. Recipe strings should be very similar so a similar set of code should result in what you want.

https://wow.gamepedia.com/ItemLink

EG.

item links include the value item:xxxx which is the type of link followed by its id

Give it a test run as it doesn't specify that it has been updated for BfA so there may be some additional info that they haven't documented.
__________________
  Reply With Quote
10-13-18, 06:15 AM   #16
LudiusMaximus
A Deviate Faerie Dragon
 
LudiusMaximus's Avatar
Join Date: Mar 2018
Posts: 12
Originally Posted by Xrystal View Post
This might help you. It details how to understand the parts of the itemstring. Recipe strings should be very similar so a similar set of code should result in what you want.

https://wow.gamepedia.com/ItemLink

EG.

item links include the value item:xxxx which is the type of link followed by its id

Give it a test run as it doesn't specify that it has been updated for BfA so there may be some additional info that they haven't documented.

Hm, the ItemLink does not seem to include the recipeID.

E.g. the reicpeID of "Savory Deviate Delight" is 8238

But string.match(itemLink, "item[%-?%d:]+") for "Savory Deviate Delight" returns

item:6661::::::::::56:71:::::::



Also the category of a recipe does not seem to have anything to do with the expansion it belongs to.

E.g. the category of "Savory Deviate Delight" is "Unusual Delights", and there is no further parent category...

Last edited by LudiusMaximus : 10-13-18 at 06:28 AM.
  Reply With Quote
10-13-18, 02:18 PM   #17
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,234
Hmm

https://www.wowhead.com/item=6657/sa...eviate-delight

https://www.wowhead.com/item=6661/re...eviate-delight

https://www.wowhead.com/spell=8238/s...eviate-delight

One seems to be the recipe after it is learned (8238) and one (6661) the recipe scroll that is picked up and the other (6657) is the resulting food stack item.

So, unless there is something in the recipe list that points to the sourceID ( recipe scroll ) you might not be able to tie them together to guarantee a match.


Also, have you looked at all the returns for the GetItemInfo on the recipe scroll ?

https://wow.gamepedia.com/API_GetItemInfo

Code:
1. itemName
String - The localized name of the item.
2. itemLink
String - The localized item link of the item.
3. itemRarity
Number - The quality of the item. The value is 0 to 7, which represents Poor to Heirloom. This appears to include gains from upgrades/bonuses.
4. itemLevel
Number - The base item level of this item, not including item levels gained from upgrades. Use GetDetailedItemLevelInfo to get the actual current level of the item.
5. itemMinLevel
Number - The minimum level required to use the item, 0 meaning no level requirement.
6. itemType
String - The localized type of the item: Armor, Weapon, Quest, Key, etc.
7. itemSubType
String - The localized sub-type of the item: Enchanting, Cloth, Sword, etc. See itemType.
8. itemStackCount
Number - How many of the item per stack: 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc.
9. itemEquipLoc
String - The type of inventory equipment location in which the item may be equipped, or "" if it can't be equippable. The string returned is also the name of a global string variable e.g. if "INVTYPE_WEAPONMAINHAND" is returned, _G["INVTYPE_WEAPONMAINHAND"] will be the localized, displayable name of the location.
10. itemIcon
Number (fileID) - The icon texture for the item.
11. itemSellPrice
Number - The price, in copper, a vendor is willing to pay for this item, 0 for items that cannot be sold.
12. itemClassID
Number - This is the numerical value that determines the string to display for 'itemType'.
13. itemSubClassID
Number - This is the numerical value that determines the string to display for 'itemSubType'
14. bindType
Number - Item binding type: 0 - none; 1 - on pickup; 2 - on equip; 3 - on use; 4 - quest.
15. expacID
Number - ?
16. itemSetID
Number - ?
17. isCraftingReagent
Boolean - ?
The auction house puts red boxes around recipes you can't learn so looking into how they know that. It might offer a clue on how you can do it.
Darn it, they use a special Auction related function that returns 'canUse' in one of its returns and GetItemInfo doesn't.
__________________

Last edited by Xrystal : 10-13-18 at 02:38 PM.
  Reply With Quote
10-15-18, 08:33 PM   #18
Nimhfree
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 247
You can try from Blizzard_TradeSkillUI.lua:
Code:
			--[[ Parent categories ]]--
			local categories = { C_TradeSkillUI.GetCategories() };

			for i, categoryID in ipairs(categories) do
				local categoryData = C_TradeSkillUI.GetCategoryInfo(categoryID);
				info.text = categoryData.name;
The name is localized. However, it appears with my brief testing that you need to have opened the Blizzard panel up first before C_TradeSkillUI API actually returns non nil.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting required profession levels for Recipes/Patterns/Plans/Schematics etc.?

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