Browse Source

Cleanup of logic.

master
MagicBot 2 years ago
parent
commit
0f2ca3e62e
  1. 32
      src/engine/objects/Mine.java

32
src/engine/objects/Mine.java

@ -7,9 +7,6 @@ @@ -7,9 +7,6 @@
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
@ -29,19 +26,18 @@ import engine.gameManager.*; @@ -29,19 +26,18 @@ import engine.gameManager.*;
import engine.net.ByteBufferWriter;
import engine.net.client.msg.ErrorPopupMsg;
import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
import engine.session.SessionID;
import org.pmw.tinylog.Logger;
import java.net.UnknownHostException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import static engine.gameManager.DbManager.*;
import static engine.gameManager.DbManager.MineQueries;
import static engine.gameManager.DbManager.getObject;
import static engine.math.FastMath.sqr;
public class Mine extends AbstractGameObject {
@ -64,9 +60,6 @@ public class Mine extends AbstractGameObject { @@ -64,9 +60,6 @@ public class Mine extends AbstractGameObject {
//flags 1: never been claimed (make active).
// Not persisted to DB
private String guildName;
private GuildTag guildTag;
@ -481,11 +474,19 @@ try{ @@ -481,11 +474,19 @@ try{
//never knocked down, let's just move on.
//hasn't been claimed since server start.
this.setActive(false);
this.lastClaimerSessionID = null;
this.lastClaimer = null;
return true;
}
if (!validClaimer(this.lastClaimer))
// This mine does not have a valid claimer
// we will therefore set it to errant
if (!validClaimer(this.lastClaimer)) {
this.lastClaimerSessionID = null;
this.lastClaimer = null;
return false;
}
if (this.owningGuild == null || this.owningGuild.isErrant() || this.owningGuild.getNation().isErrant())
return false;
@ -500,14 +501,6 @@ try{ @@ -500,14 +501,6 @@ try{
setLastChange(System.currentTimeMillis());
if (mineBuilding.getRank() < 1){
if (this.lastClaimer == null){
this.lastClaimerSessionID = null;
updateGuildOwner(null);
return false;
}
mineBuilding.rebuildMine();
WorldGrid.updateObject(mineBuilding);
ChatManager.chatSystemChannel(this.lastClaimer.getName() + " has claimed the mine in " + this.parentZone.getParent().getName() + " for " + this.owningGuild.getName() + ". The mine is no longer active.");
@ -517,10 +510,7 @@ try{ @@ -517,10 +510,7 @@ try{
MineRecord mineRecord = MineRecord.borrow(this, this.lastClaimer, Enum.RecordEventType.CAPTURE);
DataWarehouse.pushToWarehouse(mineRecord);
}else{
mineBuilding.setRank(mineBuilding.getRank());
}
this.setActive(false);
return true;
}

Loading…
Cancel
Save