RuneHive-Game
Loading...
Searching...
No Matches
ItemActionRepository.java
Go to the documentation of this file.
1package com.runehive.content.itemaction;
2
3import com.runehive.content.itemaction.impl.*;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.items.Item;
6
7import java.util.HashMap;
8
9/**
10 * Handles execution of the item actions.
11 *
12 * @author Daniel
13 */
15
16 /** Map of all the item actions. */
17 public static HashMap<Integer, ItemAction> ACTIONS = new HashMap<>();
18
19 /** Declares all the item actions. */
20 public static void declare() {
21 ACTIONS.put(12_931, new SerpentineHelm()); // charged
22 ACTIONS.put(12_929, new SerpentineHelm()); // uncharged
23
24 ACTIONS.put(13_196, new TanzaniteHelm()); // charged
25 ACTIONS.put(13_197, new TanzaniteHelm()); // uncharged
26
27 ACTIONS.put(13_198, new MagmaHelm()); // charged
28 ACTIONS.put(13_199, new MagmaHelm()); // uncharged
29
30 ACTIONS.put(11283, new DragonfireShield()); // charged
31 ACTIONS.put(11284, new DragonfireShield()); // uncharged
32
33 ACTIONS.put(12924, new ToxicBlowpipe()); // uncharged
34 ACTIONS.put(12926, new ToxicBlowpipe()); // charged
35
36 ACTIONS.put(11907, new TridentOfTheSeas()); // charged
37 ACTIONS.put(12899, new TridentOfTheSwamp()); // charged
38
39
40 ACTIONS.put((int) CrawsBow.CRAWS_UNCHARGED_ID, new CrawsBow()); // uncharged
41 ACTIONS.put((int) CrawsBow.CRAWS_CHARGED_ID, new CrawsBow()); // charged
42
45
48
49 ACTIONS.put((int) CelestialRing.UNCHARGED_RING, new CelestialRing()); // uncharged
50 ACTIONS.put((int) CelestialRing.CHARGED_RING, new CelestialRing()); // charged
51
52 ACTIONS.put(6831, new MimeBox());
53 ACTIONS.put(6832, new DrillDemonBox());
54 ACTIONS.put(12897, new ClanShowcaseBox());
55 ACTIONS.put(6854, new ClanResourceBox());
56
57// ACTIONS.put(1704, new AmuletOfGlory());
58// ACTIONS.put(1706, new AmuletOfGlory());
59// ACTIONS.put(1708, new AmuletOfGlory());
60// ACTIONS.put(1710, new AmuletOfGlory());
61// ACTIONS.put(1712, new AmuletOfGlory());
62// ACTIONS.put(1714, new AmuletOfGlory());
63// ACTIONS.put(11978, new AmuletOfGlory());
64// ACTIONS.put(11978, new AmuletOfGlory());
65// ACTIONS.put(2566, new RingOfDueling());
66// ACTIONS.put(2564, new RingOfDueling());
67// ACTIONS.put(2562, new RingOfDueling());
68// ACTIONS.put(2560, new RingOfDueling());
69// ACTIONS.put(2558, new RingOfDueling());
70// ACTIONS.put(2556, new RingOfDueling());
71// ACTIONS.put(2554, new RingOfDueling());
72// ACTIONS.put(2552, new RingOfDueling());
73 }
74
75 public static boolean itemOnItem(Player player, Item first, Item second) {
76 ItemAction action = ACTIONS.getOrDefault(first.getId(), ACTIONS.get(second.getId()));
77 return action != null && action.itemOnItem(player, first, second);
78 }
79
80 public static boolean inventory(Player player, Item item, int opcode) {
81 ItemAction action = ACTIONS.get(item.getId());
82 return action != null && action.inventory(player, item, opcode);
83 }
84
85 public static boolean equipment(Player player, Item item, int opcode) {
86 ItemAction action = ACTIONS.get(item.getId());
87 return action != null && action.equipment(player, item, opcode);
88 }
89
90 public static boolean drop(Player player, Item item) {
91 ItemAction action = ACTIONS.get(item.getId());
92 return action != null && action.drop(player, item);
93 }
94}
Handles executing an item action.
boolean equipment(Player player, Item item, int opcode)
boolean drop(Player player, Item item)
boolean itemOnItem(Player player, Item first, Item second)
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
static boolean itemOnItem(Player player, Item first, Item second)
static void declare()
Declares all the item actions.
static boolean equipment(Player player, Item item, int opcode)
static boolean inventory(Player player, Item item, int opcode)
static HashMap< Integer, ItemAction > ACTIONS
Map of all the item actions.
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
final int getId()
Gets the identification of this item.
Definition Item.java:324