Krealle / Cell_UnitFrames

MIT License
14 stars 3 forks source link

Integrated Classic support #184

Open inyawfaze opened 1 week ago

inyawfaze commented 1 week ago

Native support for Classic this time.

HelpTips and several widgets will not get loaded for Classic, via exclusion from it's .toc. Unsupported frames (focus/boss) are excluded for Classic.

Exclusion of these features from the baseline const, defaults and builder tables & conditionally adding them in for the Retail version.

Some util functions are added in esp. regarding auras. I spent quite some time researching how to retrieve the buff index needed for the aura tooltips in Classic, an on demand util function seemed reasonable, as the alternative requires constantly mapping the index on every buff change.

Following this approach now only available features will be visible in the addon menu. Role icons are disabled for Classic for now, as their LibGroupInfo requirement from Cell is not loaded for Classic. This should be able to get reimplemented fairly easily.

Typings: definitely not my strongsuit. Had to change some enums to classes as they have keys included conditionally. At least that's what my LuaLS suggested, I hope thats the correct approach. These changes will definitely add some warnings.

Retail: every feature I took out for Classic worked for me in Retail. I don't think there should be any regression/breaking changes in this.

I think this approach is way healthier than my last one, I'm happy I redid this (and will keep working on it if it's not up to standard)!

TLDR/Commit Message:

inyawfaze commented 1 week ago

Yeah, the lua ci runner does not seem to approve my changes. I'm not too sure if I can fix those myself, but I'll take a look and learn about it. đŸ˜…

Krealle commented 1 week ago

I will try to take a look over this later today - but changing enums to classes is a big no-no.

Enums essentially describe an input to be x value out of y enum table. Whilst a class is used to define a table.

So if you have a function that expects a string to be one of the entries in an enum, then you can type it as such, but if it becomes a class, then it would expect it to be a table.

inyawfaze commented 1 week ago

Awesome feedback, thanks! I'll be going over this tomorrow and make adjustments where needed.

Krealle commented 5 days ago

I also think you should add ---@diagnostic disable: inject-field to the top of Constants.lua. Should help with removing all the typing nightmares there.