From df6b9e48d394b99b654529dfc4ca791301db10f1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 21 Aug 2023 13:47:47 -0400 Subject: [PATCH] New npc creation work. --- src/engine/db/handlers/dbNPCHandler.java | 12 ++++++------ src/engine/objects/NPC.java | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/engine/db/handlers/dbNPCHandler.java b/src/engine/db/handlers/dbNPCHandler.java index ad8195c9..81589a01 100644 --- a/src/engine/db/handlers/dbNPCHandler.java +++ b/src/engine/db/handlers/dbNPCHandler.java @@ -38,16 +38,16 @@ public class dbNPCHandler extends dbHandlerBase { try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("CALL `npc_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) { - preparedStatement.setLong(1, toAdd.getParentZoneID()); + preparedStatement.setLong(1, toAdd.parentZoneUUID); preparedStatement.setString(2, toAdd.getName()); - preparedStatement.setInt(3, toAdd.getContractID()); - preparedStatement.setInt(4, toAdd.getGuildUUID()); + preparedStatement.setInt(3, toAdd.contractUUID); + preparedStatement.setInt(4, toAdd.guildUUID); preparedStatement.setFloat(5, toAdd.getSpawnX()); preparedStatement.setFloat(6, toAdd.getSpawnY()); preparedStatement.setFloat(7, toAdd.getSpawnZ()); - preparedStatement.setInt(8, toAdd.getLevel()); - preparedStatement.setFloat(9, toAdd.getBuyPercent()); - preparedStatement.setFloat(10, toAdd.getSellPercent()); + preparedStatement.setInt(8, toAdd.level); + preparedStatement.setFloat(9, toAdd.buyPercent); + preparedStatement.setFloat(10, toAdd.sellPercent); if (toAdd.getBuilding() != null) preparedStatement.setInt(11, toAdd.buildingUUID); diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 36e2af75..a1824628 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -66,8 +66,8 @@ public class NPC extends AbstractCharacter { protected float statLat; protected float statLon; protected float statAlt; - protected float sellPercent; //also train percent - protected float buyPercent; + public float sellPercent; //also train percent + public float buyPercent; protected int vendorID; protected ArrayList modTypeTable; protected ArrayList modSuffixTable; @@ -77,8 +77,8 @@ public class NPC extends AbstractCharacter { protected boolean isStatic = false; private DateTime upgradeDateTime = null; private HashSet canRoll = null; - private int parentZoneID; - private int equipmentSetID = 0; + public int parentZoneUUID; + public int equipmentSetID = 0; private int repairCost = 5; // New NPC constructor. Fill in the blanks and then call @@ -104,7 +104,7 @@ public class NPC extends AbstractCharacter { this.currentID = this.dbID; this.setObjectTypeMask(MBServerStatics.MASK_NPC); this.contractUUID = rs.getInt("npc_contractID"); - this.parentZoneID = rs.getInt("parent"); + this.parentZoneUUID = rs.getInt("parent"); this.gridObjectType = GridObjectType.STATIC; this.equipmentSetID = rs.getInt("equipmentSet"); this.runeSetID = rs.getInt("runeSet"); @@ -468,7 +468,7 @@ public class NPC extends AbstractCharacter { else newNPC.bindLoc = Vector3fImmutable.ZERO; - newNPC.parentZoneID = parent.getObjectUUID(); + newNPC.parentZoneUUID = parent.getObjectUUID(); newNPC.guildUUID = guild.getObjectUUID(); if (building == null) @@ -724,7 +724,7 @@ public class NPC extends AbstractCharacter { return this.parentZone; } - public int getParentZoneID() { + public int getParentZoneUUID() { if (this.parentZone != null) return this.parentZone.getObjectUUID(); @@ -891,7 +891,7 @@ public class NPC extends AbstractCharacter { // Configure parent zone adding this NPC to the // zone collection - this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneID); + this.parentZone = ZoneManager.getZoneByUUID(this.parentZoneUUID); this.parentZone.zoneNPCSet.remove(this); this.parentZone.zoneNPCSet.add(this);