WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Classic profession skill levels? (https://www.wowinterface.com/forums/showthread.php?t=57554)

jshipley 09-27-19 08:58 PM

Classic profession skill levels?
 
I'm trying to figure out the best way to find out what my current skill level is for First Aid.

From what I can find, GetProfessions / GetProfessionInfo don't work in Classic, and I'm stuck trying to use GetSkillLineInfo. The problem is that I'm not sure I can rely on this. I'm currently using index 10, because that's what First Aid is for me, right now. I could loop over GetSkillLineInfo using GetNumSkillLines, but then I would have to rely on using the "First Aid" string to identify the right skill line and I don't think that would work in any language other than English.

Is there a better way to get the current First Aid skill in Classic?

Kanegasi 09-27-19 11:16 PM

Loop through those indexes while comparing the skillname argument with the available global strings, which are locally translated depending on the installed client.

CHARACTER_PROFESSION_ALCHEMY = "Alchemy"
CHARACTER_PROFESSION_BLACKSMITHING = "Blacksmithing"
CHARACTER_PROFESSION_ENCHANTING = "Enchanting"
CHARACTER_PROFESSION_ENGINEERING = "Engineering"
CHARACTER_PROFESSION_FIRST_AID = "First Aid"
CHARACTER_PROFESSION_HERBALISM = "Herbalism"
CHARACTER_PROFESSION_LEATHERWORKING = "Leatherworking"
CHARACTER_PROFESSION_MINING = "Mining"
CHARACTER_PROFESSION_SKINNING = "Skinning"
CHARACTER_PROFESSION_TAILORING = "Tailoring"

I'm sure you already have the 4th argument, which is the skill level, but make sure to add it to the 5th argument, which is any temp points, like fishing has with poles and bobbers. I don't know if First Aid has any temp buffs or items but better safe than sorry.

jshipley 09-28-19 01:02 AM

Thank you. Those global strings are exactly what I need.

fyehu43 09-28-19 03:21 AM

Quote:

Originally Posted by Kanegasi (Post 334023)
Loop through those indexes while comparing the skillname argument with the available global strings, which are locally translated depending on the installed client.

CHARACTER_PROFESSION_ALCHEMY = "Alchemy"
CHARACTER_PROFESSION_BLACKSMITHING = "Blacksmithing"
CHARACTER_PROFESSION_ENCHANTING = "Enchanting"
CHARACTER_PROFESSION_ENGINEERING = "Engineering"
CHARACTER_PROFESSION_FIRST_AID = "First Aid"
CHARACTER_PROFESSION_HERBALISM = "Herbalism"
CHARACTER_PROFESSION_LEATHERWORKING = "Leatherworking"
CHARACTER_PROFESSION_MINING = "Mining"
CHARACTER_PROFESSION_SKINNING = "Skinning"
CHARACTER_PROFESSION_TAILORING = "Tailoring"

I'm sure you already have the 4th argument, which is the skill level, but make sure to add it to the 5th argument, which is any temp points, like fishing has with poles and bobbers. I don't know if First Aid has any temp buffs or items but better safe than sorry.

ohh neat I legitimately didn't know about this, thanks!

Kanegasi 09-28-19 09:33 AM

Unfortunately, GlobalStrings have not been included in the FrameXML dump for years, so it's understandable that some people miss it. However, there are sites that extract things from the game files:

https://wow.tools/dbc/?dbc=globalstr...search=&page=1

Nimhfree 09-28-19 11:58 AM

I just tried in Classic and it appears CHARACTER_PROFESSION_ENCHANTING, etc. are all nil.

Kanegasi 09-28-19 01:59 PM

Weird, then that means the wow.tools dump is wrong or somehow dumped retail instead. Searching the strings directly ingame for "PROFESSIONS" got me these:

Lua Code:
  1. --LE_FRAME_TUTORIAL_PROFESSIONS=5,
  2. --PROFESSIONS_ARCHAEOLOGY="Archaeology",
  3. --PROFESSIONS_ARCHAEOLOGY_MISSING="Visit a trainer to learn archaeology.  Archaeology allows you to discover valuable treasures and learn ancient lore of the world.",
  4. PROFESSIONS_COOKING="Cooking",
  5. --PROFESSIONS_COOKING_MISSING="Visit a trainer to learn cooking. Cooking lets you learn recipes to create food that heals you out of combat and grants you temporary buffs."
  6. PROFESSIONS_FIRST_AID="First Aid",
  7. --PROFESSIONS_FIRST_AID_MISSING="Visit a trainer to learn first aid.  First aid lets you turn cloth into bandages for healing yourself and others.",
  8. --PROFESSIONS_FIRST_PROFESSION="First Profession",
  9. PROFESSIONS_FISHING="Fishing",
  10. --PROFESSIONS_FISHING_MISSING="Visit a trainer to learn fishing.  Fishing lets you catch fish and other strange things from water.  Fish can be cooked into delicious meals with the Cooking skill.",
  11. --PROFESSIONS_HELP_1="You can find trainers for professions in a major city.\n\nA gathering profession is recommended for new players.",
  12. --PROFESSIONS_HELP_2="You can find trainers for professions in a major city.\n\nFirst Aid is recommended for new players.",
  13. --PROFESSIONS_MISSING_PROFESSION="Visit a profession trainer in a major city to learn a new profession. You may have two professions. You may have any combination of gathering and production professions.",
  14. --PROFESSIONS_SECOND_PROFESSION="Second Profession",
  15. --PROFESSIONS_USED_IN_COOKING="Crafting Reagent",

Looks like there's no global strings at all for the other tradeskills or crafts. It's also possible that the global string dump is correct and this is a case of purposeful coding to emulate vanilla.

Seerah 09-28-19 03:25 PM

Check the extracted code (you can even extract it yourself) to see how the default UI does it in the skills window.

Kanegasi 09-28-19 03:32 PM

I looked at that before answering originally. The code to set up the SkillFrame tab is just a mindless index loop with headers injected into the data like the ReputationFrame.

local skillName, header, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType, skillDescription = GetSkillLineInfo(skillIndex)

It's easy to get info on a single profession in retail, you have to loop through this function in classic.

Nimhfree 09-28-19 08:02 PM

Retail also does not have those strings. I wish both had them as it would make my life easier. The interesting thing is the website with the dump has a field with value 1 which appears to be in use by Blizzard clients. However, those strings with the profession names have a 2 in that field instead.

cokedrivers 01-21-20 11:06 AM

Not to hijack a topic but I was wondering about profession with my databar I use and was wondering with the help from this post does the following code look like it will work in Classic?

Code:

                proPlugin:SetScript('OnEnter', function()               
                        local anchor, panel, xoff, yoff = DataTextTooltipAnchor(Text)
                        GameTooltip:SetOwner(panel, anchor, xoff, yoff)
                        GameTooltip:ClearLines()
                        GameTooltip:AddLine(hexa..PLAYER_NAME.."'s"..hexb.." Professions")
                        GameTooltip:AddLine' '
                        for i = 1, select("#", GetNumPrimaryProfessions()) do
                                local v = select(i, GetSkillLineInfo());
                                if v ~= nil then
                                        local skillName, _, _, skillRank, _, _, skillMaxRank, _, _, _, _, _, _ = GetSkillLineInfo(v)
                                        GameTooltip:AddDoubleLine(skillName, skillRank..' / '..skillMaxRank,.75,.9,1,.3,1,.3)
                                end
                        end
                        GameTooltip:AddLine' '
                        GameTooltip:AddLine("|cffeda55fLeft Click|r to Open Profession #1")
                        GameTooltip:AddLine("|cffeda55fMiddle Click|r to Open Spell Book")
                        GameTooltip:AddLine("|cffeda55fRight Click|r to Open Profession #2")
                       
                        GameTooltip:Show()
                end)


                proPlugin:SetScript("OnClick",function(self,btn)
                        local prof1, prof2 = GetNumPrimaryProfessions()
                        if btn == "LeftButton" then
                                if prof1 then
                                        if(GetSkillLineInfo(prof1) == ('Skinning')) then
                                                CastSpellByName("Skinning Skills")
                                        elseif(GetSkillLineInfo(prof1) == ('Mining')) then
                                                CastSpellByName("Mining Skills")
                                        elseif(GetSkillLineInfo(prof1) == ('Herbalism')) then
                                                CastSpellByName("Herbalism Skills")                                       
                                        else       
                                                CastSpellByName((GetSkillLineInfo(prof1)))
                                        end
                                else
                                        print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
                                end
                        elseif btn == 'MiddleButton' then
                                ToggleSpellBook(BOOKTYPE_PROFESSION)       
                        elseif btn == "RightButton" then
                                if prof2 then
                                        if(GetSkillLineInfo(prof2) == ('Skinning')) then
                                                CastSpellByName("Skinning Skills")
                                        elseif(GetSkillLineInfo(prof2) == ('Mining')) then
                                                CastSpellByName("Mining Skills")
                                        elseif(GetSkillLineInfo(prof2) == ('Herbalism')) then
                                                CastSpellByName("Herbalism Skills")                                               
                                        else
                                                CastSpellByName((GetSkillLineInfo(prof2)))
                                        end
                                else
                                        print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
                                end
                        end
                end)

thanks for any help with this.
Coke

MickeyPickey 08-06-20 08:22 AM

GetNumPrimaryProfessions() - won't work
In classic it's just return NUMBER, not args\objects.

In Classic you can use
GetNumSkillLines() - to get total number of skills
and then iterate them through GetSkillLineInfo(index) using profession name

Ketho 05-30-21 02:23 PM

Slight necro since this pops up in google

The mentioned Globalstrings won't work since those are flagged for gluescreens only
You can get the localized names from wow.tools

https://github.com/Ketho/WoWtoolsPar...ssionNames.lua
Lua Code:
  1. local ProfessionNames = {
  2.     enUS = {
  3.         [164] = "Blacksmithing",
  4.         [165] = "Leatherworking",
  5.         [171] = "Alchemy",
  6.         [182] = "Herbalism",
  7.         [185] = "Cooking",
  8.         [186] = "Mining",
  9.         [197] = "Tailoring",
  10.         [202] = "Engineering",
  11.         [333] = "Enchanting",
  12.         [356] = "Fishing",
  13.         [393] = "Skinning",
  14.         [755] = "Jewelcrafting",
  15.         [773] = "Inscription",
  16.     },
  17.     deDE = {
  18.         [164] = "Schmiedekunst",
  19.         [165] = "Lederverarbeitung",
  20.         [171] = "Alchemie",
  21.         [182] = "Kräuterkunde",
  22.         [185] = "Kochkunst",
  23.         [186] = "Bergbau",
  24.         [197] = "Schneiderei",
  25.         [202] = "Ingenieurskunst",
  26.         [333] = "Verzauberkunst",
  27.         [356] = "Angeln",
  28.         [393] = "Kürschnerei",
  29.         [755] = "Juwelierskunst",
  30.         [773] = "Inschriftenkunde",
  31.     },
  32.     frFR = {
  33.         [164] = "Forge",
  34.         [165] = "Travail du cuir",
  35.         [171] = "Alchimie",
  36.         [182] = "Herboristerie",
  37.         [185] = "Cuisine",
  38.         [186] = "Minage",
  39.         [197] = "Couture",
  40.         [202] = "Ingénierie",
  41.         [333] = "Enchantement",
  42.         [356] = "Pêche",
  43.         [393] = "Dépeçage",
  44.         [755] = "Joaillerie",
  45.         [773] = "Calligraphie",
  46.     },
  47.     esMX = {
  48.         [164] = "Herrería",
  49.         [165] = "Peletería",
  50.         [171] = "Alquimia",
  51.         [182] = "Herboristería",
  52.         [185] = "Cocina",
  53.         [186] = "Minería",
  54.         [197] = "Sastrería",
  55.         [202] = "Ingeniería",
  56.         [333] = "Encantamiento",
  57.         [356] = "Pesca",
  58.         [393] = "Desuello",
  59.         [755] = "Joyería",
  60.         [773] = "Inscripción",
  61.     },
  62.     ptBR = {
  63.         [164] = "Ferraria",
  64.         [165] = "Couraria",
  65.         [171] = "Alquimia",
  66.         [182] = "Herborismo",
  67.         [185] = "Culinária",
  68.         [186] = "Mineração",
  69.         [197] = "Alfaiataria",
  70.         [202] = "Engenharia",
  71.         [333] = "Encantamento",
  72.         [356] = "Pesca",
  73.         [393] = "Esfolamento",
  74.         [755] = "Joalheria",
  75.         [773] = "Escrivania",
  76.     },
  77.     ruRU = {
  78.         [164] = "Кузнечное дело",
  79.         [165] = "Кожевничество",
  80.         [171] = "Алхимия",
  81.         [182] = "Травничество",
  82.         [185] = "Кулинария",
  83.         [186] = "Горное дело",
  84.         [197] = "Портняжное дело",
  85.         [202] = "Инженерное дело",
  86.         [333] = "Наложение чар",
  87.         [356] = "Рыбная ловля",
  88.         [393] = "Снятие шкур",
  89.         [755] = "Ювелирное дело",
  90.         [773] = "Начертание",
  91.     },
  92.     zhCN = {
  93.         [164] = "锻造",
  94.         [165] = "制皮",
  95.         [171] = "炼金术",
  96.         [182] = "草药学",
  97.         [185] = "烹饪",
  98.         [186] = "采矿",
  99.         [197] = "裁缝",
  100.         [202] = "工程学",
  101.         [333] = "附魔",
  102.         [356] = "钓鱼",
  103.         [393] = "剥皮",
  104.         [755] = "珠宝加工",
  105.         [773] = "铭文",
  106.     },
  107.     zhTW = {
  108.         [164] = "鍛造",
  109.         [165] = "製皮",
  110.         [171] = "鍊金術",
  111.         [182] = "草藥學",
  112.         [185] = "烹飪",
  113.         [186] = "採礦",
  114.         [197] = "裁縫",
  115.         [202] = "工程學",
  116.         [333] = "附魔",
  117.         [356] = "釣魚",
  118.         [393] = "剝皮",
  119.         [755] = "珠寶設計",
  120.         [773] = "銘文學",
  121.     },
  122.     koKR = {
  123.         [164] = "대장기술",
  124.         [165] = "가죽세공",
  125.         [171] = "연금술",
  126.         [182] = "약초채집",
  127.         [185] = "요리",
  128.         [186] = "채광",
  129.         [197] = "재봉술",
  130.         [202] = "기계공학",
  131.         [333] = "마법부여",
  132.         [356] = "낚시",
  133.         [393] = "무두질",
  134.         [755] = "보석세공",
  135.         [773] = "주문각인",
  136.     },
  137. }

Here is an example for getting localized profession names
Lua Code:
  1. local profNames = ProfessionNames[GetLocale()]
  2. print(profNames[185]) -- "Cooking"

and for going through the list of profession skills.
Lua Code:
  1. local profNames = ProfessionNames[GetLocale()]
  2. local profNames_rev = tInvert(profNames)
  3.  
  4. for i = 1, GetNumSkillLines() do
  5.     local name, _, _, skillRank = GetSkillLineInfo(i)
  6.     if profNames_rev[name] then
  7.         print(name, skillRank)
  8.     end
  9. end


The table structure is not ideal for every situation so consider changing it if needed and/or using enums
Lua Code:
  1. local profNames = ProfessionNames[GetLocale()]
  2. local enums = {
  3.         Cooking = 185,
  4.         Engineering = 202,
  5. }
  6. print(profNames[enums.Cooking])


All times are GMT -6. The time now is 02:59 PM.

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