package org.apollo.game.model;

import org.apollo.game.model.def.NpcDefinition;
import org.apollo.game.sync.block.SynchronizationBlock;

/**
 * An {@link Npc} is a {@link Mob} that is not being controlled by a player.
 * 
 * @author Major
 */
@SuppressWarnings("serial")
public final class Npc extends Mob {

	/**
	 * Creates a new npc with the specified id and {@link Position}.
	 * 
	 * @param id The id.
	 * @param position The position.
	 */
	public Npc(int id, Position position) {
		this(NpcDefinition.lookup(id), position);
	}

	/**
	 * Creates a new npc with the specified {@link NpcDefinition} and {@link Position}.
	 * 
	 * @param definition The definition.
	 * @param position The position.
	 */
	public Npc(NpcDefinition definition, Position position) {
		super(position);
		this.definition = definition;
	}

	/**
	 * Gets the id of this npc. Shorthand for {@link #getDefinition().getId()}.
	 * 
	 * @return The id.
	 */
	public int getId() {
		return definition.getId();
	}

	/**
	 * Transforms this npc into the npc with the specified id.
	 * 
	 * @param id The id.
	 */
	public void transform(int id) {
		if (id < 0 || id >= NpcDefinition.count()) {
			throw new IllegalArgumentException("Id to transform to is out of bounds.");
		}
		definition = NpcDefinition.lookup(id);
		blockSet.add(SynchronizationBlock.createTransformBlock(id));
	}

	@Override
	public EntityType getEntityType() {
		return EntityType.NPC;
	}

	@Override
	public String toString() {
		return "[" + Npc.class.getName() + ": id=" + definition.getId() + ", name=" + definition.getName() + "]";
	}

}
@@ -302,16 +302,134 @@
  Mob %7B%0A%0A
+%09/**%0A%09 * The positions representing the bounds (i.e. walking limits) of this npc.%0A%09 */%0A%09private Position%5B%5D boundary;%0A%0A
 %09/**%0A%09 *
@@ -954,151 +954,1005 @@
 the 
-id of this npc. Shorthand for %7B@link #getDefinition().getId()%7D.%0A%09 * %0A%09 * @return The id.%0A%09 */%0A%09public int getId() %7B%0A%09%09return definition.getId()
+boundary of this npc.%0A%09 * %0A%09 * @return The boundary.%0A%09 */%0A%09public Position%5B%5D getBoundary() %7B%0A%09%09return boundary;%0A%09%7D%0A%0A%09@Override%0A%09public EntityType getEntityType() %7B%0A%09%09return EntityType.NPC;%0A%09%7D%0A%0A%09/**%0A%09 * Gets the id of this npc. Shorthand for %7B@link #getDefinition().getId()%7D.%0A%09 * %0A%09 * @return The id.%0A%09 */%0A%09public int getId() %7B%0A%09%09return definition.getId();%0A%09%7D%0A%0A%09/**%0A%09 * Indicates whether or not this npc is bound to a specific set of coordinates.%0A%09 * %0A%09 * @return %7B@code true%7D if the npc is bound, otherwise %7B@code false%7D.%0A%09 */%0A%09public boolean isBound() %7B%0A%09%09return boundary == null;%0A%09%7D%0A%0A%09/**%0A%09 * Sets the boundary of this npc.%0A%09 * %0A%09 * @param boundary The boundary.%0A%09 */%0A%09public void setBoundary(Position%5B%5D boundary) %7B%0A%09%09if (boundary.length != 4) %7B%0A%09%09%09throw new IllegalArgumentException(%22Boundary count must be 4.%22);%0A%09%09%7D%0A%09%09this.boundary = boundary;%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22%5B%22 + Npc.class.getName() + %22: id=%22 + definition.getId() + %22, name=%22 + definition.getName() + %22%5D%22
 ;%0A%09%7D
@@ -2325,233 +2325,5 @@
 %09%7D%0A%0A
-%09@Override%0A%09public EntityType getEntityType() %7B%0A%09%09return EntityType.NPC;%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22%5B%22 + Npc.class.getName() + %22: id=%22 + definition.getId() + %22, name=%22 + definition.getName() + %22%5D%22;%0A%09%7D%0A%0A
 %7D

Add Npc boundaries.