Browse Source

more Bonus Code removal.

master
MagicBot 2 years ago
parent
commit
10a6eec3da
  1. 58
      src/engine/objects/Building.java

58
src/engine/objects/Building.java

@ -474,7 +474,8 @@ public class Building extends AbstractWorldObject {
for (Building building : city.getParent().zoneBuildingSet) { for (Building building : city.getParent().zoneBuildingSet) {
//dont add -1 rank buildings. //don't add -1 rank buildings.
if (building.rank <= 0) if (building.rank <= 0)
continue; continue;
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
@ -553,8 +554,6 @@ public class Building extends AbstractWorldObject {
return; return;
} }
// Handling of exploding TOL's
// Must remove a bane before considering destruction of a TOL // Must remove a bane before considering destruction of a TOL
if (bane != null) { if (bane != null) {
@ -673,10 +672,6 @@ public class Building extends AbstractWorldObject {
return this.w; return this.w;
} }
public final void setMeshScale(Vector3f value) {
this.meshScale = value;
}
public final Vector3f getMeshScale() { public final Vector3f getMeshScale() {
return this.meshScale; return this.meshScale;
} }
@ -1049,7 +1044,9 @@ public class Building extends AbstractWorldObject {
public final void rebuildMine(){ public final void rebuildMine(){
this.setRank(1); this.setRank(1);
this.meshUUID = this.getBlueprint().getMeshForRank(this.rank); this.meshUUID = this.getBlueprint().getMeshForRank(this.rank);
// New rank mean new max hitpoints. // New rank mean new max hitpoints.
this.healthMax = this.getBlueprint().getMaxHealth(this.rank); this.healthMax = this.getBlueprint().getMaxHealth(this.rank);
this.setCurrentHitPoints(this.healthMax); this.setCurrentHitPoints(this.healthMax);
this.getBounds().setBounds(this); this.getBounds().setBounds(this);
@ -1077,8 +1074,6 @@ public class Building extends AbstractWorldObject {
// Submit upgrade job if building is currently set to rank. // Submit upgrade job if building is currently set to rank.
try { try {
DbObjectType objectType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerUUID); DbObjectType objectType = DbManager.BuildingQueries.GET_UID_ENUM(this.ownerUUID);
this.ownerIsNPC = (objectType == DbObjectType.NPC); this.ownerIsNPC = (objectType == DbObjectType.NPC);
@ -1142,6 +1137,7 @@ public class Building extends AbstractWorldObject {
//create a new list for children if the building is not a child. children list default is null. //create a new list for children if the building is not a child. children list default is null.
//TODO Remove Furniture/Child buildings from building class and move them into a seperate class. //TODO Remove Furniture/Child buildings from building class and move them into a seperate class.
if (this.parentBuildingID == 0) if (this.parentBuildingID == 0)
this.children = new ArrayList<>(); this.children = new ArrayList<>();
@ -1150,7 +1146,9 @@ public class Building extends AbstractWorldObject {
if (parent != null){ if (parent != null){
parent.children.add(this); parent.children.add(this);
//add furniture to region cache. floor and level are reversed in database, //TODO Fix //add furniture to region cache. floor and level are reversed in database, //TODO Fix
Regions region = BuildingManager.GetRegion(parent, this.level,this.floor, this.getLoc().x, this.getLoc().z); Regions region = BuildingManager.GetRegion(parent, this.level,this.floor, this.getLoc().x, this.getLoc().z);
if (region != null) if (region != null)
Regions.FurnitureRegionMap.put(this.getObjectUUID(), region); Regions.FurnitureRegionMap.put(this.getObjectUUID(), region);
@ -1161,28 +1159,6 @@ public class Building extends AbstractWorldObject {
if (this.upgradeDateTime != null) if (this.upgradeDateTime != null)
BuildingManager.submitUpgradeJob(this); BuildingManager.submitUpgradeJob(this);
// Run Once move buildings
// 64 / -64 to align with pads
// Don't move furniture
/*
if (parentBuildingID != 0)
return;
// Don't move buildings not on a city zone
// or buildings that are in npc owned city
City city = getCity();
if (city == null)
return;
if (city.getIsNpcOwned() == 1)
return;
PullCmd.MoveBuilding(this, null, getLoc().add(new Vector3fImmutable(0, 0, 0)), getParentZone());
*/
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
@ -1196,21 +1172,8 @@ public class Building extends AbstractWorldObject {
else else
newOwnerID = newOwner.getObjectUUID(); newOwnerID = newOwner.getObjectUUID();
// ***BONUS CODE BELOW!
/*
if (newOwner == null) {
this.ownerIsNPC = false;
this.ownerUUID = 0;
} else if (newOwner instanceof PlayerCharacter) {
this.ownerIsNPC = false;
this.ownerUUID = newOwner.getObjectUUID();
} else {
this.ownerIsNPC = true;
this.ownerUUID = newOwner.getObjectUUID();
}
*/
try { try {
// Save new owner to database // Save new owner to database
if (!DbManager.BuildingQueries.updateBuildingOwner(this, newOwnerID)) if (!DbManager.BuildingQueries.updateBuildingOwner(this, newOwnerID))
@ -1316,6 +1279,7 @@ public class Building extends AbstractWorldObject {
// Can't have an invalid door number // Can't have an invalid door number
// Log error? // Log error?
if (doorNumber < 1 || doorNumber > 16) if (doorNumber < 1 || doorNumber > 16)
return false; return false;
@ -1344,10 +1308,6 @@ public class Building extends AbstractWorldObject {
return true; return true;
} }
public int getDoorstate(){
return this.doorState;
}
public void updateEffects() { public void updateEffects() {
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(0x00720063, 1, this.getObjectType().ordinal(), this.getObjectUUID(), this.effectFlags); ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(0x00720063, 1, this.getObjectType().ordinal(), this.getObjectUUID(), this.effectFlags);

Loading…
Cancel
Save