auto-champion-select 1.2.0 → 1.3.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.br.md +44 -39
- package/README.md +44 -39
- package/dist/index.js +2 -2
- package/package.json +34 -34
package/README.br.md
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# `🐧` Auto Champion Select <br>
|
|
4
|
-
|
|
5
|
-
[](https://wakatime.com/89c5e1c8-9e67-43ef-bd0e-3ff9a4fde5e2)
|
|
6
|
-
[](https://discordapp.com/users/854886148455399436) <br>
|
|
7
|
-

|
|
8
|
-
[](README.md)
|
|
9
|
-
[](README.br.md)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Esse é o meu primeiro projeto utilizando JavaScript :)
|
|
13
|
-
|
|
14
|
-
<img src="https://i.imgur.com/
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
<br>
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
1.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# `🐧` Auto Champion Select <br>
|
|
4
|
+
|
|
5
|
+
[](https://wakatime.com/89c5e1c8-9e67-43ef-bd0e-3ff9a4fde5e2)
|
|
6
|
+
[](https://discordapp.com/users/854886148455399436) <br>
|
|
7
|
+

|
|
8
|
+
[](README.md)
|
|
9
|
+
[](README.br.md)
|
|
10
|
+
|
|
11
|
+
Aceite a fila, selecione e bana os campeões automaticamente. <br>
|
|
12
|
+
Esse é o meu primeiro projeto utilizando JavaScript :)
|
|
13
|
+
|
|
14
|
+
<img src="https://i.imgur.com/Ovy1gGw.png" width="700" alt="Plugin preview">
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
## 📍 Novidades
|
|
20
|
+
|
|
21
|
+
- Accept: aceita, automaticamente, as partidas
|
|
22
|
+
- CommandBar: use `CTRL + K` para desligar/ligar o auto pick/ban
|
|
23
|
+
|
|
24
|
+
## Dependências
|
|
25
|
+
|
|
26
|
+
[Pengu Loader 1.0.5](https://github.com/PenguLoader/PenguLoader) (ou qualquer versão superior) <br>
|
|
27
|
+
[controladoUtils.js](https://github.com/controlado/pengu-plugins/blob/master/_controladoUtils.js) (incluso automaticamente)
|
|
28
|
+
|
|
29
|
+
## Instalação
|
|
30
|
+
|
|
31
|
+
1. Baixe os arquivos através das releases [download direto](https://github.com/controlado/auto-champion-select/releases/latest/download/auto-champion-select.zip)
|
|
32
|
+
2. Extraia os arquivos para a pasta de plugins
|
|
33
|
+
|
|
34
|
+
A estrutura deve ser algo parecido com isso:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
📂 Pengu Loader
|
|
38
|
+
└── 📂 plugins
|
|
39
|
+
├── 📂 @default
|
|
40
|
+
└── 📂 auto-champion-select
|
|
41
|
+
├── 📃 README.md
|
|
42
|
+
├── 📃 README.br.md
|
|
43
|
+
└── 📀 index.js
|
|
44
|
+
```
|
package/README.md
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# `🐧` Auto Champion Select <br>
|
|
4
|
-
|
|
5
|
-
[](https://wakatime.com/89c5e1c8-9e67-43ef-bd0e-3ff9a4fde5e2)
|
|
6
|
-
[](https://discordapp.com/users/854886148455399436) <br>
|
|
7
|
-

|
|
8
|
-
[](README.md)
|
|
9
|
-
[](README.br.md)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
This is my first project using JavaScript :)
|
|
13
|
-
|
|
14
|
-
<img src="https://i.imgur.com/
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
<br>
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
1.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# `🐧` Auto Champion Select <br>
|
|
4
|
+
|
|
5
|
+
[](https://wakatime.com/89c5e1c8-9e67-43ef-bd0e-3ff9a4fde5e2)
|
|
6
|
+
[](https://discordapp.com/users/854886148455399436) <br>
|
|
7
|
+

|
|
8
|
+
[](README.md)
|
|
9
|
+
[](README.br.md)
|
|
10
|
+
|
|
11
|
+
Accept queue, pick and ban champions automatically. <br>
|
|
12
|
+
This is my first project using JavaScript :)
|
|
13
|
+
|
|
14
|
+
<img src="https://i.imgur.com/Ovy1gGw.png" width="700" alt="Plugin preview">
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
## 📍 What's new
|
|
20
|
+
|
|
21
|
+
- Accept: automatically accepts matches (ready check)
|
|
22
|
+
- CommandBar: use `CTRL + K` to turn auto pick/ban off/on
|
|
23
|
+
|
|
24
|
+
## Dependencies
|
|
25
|
+
|
|
26
|
+
[Pengu Loader 1.0.5](https://github.com/PenguLoader/PenguLoader) (or any higher version) <br>
|
|
27
|
+
[controladoUtils.js](https://github.com/controlado/pengu-plugins) (automatically included)
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
1. Download the files via the releases [direct download](https://github.com/controlado/auto-champion-select/releases/latest/download/auto-champion-select.zip)
|
|
32
|
+
2. Extract the files to the plugins folder
|
|
33
|
+
|
|
34
|
+
The structure should look something like this:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
📂 Pengu Loader
|
|
38
|
+
└── 📂 plugins
|
|
39
|
+
├── 📂 @default
|
|
40
|
+
└── 📂 auto-champion-select
|
|
41
|
+
├── 📃 README.md
|
|
42
|
+
├── 📃 README.br.md
|
|
43
|
+
└── 📀 index.js
|
|
44
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @name auto-champion-select
|
|
5
5
|
* @link https://github.com/controlado/auto-champion-select#readme
|
|
6
6
|
* @description Pick or ban automatically! 🐧
|
|
7
|
-
* @version 1.
|
|
7
|
+
* @version 1.3.0
|
|
8
8
|
* @license GPL-3.0-or-later
|
|
9
9
|
*/
|
|
10
|
-
import{sleep as d,request as
|
|
10
|
+
import{sleep as d,request as a,linkEndpoint as y}from"https://cdn.skypack.dev/balaclava-utils@latest";const E={enabled:!1},x={enabled:!1,champions:[21,21]},F={enabled:!1,champions:[21,21]},r={controladoAutoAccept:E,controladoPick:x,controladoBan:F};class I{constructor(){this.session=null,this.actions=null,this.localPlayerCellId=null,this.teamIntents=null,this.allPicks=null,this.allBans=null,this.mounted=!1,this.watch()}mount(){this.mounted=!0}unmount(){this.mounted=!1}async watch(){for(;;)this.mounted&&(await this.updateProperties(),await this.task()),await d(300)}async updateProperties(){const e=await a("GET","/lol-champ-select/v1/session");this.session=await e.json(),this.actions=this.session.actions,this.localPlayerCellId=this.session.localPlayerCellId,this.allPicks=[...this.session.myTeam,...this.session.theirTeam],this.allBans=[...this.session.bans.myTeamBans,...this.session.bans.theirTeamBans],this.teamIntents=this.session.myTeam.map(t=>t.championPickIntent)}async task(){const e=DataStore.get("controladoPick")||r.controladoPick,t=DataStore.get("controladoBan")||r.controladoBan;if(!e.enabled&&!t.enabled)return;const n=this.getLocalPlayerSubActions();if(n.length===0){console.debug("auto-champion-select: No local player sub actions found, skipping..."),this.unmount();return}for(const s of n){const l=s.type==="pick"?e:t;if(l.enabled)for(const i of l.champions){if(this.allBans.some(c=>c==i)){console.debug(`auto-champion-select: Banning ${i} but it's already banned, skipping...`);continue}if(s.type==="ban"&&this.teamIntents.some(c=>c==i)){console.debug(`auto-champion-select: Banning ${i} but it's already picked, skipping...`);continue}if(s.type==="pick"&&this.allPicks.some(c=>c.championId==i)){console.debug(`auto-champion-select: Picking ${i} but it's already picked, skipping...`);continue}if(console.debug(`auto-champion-select: Trying to ${s.type} ${i}...`),(await this.selectChampion(s.id,i)).ok){console.debug("auto-champion-select: OK!");return}}}}getLocalPlayerSubActions(){return this.actions.flat().filter(e=>e.actorCellId===this.localPlayerCellId&&e.completed===!1)}selectChampion(e,t){const n=`/lol-champ-select/v1/session/actions/${e}`;return a("PATCH",n,{body:{championId:t,completed:!0}})}}class p{constructor(e,t,n,s){this.element=document.createElement("lol-uikit-framed-dropdown"),this.element.classList.add("dropdown-champions-default"),this.text=e,this.config=null,this.configKey=t,this.configIndex=n,this.championsFunction=s,this.champions=null}async setup(){this.champions=await this.championsFunction(),this.config=DataStore.get(this.configKey)||r[this.configKey],this.champions.some(t=>this.config.champions[this.configIndex]===t.id)||(this.config.champions[this.configIndex]=this.champions[0].id,DataStore.set(this.configKey,this.config));const e=[];for(const t of this.champions){if(e.includes(t.name))continue;e.push(t.name);const n=this.getNewOption(t);this.element.appendChild(n)}if(!this.element.shadowRoot.querySelector("#controlado-placeholder")){const t=this.element.shadowRoot.querySelector(".ui-dropdown-current"),n=this.getNewPlaceholder();t.appendChild(n)}}getNewOption(e){const t=document.createElement("lol-uikit-dropdown-option");return t.setAttribute("slot","lol-uikit-dropdown-option"),t.addEventListener("click",()=>{this.config.champions[this.configIndex]=e.id,DataStore.set(this.configKey,this.config)}),this.config.champions[this.configIndex]===e.id&&t.setAttribute("selected","true"),t.innerText=e.name,t}getNewPlaceholder(){const e=document.createElement("div");return e.classList.add("ui-dropdown-current-content"),e.style.overflow="visible",e.id="controlado-placeholder",e.innerText=this.text,e}refresh(){this.element.innerHTML="",this.setup()}}class b{constructor(e,t){this.element=document.createElement("lol-uikit-radio-input-option"),this.element.classList.add("lol-settings-voice-input-mode-option","auto-select-checkbox"),this.element.innerText=e,this.config=null,this.configKey=t}setup(){this.config=DataStore.get(this.configKey)||r[this.configKey],this.config.enabled&&this.element.setAttribute("selected","true"),this.element.addEventListener("click",()=>this.toggle())}toggle(){return console.debug("auto-champion-select: Toggling",this.configKey),this.config.enabled=!this.config.enabled,DataStore.set(this.configKey,this.config),this.element.toggleAttribute("selected"),this.config.enabled}}class O{constructor(e,...t){this.element=document.createElement("lol-social-roster-group"),this.element.addEventListener("post-render",()=>this.onPostRender()),this.element.addEventListener("click",()=>this.onClick()),this.label=e,this.hiddableElements=t,this.waitRender()}waitRender(){new MutationObserver((e,t)=>{if(this.element.querySelector("span")){const n=new Event("post-render");this.element.dispatchEvent(n),t.disconnect()}}).observe(this.element,{childList:!0})}onPostRender(){this.element.querySelector("span").innerText=this.label,this.element.querySelector(".group-header").removeAttribute("graggable")}onClick(){this.hiddableElements.forEach(e=>e.classList.toggle("hidden")),this.element.querySelector(".arrow").toggleAttribute("open")}}const h="Balaclava: Auto Champion Select";class v{constructor(e,t,n,s,l,i,k){this.id=e,this.name=t,this.legend=n,this.tags=s,this.group=l,this.perform=this.perform.bind(this),this.callback=i,this.toasts=k}perform(){try{const e=this.callback();Toast.success(e?this.toasts.on:this.toasts.off)}catch(e){Toast.error(this.toasts.error),console.error(e)}}}class D extends v{constructor(e){super("controladoPickSwitch","Auto Pick [ON/OFF]","Turn the auto pick ON/OFF",[h,"pick","switch"],h,e,{on:"Auto Pick is ON",off:"Auto Pick is OFF",error:"Failed to toggle Auto Pick. Check console."})}}class L extends v{constructor(e){super("controladoBanSwitch","Auto Ban [ON/OFF]","Turn the auto ban ON/OFF",[h,"ban","switch"],h,e,{on:"Auto Ban is ON",off:"Auto Ban is OFF",error:"Failed to toggle Auto Ban. Check console."})}}function R(o){for(let e of o)CommandBar.addAction(e)}const K="1.3.0";const A=new I,w=new b("Accept","controladoAutoAccept"),u=new b("Pick","controladoPick"),m=new p("1st pick option","controladoPick",0,B),g=new p("2nd pick option","controladoPick",1,B),f=new b("Ban","controladoBan"),C=new p("1st ban option","controladoBan",0,T),P=new p("2nd ban option","controladoBan",1,T);function S(){return document.querySelector("lol-social-roster.roster")}async function B(){let o=await a("GET","/lol-champions/v1/owned-champions-minimal");for(;!o.ok;)console.debug("auto-champion-select(owned-champions-minimal): Retrying..."),o=await a("GET","/lol-champions/v1/owned-champions-minimal"),await d(1e3);const e=await o.json();return e.sort((t,n)=>t.name.localeCompare(n.name)),e}async function T(){const e=await(await a("GET","/lol-game-data/assets/v1/champion-summary.json")).json();return e.sort((t,n)=>t.name.localeCompare(n.name)),e}async function N(){w.config.enabled===!0&&(console.debug("auto-champion-select(auto-accept): Ready check detected, accepting in 2 seconds..."),await d(2e3),await q())}async function q(){const o=await a("POST","/lol-matchmaking/v1/ready-check/accept");o.ok?console.debug("auto-champion-select(auto-accept): Accepted ready check"):console.error("auto-champion-select(auto-accept): Failed to accept ready check",o)}window.addEventListener("load",async()=>{let o=S();for(;!o;)await d(200),o=S();Promise.all([w.setup(),u.setup(),f.setup(),m.setup(),g.setup(),C.setup(),P.setup()]),R([new D(()=>u.toggle()),new L(()=>f.toggle())]),y("/lol-inventory/v1/wallet",s=>{s.eventType==="Update"&&(console.debug("auto-champion-select(wallet): Refreshing dropdowns..."),Promise.all([m.refresh(),g.refresh()]))}),y("/lol-gameflow/v1/gameflow-phase",s=>{s.data==="ReadyCheck"&&N(),s.data==="ChampSelect"?A.mount():A.unmount()});const e=document.createElement("div"),t=document.createElement("div");t.classList.add("auto-select-checkboxes-div"),t.append(w.element,u.element,f.element),e.append(m.element,g.element),e.append(C.element,P.element);const n=new O("Auto champion select",e,t);o.append(n.element,t,e),console.debug(`auto-champion-select(${K}): Report bugs to Balaclava#1912`)});
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto-champion-select",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Pick or ban automatically! 🐧",
|
|
5
|
-
"author": "balaclava",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/controlado/auto-champion-select.git"
|
|
9
|
-
},
|
|
10
|
-
"license": "GPL-3.0-or-later",
|
|
11
|
-
"main": "./dist/index.js",
|
|
12
|
-
"files": [
|
|
13
|
-
"dist"
|
|
14
|
-
],
|
|
15
|
-
"keywords": [
|
|
16
|
-
"pengu-loader",
|
|
17
|
-
"league-client",
|
|
18
|
-
"league-of-legends",
|
|
19
|
-
"plugins",
|
|
20
|
-
"balaclava",
|
|
21
|
-
"controlado"
|
|
22
|
-
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "vite build",
|
|
25
|
-
"watch": "vite build --watch --outDir ."
|
|
26
|
-
},
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/controlado/auto-champion-select/issues"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://github.com/controlado/auto-champion-select#readme",
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"vite": "^4.4.6",
|
|
33
|
-
"vite-plugin-css-injected-by-js": "^3.2.1"
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "auto-champion-select",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Pick or ban automatically! 🐧",
|
|
5
|
+
"author": "balaclava",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/controlado/auto-champion-select.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "GPL-3.0-or-later",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"pengu-loader",
|
|
17
|
+
"league-client",
|
|
18
|
+
"league-of-legends",
|
|
19
|
+
"plugins",
|
|
20
|
+
"balaclava",
|
|
21
|
+
"controlado"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"watch": "vite build --watch --outDir ."
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/controlado/auto-champion-select/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/controlado/auto-champion-select#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"vite": "^4.4.6",
|
|
33
|
+
"vite-plugin-css-injected-by-js": "^3.2.1"
|
|
34
|
+
}
|
|
35
35
|
}
|