fully implement cheat menu

This commit is contained in:
Sen 2025-07-01 01:29:46 +02:00
parent 0171d81724
commit 8d6957d6e1
Signed by: sen
GPG key ID: 3AC50A6F47D1B722

View file

@ -159,9 +159,9 @@ public abstract class GuiContainer extends Gui
this.gm.player.openContainer = this.inventorySlots;
if(this.gm.itemCheat) {
this.cheatX = this.container_x + this.container_w + 4;
this.cheatY = 20;
this.cheatWidth = Math.max((this.gm.fb_x - this.container_x - this.container_w - 32) / 18, 1);
this.cheatHeight = Math.max((this.gm.fb_y - 20 * 2 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 64) / 18, 1);
this.cheatY = 16;
this.cheatWidth = Math.max((this.gm.fb_x - this.container_x - this.container_w - 16) / 18, 1);
this.cheatHeight = Math.max((this.gm.fb_y - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 100) / 18, 1);
}
}
@ -174,8 +174,8 @@ public abstract class GuiContainer extends Gui
}
if(this.gm.itemCheat) {
this.cheatLabel = this.add(new Label(this.cheatX, this.cheatY, this.cheatWidth * 18, "", true));
this.cheatDesc = this.add(new MultiLabel(this.cheatX, this.cheatY + this.cheatHeight * 18, this.cheatWidth * 18, 60, "Vorsicht: Schummeln wird mit Keule bestraft\n(Halte Strg beim Klick für vollen Stapel)"));
this.cheatSearch = this.add(new Field(this.cheatX, this.gm.fb_y - Element.BASE_HEIGHT - 32, this.cheatWidth * 18, 0, 128, null, ""));
this.cheatDesc = this.add(new MultiLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 60, "Vorsicht: Schummeln wird\nmit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)"));
this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18, 0, 128, null, ""));
this.cheatLast = "";
for(CheatTab tab : CheatTab.values()) {
this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18));
@ -255,10 +255,10 @@ public abstract class GuiContainer extends Gui
return;
if(this.gm.itemCheat) {
boolean flag = Button.MOUSE_LEFT.isDown(); //TODO: remove?
int x1 = this.cheatX + this.cheatWidth * 18 + 1;
int y1 = this.cheatY + 1;
int x2 = x1 + 10;
int y2 = y1 + 112 + 18 * 4;
int x1 = this.cheatX + this.cheatWidth * 18 + 2;
int y1 = this.cheatY;
int x2 = x1 + 8;
int y2 = y1 + this.cheatHeight * 18;
if (!this.wasClicking && flag && this.gm.mouse_x >= x1 && this.gm.mouse_y >= y1 && this.gm.mouse_x < x2 && this.gm.mouse_y < y2)
{
@ -397,11 +397,11 @@ public abstract class GuiContainer extends Gui
super.draw();
if(this.gm.itemCheat) {
if(this.needsScrollBars()) {
int x1 = this.cheatX + this.cheatWidth * 18 + 1;
int y1 = this.cheatY + 1;
int y2 = y1 + 184;
Drawing.drawRect(x1, y1, 8, 182, 0xff000000);
Drawing.drawGradient(x1, y1 + (int)((float)(y2 - y1 - 17) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm);
int x1 = this.cheatX + this.cheatWidth * 18 + 2;
int y1 = this.cheatY;
int y2 = y1 + this.cheatHeight * 18;
Drawing.drawRect(x1, y1, 8, this.cheatHeight * 18, 0xff000000);
Drawing.drawGradient(x1, y1 + (int)((float)(y2 - y1 - 15) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm);
}
Drawing.drawRect(this.cheatX + 18 * (selectedTab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (selectedTab.getIndex() / this.cheatWidth) - 2, 18, 2, 0xffffffff);
}