View Single Post
03/03/21, 03:34 AM   #20
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,973
About LAM and the resfresh:
Set your addon panel to listen for refreshs like described in the LAM documentaion ->

local panelData = {
...
registerForRefresh = true,
}

There is a clear callback for LAM-RefreshPanel of the lam panel where you register your function and check if the panel is your LAM panel
(local myAddonPanel = LibAddonMenu2:RegisterAddonPanel(gAddonName .. "_LAM", panelData) -> in the callback function if panel (1st param of the callback func) ~= myAddonPanel then return end)
, and then you should call your refreshConflict function for the needed dropdown controls (predefined in a table "for _, dropdownControl in ipairs(updateThisControls)").

Using the setfunc will get you into trouble earlier than you might think off.


Originally Posted by Gabriel_H View Post
I was feeling a little guilty about creating work for you, so I wanted to say thanks the best way I could.

I was thinking about the slot options, and the likelihood of it causing problems. I took some code I have been working on and played around a bit. Basically it starts with a table (choiceConflicts) that stores the skillId and puts it against the raw name and any skillId's that you want to flag as "conflicting".

That allows for a function which I have called choiceConflict to be set that takes the starting choice tables (by number and text) and returns new tables (by number and text) excluding the conflicts. I have put that function instead of the tables listed against choices and choicesValues for each of the dropdowns.

So for example, Gifted Rider is set to slot 1, which means that the dropdown list for War Mount won't include slot 1 - thereby making conflict between them impossible. If you change Gifted Rider to slot 3, then War Mount dropdown will restore slot 1 to its list but remove slot 3.

LAM is a great library, but one of the things it doesn't do is refresh the dropdown lists if you play around with them like I have above. So there is a second function called refreshConflict, that fires on the setFunc parameter after the original save variable function has done it's thing. The purpose of the second function is to rebuild the dropdown list for the ones that conflict with the value you just changed.

I have attached the menu.lua I have been playing with.

Feel free to use it, ignore it, change it, whatever you want to do with it.

Thanks,
Gab

Last edited by Baertram : 03/03/21 at 03:39 AM.