diff --git a/src/engine/db/handlers/dbNPCHandler.java b/src/engine/db/handlers/dbNPCHandler.java index f762f16b..c0c83a83 100644 --- a/src/engine/db/handlers/dbNPCHandler.java +++ b/src/engine/db/handlers/dbNPCHandler.java @@ -206,6 +206,7 @@ public class dbNPCHandler extends dbHandlerBase { try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) { preparedStatement.setInt(1, npc.getSpecialPrice()); + preparedStatement.setInt(2, npc.getDBID()); preparedStatement.executeUpdate(); diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index a4f49f41..860be8b4 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1683,6 +1683,13 @@ public class ClientMessagePump implements NetMsgHandler { int cost = ((int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getSpecialPrice() * npc.buyPercent))) + (int)(npc.getSpecialPrice() * (max - dur)); + //int pointsToRepair = max - dur; + //int magicValue = toRepair.getMagicValue(); + //if(magicValue == 0) + // magicValue = 1; + //int calculatedValue = toRepair.getDurabilityMax() * magicValue; + //float costPerPoint = (magicValue / max) * ( 1 + npc.buyPercent); + //cost = (int)(pointsToRepair * costPerPoint) + npc.getSpecialPrice(); Building b = (!npc.isStatic()) ? npc.getBuilding() : null; if (b != null) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 772347f4..be456d93 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -1302,7 +1302,7 @@ public class NPC extends AbstractCharacter { public void setSpecialPrice(int specialPrice) { this.specialPrice = specialPrice; - DbManager.NPCQueries.updateDatabase(this); + DbManager.NPCQueries.updateSpecialPricing(this); } public void processUpgradeNPC(PlayerCharacter player) {