doadin / Baggins

zlib License
6 stars 7 forks source link

Feature Request: Learned Profession conditional #63

Closed WanderingFox closed 1 year ago

WanderingFox commented 2 years ago

Hey there! First all absolutely love this addon! Thank you so much for maintaining it!

I was wondering though if it would be possible to get a "profession learned" conditional?

I'm on a crusade to reduce the number of profiles used in my addons and I can almost get down to one profile with baggins, except that I use different profession bag categories on each of my characters (eg. one bag might show alchemy items on one character but blacksmithing on another character). That way I can make a bag that has several categories along the lines of "knows blacksmithing and (normal rules for that category)" and "knows alchemy and (...)" etc.

WanderingFox commented 2 years ago

Some digging suggests this should be doable?

ProfessionID -> Localized name can be done via Constants.ProfessionIDs and C_TradeSkillUI.GetTradeSkillLineInfoByID(id)

doadin commented 1 year ago

Sorry little late responding, however the function you linked is going to be removed from the game in 10.0, so would not be useful for long. I am going to look into this though.

doadin commented 1 year ago

Im not sure how this is going to work, how filters work is it matches an item to a type, I don't know any other way other than to match all items to w.e. profession the character has. I'm going to push a update that adds this now let me know if it works I guess?

edit: I guess if you add category that matches the existing enchanting and the new "Profession: Enchanting" that would work? Idk

WanderingFox commented 1 year ago

Update tosses a lua error on first login (presumably because GetProfessions isn't available until the player is in the world) :(

After a reload there's no errors, but it doesn't seem to do what I was hoping for.

My hope was that I could create categories like the attached image and that would filter the item into the category, but only if the given profession was learned on that character. Instead it seems to just always filter the item and ignore the AND

image

doadin commented 1 year ago

I just pushed another update to see if it helps any, if not im not sure I can add this.

doadin commented 1 year ago

Just to check are you testing on retail or other game version?

doadin commented 1 year ago

I just pushed one more update out unfortunately it only works if you reload once after first login, becuase as you have noted GetProfessions isn't available until the player is in the world. Once I figure out how to update the cat after login it should work but I have yet to figure that out.

doadin commented 1 year ago

ok I just pushed v4.0.57 I think this version works, let me know.

WanderingFox commented 1 year ago

Works!

Though something is up with the item category filter and it's choking on IsWrathWow which doesn't exist.

Manually defining it in baggins.lua in the same way as the other ones that already exist fixes that :)

local WOW_PROJECT_WRATH_CLASSIC = _G.WOW_PROJECT_WRATH_CLASSIC

. . .

function Baggins:IsWrathWow() --luacheck: ignore 212
    return WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC
end
doadin commented 1 year ago

I had it typed out but in trying to fix add this feature I was up late and forgot to push that commit, sorry that fix should be going out now.

doadin commented 1 year ago

Since this feature works now I am going to go ahead and close this, thank you for your help and support!