Browse Source

Name is all that's needed.

combat-2
MagicBot 1 year ago
parent
commit
57ff1ede97
  1. 15
      src/engine/db/handlers/dbMobHandler.java
  2. 4
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java

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

@ -127,15 +127,13 @@ public class dbMobHandler extends dbHandlerBase { @@ -127,15 +127,13 @@ public class dbMobHandler extends dbHandlerBase {
}
}
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
public boolean ADD_TO_GUARDS(final long captainUID, final String name) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `name`) VALUES (?,?)")) {
preparedStatement.setLong(1, captainUID);
preparedStatement.setInt(2, mobBaseID);
preparedStatement.setString(3, name);
preparedStatement.setInt(4, slot);
preparedStatement.setString(2, name);
return (preparedStatement.executeUpdate() > 0);
@ -145,14 +143,13 @@ public class dbMobHandler extends dbHandlerBase { @@ -145,14 +143,13 @@ public class dbMobHandler extends dbHandlerBase {
}
}
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
public boolean REMOVE_FROM_GUARDS(final long captainUID, final String minionName) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
preparedStatement.setLong(1, captainUID);
preparedStatement.setInt(2, mobBaseID);
preparedStatement.setInt(3, slot);
preparedStatement.setString(2, minionName);
return (preparedStatement.executeUpdate() > 0);

4
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -182,7 +182,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -182,7 +182,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (!npc.getSiegeMinionMap().containsKey(toRemove))
return true;
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.firstName))
return true;
npc.getSiegeMinionMap().remove(toRemove);
@ -273,7 +273,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -273,7 +273,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (toCreate == null)
return true;
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size()))
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), pirateName))
return true;
if (toCreate != null) {

Loading…
Cancel
Save