RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
MimeBox.java
1
package
com.osroyale.content.itemaction.impl;
2
3
import
com.osroyale.net.packet.out.SendMessage;
4
import
com.osroyale.game.world.entity.mob.player.Player;
5
import
com.osroyale.content.emote.EmoteHandler;
6
import
com.osroyale.content.emote.EmoteUnlockable;
7
import
com.osroyale.content.itemaction.ItemAction;
8
import
com.osroyale.game.world.items.Item;
9
import
com.osroyale.util.Utility;
10
33
34
public
class
MimeBox
extends
ItemAction
{
35
36
private
static
final
EmoteUnlockable
[] EMOTES = {
EmoteUnlockable
.GLASS_BOX,
EmoteUnlockable
.GLASS_WALL,
EmoteUnlockable
.LEAN,
EmoteUnlockable
.CLIMB_ROPE};
37
38
private
static
final
Item[] MIME_COSTUME = {
new
Item(3057),
new
Item(3058),
new
Item(3059),
new
Item(3060),
new
Item(3061) };
39
40
@Override
41
public
String
name
() {
42
return
"Mime box"
;
43
}
44
45
@Override
46
public
boolean
inventory
(
Player
player, Item item,
int
opcode) {
47
if
(opcode != 1)
48
return
false
;
49
50
51
player.inventory.
remove
(item);
52
int
random =
Utility
.random(1, 5);
53
54
switch
(random) {
55
case
1:
56
case
2:
57
if
(!
EmoteHandler
.containsAll(player, EMOTES)) {
58
EmoteUnlockable
emote =
EmoteHandler
.selectRandom(player, EMOTES);
59
player.emoteUnlockable.add(emote);
60
EmoteHandler
.
refresh
(player);
61
player.send(
new
SendMessage
(
"You have unlocked the "
+
Utility
.formatName(emote.name().toLowerCase().replace(
"_"
,
""
)) +
" emote!"
));
62
return
true
;
63
}
64
int
random2 =
Utility
.random(1, 2);
65
if
(random2 == 1) {
66
Item clothing =
Utility
.
randomElement
(MIME_COSTUME);
67
player.inventory.
add
(clothing);
68
player.send(
new
SendMessage
(
"You have received the "
+ clothing.getName() +
" item!"
));
69
}
else
{
70
player.inventory.
add
(
new
Item(995, 75000));
71
}
72
break
;
73
case
3:
74
case
4:
75
player.inventory.
add
(
Utility
.
randomElement
(MIME_COSTUME));
76
break
;
77
case
5:
78
player.inventory.
add
(
new
Item(995, 75000));
79
break
;
80
}
81
return
true
;
82
}
83
}
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.MimeBox
Definition
MimeBox.java:34
com.osroyale.content.itemaction.impl.MimeBox.inventory
boolean inventory(Player player, Item item, int opcode)
Definition
MimeBox.java:46
com.osroyale.content.itemaction.impl.MimeBox.name
String name()
Definition
MimeBox.java:41
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