Browse Source

Rework of agent type init in runafterload. Only used for 2 instances from disk.

feature-workorder
MagicBot 1 year ago
parent
commit
d0795e9e1c
  1. 67
      src/engine/objects/Mob.java

67
src/engine/objects/Mob.java

@ -452,6 +452,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -452,6 +452,7 @@ public class Mob extends AbstractIntelligenceAgent {
minionMobile.guardCaptain = guardCaptain;
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
minionMobile.agentType = AIAgentType.GUARDMINION;
minionMobile.guardedCity = guardCaptain.guardedCity;
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
@ -507,6 +508,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -507,6 +508,7 @@ public class Mob extends AbstractIntelligenceAgent {
siegeMinion.guardCaptain = artyCaptain;
siegeMinion.parentZoneUUID = artyCaptain.parentZoneUUID;
siegeMinion.behaviourType = MobBehaviourType.SiegeEngine;
siegeMinion.agentType = AIAgentType.SIEGEENGINE;
siegeMinion.bindLoc = Vector3fImmutable.ZERO;
siegeMinion.spawnTime = (60 * 15);
@ -541,6 +543,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -541,6 +543,7 @@ public class Mob extends AbstractIntelligenceAgent {
petMinion.healthMax = MobBase.getMobBase(loadID).getHealthMax() * (petMinion.level * 0.5f);
petMinion.health.set(petMinion.healthMax);
petMinion.behaviourType = MobBehaviourType.Pet1;
petMinion.agentType = AIAgentType.PET;
petMinion.firstName = "";
petMinion.lastName = "";
@ -1524,43 +1527,19 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1524,43 +1527,19 @@ public class Mob extends AbstractIntelligenceAgent {
this.setObjectTypeMask(MBServerStatics.MASK_MOB | this.getTypeMasks());
this.building = BuildingManager.getBuilding(this.buildingUUID);
if (this.contractUUID == 0)
this.contract = null;
else
this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID);
if (this.contract != null) {
// Setup equipset for contract
this.equipmentSetID = this.contract.getEquipmentSet();
// Configure AI related values
switch (this.behaviourType) {
case GuardCaptain:
this.agentType = AIAgentType.GUARDCAPTAIN;
this.spawnTime = 600;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
break;
case GuardMinion:
this.agentType = AIAgentType.GUARDMINION;
break;
case GuardWallArcher:
this.agentType = AIAgentType.GUARDWALLARCHER;
this.spawnTime = 450;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
case Pet1:
this.agentType = AIAgentType.PET;
break;
case SiegeEngine:
this.agentType = AIAgentType.SIEGEENGINE;
break;
}
// Configure AI related values
switch (this.behaviourType) {
case GuardCaptain:
this.agentType = AIAgentType.GUARDCAPTAIN;
this.spawnTime = 600;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
break;
case GuardWallArcher:
this.agentType = AIAgentType.GUARDWALLARCHER;
this.spawnTime = 450;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
break;
}
// Default to the mobbase for AI if nothing is in mob field to override.
@ -1571,6 +1550,18 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1571,6 +1550,18 @@ public class Mob extends AbstractIntelligenceAgent {
if (this.behaviourType == null)
this.behaviourType = MobBehaviourType.None;
this.building = BuildingManager.getBuilding(this.buildingUUID);
if (this.contractUUID == 0)
this.contract = null;
else
this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID);
// Setup equipset for contract
if (this.contract != null)
this.equipmentSetID = this.contract.getEquipmentSet();
if (this.building != null)
this.guild = this.building.getGuild();
else
@ -1596,7 +1587,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1596,7 +1587,7 @@ public class Mob extends AbstractIntelligenceAgent {
// Don't override level for guard minions or pets
if (this.contract == null)
if (!this.agentType.equals(AIAgentType.GUARDCAPTAIN) && !this.agentType.equals(AIAgentType.PET))
if (!this.agentType.equals(AIAgentType.GUARDMINION) && !this.agentType.equals(AIAgentType.PET))
this.level = (short) this.mobBase.getLevel();
//set bonuses

Loading…
Cancel
Save