|
|
@ -14,9 +14,9 @@ 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.mobileAI.Threads.MobAIThread; |
|
|
|
|
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
|
|
|
|
import engine.mobileAI.Threads.MobAIThread; |
|
|
|
import engine.net.Dispatch; |
|
|
|
import engine.net.Dispatch; |
|
|
|
import engine.net.DispatchMessage; |
|
|
|
import engine.net.DispatchMessage; |
|
|
|
import engine.net.client.msg.PetMsg; |
|
|
|
import engine.net.client.msg.PetMsg; |
|
|
@ -30,26 +30,13 @@ import java.util.ArrayList; |
|
|
|
public abstract class AbstractIntelligenceAgent extends AbstractCharacter { |
|
|
|
public abstract class AbstractIntelligenceAgent extends AbstractCharacter { |
|
|
|
protected Vector3fImmutable lastBindLoc; |
|
|
|
protected Vector3fImmutable lastBindLoc; |
|
|
|
private boolean assist = false; |
|
|
|
private boolean assist = false; |
|
|
|
private AbstractCharacter callForHelpAggro = null; |
|
|
|
private Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE; |
|
|
|
private int type = 0; //Mob: 0, Pet: 1, Guard: 2
|
|
|
|
|
|
|
|
private boolean clearAggro = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException { |
|
|
|
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException { |
|
|
|
super(rs); |
|
|
|
super(rs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AbstractIntelligenceAgent(ResultSet rs, boolean isPlayer) |
|
|
|
|
|
|
|
throws SQLException { |
|
|
|
|
|
|
|
super(rs, isPlayer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractIntelligenceAgent(ResultSet rs, |
|
|
|
|
|
|
|
int UUID) throws SQLException { |
|
|
|
|
|
|
|
super(rs, UUID); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractIntelligenceAgent(String firstName, |
|
|
|
public AbstractIntelligenceAgent(String firstName, |
|
|
|
String lastName, short statStrCurrent, short statDexCurrent, |
|
|
|
String lastName, short statStrCurrent, short statDexCurrent, |
|
|
|
short statConCurrent, short statIntCurrent, short statSpiCurrent, |
|
|
|
short statConCurrent, short statIntCurrent, short statSpiCurrent, |
|
|
@ -88,107 +75,84 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { |
|
|
|
|
|
|
|
|
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
return this.getMobBase(); |
|
|
|
return this.getMobBase(); |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractCharacter getCallForHelpAggro() { |
|
|
|
|
|
|
|
return callForHelpAggro; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setCallForHelpAggro(AbstractCharacter ac) { |
|
|
|
return null; |
|
|
|
this.callForHelpAggro = ac; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMob() { |
|
|
|
public void setMob() { |
|
|
|
this.type = 0; |
|
|
|
this.agentType = Enum.AIAgentType.MOBILE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPet(PlayerCharacter owner, boolean summoned) { |
|
|
|
public void setPet(PlayerCharacter owner, boolean summoned) { |
|
|
|
|
|
|
|
|
|
|
|
if (summoned) |
|
|
|
if (summoned) |
|
|
|
this.type = 1; //summoned
|
|
|
|
this.agentType = Enum.AIAgentType.PET; //summoned
|
|
|
|
else |
|
|
|
else |
|
|
|
this.type = 2; //charmed
|
|
|
|
this.agentType = Enum.AIAgentType.CHARMED; |
|
|
|
|
|
|
|
|
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) { |
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) { |
|
|
|
((Mob) this).setOwner(owner); |
|
|
|
((Mob) this).setOwner(owner); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setGuard() { |
|
|
|
|
|
|
|
this.type = 3; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isMob() { |
|
|
|
public boolean isMob() { |
|
|
|
return (this.type == 0); |
|
|
|
return (this.agentType.equals(Enum.AIAgentType.MOBILE)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isPet() { |
|
|
|
public boolean isPet() { |
|
|
|
return (this.type == 1 || this.type == 2); |
|
|
|
|
|
|
|
|
|
|
|
return (this.agentType.equals(Enum.AIAgentType.PET) || |
|
|
|
|
|
|
|
this.agentType.equals(Enum.AIAgentType.CHARMED)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isSummonedPet() { |
|
|
|
public boolean isSummonedPet() { |
|
|
|
return (this.type == 1); |
|
|
|
return (this.agentType.equals(Enum.AIAgentType.PET)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isCharmedPet() { |
|
|
|
public boolean isCharmedPet() { |
|
|
|
return (this.type == 2); |
|
|
|
return (this.agentType.equals(Enum.AIAgentType.CHARMED)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isGuard() { |
|
|
|
public boolean isGuard() { |
|
|
|
return (this.type == 3); |
|
|
|
return (this.agentType.equals(Enum.AIAgentType.GUARD)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean assist() { |
|
|
|
public boolean assist() { |
|
|
|
return this.assist; |
|
|
|
return this.assist; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setAssist(boolean value) { |
|
|
|
|
|
|
|
this.assist = value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void toggleAssist() { |
|
|
|
public void toggleAssist() { |
|
|
|
this.assist = (this.assist) ? false : true; |
|
|
|
this.assist = !this.assist; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getDBID() { |
|
|
|
public int getDBID() { |
|
|
|
|
|
|
|
|
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
return this.getDBID(); |
|
|
|
return this.getDBID(); |
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean clearAggro() { |
|
|
|
|
|
|
|
return clearAggro; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setClearAggro(boolean value) { |
|
|
|
|
|
|
|
this.clearAggro = value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Vector3fImmutable getLastBindLoc() { |
|
|
|
return 0; |
|
|
|
if (this.lastBindLoc == null) |
|
|
|
|
|
|
|
this.lastBindLoc = this.getBindLoc(); |
|
|
|
|
|
|
|
return this.lastBindLoc; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PlayerCharacter getOwner() { |
|
|
|
public PlayerCharacter getOwner() { |
|
|
|
|
|
|
|
|
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
if (this.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
return this.getOwner(); |
|
|
|
return this.getOwner(); |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean getSafeZone() { |
|
|
|
public boolean getSafeZone() { |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc()); |
|
|
|
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc()); |
|
|
|
for (Zone zone : allIn) { |
|
|
|
|
|
|
|
|
|
|
|
for (Zone zone : allIn) |
|
|
|
if (zone.getSafeZone() == (byte) 1) |
|
|
|
if (zone.getSafeZone() == (byte) 1) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
//return this.safeZone;
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public abstract AbstractWorldObject getFearedObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getAggroRange() { |
|
|
|
public float getAggroRange() { |
|
|
|
float ret = MobAIThread.AI_BASE_AGGRO_RANGE; |
|
|
|
float ret = MobAIThread.AI_BASE_AGGRO_RANGE; |
|
|
|
if (this.bonuses != null) |
|
|
|
if (this.bonuses != null) |
|
|
@ -212,9 +176,8 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { |
|
|
|
} else { //revert charmed pet
|
|
|
|
} else { //revert charmed pet
|
|
|
|
this.setMob(); |
|
|
|
this.setMob(); |
|
|
|
this.setCombatTarget(null); |
|
|
|
this.setCombatTarget(null); |
|
|
|
// if (this.isAlive())
|
|
|
|
|
|
|
|
// WorldServer.updateObject(this);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//clear owner
|
|
|
|
//clear owner
|
|
|
|
PlayerCharacter owner = this.getOwner(); |
|
|
|
PlayerCharacter owner = this.getOwner(); |
|
|
|
|
|
|
|
|
|
|
|