RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.net.packet.out.SendEntityFeed Class Reference

Sends the entity feed. More...

Inheritance diagram for com.runehive.net.packet.out.SendEntityFeed:
Collaboration diagram for com.runehive.net.packet.out.SendEntityFeed:

Public Member Functions

boolean encode (final Player player)
 SendEntityFeed ()
 SendEntityFeed (final int hp, final int maxHp)
 SendEntityFeed (final int opponentId, final int hp, final int maxHp)
 SendEntityFeed (final Mob mob)
Public Member Functions inherited from com.runehive.net.packet.OutgoingPacket
void execute (Player player)
 OutgoingPacket (int opcode, int capacity)
 OutgoingPacket (int opcode, PacketType type)
 OutgoingPacket (int opcode, PacketType type, int size)

Static Public Member Functions

static int getOpponent (final Mob mob)

Static Public Attributes

static final int NO_OPPONENT = -1
static final int OPPONENT_OFFSET_NPC = 2048

Private Attributes

final int hp
final int maxHp
final int opponentId

Static Private Attributes

static final int OPCODE = 175

Additional Inherited Members

Protected Attributes inherited from com.runehive.net.packet.OutgoingPacket
final PacketBuilder builder

Detailed Description

Sends the entity feed.

Author
Daniel

Definition at line 13 of file SendEntityFeed.java.

Constructor & Destructor Documentation

◆ SendEntityFeed() [1/4]

com.runehive.net.packet.out.SendEntityFeed.SendEntityFeed ( final int opponentId,
final int hp,
final int maxHp )

Definition at line 31 of file SendEntityFeed.java.

32 {
33 super(OPCODE, PacketType.FIXED, 6);
34 this.opponentId = opponentId;
35 this.hp = hp;
36 this.maxHp = maxHp;
37 }

References com.runehive.net.packet.PacketType.FIXED, hp, maxHp, OPCODE, and opponentId.

Referenced by getOpponent().

Here is the caller graph for this function:

◆ SendEntityFeed() [2/4]

com.runehive.net.packet.out.SendEntityFeed.SendEntityFeed ( final Mob mob)

Definition at line 39 of file SendEntityFeed.java.

39 {
40 this(
41 getOpponent(mob),
42 mob.getCurrentHealth(),
43 mob.getMaximumHealth()
44 );
45 }

References com.runehive.game.world.entity.mob.Mob.getCurrentHealth(), com.runehive.game.world.entity.mob.Mob.getMaximumHealth(), and getOpponent().

Here is the call graph for this function:

◆ SendEntityFeed() [3/4]

com.runehive.net.packet.out.SendEntityFeed.SendEntityFeed ( final int hp,
final int maxHp )

Definition at line 47 of file SendEntityFeed.java.

47 {
48 this(NO_OPPONENT, hp, maxHp);
49 }

References hp, maxHp, and NO_OPPONENT.

◆ SendEntityFeed() [4/4]

com.runehive.net.packet.out.SendEntityFeed.SendEntityFeed ( )

Definition at line 51 of file SendEntityFeed.java.

51 {
52 this(0, 0);
53 }

Member Function Documentation

◆ encode()

boolean com.runehive.net.packet.out.SendEntityFeed.encode ( final Player player)

Reimplemented from com.runehive.net.packet.OutgoingPacket.

Definition at line 56 of file SendEntityFeed.java.

56 {
57 builder.writeShort(opponentId)
58 .writeShort(hp)
59 .writeShort(maxHp);
60 return true;
61 }

References com.runehive.net.packet.OutgoingPacket.builder, hp, maxHp, and opponentId.

◆ getOpponent()

int com.runehive.net.packet.out.SendEntityFeed.getOpponent ( final Mob mob)
static

Definition at line 20 of file SendEntityFeed.java.

20 {
21 return mob.getIndex()
22 + (!mob.isPlayer()
23 ? SendEntityFeed.OPPONENT_OFFSET_NPC : 0);
24 }

References com.runehive.game.world.entity.Entity.getIndex(), com.runehive.game.world.entity.mob.Mob.isPlayer(), and SendEntityFeed().

Referenced by SendEntityFeed(), and com.runehive.net.packet.out.SendKillFeed.SendKillFeed().

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

Member Data Documentation

◆ hp

final int com.runehive.net.packet.out.SendEntityFeed.hp
private

Definition at line 28 of file SendEntityFeed.java.

Referenced by encode(), SendEntityFeed(), and SendEntityFeed().

◆ maxHp

final int com.runehive.net.packet.out.SendEntityFeed.maxHp
private

Definition at line 29 of file SendEntityFeed.java.

Referenced by encode(), SendEntityFeed(), and SendEntityFeed().

◆ NO_OPPONENT

final int com.runehive.net.packet.out.SendEntityFeed.NO_OPPONENT = -1
static

Definition at line 17 of file SendEntityFeed.java.

Referenced by SendEntityFeed().

◆ OPCODE

final int com.runehive.net.packet.out.SendEntityFeed.OPCODE = 175
staticprivate

Definition at line 15 of file SendEntityFeed.java.

Referenced by SendEntityFeed().

◆ OPPONENT_OFFSET_NPC

final int com.runehive.net.packet.out.SendEntityFeed.OPPONENT_OFFSET_NPC = 2048
static

Definition at line 18 of file SendEntityFeed.java.

◆ opponentId

final int com.runehive.net.packet.out.SendEntityFeed.opponentId
private

Definition at line 26 of file SendEntityFeed.java.

Referenced by encode(), and SendEntityFeed().


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