Browse Source

player placed NPCs now show correct names

master
FatBoy-DOTC 2 years ago
parent
commit
ad4f9d3540
  1. 24
      src/engine/objects/NPC.java

24
src/engine/objects/NPC.java

@ -87,7 +87,6 @@ public class NPC extends AbstractCharacter {
public ArrayList<ProducedItem> forgedItems = new ArrayList<>(); public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
public HashMap<Integer, MobEquipment> equip = null; public HashMap<Integer, MobEquipment> equip = null;
private String nameOverride = "";
private int equipmentSetID = 0; private int equipmentSetID = 0;
public int runeSetID = 0; public int runeSetID = 0;
@ -240,8 +239,10 @@ public class NPC extends AbstractCharacter {
if (this.upgradeDateTime != null) if (this.upgradeDateTime != null)
submitUpgradeJob(); submitUpgradeJob();
this.name = this.contract.getName(); this.name = rs.getString("npc_name");
this.nameOverride = rs.getString("npc_name"); if(this.building != null && this.building.getOwner() != null){
this.name += " the " + this.contract.getName();
}
}catch(Exception e){ }catch(Exception e){
Logger.error(e); Logger.error(e);
@ -620,23 +621,8 @@ public class NPC extends AbstractCharacter {
writer.putInt(0xFF665EC3); //Spi writer.putInt(0xFF665EC3); //Spi
writer.putInt(0); writer.putInt(0);
if (!npc.nameOverride.isEmpty()){
writer.putString(npc.nameOverride);
writer.putInt(0);
}else
if (npc.contract != null) {
if (npc.contract.isTrainer()) {
writer.putString(npc.name + ", " + npc.contract.getName());
writer.putString("");
} else {
writer.putString(npc.name);
writer.putString(npc.contract.getName());
}
} else {
writer.putString(npc.name); writer.putString(npc.name);
writer.putString(""); writer.putString("");
}
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -1473,7 +1459,7 @@ public class NPC extends AbstractCharacter {
} }
public String getNameOverride() { public String getNameOverride() {
return nameOverride; return name;
} }
public static NPCProfits GetNPCProfits(NPC npc){ public static NPCProfits GetNPCProfits(NPC npc){

Loading…
Cancel
Save