RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.net.packet.out.SendGroundItem Class Reference
Inheritance diagram for com.runehive.net.packet.out.SendGroundItem:
Collaboration diagram for com.runehive.net.packet.out.SendGroundItem:

Classes

enum  GroundItemType

Public Member Functions

boolean encode (Player player)
 SendGroundItem (GroundItem groundItem)
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)

Private Member Functions

 SendGroundItem (GroundItem groundItem, GroundItemType type)

Private Attributes

final GroundItem groundItem
GroundItemType type

Additional Inherited Members

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

Detailed Description

Definition at line 9 of file SendGroundItem.java.

Constructor & Destructor Documentation

◆ SendGroundItem() [1/2]

com.runehive.net.packet.out.SendGroundItem.SendGroundItem ( GroundItem groundItem,
GroundItemType type )
private

Definition at line 14 of file SendGroundItem.java.

14 {
15 super(44, 12);
16 this.groundItem = groundItem;
17 this.type = type;
18 }

References groundItem, and type.

◆ SendGroundItem() [2/2]

com.runehive.net.packet.out.SendGroundItem.SendGroundItem ( GroundItem groundItem)

Definition at line 20 of file SendGroundItem.java.

20 {
21 this(groundItem, GroundItemType.NORMAL);
22 }

References groundItem, and com.runehive.net.packet.out.SendGroundItem.GroundItemType.NORMAL.

Member Function Documentation

◆ encode()

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

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

Definition at line 25 of file SendGroundItem.java.

25 {
26 if (groundItem.instance != player.instance) {
27 return false;
28 }
29
30 if (!groundItem.isRegistered()) {
31 return false;
32 }
33
34 if (!groundItem.item.isTradeable()) {
35 this.type = GroundItemType.UNTRADEABLE;
36 } else if (groundItem.item.getValue() > 1_000_000) {
37 this.type = GroundItemType.RARE;
38 } else {
39 this.type = GroundItemType.NORMAL;
40 }
41
42 player.send(new SendCoordinate(groundItem.getPosition()));
43 builder.writeShort(groundItem.item.getId(), ByteModification.ADD, ByteOrder.LE)
44 .writeLong(groundItem.item.getAmount())
45 .writeByte(type.ordinal())
46 .writeByte(0);
47 return true;
48 }

References com.runehive.net.codec.ByteModification.ADD, com.runehive.net.packet.OutgoingPacket.builder, groundItem, com.runehive.game.world.entity.Entity.instance, com.runehive.net.codec.ByteOrder.LE, com.runehive.net.packet.out.SendGroundItem.GroundItemType.NORMAL, com.runehive.net.packet.out.SendGroundItem.GroundItemType.RARE, com.runehive.game.world.entity.mob.player.Player.send(), type, and com.runehive.net.packet.out.SendGroundItem.GroundItemType.UNTRADEABLE.

Here is the call graph for this function:

Member Data Documentation

◆ groundItem

final GroundItem com.runehive.net.packet.out.SendGroundItem.groundItem
private

Definition at line 11 of file SendGroundItem.java.

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

◆ type

GroundItemType com.runehive.net.packet.out.SendGroundItem.type
private

Definition at line 12 of file SendGroundItem.java.

Referenced by encode(), and SendGroundItem().


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