Browse Source

player placed mobiles now show correct names

master
FatBoy-DOTC 2 years ago
parent
commit
6868c9de24
  1. 4
      src/engine/ai/MobileFSM.java
  2. 29
      src/engine/objects/Mob.java

4
src/engine/ai/MobileFSM.java

@ -385,9 +385,9 @@ public class MobileFSM {
mob.updateLocation(); mob.updateLocation();
if (mob.BehaviourType != Enum.MobBehaviourType.Pet1) { if (mob.BehaviourType != Enum.MobBehaviourType.Pet1) {
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal() && (mob.npcOwner).isAlive()) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal())
return; return;
}
Patrol(mob); Patrol(mob);
} }
else { else {

29
src/engine/objects/Mob.java

@ -120,7 +120,9 @@ public class Mob extends AbstractIntelligenceAgent {
if (contractID == 0) this.contract = null; if (contractID == 0) this.contract = null;
else this.contract = DbManager.ContractQueries.GET_CONTRACT(contractID); else this.contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if(building != null && building.getOwner()!= null){
this.lastName = "the " + contract.getName();
}
clearStatic(); clearStatic();
} }
@ -253,13 +255,13 @@ public class Mob extends AbstractIntelligenceAgent {
this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class); this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class);
this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class); this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class);
this.firstName = rs.getString("mob_name");
if (this.contract != null) { if (this.contract != null) {
this.equipmentSetID = this.contract.getEquipmentSet(); this.equipmentSetID = this.contract.getEquipmentSet();
this.nameOverride = this.getContract().getName(); this.lastName = this.getContract().getName();
} else { } else {
this.equipmentSetID = rs.getInt("equipmentSet"); this.equipmentSetID = rs.getInt("equipmentSet");
this.nameOverride = rs.getString("mob_name");
} }
if (rs.getString("fsm").length() > 1) this.BehaviourType = MobBehaviourType.valueOf(rs.getString("fsm")); if (rs.getString("fsm").length() > 1) this.BehaviourType = MobBehaviourType.valueOf(rs.getString("fsm"));
@ -328,14 +330,11 @@ public class Mob extends AbstractIntelligenceAgent {
writer.putInt(0xFF665EC3); //Spi writer.putInt(0xFF665EC3); //Spi
writer.putInt(0); writer.putInt(0);
if (!mob.nameOverride.isEmpty()) {
writer.putString(mob.nameOverride);
writer.putInt(0);
} else {
writer.putString(mob.firstName); writer.putString(mob.firstName);
writer.putString(mob.lastName); writer.putString(mob.lastName);
}
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -706,10 +705,7 @@ public class Mob extends AbstractIntelligenceAgent {
else if (guardCaptain.getRank() == 6) rank = MBServerStatics.VETERAN; else if (guardCaptain.getRank() == 6) rank = MBServerStatics.VETERAN;
else rank = MBServerStatics.ELITE; else rank = MBServerStatics.ELITE;
if (rank.isEmpty())
mob.nameOverride = pirateName + " " + minionType.getRace() + " " + minionType.getName();
else
mob.nameOverride = pirateName + " " + minionType.getRace() + " " + rank + " " + minionType.getName();
} }
} }
@ -888,11 +884,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.mana.set(this.manaMax); this.mana.set(this.manaMax);
this.stamina.set(this.staminaMax); this.stamina.set(this.staminaMax);
if (!this.nameOverride.isEmpty())
this.firstName = this.nameOverride;
else
this.firstName = this.mobBase.getFirstName();
if (isPet) if (isPet)
this.setObjectTypeMask(MBServerStatics.MASK_PET | this.getTypeMasks()); this.setObjectTypeMask(MBServerStatics.MASK_PET | this.getTypeMasks());
@ -1990,7 +1981,7 @@ public class Mob extends AbstractIntelligenceAgent {
} }
public String getNameOverride() { public String getNameOverride() {
return nameOverride; return firstName + " " + lastName;
} }
public void processUpgradeMob(PlayerCharacter player) { public void processUpgradeMob(PlayerCharacter player) {

Loading…
Cancel
Save