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:
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:
function GhostwheelAIShortcuts:OnGroupMemberJoined(eventCode, memberCharacterName, memberDisplayName, isLocalPlayer)
--Only check for yourself as other group members joing won't show the port to group leader popup
if isLocalPlayer == true then groupMemberJoinedFlag = true end
end
And in the code that andy.s gave you can use the var like this then:
Lua Code:
local org = ZO_PlayerToPlayer.AddPromptToIncomingQueue
function ZO_PlayerToPlayer.AddPromptToIncomingQueue(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
--Do not call the stuff if you did not recently join a group
if interactType == 19 and groupMemberJoinedFlag and GhostwheelAIShortcuts.savedVariables.DeclineJumpToLeaderRequest then
groupMemberJoinedFlag = false
return {}
else
return org(self, interactType, characterName, displayName, targetLabel, acceptCallback, declineCallback, deferDecisionCallback)
end
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