-
Notifications
You must be signed in to change notification settings - Fork 37
/
mass_invite.lua
72 lines (70 loc) · 2.41 KB
/
mass_invite.lua
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local js = require("access_panorama")
js.eval([[
let collectedSteamIDS = [];
collectedSteamIDS.push("123");
]])
local refresh = false
local function refresh_nearbies()
client.delay_call(5, refresh_nearbies)
if not refresh then
return
end
js.eval([[
PartyBrowserAPI.Refresh();
var lobbies = PartyBrowserAPI.GetResultsCount();
for (var lobbyid = 0; lobbyid < lobbies; lobbyid++) {
var xuid = PartyBrowserAPI.GetXuidByIndex(lobbyid);
if (!collectedSteamIDS.includes(xuid)) {
if (collectedSteamIDS.includes('123')) {
collectedSteamIDS.splice(collectedSteamIDS.indexOf('123'), 1);
}
collectedSteamIDS.push(xuid);
$.Msg(`Adding ${xuid} to the collection..`);
}
}
$.Msg(`Mass invite collection: ${collectedSteamIDS.length}`);
]])
end
refresh_nearbies()
local auto_refresh_nearbies = ui.new_checkbox("lua", "a", "Auto refresh nearbies")
ui.set_callback(auto_refresh_nearbies, function(self)
refresh = ui.get(self)
end)
ui.new_button("lua", "a", "Refresh nearbies", function()
js.eval([[
PartyBrowserAPI.Refresh();
var lobbies = PartyBrowserAPI.GetResultsCount();
for (var lobbyid = 0; lobbyid < lobbies; lobbyid++) {
var xuid = PartyBrowserAPI.GetXuidByIndex(lobbyid);
if (!collectedSteamIDS.includes(xuid)) {
if (collectedSteamIDS.includes('123')) {
collectedSteamIDS.splice(collectedSteamIDS.indexOf('123'), 1);
}
collectedSteamIDS.push(xuid);
$.Msg(`Adding ${xuid} to the collection..`);
}
}
$.Msg(`Mass invite collection: ${collectedSteamIDS.length}`);
]])
end)
ui.new_button("lua", "a", "Mass invite nearbies", function()
js.eval([[
collectedSteamIDS.forEach(xuid => {
FriendsListAPI.ActionInviteFriend(xuid, "");
});
]])
end)
ui.new_button("lua", "a", "Print invite collection", function()
js.eval([[
$.Msg(collectedSteamIDS);
]])
end)
ui.new_button("lua", "a", "Invite all friends", function()
js.eval([[
var friends = FriendsListAPI.GetCount();
for (var id = 0; id < friends; id++) {
var xuid = FriendsListAPI.GetXuidByIndex(id);
FriendsListAPI.ActionInviteFriend(xuid, "");
}
]])
end)