Browse Source

Init forge support only for valid contracts

combat-2
MagicBot 7 months ago
parent
commit
85e5e2a7e3
  1. 4
      src/engine/net/client/msg/ManageNPCMsg.java
  2. 5
      src/engine/objects/NPC.java

4
src/engine/net/client/msg/ManageNPCMsg.java

@ -434,10 +434,6 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -434,10 +434,6 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.put((byte) template.modTable);//EffectItemType
}
// Sanity check.
ForgeManager.vendorItemLookup.computeIfAbsent(npc, k -> new ArrayList<>()); // Forge lookup
writer.putInt(ForgeManager.vendorItemLookup.get(npc).size());
for (Item item : ForgeManager.vendorItemLookup.get(npc)) {

5
src/engine/objects/NPC.java

@ -869,6 +869,11 @@ public class NPC extends AbstractCharacter { @@ -869,6 +869,11 @@ public class NPC extends AbstractCharacter {
if (this.building != null)
NPCManager.slotCharacterInBuilding(this);
// If NPC is a vendor create arraylist for forge
if (this.contract.isTrainer() == false)
ForgeManager.vendorItemLookup.computeIfAbsent(this, k -> new ArrayList<>()); // Forge lookup
this.symbol = this.contract.getIconID();
this.modTypeTable = this.contract.getNPCModTypeTable();
this.modSuffixTable = this.contract.getNpcModSuffixTable();

Loading…
Cancel
Save