auto-champion-select 1.0.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 +39 -0
- package/README.md +39 -0
- package/dist/index.js +9 -0
- package/package.json +34 -0
package/README.BR.md
ADDED
|
@@ -0,0 +1,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
|
+
Selecione e bana os campeões automaticamente. <br>
|
|
12
|
+
Esse é o meu primeiro projeto utilizando JavaScript :)
|
|
13
|
+
|
|
14
|
+
<img src="https://i.imgur.com/dVbUcBp.png" width="700" alt="Plugin preview">
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
## Dependências
|
|
20
|
+
|
|
21
|
+
[Pengu Loader 1.0.5](https://github.com/PenguLoader/PenguLoader) (ou qualquer versão superior) <br>
|
|
22
|
+
[controladoUtils.js](https://github.com/controlado/pengu-plugins/blob/master/_controladoUtils.js) (incluso automaticamente)
|
|
23
|
+
|
|
24
|
+
## Instalação
|
|
25
|
+
|
|
26
|
+
1. Baixe os arquivos através das releases [download direto](https://github.com/controlado/auto-champion-select/releases/latest/download/auto-champion-select.zip)
|
|
27
|
+
2. Extraia os arquivos para a pasta de plugins
|
|
28
|
+
|
|
29
|
+
A estrutura deve ser algo parecido com isso:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
📂 Pengu Loader
|
|
33
|
+
└── 📂 plugins
|
|
34
|
+
├── 📂 @default
|
|
35
|
+
└── 📂 auto-champion-select
|
|
36
|
+
├── 📃 README.md
|
|
37
|
+
├── 📃 README.br.md
|
|
38
|
+
└── 📀 index.js
|
|
39
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,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
|
+
Pick and ban champions automatically. <br>
|
|
12
|
+
This is my first project using JavaScript :)
|
|
13
|
+
|
|
14
|
+
<img src="https://i.imgur.com/dVbUcBp.png" width="700" alt="Plugin preview">
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
[Pengu Loader 1.0.5](https://github.com/PenguLoader/PenguLoader) (or any higher version) <br>
|
|
22
|
+
[controladoUtils.js](https://github.com/controlado/pengu-plugins) (automatically included)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
1. Download the files via the releases [direct download](https://github.com/controlado/auto-champion-select/releases/latest/download/auto-champion-select.zip)
|
|
27
|
+
2. Extract the files to the plugins folder
|
|
28
|
+
|
|
29
|
+
The structure should look something like this:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
📂 Pengu Loader
|
|
33
|
+
└── 📂 plugins
|
|
34
|
+
├── 📂 @default
|
|
35
|
+
└── 📂 auto-champion-select
|
|
36
|
+
├── 📃 README.md
|
|
37
|
+
├── 📃 README.br.md
|
|
38
|
+
└── 📀 index.js
|
|
39
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author balaclava
|
|
3
|
+
* @name auto-champion-select
|
|
4
|
+
* @link https://github.com/controlado/auto-champion-select#readme
|
|
5
|
+
* @description Pick or ban automatically! 🐧
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @license GPL-3.0-or-later
|
|
8
|
+
*/
|
|
9
|
+
import{request as b,linkEndpoint as k,addRoutines as y,sleep as S}from"https://cdn.skypack.dev/balaclava-utils@latest";async function w(t,e,n=!0){const o=`/lol-champ-select/v1/session/actions/${t}`;return(await b("PATCH",o,{body:{completed:n,championId:e}})).ok}async function x(){return(await b("GET","/lol-champ-select/v1/session")).json()}async function D(){return(await b("GET","/lol-gameflow/v1/gameflow-phase")).json()}async function v(){const e=await(await b("GET","/lol-game-data/assets/v1/champion-summary.json")).json();return e.sort((n,o)=>n.name.localeCompare(o.name)),e}function A(t){const e=document.createElement("lol-uikit-framed-dropdown");return e.setAttribute("style","margin-bottom: 1.2px;"),e.id=t,e}function E(t){const e=document.createElement("lol-uikit-dropdown-option");return e.setAttribute("slot","lol-uikit-dropdown-option"),e.textContent=t,e}function T(t,e){const n=document.createElement("lol-uikit-radio-input-option");return n.setAttribute("style","margin-left: 16px; font-family: Arial;"),n.setAttribute("selected",e?"true":"false"),n.textContent=t,n}let h=null;const I={enabled:!1,champions:[429,136]},q={enabled:!1,force:!1,champions:[350,221]},B=async t=>{if(t.data==="ChampSelect")for(;await D()==="ChampSelect";){const e=await x();if(await P(e),e.timer.phase==="FINALIZATION")return;await S(200)}},P=async t=>{const{localPlayerCellId:e,actions:n,bans:o,myTeam:c,theirTeam:l}=t,p=[...o.myTeamBans,...o.theirTeamBans],m=[...c,...l],u=DataStore.get("pickChampion"),d=DataStore.get("banChampion");for(const a of n)for(const s of a)if(!(s.completed||s.actorCellId!=e)){if(s.type==="pick"&&u.enabled){for(const i of u.champions)if(!p.some(r=>r==i)&&!m.some(r=>r.championId==i)&&await w(s.id,i))return}if(s.type==="ban"&&d.enabled){for(const i of d.champions)if(!p.some(r=>r==i)&&!(!d.force&&c.some(r=>r.championPickIntent==i))){if(await w(s.id,i))return;break}}}};class f{constructor(e,n,o,c,l=!1){this.index=e,this.id=n,this.champions=o,this.selectedChampion=null,this.config=DataStore.get(this.id),this.element=A(this.id);for(const p of this.champions){const m=this.getOption(p);this.element.append(m)}l&&(this.element.style.filter="brightness(0.7)"),this.hoverText=this.element.shadowRoot.querySelector("div > dt > div"),this.element.onmouseenter=()=>{this.hoverText.textContent=c},this.element.onmouseleave=()=>{this.hoverText.textContent=this.selectedChampion}}getOption(e){const n=E(e.name);return n.onclick=()=>{this.config.champions[this.index]=e.id,this.selectedChampion=e.name,DataStore.set(this.id,this.config)},this.config.champions[this.index]==e.id&&(this.selectedChampion=e.name,n.setAttribute("selected","true")),n}}class C{constructor(e){this.element=document.createElement("div"),this.element.id=e}}class j{constructor(e){this.element=document.createElement("div"),this.element.className="alpha-version-panel",this.element.id=e}}class g{constructor(e,n){this.configKey=n,this.config=DataStore.get(this.configKey),this.element=T(e,this.config.enabled),this.element.onclick=()=>{this.config.enabled=!this.config.enabled,DataStore.set(this.configKey,this.config),this.config.enabled?this.element.setAttribute("selected","true"):this.element.removeAttribute("selected")}}}const G=()=>{const t=document.querySelector(".lol-social-lower-pane-container");if(!t||document.querySelector("#checkbox-container")||document.querySelector("#pick-dropdown-container")||document.querySelector("#ban-dropdown-container"))return;const e=new j("checkbox-container"),n=new C("pick-dropdown-container"),o=new C("ban-dropdown-container"),c=new g("Auto pick","pickChampion"),l=new g("Auto ban","banChampion"),p=new f(0,"pickChampion",h,"First pick option"),m=new f(1,"pickChampion",h,"Second pick option"),u=new f(0,"banChampion",h,"First ban option",!0),d=new f(1,"banChampion",h,"Second ban option",!0);e.element.append(c.element,l.element),n.element.append(p.element,m.element),o.element.append(u.element,d.element);const a=document.createElement("lol-social-roster-group");a.classList.add("group","group-label"),a.addEventListener("click",()=>{const i=a.nextElementSibling;i.style.display=i.style.display==="none"?"block":"none",a.querySelector(".arrow").toggleAttribute("open")});const s=document.createElement("div");s.append(e.element,n.element,o.element),t.append(a,s),a.querySelector("span").textContent="Auto pick/ban",a.querySelector(".group-header").removeAttribute("draggable")};window.addEventListener("load",async()=>{h=await v(),DataStore.has("pickChampion")||DataStore.set("pickChampion",I),DataStore.has("banChampion")||DataStore.set("banChampion",q),k("/lol-gameflow/v1/gameflow-phase",B),y(G),console.debug("auto-champion-select: Report bugs to Balaclava#1912")});
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auto-champion-select",
|
|
3
|
+
"version": "1.0.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"
|
|
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
|
+
}
|
|
34
|
+
}
|