RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
DrillDemonBox.java
1
package
com.osroyale.content.itemaction.impl;
2
3
import
com.osroyale.content.emote.EmoteHandler;
4
import
com.osroyale.content.emote.EmoteUnlockable;
5
import
com.osroyale.content.itemaction.ItemAction;
6
import
com.osroyale.game.world.entity.mob.player.Player;
7
import
com.osroyale.game.world.items.Item;
8
import
com.osroyale.net.packet.out.SendMessage;
9
import
com.osroyale.util.Utility;
10
37
38
public
class
DrillDemonBox
extends
ItemAction
{
39
40
private
static
final
EmoteUnlockable
[] EMOTES = {
EmoteUnlockable
.SIT_UP,
EmoteUnlockable
.PUSH_UP,
EmoteUnlockable
.JUMPING_JACK,
EmoteUnlockable
.JOG};
41
42
private
static
final
Item[] CAMO_CLOTHING = {
new
Item(6656),
new
Item(6654),
new
Item(6655)};
43
44
@Override
45
public
String
name
() {
46
return
"Drill demon box"
;
47
}
48
49
@Override
50
public
String
message
(Item item) {
51
return
"You open the Drill demon box..."
;
52
}
53
54
@Override
55
public
int
delay
() {
56
return
2;
57
}
58
59
@Override
60
public
boolean
inventory
(
Player
player, Item item,
int
opcode) {
61
if
(opcode != 1)
62
return
false
;
63
64
player.inventory.
remove
(item);
65
int
random =
Utility
.random(1, 5);
66
67
switch
(random) {
68
case
1:
69
case
2:
70
if
(!
EmoteHandler
.containsAll(player, EMOTES)) {
71
EmoteUnlockable
emote =
EmoteHandler
.selectRandom(player, EMOTES);
72
player.emoteUnlockable.add(emote);
73
EmoteHandler
.
refresh
(player);
74
player.send(
new
SendMessage
(
"You have unlocked the "
+
Utility
.formatName(emote.name().toLowerCase().replace(
"_"
,
""
)) +
" emote!"
));
75
return
true
;
76
}
77
int
random2 =
Utility
.random(1, 2);
78
if
(random2 == 1) {
79
Item clothing =
Utility
.
randomElement
(CAMO_CLOTHING);
80
player.inventory.
add
(clothing);
81
player.send(
new
SendMessage
(
"You have received the "
+ clothing.getName() +
" item!"
));
82
}
else
{
83
player.inventory.
add
(
new
Item(995, 75000));
84
}
85
break
;
86
case
3:
87
case
4:
88
player.inventory.
add
(
Utility
.
randomElement
(CAMO_CLOTHING));
89
break
;
90
case
5:
91
player.inventory.
add
(
new
Item(995, 75000));
92
break
;
93
}
94
return
true
;
95
}
96
}
com.osroyale.content.emote.EmoteHandler
Definition
EmoteHandler.java:55
com.osroyale.content.emote.EmoteHandler.refresh
static void refresh(Player player)
Definition
EmoteHandler.java:63
com.osroyale.content.itemaction.ItemAction
Definition
ItemAction.java:42
com.osroyale.content.itemaction.impl.DrillDemonBox
Definition
DrillDemonBox.java:38
com.osroyale.content.itemaction.impl.DrillDemonBox.inventory
boolean inventory(Player player, Item item, int opcode)
Definition
DrillDemonBox.java:60
com.osroyale.content.itemaction.impl.DrillDemonBox.delay
int delay()
Definition
DrillDemonBox.java:55
com.osroyale.content.itemaction.impl.DrillDemonBox.message
String message(Item item)
Definition
DrillDemonBox.java:50
com.osroyale.content.itemaction.impl.DrillDemonBox.name
String name()
Definition
DrillDemonBox.java:45
com.osroyale.game.world.entity.mob.player.Player
Definition
Player.java:162
com.osroyale.game.world.items.containers.ItemContainer.add
boolean add(Item item)
Definition
ItemContainer.java:195
com.osroyale.game.world.items.containers.ItemContainer.remove
boolean remove(Item item)
Definition
ItemContainer.java:348
com.osroyale.net.packet.out.SendMessage
Definition
SendMessage.java:38
com.osroyale.util.Utility
Definition
Utility.java:64
com.osroyale.util.Utility.randomElement
static< T > T randomElement(Collection< T > collection)
Definition
Utility.java:285
com.osroyale.content.emote.EmoteUnlockable
Definition
EmoteUnlockable.java:41