Browse Source

bane commander NPC

lakebane2
FatBoy-DOTC 3 weeks ago
parent
commit
5529170036
  1. 6
      src/engine/net/client/msg/VendorDialogMsg.java
  2. 47
      src/engine/objects/Contract.java

6
src/engine/net/client/msg/VendorDialogMsg.java

@ -121,7 +121,8 @@ public class VendorDialogMsg extends ClientNetMsg {
Contract contract = npc.getContract(); Contract contract = npc.getContract();
if(contract.getContractID() == 1502042){ if(contract.getContractID() == 1502042){
vd = Contract.HandleBaneCommanderOptions(msg.unknown03); vd = Contract.HandleBaneCommanderOptions(msg.unknown03, npc);
msg.updateMessage(3, vd);
}else { }else {
if (contract == null) if (contract == null)
@ -135,13 +136,12 @@ public class VendorDialogMsg extends ClientNetMsg {
vd = contract.getVendorDialog(); vd = contract.getVendorDialog();
if (vd == null) if (vd == null)
vd = VendorDialog.getHostileVendorDialog(); vd = VendorDialog.getHostileVendorDialog();
}
if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) { if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) {
msg.updateMessage(3, vd); msg.updateMessage(3, vd);
} else { } else {
if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin)) if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin))
return; return;
}
vd = VendorDialog.getVendorDialog(msg.unknown03); vd = VendorDialog.getVendorDialog(msg.unknown03);
msg.updateMessage(3, vd); msg.updateMessage(3, vd);
} }

47
src/engine/objects/Contract.java

@ -11,7 +11,9 @@ package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet; import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum; import engine.Enum;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -190,18 +192,41 @@ public class Contract extends AbstractGameObject {
return this.vendorDialog; return this.vendorDialog;
} }
public static VendorDialog HandleBaneCommanderOptions(int optionId){ public static VendorDialog HandleBaneCommanderOptions(int optionId, NPC npc){
if(optionId == 0) { VendorDialog vd;
VendorDialog vd = VendorDialog.getHostileVendorDialog(); Building building = npc.building;
vd.getOptions().clear(); Bane bane = null;
MenuOption option1 = new MenuOption(796, "Set Bane Day", 796); if(building != null)
vd.getOptions().add(option1); {
MenuOption option2 = new MenuOption(797, "Set Bane Time", 797); City city = ZoneManager.getCityAtLocation(npc.loc);
vd.getOptions().add(option2); if(city != null){
return vd; bane = city.getBane();
}
} }
if(bane == null){
return VendorDialog.getHostileVendorDialog(); 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<Integer> getNPCMenuOptions() { public ArrayList<Integer> getNPCMenuOptions() {

Loading…
Cancel
Save