-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAltInvite.lua
More file actions
42 lines (38 loc) · 1.5 KB
/
AltInvite.lua
File metadata and controls
42 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--[[ Alt Invite Module ]]--
local _, BCM = ...
BCM.modules[#BCM.modules+1] = function()
if bcmDB.BCM_AltInvite then return end
local InviteUnit = C_PartyInfo.InviteUnit
local GetAccountInfoByID = C_BattleNet.GetAccountInfoByID
local BNInviteFriend = BNInviteFriend
hooksecurefunc("SetItemRef", function(link)
if IsAltKeyDown() then
-- Normal chat: player:<name>:<lineId>:WHISPER:<name>
-- BNet chat: BNplayer:<bNetName>:<bNetGameAccountID>:<lineId>:BN_WHISPER:<bNetName>
local player = link:match("^player:([^:]+)")
if player then
InviteUnit(player)
-- We use a secure hook to stay clean (avoid taint), but this means a whisper window will open, so we close it.
if ChatEdit_OnEscapePressed then -- Midnight compat code
ChatEdit_OnEscapePressed(ChatFrame1EditBox)
else
ChatFrame1EditBox:ClearChat()
end
else
local bnetAccountID = link:match("^BNplayer:[^:]+:([^:]+)")
if bnetAccountID then
local accountInfoTbl = GetAccountInfoByID(bnetAccountID)
if accountInfoTbl and accountInfoTbl.gameAccountInfo and accountInfoTbl.gameAccountInfo.gameAccountID then
BNInviteFriend(accountInfoTbl.gameAccountInfo.gameAccountID)
-- We use a secure hook to stay clean (avoid taint), but this means a whisper window will open, so we close it.
if ChatEdit_OnEscapePressed then -- Midnight compat code
ChatEdit_OnEscapePressed(ChatFrame1EditBox)
else
ChatFrame1EditBox:ClearChat()
end
end
end
end
end
end)
end