Thread Tools Display Modes
07/08/20, 12:23 PM   #1
GhostwheelAI
 
GhostwheelAI's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 10
Is there Event for jump request?

When you accept invite to group there is request to jump to leader of the group. Is where Event for that request and function to decline it? I'd like to auto decline.

Didn't find anything like that in here https://wiki.esoui.com/Events
  Reply With Quote
07/08/20, 12:37 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Nope there isn't you'need to check the esoui source code for groups, find the invitation stuff and check how the code shows the jump to leader stuff, then try to find a "hook point" where you could auto decline it.
Should be maybe somewhere around here:
https://github.com/esoui/esoui/tree/...i/ingame/group

Or search for "jump" in the sources, like this: https://github.com/esoui/esoui/searc...nscoped_q=jump

You'll find the function here
https://github.com/esoui/esoui/blob/...hared.lua#L108
JumpToGroupLeader

Then search where it is used and try to find the space where "your popup" occurs.
Maybr it's not at the lua side of code and you cannot intercept or hook nor find it...

Last edited by Baertram : 07/08/20 at 12:40 PM.
  Reply With Quote
07/08/20, 04:17 PM   #3
GhostwheelAI
 
GhostwheelAI's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 10
Originally Posted by Baertram View Post
Nope there isn't you'need to check the esoui source code for groups, find the invitation stuff and check how the code shows the jump to leader stuff, then try to find a "hook point" where you could auto decline it.
Should be maybe somewhere around here:
Thanks. Found it.

https://github.com/esoui/esoui/blob/...ertoplayer.lua

743 line

I'm new to lua and plugins. Could you explain how to hook a function? I have to create local variable that contains the function, right? And then override original function?
  Reply With Quote
07/08/20, 05:08 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
You can't as the function is local!
local function OnTravelToLeaderPromptReceived()
And the local function OnGroupMemberJoined() as well in line 790

And overwriting wouldn't be good at all. You could use ZO_PreHook or ZO_PostHook/SecurePostHook (chekc the wiki for them), but this is also not possible here.

So you cannot overwrite it properly and if you would do it you'd most probabyl kill other addons and ZOs vanilla UI
The real call to the popup is done in line 758 btw.
https://github.com/esoui/esoui/blob/...layer.lua#L758
But it queues the prompt so if you hook or try to hook here you most probably will kill the queue of all popups.

So unfortunately: No chance afai can see
  Reply With Quote
07/08/20, 07:03 PM   #5
GhostwheelAI
 
GhostwheelAI's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 10
Originally Posted by Baertram View Post
You can't as the function is local!
local function OnTravelToLeaderPromptReceived()
And the local function OnGroupMemberJoined() as well in line 790
OK. Decline callback looks like this

Code:
local function DeclineCallback()
      self:RemoveFromIncomingQueue(INTERACT_TYPE_TRAVEL_TO_LEADER)
end
and ZO_PlayerToPlayer:RemoveFromIncomingQueue appears to be global...

How do you think, can I do smth like that...

Register EVENT_GROUP_MEMBER_JOINED

Set callback that waits for example 100 ms (because it says in comments (line 737) that "-- The location of the group leader may not be available immediately", so prompt doesn't appear immediately too.

And then call ZO_PlayerToPlayer:RemoveFromIncomingQueue(INTERACT_TYPE_TRAVEL_TO_LEADER)?

Last edited by GhostwheelAI : 07/08/20 at 08:07 PM.
  Reply With Quote
07/09/20, 12:23 AM   #6
andy.s
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 40
There are actually several ways to achieve that, but the most simple one is:

Lua Code:
  1. local org = ZO_PlayerToPlayer.AddPromptToIncomingQueue
  2. function ZO_PlayerToPlayer.AddPromptToIncomingQueue(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
  3.     if interactType == 19 then
  4.         return {}
  5.     else
  6.         return org(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
  7.     end
  8. end
  9.  
  10. --ZO_PreHook(ZO_PlayerToPlayer, 'AddPromptToIncomingQueue', function(self, interactType)
  11.     --if interactType == 19 then return true end
  12. --end)

I commented ZO_PreHook, because it will produce lua error, since zos code doesn't check if the prompt was added and will just try to access nil value. Also INTERACT_TYPE_TRAVEL_TO_LEADER = 19 is a local variable, so have to use a raw value... But it does its job
  Reply With Quote
07/09/20, 02:58 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I would like to mention that this will block ALL of the "jump to leader" popups, and not only if you are joining a group.
Not sure if it happens at other spots as well though.

If you only want it to happen after you have joined a group you could use the EVENT_GROUP_MEMBER_JOINED,
then chck if YOU have joined (via the name e.g.), or use event filters to filter on the unitag "player" (if the group join event uses that),
and set a local addon variable = true.
Inside the PreHook / overwritten function check if the variable is true and only then block the port to group leader request.
Don't forget to set the variable = false again.
  Reply With Quote
07/09/20, 02:51 PM   #8
GhostwheelAI
 
GhostwheelAI's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 10
Originally Posted by Baertram View Post
If you only want it to happen after you have joined a group you could use the EVENT_GROUP_MEMBER_JOINED,
then chck if YOU have joined (via the name e.g.), or use event filters to filter on the unitag "player" (if the group join event uses that),
and set a local addon variable = true.
Inside the PreHook / overwritten function check if the variable is true and only then block the port to group leader request.

Don't forget to set the variable = false again.
Thank you.

I didn't understand how to use prehook and EVENT_GROUP_MEMBER_JOINED at the same time. If I prehook something it would stay that way?

So for now I did it like this. Have to test though.

Lua Code:
  1. function GhostwheelAIShortcuts:OnGroupMemberJoined(eventCode, memberCharacterName, memberDisplayName, isLocalPlayer)
  2.  
  3.   local function declineJumpToLeaderRequest()
  4.     if isLocalPlayer then
  5.       ZO_PlayerToPlayer:RemoveFromIncomingQueue(19)
  6.     end
  7.   end
  8.  
  9.   if GhostwheelAIShortcuts.savedVariables.DeclineJumpToLeaderRequest then
  10.     zo_callLater(declineJumpToLeaderRequest, 150)
  11.   end
  12.  
  13. end

and set a local addon variable = true.
I assume that this is variable that modifies addon behavior, but tried to reread the wiki (not entirely) and didn't find anything on that. How can I use it?

Last edited by GhostwheelAI : 07/09/20 at 03:08 PM.
  Reply With Quote
07/09/20, 03:33 PM   #9
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
If I prehook something it would stay that way?
Yes, until reloadui.
Then it needs to be reapllied by your addon's code, what the addon will automatically do once you have defined it to apply the PreHook in e.g. event_add_on_loaded.

and set a local addon variable = true.
Just define a local variable inside your addon, somewhere at the top?
Lua Code:
  1. local groupMemberJoinedFlag = false

In your callback function for the event group member joined set it to groupMemberJoinedFlag = true then.
> And remove all your other code there if you want to use Andy.s' code!
Lua Code:
  1. function GhostwheelAIShortcuts:OnGroupMemberJoined(eventCode, memberCharacterName, memberDisplayName, isLocalPlayer)
  2.    --Only check for yourself as other group members joing won't show the port to group leader popup
  3.    if isLocalPlayer == true then groupMemberJoinedFlag = true end
  4. end


And in the code that andy.s gave you can use the var like this then:

Lua Code:
  1. local org = ZO_PlayerToPlayer.AddPromptToIncomingQueue
  2. function ZO_PlayerToPlayer.AddPromptToIncomingQueue(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
  3.     --Do not call the stuff if you did not recently join a group
  4.     if interactType == 19 and groupMemberJoinedFlag and GhostwheelAIShortcuts.savedVariables.DeclineJumpToLeaderRequest then
  5.        groupMemberJoinedFlag = false
  6.        return {}
  7.     else
  8.         return org(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
  9.     end
  10. end



btw:
ZO_PlayerToPlayer won't work! It's the "kind of" class you try to use there, not the created object from that class.
The created object will be something like VARIABLE_NAME = ZO_PlayerToPlayer:New()
and is either defined in the XML files or in the lua files, most time near the bottom.
I think it's PLAYER_TO_PLAYER or similar and not ZO_PlayerToPlayer

https://github.com/esoui/esoui/blob/...ayer.lua#L1927

Last edited by Baertram : 07/09/20 at 03:36 PM.
  Reply With Quote
07/15/20, 08:38 PM   #10
GhostwheelAI
 
GhostwheelAI's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 10
Originally Posted by Baertram View Post
I think it's PLAYER_TO_PLAYER or similar and not ZO_PlayerToPlayer
Thanks andy.s and Baertram. I tested it yesterday, it works.

The actual object is PLAYER_TO_PLAYER

Last edited by GhostwheelAI : 07/15/20 at 08:57 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Is there Event for jump request?

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