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. 41
      src/engine/objects/Mob.java

41
src/engine/objects/Mob.java

@ -452,6 +452,7 @@ 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.GUARDMINION;
minionMobile.guardedCity = guardCaptain.guardedCity; minionMobile.guardedCity = guardCaptain.guardedCity;
minionMobile.patrolPoints = guardCaptain.building.patrolPoints; minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
@ -507,6 +508,7 @@ public class Mob extends AbstractIntelligenceAgent {
siegeMinion.guardCaptain = artyCaptain; siegeMinion.guardCaptain = artyCaptain;
siegeMinion.parentZoneUUID = artyCaptain.parentZoneUUID; siegeMinion.parentZoneUUID = artyCaptain.parentZoneUUID;
siegeMinion.behaviourType = MobBehaviourType.SiegeEngine; siegeMinion.behaviourType = MobBehaviourType.SiegeEngine;
siegeMinion.agentType = AIAgentType.SIEGEENGINE;
siegeMinion.bindLoc = Vector3fImmutable.ZERO; siegeMinion.bindLoc = Vector3fImmutable.ZERO;
siegeMinion.spawnTime = (60 * 15); siegeMinion.spawnTime = (60 * 15);
@ -541,6 +543,7 @@ public class Mob extends AbstractIntelligenceAgent {
petMinion.healthMax = MobBase.getMobBase(loadID).getHealthMax() * (petMinion.level * 0.5f); petMinion.healthMax = MobBase.getMobBase(loadID).getHealthMax() * (petMinion.level * 0.5f);
petMinion.health.set(petMinion.healthMax); petMinion.health.set(petMinion.healthMax);
petMinion.behaviourType = MobBehaviourType.Pet1; petMinion.behaviourType = MobBehaviourType.Pet1;
petMinion.agentType = AIAgentType.PET;
petMinion.firstName = ""; petMinion.firstName = "";
petMinion.lastName = ""; petMinion.lastName = "";
@ -1524,20 +1527,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.setObjectTypeMask(MBServerStatics.MASK_MOB | this.getTypeMasks()); 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 // Configure AI related values
switch (this.behaviourType) { switch (this.behaviourType) {
@ -1546,23 +1535,13 @@ public class Mob extends AbstractIntelligenceAgent {
this.spawnTime = 600; this.spawnTime = 600;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
break; break;
case GuardMinion:
this.agentType = AIAgentType.GUARDMINION;
break;
case GuardWallArcher: case GuardWallArcher:
this.agentType = AIAgentType.GUARDWALLARCHER; this.agentType = AIAgentType.GUARDWALLARCHER;
this.spawnTime = 450; this.spawnTime = 450;
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
case Pet1:
this.agentType = AIAgentType.PET;
break;
case SiegeEngine:
this.agentType = AIAgentType.SIEGEENGINE;
break; break;
} }
}
// Default to the mobbase for AI if nothing is in 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))
@ -1571,6 +1550,18 @@ public class Mob extends AbstractIntelligenceAgent {
if (this.behaviourType == null) if (this.behaviourType == null)
this.behaviourType = MobBehaviourType.None; 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) if (this.building != null)
this.guild = this.building.getGuild(); this.guild = this.building.getGuild();
else else
@ -1596,7 +1587,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.GUARDCAPTAIN) && !this.agentType.equals(AIAgentType.PET)) if (!this.agentType.equals(AIAgentType.GUARDMINION) && !this.agentType.equals(AIAgentType.PET))
this.level = (short) this.mobBase.getLevel(); this.level = (short) this.mobBase.getLevel();
//set bonuses //set bonuses

Loading…
Cancel
Save