RuneHive-Game
Loading...
Searching...
No Matches
PickaxeData.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.mining;
2
3import com.google.common.collect.ImmutableSet;
4import com.runehive.game.world.entity.mob.player.Player;
5
6import java.util.Optional;
7
8/**
9 * Represents types of axes.
10 *
11 * @author Graham Edgecombe
12 */
13public enum PickaxeData {
14 BRONZE_PICKAXE(1265, 1, 625, 0.05),
15 IRON_PICKAXE(1267, 1, 626, 0.08),
16 STEEL_PICKAXE(1269, 6, 627, 0.12),
17 MITHRIL_PICKAXE(1273, 21, 629, 0.16),
18 ADAMANT_PICKAXE(1271, 31, 628, 0.2),
19 RUNE_PICKAXE(1275, 41, 624, 0.25),
20 INFERNO_ADZE(13243, 75, 4483, 0.55),
21 THIRD_AGE_PICKAXE(20014, 90, 7283, 0.6),
22 DRAGON_PICKAXE(11920, 61, 7139, 0.6),
23 DRAGON_OR_PICKAXE(12797, 61, 643, 0.6);
24
25 /**
26 * Caches our enum values.
27 */
28 private static final ImmutableSet<PickaxeData> VALUES = ImmutableSet.copyOf(values());
29
30 /** The id. */
31 public final int id;
32
33 /** The level. */
34 public final int level;
35
36 /** The animation. */
37 public final int animation;
38
39 /**
40 * The speed of this pickaxe.
41 */
42 public final double speed;
43
44 /**
45 * Creates the axe.
46 *
47 * @param id
48 * The id.
49 * @param level
50 * The required level.
51 * @param animation
52 * The animation id.
53 */
54 PickaxeData(int id, int level, int animation, double speed) {
55 this.id = id;
56 this.level = level;
57 this.animation = animation;
58 this.speed = speed;
59 }
60
61 /**
62 * Gets the definition for this pickaxe.
63 * @param player the identifier to check for.
64 * @return an optional holding the {@link PickaxeData} value found,
65 * {@link Optional#empty} otherwise.
66 */
67 public static Optional<PickaxeData> getBestPickaxe(Player player) {
68 return VALUES.stream().filter(def -> player.equipment.contains(def.id) || player.inventory.contains(def.id)).findAny();
69 }
70}
This class represents a character controlled by a player.
Definition Player.java:125
boolean contains(int id)
Determines if this container contains id.
boolean contains(int[] bowsWithNoArrowsRequired)
PickaxeData(int id, int level, int animation, double speed)
Creates the axe.
static Optional< PickaxeData > getBestPickaxe(Player player)
Gets the definition for this pickaxe.
final double speed
The speed of this pickaxe.
static final ImmutableSet< PickaxeData > VALUES
Caches our enum values.