RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.mysterybox.MysteryBoxManager Class Reference
Collaboration diagram for com.runehive.content.mysterybox.MysteryBoxManager:

Public Member Functions

boolean click (Item item)
 MysteryBoxManager (Player player)
void spin ()

Public Attributes

MysteryBox box

Package Attributes

int count

Private Attributes

final Player player

Detailed Description

Definition at line 12 of file MysteryBoxManager.java.

Constructor & Destructor Documentation

◆ MysteryBoxManager()

com.runehive.content.mysterybox.MysteryBoxManager.MysteryBoxManager ( Player player)

Definition at line 17 of file MysteryBoxManager.java.

17 {
18 this.player = player;
19 }

References player.

Member Function Documentation

◆ click()

boolean com.runehive.content.mysterybox.MysteryBoxManager.click ( Item item)

Definition at line 21 of file MysteryBoxManager.java.

21 {
22 Optional<MysteryBox> mBox = MysteryBox.getMysteryBox(item.getId());
23
24 if (!mBox.isPresent()) {
25 return false;
26 }
27
28 if (Area.inWilderness(player)) {
29 player.dialogueFactory.sendStatement("You can not open a mystery box while in the wilderness!").execute();
30 return true;
31 }
32
33 if (player.getCombat().inCombat()) {
34 player.dialogueFactory.sendStatement("You can not open a mystery box while in combat!").execute();
35 return true;
36 }
37
38 if (player.playerAssistant.busy() && !player.interfaceManager.isInterfaceOpen(59500)) {
39 player.dialogueFactory.sendStatement("You can not open a mystery box right now!").execute();
40 return true;
41 }
42 box = mBox.get();
43 count = player.inventory.computeAmountForId(item.getId());
44
45 spin();
46 /* for (int index = 0; index < 11; index++) {
47 player.send(new SendConfig((430 + index), 1));
48 }
49 player.send(new SendItemOnInterface(59581, mBox.get().rewards()));
50 player.send(new SendScrollbar(59580, mBox.get().rewards().length * 5));
51 player.send(new SendItemOnInterface(59512));
52 player.send(new SendColor(59508, 0x37991C));
53 player.send(new SendString(mBox.get().name(), 59503));
54 player.send(new SendString("You have " + count + " available!", 59507));
55 player.interfaceManager.open(59500);*/
56 return true;
57 }
final int getId()
Gets the identification of this item.
Definition Item.java:324

References box, count, com.runehive.game.world.items.Item.getId(), com.runehive.content.mysterybox.MysteryBox.getMysteryBox(), com.runehive.game.world.position.Area.inWilderness(), player, and spin().

Referenced by com.runehive.net.packet.in.ItemOptionPacketListener.handleFirstOption().

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

◆ spin()

void com.runehive.content.mysterybox.MysteryBoxManager.spin ( )

Definition at line 59 of file MysteryBoxManager.java.

59 {
60 if (box == null) {
61 player.interfaceManager.close();
62 return;
63 }
64 if (count == 0) {
65 player.dialogueFactory.sendStatement("You do not have any " + box.name() + "!", "To spin a different mystery box level click on the item first!").execute();
66 return;
67 }
68 World.schedule(new MysteryBoxEvent(player));
69 }

References box, count, player, and com.runehive.game.world.World.schedule().

Referenced by click().

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

Member Data Documentation

◆ box

MysteryBox com.runehive.content.mysterybox.MysteryBoxManager.box

Definition at line 15 of file MysteryBoxManager.java.

Referenced by click(), and spin().

◆ count

int com.runehive.content.mysterybox.MysteryBoxManager.count
package

Definition at line 14 of file MysteryBoxManager.java.

Referenced by click(), and spin().

◆ player

final Player com.runehive.content.mysterybox.MysteryBoxManager.player
private

Definition at line 13 of file MysteryBoxManager.java.

Referenced by click(), MysteryBoxManager(), and spin().


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