Skip to content

Commit a8b84d8

Browse files
committed
Initial release
0 parents  commit a8b84d8

3 files changed

Lines changed: 101 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Replace toc-versions
18+
uses: Numynum/ToCVersions@master
19+
20+
- name: Create Retail Package
21+
uses: BigWigsMods/packager@master
22+
env:
23+
CF_API_KEY: ${{ secrets.CF_API_KEY }}
24+
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}

CrossFactionRequestInvite.lua

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
local handledButtons = {}
2+
local function getGameAccountIDByTravelPassButton(travelPassButton)
3+
local gameAccountID
4+
local friendIndex = travelPassButton:GetParent().id
5+
local numGameAccounts = C_BattleNet.GetFriendNumGameAccounts(friendIndex);
6+
if numGameAccounts > 1 then
7+
for i = 1, numGameAccounts do
8+
local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(friendIndex, i);
9+
if gameAccountInfo.playerGuid and (gameAccountInfo.realmID ~= 0) then
10+
gameAccountID = gameAccountInfo.gameAccountID;
11+
break;
12+
end
13+
end
14+
else
15+
local accountInfo = C_BattleNet.GetFriendAccountInfo(friendIndex);
16+
if accountInfo and accountInfo.gameAccountInfo.playerGuid then
17+
gameAccountID = accountInfo.gameAccountInfo.gameAccountID;
18+
end
19+
end
20+
21+
return gameAccountID
22+
end
23+
local function onClick(travelPassButton, btn)
24+
if btn == "LeftButton" then
25+
return
26+
end
27+
-- undo the default behavior
28+
FriendsFrame_BattlenetInviteByIndex(travelPassButton:GetParent().id)
29+
30+
local gameAccountID = getGameAccountIDByTravelPassButton(travelPassButton)
31+
32+
if gameAccountID then BNRequestInviteFriend(gameAccountID) end
33+
end
34+
local function onEnter(travelPassButton)
35+
local gameAccountID = getGameAccountIDByTravelPassButton(travelPassButton)
36+
37+
if gameAccountID then
38+
GameTooltip:AddLine("Right-Click to force a request invite", 0, 1, 0)
39+
GameTooltip:Show()
40+
end
41+
end
42+
43+
local function handleFriendListButtons()
44+
if
45+
FriendsListFrame
46+
and FriendsListFrame.ScrollBox
47+
and FriendsListFrame.ScrollBox.ScrollTarget
48+
and FriendsListFrame.ScrollBox.ScrollTarget.GetChildren
49+
then
50+
local buttons = {FriendsListFrame.ScrollBox.ScrollTarget:GetChildren()}
51+
for _, button in pairs(buttons) do
52+
if not button.travelPassButton or handledButtons[button] then
53+
return
54+
end
55+
handledButtons[button] = true
56+
button.travelPassButton:RegisterForClicks("LeftButtonDown", "RightButtonDown")
57+
-- register leftclick for default behavior
58+
button.travelPassButton:HookScript("OnEnter", onEnter)
59+
button.travelPassButton:HookScript("OnClick", onClick)
60+
end
61+
end
62+
end
63+
64+
do
65+
if FriendsList_Update then
66+
hooksecurefunc("FriendsList_Update", handleFriendListButtons)
67+
end
68+
handleFriendListButtons()
69+
end

CrossFactionRequestInvite.toc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Interface: @toc-version-retail@
2+
## Version: @project-version@
3+
## Title: Cross-Faction Request Invite
4+
## Notes: Allows you to easily request invite from a cross-faction bnet friend.
5+
## Author: Numy
6+
## X-Curse-Project-ID: 701095
7+
8+
CrossFactionRequestInvite.lua

0 commit comments

Comments
 (0)