Browse Source

replaced MobileFSM.STATE with MobileFSM.MobBehaviourTypes

master
FatBoy-DOTC 2 years ago
parent
commit
98f0928a4b
  1. 10
      src/engine/InterestManagement/InterestManager.java
  2. 1836
      src/engine/ai/MobileFSM.java
  3. 4
      src/engine/db/handlers/dbMobHandler.java
  4. 2
      src/engine/devcmd/cmds/InfoCmd.java
  5. 5
      src/engine/gameManager/CombatManager.java
  6. 9
      src/engine/gameManager/NPCManager.java
  7. 7
      src/engine/net/client/ClientMessagePump.java
  8. 5
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  9. 3
      src/engine/objects/AbstractIntelligenceAgent.java
  10. 40
      src/engine/objects/Mob.java
  11. 3
      src/engine/objects/NPC.java
  12. 2
      src/engine/objects/PlayerCharacter.java
  13. 4
      src/engine/powers/poweractions/ApplyEffectPowerAction.java
  14. 2
      src/engine/powers/poweractions/ClearAggroPowerAction.java
  15. 3
      src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java
  16. 3
      src/engine/powers/poweractions/CreateMobPowerAction.java
  17. 3
      src/engine/powers/poweractions/MobRecallPowerAction.java
  18. 2
      src/engine/powers/poweractions/RecallPowerAction.java

10
src/engine/InterestManagement/InterestManager.java

@ -10,8 +10,6 @@ package engine.InterestManagement;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.ai.MobileFSM;
import engine.ai.MobileFSM.STATE;
import engine.gameManager.GroupManager; import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.job.JobScheduler; import engine.job.JobScheduler;
@ -338,11 +336,12 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive() && (awonpc.isPet() || awonpc.isSiege() || awonpc.isNecroPet() || awonpc.isPlayerGuard())) if (!awonpc.isAlive() && (awonpc.isPet() || awonpc.isSiege() || awonpc.isNecroPet() || awonpc.isPlayerGuard()))
continue; continue;
if (awonpc.state.equals(STATE.Respawn) || awonpc.state.equals(STATE.Disabled)) if (awonpc.isAlive() == false)
continue; continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), false); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
MobileFSM.setAwake(awonpc, false); //MobileFSM.setAwake(awonpc, false);
((Mob)awonpc).setCombatTarget(null);
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000)); // IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
// awonpc.enableIntelligence(); // awonpc.enableIntelligence();
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii()); lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@ -358,7 +357,8 @@ public enum InterestManager implements Runnable {
awonpc.playerAgroMap.put(player.getObjectUUID(), false); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if (awonpc.isMob()) if (awonpc.isMob())
MobileFSM.setAwake(awonpc, false); //MobileFSM.setAwake(awonpc, false);
((Mob)awonpc).setCombatTarget(null);
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000)); // IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
// awonpc.enableIntelligence(); // awonpc.enableIntelligence();
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii()); lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());

1836
src/engine/ai/MobileFSM.java

File diff suppressed because it is too large Load Diff

4
src/engine/db/handlers/dbMobHandler.java

@ -9,7 +9,6 @@
package engine.db.handlers; package engine.db.handlers;
import engine.ai.MobileFSM.STATE;
import engine.gameManager.NPCManager; import engine.gameManager.NPCManager;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.Zone; import engine.objects.Zone;
@ -124,9 +123,8 @@ public class dbMobHandler extends dbHandlerBase {
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES); toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES);
toCreate.setDeathTime(System.currentTimeMillis()); toCreate.setDeathTime(System.currentTimeMillis());
toCreate.state = STATE.Respawn;
} }
} }

2
src/engine/devcmd/cmds/InfoCmd.java

@ -458,7 +458,7 @@ public class InfoCmd extends AbstractDevCmd {
output += StringUtils.addWS("isAlive: " output += StringUtils.addWS("isAlive: "
+ targetMob.isAlive(), 20); + targetMob.isAlive(), 20);
output += newline; output += newline;
output += "Mob State: " + targetMob.state.name(); //output += "Mob State: " + targetMob.state.name();
output += newline; output += newline;
output += "Speed : " + targetMob.getSpeed(); output += "Speed : " + targetMob.getSpeed();

5
src/engine/gameManager/CombatManager.java

@ -9,7 +9,6 @@
package engine.gameManager; package engine.gameManager;
import engine.Enum.*; import engine.Enum.*;
import engine.ai.MobileFSM.STATE;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.job.JobContainer; import engine.job.JobContainer;
import engine.job.JobScheduler; import engine.job.JobScheduler;
@ -183,7 +182,6 @@ public enum CombatManager {
//set sources target //set sources target
pet.setCombatTarget(target); pet.setCombatTarget(target);
pet.state = STATE.Attack;
// setFirstHitCombatTarget(player,target); // setFirstHitCombatTarget(player,target);
//put in combat if not already //put in combat if not already
@ -691,7 +689,6 @@ public enum CombatManager {
count++; count++;
mob.setCombatTarget(ac); mob.setCombatTarget(ac);
mob.state = STATE.Attack;
} }
} }
} }
@ -1339,7 +1336,6 @@ public enum CombatManager {
Mob pet = ((PlayerCharacter) tarAc).getPet(); Mob pet = ((PlayerCharacter) tarAc).getPet();
if (pet != null && pet.assist() && pet.getCombatTarget() == null) { if (pet != null && pet.assist() && pet.getCombatTarget() == null) {
pet.setCombatTarget(ac); pet.setCombatTarget(ac);
pet.state = STATE.Retaliate;
} }
} }
@ -1351,7 +1347,6 @@ public enum CombatManager {
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege()) if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
return; return;
retaliater.setCombatTarget(ac); retaliater.setCombatTarget(ac);
retaliater.state = STATE.Retaliate;
} }
} }

9
src/engine/gameManager/NPCManager.java

@ -2,7 +2,6 @@ package engine.gameManager;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
@ -115,8 +114,6 @@ public enum NPCManager {
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) { public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
necroPet.state = MobileFSM.STATE.Disabled;
necroPet.combatTarget = null; necroPet.combatTarget = null;
necroPet.hasLoot = false; necroPet.hasLoot = false;
@ -202,7 +199,6 @@ public enum NPCManager {
try { try {
dismissNecroPet(necroPet, true); dismissNecroPet(necroPet, true);
} catch (Exception e) { } catch (Exception e) {
necroPet.state = MobileFSM.STATE.Disabled;
Logger.error(e); Logger.error(e);
} }
} }
@ -333,7 +329,6 @@ public enum NPCManager {
mob.deathTime = System.currentTimeMillis(); mob.deathTime = System.currentTimeMillis();
mob.spawnTime = 900; mob.spawnTime = 900;
mob.npcOwner = guardCaptain; mob.npcOwner = guardCaptain;
mob.state = MobileFSM.STATE.Respawn;
return mob; return mob;
} }
@ -342,12 +337,9 @@ public enum NPCManager {
for (Mob toRemove : mobile.siegeMinionMap.keySet()) { for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
toRemove.state = MobileFSM.STATE.Disabled;
if (mobile.isMoving()) { if (mobile.isMoving()) {
mobile.stopMovement(mobile.getLoc()); mobile.stopMovement(mobile.getLoc());
mobile.state = MobileFSM.STATE.Disabled;
if (toRemove.parentZone != null) if (toRemove.parentZone != null)
toRemove.parentZone.zoneMobSet.remove(toRemove); toRemove.parentZone.zoneMobSet.remove(toRemove);
@ -383,7 +375,6 @@ public enum NPCManager {
public static boolean removeMobileFromBuilding(Mob mobile, Building building) { public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
// Remove npc from it's building // Remove npc from it's building
mobile.state = MobileFSM.STATE.Disabled;
try { try {
mobile.clearEffects(); mobile.clearEffects();

7
src/engine/net/client/ClientMessagePump.java

@ -12,7 +12,6 @@ package engine.net.client;
import engine.Enum.*; import engine.Enum.*;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM.STATE;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
@ -2026,7 +2025,6 @@ public class ClientMessagePump implements NetMsgHandler {
if (pet.getCombatTarget() == null) if (pet.getCombatTarget() == null)
return; return;
pet.state = STATE.Attack;
} }
protected static void petCmd(PetCmdMsg msg, ClientConnection conn) throws MsgSendException { protected static void petCmd(PetCmdMsg msg, ClientConnection conn) throws MsgSendException {
@ -2044,15 +2042,14 @@ public class ClientMessagePump implements NetMsgHandler {
if (!pet.isAlive()) if (!pet.isAlive())
return; return;
if (pet.state == STATE.Disabled) //if (pet.state == STATE.Disabled)
return; // return;
int type = msg.getType(); int type = msg.getType();
if (type == 1) { //stop attack if (type == 1) { //stop attack
pet.setCombatTarget(null); pet.setCombatTarget(null);
pc.setCombat(false); pc.setCombat(false);
pet.state = STATE.Awake;
} }
else if (type == 2) { //dismiss else if (type == 2) { //dismiss

5
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -3,7 +3,6 @@ package engine.net.client.handlers;
import engine.Enum; import engine.Enum;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
@ -67,7 +66,6 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (!npc.getSiegeMinionMap().containsKey(toRemove)) if (!npc.getSiegeMinionMap().containsKey(toRemove))
return true; return true;
toRemove.state = MobileFSM.STATE.Disabled;
npc.getSiegeMinionMap().remove(toRemove); npc.getSiegeMinionMap().remove(toRemove);
//toRemove.disableIntelligence(); //toRemove.disableIntelligence();
@ -160,7 +158,6 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toCreate.setSpawnTime(60 * 15); toCreate.setSpawnTime(60 * 15);
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + (60 * 15 * 1000)); toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + (60 * 15 * 1000));
toCreate.setDeathTime(System.currentTimeMillis()); toCreate.setDeathTime(System.currentTimeMillis());
toCreate.state = MobileFSM.STATE.Respawn;
} }
} }
@ -199,7 +196,6 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove))) if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
return true; return true;
toRemove.state = MobileFSM.STATE.Disabled;
npc.getSiegeMinionMap().remove(toRemove); npc.getSiegeMinionMap().remove(toRemove);
//toRemove.disableIntelligence(); //toRemove.disableIntelligence();
@ -293,7 +289,6 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (toCreate != null) { if (toCreate != null) {
toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES); toCreate.setTimeToSpawnSiege(System.currentTimeMillis() + MBServerStatics.FIFTEEN_MINUTES);
toCreate.setDeathTime(System.currentTimeMillis()); toCreate.setDeathTime(System.currentTimeMillis());
toCreate.state = MobileFSM.STATE.Respawn;
} }
} }

3
src/engine/objects/AbstractIntelligenceAgent.java

@ -14,7 +14,6 @@ import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM.STATE;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
@ -204,7 +203,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
WorldGrid.RemoveWorldObject(this); WorldGrid.RemoveWorldObject(this);
if (this.getObjectType() == GameObjectType.Mob){ if (this.getObjectType() == GameObjectType.Mob){
((Mob)this).state = STATE.Disabled; //((Mob)this).state = STATE.Disabled;
if (((Mob)this).getParentZone() != null) if (((Mob)this).getParentZone() != null)
((Mob)this).getParentZone().zoneMobSet.remove(this); ((Mob)this).getParentZone().zoneMobSet.remove(this);
} }

40
src/engine/objects/Mob.java

@ -8,13 +8,11 @@
package engine.objects; package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet; import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum; import engine.Enum;
import engine.Enum.*; import engine.Enum.*;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM; import engine.ai.MobileFSM;
import engine.ai.MobileFSM.STATE;
import engine.exception.SerializationException; import engine.exception.SerializationException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
@ -35,7 +33,6 @@ import engine.net.client.msg.PlaceAssetMsg;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
@ -44,7 +41,6 @@ import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
public class Mob extends AbstractIntelligenceAgent { public class Mob extends AbstractIntelligenceAgent {
@ -89,7 +85,6 @@ public class Mob extends AbstractIntelligenceAgent {
public AbstractCharacter npcOwner; public AbstractCharacter npcOwner;
public Vector3fImmutable inBuildingLoc = null; public Vector3fImmutable inBuildingLoc = null;
private boolean noAggro = false; private boolean noAggro = false;
public STATE state = STATE.Disabled;
private int aggroTargetID = 0; private int aggroTargetID = 0;
private boolean walkingHome = true; private boolean walkingHome = true;
private long lastAttackTime = 0; private long lastAttackTime = 0;
@ -110,7 +105,7 @@ public class Mob extends AbstractIntelligenceAgent {
public EnumBitSet<MonsterType> notEnemy; public EnumBitSet<MonsterType> notEnemy;
public EnumBitSet<Enum.MonsterType> enemy; public EnumBitSet<Enum.MonsterType> enemy;
public MobileFSM.MobBehaviourType BehaviourType;
/** /**
* No Id Constructor * No Id Constructor
*/ */
@ -122,7 +117,7 @@ public class Mob extends AbstractIntelligenceAgent {
walk, combat, bindLoc, currentLoc, faceDir, healthCurrent, manaCurrent, stamCurrent, guild, runningTrains); walk, combat, bindLoc, currentLoc, faceDir, healthCurrent, manaCurrent, stamCurrent, guild, runningTrains);
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
this.state = STATE.Idle; //this.state = STATE.Idle;
this.loadID = npcType; this.loadID = npcType;
this.isMob = isMob; this.isMob = isMob;
this.mobBase = MobBase.getMobBase(loadID); this.mobBase = MobBase.getMobBase(loadID);
@ -155,7 +150,7 @@ public class Mob extends AbstractIntelligenceAgent {
byte runningTrains, int npcType, boolean isMob, Zone parent, int newUUID, Building building, int contractID) { byte runningTrains, int npcType, boolean isMob, Zone parent, int newUUID, Building building, int contractID) {
super(firstName, lastName, statStrCurrent, statDexCurrent, statConCurrent, statIntCurrent, statSpiCurrent, level, exp, sit, super(firstName, lastName, statStrCurrent, statDexCurrent, statConCurrent, statIntCurrent, statSpiCurrent, level, exp, sit,
walk, combat, bindLoc, currentLoc, faceDir, healthCurrent, manaCurrent, stamCurrent, guild, runningTrains, newUUID); walk, combat, bindLoc, currentLoc, faceDir, healthCurrent, manaCurrent, stamCurrent, guild, runningTrains, newUUID);
this.state = STATE.Idle; //this.state = STATE.Idle;
this.dbID = newUUID; this.dbID = newUUID;
this.loadID = npcType; this.loadID = npcType;
this.isMob = isMob; this.isMob = isMob;
@ -178,7 +173,7 @@ public class Mob extends AbstractIntelligenceAgent {
*/ */
public Mob(MobBase mobBase, Guild guild, Zone parent, short level, PlayerCharacter owner, int tableID) { public Mob(MobBase mobBase, Guild guild, Zone parent, short level, PlayerCharacter owner, int tableID) {
super(mobBase.getFirstName(), "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, level, 0, false, true, false, owner.getLoc(), owner.getLoc(), owner.getFaceDir(), (short) mobBase.getHealthMax(), (short) 0, (short) 0, guild, (byte) 0, tableID); super(mobBase.getFirstName(), "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, level, 0, false, true, false, owner.getLoc(), owner.getLoc(), owner.getFaceDir(), (short) mobBase.getHealthMax(), (short) 0, (short) 0, guild, (byte) 0, tableID);
this.state = STATE.Idle; //this.state = STATE.Idle;
this.dbID = tableID; this.dbID = tableID;
this.loadID = mobBase.getObjectUUID(); this.loadID = mobBase.getObjectUUID();
this.isMob = true; this.isMob = true;
@ -214,7 +209,7 @@ public class Mob extends AbstractIntelligenceAgent {
try { try {
this.dbID = rs.getInt(1); this.dbID = rs.getInt(1);
this.state = STATE.Idle; //this.state = STATE.Idle;
this.loadID = rs.getInt("mob_mobbaseID"); this.loadID = rs.getInt("mob_mobbaseID");
this.gridObjectType = GridObjectType.DYNAMIC; this.gridObjectType = GridObjectType.DYNAMIC;
this.spawnRadius = rs.getFloat("mob_spawnRadius"); this.spawnRadius = rs.getFloat("mob_spawnRadius");
@ -298,7 +293,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.equipmentSetID = this.contract.getEquipmentSet(); this.equipmentSetID = this.contract.getEquipmentSet();
this.nameOverride = rs.getString("mob_name"); this.nameOverride = rs.getString("mob_name");
this.BehaviourType = MobileFSM.MobBehaviourType.valueOf(rs.getString("fsm"));
} catch (Exception e) { } catch (Exception e) {
Logger.error(currentID + ""); Logger.error(currentID + "");
} }
@ -650,7 +645,7 @@ public class Mob extends AbstractIntelligenceAgent {
DbManager.addToCache(mob); DbManager.addToCache(mob);
mob.setPet(owner, true); mob.setPet(owner, true);
mob.setWalkMode(false); mob.setWalkMode(false);
mob.state = STATE.Awake; //mob.state = STATE.Awake;
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
@ -717,7 +712,7 @@ public class Mob extends AbstractIntelligenceAgent {
//target is mob's combat target, LETS GO. //target is mob's combat target, LETS GO.
if (source.getHateValue() > target.getHateValue()) { if (source.getHateValue() > target.getHateValue()) {
mob.setCombatTarget(source); mob.setCombatTarget(source);
MobileFSM.setAggro(mob, source.getObjectUUID()); //MobileFSM.setAggro(mob, source.getObjectUUID());
} }
} }
} }
@ -1144,8 +1139,8 @@ public class Mob extends AbstractIntelligenceAgent {
if (!this.isMoving()) if (!this.isMoving())
return; return;
if (state == STATE.Disabled) //if (state == STATE.Disabled)
return; // return;
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) { if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
//Target is stunned or rooted. Don't move //Target is stunned or rooted. Don't move
@ -1185,7 +1180,8 @@ public class Mob extends AbstractIntelligenceAgent {
try { try {
if (this.isSiege) { if (this.isSiege) {
this.deathTime = System.currentTimeMillis(); this.deathTime = System.currentTimeMillis();
this.state = STATE.Dead; //this.state = STATE.Dead;
MobileFSM.dead(this);
try { try {
this.clearEffects(); this.clearEffects();
} catch (Exception e) { } catch (Exception e) {
@ -1211,7 +1207,7 @@ public class Mob extends AbstractIntelligenceAgent {
} }
} else if (this.isPet() || this.isNecroPet()) { } else if (this.isPet() || this.isNecroPet()) {
this.state = STATE.Disabled; //this.state = STATE.Disabled;
this.combatTarget = null; this.combatTarget = null;
this.hasLoot = false; this.hasLoot = false;
@ -1248,7 +1244,8 @@ public class Mob extends AbstractIntelligenceAgent {
//cleanup effects //cleanup effects
this.deathTime = System.currentTimeMillis(); this.deathTime = System.currentTimeMillis();
this.state = STATE.Dead; //this.state = STATE.Dead;
MobileFSM.dead(this);
playerAgroMap.clear(); playerAgroMap.clear();
@ -2037,7 +2034,8 @@ public class Mob extends AbstractIntelligenceAgent {
PlayerCharacter player = (PlayerCharacter) ac; PlayerCharacter player = (PlayerCharacter) ac;
if (this.getCombatTarget() == null) { if (this.getCombatTarget() == null) {
MobileFSM.setAggro(this, player.getObjectUUID()); //MobileFSM.setAggro(this, player.getObjectUUID());
this.combatTarget = ac;
return; return;
} }
@ -2048,7 +2046,7 @@ public class Mob extends AbstractIntelligenceAgent {
if (ac.getHateValue() > ((PlayerCharacter) this.getCombatTarget()).getHateValue()) { if (ac.getHateValue() > ((PlayerCharacter) this.getCombatTarget()).getHateValue()) {
this.setCombatTarget(player); this.setCombatTarget(player);
MobileFSM.setAggro(this, player.getObjectUUID()); //MobileFSM.setAggro(this, player.getObjectUUID());
} }
} }
} }
@ -2329,7 +2327,7 @@ public class Mob extends AbstractIntelligenceAgent {
WorldGrid.RemoveWorldObject(this); WorldGrid.RemoveWorldObject(this);
DbManager.removeFromCache(this); DbManager.removeFromCache(this);
if (this.getObjectType() == GameObjectType.Mob) { if (this.getObjectType() == GameObjectType.Mob) {
this.state = STATE.Disabled; //this.state = STATE.Disabled;
if (this.getParentZone() != null) if (this.getParentZone() != null)
this.getParentZone().zoneMobSet.remove(this); this.getParentZone().zoneMobSet.remove(this);
} }

3
src/engine/objects/NPC.java

@ -12,7 +12,6 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.*; import engine.Enum.*;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM.STATE;
import engine.exception.SerializationException; import engine.exception.SerializationException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
@ -790,7 +789,6 @@ public class NPC extends AbstractCharacter {
for (Mob toRemove : this.siegeMinionMap.keySet()) { for (Mob toRemove : this.siegeMinionMap.keySet()) {
toRemove.state = STATE.Disabled;
try { try {
toRemove.clearEffects(); toRemove.clearEffects();
@ -1461,7 +1459,6 @@ public class NPC extends AbstractCharacter {
mob.setSpawnTime(10); mob.setSpawnTime(10);
mob.setNpcOwner(this); mob.setNpcOwner(this);
mob.state = STATE.Awake;
mob.region = AbstractWorldObject.GetRegionByWorldObject(mob); mob.region = AbstractWorldObject.GetRegionByWorldObject(mob);
return mob; return mob;
} }

2
src/engine/objects/PlayerCharacter.java

@ -15,7 +15,6 @@ import engine.InterestManagement.HeightMap;
import engine.InterestManagement.InterestManager; import engine.InterestManagement.InterestManager;
import engine.InterestManagement.RealmMap; import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM.STATE;
import engine.db.archive.CharacterRecord; import engine.db.archive.CharacterRecord;
import engine.db.archive.DataWarehouse; import engine.db.archive.DataWarehouse;
import engine.db.archive.PvpRecord; import engine.db.archive.PvpRecord;
@ -4580,7 +4579,6 @@ public class PlayerCharacter extends AbstractCharacter {
if (!currentPet.isSiege()) { if (!currentPet.isSiege()) {
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
currentPet.state = STATE.Disabled;
if (currentPet.getParentZone() != null) if (currentPet.getParentZone() != null)

4
src/engine/powers/poweractions/ApplyEffectPowerAction.java

@ -125,7 +125,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
if (this.effectID.equals("TAUNT")){ if (this.effectID.equals("TAUNT")){
if (awo != null && awo.getObjectType() == GameObjectType.Mob){ if (awo != null && awo.getObjectType() == GameObjectType.Mob){
MobileFSM.setAggro((Mob)awo,source.getObjectUUID()); ((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo); ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg); DispatchMessage.sendToAllInRange(source, msg);
} }
@ -252,7 +252,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
if (this.effectID.equals("TAUNT")){ if (this.effectID.equals("TAUNT")){
if (awo != null && awo.getObjectType() == GameObjectType.Mob){ if (awo != null && awo.getObjectType() == GameObjectType.Mob){
MobileFSM.setAggro((Mob)awo,source.getObjectUUID()); ((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo); ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg); DispatchMessage.sendToAllInRange(source, msg);
} }

2
src/engine/powers/poweractions/ClearAggroPowerAction.java

@ -10,7 +10,6 @@
package engine.powers.poweractions; package engine.powers.poweractions;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.ai.MobileFSM.STATE;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
@ -32,7 +31,6 @@ public class ClearAggroPowerAction extends AbstractPowerAction {
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob){ if (awo != null && awo.getObjectType() == GameObjectType.Mob){
((Mob)awo).setNoAggro(true); ((Mob)awo).setNoAggro(true);
((Mob)awo).state = STATE.Patrol;
} }

3
src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java

@ -10,11 +10,9 @@
package engine.powers.poweractions; package engine.powers.poweractions;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.ai.MobileFSM.STATE;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter; import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject; import engine.objects.AbstractWorldObject;
import engine.objects.Mob;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
@ -31,7 +29,6 @@ public class ClearNearbyAggroPowerAction extends AbstractPowerAction {
@Override @Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source.getObjectType() == GameObjectType.Mob){ if (source.getObjectType() == GameObjectType.Mob){
((Mob)source).state = STATE.Patrol;
} }
} }

3
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -11,7 +11,6 @@ package engine.powers.poweractions;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM.STATE;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.NPCManager; import engine.gameManager.NPCManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
@ -82,7 +81,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
if(currentPet!= null && !currentPet.isNecroPet() && !currentPet.isSiege()) { if(currentPet!= null && !currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet); DbManager.removeFromCache(currentPet);
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);
currentPet.state = STATE.Disabled;
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.getParentZone() != null) if (currentPet.getParentZone() != null)
@ -116,7 +114,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
if(!currentPet.isNecroPet() && !currentPet.isSiege()) { if(!currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet); DbManager.removeFromCache(currentPet);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
currentPet.state = STATE.Disabled;
currentPet.setOwner(null); currentPet.setOwner(null);
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);

3
src/engine/powers/poweractions/MobRecallPowerAction.java

@ -41,7 +41,8 @@ public class MobRecallPowerAction extends AbstractPowerAction {
MovementManager.translocate(awoac,awoac.getBindLoc(), null); MovementManager.translocate(awoac,awoac.getBindLoc(), null);
if (awoac.getObjectType() == GameObjectType.Mob){ if (awoac.getObjectType() == GameObjectType.Mob){
MobileFSM.setAwake((Mob)awoac,true); //MobileFSM.setAwake((Mob)awoac,true);
((Mob)awoac).setCombatTarget(null);
} }

2
src/engine/powers/poweractions/RecallPowerAction.java

@ -67,7 +67,7 @@ public class RecallPowerAction extends AbstractPowerAction {
awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ); awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ);
awoac.teleport(awoac.getBindLoc()); awoac.teleport(awoac.getBindLoc());
if (awoac.getObjectType() == GameObjectType.Mob){ if (awoac.getObjectType() == GameObjectType.Mob){
MobileFSM.setAwake((Mob)awoac,true); ((Mob)awoac).setCombatTarget(null);
if (awoac.isAlive()) if (awoac.isAlive())
WorldGrid.updateObject(awoac); WorldGrid.updateObject(awoac);
} }

Loading…
Cancel
Save