Refactor to separate persistence and write fsm to table.

This commit is contained in:
2023-08-31 08:03:30 -04:00
parent 6641651f3c
commit c8ed04aaaf
5 changed files with 54 additions and 47 deletions
+28 -10
View File
@@ -530,41 +530,59 @@ public enum BuildingManager {
else
rank = 10;
Mob mob;
Mob mobile;
NPC npc;
if (NPC.ISWallArcher(contract)) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
if (mobile == null)
return false;
mob.setLoc(mob.getLoc());
// Configure AI.
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
DbManager.MobQueries.PERSIST(mobile);
mobile.setLoc(mobile.getLoc());
return true;
}
if (NPC.ISGuardCaptain(contract.getContractID())) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
if (mobile == null)
return false;
mob.setLoc(mob.getLoc());
// Configure AI.
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
DbManager.MobQueries.PERSIST(mobile);
mobile.setLoc(mobile.getLoc());
return true;
}
if (contract.getContractID() == 910) {
//guard dog
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
if (mobile == null)
return false;
mob.setLoc(mob.getLoc());
// Configure AI.
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
DbManager.MobQueries.PERSIST(mobile);
mobile.setLoc(mobile.getLoc());
return true;
}