RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.world.position.Position Class Reference

Represents a single tile on the game world. More...

Public Member Functions

Position copy ()
 Creates a deep copy of this location.
Position east ()
boolean equals (Object obj)
int getChebyshevDistance (int x1, int y1, int x2, int y2)
int getChebyshevDistance (Position other)
int getChevDistance (Position other)
int getChunkX ()
 Gets the chunk x coordinate.
int getChunkY ()
 Gets the chunk y coordinate.
int getCoordFaceX (final int sizeX)
int getCoordFaceX (final int sizeX, final int sizeY, final int rotation)
int getCoordFaceY (final int sizeX, final int sizeY, final int rotation)
int getCoordFaceY (final int sizeY)
Position getDelta (Position location, Position other)
double getDistance (Position other)
 Gets the distance between this location and another location.
int getDistances (Position other)
 Absolute distance between this Coordiante and another.
int getHeight ()
 Gets the height coordinate, or height.
int getLocalX ()
 Gets the local x coordinate relative to this region.
int getLocalX (Position origin)
 Gets the local x coordinate relative to a specific region.
int getLocalY ()
 Gets the local y coordinate relative to this region.
int getLocalY (Position origin)
 Gets the local y coordinate relative to a specific region.
int getLongestDelta (Position other)
 Gets the longest horizontal or vertical delta between the two positions.
int getManhattanDistance (Position other)
 Gets the distance between this location and another location without diagonals.
Region getRegion ()
int getRegionX ()
int getRegionY ()
int getX ()
 Gets the absolute x coordinate.
int getY ()
 Gets the absolute y coordinate.
int hashCode ()
boolean inLocation (Position southWest, Position northEast, boolean inclusive)
boolean isViewableFrom (Position other)
boolean isWithinDistance (Position other, int radius)
 Checks if this location is within range of another.
boolean matches (int x, int y)
boolean matches (int x, int y, int z)
Position north ()
Position northEast ()
Position northWest ()
 Position (int x, int y)
 Creates a location with a default height of 0.
 Position (int x, int y, int height)
 Creates a location.
Position south ()
Position southEast ()
Position southWest ()
String toString ()
Position transform (int diffX, int diffY)
 Creates a new location based on this location.
Position transform (int diffX, int diffY, int diffZ)
 Creates a new location based on this location.
Position transform (Position other)
 Creates a new location based on this location.
Position west ()

Static Public Member Functions

static Position create (int x, int y)
 Creates a location.
static Position create (int x, int y, int z)
 Creates a location.
static double getDistance (Position first, Position second)
 Gets the Euclidean (straight-line) distance between two Position s.
static int getManhattanDistance (Interactable origin, Interactable target)
 Gets the manhattan distance between two interactable object.
static int getManhattanDistance (Position first, Position second)
 Gets the Euclidean (straight-line) distance between two Position s.
static int hash (int x, int y, int z)
static boolean isWithinDiagonalDistance (Mob attacker, Mob defender, int distance)

Static Public Attributes

static final int HEIGHT_LEVELS = 4
 The maximum amount of height-planes.

Private Attributes

final int height
 The height coordinate.
final int x
 The x coordinate.
final int y
 The y coordinate.

Detailed Description

Represents a single tile on the game world.

Author
Graham Edgecombe

Definition at line 14 of file Position.java.

Constructor & Destructor Documentation

◆ Position() [1/2]

com.runehive.game.world.position.Position.Position ( int x,
int y )

Creates a location with a default height of 0.

Definition at line 29 of file Position.java.

29 {
30 this(x, y, 0);
31 }

References x, and y.

Referenced by copy(), create(), create(), east(), equals(), getChebyshevDistance(), getChevDistance(), getDelta(), getDistance(), getDistance(), getDistances(), getLocalX(), getLocalY(), getLongestDelta(), getManhattanDistance(), getManhattanDistance(), com.runehive.content.ai.AIDialogueHandler.handleAICommand(), inLocation(), isViewableFrom(), isWithinDiagonalDistance(), isWithinDistance(), north(), northEast(), northWest(), south(), southEast(), southWest(), transform(), transform(), transform(), and west().

Here is the caller graph for this function:

◆ Position() [2/2]

com.runehive.game.world.position.Position.Position ( int x,
int y,
int height )

Creates a location.

Definition at line 34 of file Position.java.

34 {
35 this.x = x;
36 this.y = y;
37 this.height = height < 0 ? 0 : height % 4;
38 }

References height, x, and y.

Member Function Documentation

◆ copy()

Position com.runehive.game.world.position.Position.copy ( )

Creates a deep copy of this location.

Returns
A deep copy of this location.

Definition at line 314 of file Position.java.

314 {
315 return new Position(x, y, height);
316 }

References height, Position(), x, and y.

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.VenomSpecial.dragonFireTickableTask(), com.runehive.game.world.entity.mob.npc.drop.NpcDropManager.drop(), com.runehive.net.packet.out.SendMapRegion.encode(), com.runehive.net.packet.in.DropItemPacketListener.handlePacket(), isWithinDiagonalDistance(), com.runehive.content.lms.lobby.LMSLobby.leaveLobby(), com.runehive.content.Waypoints.setWaypoint(), com.runehive.game.world.entity.mob.Viewport.shouldRemove(), com.runehive.game.world.entity.combat.strategy.npc.boss.Callisto.Roar.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.FireballAttack.start(), and com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.VenomSpecial.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [1/2]

Position com.runehive.game.world.position.Position.create ( int x,
int y )
static

Creates a location.

Parameters
xThe x coordinate.
yThe y coordinate.
Returns
The location.

Definition at line 266 of file Position.java.

266 {
267 return new Position(x, y);
268 }

References Position(), x, and y.

Here is the call graph for this function:

◆ create() [2/2]

Position com.runehive.game.world.position.Position.create ( int x,
int y,
int z )
static

Creates a location.

Parameters
xThe x coordinate.
yThe y coordinate.
zThe height coordinate.
Returns
The location.

Definition at line 255 of file Position.java.

255 {
256 return new Position(x, y, z);
257 }

References Position(), x, and y.

Referenced by com.runehive.content.gambling.GambleManager.canPlayFlowerPokerAtPositon(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), com.runehive.content.gambling.impl.FlowerPoker.gamble(), com.runehive.util.Utility.getDelta(), com.runehive.util.Utility.getDelta(), com.runehive.content.bot.objective.impl.WildernessDitchObjective.init(), com.runehive.content.bot.objective.impl.WildernessWalkObjective.init(), com.runehive.content.skill.impl.agility.obstacle.impl.ClimbOverInteraction.onExecution(), com.runehive.content.skill.impl.agility.obstacle.impl.RopeSwingInteraction.onExecution(), com.runehive.content.skill.impl.prayer.BoneSacrifice.sacrifice(), and com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.GhostAttack.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ east()

Position com.runehive.game.world.position.Position.east ( )

Definition at line 101 of file Position.java.

101 {
102 return transform(1, 0);
103 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), and com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

boolean com.runehive.game.world.position.Position.equals ( Object obj)

Definition at line 319 of file Position.java.

319 {
320 if (obj == this) return true;
321
322 if (obj instanceof Position) {
323 Position other = (Position) obj;
324 return x == other.x && y == other.y && height == other.height;
325 }
326
327 return false;
328 }

References height, Position(), x, and y.

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.VenomSpecial.AcidTask(), com.runehive.content.skill.impl.firemaking.Firemaking.clickObject(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.VenomSpecial.dragonFireTickableTask(), com.runehive.game.world.items.ground.GroundItem.equals(), com.runehive.game.world.object.CustomGameObject.equals(), com.runehive.content.skill.impl.agility.obstacle.ObstacleInteraction.execute(), com.runehive.game.world.pathfinding.path.impl.AStarPathFinder.find(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), com.runehive.util.Utility.findBestInside(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.FireballAttack.hit(), com.runehive.game.world.entity.combat.strategy.npc.boss.Zulrah.MeleeAttack.hit(), com.runehive.game.world.entity.combat.strategy.player.custom.ScytheOfViturStrategy.hitEvent(), com.runehive.util.Utility.inside(), com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.LavaAttack.lavaTask(), com.runehive.content.skill.impl.agility.obstacle.impl.WildernessDoorInteraction.onExecution(), com.runehive.game.world.entity.combat.strategy.npc.boss.Hydra.poisonTask(), com.runehive.game.world.entity.combat.strategy.npc.boss.ChaosFanatic.RainAttack.start(), and com.runehive.game.world.entity.combat.strategy.npc.boss.CrazyArchaeologist.RainAttack.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChebyshevDistance() [1/2]

int com.runehive.game.world.position.Position.getChebyshevDistance ( int x1,
int y1,
int x2,
int y2 )

Definition at line 386 of file Position.java.

386 {
387 return Math.max(Math.abs(x2 - x1), Math.abs(y2 - y1));
388 }

◆ getChebyshevDistance() [2/2]

int com.runehive.game.world.position.Position.getChebyshevDistance ( Position other)

Definition at line 382 of file Position.java.

382 {
383 return getChebyshevDistance(getX(), getY(), other.getX(), other.getY());
384 }

References getChebyshevDistance(), getX(), getY(), and Position().

Referenced by com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), getChebyshevDistance(), and com.runehive.game.world.entity.combat.strategy.player.PlayerMagicStrategy.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChevDistance()

int com.runehive.game.world.position.Position.getChevDistance ( Position other)

Definition at line 180 of file Position.java.

180 {
181 return Math.max(Math.abs(other.getX() - getX()), Math.abs(other.getY() - getY()));
182 }

References getX(), getY(), and Position().

Here is the call graph for this function:

◆ getChunkX()

int com.runehive.game.world.position.Position.getChunkX ( )

Gets the chunk x coordinate.

Definition at line 76 of file Position.java.

76 {
77 return (x >> 3) - 6;
78 }

References x.

Referenced by com.runehive.net.packet.out.SendMapRegion.encode(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), getLocalX(), getRegionX(), and com.runehive.util.Utility.isRegionChange().

Here is the caller graph for this function:

◆ getChunkY()

int com.runehive.game.world.position.Position.getChunkY ( )

Gets the chunk y coordinate.

Definition at line 81 of file Position.java.

81 {
82 return (y >> 3) - 6;
83 }

References y.

Referenced by com.runehive.net.packet.out.SendMapRegion.encode(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), getLocalY(), getRegionY(), and com.runehive.util.Utility.isRegionChange().

Here is the caller graph for this function:

◆ getCoordFaceX() [1/2]

int com.runehive.game.world.position.Position.getCoordFaceX ( final int sizeX)

Definition at line 390 of file Position.java.

390 {
391 return getCoordFaceX(sizeX, -1, -1);
392 }

References getCoordFaceX().

Referenced by getCoordFaceX().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCoordFaceX() [2/2]

int com.runehive.game.world.position.Position.getCoordFaceX ( final int sizeX,
final int sizeY,
final int rotation )

Definition at line 394 of file Position.java.

394 {
395 return getX() + ((rotation == 1 || rotation == 3 ? sizeY : sizeX) - 1) / 2;
396 }

References getX().

Here is the call graph for this function:

◆ getCoordFaceY() [1/2]

int com.runehive.game.world.position.Position.getCoordFaceY ( final int sizeX,
final int sizeY,
final int rotation )

Definition at line 402 of file Position.java.

402 {
403 return getY() + ((rotation == 1 || rotation == 3 ? sizeX : sizeY) - 1) / 2;
404 }

References getY().

Here is the call graph for this function:

◆ getCoordFaceY() [2/2]

int com.runehive.game.world.position.Position.getCoordFaceY ( final int sizeY)

Definition at line 398 of file Position.java.

398 {
399 return getCoordFaceY(-1, sizeY, -1);
400 }

References getCoordFaceY().

Referenced by getCoordFaceY().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDelta()

Position com.runehive.game.world.position.Position.getDelta ( Position location,
Position other )

Definition at line 218 of file Position.java.

218 {
219 return new Position(other.x - location.x, other.y - location.y, other.getHeight() - location.getHeight());
220 }

References getHeight(), Position(), x, and y.

Referenced by com.runehive.game.world.World.executeProjectile(), and isViewableFrom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDistance() [1/2]

double com.runehive.game.world.position.Position.getDistance ( Position first,
Position second )
static

Gets the Euclidean (straight-line) distance between two Position s.

Returns
The distance in tiles between the two locations.

Definition at line 190 of file Position.java.

190 {
191 final int dx = second.getX() - first.getX();
192 final int dy = second.getY() - first.getY();
193 return Math.sqrt(dx * dx + dy * dy);
194 }

References getX(), getY(), and Position().

Here is the call graph for this function:

◆ getDistance() [2/2]

double com.runehive.game.world.position.Position.getDistance ( Position other)

Gets the distance between this location and another location.

Parameters
otherThe other location.
Returns
The distance between the two locations.

Definition at line 163 of file Position.java.

163 {
164 if (height != other.height) return 0;
165 int dx = other.x - x;
166 int dy = other.y - y;
167 return Math.sqrt(dx * dx + dy * dy);
168 }

References height, Position(), x, and y.

Referenced by com.runehive.game.world.pathfinding.path.impl.AStarPathFinder.find(), and com.runehive.game.world.entity.combat.strategy.npc.NpcMagicStrategy.getAttackDelay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDistances()

int com.runehive.game.world.position.Position.getDistances ( Position other)

Absolute distance between this Coordiante and another.

Parameters
otherThe other Coordiante.
Returns
The distance between the 2 Coordinates.

Definition at line 176 of file Position.java.

176 {
177 return (int) Math.sqrt(Math.pow(x - other.x, 2) + Math.pow(y - other.y, 2) + Math.pow(height - other.height, 2));
178 }

References height, Position(), x, and y.

Referenced by com.runehive.content.lms.LMSGame.handleFogDamage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeight()

int com.runehive.game.world.position.Position.getHeight ( )

Gets the height coordinate, or height.

Definition at line 51 of file Position.java.

51 {
52 return height;
53 }

References height.

Referenced by com.runehive.game.world.pathfinding.path.SimplePathChecker.check(), com.runehive.game.world.pathfinding.path.impl.Node.equals(), com.runehive.game.world.pathfinding.path.impl.AStarPathFinder.find(), com.runehive.game.world.pathfinding.path.impl.AStarPathFinder.find(), com.runehive.game.world.pathfinding.path.impl.AStarPathFinder.find(), com.runehive.content.ai.AIDialogueHandler.findNearbyNpc(), getDelta(), com.runehive.util.Utility.getDelta(), com.runehive.util.Utility.getDistance(), com.runehive.game.world.Interactable.getHeight(), com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), com.runehive.content.ai.AIDialogueHandler.handleAICommand(), com.runehive.content.ai.LazyAIManager.handleGandalfAIClick(), com.runehive.game.world.pathfinding.path.impl.Node.hashCode(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), isViewableFrom(), com.runehive.content.wintertodt.Wintertodt.shootFlame(), com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.shoulderShot(), transform(), com.runehive.util.Utility.within(), com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.withinDistance(), and com.runehive.util.Utility.withinOctal().

Here is the caller graph for this function:

◆ getLocalX() [1/2]

int com.runehive.game.world.position.Position.getLocalX ( )

Gets the local x coordinate relative to this region.

Definition at line 56 of file Position.java.

56 {
57 return getLocalX(this);
58 }

References getLocalX().

Referenced by com.runehive.net.packet.out.SendPlayerUpdate.appendForceMovementMask(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), getLocalX(), com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.shoulderShot(), and com.runehive.net.packet.out.SendPlayerUpdate.updateMovement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLocalX() [2/2]

int com.runehive.game.world.position.Position.getLocalX ( Position origin)

Gets the local x coordinate relative to a specific region.

Definition at line 66 of file Position.java.

66 {
67 return x - 8 * origin.getChunkX();
68 }

References getChunkX(), Position(), and x.

Here is the call graph for this function:

◆ getLocalY() [1/2]

int com.runehive.game.world.position.Position.getLocalY ( )

Gets the local y coordinate relative to this region.

Definition at line 61 of file Position.java.

61 {
62 return getLocalY(this);
63 }

References getLocalY().

Referenced by com.runehive.net.packet.out.SendPlayerUpdate.appendForceMovementMask(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), getLocalY(), com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.shoulderShot(), and com.runehive.net.packet.out.SendPlayerUpdate.updateMovement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLocalY() [2/2]

int com.runehive.game.world.position.Position.getLocalY ( Position origin)

Gets the local y coordinate relative to a specific region.

Definition at line 71 of file Position.java.

71 {
72 return y - 8 * origin.getChunkY();
73 }

References getChunkY(), Position(), and y.

Here is the call graph for this function:

◆ getLongestDelta()

int com.runehive.game.world.position.Position.getLongestDelta ( Position other)

Gets the longest horizontal or vertical delta between the two positions.

Parameters
otherThe other position.
Returns
The longest horizontal or vertical delta.

Definition at line 240 of file Position.java.

240 {
241 if (height != other.height) return 0;
242 int deltaX = Math.abs(getX() - other.getX());
243 int deltaY = Math.abs(getY() - other.getY());
244 return Math.max(deltaX, deltaY);
245 }

References getX(), getY(), height, and Position().

Referenced by com.runehive.game.world.pathfinding.path.impl.SimplePathFinder.find().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getManhattanDistance() [1/3]

int com.runehive.game.world.position.Position.getManhattanDistance ( Interactable origin,
Interactable target )
static

Gets the manhattan distance between two interactable object.

Parameters
originThe originating location.
targetThe target location.
Returns
The distance between the origin and target.

Definition at line 136 of file Position.java.

136 {
137 return Utility.getDistance(origin, target);
138 }

References com.runehive.util.Utility.getDistance().

Here is the call graph for this function:

◆ getManhattanDistance() [2/3]

int com.runehive.game.world.position.Position.getManhattanDistance ( Position first,
Position second )
static

Gets the Euclidean (straight-line) distance between two Position s.

Returns
The distance in tiles between the two locations.

Definition at line 228 of file Position.java.

228 {
229 final int dx = Math.abs(second.getX() - first.getX());
230 final int dy = Math.abs(second.getY() - first.getY());
231 return dx + dy;
232 }

References getX(), getY(), and Position().

Here is the call graph for this function:

◆ getManhattanDistance() [3/3]

int com.runehive.game.world.position.Position.getManhattanDistance ( Position other)

Gets the distance between this location and another location without diagonals.

Parameters
otherThe other location.
Returns
The distance between the two locations.

Definition at line 203 of file Position.java.

203 { //dont use this, it calcs wrong btw
204 if (other == null || height != other.height) return Integer.MAX_VALUE;
205 int dx = Math.abs(other.x - x);
206 int dy = Math.abs(other.y - y);
207 return dx + dy;
208 }

References height, Position(), x, and y.

Here is the call graph for this function:

◆ getRegion()

Region com.runehive.game.world.position.Position.getRegion ( )

Definition at line 93 of file Position.java.

93 {
94 return World.getRegions().getRegion(this);
95 }

References com.runehive.game.world.region.RegionManager.getRegion(), and com.runehive.game.world.World.getRegions().

Referenced by com.runehive.game.world.object.StaticGameObject.active(), com.runehive.game.world.object.StaticGameObject.register(), and com.runehive.game.world.object.StaticGameObject.unregister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRegionX()

int com.runehive.game.world.position.Position.getRegionX ( )

Definition at line 85 of file Position.java.

85 {
86 return getChunkX() / 8;
87 }

References getChunkX().

Here is the call graph for this function:

◆ getRegionY()

int com.runehive.game.world.position.Position.getRegionY ( )

Definition at line 89 of file Position.java.

89 {
90 return getChunkY() / 8;
91 }

References getChunkY().

Here is the call graph for this function:

◆ getX()

int com.runehive.game.world.position.Position.getX ( )

Gets the absolute x coordinate.

Definition at line 41 of file Position.java.

41 {
42 return x;
43 }

References x.

Referenced by com.runehive.net.packet.out.SendNpcUpdate.addNewNpc(), com.runehive.game.world.pathfinding.path.Path.addSteps(), com.runehive.net.packet.out.SendNpcUpdate.appendFaceCoordinateMask(), com.runehive.net.packet.out.SendPlayerUpdate.appendFaceCoordinteMask(), com.runehive.net.packet.out.SendPlayerUpdate.appendForceMovementMask(), com.runehive.content.wintertodt.Wintertodt.breakBrazier(), com.runehive.game.world.pathfinding.distance.Chebyshev.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Chebyshev.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Euclidean.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Manhattan.calculate(), com.runehive.game.world.pathfinding.distance.Euclidean.calculate(), com.runehive.game.world.pathfinding.distance.Manhattan.calculate(), com.runehive.content.skill.impl.hunter.trap.TrapManager.canLay(), com.runehive.content.gambling.GambleManager.canPlayFlowerPokerAtPositon(), com.runehive.game.world.pathfinding.path.SimplePathChecker.check(), com.runehive.content.wintertodt.Wintertodt.doMagicAttack(), com.runehive.content.skill.impl.construction.House.enter(), com.runehive.game.world.pathfinding.path.impl.Node.equals(), com.runehive.game.action.impl.RevShortcutAction.execute(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), com.runehive.util.Utility.findBestInside(), com.runehive.util.Utility.fixInsidePosition(), com.runehive.content.gambling.impl.FlowerPoker.gamble(), getChebyshevDistance(), getChevDistance(), getCoordFaceX(), com.runehive.util.Utility.getDelta(), com.runehive.util.Utility.getDelta(), com.runehive.game.world.entity.mob.Direction.getDirection(), getDistance(), com.runehive.util.Utility.getDistance(), com.runehive.util.Utility.getDistance(), com.runehive.game.world.entity.mob.Direction.getFollowDirection(), getLongestDelta(), com.runehive.game.world.entity.mob.Direction.getManhattanDirection(), getManhattanDistance(), com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), com.runehive.game.world.Interactable.getX(), com.runehive.content.skill.impl.hunter.trap.TrapManager.goodArea(), com.runehive.content.ai.AIDialogueHandler.handleAICommand(), com.runehive.content.ai.LazyAIManager.handleGandalfAIClick(), com.runehive.game.world.pathfinding.path.impl.Node.hashCode(), com.runehive.game.world.position.Area.inArea(), com.runehive.util.Utility.inside(), com.runehive.util.Utility.isRegionChange(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), isWithinDiagonalDistance(), com.runehive.content.lms.lobby.LMSLobby.leaveLobby(), com.runehive.content.skill.impl.agility.obstacle.impl.ClimbOverInteraction.onExecution(), com.runehive.content.skill.impl.agility.obstacle.impl.RopeSwingInteraction.onExecution(), com.runehive.content.skill.impl.agility.obstacle.impl.SteppingStonesInteraction.onExecution(), com.runehive.game.ProjectileTest.ProjectileTest(), com.runehive.game.world.region.Region.reachable(), com.runehive.content.lms.LMSGame.reset(), com.runehive.game.world.World.sendProjectile(), com.runehive.game.world.World.sendProjectile(), com.runehive.game.world.World.sendProjectile(), com.runehive.content.wintertodt.Wintertodt.shootFlame(), com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.shoulderShot(), com.runehive.content.lms.crate.LMSCrate.spawn(), com.runehive.game.world.entity.combat.strategy.npc.boss.Callisto.Roar.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Derwen.LightingRain.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Justiciar.LightingRain.start(), com.runehive.game.world.entity.mob.player.Player.toSceneLocalX(), transform(), com.runehive.util.Utility.within(), com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.withinDistance(), com.runehive.util.Utility.withinOctal(), and com.runehive.util.Utility.withinViewingDistance().

Here is the caller graph for this function:

◆ getY()

int com.runehive.game.world.position.Position.getY ( )

Gets the absolute y coordinate.

Definition at line 46 of file Position.java.

46 {
47 return y;
48 }

References y.

Referenced by com.runehive.net.packet.out.SendNpcUpdate.addNewNpc(), com.runehive.game.world.pathfinding.path.Path.addSteps(), com.runehive.net.packet.out.SendNpcUpdate.appendFaceCoordinateMask(), com.runehive.net.packet.out.SendPlayerUpdate.appendFaceCoordinteMask(), com.runehive.net.packet.out.SendPlayerUpdate.appendForceMovementMask(), com.runehive.content.wintertodt.Wintertodt.breakBrazier(), com.runehive.game.world.pathfinding.distance.Chebyshev.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Chebyshev.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Euclidean.calculate(), com.runehive.game.world.pathfinding.distance.Distance.Manhattan.calculate(), com.runehive.game.world.pathfinding.distance.Euclidean.calculate(), com.runehive.game.world.pathfinding.distance.Manhattan.calculate(), com.runehive.content.skill.impl.hunter.trap.TrapManager.canLay(), com.runehive.content.gambling.GambleManager.canPlayFlowerPokerAtPositon(), com.runehive.game.world.pathfinding.path.SimplePathChecker.check(), com.runehive.content.wintertodt.Wintertodt.doMagicAttack(), com.runehive.content.skill.impl.construction.House.enter(), com.runehive.game.world.pathfinding.path.impl.Node.equals(), com.runehive.game.action.impl.RevShortcutAction.execute(), com.runehive.game.world.pathfinding.path.impl.DijkstraPathFinder.find(), com.runehive.util.Utility.findBestInside(), com.runehive.util.Utility.fixInsidePosition(), com.runehive.content.gambling.impl.FlowerPoker.gamble(), getChebyshevDistance(), getChevDistance(), getCoordFaceY(), com.runehive.util.Utility.getDelta(), com.runehive.util.Utility.getDelta(), com.runehive.game.world.entity.mob.Direction.getDirection(), getDistance(), com.runehive.util.Utility.getDistance(), com.runehive.util.Utility.getDistance(), com.runehive.game.world.entity.mob.Direction.getFollowDirection(), getLongestDelta(), com.runehive.game.world.entity.mob.Direction.getManhattanDirection(), getManhattanDistance(), com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), com.runehive.game.world.Interactable.getY(), com.runehive.content.skill.impl.hunter.trap.TrapManager.goodArea(), com.runehive.content.ai.AIDialogueHandler.handleAICommand(), com.runehive.content.ai.LazyAIManager.handleGandalfAIClick(), com.runehive.game.world.pathfinding.path.impl.Node.hashCode(), com.runehive.game.world.position.Area.inArea(), com.runehive.util.Utility.inside(), com.runehive.util.Utility.isRegionChange(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), com.runehive.game.world.pathfinding.TraversalMap.isTraversable(), isWithinDiagonalDistance(), com.runehive.content.lms.lobby.LMSLobby.leaveLobby(), com.runehive.content.skill.impl.agility.obstacle.impl.ClimbOverInteraction.onExecution(), com.runehive.content.skill.impl.agility.obstacle.impl.RopeSwingInteraction.onExecution(), com.runehive.content.skill.impl.agility.obstacle.impl.SteppingStonesInteraction.onExecution(), com.runehive.game.world.entity.mob.player.Player.onStep(), com.runehive.game.ProjectileTest.ProjectileTest(), com.runehive.game.world.region.Region.reachable(), com.runehive.content.lms.LMSGame.reset(), com.runehive.game.world.World.sendProjectile(), com.runehive.game.world.World.sendProjectile(), com.runehive.game.world.World.sendProjectile(), com.runehive.content.wintertodt.Wintertodt.shootFlame(), com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.shoulderShot(), com.runehive.content.lms.crate.LMSCrate.spawn(), com.runehive.game.world.entity.combat.strategy.npc.boss.Callisto.Roar.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Derwen.LightingRain.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Justiciar.LightingRain.start(), com.runehive.game.world.entity.mob.player.Player.toSceneLocalY(), transform(), com.runehive.util.Utility.within(), com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.withinDistance(), com.runehive.util.Utility.withinOctal(), and com.runehive.util.Utility.withinViewingDistance().

Here is the caller graph for this function:

◆ hash()

int com.runehive.game.world.position.Position.hash ( int x,
int y,
int z )
static

Definition at line 348 of file Position.java.

348 {
349 return (y << 16) | (x << 8) | z;
350 }

References x, and y.

Referenced by hashCode(), com.runehive.fs.cache.decoder.RegionDecoder.parseGameObject(), and com.runehive.fs.cache.decoder.RegionDecoder.parseTerrain().

Here is the caller graph for this function:

◆ hashCode()

int com.runehive.game.world.position.Position.hashCode ( )

Definition at line 339 of file Position.java.

339 {
340 return hash(x, y, height);
341 }

References hash(), height, x, and y.

Here is the call graph for this function:

◆ inLocation()

boolean com.runehive.game.world.position.Position.inLocation ( Position southWest,
Position northEast,
boolean inclusive )

Definition at line 294 of file Position.java.

294 {
295 return !inclusive ? this.x > southWest.getX() && this.x < northEast.getX() && this.y > southWest.getY() && this.y < northEast.getY() : this.x >= southWest.getX() && this.x <= northEast.getX() && this.y >= southWest.getY() && this.y <= northEast.getY();
296 }

References northEast(), Position(), and southWest().

Referenced by com.runehive.content.skill.impl.prayer.BoneSacrifice.sacrifice(), and com.runehive.content.activity.impl.barrows.BarrowsUtility.teleportPlayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isViewableFrom()

boolean com.runehive.game.world.position.Position.isViewableFrom ( Position other)

Definition at line 210 of file Position.java.

210 {
211 if (this.getHeight() != other.getHeight())
212 return false;
213 Position p = this.getDelta(this, other);
214 return p.x <= 14 && p.x >= -15 && p.y <= 14 &&
215 p.y >= -15;
216 }

References getDelta(), getHeight(), and Position().

Referenced by com.runehive.game.world.World.executeProjectile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isWithinDiagonalDistance()

boolean com.runehive.game.world.position.Position.isWithinDiagonalDistance ( Mob attacker,
Mob defender,
int distance )
static

Definition at line 352 of file Position.java.

352 {
353 int attackerSize = 1;
354 int defenderSize = 1;
355
356 if(attacker.isNpc())
357 attackerSize = attacker.getNpc().definition.getSize();
358 if(defender.isNpc())
359 defenderSize = defender.getNpc().definition.getSize();
360
361 int e_offset_x = attackerSize - 1 + distance;
362 int e_offset_y = attackerSize - 1 + distance;
363
364 int o_offset_x = defenderSize - 1 + distance;
365 int o_offset_y = defenderSize - 1 + distance;
366
367 Position entity_pos = attacker.getPosition().copy();
368 Position other_pos = defender.getPosition().copy();
369
370 boolean inside_entity =
371 (other_pos.getX() <= entity_pos.getX() + e_offset_x && other_pos.getX() >= (entity_pos.getX() - distance)) &&
372 (other_pos.getY() <= entity_pos.getY() + e_offset_y && other_pos.getY() >= (entity_pos.getY() - distance));
373
374 boolean inside_other =
375 (entity_pos.getX() <= other_pos.getX() + o_offset_x && entity_pos.getX() >= (other_pos.getX() - distance)) &&
376 (entity_pos.getY() <= other_pos.getY() + o_offset_y && entity_pos.getY() >= (other_pos.getY() - distance));
377
378
379 return inside_entity || inside_other;
380 }

References copy(), com.runehive.game.world.entity.mob.npc.Npc.definition, com.runehive.game.world.entity.mob.Mob.getNpc(), com.runehive.game.world.entity.Entity.getPosition(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.getSize(), getX(), getY(), com.runehive.game.world.entity.mob.Mob.isNpc(), and Position().

Referenced by com.runehive.game.world.entity.combat.strategy.player.custom.ScytheOfViturStrategy.hitEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isWithinDistance()

boolean com.runehive.game.world.position.Position.isWithinDistance ( Position other,
int radius )

Checks if this location is within range of another.

Parameters
otherThe other location.
radiusThe radius from the origin point.
Returns
True if the location is within the radius.

Definition at line 147 of file Position.java.

147 {
148 if (height != other.height) {
149 return false;
150 }
151
152 final int deltaX = Math.abs(other.x - x);
153 final int deltaY = Math.abs(other.y - y);
154 return deltaX <= radius && deltaY <= radius;
155 }

References height, Position(), x, and y.

Referenced by com.runehive.content.activity.infernomobs.Jalimkot.canAttack(), com.runehive.game.world.region.RegionManager.getLocalNpcs(), com.runehive.game.world.region.RegionManager.getLocalPlayers(), com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.LavaAttack.lavaTask(), com.runehive.content.ProfileViewer.open(), com.runehive.content.skill.impl.hunter.trap.TrapExecution.setTrapProcess(), and com.runehive.game.world.entity.combat.strategy.npc.boss.LizardShaman.MinionsAttack.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ matches() [1/2]

boolean com.runehive.game.world.position.Position.matches ( int x,
int y )

Definition at line 330 of file Position.java.

330 {
331 return this.x == x && this.y == y;
332 }

References x, and y.

◆ matches() [2/2]

boolean com.runehive.game.world.position.Position.matches ( int x,
int y,
int z )

Definition at line 334 of file Position.java.

334 {
335 return this.x == x && this.y == y && this.height == z;
336 }

References x, and y.

◆ north()

Position com.runehive.game.world.position.Position.north ( )

Definition at line 97 of file Position.java.

97 {
98 return transform(0, 1);
99 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), and com.runehive.content.lms.lobby.LMSLobby.joinLobby().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ northEast()

Position com.runehive.game.world.position.Position.northEast ( )

Definition at line 113 of file Position.java.

113 {
114 return transform(1, 1);
115 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), and inLocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ northWest()

Position com.runehive.game.world.position.Position.northWest ( )

Definition at line 117 of file Position.java.

117 {
118 return transform(-1, 1);
119 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), and com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ south()

Position com.runehive.game.world.position.Position.south ( )

Definition at line 105 of file Position.java.

105 {
106 return transform(0, -1);
107 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), and com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ southEast()

Position com.runehive.game.world.position.Position.southEast ( )

Definition at line 121 of file Position.java.

121 {
122 return transform(1, -1);
123 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), and com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ southWest()

Position com.runehive.game.world.position.Position.southWest ( )

Definition at line 125 of file Position.java.

125 {
126 return transform(-1, -1);
127 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), and inLocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

String com.runehive.game.world.position.Position.toString ( )

Definition at line 344 of file Position.java.

344 {
345 return String.format("pos[x=%d, y=%d, z=%d]", x, y, height);
346 }

References height, x, and y.

◆ transform() [1/3]

Position com.runehive.game.world.position.Position.transform ( int diffX,
int diffY )

Creates a new location based on this location.

Parameters
diffXX difference.
diffYY difference.
Returns
The new location.

Definition at line 289 of file Position.java.

289 {
290 return new Position(x + diffX, y + diffY, height);
291 }

References height, Position(), x, and y.

Here is the call graph for this function:

◆ transform() [2/3]

Position com.runehive.game.world.position.Position.transform ( int diffX,
int diffY,
int diffZ )

Creates a new location based on this location.

Parameters
diffXX difference.
diffYY difference.
diffZZ difference.
Returns
The new location.

Definition at line 278 of file Position.java.

278 {
279 return new Position(x + diffX, y + diffY, height + diffZ);
280 }

References height, Position(), x, and y.

Referenced by com.runehive.content.pet.Pets.abandon(), com.runehive.game.world.pathfinding.path.impl.SimplePathFinder.addWalks(), east(), com.runehive.game.world.entity.mob.Mob.face(), com.runehive.util.Utility.findBestInside(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vetion.finishIncoming(), com.runehive.util.Utility.fixInsidePosition(), com.runehive.util.Utility.getBoundaries(), com.runehive.util.Utility.getDelta(), com.runehive.util.Utility.getDistance(), com.runehive.util.Utility.getDistance(), com.runehive.util.Utility.getInnerBoundaries(), com.runehive.util.Utility.getInnerBoundaries(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles(), com.runehive.game.world.entity.combat.strategy.player.special.melee.DragonSpear.hit(), com.runehive.util.Utility.inside(), com.runehive.content.lms.lobby.LMSLobby.leaveLobby(), north(), northEast(), northWest(), com.runehive.game.world.region.Region.reachable(), south(), southEast(), southWest(), com.runehive.game.world.entity.combat.strategy.npc.boss.Callisto.Roar.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Derwen.LightingRain.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.magearena.Justiciar.LightingRain.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vetion.Magic.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.Vorkath.VenomSpecial.start(), transform(), com.runehive.game.world.pathfinding.path.impl.SimplePathFinder.traversable(), west(), com.runehive.util.Utility.within(), com.runehive.util.Utility.withinOctal(), and com.runehive.util.Utility.withinViewingDistance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transform() [3/3]

Position com.runehive.game.world.position.Position.transform ( Position other)

Creates a new location based on this location.

Parameters
otherThe difference.
Returns
The new location.

Definition at line 304 of file Position.java.

304 {
305 if (other == null) return this;
306 return transform(other.getX(), other.getY(), other.getHeight());
307 }

References getHeight(), getX(), getY(), Position(), and transform().

Here is the call graph for this function:

◆ west()

Position com.runehive.game.world.position.Position.west ( )

Definition at line 109 of file Position.java.

109 {
110 return transform(-1, 0);
111 }

References Position(), and transform().

Referenced by com.runehive.game.world.pathfinding.TraversalMap.getRandomNonDiagonal(), com.runehive.game.world.pathfinding.TraversalMap.getRandomTraversableTile(), and com.runehive.game.world.pathfinding.TraversalMap.getTraversableTiles().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ height

final int com.runehive.game.world.position.Position.height
private

◆ HEIGHT_LEVELS

final int com.runehive.game.world.position.Position.HEIGHT_LEVELS = 4
static

The maximum amount of height-planes.

Definition at line 17 of file Position.java.

◆ x

final int com.runehive.game.world.position.Position.x
private

◆ y

final int com.runehive.game.world.position.Position.y
private

The documentation for this class was generated from the following file: