perfectionist-plugins 2.4.7 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -52
- package/auto-accept.js +296 -294
- package/auto-claimer.js +1 -37
- package/auto-read.js +107 -42
- package/ban-blocker.js +483 -677
- package/better-client.js +362 -793
- package/dodge-helper.js +375 -673
- package/hide-unowned-skins.js +63 -686
- package/package.json +40 -40
- package/perfectionist-utils.js +540 -301
- package/unlock-profile-skins.js +174 -620
package/auto-accept.js
CHANGED
|
@@ -1,295 +1,297 @@
|
|
|
1
|
-
const PLUGIN_ID = "auto-accept";
|
|
2
|
-
export const version = "1.
|
|
3
|
-
|
|
4
|
-
const PHASE_URI = "/lol-gameflow/v1/gameflow-phase";
|
|
5
|
-
const READY_CHECK_URI = "/lol-matchmaking/v1/ready-check";
|
|
6
|
-
const ACCEPT_URI = "/lol-matchmaking/v1/ready-check/accept";
|
|
7
|
-
const ACCEPT_KEY = "autoAccept";
|
|
8
|
-
const RETRY_MS = 700;
|
|
9
|
-
const MAX_ATTEMPTS = 4;
|
|
10
|
-
const GAME_SELECT_GUARD_MS = 1500;
|
|
11
|
-
const STYLE_ID = "perf-auto-accept-style";
|
|
12
|
-
const ROOT_ID = "perfAutoAccept";
|
|
13
|
-
const TOGGLE_ID = "perfAutoAcceptToggle";
|
|
14
|
-
|
|
15
|
-
const CSS = `#perfAutoAccept {
|
|
16
|
-
display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
|
|
17
|
-
align-items: center !important; gap: 8px !important; width: max-content !important;
|
|
18
|
-
}
|
|
19
|
-
#perfAutoAccept > * { flex: 0 0 auto !important; }
|
|
20
|
-
#perfAutoAccept .auto-accept-button { display: inline-flex !important; align-items: center !important; cursor: pointer !important; }
|
|
21
|
-
#perfAutoAccept .auto-accept-button-text {
|
|
22
|
-
font-family: var(--font-body, "LoL Body", Arial, sans-serif) !important;
|
|
23
|
-
font-size: 12px !important; letter-spacing: 0.3px !important; color: #a09b8c !important;
|
|
24
|
-
}
|
|
25
|
-
#perfAutoAccept .auto-accept-button[selected] .auto-accept-button-text { color: #f0e6d2 !important; }`;
|
|
26
|
-
|
|
27
|
-
let api = null;
|
|
28
|
-
let active = false;
|
|
29
|
-
let timer = null;
|
|
30
|
-
let accepted = false;
|
|
31
|
-
let sending = false;
|
|
32
|
-
let attempts = 0;
|
|
33
|
-
let unsubscribes = [];
|
|
34
|
-
let removeStyle = null;
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
function enabled() {
|
|
39
|
-
try {
|
|
40
|
-
return api?.getOption?.(PLUGIN_ID, ACCEPT_KEY, true) === true;
|
|
41
|
-
} catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function unwrap(raw) {
|
|
47
|
-
if (typeof raw === "string") {
|
|
48
|
-
const text = raw.trim();
|
|
49
|
-
if (text.startsWith("{") || text.startsWith("[")) {
|
|
50
|
-
try {
|
|
51
|
-
return unwrap(JSON.parse(text));
|
|
52
|
-
} catch {
|
|
53
|
-
return raw;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return raw;
|
|
57
|
-
}
|
|
58
|
-
if (Array.isArray(raw) && raw.length >= 3 && typeof raw[1] === "string") {
|
|
59
|
-
return unwrap(raw[2]?.data ?? raw[2]);
|
|
60
|
-
}
|
|
61
|
-
if (raw && typeof raw === "object" && "data" in raw) {
|
|
62
|
-
const keys = Object.keys(raw);
|
|
63
|
-
if (keys.includes("uri") || keys.includes("eventType") || keys.length <= 2) return unwrap(raw.data);
|
|
64
|
-
}
|
|
65
|
-
return raw;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function canAccept(check) {
|
|
69
|
-
if (!check || typeof check !== "object") return false;
|
|
70
|
-
if (check.state !== "InProgress") return false;
|
|
71
|
-
if (check.playerResponse && check.playerResponse !== "None") return false;
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function clearTimer() {
|
|
76
|
-
clearTimeout(timer);
|
|
77
|
-
timer = null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function resetReadyCheck() {
|
|
81
|
-
clearTimer();
|
|
82
|
-
accepted = false;
|
|
83
|
-
attempts = 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await api.lcu.
|
|
94
|
-
accepted
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
attempts
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
option
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
label
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
1
|
+
const PLUGIN_ID = "auto-accept";
|
|
2
|
+
export const version = "1.2.0";
|
|
3
|
+
|
|
4
|
+
const PHASE_URI = "/lol-gameflow/v1/gameflow-phase";
|
|
5
|
+
const READY_CHECK_URI = "/lol-matchmaking/v1/ready-check";
|
|
6
|
+
const ACCEPT_URI = "/lol-matchmaking/v1/ready-check/accept";
|
|
7
|
+
const ACCEPT_KEY = "autoAccept";
|
|
8
|
+
const RETRY_MS = 700;
|
|
9
|
+
const MAX_ATTEMPTS = 4;
|
|
10
|
+
const GAME_SELECT_GUARD_MS = 1500;
|
|
11
|
+
const STYLE_ID = "perf-auto-accept-style";
|
|
12
|
+
const ROOT_ID = "perfAutoAccept";
|
|
13
|
+
const TOGGLE_ID = "perfAutoAcceptToggle";
|
|
14
|
+
|
|
15
|
+
const CSS = `#perfAutoAccept {
|
|
16
|
+
display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
|
|
17
|
+
align-items: center !important; gap: 8px !important; width: max-content !important;
|
|
18
|
+
}
|
|
19
|
+
#perfAutoAccept > * { flex: 0 0 auto !important; }
|
|
20
|
+
#perfAutoAccept .auto-accept-button { display: inline-flex !important; align-items: center !important; cursor: pointer !important; }
|
|
21
|
+
#perfAutoAccept .auto-accept-button-text {
|
|
22
|
+
font-family: var(--font-body, "LoL Body", Arial, sans-serif) !important;
|
|
23
|
+
font-size: 12px !important; letter-spacing: 0.3px !important; color: #a09b8c !important;
|
|
24
|
+
}
|
|
25
|
+
#perfAutoAccept .auto-accept-button[selected] .auto-accept-button-text { color: #f0e6d2 !important; }`;
|
|
26
|
+
|
|
27
|
+
let api = null;
|
|
28
|
+
let active = false;
|
|
29
|
+
let timer = null;
|
|
30
|
+
let accepted = false;
|
|
31
|
+
let sending = false;
|
|
32
|
+
let attempts = 0;
|
|
33
|
+
let unsubscribes = [];
|
|
34
|
+
let removeStyle = null;
|
|
35
|
+
let unwatchFooter = null;
|
|
36
|
+
let removeFrameHook = null;
|
|
37
|
+
|
|
38
|
+
function enabled() {
|
|
39
|
+
try {
|
|
40
|
+
return api?.getOption?.(PLUGIN_ID, ACCEPT_KEY, true) === true;
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function unwrap(raw) {
|
|
47
|
+
if (typeof raw === "string") {
|
|
48
|
+
const text = raw.trim();
|
|
49
|
+
if (text.startsWith("{") || text.startsWith("[")) {
|
|
50
|
+
try {
|
|
51
|
+
return unwrap(JSON.parse(text));
|
|
52
|
+
} catch {
|
|
53
|
+
return raw;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return raw;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(raw) && raw.length >= 3 && typeof raw[1] === "string") {
|
|
59
|
+
return unwrap(raw[2]?.data ?? raw[2]);
|
|
60
|
+
}
|
|
61
|
+
if (raw && typeof raw === "object" && "data" in raw) {
|
|
62
|
+
const keys = Object.keys(raw);
|
|
63
|
+
if (keys.includes("uri") || keys.includes("eventType") || keys.length <= 2) return unwrap(raw.data);
|
|
64
|
+
}
|
|
65
|
+
return raw;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function canAccept(check) {
|
|
69
|
+
if (!check || typeof check !== "object") return false;
|
|
70
|
+
if (check.state !== "InProgress") return false;
|
|
71
|
+
if (check.playerResponse && check.playerResponse !== "None") return false;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function clearTimer() {
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
timer = null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function resetReadyCheck() {
|
|
81
|
+
clearTimer();
|
|
82
|
+
accepted = false;
|
|
83
|
+
attempts = 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// known: ready-check data that just arrived over the WebSocket. When it says we can accept, accept in
|
|
87
|
+
// the same tick instead of asking the server again first.
|
|
88
|
+
async function acceptNow(known = null) {
|
|
89
|
+
timer = null;
|
|
90
|
+
if (!active || !enabled() || accepted || sending) return;
|
|
91
|
+
sending = true;
|
|
92
|
+
try {
|
|
93
|
+
const check = known && canAccept(known) ? known : await api.lcu.get(READY_CHECK_URI).catch(() => null);
|
|
94
|
+
if (!active || !enabled() || accepted || !canAccept(check)) return;
|
|
95
|
+
await api.lcu.send("POST", ACCEPT_URI);
|
|
96
|
+
accepted = true;
|
|
97
|
+
attempts = 0;
|
|
98
|
+
} catch {
|
|
99
|
+
attempts += 1;
|
|
100
|
+
if (active && enabled() && attempts < MAX_ATTEMPTS) timer = setTimeout(acceptNow, RETRY_MS);
|
|
101
|
+
} finally {
|
|
102
|
+
sending = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function onPhase(raw) {
|
|
107
|
+
const phase = unwrap(raw);
|
|
108
|
+
if (typeof phase !== "string") return;
|
|
109
|
+
if (phase === "ReadyCheck") {
|
|
110
|
+
if (!accepted) acceptNow();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
resetReadyCheck();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function onReadyCheck(raw) {
|
|
117
|
+
const check = unwrap(raw);
|
|
118
|
+
if (!check || typeof check !== "object" || !check.state) return;
|
|
119
|
+
if (check.playerResponse === "Accepted") {
|
|
120
|
+
accepted = true;
|
|
121
|
+
clearTimer();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (check.playerResponse === "Declined" || check.state !== "InProgress") {
|
|
125
|
+
resetReadyCheck();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
acceptNow(check);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function refresh() {
|
|
132
|
+
const phase = unwrap(await api.lcu.get(PHASE_URI).catch(() => null));
|
|
133
|
+
if (!active) return;
|
|
134
|
+
if (phase === "ReadyCheck") acceptNow();
|
|
135
|
+
else resetReadyCheck();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function syncButton() {
|
|
139
|
+
const option = document.getElementById(TOGGLE_ID);
|
|
140
|
+
if (!option) return;
|
|
141
|
+
if (enabled()) option.setAttribute("selected", "true");
|
|
142
|
+
else option.removeAttribute("selected");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function toggle() {
|
|
146
|
+
const next = !enabled();
|
|
147
|
+
try {
|
|
148
|
+
api.setOption(PLUGIN_ID, ACCEPT_KEY, next, false);
|
|
149
|
+
} catch {}
|
|
150
|
+
syncButton();
|
|
151
|
+
if (next) acceptNow();
|
|
152
|
+
else resetReadyCheck();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function buildButton() {
|
|
156
|
+
const root = document.createElement("div");
|
|
157
|
+
root.id = ROOT_ID;
|
|
158
|
+
|
|
159
|
+
const option = document.createElement("lol-uikit-radio-input-option");
|
|
160
|
+
option.id = TOGGLE_ID;
|
|
161
|
+
option.className = "auto-accept-button";
|
|
162
|
+
const label = document.createElement("div");
|
|
163
|
+
label.className = "auto-accept-button-text";
|
|
164
|
+
label.textContent = "Auto Accept";
|
|
165
|
+
option.append(label);
|
|
166
|
+
option.addEventListener("click", (event) => {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
toggle();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
root.append(option);
|
|
173
|
+
return root;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
let buttonRetry = null;
|
|
177
|
+
let gameSelectGuardUntil = 0;
|
|
178
|
+
let gameSelectClickHandler = null;
|
|
179
|
+
|
|
180
|
+
function footer() {
|
|
181
|
+
return (
|
|
182
|
+
document.querySelector(".v2-footer-notifications.ember-view") ??
|
|
183
|
+
document.querySelector(".parties-footer-notifications.ember-view")
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function gameSelectOpen() {
|
|
188
|
+
if (Date.now() < gameSelectGuardUntil) return true;
|
|
189
|
+
try {
|
|
190
|
+
return !!document.querySelector(".parties-game-select-screen.game-select-show");
|
|
191
|
+
} catch {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function onGameSelectClick(event) {
|
|
197
|
+
const target = event.target;
|
|
198
|
+
if (!(target instanceof Element)) return;
|
|
199
|
+
if (!target.closest(".parties-game-select-screen, .play-button-container, .lobby-back-button")) return;
|
|
200
|
+
gameSelectGuardUntil = Date.now() + GAME_SELECT_GUARD_MS;
|
|
201
|
+
clearTimeout(buttonRetry);
|
|
202
|
+
buttonRetry = setTimeout(ensureButton, GAME_SELECT_GUARD_MS + 100);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function ensureButton() {
|
|
206
|
+
if (!active) return;
|
|
207
|
+
clearTimeout(buttonRetry);
|
|
208
|
+
buttonRetry = null;
|
|
209
|
+
if (gameSelectOpen()) {
|
|
210
|
+
buttonRetry = setTimeout(ensureButton, 750);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const host = footer();
|
|
214
|
+
if (!host) return;
|
|
215
|
+
if (!document.getElementById(ROOT_ID)) host.append(buildButton());
|
|
216
|
+
syncButton();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const FOOTER_SELECTOR = ".v2-footer-notifications.ember-view, .parties-footer-notifications.ember-view";
|
|
220
|
+
|
|
221
|
+
function onFrame() {
|
|
222
|
+
// Re-add the switch if the lobby footer re-rendered without it.
|
|
223
|
+
if (buttonRetry || document.getElementById(ROOT_ID)) return;
|
|
224
|
+
if (footer()) ensureButton();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function onEnable(utils) {
|
|
228
|
+
api = utils;
|
|
229
|
+
active = true;
|
|
230
|
+
removeStyle = utils.addStyle(STYLE_ID, CSS);
|
|
231
|
+
|
|
232
|
+
unwatchFooter = utils.watch(FOOTER_SELECTOR, () => ensureButton());
|
|
233
|
+
removeFrameHook = utils.onFrame ? utils.onFrame(onFrame) : null;
|
|
234
|
+
|
|
235
|
+
gameSelectClickHandler = onGameSelectClick;
|
|
236
|
+
document.addEventListener("pointerdown", gameSelectClickHandler, true);
|
|
237
|
+
document.addEventListener("click", gameSelectClickHandler, true);
|
|
238
|
+
|
|
239
|
+
for (const uri of [PHASE_URI, READY_CHECK_URI]) {
|
|
240
|
+
try {
|
|
241
|
+
const off = utils.subscribe(uri, uri === PHASE_URI ? onPhase : onReadyCheck);
|
|
242
|
+
if (off) unsubscribes.push(off);
|
|
243
|
+
} catch {}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
ensureButton();
|
|
247
|
+
refresh();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function onDisable() {
|
|
251
|
+
active = false;
|
|
252
|
+
resetReadyCheck();
|
|
253
|
+
for (const off of unsubscribes) {
|
|
254
|
+
try {
|
|
255
|
+
off();
|
|
256
|
+
} catch {}
|
|
257
|
+
}
|
|
258
|
+
unsubscribes = [];
|
|
259
|
+
unwatchFooter?.();
|
|
260
|
+
unwatchFooter = null;
|
|
261
|
+
removeFrameHook?.();
|
|
262
|
+
removeFrameHook = null;
|
|
263
|
+
clearTimeout(buttonRetry);
|
|
264
|
+
buttonRetry = null;
|
|
265
|
+
if (gameSelectClickHandler) {
|
|
266
|
+
document.removeEventListener("pointerdown", gameSelectClickHandler, true);
|
|
267
|
+
document.removeEventListener("click", gameSelectClickHandler, true);
|
|
268
|
+
}
|
|
269
|
+
gameSelectClickHandler = null;
|
|
270
|
+
gameSelectGuardUntil = 0;
|
|
271
|
+
document.getElementById(ROOT_ID)?.remove();
|
|
272
|
+
removeStyle?.();
|
|
273
|
+
removeStyle = null;
|
|
274
|
+
api = null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function init() {
|
|
278
|
+
const registerWith = (utils) => {
|
|
279
|
+
utils.registerPlugin({
|
|
280
|
+
id: PLUGIN_ID,
|
|
281
|
+
name: "Auto Accept",
|
|
282
|
+
description:
|
|
283
|
+
"Accepts the ready check automatically. Use the Auto Accept switch in the lobby footer to turn it on or off.",
|
|
284
|
+
version,
|
|
285
|
+
onEnable,
|
|
286
|
+
onDisable,
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
if (window.PerfectionistUtils) {
|
|
291
|
+
registerWith(window.PerfectionistUtils);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
addEventListener("perfectionist:utils-ready", (event) => registerWith(event.detail ?? window.PerfectionistUtils), {
|
|
295
|
+
once: true,
|
|
296
|
+
});
|
|
295
297
|
}
|
package/auto-claimer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PLUGIN_ID = "auto-claimer";
|
|
2
|
-
const version = "1.
|
|
2
|
+
const version = "1.3.0";
|
|
3
3
|
|
|
4
4
|
const SWEEP_DEBOUNCE_MS = 400;
|
|
5
5
|
const CLAIM_COOLDOWN_MS = 5 * 60 * 1000;
|
|
@@ -27,7 +27,6 @@ let shopInterval = null;
|
|
|
27
27
|
let shopRunning = false;
|
|
28
28
|
let shopQueued = false;
|
|
29
29
|
let unsubscribes = [];
|
|
30
|
-
let sourceInstalled = false;
|
|
31
30
|
const cooldowns = new Map();
|
|
32
31
|
const recipes = new Map();
|
|
33
32
|
|
|
@@ -265,39 +264,6 @@ function syncShopTimer() {
|
|
|
265
264
|
shopInterval = null;
|
|
266
265
|
}
|
|
267
266
|
|
|
268
|
-
function noteTraffic(url) {
|
|
269
|
-
if (!active || typeof url !== "string") return;
|
|
270
|
-
if (url.includes("/lol-store/v1/catalog")) scheduleShop();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function installSourceWatch() {
|
|
274
|
-
if (sourceInstalled) return;
|
|
275
|
-
sourceInstalled = true;
|
|
276
|
-
const original = window.fetch;
|
|
277
|
-
if (typeof original === "function" && !original.__perfClaimWatch) {
|
|
278
|
-
const wrapped = function (input, init) {
|
|
279
|
-
noteTraffic(typeof input === "string" ? input : (input && input.url) || "");
|
|
280
|
-
return original.call(this, input, init);
|
|
281
|
-
};
|
|
282
|
-
wrapped.__perfClaimWatch = true;
|
|
283
|
-
window.fetch = wrapped;
|
|
284
|
-
}
|
|
285
|
-
const proto = window.XMLHttpRequest && window.XMLHttpRequest.prototype;
|
|
286
|
-
if (proto && !proto.open.__perfClaimWatch) {
|
|
287
|
-
const origOpen = proto.open;
|
|
288
|
-
const origSend = proto.send;
|
|
289
|
-
proto.open = function (method, url, ...rest) {
|
|
290
|
-
this.__perfClaimUrl = typeof url === "string" ? url : "";
|
|
291
|
-
return origOpen.call(this, method, url, ...rest);
|
|
292
|
-
};
|
|
293
|
-
proto.open.__perfClaimWatch = true;
|
|
294
|
-
proto.send = function (...args) {
|
|
295
|
-
noteTraffic(this.__perfClaimUrl || "");
|
|
296
|
-
return origSend.apply(this, args);
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
267
|
function onEnable(utils) {
|
|
302
268
|
api = utils;
|
|
303
269
|
active = true;
|
|
@@ -354,8 +320,6 @@ function onOptionChange(key) {
|
|
|
354
320
|
}
|
|
355
321
|
|
|
356
322
|
export function init() {
|
|
357
|
-
installSourceWatch();
|
|
358
|
-
|
|
359
323
|
const registerWith = (utils) => {
|
|
360
324
|
utils.registerPlugin({
|
|
361
325
|
id: PLUGIN_ID,
|