1package com.runehive.game.world.entity.mob.npc;
3import com.runehive.content.activity.Activity;
4import com.runehive.game.world.World;
5import com.runehive.game.world.entity.EntityType;
6import com.runehive.game.world.entity.combat.Combat;
7import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
8import com.runehive.game.world.entity.mob.Direction;
9import com.runehive.game.world.entity.mob.Mob;
10import com.runehive.game.world.entity.mob.data.PacketType;
11import com.runehive.game.world.entity.mob.npc.definition.NpcDefinition;
12import com.runehive.game.world.position.Area;
13import com.runehive.game.world.position.Position;
14import com.runehive.game.world.region.Region;
15import com.runehive.util.RandomUtils;
16import com.runehive.util.Utility;
17import org.apache.logging.log4j.LogManager;
18import org.apache.logging.log4j.Logger;
20import java.util.Objects;
21import java.util.concurrent.atomic.AtomicInteger;
30 private static final Logger
logger = LogManager.getLogger(
Npc.class);
56 this.walkingRadius = 0;
63 this.faceDirection = direction;
64 this.spawnPosition =
position.copy();
71 this.faceDirection = direction;
72 this.spawnPosition =
position.copy();
105 }
catch (Exception ex) {
106 logger.error(String.format(
"error npc.sequence(): %s",
this), ex);
192 if (obj instanceof
Npc) {
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
static void forActivity(Mob mob, Consumer< Activity > consumer)
Represents the game world.
static void schedule(Task task)
Submits a new event.
static MobList< Npc > getNpcs()
void setRegistered(boolean registered)
final boolean isRegistered()
Entity destroy()
Destroys this entity.
void setPosition(Position position)
final SkillManager skills
Mob(Position position)
Constructs a new Mob.
Method handles small methods for npcs that do not have any parent class.
boolean isAutoRetaliate()
State of the mob's auto retaliate.
String getName()
Gets the name of this entity.
CombatStrategy< Npc > strategy
final Combat< Npc > combat
void addToRegion(Region region)
Adds this entity to the specified region.
void appendDeath()
Handles the mob death.
void sequence()
The method which is invoked every tick.
final Position spawnPosition
static final Logger logger
final AtomicInteger atomicPlayerCount
EntityType getType()
Gets the EntityType.
Npc(int id, Position position, int walkingRadius, int instance, Direction direction)
final Direction faceDirection
void removeFromRegion(Region region)
Removes this entity from the specified region.
final NpcAssistant npcAssistant
void setStrategy(CombatStrategy< Npc > strategy)
int pyroHealth
Pyromancer data.
Npc(int id, Position position)
void register()
Registers an entity to the World.
Npc(int id, int instance, Position position)
boolean equals(Object obj)
CombatStrategy< Npc > getStrategy()
The combat strategy of the mob.
void unregister()
Unregisters an entity from the World.
Npc(int id, Position position, int walkingRadius, Direction direction)
Combat< Npc > getCombat()
The combat of the mob.
Contains the npc definitions.
Handles checking if mobs are in a certain area.
static boolean inWilderness(Position position)
Represents a single tile on the game world.
Represents a single region.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static int inclusive(int min, int max)
Returns a pseudo-random int value between inclusive min and inclusive max.
Handles miscellaneous methods.
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
static Position[] getInnerBoundaries(Position position, int width, int length)
Represents the enumerated directions an entity can walk or face.