Browse Source

Slots will be derived not stored.

master
MagicBot 2 years ago
parent
commit
225e55d956
  1. 23
      src/engine/db/handlers/dbMobHandler.java
  2. 3
      src/engine/db/handlers/dbNPCHandler.java
  3. 5
      src/engine/objects/Mob.java
  4. 9
      src/engine/objects/NPC.java

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

@ -28,8 +28,8 @@ public class dbMobHandler extends dbHandlerBase { @@ -28,8 +28,8 @@ public class dbMobHandler extends dbHandlerBase {
public Mob ADD_MOB(Mob toAdd)
{
prepareCallable("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
setLong(1, toAdd.getParentZoneID());
prepareCallable("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
setLong(1, toAdd.getParentZoneID());
setInt(2, toAdd.getMobBaseID());
setInt(3, toAdd.getGuildUUID());
setFloat(4, toAdd.getSpawnX());
@ -45,7 +45,6 @@ public class dbMobHandler extends dbHandlerBase { @@ -45,7 +45,6 @@ public class dbMobHandler extends dbHandlerBase {
setInt(11, toAdd.getBuildingID());
setInt(12, toAdd.getLevel());
setString(13, toAdd.getFirstName());
setInt(14, toAdd.slot);
int objectUUID = (int) getUUID();
if (objectUUID > 0)
return GET_MOB(objectUUID);
@ -141,17 +140,6 @@ public class dbMobHandler extends dbHandlerBase { @@ -141,17 +140,6 @@ public class dbMobHandler extends dbHandlerBase {
return getLargeObjectList();
}
public ArrayList<Mob> GET_ALL_MOBS_FOR_BUILDING(int buildingID) {
prepareCallable("SELECT * FROM `obj_mob` WHERE `mob_buildingID` = ?");
setInt(1, buildingID);
return getObjectList();
}
public ArrayList<Mob> GET_ALL_MOBS() {
prepareCallable("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID`;");
return getObjectList();
}
public Mob GET_MOB(final int objectUUID) {
prepareCallable("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?;");
setLong(1, objectUUID);
@ -168,13 +156,6 @@ public class dbMobHandler extends dbHandlerBase { @@ -168,13 +156,6 @@ public class dbMobHandler extends dbHandlerBase {
return executeUpdate();
}
public boolean UPDATE_MOB_BUILDING(int buildingID, int mobID) {
prepareCallable("UPDATE `object` INNER JOIN `obj_mob` On `object`.`UID` = `obj_mob`.`UID` SET `obj_mob`.`mob_buildingID`=? WHERE `obj_mob`.`UID`=?;");
setInt(1, buildingID);
setInt(2, mobID);
return (executeUpdate() > 0);
}
public String SET_PROPERTY(final Mob m, String name, Object new_value) {
prepareCallable("CALL mob_SETPROP(?,?,?)");
setLong(1, m.getObjectUUID());

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

@ -27,7 +27,7 @@ public class dbNPCHandler extends dbHandlerBase { @@ -27,7 +27,7 @@ public class dbNPCHandler extends dbHandlerBase {
}
public NPC ADD_NPC(NPC toAdd, boolean isMob) {
prepareCallable("CALL `npc_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
prepareCallable("CALL `npc_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
setLong(1, toAdd.getParentZoneID());
setString(2, toAdd.getName());
setInt(3, toAdd.getContractID());
@ -43,7 +43,6 @@ public class dbNPCHandler extends dbHandlerBase { @@ -43,7 +43,6 @@ public class dbNPCHandler extends dbHandlerBase {
} else {
setInt(11, 0);
}
setInt(12, toAdd.slot);
int objectUUID = (int) getUUID();
if (objectUUID > 0) {

5
src/engine/objects/Mob.java

@ -36,7 +36,6 @@ import java.sql.SQLException; @@ -36,7 +36,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ -102,8 +101,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -102,8 +101,6 @@ public class Mob extends AbstractIntelligenceAgent {
private DateTime upgradeDateTime = null;
private boolean lootSync = false;
public int slot = -1;
/**
* No Id Constructor
*/
@ -278,8 +275,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -278,8 +275,6 @@ public class Mob extends AbstractIntelligenceAgent {
if (rs.getString("fsm").length() > 1)
this.BehaviourType = MobBehaviourType.valueOf(rs.getString("fsm"));
this.slot = rs.getInt("slot");
} catch (Exception e) {
Logger.error(e + " " + this.dbID );
}

9
src/engine/objects/NPC.java

@ -94,7 +94,6 @@ public class NPC extends AbstractCharacter { @@ -94,7 +94,6 @@ public class NPC extends AbstractCharacter {
private String nameOverride = "";
private int equipmentSetID = 0;
public int runeSetID = 0;
public int slot = -1;
private Regions region = null;
public Vector3fImmutable inBuildingLoc = Vector3fImmutable.ZERO;
@ -224,8 +223,6 @@ public class NPC extends AbstractCharacter { @@ -224,8 +223,6 @@ public class NPC extends AbstractCharacter {
this.statAlt = rs.getFloat("npc_spawnY");
this.statLon = rs.getFloat("npc_spawnZ");
this.slot = rs.getInt("npc_slot");
if (this.contract != null) {
this.symbol = this.contract.getIconID();
this.modTypeTable = this.contract.getNPCModTypeTable();
@ -909,10 +906,7 @@ public class NPC extends AbstractCharacter { @@ -909,10 +906,7 @@ public class NPC extends AbstractCharacter {
BuildingLocation buildingLocation = null;
//-1 slot means no slot available in building.
if (this.slot != -1)
putSlot = this.slot;
else
putSlot = NPC.getBuildingSlot(this);
putSlot = NPC.getBuildingSlot(this);
buildingLocation = buildingModel.getSlotLocation(putSlot);
@ -1556,7 +1550,6 @@ public class NPC extends AbstractCharacter { @@ -1556,7 +1550,6 @@ public class NPC extends AbstractCharacter {
if (!DbManager.NPCQueries.UPDATE_SLOT(npc, slot))
return false;
npc.slot = slot;
return true;
}

Loading…
Cancel
Save