|
|
|
@ -202,12 +202,23 @@ public class dbNPCHandler extends dbHandlerBase {
@@ -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 {
@@ -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(); |
|
|
|
|
|
|
|
|
|