Quantcast
ESOUI - View Single Post - Is there Event for jump request?
View Single Post
07/09/20, 03:33 PM   #9
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,101
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