Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod - Afficher les items craftable #164

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

TheKetur55
Copy link

Un script qui rajoute un checkbox dans les recettes pour afficher filtrer les items qui sont craftable

Un mod qui rajoute un checkbox dans les recettes pour filtrer les items craftables.
@TheKetur55 TheKetur55 marked this pull request as draft January 10, 2022 17:03
@TheKetur55
Copy link
Author

En attente de Broseidon pour opti le css

@ghost
Copy link

ghost commented Jan 10, 2022

Pas avant ce week-end, sorry !

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Hello ! Petite review du code, y'a plusieurs choses à améliorer au niveau du CSS : tu vas gagner des lignes et en lisibilité !
Je t'ai mis pas mal de code d'exemple, mais pas tout : faut quand même que tu travailles !

src/app/mods/index.ts Outdated Show resolved Hide resolved
src/app/mods/item-craftable/itemcraftable.ts Show resolved Hide resolved
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.

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

Comment on lines 60 to 61
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

Comment on lines 65 to 75
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

Comment on lines 84 to 93
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.

Comment on lines 98 to 107
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.

src/app/mods/item-craftable/itemcraftable.ts Show resolved Hide resolved
Comment on lines 56 to 59
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

}

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

@TheKetur55 TheKetur55 marked this pull request as ready for review January 16, 2022 13:47
@TheKetur55 TheKetur55 marked this pull request as draft January 17, 2022 16:40
@TheKetur55
Copy link
Author

Le checkbox ne ce remove pas lors du reload . . .

@JulienCoutault
Copy link
Collaborator

JulienCoutault commented Jan 17, 2022

Je pense que l'on peut mettre cette pr (et surtout le checkbox) de cote, tant que #136 ne sera pas merge

@TheKetur55
Copy link
Author

TheKetur55 commented Jan 17, 2022

Je pense que l'on peut mettre cette pr (et surtout le checkbox) de cote, tant que #136 ne sera pas merge

Yep ca me va

@JulienCoutault
Copy link
Collaborator

Je relance vu que #136 est maitnenant merge, on a toujours un soucis sur develop mais #191 devrait le resoudre

@Sylvaner
Copy link

Bonjour,

Désolé je regarde seulement mais c'est compliqué sans avoir la main sur le code des autres car c'est des soucis de typage HTMLElement dans le code.
Donc je vous mets les corrections ici :

Error: src/app/mods/general/auto-focus.ts:38:95 - error TS2339: Property 'focus' does not exist on type 'Element'.
38 this.wGame.document.querySelector(this.focusableWindows[id] + ' .InputBox input').focus()

(this.wGame.document.querySelector(this.focusableWindows[id] + ' .InputBox input') as HTMLInputElement).focus()

(Ça, c'est déjà corrigé dans la PR normalement)

Pour les problèmes des lignes 51, 54 et 63 il faut juste caster l'élément HTML
et donc remplacer list.getElementsByClassName("RecipeBox")[i].style par (list.getElementsByClassName("RecipeBox")[i] as HTMLElement).style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants