From 8c44e3927540f84dee3986c734b1752ffd376475 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 2 Jan 2025 20:52:14 -0600 Subject: [PATCH] all sages can repair everything --- src/engine/db/handlers/dbContractHandler.java | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/engine/db/handlers/dbContractHandler.java b/src/engine/db/handlers/dbContractHandler.java index 323b349d..bdfc464d 100644 --- a/src/engine/db/handlers/dbContractHandler.java +++ b/src/engine/db/handlers/dbContractHandler.java @@ -98,32 +98,48 @@ public class dbContractHandler extends dbHandlerBase { public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) { - try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) { + if(!contract.getName().contains("Sage")) { + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) { - preparedStatement.setInt(1, contract.getObjectUUID()); + preparedStatement.setInt(1, contract.getObjectUUID()); - ResultSet rs = preparedStatement.executeQuery(); + ResultSet rs = preparedStatement.executeQuery(); - while (rs.next()) { + while (rs.next()) { - int type = rs.getInt("type"); - int value = rs.getInt("value"); - - switch (type) { - case 1: - contract.getBuyItemType().add(value); - break; - case 2: - contract.getBuySkillToken().add(value); - break; - case 3: - contract.getBuyUnknownToken().add(value); - break; + int type = rs.getInt("type"); + int value = rs.getInt("value"); + + switch (type) { + case 1: + contract.getBuyItemType().add(value); + break; + case 2: + contract.getBuySkillToken().add(value); + break; + case 3: + contract.getBuyUnknownToken().add(value); + break; + } } + } catch (SQLException e) { + Logger.error(e); + } + }else{ + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `type` = ?;")) { + + preparedStatement.setInt(1, 2); + + ResultSet rs = preparedStatement.executeQuery(); + + while (rs.next()) { + contract.getBuySkillToken().add(rs.getInt("value")); + } + } catch (SQLException e) { + Logger.error(e); } - } catch (SQLException e) { - Logger.error(e); } }