Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/mods/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export { Shortcuts } from "../mods/shortcuts/shortcuts";
export { ShowResources } from "./show-resources/show-resources";
export { VerticalTimeline } from "./vertical-timeline/vertical-timeline";
export { ZaapSearchFilter } from "./zaap-search-filter/zaap-search-filter";
export { RuneOpenerList } from "./rune-lister/runeOpenerLister"
export { RuneOpenerList } from "./rune-lister/runeOpenerLister";
export { ItemCraftable } from "./item-craftable/itemcraftable"
110 changes: 110 additions & 0 deletions src/app/mods/item-craftable/itemcraftable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import {Mod} from "../mod";

export class ItemCraftable extends Mod {
private itemWindow = null
private styleTag: HTMLStyleElement;
private statuscheckbox = false

startMod(): void {
this.itemWindow = this.wGame.gui.windowsContainer._childrenList.find(e=>e.id=="itemRecipes")
this.wGame.gui.windowsContainer._childrenList.find(e=>e.id=="itemRecipes").on("open",(e)=>{
e = this.wGame.gui.windowsContainer._childrenList.find(e=>e.id=="itemRecipes")
setTimeout(() => {
this.checkBox();
}, 200);
})
}

private verifRecette(statuscheckbox){
let aa = this.wGame.gui.windowsContainer.getChildren().find(e=>e.id=="itemRecipes")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aa ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahaha

let listrecette = aa.recipeList.recipesList._childrenList
if(listrecette == NaN){
return ;
}
if(statuscheckbox == false){
this.searchFilterOn(listrecette)
}
else {
this.searchFilterOff(listrecette)
}

}
private searchFilterOn(listrecette){
let list = this.wGame.document.querySelector('.ItemRecipesWindow .rightCol .recipesWrapper .scrollerContent')
for(var i = 0; i < listrecette.length; i++){
if(listrecette[i].craftableCount == 1){
list.getElementsByClassName("RecipeBox")[i].style.display = "block";
}
else {
list.getElementsByClassName("RecipeBox")[i].style.display = "none";
}

}

}
private searchFilterOff(listrecette){
let list = this.wGame.document.querySelector('.ItemRecipesWindow .rightCol .recipesWrapper .scrollerContent')
for(var i = 0; i < listrecette.length; i++){
list.getElementsByClassName("RecipeBox")[i].style.display = "block";
}
}



private checkBox(){
let boutondroit = this.wGame.document.querySelector('.ItemRecipesWindow .rightCol .PaginationUI .next.Button')
let checkboxic = document.createElement("div");
checkboxic.setAttribute("type", "checkbox");
checkboxic.className = "checkboxitemcraftable";
checkboxic.innerText = "Afficher les items craftable";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remplacer checkboxic par le champs privé déclaré plus haut

this.styleTag = this.wGame.document.createElement("style");
this.wGame.document.getElementsByTagName("head")[0].appendChild(this.styleTag);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile

let onClick = () => {
this.statusCheckBox()
};
this.styleTag.innerHTML += `
.checkboxitemcraftable {
text-align: left;
padding: 3px 3px 3px 30px;
background-position: -24px calc(50% - 2px);
background-size: 18px 18px;
background-repeat: no-repeat;
background-origin: content-box;
background-image: url("./assets/ui/checkbox.png")
}
`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile

boutondroit.parentNode.insertBefore(checkboxic, null);
checkboxic.addEventListener('click', onClick);
}

private statusCheckBox(){
if(this.statuscheckbox == false){
this.verifRecette(this.statuscheckbox);
this.statuscheckbox = true
this.styleTag.innerHTML = `
.checkboxitemcraftable {
text-align: left;
padding: 3px 3px 3px 30px;
background-position: -24px calc(50% - 2px);
background-size: 18px 18px;
background-repeat: no-repeat;
background-origin: content-box;
background-image: url("./assets/ui/checkbox_checked.png");
`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile, à remplacer par element.classList.add('on') pour ajouter la classe "on" et ainsi avoir la box checked visuellement.

}
else {
this.verifRecette(this.statuscheckbox);
this.statuscheckbox = false
this.styleTag.innerHTML = `
.checkboxitemcraftable {
text-align: left;
padding: 3px 3px 3px 30px;
background-position: -24px calc(50% - 2px);
background-size: 18px 18px;
background-repeat: no-repeat;
background-origin: content-box;
background-image: url("./assets/ui/checkbox.png")
`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile, à remplacer par element.classList.remove('on') pour retirerla classe "on" et ainsi avoir la box non check.

}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il te faut une fonction reset() pour enlever (this.styleTag?.remove?.();) la feuille de style définie dans le startMod() et la checkbox ajoutée

}