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

Created by Daniel on 2017-11-24. More...

Public Member Functions

 Boundary (int minX, int minY, int highX, int highY)
 Boundary (int minX, int minY, int highX, int highY, int height)
int getMaximumX ()
int getMaximumY ()
int getMinimumX ()
int getMinimumY ()

Static Public Member Functions

static List< PlayergetPlayers (Boundary boundary)
static boolean isIn (int x, int y, int z, Boundary boundaries)
static boolean isIn (Mob mob, Boundary... boundaries)
static boolean isInSameBoundary (Player player1, Player player2, Boundary[] boundaries)

Package Attributes

int height
int highX
int highY
int minX
int minY

Detailed Description

Created by Daniel on 2017-11-24.

Definition at line 12 of file Boundary.java.

Constructor & Destructor Documentation

◆ Boundary() [1/2]

com.runehive.game.world.position.Boundary.Boundary ( int minX,
int minY,
int highX,
int highY )

Definition at line 17 of file Boundary.java.

17 {
18 this.minX = minX;
19 this.minY = minY;
20 this.highX = highX;
21 this.highY = highY;
22 height = -1;
23 }

References height, highX, highY, minX, and minY.

Referenced by getPlayers(), isIn(), isIn(), and isInSameBoundary().

Here is the caller graph for this function:

◆ Boundary() [2/2]

com.runehive.game.world.position.Boundary.Boundary ( int minX,
int minY,
int highX,
int highY,
int height )

Definition at line 25 of file Boundary.java.

25 {
26 this.minX = minX;
27 this.minY = minY;
28 this.highX = highX;
29 this.highY = highY;
30 this.height = height;
31 }

References height, highX, highY, minX, and minY.

Member Function Documentation

◆ getMaximumX()

int com.runehive.game.world.position.Boundary.getMaximumX ( )

Definition at line 41 of file Boundary.java.

41 {
42 return highX;
43 }

References highX.

◆ getMaximumY()

int com.runehive.game.world.position.Boundary.getMaximumY ( )

Definition at line 45 of file Boundary.java.

45 {
46 return highY;
47 }

References highY.

◆ getMinimumX()

int com.runehive.game.world.position.Boundary.getMinimumX ( )

Definition at line 33 of file Boundary.java.

33 {
34 return minX;
35 }

References minX.

Referenced by com.runehive.content.Obelisks.activate().

Here is the caller graph for this function:

◆ getMinimumY()

int com.runehive.game.world.position.Boundary.getMinimumY ( )

Definition at line 37 of file Boundary.java.

37 {
38 return minY;
39 }

References minY.

Referenced by com.runehive.content.Obelisks.activate().

Here is the caller graph for this function:

◆ getPlayers()

List< Player > com.runehive.game.world.position.Boundary.getPlayers ( Boundary boundary)
static

Definition at line 70 of file Boundary.java.

70 {
71 List<Player> list = new ArrayList<>();
72 for (Player player : World.getPlayers()) {
73 if (player != null && isIn(player, boundary))
74 list.add(player);
75 }
76 return list;
77 }

References Boundary(), com.runehive.game.world.World.getPlayers(), and isIn().

Referenced by com.runehive.content.Obelisks.activate().

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

◆ isIn() [1/2]

boolean com.runehive.game.world.position.Boundary.isIn ( int x,
int y,
int z,
Boundary boundaries )
static

Definition at line 61 of file Boundary.java.

61 {
62 if (boundaries.height >= 0) {
63 if (z != boundaries.height) {
64 return false;
65 }
66 }
67 return x >= boundaries.minX && x <= boundaries.highX && y >= boundaries.minY && y <= boundaries.highY;
68 }

References Boundary(), height, and highY.

Here is the call graph for this function:

◆ isIn() [2/2]

boolean com.runehive.game.world.position.Boundary.isIn ( Mob mob,
Boundary... boundaries )
static

Definition at line 49 of file Boundary.java.

49 {
50 for (Boundary b : boundaries) {
51 if (b.height >= 0) {
52 if (mob.getHeight() != b.height)
53 continue;
54 }
55 if (mob.getX() >= b.minX && mob.getX() <= b.highX && mob.getY() >= b.minY && mob.getY() <= b.highY)
56 return true;
57 }
58 return false;
59 }

References Boundary(), com.runehive.game.world.entity.Entity.getHeight(), com.runehive.game.world.entity.Entity.getX(), and com.runehive.game.world.entity.Entity.getY().

Referenced by com.runehive.content.gambling.GambleManager.canGamble(), getPlayers(), com.runehive.content.lms.LMSGame.handleFogDamage(), com.runehive.content.lms.LMSGame.inGameArea(), com.runehive.content.lms.safezone.LMSSafezone.inSafeZone(), isInSameBoundary(), and com.runehive.game.world.entity.mob.player.Player.onStep().

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

◆ isInSameBoundary()

boolean com.runehive.game.world.position.Boundary.isInSameBoundary ( Player player1,
Player player2,
Boundary[] boundaries )
static

Definition at line 79 of file Boundary.java.

79 {
80 Optional<Boundary> boundary1 = Arrays.stream(boundaries).filter(b -> isIn(player1, b)).findFirst();
81 Optional<Boundary> boundary2 = Arrays.stream(boundaries).filter(b -> isIn(player2, b)).findFirst();
82 if (!boundary1.isPresent() || !boundary2.isPresent()) {
83 return false;
84 }
85 return Objects.equals(boundary1.get(), boundary2.get());
86 }

References Boundary(), and isIn().

Here is the call graph for this function:

Member Data Documentation

◆ height

int com.runehive.game.world.position.Boundary.height
package

Definition at line 15 of file Boundary.java.

Referenced by Boundary(), Boundary(), and isIn().

◆ highX

int com.runehive.game.world.position.Boundary.highX
package

Definition at line 14 of file Boundary.java.

Referenced by Boundary(), Boundary(), and getMaximumX().

◆ highY

int com.runehive.game.world.position.Boundary.highY
package

Definition at line 14 of file Boundary.java.

Referenced by Boundary(), Boundary(), getMaximumY(), and isIn().

◆ minX

int com.runehive.game.world.position.Boundary.minX
package

Definition at line 14 of file Boundary.java.

Referenced by Boundary(), Boundary(), and getMinimumX().

◆ minY

int com.runehive.game.world.position.Boundary.minY
package

Definition at line 14 of file Boundary.java.

Referenced by Boundary(), Boundary(), and getMinimumY().


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