NPC special price option

This commit is contained in:
2025-01-03 07:55:01 -06:00
parent 7b7e1c5337
commit f97991f00d
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -202,12 +202,23 @@ public class dbNPCHandler extends dbHandlerBase {
return result;
}
public static void updateSpecialPricing(final NPC npc){
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
preparedStatement.setInt(1, npc.getSpecialPrice());
preparedStatement.executeUpdate();
} catch (SQLException e) {
Logger.error(e);
}
}
public void updateDatabase(final NPC npc) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET npc_name=?, npc_contractID=?, npc_typeID=?, npc_guildID=?,"
+ " npc_spawnX=?, npc_spawnY=?, npc_spawnZ=?, npc_level=? ,"
+ " npc_buyPercent=?, npc_sellPercent=?, npc_buildingID=?, specialPrice=? WHERE UID = ?")) {
+ " npc_buyPercent=?, npc_sellPercent=?, npc_buildingID=? WHERE UID = ?")) {
preparedStatement.setString(1, npc.getName());
preparedStatement.setInt(2, (npc.getContract() != null) ? npc.getContract().getObjectUUID() : 0);
@@ -221,7 +232,6 @@ public class dbNPCHandler extends dbHandlerBase {
preparedStatement.setFloat(10, npc.getSellPercent());
preparedStatement.setInt(11, (npc.getBuilding() != null) ? npc.getBuilding().getObjectUUID() : 0);
preparedStatement.setInt(12, npc.getDBID());
preparedStatement.setInt(13, npc.getSpecialPrice());
preparedStatement.executeUpdate();
+1 -1
View File
@@ -804,7 +804,7 @@ public class NPC extends AbstractCharacter {
@Override
public void updateDatabase() {
DbManager.NPCQueries.updateDatabase(this);
DbManager.NPCQueries.updateSpecialPricing(this);
}
public int getSymbol() {