ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Bug Reports (https://www.esoui.com/forums/forumdisplay.php?f=187)
-   -   [open] GetGroupElectionInfo() doesn't update on EVENT_GROUP_ELECTION_REQUESTED (https://www.esoui.com/forums/showthread.php?t=8959)

ArtOfShred 02/11/20 08:38 AM

[open] GetGroupElectionInfo() doesn't update on EVENT_GROUP_ELECTION_REQUESTED
 
Code:

GetGroupElectionInfo()
    Returns: number GroupElectionType electionType, number timeRemainingSeconds, string electionDescriptor, string targetUnitTag

While writing a function for LUIE I discovered some odd behavior with this function. I hooked into the alert handler for EVENT_GROUP_ELECTION_REQUESTED in hopes of enhancing the message this function displays for initiating a votekick. ("You have initiated a vote..." into something listing the character name of the player.)

The event only has "descriptor" as a value though which is either "[ZO_NONE]" or "[ZO_READY_CHECK]." So in order to get the relevant information I needed to use GetGroupElectionInfo() to get the unitTag for the name of the player being votekicked.

This is when I discovered that GetGroupElectionInfo() doesn't update when the local player makes an election request (we get an event for this through EVENT_GROUP_ELECTION_REQUESTED).

The info returned by GetGroupElectionInfo() will only update once the group election has a result. This means the values returned by GetGroupElectionInfo() will be incorrect at the time of initiating an election for the local player before the election has been resolved.

Other players in the group don't have the same issue as when the election request is submitted GetGroupElectionInfo() will immediately return proper values for the currently active election.

The expected behavior of the result for GetGroupElectionInfo() would be to update on the backend simultaneously with EVENT_GROUP_ELECTION_REQUESTED so that we can pull accurate values for the local player requesting the election as well.

ZOS_DanBatson 02/17/20 02:06 PM

Thank for pointing this out. It was built so that you only fill out that info when an election is successfully created on the backend, but it's also built to not notify the initiator because they don't need to actually vote. I can probably make it so I fill out the intended data so the initiator has access to it. Of note, just because that info is there doesn't mean a vote actually started. You still need to be prepared for a possible EVENT_GROUP_ELECTION_FAILED event immediately after EVENT_GROUP_ELECTION_REQUESTED.

ArtOfShred 02/17/20 02:30 PM

Quote:

Originally Posted by ZOS_DanBatson (Post 40250)
Thank for pointing this out. It was built so that you only fill out that info when an election is successfully created on the backend, but it's also built to not notify the initiator because they don't need to actually vote. I can probably make it so I fill out the intended data so the initiator has access to it. Of note, just because that info is there doesn't mean a vote actually started. You still need to be prepared for a possible EVENT_GROUP_ELECTION_FAILED event immediately after EVENT_GROUP_ELECTION_REQUESTED.

Awesome that would work perfectly for what I need it for (just notification purposes).

I think one of the election failure reasons already is NO_ELECTION probably so that would be fine.

EDIT: Or hmm the only one I see possible related is GROUP_ELECTION_RESULT_NOT_APPLICABLE, I imagine that probably handles when there is no current election.


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

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI