Add Auctioneer role to NPC GUI and connect auction system

- Add Auctioneer to role dropdown in GuiNpcAdvanced
- Create GuiNpcAuctioneer setup GUI for configuring:
  - Tab visibility (browse, my listings, my bids, claims)
  - Player actions (create, bid, buyout)
  - Custom welcome/disabled messages
- Add PlayerAuction container handler in CommonProxy
- Add PlayerAuction GUI handler in ClientProxy
- Add all role.auctioneer lang keys to en_US.lang
This commit is contained in:
Claude committed 2026-01-04 20:37:00 +00:00
1 parent 7b42ad7796
commit e7f6177be8
5 files changed
+170 -1

No files matched your search

@@ -15,6 +15,7 @@ import noppes.npcs.api.IWorld;
import noppes.npcs.blocks.tiles.TileNpcContainer;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.ContainerAnvilRepair;
import noppes.npcs.containers.ContainerAuction;
import noppes.npcs.containers.ContainerCarpentryBench;
import noppes.npcs.containers.ContainerCrate;
import noppes.npcs.containers.ContainerCustomGui;
@@ -131,6 +132,9 @@ public class CommonProxy implements IGuiHandler {
if (gui == EnumGuiType.CompanionInv)
return new ContainerNPCCompanion(npc, player);
if (gui == EnumGuiType.PlayerAuction)
return new ContainerAuction(npc, player);
return null;
}
@@ -104,6 +104,7 @@ import noppes.npcs.client.gui.player.GuiCrate;
import noppes.npcs.client.gui.player.GuiMailbox;
import noppes.npcs.client.gui.player.GuiMailmanWrite;
import noppes.npcs.client.gui.player.GuiNPCBankChest;
import noppes.npcs.client.gui.player.GuiAuction;
import noppes.npcs.client.gui.player.GuiNPCTrader;
import noppes.npcs.client.gui.player.GuiNpcAnvil;
import noppes.npcs.client.gui.player.GuiNpcCarpentryBench;
@@ -177,6 +178,7 @@ import noppes.npcs.config.ConfigMain;
import noppes.npcs.config.StringCache;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.ContainerAnvilRepair;
import noppes.npcs.containers.ContainerAuction;
import noppes.npcs.containers.ContainerCarpentryBench;
import noppes.npcs.containers.ContainerCrate;
import noppes.npcs.containers.ContainerCustomGui;
@@ -568,6 +570,9 @@ public class ClientProxy extends CommonProxy {
else if (gui == EnumGuiType.MagicBook)
return new GuiNpcMagicBook();
else if (gui == EnumGuiType.PlayerAuction)
return new GuiAuction(npc, (ContainerAuction) container);
else if (gui == EnumGuiType.GlobalRemote)
return new GuiNPCGlobalMainMenu(null);
@@ -25,6 +25,7 @@ import noppes.npcs.client.gui.roles.GuiNpcFollowerJob;
import noppes.npcs.client.gui.roles.GuiNpcGuard;
import noppes.npcs.client.gui.roles.GuiNpcHealer;
import noppes.npcs.client.gui.roles.GuiNpcSpawner;
import noppes.npcs.client.gui.roles.GuiNpcAuctioneer;
import noppes.npcs.client.gui.roles.GuiNpcMount;
import noppes.npcs.client.gui.roles.GuiNpcTransporter;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
@@ -48,7 +49,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData {
super.initGui();
int y = guiTop + 10;
this.addButton(new GuiNpcButton(3, guiLeft + 85 + 160, y, 52, 20, "selectServer.edit"));
this.addButton(new GuiNpcButton(8, guiLeft + 85, y, 155, 20, new String[]{"role.none", "role.trader", "role.follower", "role.bank", "role.transporter", "role.mailman", NoppesStringUtils.translate("role.companion", "(WIP)"), "role.mount"}, npc.advanced.role.ordinal()));
this.addButton(new GuiNpcButton(8, guiLeft + 85, y, 155, 20, new String[]{"role.none", "role.trader", "role.follower", "role.bank", "role.transporter", "role.mailman", NoppesStringUtils.translate("role.companion", "(WIP)"), "role.mount", "role.auctioneer"}, npc.advanced.role.ordinal()));
getButton(3).setEnabled(npc.advanced.role != EnumRoleType.None && npc.advanced.role != EnumRoleType.Postman);
this.addButton(new GuiNpcButton(4, guiLeft + 85 + 160, y += 22, 52, 20, "selectServer.edit"));
@@ -151,6 +152,8 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData {
displayGuiScreen(new GuiNpcCompanion(npc));
else if (npc.advanced.role == EnumRoleType.Mount)
displayGuiScreen(new GuiNpcMount(npc));
else if (npc.advanced.role == EnumRoleType.Auctioneer)
displayGuiScreen(new GuiNpcAuctioneer(npc));
} else if (compound.hasKey("JobData")) {
if (npc.jobInterface != null)
npc.jobInterface.readFromNBT(compound);
@@ -0,0 +1,144 @@
package noppes.npcs.client.gui.roles;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleAuctioneer;
public class GuiNpcAuctioneer extends GuiNPCInterface2 implements ITextfieldListener {
private final RoleAuctioneer role;
public GuiNpcAuctioneer(EntityNPCInterface npc) {
super(npc);
this.role = npc.roleInterface instanceof RoleAuctioneer ? (RoleAuctioneer) npc.roleInterface : null;
}
@Override
public void initGui() {
super.initGui();
if (role == null) {
close();
return;
}
int y = guiTop + 10;
// Left column - Tab visibility
addLabel(new GuiNpcLabel(0, "role.auctioneer.tabs", guiLeft + 10, y, 0x404040));
y += 18;
addLabel(new GuiNpcLabel(1, "role.auctioneer.showBrowse", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(1, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.showActiveListings ? 1 : 0));
y += 22;
addLabel(new GuiNpcLabel(2, "role.auctioneer.showMyListings", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(2, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.showMyListings ? 1 : 0));
y += 22;
addLabel(new GuiNpcLabel(3, "role.auctioneer.showMyBids", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(3, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.showMyBids ? 1 : 0));
y += 22;
addLabel(new GuiNpcLabel(4, "role.auctioneer.showClaims", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(4, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.showClaims ? 1 : 0));
y += 30;
// Actions
addLabel(new GuiNpcLabel(10, "role.auctioneer.actions", guiLeft + 10, y, 0x404040));
y += 18;
addLabel(new GuiNpcLabel(11, "role.auctioneer.allowCreate", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(11, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.allowCreatingListings ? 1 : 0));
y += 22;
addLabel(new GuiNpcLabel(12, "role.auctioneer.allowBid", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(12, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.allowBidding ? 1 : 0));
y += 22;
addLabel(new GuiNpcLabel(13, "role.auctioneer.allowBuyout", guiLeft + 10, y + 5, 0x404040));
addButton(new GuiNpcButton(13, guiLeft + 140, y, 50, 20, new String[]{"gui.no", "gui.yes"}, role.allowBuyout ? 1 : 0));
// Right column - Messages
int rightX = guiLeft + 210;
int rightY = guiTop + 10;
addLabel(new GuiNpcLabel(20, "role.auctioneer.messages", rightX, rightY, 0x404040));
rightY += 18;
addLabel(new GuiNpcLabel(21, "role.auctioneer.welcome", rightX, rightY + 5, 0x404040));
rightY += 18;
GuiNpcTextField welcomeField = new GuiNpcTextField(21, this, rightX, rightY, 180, 20, role.welcomeMessage);
welcomeField.setMaxStringLength(200);
addTextField(welcomeField);
rightY += 28;
addLabel(new GuiNpcLabel(22, "role.auctioneer.noAuction", rightX, rightY + 5, 0x404040));
rightY += 18;
GuiNpcTextField noAuctionField = new GuiNpcTextField(22, this, rightX, rightY, 180, 20, role.noAuctionMessage);
noAuctionField.setMaxStringLength(200);
addTextField(noAuctionField);
}
@Override
public void buttonEvent(GuiButton guibutton) {
if (role == null) return;
if (guibutton instanceof GuiNpcButton) {
GuiNpcButton button = (GuiNpcButton) guibutton;
boolean value = button.getValue() == 1;
switch (button.id) {
case 1:
role.showActiveListings = value;
break;
case 2:
role.showMyListings = value;
break;
case 3:
role.showMyBids = value;
break;
case 4:
role.showClaims = value;
break;
case 11:
role.allowCreatingListings = value;
break;
case 12:
role.allowBidding = value;
break;
case 13:
role.allowBuyout = value;
break;
}
}
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if (role == null) return;
switch (textfield.id) {
case 21:
role.welcomeMessage = textfield.getText();
break;
case 22:
role.noAuctionMessage = textfield.getText();
break;
}
}
@Override
public void save() {
if (role != null) {
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
}
}
}