Browse Source

Slots will be derived not stored.

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

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

@ -28,7 +28,7 @@ public class dbMobHandler extends dbHandlerBase {
public Mob ADD_MOB(Mob toAdd) public Mob ADD_MOB(Mob toAdd)
{ {
prepareCallable("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); prepareCallable("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
setLong(1, toAdd.getParentZoneID()); setLong(1, toAdd.getParentZoneID());
setInt(2, toAdd.getMobBaseID()); setInt(2, toAdd.getMobBaseID());
setInt(3, toAdd.getGuildUUID()); setInt(3, toAdd.getGuildUUID());
@ -45,7 +45,6 @@ public class dbMobHandler extends dbHandlerBase {
setInt(11, toAdd.getBuildingID()); setInt(11, toAdd.getBuildingID());
setInt(12, toAdd.getLevel()); setInt(12, toAdd.getLevel());
setString(13, toAdd.getFirstName()); setString(13, toAdd.getFirstName());
setInt(14, toAdd.slot);
int objectUUID = (int) getUUID(); int objectUUID = (int) getUUID();
if (objectUUID > 0) if (objectUUID > 0)
return GET_MOB(objectUUID); return GET_MOB(objectUUID);
@ -141,17 +140,6 @@ public class dbMobHandler extends dbHandlerBase {
return getLargeObjectList(); 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) { 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` = ?;"); prepareCallable("SELECT `obj_mob`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mob` ON `obj_mob`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?;");
setLong(1, objectUUID); setLong(1, objectUUID);
@ -168,13 +156,6 @@ public class dbMobHandler extends dbHandlerBase {
return executeUpdate(); 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) { public String SET_PROPERTY(final Mob m, String name, Object new_value) {
prepareCallable("CALL mob_SETPROP(?,?,?)"); prepareCallable("CALL mob_SETPROP(?,?,?)");
setLong(1, m.getObjectUUID()); setLong(1, m.getObjectUUID());

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

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

5
src/engine/objects/Mob.java

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

7
src/engine/objects/NPC.java

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

Loading…
Cancel
Save