RuneHive-Game
Loading...
Searching...
No Matches
DrillDemonBox.java
Go to the documentation of this file.
1package com.runehive.content.itemaction.impl;
2
3import com.runehive.content.emote.EmoteHandler;
4import com.runehive.content.emote.EmoteUnlockable;
5import com.runehive.content.itemaction.ItemAction;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.items.Item;
8import com.runehive.net.packet.out.SendMessage;
9import com.runehive.util.Utility;
10
11public class DrillDemonBox extends ItemAction {
12
14
15 private static final Item[] CAMO_CLOTHING = {new Item(6656), new Item(6654), new Item(6655)};
16
17 @Override
18 public String name() {
19 return "Drill demon box";
20 }
21
22 @Override
23 public String message(Item item) {
24 return "You open the Drill demon box...";
25 }
26
27 @Override
28 public int delay() {
29 return 2;
30 }
31
32 @Override
33 public boolean inventory(Player player, Item item, int opcode) {
34 if (opcode != 1)
35 return false;
36
37 player.inventory.remove(item);
38 int random = Utility.random(1, 5);
39
40 switch (random) {
41 case 1:
42 case 2:
43 if (!EmoteHandler.containsAll(player, EMOTES)) {
45 player.emoteUnlockable.add(emote);
46 EmoteHandler.refresh(player);
47 player.send(new SendMessage("You have unlocked the " + Utility.formatName(emote.name().toLowerCase().replace("_", "")) + " emote!"));
48 return true;
49 }
50 int random2 = Utility.random(1, 2);
51 if (random2 == 1) {
53 player.inventory.add(clothing);
54 player.send(new SendMessage("You have received the " + clothing.getName() + " item!"));
55 } else {
56 player.inventory.add(new Item(995, 75000));
57 }
58 break;
59 case 3:
60 case 4:
62 break;
63 case 5:
64 player.inventory.add(new Item(995, 75000));
65 break;
66 }
67 return true;
68 }
69}
This class handles emotes from the emote tab and skill cape.
static void refresh(Player player)
Handles refreshing the emote tab.
static boolean containsAll(Player player, EmoteUnlockable... emotes)
static EmoteUnlockable selectRandom(Player player, EmoteUnlockable... emotes)
Handles executing an item action.
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
int delay()
The item click delay of the action.
String message(Item item)
The message of the action.
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
The OutgoingPacket that sends a message to a Players chatbox in the client.
Handles miscellaneous methods.
Definition Utility.java:27
static String formatName(final String input)
Definition Utility.java:645
static int random(int bound)
Definition Utility.java:239
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
Definition Utility.java:248