Tweak to name derivation in constructor

This commit is contained in:
2023-04-29 16:32:12 -04:00
parent a3217f44be
commit 4365fafb77
+8 -11
View File
@@ -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"); int buildingID = rs.getInt("npc_buildingID");
this.building = BuildingManager.getBuilding(buildingID);
try{
this.building = BuildingManager.getBuilding(buildingID);
}catch(Exception e){
this.building = null;
Logger.error( e.getMessage());
}
this.name = rs.getString("npc_name");
// 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();