RuneHive-Game
Loading...
Searching...
No Matches
EquipmentDefinition.java
Go to the documentation of this file.
1package com.runehive.util.parser.old.defs;
2
3import com.runehive.game.world.items.SkillRequirement;
4import com.runehive.game.world.items.containers.equipment.EquipmentType;
5
6import java.util.HashMap;
7import java.util.Map;
8
9/**
10 * Represents an in-game equipped item.
11 *
12 * @author Daniel | Obey
13 */
14public class EquipmentDefinition {
15
16 /* The id of the item */
17 private final int id;
18
19 /* The name of the item */
20 private final String name;
21
22 /* The type of equipment also called slot */
23 private final EquipmentType type;
24
25 /* The requirements to equip this item */
27
28 /* The bonuses for this item */
29 private final int[] bonuses;
30
31 /**
32 * Creates a new {@link EquipmentDefinition}.
33 *
34 * @param id The id of the item being equipped.
35 * @param name The name of the item.
36 * @param type The slot of the item.
37 * @param requirements The requirements of the item.
38 * @param bonuses The item bonuses.
39 */
41 this.id = id;
42 this.name = name;
43 this.type = type;
44 this.requirements = requirements;
45 this.bonuses = bonuses;
46 }
47
48 /** @return the bonuses */
49 public int[] getBonuses() {
50 return bonuses;
51 }
52
53 /** @return the id */
54 public int getId() {
55 return id;
56 }
57
58 /**
59 * @return the name
60 */
61 public String getName() {
62 return name;
63 }
64
65 /** @return the requirements */
67 return requirements;
68 }
69
70 /** @return the type */
72 return type;
73 }
74
75 /** @return the equipment slot */
76 public int getSlot() {
77 return getType().getSlot();
78 }
79
80 /* The equipment definitions stored on startup that are mapped to their item ids */
81 public static final Map<Integer, EquipmentDefinition> EQUIPMENT_DEFINITIONS = new HashMap<>();
82
83 public static EquipmentDefinition get(int id) {
84 return EQUIPMENT_DEFINITIONS.get(id);
85 }
86
87}
static final Map< Integer, EquipmentDefinition > EQUIPMENT_DEFINITIONS
EquipmentDefinition(int id, String name, EquipmentType type, SkillRequirement[] requirements, int[] bonuses)
Creates a new EquipmentDefinition.
The enumerated types of a players equipped item slots.