RuneHive-Game
Loading...
Searching...
No Matches
StallData.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.thieving;
2
3import com.runehive.game.world.items.Item;
4
5import java.util.Arrays;
6import java.util.Optional;
7
8/**
9 * Holds all the data for thieving stalls.
10 *
11 * @author Daniel
12 */
13public enum StallData {
14 FOOD(4875, new Item(3162), 1, 25, 275),
15 GENERAL(4876, new Item(1887), 20, 50, 760),
16 CRAFTING(4874, new Item(1635), 40, 125, 1453),
17 RUNES(4877, new Item(8788), 50, 250, 2546),
18 SCIMITAR(4878, new Item(686), 80, 500, 3860);
19
20 /** The object identification. */
21 private final int object;
22
23 /** The item rewarded */
24 private final Item item;
25
26 /** The level required */
27 private final int level;
28
29 /** The experience rewarded. */
30 private final int experience;
31
32 /** The item value. */
33 private final int value;
34
35 /** Constructs a new <code>StallData<code> */
36 StallData(int object, Item item, int level, int experience, int value) {
37 this.object = object;
38 this.item = item;
39 this.level = level;
40 this.experience = experience;
41 this.value = value;
42 }
43
44 /** Gets the object identification. */
45 public int getObject() {
46 return object;
47 }
48
49 /** Gets the item reward. */
50 public Item getItem() {
51 return item;
52 }
53
54 /** Gets the level required. */
55 public int getLevel() {
56 return level;
57 }
58
59 /** Gets the reward value. */
60 public int getValue() {
61 return value;
62 }
63
64 /** Gets the experience rewarded. */
65 public int getExperience() {
66 return experience;
67 }
68
69 /** Gets the stall data base off object identification. */
70 public static Optional<StallData> forId(int id) {
71 return Arrays.stream(values()).filter(a -> a.object == id).findAny();
72 }
73
74 /** Checks if the item is a reward. */
75 public static boolean isReward(Item item) {
76 if (item == null)
77 return false;
78 return Arrays.stream(values()).anyMatch(i -> i.getItem().getId() == item.getId());
79 }
80
81 /** Gets the value of the reward. */
82 public static final int getValue(Item item) {
83 return Arrays.stream(values()).filter(i -> i.getItem().getId() == item.getId()).findAny().get().getValue();
84 }
85}
The container class that represents an item that can be interacted with.
Definition Item.java:21
int getExperience()
Gets the experience rewarded.
static boolean isReward(Item item)
Checks if the item is a reward.
int getObject()
Gets the object identification.
static Optional< StallData > forId(int id)
Gets the stall data base off object identification.
final int object
The object identification.
StallData(int object, Item item, int level, int experience, int value)
Constructs a new StallData
static final int getValue(Item item)
Gets the value of the reward.
final int experience
The experience rewarded.