Quantcast
Getting rid of a popup (zone instance) - ESOUI
Thread Tools Display Modes
08/04/21, 02:22 PM   #1
TrelliumTB
Join Date: Feb 2021
Posts: 3
Getting rid of a popup (zone instance)

Hello everyone,

First off, thanks for all your work in documenting the ESO Lua system. I used it a great deal in making up our Addons.

But, I have a problem that has me stumped. I made a group invite addon for our family. It works well, it makes up a group of our currently logged in characters, removes ones that have logged out and that sort of thing.

But, if I invite a character that is in the same zone but a different instance, I get a message that says:

Code:
This group's leader is located in a different version of <zone name>. Would you like to travel to their version ... F-Accept X-Decline
I can't figure out how to accept or decline this message through Lua. We always decline it, and then later on meet up (not always the group leaders location), so it would be great to auto-decline this option.

I have "IsGroupMemberInSameInstanceAsPlayer(inviterAccount)", which detects the issue properly, but I can't seem to get rid of the popup itself. It also doesn't time-out and go away.

It's probably something obvious, but I just don't see it
  Reply With Quote
08/04/21, 02:45 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,753
The text can be found in the ingamelocalization/localizegeneratestrings.lua files -> constant is :SI_JUMP_TO_GROUP_LEADER_OCCURANCE_PROMPT
Code:
    "This group's leader is located in a different version of |cffffff<<1>>|r.\n\nWould you like to travel to their version, which will place you at the wayshrine nearest to them?", -- SI_JUMP_TO_GROUP_LEADER_OCCURANCE_PROMPT
You can search the esoui sources for that constant then:
SI_JUMP_TO_GROUP_LEADER_OCCURANCE_PROMPT

-> playertoplayer.lua, local function OnTravelToLeaderPromptReceived()
lines 767 ff
Code:
promptData.messageFormat = GetString(GetUnitZone("player") == groupLeaderZoneName and SI_JUMP_TO_GROUP_LEADER_OCCUR
ANCE_PROMPT or SI_JUMP_TO_GROUP_LEADER_WORLD_PROMPT)

lines 785ff shows where this local function is used:

Lua Code:
  1. local function OnUnitCreated(unitTag)
  2.         if ZO_Group_IsGroupUnitTag(unitTag) then
  3.             OnTravelToLeaderPromptReceived()
  4.         end
  5.     end
  6.         local function OnZoneUpdate(unitTag, newZone)
  7.         if ZO_Group_IsGroupUnitTag(unitTag) then
  8.             OnTravelToLeaderPromptReceived()
  9.         end
  10.     end
  11.     local function OnGroupMemberJoined(characterName, displayName, isLocalPlayer)
  12.         if isLocalPlayer then
  13.             local groupLeaderUnitTag = GetGroupLeaderUnitTag()
  14.             if not AreUnitsEqual(groupLeaderUnitTag, "player") then
  15.                 pendingJumpToGroupLeaderPrompt = true
  16.                 OnTravelToLeaderPromptReceived()
  17.             end
  18.         end
  19.     end
  20.     local function OnPlayerActivateOrLeaderUpdate()
  21.         if pendingJumpToGroupLeaderPrompt then
  22.             OnTravelToLeaderPromptReceived()
  23.         end
  24.     end

As the funcs are local you cannot hack into them directly

But they are registered as event callbacks:
Lua Code:
  1. self.control:RegisterForEvent(EVENT_UNIT_CREATED, function(event, ...) OnUnitCreated(...) end)
  2.     self.control:RegisterForEvent(EVENT_ZONE_UPDATE, function(event, ...) OnZoneUpdate(...) end)
  3.     self.control:RegisterForEvent(EVENT_GROUP_MEMBER_JOINED, function(event, ...) OnGroupMemberJoined(...) end)
  4.     self.control:RegisterForEvent(EVENT_LEADER_UPDATE, function(event, ...) OnGroupMemberJoined(...) end)
  5.     self.control:RegisterForEvent(EVENT_GROUP_MEMBER_LEFT, function(event, ...) OnGroupMemberLeft(...) end)

self = ZO_PlayerToPlayer -> object created is PLAYER_TO_PLAYER in func
Lua Code:
  1. function ZO_PlayerToPlayer_Initialize(control)
  2.     PLAYER_TO_PLAYER = ZO_PlayerToPlayer:New(control)
  3. end

Try the following in chat as script:
Code:
/script PLAYER_TO_PLAYER.control:UnregisterForEvent(EVENT_GROUP_MEMBER_JOINED)
Or try one of the others like EVENT_UNIT_CREATED

But beware: This might damage the grouping tools and other addons!

Another approach would be to prehook the function self:AddPromptToIncomingQueue which is used in OnTravelToLeaderPromptReceived()
self = PLAYER_TO_PLAYER again

The function starts in line 1075
Lua Code:
  1. function ZO_PlayerToPlayer:AddPromptToIncomingQueue(interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)

Just add something like

Lua Code:
  1. ZO_PreHook(PLAYER_TO_PLAYER, "AddPromptToIncomingQueue", function(interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
  2.  if interactType == INTERACT_TYPE_TRAVEL_TO_LEADER then return true end
  3. --return true will exit here adn NOT call the original code after that
  4. end)

Last edited by Baertram : 08/04/21 at 02:53 PM.
  Reply With Quote
08/04/21, 02:51 PM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,490
Could try to prehook AddPromptToIncomingQueue and cancel the call when the interact type is INTERACT_TYPE_TRAVEL_TO_LEADER:

Lua Code:
  1. ZO_PreHook(PLAYER_TO_PLAYER, "AddPromptToIncomingQueue", function(self, interactType)
  2.     if interactType == INTERACT_TYPE_TRAVEL_TO_LEADER then
  3.         return true
  4.     end
  5. end)
__________________
https://www.imperialtradingcompany.eu/ - My Addons - The Vault (Early updates and experimental projects) - My patreon - My blog
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
08/04/21, 02:53 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,753
Oh siri found the same as I was editing my message
  Reply With Quote
08/04/21, 03:02 PM   #5
TrelliumTB
Join Date: Feb 2021
Posts: 3
Thanks!

Thanks soooo much -- I will definitely try all this out. And thanks for the explanation of where/how to find it, as well as how quickly you posted all that
  Reply With Quote
08/05/21, 02:20 PM   #6
TrelliumTB
Join Date: Feb 2021
Posts: 3
Just an update on this.

The following code did not fix the issue. It was called, as expected. It returned true, as it should. But it did not suppress or cancel the prompt popup.
Code:
ZO_PreHook(PLAYER_TO_PLAYER, "AddPromptToIncomingQueue", function(interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
     if interactType == INTERACT_TYPE_TRAVEL_TO_LEADER then return true end
    --return true will exit here adn NOT call the original code after that
    end)
I tried variations of it, with no success at all. Is there something with declineCallback that can be used? I couldn't figure that out.

I also tried the suggestion to use:
Code:
/script PLAYER_TO_PLAYER.control:UnregisterForEvent(EVENT_GROUP_MEMBER_JOINED)
That did work in suppressing any further popups. I think it will work for me, but as you said, it may have side effects on other addons or the game itself. I have tested it with the FasterTravel addon and so far have had no issues.
I assume that I just won't have the option to teleport to the leader from now on, and that is fine.

Anyway, thanks again for the help. I never would have gotten to this on my own.
  Reply With Quote
08/06/21, 05:29 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,753
Try to change the function code to this, like siri wrote (first param = self). Could be that my exmaple would not work properly as my first param was the interactType but it actually fileld with the values of "self" instead and thus the check on interactType == INTERACT_TYPE_TRAVEL_TO_LEADER was actually if self == INTERACT_TYPE_TRAVEL_TO_LEADER and thus never was met.

Code:
ZO_PreHook(PLAYER_TO_PLAYER, "AddPromptToIncomingQueue", function(self, interactType)
    if interactType == INTERACT_TYPE_TRAVEL_TO_LEADER then
        return true
    end
end)
Yeah the decline callback function is local but it's code is this:
Lua Code:
  1. local function DeclineCallback()
  2.                             self:RemoveFromIncomingQueue(INTERACT_TYPE_TRAVEL_TO_LEADER)
  3.                         end

So if the first code example above did not work you can try this:
Code:
ZO_PreHook(PLAYER_TO_PLAYER, "AddPromptToIncomingQueue", function(self, interactType)
d("interactType: " .. tostring(interactType)) --just a chat debug line to see if interact type is a number (correct) or a table/userdata (wrong)
    if interactType == INTERACT_TYPE_TRAVEL_TO_LEADER then
        self:RemoveFromIncomingQueue(INTERACT_TYPE_TRAVEL_TO_LEADER) --if self is not working try PLAYER_TO_PLAYER::RemoveFromIncomingQueue(INTERACT_TYPE_TRAVEL_TO_LEADER)
        return true
    end
end)

Last edited by Baertram : 08/06/21 at 05:33 AM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Getting rid of a popup (zone instance)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off