perfectionist-plugins 1.4.0 → 1.4.1

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.
@@ -1,4 +1,4 @@
1
- export const version = "2.3.1";
1
+ export const version = "2.3.2";
2
2
 
3
3
  const PLUGIN_ID = "hide-unowned-skins";
4
4
  const STYLE_ID = "perfectionist-hide-unowned-skins-style";
@@ -259,6 +259,7 @@ function ensureSourceFilter() {
259
259
  let api = null;
260
260
  let summonerId = null;
261
261
  let ownedSkinIds = null;
262
+ let allSkinIds = null;
262
263
  let currentChampionId = null;
263
264
  let carouselOrder = [];
264
265
  let selectedSkinId = null;
@@ -379,7 +380,7 @@ function applyAll() {
379
380
  let hidden = 0;
380
381
  items.forEach((item) => {
381
382
  const skinId = currentChampionId === null ? null : readSkinId(item);
382
- const hide = ownedSkinIds !== null && skinId !== null && !ownedSkinIds.has(skinId);
383
+ const hide = ownedSkinIds !== null && skinId !== null && allSkinIds !== null && allSkinIds.has(skinId) && !ownedSkinIds.has(skinId);
383
384
  if (hide) hidden++;
384
385
  item.classList.toggle(HIDDEN_CLASS, hide);
385
386
  hideTargetFor(item).classList.toggle(HIDDEN_CLASS, hide);
@@ -390,7 +391,7 @@ function applyAll() {
390
391
  const dotsMapped = carouselOrder.length > 0 && dots.length === carouselOrder.length;
391
392
  dots.forEach((dot, index) => {
392
393
  const skinId = dotsMapped ? carouselOrder[index] : undefined;
393
- const hide = ownedSkinIds !== null && skinId !== undefined && !ownedSkinIds.has(skinId);
394
+ const hide = ownedSkinIds !== null && skinId !== undefined && allSkinIds !== null && allSkinIds.has(skinId) && !ownedSkinIds.has(skinId);
394
395
  if (hide) dotsHidden++;
395
396
  dot.classList.toggle(HIDDEN_CLASS, hide);
396
397
  });
@@ -487,6 +488,7 @@ async function selectSkin(skinId) {
487
488
  function resetState() {
488
489
  requestToken++;
489
490
  ownedSkinIds = null;
491
+ allSkinIds = null;
490
492
  currentChampionId = null;
491
493
  selectedSkinId = null;
492
494
  carouselOrder = [];
@@ -500,6 +502,7 @@ function resetState() {
500
502
  function loadChampion(championId) {
501
503
  currentChampionId = championId;
502
504
  ownedSkinIds = null;
505
+ allSkinIds = null;
503
506
  failure = null;
504
507
  clientSkinOrder = [];
505
508
  const token = ++requestToken;
@@ -508,6 +511,7 @@ function loadChampion(championId) {
508
511
  ([{ owned, order: inventoryOrder }, carouselIds]) => {
509
512
  if (token !== requestToken) return;
510
513
  ownedSkinIds = owned;
514
+ allSkinIds = new Set(inventoryOrder);
511
515
  carouselOrder = carouselIds.length > 0 ? carouselIds : inventoryOrder;
512
516
  applyAllGuarded();
513
517
  },
@@ -542,7 +546,8 @@ function updateForSession(session, selection) {
542
546
  const belongsToChampion = serverSkinId !== null && Math.floor(serverSkinId / 1000) === championId;
543
547
  if (!selectInFlight && belongsToChampion) selectedSkinId = serverSkinId;
544
548
 
545
- if (!selectInFlight && belongsToChampion && !ownedSkinIds.has(serverSkinId)) {
549
+ const knownUnownedSkin = allSkinIds !== null && allSkinIds.has(serverSkinId) && !ownedSkinIds.has(serverSkinId);
550
+ if (!selectInFlight && knownUnownedSkin) {
546
551
  const fallback = nextOwnedSkin(ownedSkinIds, 0, 1);
547
552
  if (fallback !== null) {
548
553
  selectSkin(fallback).catch((error) => logError("could not correct the selected skin.", error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perfectionist-plugins",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Small plugins that fix the annoying parts of League of Legends champ select. Built for Pengu Loader.",
5
5
  "type": "module",
6
6
  "main": "perfectionist-utils.js",
@@ -33,7 +33,7 @@ const BUNDLED_MODULES = [
33
33
  id: "hide-unowned-skins",
34
34
  file: "hide-unowned-skins.js",
35
35
  name: "Hide Unowned Skins",
36
- version: "2.3.1",
36
+ version: "2.3.2",
37
37
  description: "In champion select, only shows the skins you own for the picked champion.",
38
38
  },
39
39
  {