Browse Source

Mobbase cannot be null.

mobile-class-refactor
MagicBot 1 year ago
parent
commit
338110973d
  1. 13
      src/engine/objects/Mob.java

13
src/engine/objects/Mob.java

@ -76,19 +76,18 @@ public class Mob extends AbstractIntelligenceAgent {
public int lastPatrolPointIndex = 0; public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0; public long stopPatrolTime = 0;
public City guardedCity; public City guardedCity;
protected int dbID; //the database ID
public int loadID; public int loadID;
public float spawnRadius; public float spawnRadius;
//used by static mobs //used by static mobs
public int parentZoneUUID; public int parentZoneUUID;
public boolean isSiege = false;
protected int dbID; //the database ID
protected float statLat; protected float statLat;
protected float statLon; protected float statLon;
protected float statAlt; protected float statAlt;
private int currentID; private int currentID;
private int ownerUID = 0; //only used by pets private int ownerUID = 0; //only used by pets
private AbstractWorldObject fearedObject = null; private AbstractWorldObject fearedObject = null;
public boolean isSiege = false;
private long lastAttackTime = 0; private long lastAttackTime = 0;
private int lastMobPowerToken = 0; private int lastMobPowerToken = 0;
private HashMap<Integer, MobEquipment> equip = null; private HashMap<Integer, MobEquipment> equip = null;
@ -1059,7 +1058,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.playerAgroMap.clear(); this.playerAgroMap.clear();
if (this.behaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) if (this.behaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal())
this.spawnTime = (int) (-2.500 * ((Mob) this.npcOwner).building.getRank() + 22.5) * 60; this.spawnTime = (int) (-2.500 * this.npcOwner.building.getRank() + 22.5) * 60;
if (this.isPet()) { if (this.isPet()) {
@ -1149,7 +1148,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
if (this.building == null && this.npcOwner != null && ((Mob) this.npcOwner).behaviourType.ordinal() == MobBehaviourType.GuardCaptain.ordinal()) if (this.building == null && this.npcOwner != null && ((Mob) this.npcOwner).behaviourType.ordinal() == MobBehaviourType.GuardCaptain.ordinal())
this.building = ((Mob) this.npcOwner).building; this.building = this.npcOwner.building;
else if (this.building != null) else if (this.building != null)
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
@ -1748,7 +1747,6 @@ public class Mob extends AbstractIntelligenceAgent {
if (!this.isPet() && !isSiege) if (!this.isPet() && !isSiege)
Mob.mobMapByDBID.put(this.dbID, this); Mob.mobMapByDBID.put(this.dbID, this);
if (this.mobBase != null) {
this.gridObjectType = GridObjectType.DYNAMIC; this.gridObjectType = GridObjectType.DYNAMIC;
this.healthMax = this.mobBase.getHealthMax(); this.healthMax = this.mobBase.getHealthMax();
this.manaMax = 0; this.manaMax = 0;
@ -1761,6 +1759,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.level = (short) this.mobBase.getLevel(); this.level = (short) this.mobBase.getLevel();
//set bonuses //set bonuses
this.bonuses = new PlayerBonuses(this); this.bonuses = new PlayerBonuses(this);
//TODO set these correctly later //TODO set these correctly later
@ -1774,8 +1773,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.defenseRating = (short) this.mobBase.getDefenseRating(); this.defenseRating = (short) this.mobBase.getDefenseRating();
this.isActive = true; this.isActive = true;
}
// Configure parent zone adding this NPC to the // Configure parent zone adding this NPC to the
// zone collection // zone collection

Loading…
Cancel
Save