From 5529170036d6c218bd685e39ce3d8de222c57794 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 28 Dec 2024 06:48:43 -0600 Subject: [PATCH] bane commander NPC --- .../net/client/msg/VendorDialogMsg.java | 6 +-- src/engine/objects/Contract.java | 47 ++++++++++++++----- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/engine/net/client/msg/VendorDialogMsg.java b/src/engine/net/client/msg/VendorDialogMsg.java index a67b29b8..6448b431 100644 --- a/src/engine/net/client/msg/VendorDialogMsg.java +++ b/src/engine/net/client/msg/VendorDialogMsg.java @@ -121,7 +121,8 @@ public class VendorDialogMsg extends ClientNetMsg { Contract contract = npc.getContract(); if(contract.getContractID() == 1502042){ - vd = Contract.HandleBaneCommanderOptions(msg.unknown03); + vd = Contract.HandleBaneCommanderOptions(msg.unknown03, npc); + msg.updateMessage(3, vd); }else { if (contract == null) @@ -135,13 +136,12 @@ public class VendorDialogMsg extends ClientNetMsg { vd = contract.getVendorDialog(); if (vd == null) vd = VendorDialog.getHostileVendorDialog(); - } if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) { msg.updateMessage(3, vd); } else { if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin)) return; - + } vd = VendorDialog.getVendorDialog(msg.unknown03); msg.updateMessage(3, vd); } diff --git a/src/engine/objects/Contract.java b/src/engine/objects/Contract.java index 2f5b8823..df0b9b10 100644 --- a/src/engine/objects/Contract.java +++ b/src/engine/objects/Contract.java @@ -11,7 +11,9 @@ package engine.objects; import ch.claude_martin.enumbitset.EnumBitSet; import engine.Enum; +import engine.gameManager.BuildingManager; import engine.gameManager.DbManager; +import engine.gameManager.ZoneManager; import org.pmw.tinylog.Logger; import java.sql.ResultSet; @@ -190,18 +192,41 @@ public class Contract extends AbstractGameObject { return this.vendorDialog; } - public static VendorDialog HandleBaneCommanderOptions(int optionId){ - if(optionId == 0) { - VendorDialog vd = VendorDialog.getHostileVendorDialog(); - vd.getOptions().clear(); - MenuOption option1 = new MenuOption(796, "Set Bane Day", 796); - vd.getOptions().add(option1); - MenuOption option2 = new MenuOption(797, "Set Bane Time", 797); - vd.getOptions().add(option2); - return vd; + public static VendorDialog HandleBaneCommanderOptions(int optionId, NPC npc){ + VendorDialog vd; + Building building = npc.building; + Bane bane = null; + if(building != null) + { + City city = ZoneManager.getCityAtLocation(npc.loc); + if(city != null){ + bane = city.getBane(); + } } - - return VendorDialog.getHostileVendorDialog(); + if(bane == null){ + return VendorDialog.getHostileVendorDialog(); + } + switch(optionId){ + default: + vd = VendorDialog.getHostileVendorDialog(); + vd.getOptions().clear(); + MenuOption option1 = new MenuOption(796, "Set Bane Day", 796); + vd.getOptions().add(option1); + MenuOption option2 = new MenuOption(797, "Set Bane Time", 797); + vd.getOptions().add(option2); + break; + case 796: // set bane day + vd = VendorDialog.getHostileVendorDialog(); + vd.getOptions().clear(); + MenuOption dayOption1 = new MenuOption(7961, "Set Bane Day", 796); + vd.getOptions().add(dayOption1); + break; + case 797: // set bane time + vd = VendorDialog.getHostileVendorDialog(); + vd.getOptions().clear(); + break; + } + return vd; } public ArrayList getNPCMenuOptions() {