35public class MysteryBoxManager {
36 private final Player player;
40 public MysteryBoxManager(
Player player) {
44 public boolean click(Item item) {
45 Optional<MysteryBox> mBox =
MysteryBox.getMysteryBox(item.getId());
47 if (!mBox.isPresent()) {
51 if (
Area.inWilderness(player)) {
52 player.dialogueFactory.sendStatement(
"You can not open a mystery box while in the wilderness!").execute();
56 if (player.getCombat().inCombat()) {
57 player.dialogueFactory.sendStatement(
"You can not open a mystery box while in combat!").execute();
61 if (player.playerAssistant.busy() && !player.interfaceManager.isInterfaceOpen(59500)) {
62 player.dialogueFactory.sendStatement(
"You can not open a mystery box right now!").execute();
66 count = player.inventory.computeAmountForId(item.getId());
84 player.interfaceManager.close();
88 player.dialogueFactory.sendStatement(
"You do not have any " + box.name() +
"!",
"To spin a different mystery box level click on the item first!").execute();