NPC special price option
This commit is contained in:
@@ -206,6 +206,7 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
||||||
preparedStatement.setInt(1, npc.getSpecialPrice());
|
preparedStatement.setInt(1, npc.getSpecialPrice());
|
||||||
|
preparedStatement.setInt(2, npc.getDBID());
|
||||||
|
|
||||||
preparedStatement.executeUpdate();
|
preparedStatement.executeUpdate();
|
||||||
|
|
||||||
|
|||||||
@@ -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 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;
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||||
|
|
||||||
if (b != null)
|
if (b != null)
|
||||||
|
|||||||
@@ -1302,7 +1302,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
public void setSpecialPrice(int specialPrice) {
|
public void setSpecialPrice(int specialPrice) {
|
||||||
this.specialPrice = specialPrice;
|
this.specialPrice = specialPrice;
|
||||||
DbManager.NPCQueries.updateDatabase(this);
|
DbManager.NPCQueries.updateSpecialPricing(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processUpgradeNPC(PlayerCharacter player) {
|
public void processUpgradeNPC(PlayerCharacter player) {
|
||||||
|
|||||||
Reference in New Issue
Block a user