Request for API
Road-block opened this issue ยท 17 comments
Greetings.
Would it be possible to add a couple callbacks under the Equipmate object?
I would like to offer support for linking a set in my own addon to an Equipmate set.
What I would need to make this clean is a couple callbacks that I can register my addon with.
- newset saved (pass me the setname)
- set deleted (again pass me the setname)
- set equipped (setname, only fire when it successfully equips, not in queue, or any fail states)
- [optional but nice to have] a method that returns an array of active sets for the current character (not a callback)
So essentially offer me
Equipmate.API.RegisterCallback("EQUIPMATE_<EVENT>",callbackfunc)
Where events are "EQUIPMATE_NEWSET", "EQUIPMATE_DELETESET", "EQUIPMATE_SELECTED" all of which pass <setname> to the callback function.
Additionally in the nice to have category.
Equipmate already offers Equipmate.Api.GetEquipmentSetsForCharacter(nameRealm)
which covers my "nice to have" request.
But if I may request that you expose addon.thisCharacter
under the Equipmate object so I don't have to duplicate the nameRealm derivation code.
Or alternatively let me call Equipmate.Api.GetEquipmentSetsForCharacter optionally without a nameRealm argument in which case it would use addon.thisCharacter internally.
Thanks for considering :)
Hello!
Ok so I have added some callback functionality for you. To register a callback use the following,
EventRegistry:RegisterCallback(event, func)
The following events can be registered,
EQUIPMATE_ON_OUTFIT_CREATED > outfitName
EQUIPMATE_ON_OUTFIT_DELETED > outfitName
EQUIPMATE_ON_OUTFIT_CHANGED > outfitName
EQUIPMATE_ON_OUTFIT_EQUIPPED > outfitName, successBoolean
I'll push this to git and allow for some testing before sending to curseforge
Regards
Any chance you can also add this line to Equipmate.Api.GetEquipmentSetsForCharacter(nameRealm)
nameRealm = nameRealm or addon.thisCharacter
so it falls back to current character if no nameRealm supplied.
I know I can construct a nameRealm key myself but less points of failure if the format changes at any point
Yes I can I forgot that part last night.
Out of interest what are you using this for?
I make an addon for SoD with some improvements to the rune engraving interface.
One of the features, is linking a set of runes to a state (states being stuff like solo/party/raid/pvp etc)
I'm looking to add equipment set as a state and support ItemRack and Equipmate as options.
Rune set application cannot be fully automated but I can offer a prompt or preload a set of runes for the player to apply.
Oh that's a neat idea. Little bit like a talent load out sort of thing I guess.
I'll add that change later, have the changes worked so far?
and no ๐
I can get to the sets to present them as options and the callbacks work for detecting a state change.
For some reason the Equipmate alpha (the git version) doesn't want to display the dropdown of my previous sets, or after I create a new one.
Not sure if I broke it myself with something I did yet. (I did not, tried without my addon loaded)
I may need some more context, I was tinkering with set/outfit config options last I worked on it
I may need some more context, I was tinkering with set/outfit config options last I worked on it
Sorry I meant to say in the Equipmate frame, the dropdown that lets you load an equipmate set, shows as empty on load.
Sets are still there in saved variables.
Creating a new set activates the Delete / Equip buttons at the bottom but the Select Outfit dropdown at the top remains non-functional.
Edit: I'm going to be AFK for several hours, there's no rush.
I'll keep working on the plumbing from my side assuming that any alpha defects will be sorted down the road :)
It seems something happen with the template for the dropdown flyout. It should get a width set when the menu items gets added but this wasn't happening. I added a default 1 value in the xml and its working again.
I only took a cursory look at the commit, I assumed it has a side-effect of using the outer outfit object rather that the inner .items at places and something slipped through/wasn't updated in all places.
On my side of things everything is working with the latest alpha, so I'll push an initial package before the patch day madness and clean it up later :)
Am I correct in assuming there is no easy way currently to query if the equipment the player has on matches an equipmate outfit?
Use case
- I can currently query the outfits and present them as options for linking a runeset to them
- I can update them for newly added or removed (as well cleanup any no longer valid runeset < -> outfit links)
- I can use the callback to get information on the player equipping an outfit + trigger the linked runeset state change
- I can't check if an equipmate outfit is active that has a linked runeset when starting the game (before the player selects an outfit for the session)
- I also can't check if an equipmate outfit is active when I link to it for one of my runesets
Both are minor things, but I'm wondering if it's something planned for the future.
It would probably also help if Equipmate ever gets a minimap/LDB launcher down the road to show the "currently equipped" outfit.
Or for its own frame to show the currently selected outfit for initial load
The addon keeps the itemGUID for outfit items so it should be possible, I'll figure out an api for this.
I have a working api to look for current outfit status, noticed a strange thing though and wonder if itemGUID is a strong unique identifier or not.
Equipmate.Api.GetCurrentOutfitStatus()
Looks good.
Did I lose Equipmate.Api.GetEquipmentSetsForCharacter
?
I do need a way to get outfits for the current character or I can't present them as options for linking a runeset to.
No it'll get an upgrade later, I just noticed it wasn't quite right. Un comment it if you want for debugging in the meantime.
We're you presenting just names? Or using the actual outfit data?
My previous code was along these lines
local eqmatesets = Equipmate.Api.GetEquipmentSetsForCharacter()
for k,v in pairs(eqmatesets) do
addon.EquipmateSets[#addon.EquipmateSets+1]=v.name
end
table.sort(addon.EquipmateSets)
return addon.EquipmateSets
addon in this context is my own addon object.
Just names were fine since they are unique identifiers for the character outfits and I can simply populate a dropdown submenu with them without further processing as shown on that image further up.
But at the end of the day some kind of outfit id works, name was just convenient and already used in the callbacks so it made sense.