Conversation
Idée : 🏋🫖☠prixe#1
Kedaostram
left a comment
There was a problem hiding this comment.
Hello, quelques remarques pour essayer de rendre le code moins répétitif, et enlever les choses inutiles !
| private Zaap; | ||
| private DivList = [] |
There was a problem hiding this comment.
Merci pour t'est commentaire,
tu as recrée un compte Discord ? si oui mp KeyTur#4671
There was a problem hiding this comment.
ok tu me dira si tu revien dessus,
On a crée un discord privé pour l'instant
| private getZaap(e){ | ||
| const Zaap = this.wGame.gui.windowsContainer.getChildren().find(e=>e.id=="teleporterList") | ||
| const ZaapList = Zaap.zaapBody.panelCollection.Zaap.table.content._childrenList | ||
| const PrismList = Zaap.zaapBody.panelCollection.Prism.table.content._childrenList | ||
| for (var i = 0; i < ZaapList.length - 1; i++) { | ||
| this.DivList.push(ZaapList[i].rootElement) | ||
| } | ||
| for (var i = 0; i < PrismList.length - 1; i++) { | ||
| this.DivList.push(PrismList[i].rootElement) | ||
| } | ||
| this.DivList.forEach(element => { | ||
| element.addEventListener('dblclick', () => { Zaap.windowBody._childrenList.find(e => e.rootElement?.classList?.contains('footer'))._childrenList[0].tap(); }) | ||
| }) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| private getZaapiPrism(e){ | ||
| const Zaapi = this.wGame.gui.windowsContainer.getChildren().find(e=>e.id=="teleporterList") | ||
| const ZaapiListC = Zaapi.subwayBody.panelCollection.CraftHouse.table.content._childrenList | ||
| const ZaapiListB = Zaapi.subwayBody.panelCollection.BidHouse.table.content._childrenList | ||
| const ZaapiListM = Zaapi.subwayBody.panelCollection.Misc.table.content._childrenList | ||
| if(e.teleporterType === 1){ | ||
| for (var i = 0; i < ZaapiListC.length - 1; i++) { | ||
| this.DivList.push(ZaapiListC[i].rootElement) | ||
| } | ||
| for (var i = 0; i < ZaapiListB.length - 1; i++) { | ||
| this.DivList.push(ZaapiListB[i].rootElement) | ||
| } | ||
| for (var i = 0; i < ZaapiListM.length - 1; i++) { | ||
| this.DivList.push(ZaapiListM[i].rootElement) | ||
| } | ||
| this.DivList.forEach(element => { | ||
| element.addEventListener('dblclick', () => { Zaapi.windowBody._childrenList.find(e => e.rootElement?.classList?.contains('footer'))._childrenList[0].tap(); }) | ||
| }) | ||
| } | ||
|
|
||
|
|
||
| } |
There was a problem hiding this comment.
Tu peux fusionner tes fonctions getZaapiPrism() et getZaap() en 1 seule avec une simple condition if/else
if (e.teleporterType == 1) {
// Craft/Bid/Misc
} else {
// Zaap/Zaapi
}Cette fonction ainsi créée peut retourner directement la liste des zaap, et t'as plus qu'à boucler dessus.
| this.DivList.push(PrismList[i].rootElement) | ||
| } | ||
| this.DivList.forEach(element => { | ||
| element.addEventListener('dblclick', () => { Zaap.windowBody._childrenList.find(e => e.rootElement?.classList?.contains('footer'))._childrenList[0].tap(); }) |
There was a problem hiding this comment.
Tu devrais ajouter un délai entre le double clic et le OK, histoire de pas le faire instantanément.
Idée : 🏋🫖☠#1
Script fonctionelle mais si vous avez des idées d'optimisation ( Keda 😶) ca sera pas plus mal