Browse Source

New handlers created

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
34024c9fb4
  1. 17
      src/engine/db/handlers/dbCityHandler.java
  2. 17
      src/engine/db/handlers/dbMobHandler.java
  3. 17
      src/engine/db/handlers/dbNPCHandler.java
  4. 17
      src/engine/db/handlers/dbZoneHandler.java

17
src/engine/db/handlers/dbCityHandler.java

@ -96,6 +96,23 @@ public class dbCityHandler extends dbHandlerBase {
return objectList; return objectList;
} }
public ArrayList<City> GET_ALL_CITIES() {
ArrayList<City> cityList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
cityList = getObjectsFromRs(rs, 100);
} catch (SQLException e) {
Logger.error(e);
}
return cityList;
}
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) { public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
ArrayList<City> cityList = new ArrayList<>(); ArrayList<City> cityList = new ArrayList<>();

17
src/engine/db/handlers/dbMobHandler.java

@ -65,6 +65,23 @@ public class dbMobHandler extends dbHandlerBase {
return mobile; return mobile;
} }
public ArrayList<Mob> GET_ALL_MOBS() {
ArrayList<Mob> mobileList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
mobileList = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
return mobileList;
}
public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) { public boolean updateUpgradeTime(Mob mob, DateTime upgradeDateTime) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();

17
src/engine/db/handlers/dbNPCHandler.java

@ -94,6 +94,23 @@ public class dbNPCHandler extends dbHandlerBase {
return row_count; return row_count;
} }
public ArrayList<NPC> GET_ALL_NPCS() {
ArrayList<NPC> npcList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_npc`.*, `object`.`parent` FROM `object` INNER JOIN `obj_npc` ON `obj_npc`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
npcList = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
return npcList;
}
public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) { public ArrayList<NPC> GET_ALL_NPCS_FOR_ZONE(Zone zone) {
ArrayList<NPC> npcList = new ArrayList<>(); ArrayList<NPC> npcList = new ArrayList<>();

17
src/engine/db/handlers/dbZoneHandler.java

@ -27,6 +27,23 @@ public class dbZoneHandler extends dbHandlerBase {
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
} }
public ArrayList<Zone> GET_ALL_ZONES() {
ArrayList<Zone> zoneList = new ArrayList<>();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` ORDER BY `object`.`UID` ASC;")) {
ResultSet rs = preparedStatement.executeQuery();
zoneList = getObjectsFromRs(rs, 2000);
} catch (SQLException e) {
Logger.error(e);
}
return zoneList;
}
public ArrayList<Zone> GET_ALL_NODES(Zone zone) { public ArrayList<Zone> GET_ALL_NODES(Zone zone) {
ArrayList<Zone> wsmList = new ArrayList<>(); ArrayList<Zone> wsmList = new ArrayList<>();
wsmList.addAll(zone.getNodes()); wsmList.addAll(zone.getNodes());

Loading…
Cancel
Save