|
|
@ -13,6 +13,7 @@ import engine.Enum.GameObjectType; |
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.gameManager.*; |
|
|
|
import engine.gameManager.*; |
|
|
|
|
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.*; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
@ -70,28 +71,24 @@ public class AddNPCCmd extends AbstractDevCmd { |
|
|
|
throwbackError(pc, "Failed to find zone to place npc in."); |
|
|
|
throwbackError(pc, "Failed to find zone to place npc in."); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Building building = null; |
|
|
|
if (target != null) |
|
|
|
if (target != null) |
|
|
|
if (target.getObjectType() == GameObjectType.Building) { |
|
|
|
if (target.getObjectType() == GameObjectType.Building) { |
|
|
|
Building parentBuilding = (Building) target; |
|
|
|
building = (Building)target; |
|
|
|
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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, |
|
|
|
NPCManager.slotCharacterInBuilding(created); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
created.setLoc(created.bindLoc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|