RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
DrillDemonBox.java
1package com.osroyale.content.itemaction.impl;
2
3import com.osroyale.content.emote.EmoteHandler;
4import com.osroyale.content.emote.EmoteUnlockable;
5import com.osroyale.content.itemaction.ItemAction;
6import com.osroyale.game.world.entity.mob.player.Player;
7import com.osroyale.game.world.items.Item;
8import com.osroyale.net.packet.out.SendMessage;
9import com.osroyale.util.Utility;
10
37
38public 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}
static void refresh(Player player)
boolean inventory(Player player, Item item, int opcode)
static< T > T randomElement(Collection< T > collection)
Definition Utility.java:285