RuneHive-Game
Loading...
Searching...
No Matches
FoodData.java
Go to the documentation of this file.
1package com.runehive.content.consume;
2
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.entity.skill.Skill;
5
6import java.util.Arrays;
7import java.util.Optional;
8
9/**
10 * Holds all the food data.
11 *
12 * @author Daniel.
13 */
14public enum FoodData {
15 SLICED_BANANA(3162, 2, "Sliced banana"),
16 EASTER_EGG1(1961, 12, "Easter Egg"),
17 PUMPKIN(1959, 14, "Pumpkin"),
18 HALF_JUG_OF_WINE(1989, 7, "Half Full Wine Jug"),
19 WINE(1993, 11, "Wine"),
20 MANTA(391, 22, "Manta Ray"),
21 SHARK(385, 20, "Shark"),
22 LOBSTER(379, 12, "Lobster"),
23 BEER(1917, 1, "Beer"),
24 GREENMANS_ALE(1909, 1, "Greenman's Ale"),
25 TROUT(333, 7, "Trout"),
26 SALMON(329, 9, "Salmon"),
27 SWORDFISH(373, 14, "Swordfish"),
28 TUNA(361, 10, "Tuna"),
29 MONKFISH(7946, 16, "Monkfish"),
30 SEA_TURTLE(397, 21, "Sea Turtle"),
31 CABBAGE(1965, 1, "Cabbage"),
32 CAKE(1891, 4, "Cake"),
33 BASS(365, 13, "Bass"),
34 COD(339, 7, "Cod"),
35 POTATO(1942, 1, "Potato"),
36 BAKED_POTATO(6701, 4, "Baked Potato"),
37 POTATO_WITH_CHEESE(6705, 16, "Potato with Cheese"),
38 EGG_POTATO(7056, 16, "Egg Potato"),
39 CHILLI_POTATO(7054, 14, "Chilli Potato"),
40 MUSHROOM_POTATO(7058, 20, "Mushroom Potato"),
41 TUNA_POTATO(7060, 22, "Tuna Potato"),
42 SHRIMPS(315, 3, "Shrimps"),
43 HERRING(347, 5, "Herring"),
44 SARDINE(325, 4, "Sardine"),
45 CHOCOLATE_CAKE(1897, 5, "Chocolate Cake"),
46 HALF_CHOCOLATE_CAKE(1899, 5, "2/3 Chocolate Cake"),
47 CHOCOLATE_SLICE(1901, 5, "Chocolate Slice"),
48 ANCHOVIES(319, 1, "Anchovies"),
49 PLAIN_PIZZA(2289, 2289, 2291, 7, "Plain Pizza"),
50 HALF_PLAIN_PIZZA(2291, 2289, -1, 7, "1/2 Plain pizza"),
51 MEAT_PIZZA(2293, 2293, 2295, 8, "Meat Pizza"),
52 HALF_MEAT_PIZZA(2295, 2293, -1, 8, "1/2 Meat Pizza"),
53 ANCHOVY_PIZZA(2297, 2297, 2299, 9, "Anchovy Pizza"),
54 HALF_ANCHOVY_PIZZA(2299, 2297, -1, 9, "1/2 Anchovy Pizza"),
55 PINEAPPLE_PIZZA(2301, 2301, 2303, 11, "Pineapple Pizza"),
56 HALF_PINEAPPLE_PIZZA(2303, 2301, -1, 11, "1/2 Pineapple Pizza"),
57 BREAD(2309, 5, "Bread"),
58 APPLE_PIE(2323, 2323, 2335, 7, "Apple Pie"),
59 HALF_APPLE_PIE(2335, 2323, -1, 7, "Half Apple Pie"),
60 REDBERRY_PIE(2325, 2325, 2333, 5, "Redberry Pie"),
61 HALF_REDBERRY_PIE(2333, 2325, -1, 5, "Half Redberry Pie"),
62 UGTHANKI_KEBAB(1883, 2, "Ugthanki kebab"),
63 MEAT_PIE(2327, 2327, 2331, 6, "Meat Pie"),
64 HALF_MEAT_PIE(2331, 2327, -1, 6, "Half Meat Pie"),
65 SUMMER_PIE(7218, 7218, 7220, 11, "Summer Pie"),
66 HALF_SUMMER_PIE(7220, 7218, -1, 11, "Half Summer Pie"),
67 PIKE(351, 8, "Pike"),
68 POTATO_WITH_BUTTER(6703, 14, "Potato with Butter"),
69 BANANA(1963, 2, "Banana"),
70 PEACH(6883, 8, "Peach"),
71 ORANGE(2108, 2, "Orange"),
72 PINEAPPLE_RINGS(2118, 2, "Pineapple Rings"),
73 PINEAPPLE_CHUNKS(2116, 2, "Pineapple Chunks"),
74 EASTER_EGG(7928, 1, "Easter Egg"),
75 EASTER_EGG2(7929, 1, "Easter Egg"),
76 EASTER_EGG3(7930, 1, "Easter Egg"),
77 EASTER_EGG4(7931, 1, "Easter Egg"),
78 EASTER_EGG5(7932, 1, "Easter Egg"),
79 EASTER_EGG6(7933, 1, "Easter Egg"),
80 PURPLE_SWEETS(10476, 9, "Purple Sweets"),
81 POT_OF_CREAM(2130, 1, "Pot of cream"),
82 BANDAGES(4049, 3, "Bandages"),
83 COOKED_KARAMBWAN(3144, -1, -1, 18, "Cooked Karambwan"),
84 DARK_CRAB(11936, 22, "Dark Crab"),
85 ANGLERFISH(13441, 22, "Anglerfish");
86
87 /** The id of the consumable item. */
88 private final int id;
89
90 /** The parent food id. */
91 private final int parent;
92
93 /** The replacement food id. */
94 private final int replacement;
95
96 /** The amount of health received after consuming the item. */
97 private final int heal;
98
99 /** The name of the consumable item. */
100 private final String name;
101
102 /**
103 * The different consumables.
104 *
105 * @param id The id of the item.
106 * @param heal The amount of health received after consuming the item.
107 * @param name The name of the consumable item.
108 */
109 FoodData(int id, int parent, int replacement, int heal, String name) {
110 this.id = id;
111 this.parent = parent;
112 this.replacement = replacement;
113 this.heal = heal;
114 this.name = name;
115 }
116
117 /**
118 * The different consumables.
119 *
120 * @param id The id of the item.
121 * @param heal The amount of health received after consuming the item.
122 * @param name The name of the consumable item.
123 */
124 FoodData(int id, int heal, String name) {
125 this(id, id, -1, heal, name);
126 }
127
128 /**
129 * Gets the food data based on the item identification.
130 *
131 * @param id The item identification.
132 * @return The food data.
133 */
134 public static Optional<FoodData> forId(int id) {
135 return Arrays.stream(values()).filter(a -> a.id == id).findFirst();
136 }
137
138 //TODO Cleaner
139 public static int anglerfishHeal(Player player) {
140 int hitpoints = player.skills.getMaxLevel(Skill.HITPOINTS);
141 if (hitpoints >= 10 && hitpoints <= 19)
142 return 3;
143 if (hitpoints >= 20 && hitpoints <= 24)
144 return 4;
145 if (hitpoints >= 25 && hitpoints <= 29)
146 return 6;
147 if (hitpoints >= 30 && hitpoints <= 39)
148 return 7;
149 if (hitpoints >= 40 && hitpoints <= 49)
150 return 8;
151 if (hitpoints >= 50 && hitpoints <= 59)
152 return 11;
153 if (hitpoints >= 60 && hitpoints <= 69)
154 return 12;
155 if (hitpoints >= 70 && hitpoints <= 74)
156 return 13;
157 if (hitpoints >= 75 && hitpoints <= 79)
158 return 15;
159 if (hitpoints >= 80 && hitpoints <= 89)
160 return 16;
161 if (hitpoints >= 90 && hitpoints <= 92)
162 return 17;
163 if (hitpoints >= 93)
164 return 22;
165 return 0;
166 }
167
168 /** Gets the id of the consumable. */
169 public int getId() {
170 return id;
171 }
172
173 /** Gets the replacement id. */
174 public int getReplacement() {
175 return replacement;
176 }
177
178 /** Checks if this food is fast. */
179 public boolean isFast() {
180 return replacement != -1 || parent != id;
181 }
182
183 /** Gets the healing amount of the consumable. */
184 public int getHeal() {
185 return heal;
186 }
187
188 /** Gets the name of the consumable. */
189 public String getName() {
190 return name;
191 }
192}
This class represents a character controlled by a player.
Definition Player.java:125
Represents a trainable and usable skill.
Definition Skill.java:18
static final int HITPOINTS
The hitpoints skill id.
Definition Skill.java:30
int getMaxLevel(int id)
Gets the highest possible level of a skill.
boolean isFast()
Checks if this food is fast.
int getHeal()
Gets the healing amount of the consumable.
int getReplacement()
Gets the replacement id.
final int id
The id of the consumable item.
Definition FoodData.java:88
final String name
The name of the consumable item.
String getName()
Gets the name of the consumable.
static int anglerfishHeal(Player player)
final int replacement
The replacement food id.
Definition FoodData.java:94
int getId()
Gets the id of the consumable.
static Optional< FoodData > forId(int id)
Gets the food data based on the item identification.
FoodData(int id, int parent, int replacement, int heal, String name)
The different consumables.
FoodData(int id, int heal, String name)
The different consumables.
final int parent
The parent food id.
Definition FoodData.java:91
final int heal
The amount of health received after consuming the item.
Definition FoodData.java:97