@ -7,9 +7,6 @@ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					//                www.magicbane.com
  
					 
					 
					 
					//                www.magicbane.com
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
  
					 
					 
					 
					// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
  
					 
					 
					 
					// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
  
					 
					 
					 
					// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -29,19 +26,18 @@ import engine.gameManager.*; 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.net.ByteBufferWriter ;  
					 
					 
					 
					import  engine.net.ByteBufferWriter ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.net.client.msg.ErrorPopupMsg ;  
					 
					 
					 
					import  engine.net.client.msg.ErrorPopupMsg ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.server.MBServerStatics ;  
					 
					 
					 
					import  engine.server.MBServerStatics ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.server.world.WorldServer ;  
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  engine.session.SessionID ;  
					 
					 
					 
					import  engine.session.SessionID ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  org.pmw.tinylog.Logger ;  
					 
					 
					 
					import  org.pmw.tinylog.Logger ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.net.UnknownHostException ;  
					 
					 
					 
					import  java.net.UnknownHostException ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.sql.ResultSet ;  
					 
					 
					 
					import  java.sql.ResultSet ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.sql.SQLException ;  
					 
					 
					 
					import  java.sql.SQLException ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.sql.Timestamp ;  
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.time.LocalDateTime ;  
					 
					 
					 
					import  java.time.LocalDateTime ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.util.ArrayList ;  
					 
					 
					 
					import  java.util.ArrayList ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  java.util.concurrent.ConcurrentHashMap ;  
					 
					 
					 
					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 ;  
					 
					 
					 
					import static  engine.math.FastMath.sqr ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					public  class  Mine  extends  AbstractGameObject  {  
					 
					 
					 
					public  class  Mine  extends  AbstractGameObject  {  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -64,9 +60,6 @@ public class Mine extends AbstractGameObject { 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    //flags 1: never been claimed (make active).
   
					 
					 
					 
					    //flags 1: never been claimed (make active).
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    // Not persisted to DB
   
					 
					 
					 
					    // Not persisted to DB
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  String  guildName ;   
					 
					 
					 
					    private  String  guildName ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    private  GuildTag  guildTag ;   
					 
					 
					 
					    private  GuildTag  guildTag ;   
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -481,11 +474,19 @@ try{ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            //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.
   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            this . setActive ( false ) ;   
					 
					 
					 
					            this . setActive ( false ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					            this . lastClaimerSessionID  =  null ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					            this . lastClaimer  =  null ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					            return  true ;   
					 
					 
					 
					            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 ;   
					 
					 
					 
					            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 ;   
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -500,14 +501,6 @@ try{ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        setLastChange ( System . currentTimeMillis ( ) ) ;   
					 
					 
					 
					        setLastChange ( System . currentTimeMillis ( ) ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							if  ( mineBuilding . getRank ( )  <  1 ) {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
								if  ( this . lastClaimer  = =  null ) {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
									this . lastClaimerSessionID  =  null ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
									updateGuildOwner ( null ) ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
									return  false ;   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
								}   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        mineBuilding . rebuildMine ( ) ;   
					 
					 
					 
					        mineBuilding . rebuildMine ( ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        WorldGrid . updateObject ( mineBuilding ) ;   
					 
					 
					 
					        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." ) ;   
					 
					 
					 
					        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{ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        MineRecord  mineRecord  =  MineRecord . borrow ( this ,  this . lastClaimer ,  Enum . RecordEventType . CAPTURE ) ;   
					 
					 
					 
					        MineRecord  mineRecord  =  MineRecord . borrow ( this ,  this . lastClaimer ,  Enum . RecordEventType . CAPTURE ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        DataWarehouse . pushToWarehouse ( mineRecord ) ;   
					 
					 
					 
					        DataWarehouse . pushToWarehouse ( mineRecord ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							} else {   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        mineBuilding . setRank ( mineBuilding . getRank ( ) ) ;   
					 
					 
					 
					        mineBuilding . setRank ( mineBuilding . getRank ( ) ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
							}   
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        this . setActive ( false ) ;   
					 
					 
					 
					        this . setActive ( false ) ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					        return  true ;   
					 
					 
					 
					        return  true ;   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    }   
					 
					 
					 
					    }