Browse Source

Tweak to name derivation in constructor

master
MagicBot 2 years ago
parent
commit
4365fafb77
  1. 19
      src/engine/objects/NPC.java

19
src/engine/objects/NPC.java

@ -190,17 +190,9 @@ public class NPC extends AbstractCharacter {
this.mobBase = MobBase.getMobBase(this.loadID); this.mobBase = MobBase.getMobBase(this.loadID);
this.level = rs.getByte("npc_level"); this.level = rs.getByte("npc_level");
this.isMob = false; this.isMob = false;
int buildingID = rs.getInt("npc_buildingID");
try{
this.building = BuildingManager.getBuilding(buildingID);
}catch(Exception e){
this.building = null;
Logger.error( e.getMessage());
}
this.name = rs.getString("npc_name"); int buildingID = rs.getInt("npc_buildingID");
this.building = BuildingManager.getBuilding(buildingID);
// Most objects from the cache have a default buy // Most objects from the cache have a default buy
// percentage of 100% which was a dupe source due // percentage of 100% which was a dupe source due
@ -247,11 +239,16 @@ public class NPC extends AbstractCharacter {
if (this.upgradeDateTime != null) if (this.upgradeDateTime != null)
submitUpgradeJob(); submitUpgradeJob();
if (this.contract != null) this.name = rs.getString("npc_name");
// Zone cache can override contract name
if (this.nameOverride.isEmpty())
this.nameOverride = rs.getString("npc_name") + " the " + this.getContract().getName(); this.nameOverride = rs.getString("npc_name") + " the " + this.getContract().getName();
else else
this.nameOverride = rs.getString("npc_name"); this.nameOverride = rs.getString("npc_name");
}catch(Exception e){ }catch(Exception e){
Logger.error(e); Logger.error(e);
e.printStackTrace(); e.printStackTrace();

Loading…
Cancel
Save