RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
SmeltingData.java
1package com.osroyale.content.skill.impl.smithing;
2
6
7import com.google.common.collect.ImmutableSet;
8import com.google.common.collect.Sets;
9import com.osroyale.game.world.items.Item;
10
11import java.util.EnumSet;
12import java.util.Optional;
13
31
32public enum SmeltingData {
33 BRONZE(3987, new Item[]{new Item(438), new Item(436)}, new Item[]{new Item(2349)}, 6.25, 1),
34 BRONZE_5(3986, BRONZE, 5),
35 BRONZE_10(2807, BRONZE, 10),
36 BRONZE_X(2414, BRONZE, -1),
37 IRON(3991, new Item[]{new Item(440)}, new Item[]{new Item(2351)}, 12.5, 15),
38 IRON_5(3990, IRON, 5),
39 IRON_10(3989, IRON, 10),
40 IRON_X(3988, IRON, -1),
41 SILVER(3995, new Item[]{new Item(442)}, new Item[]{new Item(2355)}, 13.67, 20),
42 SILVER_5(3994, SILVER, 5),
43 SILVER_10(3993, SILVER, 10),
44 SILVER_X(3992, SILVER, -1),
45 STEEL(3999, new Item[]{new Item(440), new Item(453, 2)}, new Item[]{new Item(2353)}, 17.5, 30),
46 STEEL_5(3998, STEEL, 5),
47 STEEL_10(3997, STEEL, 10),
48 STEEL_X(3996, STEEL, -1),
49 GOLD(4003, new Item[]{new Item(444)}, new Item[]{new Item(2357)}, 22.5, 40),
50 GOLD_5(4002, GOLD, 5),
51 GOLD_10(4001, GOLD, 10),
52 GOLD_X(4000, GOLD, -1),
53 MITHRIL(7441, new Item[]{new Item(447), new Item(453, 4)}, new Item[]{new Item(2359)}, 30, 50),
54 MITHRIL_5(7440, MITHRIL, 5),
55 MITHRIL_10(6397, MITHRIL, 10),
56 MITHRIL_X(4158, MITHRIL, -1),
57 ADAMANT(7446, new Item[]{new Item(449), new Item(453, 6)}, new Item[]{new Item(2361)}, 37.5, 70),
58 ADAMANT_5(7444, ADAMANT, 5),
59 ADAMANT_10(7443, ADAMANT, 10),
60 ADAMANT_X(7442, ADAMANT, -1),
61 RUNITE(7450, new Item[]{new Item(451), new Item(453, 8)}, new Item[]{new Item(2363)}, 50, 85),
62 RUNITE_5(7449, RUNITE, 5),
63 RUNITE_10(7448, RUNITE, 10),
64 RUNITE_X(7447, RUNITE, -1);
65
67 private static final ImmutableSet<SmeltingData> VALUES = Sets.immutableEnumSet(EnumSet.allOf(SmeltingData.class));
68
70 private final int buttonId;
71
73 public final Item[] required;
74
76 public final Item[] produced;
77
79 public final double experience;
80
82 public final int requirement;
83
85 public final int amount;
86
88 SmeltingData(int buttonId, Item[] required, Item[] produced, double experience, int requirement) {
89 this.buttonId = buttonId;
90 this.required = required;
91 this.produced = produced;
92 this.experience = experience;
93 this.requirement = requirement;
94 this.amount = 1;
95 }
96
98 SmeltingData(int buttonId, SmeltingData definition, int amount) {
99 this.buttonId = buttonId;
100 this.required = definition.required;
101 this.produced = definition.produced;
102 this.experience = definition.experience;
103 this.requirement = definition.requirement;
104 this.amount = amount;
105 }
106
108 public static Optional<SmeltingData> getDefinition(int buttonId) {
109 return VALUES.stream().filter(def -> def.buttonId == buttonId).findAny();
110 }
111
113 public static Optional<SmeltingData> getDefinitionByItem(int itemId) {
114 for (SmeltingData data : VALUES) {
115 for (Item item : data.required) {
116 if (item.getId() == itemId) {
117 return Optional.of(data);
118 }
119 }
120 }
121 return Optional.empty();
122 }
123
124 public static SmeltingData getSmeltData(int itemId) {
125 switch(itemId) {
126 case 438:
127 case 436:
128 return BRONZE;
129 case 440:
130 return IRON;
131 case 442:
132 return SILVER;
133 case 444:
134 return GOLD;
135 case 447:
136 return MITHRIL;
137 case 449:
138 return ADAMANT;
139 case 451:
140 return RUNITE;
141 }
142 return null;
143 }
144}
SmeltingData(int buttonId, SmeltingData definition, int amount)
static Optional< SmeltingData > getDefinitionByItem(int itemId)
static Optional< SmeltingData > getDefinition(int buttonId)
SmeltingData(int buttonId, Item[] required, Item[] produced, double experience, int requirement)