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


All times are GMT -6. The time now is 12:04 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI