|
|
|
@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
|
|
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
|
import engine.gameManager.*; |
|
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
|
import engine.objects.*; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
@ -70,28 +71,24 @@ public class AddNPCCmd extends AbstractDevCmd {
@@ -70,28 +71,24 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|
|
|
|
throwbackError(pc, "Failed to find zone to place npc in."); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Building building = null; |
|
|
|
|
if (target != null) |
|
|
|
|
if (target.getObjectType() == GameObjectType.Building) { |
|
|
|
|
Building parentBuilding = (Building) target; |
|
|
|
|
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level); |
|
|
|
|
return; |
|
|
|
|
building = (Building)target; |
|
|
|
|
} |
|
|
|
|
NPC created; |
|
|
|
|
Guild guild = null; |
|
|
|
|
if(building != null){ |
|
|
|
|
guild = building.getGuild(); |
|
|
|
|
} |
|
|
|
|
created = NPC.createNPC(name, contractID, Vector3fImmutable.ZERO, guild, zone, (short)level, building); |
|
|
|
|
if(building != null) { |
|
|
|
|
created.buildingUUID = building.getObjectUUID(); |
|
|
|
|
created.building = building; |
|
|
|
|
|
|
|
|
|
NPC npc = NPC.createNPC(name, contractID, |
|
|
|
|
pc.getLoc(), null, zone, (short) level, null); |
|
|
|
|
|
|
|
|
|
if (npc != null) { |
|
|
|
|
WorldGrid.addObject(npc, pc); |
|
|
|
|
ChatManager.chatSayInfo(pc, |
|
|
|
|
"NPC with ID " + npc.getDBID() + " added"); |
|
|
|
|
this.setResult(String.valueOf(npc.getDBID())); |
|
|
|
|
} else { |
|
|
|
|
throwbackError(pc, "Failed to create npc of contract type " |
|
|
|
|
+ contractID); |
|
|
|
|
Logger.error( |
|
|
|
|
"Failed to create npc of contract type " + contractID); |
|
|
|
|
NPCManager.slotCharacterInBuilding(created); |
|
|
|
|
} |
|
|
|
|
created.setLoc(created.bindLoc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|