I have some movements with my question.
1st. Register an event to initialize hooking link clicks
Lua Code:
EVENT_MANAGER:RegisterForEvent("IRememberYou", EVENT_PLAYER_ACTIVATED, HookChatLink)
2nd. Hooking itself.
Lua Code:
local function HookChatLink()
for i=1,#ZO_ChatWindow.container.windows do
ZO_PreHookHandler(ZO_ChatWindow.container.windows[i].buffer,"OnLinkClicked",HookChatLinkClicked)
end
end
3rd. Function to add item to the end of current list and resise ZO_Menu
Lua Code:
local function HookChatLinkClicked(self, linkData, linkText, button, ctrl, alt, shift, command)
-- thx Kentarii
local linkType, _, _ = zo_strsplit(":", linkData)
-- add our menu only to player linktype
if linkType ~= CHARACTER_LINK_TYPE and linkType~=DISPLAY_NAME_LINK_TYPE then return end
-- We want our item added after all items. So, wait untill they are created. Littly hacky, but... :banana:
zo_callLater(
function ()
ZO_Menu:SetHeight(ZO_Menu:GetHeight()+22.3125)
AddMenuItem("Rate", YourFunction)
end
, 1)
end
But now I have another problem... When I move mouse over new item it does not selects properly. It works sometimes, but I can't repeat it manually.