Browse Source

Every building does not need a rebuild mine method.

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
44743b772b
  1. 11
      src/engine/gameManager/BuildingManager.java
  2. 13
      src/engine/objects/Building.java
  3. 2
      src/engine/workthreads/HourlyJobThread.java

11
src/engine/gameManager/BuildingManager.java

@ -851,4 +851,15 @@ public enum BuildingManager { @@ -851,4 +851,15 @@ public enum BuildingManager {
}
}
public static void rebuildMine(Building mineBuilding) {
mineBuilding.setRank(1);
mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank);
// New rank mean new max hit points.
mineBuilding.healthMax = mineBuilding.getBlueprint().getMaxHealth(mineBuilding.rank);
mineBuilding.setCurrentHitPoints(mineBuilding.healthMax);
mineBuilding.getBounds().setBounds(mineBuilding);
}
}

13
src/engine/objects/Building.java

@ -89,7 +89,7 @@ public class Building extends AbstractWorldObject { @@ -89,7 +89,7 @@ public class Building extends AbstractWorldObject {
private int maxGold;
private int effectFlags = 0;
private String name = "";
private int rank;
public int rank;
private boolean ownerIsNPC = true;
private boolean spireIsActive = false;
private ConcurrentHashMap<String, JobContainer> timers = null;
@ -954,17 +954,6 @@ public class Building extends AbstractWorldObject { @@ -954,17 +954,6 @@ public class Building extends AbstractWorldObject {
}
public final void rebuildMine() {
this.setRank(1);
this.meshUUID = this.getBlueprint().getMeshForRank(this.rank);
// New rank mean new max hit points.
this.healthMax = this.getBlueprint().getMaxHealth(this.rank);
this.setCurrentHitPoints(this.healthMax);
this.getBounds().setBounds(this);
}
public final void refreshGuild() {
UpdateObjectMsg uom = new UpdateObjectMsg(this, 5);

2
src/engine/workthreads/HourlyJobThread.java

@ -163,7 +163,7 @@ public class HourlyJobThread implements Runnable { @@ -163,7 +163,7 @@ public class HourlyJobThread implements Runnable {
mine.nationName = nation.getName();
mine.nationTag = nation.getGuildTag();
mineBuilding.rebuildMine();
BuildingManager.rebuildMine(mineBuilding);
WorldGrid.updateObject(mineBuilding);
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().parent.zoneName + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active.");

Loading…
Cancel
Save