Browse Source

Populate new column in table.

combat-2
MagicBot 9 months ago
parent
commit
58fb2a9b90
  1. 19
      src/engine/db/handlers/dbContractHandler.java
  2. 2
      src/engine/objects/Contract.java
  3. 12
      src/engine/server/world/WorldServer.java

19
src/engine/db/handlers/dbContractHandler.java

@ -20,6 +20,7 @@ import java.sql.Connection; @@ -20,6 +20,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class dbContractHandler extends dbHandlerBase {
@ -28,6 +29,24 @@ public class dbContractHandler extends dbHandlerBase { @@ -28,6 +29,24 @@ public class dbContractHandler extends dbHandlerBase {
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public void UPDATE_CONTRACTS() {
ArrayList<Contract> contracts = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract`;")) {
ResultSet rs = preparedStatement.executeQuery();
contracts = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
for (Contract contract : contracts)
DbManager.ContractQueries.updateAllowedBuildings(contract);
}
public Contract GET_CONTRACT(final int objectUUID) {
Contract contract = (Contract) DbManager.getFromCache(mbEnums.GameObjectType.Contract, objectUUID);

2
src/engine/objects/Contract.java

@ -89,8 +89,6 @@ public class Contract extends AbstractGameObject { @@ -89,8 +89,6 @@ public class Contract extends AbstractGameObject {
this.equipmentSet = rs.getInt("equipSetID");
this.inventorySet = rs.getInt("inventorySet");
DbManager.ContractQueries.updateAllowedBuildings(this);
try {
String menuoptions = rs.getString("menuoptions");

12
src/engine/server/world/WorldServer.java

@ -9,10 +9,6 @@ @@ -9,10 +9,6 @@
package engine.server.world;
import engine.mbEnums;
import engine.mbEnums.DispatchChannel;
import engine.mbEnums.MinionType;
import engine.mbEnums.SupportMsgType;
import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid;
import engine.db.archive.DataWarehouse;
@ -23,6 +19,10 @@ import engine.gameManager.*; @@ -23,6 +19,10 @@ import engine.gameManager.*;
import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.LogoutCharacterJob;
import engine.mbEnums;
import engine.mbEnums.DispatchChannel;
import engine.mbEnums.MinionType;
import engine.mbEnums.SupportMsgType;
import engine.mobileAI.Threads.MobAIThread;
import engine.mobileAI.Threads.Respawner;
import engine.net.DispatchMessage;
@ -455,6 +455,10 @@ public class WorldServer { @@ -455,6 +455,10 @@ public class WorldServer {
Logger.info("Starting Mob Respawn Thread");
Respawner.start();
// Update contract field
Logger.info("Starting Mob Respawn Thread");
DbManager.ContractQueries.UPDATE_CONTRACTS();
// Run maintenance
MaintenanceManager.dailyMaintenance();

Loading…
Cancel
Save