perfectionist-plugins 2.4.3 → 2.4.4
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 +16 -72
- package/auto-accept.js +26 -4
- package/better-client.js +796 -796
- package/dodge-helper.js +49 -7
- package/package.json +1 -1
- package/perfectionist-utils.js +22 -22
package/dodge-helper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PLUGIN_ID = "dodge-helper";
|
|
2
|
-
export const version = "1.4.
|
|
2
|
+
export const version = "1.4.2";
|
|
3
3
|
|
|
4
4
|
const PHASE_URI = "/lol-gameflow/v1/gameflow-phase";
|
|
5
5
|
const SESSION_URI = "/lol-gameflow/v1/session";
|
|
@@ -62,6 +62,7 @@ const state = {
|
|
|
62
62
|
account: null,
|
|
63
63
|
penalty: null,
|
|
64
64
|
lastSelfDodgeAt: 0,
|
|
65
|
+
lockedLocalPick: false,
|
|
65
66
|
anchor: null,
|
|
66
67
|
};
|
|
67
68
|
|
|
@@ -198,6 +199,8 @@ async function refreshPenalty() {
|
|
|
198
199
|
if (!active || token !== penaltyToken || queueId !== state.queueId) return;
|
|
199
200
|
state.penalty = penalty;
|
|
200
201
|
render();
|
|
202
|
+
bindButton(document.getElementById(BUTTON_ID));
|
|
203
|
+
requestAnimationFrame(() => bindButton(document.getElementById(BUTTON_ID)));
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
function applySession(raw) {
|
|
@@ -219,6 +222,16 @@ function applySession(raw) {
|
|
|
219
222
|
ensureMount();
|
|
220
223
|
}
|
|
221
224
|
|
|
225
|
+
function syncLocalPick(session) {
|
|
226
|
+
const cellId = Number(session?.localPlayerCellId);
|
|
227
|
+
if (!Number.isFinite(cellId)) return;
|
|
228
|
+
const actions = Array.isArray(session.actions) ? session.actions.flat() : [];
|
|
229
|
+
const locked = actions.some(
|
|
230
|
+
(action) => Number(action?.actorCellId) === cellId && action?.type === "pick" && action?.completed === true
|
|
231
|
+
);
|
|
232
|
+
if (locked) state.lockedLocalPick = true;
|
|
233
|
+
}
|
|
234
|
+
|
|
222
235
|
function applyChampSelect(raw) {
|
|
223
236
|
const session = unwrap(raw);
|
|
224
237
|
if (!session) return;
|
|
@@ -226,6 +239,7 @@ function applyChampSelect(raw) {
|
|
|
226
239
|
const queueId = Number(session.queueId ?? 0) || 0;
|
|
227
240
|
if (queueId > 0) state.queueId = queueId;
|
|
228
241
|
if (session.isCustomGame) state.isCustom = true;
|
|
242
|
+
syncLocalPick(session);
|
|
229
243
|
ensureMount();
|
|
230
244
|
syncWatching();
|
|
231
245
|
}
|
|
@@ -238,6 +252,25 @@ function unmount() {
|
|
|
238
252
|
}
|
|
239
253
|
}
|
|
240
254
|
|
|
255
|
+
function onButtonClick(event) {
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
event.stopPropagation();
|
|
258
|
+
quitOrDodge();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function bindButton(button) {
|
|
262
|
+
if (!button) return;
|
|
263
|
+
if (!button.__perfClickBound) {
|
|
264
|
+
button.__perfClickBound = true;
|
|
265
|
+
button.addEventListener("click", onButtonClick, true);
|
|
266
|
+
}
|
|
267
|
+
const inner = button.shadowRoot?.querySelector(".lol-uikit-flat-button");
|
|
268
|
+
if (inner && !inner.__perfClickBound) {
|
|
269
|
+
inner.__perfClickBound = true;
|
|
270
|
+
inner.addEventListener("click", onButtonClick);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
241
274
|
function build() {
|
|
242
275
|
const root = document.createElement("div");
|
|
243
276
|
root.id = ROOT_ID;
|
|
@@ -246,11 +279,7 @@ function build() {
|
|
|
246
279
|
lp.className = "perf-dodge-lp";
|
|
247
280
|
const button = document.createElement("lol-uikit-flat-button");
|
|
248
281
|
button.id = BUTTON_ID;
|
|
249
|
-
button
|
|
250
|
-
event.preventDefault();
|
|
251
|
-
event.stopPropagation();
|
|
252
|
-
quitOrDodge();
|
|
253
|
-
});
|
|
282
|
+
bindButton(button);
|
|
254
283
|
root.append(lp, button);
|
|
255
284
|
return root;
|
|
256
285
|
}
|
|
@@ -287,11 +316,15 @@ function ensureMount() {
|
|
|
287
316
|
const roots = [...document.querySelectorAll(`#${ROOT_ID}`)];
|
|
288
317
|
for (const extra of roots.slice(1)) extra.remove();
|
|
289
318
|
const root = roots[0] ?? build();
|
|
290
|
-
if (root.parentElement !== target.element) target.element.
|
|
319
|
+
if (root.parentElement !== target.element) target.element.prepend(root);
|
|
320
|
+
else if (target.kind === "quit" && target.element.firstElementChild !== root) target.element.prepend(root);
|
|
291
321
|
root.classList.toggle("perf-dodge-quit", target.kind === "quit");
|
|
292
322
|
root.classList.toggle("perf-dodge-bar", target.kind === "bar");
|
|
293
323
|
root.classList.toggle("perf-dodge-floating", target.kind === "floating");
|
|
294
324
|
render();
|
|
325
|
+
bindButton(document.getElementById(BUTTON_ID));
|
|
326
|
+
requestAnimationFrame(() => bindButton(document.getElementById(BUTTON_ID)));
|
|
327
|
+
setTimeout(() => bindButton(document.getElementById(BUTTON_ID)), 500);
|
|
295
328
|
}
|
|
296
329
|
|
|
297
330
|
function scheduleMount() {
|
|
@@ -409,8 +442,16 @@ async function quitOrDodge() {
|
|
|
409
442
|
}
|
|
410
443
|
|
|
411
444
|
async function handlePhase(raw) {
|
|
445
|
+
const previous = state.phase;
|
|
412
446
|
const phase = typeof raw === "string" ? raw : unwrap(raw);
|
|
413
447
|
if (typeof phase === "string" && phase) state.phase = phase;
|
|
448
|
+
if (previous === "ChampSelect" && state.phase !== "ChampSelect" && state.phase !== "GameStart" && state.phase !== "InProgress") {
|
|
449
|
+
if (RANKED_QUEUES.has(state.queueId) && !state.lockedLocalPick && !hasNativeQuit()) {
|
|
450
|
+
recordDodge();
|
|
451
|
+
}
|
|
452
|
+
state.lockedLocalPick = false;
|
|
453
|
+
}
|
|
454
|
+
if (state.phase === "ChampSelect" && previous !== "ChampSelect") state.lockedLocalPick = false;
|
|
414
455
|
if (state.phase === "ChampSelect") {
|
|
415
456
|
await loadAccount();
|
|
416
457
|
const [session, champSelect] = await Promise.all([
|
|
@@ -491,6 +532,7 @@ function onDisable() {
|
|
|
491
532
|
state.account = null;
|
|
492
533
|
state.penalty = null;
|
|
493
534
|
state.lastSelfDodgeAt = 0;
|
|
535
|
+
state.lockedLocalPick = false;
|
|
494
536
|
penaltyToken = 0;
|
|
495
537
|
api = null;
|
|
496
538
|
}
|
package/package.json
CHANGED
package/perfectionist-utils.js
CHANGED
|
@@ -16,7 +16,7 @@ const BUNDLED_MODULES = [
|
|
|
16
16
|
file: "perfectionist-utils.js",
|
|
17
17
|
name: "Perfectionism Core",
|
|
18
18
|
version,
|
|
19
|
-
description: "
|
|
19
|
+
description: "The base the other plugins run on. Adds this Perfectionism page to the client settings.",
|
|
20
20
|
core: true,
|
|
21
21
|
},
|
|
22
22
|
{
|
|
@@ -24,56 +24,56 @@ const BUNDLED_MODULES = [
|
|
|
24
24
|
file: "better-client.js",
|
|
25
25
|
name: "BetterClient",
|
|
26
26
|
version: "1.7.0",
|
|
27
|
-
description: "
|
|
27
|
+
description: "Makes the client lighter and smoother without changing how it looks. Cuts tracking and repeated requests and fixes small bugs. Has an optional Performance mode for slower PCs.",
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: "ban-blocker",
|
|
31
31
|
file: "ban-blocker.js",
|
|
32
32
|
name: "Ban Blocker",
|
|
33
33
|
version: "3.6.0",
|
|
34
|
-
description: "
|
|
34
|
+
description: "Adds a BLOCK button to your teammates in champ select. While a teammate is blocked, the champion they are about to ban is prepicked for you, so their ban can never land on it.",
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
id: "unlock-profile-skins",
|
|
38
38
|
file: "unlock-profile-skins.js",
|
|
39
39
|
name: "Unlock Profile Skins",
|
|
40
40
|
version: "1.2.4",
|
|
41
|
-
description: "
|
|
41
|
+
description: "Shows every skin as unlocked in the Set profile background window, event skins included, so you can pick any skin as your profile background.",
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
id: "hide-unowned-skins",
|
|
45
45
|
file: "hide-unowned-skins.js",
|
|
46
46
|
name: "Hide Unowned Skins",
|
|
47
47
|
version: "2.5.1",
|
|
48
|
-
description: "In
|
|
48
|
+
description: "In champ select, the skin carousel only shows the skins you own for the champion you picked.",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "auto-accept",
|
|
52
|
+
file: "auto-accept.js",
|
|
53
|
+
name: "Auto Accept",
|
|
54
|
+
version: "1.1.1",
|
|
55
|
+
description: "Accepts the match for you when the ready check pops up. Add an optional delay, and switch it on or off from the lobby footer.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "dodge-helper",
|
|
59
|
+
file: "dodge-helper.js",
|
|
60
|
+
name: "Dodge Helper",
|
|
61
|
+
version: "1.4.2",
|
|
62
|
+
description: "Adds a button to leave champ select: DODGE in ranked Solo/Duo and Flex, with the estimated LP you will lose, and QUIT in every other mode.",
|
|
49
63
|
},
|
|
50
64
|
{
|
|
51
65
|
id: "auto-claimer",
|
|
52
66
|
file: "auto-claimer.js",
|
|
53
67
|
name: "Auto Claimer",
|
|
54
68
|
version: "1.2.0",
|
|
55
|
-
description: "
|
|
69
|
+
description: "Claims rewards for you as soon as they are ready: event tracks, missions and the TFT Battle Pass. Optional extras can also buy 1 BE shop items and open mystery loot and chests.",
|
|
56
70
|
},
|
|
57
71
|
{
|
|
58
72
|
id: "auto-read",
|
|
59
73
|
file: "auto-read.js",
|
|
60
74
|
name: "Auto Read",
|
|
61
75
|
version: "1.2.0",
|
|
62
|
-
description: "
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "auto-accept",
|
|
66
|
-
file: "auto-accept.js",
|
|
67
|
-
name: "Auto Accept",
|
|
68
|
-
version: "1.1.0",
|
|
69
|
-
description: "Accepts the ready check automatically, with an optional delay and a native switch in the lobby footer.",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: "dodge-helper",
|
|
73
|
-
file: "dodge-helper.js",
|
|
74
|
-
name: "Dodge Helper",
|
|
75
|
-
version: "1.4.0",
|
|
76
|
-
description: "Adds a DODGE/QUIT button to champion select: DODGE with the estimated LP loss for ranked queues, QUIT for every other mode.",
|
|
76
|
+
description: "Marks quests, loot, Clash, TFT and client notices as read for you, so no badge or dot stays lit.",
|
|
77
77
|
},
|
|
78
78
|
];
|
|
79
79
|
|
|
@@ -942,4 +942,4 @@ export async function init(context, coordsProvided) {
|
|
|
942
942
|
} catch (error) {
|
|
943
943
|
logError("startup failed.", error);
|
|
944
944
|
}
|
|
945
|
-
}
|
|
945
|
+
}
|