| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -405,6 +405,8 @@ public class Mob extends AbstractIntelligenceAgent { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Mob mobile = new Mob(); | 
					 | 
					 | 
					 | 
					        Mob mobile = new Mob(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; | 
					 | 
					 | 
					 | 
					        mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mobile.agentType = AIAgentType.MOBILE; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        mobile.behaviourType = MobBehaviourType.None; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        mobile.loadID = loadID; | 
					 | 
					 | 
					 | 
					        mobile.loadID = loadID; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        mobile.level = (short) level; | 
					 | 
					 | 
					 | 
					        mobile.level = (short) level; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -428,18 +430,7 @@ public class Mob extends AbstractIntelligenceAgent { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else | 
					 | 
					 | 
					 | 
					        else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            mobile.contractUUID = contract.getContractID(); | 
					 | 
					 | 
					 | 
					            mobile.contractUUID = contract.getContractID(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Mob mob; | 
					 | 
					 | 
					 | 
					        return mobile; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        mobile.agentType = AIAgentType.GUARD; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        try { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            mob = DbManager.MobQueries.PERSIST(mobile); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } catch (Exception e) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Logger.error("SQLException:" + e.getMessage()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            mob = null; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return mob; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) { | 
					 | 
					 | 
					 | 
					    public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -463,7 +454,6 @@ public class Mob extends AbstractIntelligenceAgent { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.guardCaptain = guardCaptain; | 
					 | 
					 | 
					 | 
					        minionMobile.guardCaptain = guardCaptain; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60; | 
					 | 
					 | 
					 | 
					        minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion; | 
					 | 
					 | 
					 | 
					        minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.agentType = AIAgentType.GUARD; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.isPlayerGuard = true; | 
					 | 
					 | 
					 | 
					        minionMobile.isPlayerGuard = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.guardedCity = guardCaptain.guardedCity; | 
					 | 
					 | 
					 | 
					        minionMobile.guardedCity = guardCaptain.guardedCity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        minionMobile.patrolPoints = guardCaptain.building.patrolPoints; | 
					 | 
					 | 
					 | 
					        minionMobile.patrolPoints = guardCaptain.building.patrolPoints; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1545,33 +1535,30 @@ public class Mob extends AbstractIntelligenceAgent { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        else | 
					 | 
					 | 
					 | 
					        else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID); | 
					 | 
					 | 
					 | 
					            this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Setup mobile AI and equipset for contract
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.contract != null) { | 
					 | 
					 | 
					 | 
					        if (this.contract != null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // Setup equipset for contract
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.equipmentSetID = this.contract.getEquipmentSet(); | 
					 | 
					 | 
					 | 
					            this.equipmentSetID = this.contract.getEquipmentSet(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // Load AI for guard captains
 | 
					 | 
					 | 
					 | 
					            // Configure AI related values
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (NPC.ISGuardCaptain(contract.getContractID()) || this.contract.getContractID() == 910) {  // Guard Dog
 | 
					 | 
					 | 
					 | 
					            switch (this.behaviourType) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.behaviourType = MobBehaviourType.GuardCaptain; | 
					 | 
					 | 
					 | 
					                case GuardCaptain: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.spawnTime = 60 * 15; | 
					 | 
					 | 
					 | 
					                    this.agentType = AIAgentType.GUARDCAPTAIN; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.isPlayerGuard = true; | 
					 | 
					 | 
					 | 
					                    this.spawnTime = 600; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); | 
					 | 
					 | 
					 | 
					                    this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                case GuardWallArcher: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    this.gridObjectType = GridObjectType.DYNAMIC; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    this.agentType = AIAgentType.GUARDWALLARCHER; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    this.spawnTime = 450; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // Load AI for wall archers
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (NPC.ISWallArcher(this.contract)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.gridObjectType = GridObjectType.DYNAMIC; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.behaviourType = MobBehaviourType.GuardWallArcher; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.isPlayerGuard = true; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.spawnTime = 450; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Default to the mobbase for AI if nothing is hte mob field to override.
 | 
					 | 
					 | 
					 | 
					        // Default to the mobbase for AI if nothing is in mob field to override.
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.behaviourType == null || this.behaviourType.equals(MobBehaviourType.None)) | 
					 | 
					 | 
					 | 
					        if (this.behaviourType == null || this.behaviourType.equals(MobBehaviourType.None)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.behaviourType = this.getMobBase().fsm; | 
					 | 
					 | 
					 | 
					            this.behaviourType = this.getMobBase().fsm; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1604,7 +1591,7 @@ public class Mob extends AbstractIntelligenceAgent { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Don't override level for guard minions or pets
 | 
					 | 
					 | 
					 | 
					        // Don't override level for guard minions or pets
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.contract == null) | 
					 | 
					 | 
					 | 
					        if (this.contract == null) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!this.agentType.equals(AIAgentType.GUARD) && !this.agentType.equals(AIAgentType.PET)) | 
					 | 
					 | 
					 | 
					            if (!this.agentType.equals(AIAgentType.GUARDCAPTAIN) && !this.agentType.equals(AIAgentType.PET)) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.level = (short) this.mobBase.getLevel(); | 
					 | 
					 | 
					 | 
					                this.level = (short) this.mobBase.getLevel(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //set bonuses
 | 
					 | 
					 | 
					 | 
					        //set bonuses
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |