@ -53,8 +53,9 @@ public class Mine extends AbstractGameObject {
private float longitude ;
private float longitude ;
private float altitude ;
private float altitude ;
private Guild owningGuild ;
private Guild owningGuild ;
private int lastClaimerID ;
private PlayerCharacter lastClaimer ;
private SessionID lastClaimerSessionID ;
private SessionID lastClaimerSessionID ;
private int flags ;
private int flags ;
private int buildingID ;
private int buildingID ;
private Zone parentZone ;
private Zone parentZone ;
@ -107,8 +108,6 @@ public class Mine extends AbstractGameObject {
this . zoneName = "Unknown Mine" ;
this . zoneName = "Unknown Mine" ;
}
}
this . owningGuild = Guild . getGuild ( ownerUID ) ;
this . owningGuild = Guild . getGuild ( ownerUID ) ;
Guild nation = null ;
Guild nation = null ;
if ( this . owningGuild ! = null & & ! this . owningGuild . isErrant ( ) ) {
if ( this . owningGuild ! = null & & ! this . owningGuild . isErrant ( ) ) {
@ -122,19 +121,17 @@ public class Mine extends AbstractGameObject {
this . owningGuild = Guild . getErrantGuild ( ) ;
this . owningGuild = Guild . getErrantGuild ( ) ;
}
}
if ( ! nation . isErrant ( ) ) {
if ( ! nation . isErrant ( ) ) {
this . nationName = nation . getName ( ) ;
this . nationName = nation . getName ( ) ;
this . nationTag = nation . getGuildTag ( ) ;
this . nationTag = nation . getGuildTag ( ) ;
} else {
} else {
this . nationName = "" ;
this . nationName = "" ;
this . nationTag = GuildTag . ERRANT ;
this . nationTag = GuildTag . ERRANT ;
}
}
this . setActive ( false ) ;
this . setActive ( false ) ;
this . production = Resource . valueOf ( rs . getString ( "mine_resource" ) ) ;
this . production = Resource . valueOf ( rs . getString ( "mine_resource" ) ) ;
this . lastClaimerID = 0 ;
this . lastClaimerSessionID = null ;
this . lastClaimerSessionID = null ;
}
}
@ -371,13 +368,6 @@ try{
public void handleStartMineWindow ( ) {
public void handleStartMineWindow ( ) {
// Do not open errant mines until after woo
// if ((this.getOwningGuild() == null) &&
// (this.getOpenDate().isAfter(DateTime.now())))
// return;
this . lastClaimerID = 0 ;
this . setActive ( true ) ;
this . setActive ( true ) ;
ChatManager . chatSystemChannel ( this . zoneName + "'s Mine is now Active!" ) ;
ChatManager . chatSystemChannel ( this . zoneName + "'s Mine is now Active!" ) ;
Logger . info ( this . zoneName + "'s Mine is now Active!" ) ;
Logger . info ( this . zoneName + "'s Mine is now Active!" ) ;
@ -490,24 +480,13 @@ try{
if ( mineBuilding . getRank ( ) > 0 ) {
if ( mineBuilding . getRank ( ) > 0 ) {
//never knocked down, let's just move on.
//never knocked down, let's just move on.
//hasn't been claimed since server start.
//hasn't been claimed since server start.
if ( this . lastClaimerID = = 0 & & ( this . owningGuild = = null | | this . owningGuild . isErrant ( ) ) )
return false ;
this . setActive ( false ) ;
this . setActive ( false ) ;
return true ;
return true ;
}
}
PlayerCharacter claimer = PlayerCharacter . getFromCache ( this . lastClaimerID ) ;
if ( ! validClaimer ( this . lastClaimer ) )
if ( ! validClaimer ( claimer ) )
return false ;
return false ;
// //verify the player hasn't logged out since claim
// if (SessionManager.getSession(claimer) == null)
// return false;
// if (!SessionManager.getSession(claimer).getSessionID().equals(this.lastClaimerSessionID))
// return false;
if ( this . owningGuild = = null | | this . owningGuild . isErrant ( ) | | this . owningGuild . getNation ( ) . isErrant ( ) )
if ( this . owningGuild = = null | | this . owningGuild . isErrant ( ) | | this . owningGuild . getNation ( ) . isErrant ( ) )
return false ;
return false ;
@ -523,19 +502,19 @@ try{
if ( mineBuilding . getRank ( ) < 1 ) {
if ( mineBuilding . getRank ( ) < 1 ) {
if ( c laimer = = null ) {
if ( this . lastC laimer = = null ) {
this . lastClaimerID = 0 ;
this . lastClaimerSessionID = null ;
updateGuildOwner ( null ) ;
updateGuildOwner ( null ) ;
return false ;
return false ;
}
}
mineBuilding . rebuildMine ( ) ;
mineBuilding . rebuildMine ( ) ;
WorldGrid . updateObject ( mineBuilding ) ;
WorldGrid . updateObject ( mineBuilding ) ;
ChatManager . chatSystemChannel ( c laimer. getName ( ) + " has claimed the mine in " + this . parentZone . getParent ( ) . getName ( ) + " for " + this . owningGuild . getName ( ) + ". The mine is no longer active." ) ;
ChatManager . chatSystemChannel ( this . lastC laimer. getName ( ) + " has claimed the mine in " + this . parentZone . getParent ( ) . getName ( ) + " for " + this . owningGuild . getName ( ) + ". The mine is no longer active." ) ;
// Warehouse this claim event
// Warehouse this claim event
MineRecord mineRecord = MineRecord . borrow ( this , c laimer, Enum . RecordEventType . CAPTURE ) ;
MineRecord mineRecord = MineRecord . borrow ( this , this . lastC laimer, Enum . RecordEventType . CAPTURE ) ;
DataWarehouse . pushToWarehouse ( mineRecord ) ;
DataWarehouse . pushToWarehouse ( mineRecord ) ;
} else {
} else {
@ -546,7 +525,7 @@ try{
return true ;
return true ;
}
}
public boolean claimMine ( PlayerCharacter claimer ) {
public boolean claimMine ( PlayerCharacter claimer ) {
if ( claimer = = null )
if ( claimer = = null )
return false ;
return false ;
@ -562,10 +541,24 @@ try{
if ( ! updateGuildOwner ( claimer ) )
if ( ! updateGuildOwner ( claimer ) )
return false ;
return false ;
this . lastClaimerID = claimer . getObjectUUID ( ) ;
// Not the Same session for this character?
// Claimers may not relog or they lose claim.
if ( this . lastClaimer ! = null ) {
if ( SessionManager . getSession ( lastClaimer ) . getSessionID ( ) ! =
this . lastClaimerSessionID ) {
this . lastClaimer = null ;
this . lastClaimerSessionID = null ;
Mine . setLastChange ( System . currentTimeMillis ( ) ) ;
Mine . setLastChange ( System . currentTimeMillis ( ) ) ;
return false ;
}
}
// Successful claim
return true ;
return true ;
}
}
public boolean depositMineResources ( ) {
public boolean depositMineResources ( ) {
if ( this . owningGuild = = null )
if ( this . owningGuild = = null )