RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
DropDefinitionDumper.java
1package com.osroyale.util.tools;
2
3import com.osroyale.game.world.entity.mob.npc.definition.NpcDefinition;
4import com.osroyale.util.tools.DropDefinitionDumper.ItemDrop.Rarity;
5
6import java.io.IOException;
7import java.util.ArrayList;
8import java.util.List;
9import java.util.stream.Collectors;
10
34
36
37 public static void main(String[] args) throws IOException {
38 NpcDefinition.createParser().run();
39 int npcId = 260;
40 boolean rare_table = true;
41 String name = NpcDefinition.get(npcId).getName();
42
43 List<ItemDrop> drops = new ArrayList<>();
44
45 drops.add(new ItemDrop(536, 1, 1, Rarity. ALWAYS));
46 drops.add(new ItemDrop(1753, 1, 1, Rarity.ALWAYS));
47 drops.add(new ItemDrop(209, 1, 1, Rarity.COMMON));
48 drops.add(new ItemDrop(205, 1, 1, Rarity.COMMON));
49 drops.add(new ItemDrop(199, 1, 1, Rarity.UNCOMMON));
50 drops.add(new ItemDrop(211, 1, 1, Rarity.UNCOMMON));
51 drops.add(new ItemDrop(215, 1, 1, Rarity.UNCOMMON));
52 drops.add(new ItemDrop(201, 1, 1, Rarity.COMMON));
53 drops.add(new ItemDrop(203, 1, 1, Rarity.UNCOMMON));
54 drops.add(new ItemDrop(207, 1, 1, Rarity.UNCOMMON));
55 drops.add(new ItemDrop(213, 1, 1, Rarity.UNCOMMON));
56 drops.add(new ItemDrop(2485, 1, 1, Rarity.UNCOMMON));
57 drops.add(new ItemDrop(217, 1, 1, Rarity.UNCOMMON));
58 drops.add(new ItemDrop(1365, 1, 1, Rarity.COMMON));
59 drops.add(new ItemDrop(20173, 1, 1, Rarity.COMMON));
60 drops.add(new ItemDrop(1243, 1, 1, Rarity.UNCOMMON));
61 drops.add(new ItemDrop(12297, 1, 1, Rarity.UNCOMMON));
62 drops.add(new ItemDrop(20561, 1, 1, Rarity.UNCOMMON));
63 drops.add(new ItemDrop(1213, 1, 1, Rarity.UNCOMMON));
64 drops.add(new ItemDrop(995, 11, 440, Rarity.COMMON));
65 drops.add(new ItemDrop(9691, 75, 75, Rarity.COMMON));
66 drops.add(new ItemDrop(9699, 37, 37, Rarity.COMMON));
67 drops.add(new ItemDrop(11693, 15, 15, Rarity.COMMON));
68 drops.add(new ItemDrop(11695, 3, 3, Rarity.COMMON));
69 drops.add(new ItemDrop(11941, 2, 2, Rarity.UNCOMMON));
70 drops.add(new ItemDrop(449, 2, 2, Rarity.UNCOMMON));
71 drops.add(new ItemDrop(2722, 1, 1, Rarity.RARE));
72
73
74
75 if (rare_table) {
76 drops.add(new ItemDrop(20527, 3000, 3000, Rarity.COMMON));
77 drops.add(new ItemDrop(1623, 1, 1, Rarity.COMMON));
78 drops.add(new ItemDrop(1619, 1, 1, Rarity.UNCOMMON));
79 drops.add(new ItemDrop(1621, 1, 1, Rarity.UNCOMMON));
80 drops.add(new ItemDrop(1462, 1, 1, Rarity.UNCOMMON));
81 drops.add(new ItemDrop(1452, 1, 1, Rarity.UNCOMMON));
82 drops.add(new ItemDrop(561, 67, 67, Rarity.UNCOMMON));
83 drops.add(new ItemDrop(2363, 1, 1, Rarity.UNCOMMON));
84 drops.add(new ItemDrop(1247, 1, 1, Rarity.RARE));
85 drops.add(new ItemDrop(1319, 1, 1, Rarity.RARE));
86 drops.add(new ItemDrop(830, 5, 5, Rarity.RARE));
87 drops.add(new ItemDrop(1201, 1, 1, Rarity.RARE));
88 drops.add(new ItemDrop(892, 42, 42, Rarity.RARE));
89 drops.add(new ItemDrop(1373, 1, 1, Rarity.RARE));
90 drops.add(new ItemDrop(1617, 1, 1, Rarity.RARE));
91 drops.add(new ItemDrop(443, 100, 100, Rarity.RARE));
92 drops.add(new ItemDrop(829, 20, 20, Rarity.RARE));
93 drops.add(new ItemDrop(1185, 1, 1, Rarity.RARE));
94 drops.add(new ItemDrop(886, 150, 150, Rarity.RARE));
95 drops.add(new ItemDrop(563, 45, 45, Rarity.RARE));
96 drops.add(new ItemDrop(560, 45, 45, Rarity.RARE));
97 drops.add(new ItemDrop(1615, 1, 1, Rarity.RARE));
98 drops.add(new ItemDrop(1149, 1, 1, Rarity.RARE));
99 drops.add(new ItemDrop(2368, 1, 1, Rarity.RARE));
100 drops.add(new ItemDrop(1249, 1, 1, Rarity.VERY_RARE));
101 drops.add(new ItemDrop(2366, 1, 1, Rarity.VERY_RARE));
102 }
103
104 List<ItemDrop> always = drops.stream().filter(item -> item.rarity == Rarity.ALWAYS).collect(Collectors.toList());
105 List<ItemDrop> common = drops.stream().filter(item -> item.rarity == Rarity.COMMON).collect(Collectors.toList());
106 List<ItemDrop> uncommon = drops.stream().filter(item -> item.rarity == Rarity.UNCOMMON).collect(Collectors.toList());
107 List<ItemDrop> rare = drops.stream().filter(item -> item.rarity == Rarity.RARE).collect(Collectors.toList());
108 List<ItemDrop> very_rare = drops.stream().filter(item -> item.rarity == Rarity.VERY_RARE).collect(Collectors.toList());
109
110 System.out.println(" {");
111 System.out.println(" \"name\": \"" + name + "\",");
112 System.out.println(" \"npc\": [");
113 System.out.println(" " + npcId);
114 System.out.println(" ],");
115 System.out.println(" \"drop\": [");
116
117 if (!always.isEmpty()) {
118 for (int index = 0; index < always.size(); index++) {
119 ItemDrop item = always.get(index);
120
121 System.out.println(" {");
122 System.out.println(" \"id\": " + item.id + ",");
123 System.out.println(" \"minimum\": " + item.min + ",");
124 System.out.println(" \"maximum\": " + item.max + ",");
125 System.out.println(" \"chance\": " + item.rarity + "");
126
127 if (index + 1 == always.size()) {
128 System.out.println(" }");
129 } else {
130 System.out.println(" },");
131 }
132 }
133 }
134
135 if (!common.isEmpty()) {
136 for (int index = 0; index < common.size(); index++) {
137 ItemDrop item = common.get(index);
138
139 System.out.println(" {");
140 System.out.println(" \"id\": " + item.id + ",");
141 System.out.println(" \"minimum\": " + item.min + ",");
142 System.out.println(" \"maximum\": " + item.max + ",");
143 System.out.println(" \"chance\": " + item.rarity + "");
144
145 if (index + 1 == common.size() && uncommon.isEmpty() && rare.isEmpty() && very_rare.isEmpty()) {
146 System.out.println(" }");
147 } else {
148 System.out.println(" },");
149 }
150 }
151 }
152
153 if (!uncommon.isEmpty()) {
154 for (int index = 0; index < uncommon.size(); index++) {
155 ItemDrop item = uncommon.get(index);
156
157 System.out.println(" {");
158 System.out.println(" \"id\": " + item.id + ",");
159 System.out.println(" \"minimum\": " + item.min + ",");
160 System.out.println(" \"maximum\": " + item.max + ",");
161 System.out.println(" \"chance\": " + item.rarity + "");
162
163 if (index + 1 == uncommon.size() && rare.isEmpty() && very_rare.isEmpty()) {
164 System.out.println(" }");
165 } else {
166 System.out.println(" },");
167 }
168 }
169 }
170
171 if (!rare.isEmpty()) {
172 for (int index = 0; index < rare.size(); index++) {
173 ItemDrop item = rare.get(index);
174
175 System.out.println(" {");
176 System.out.println(" \"id\": " + item.id + ",");
177 System.out.println(" \"minimum\": " + item.min + ",");
178 System.out.println(" \"maximum\": " + item.max + ",");
179 System.out.println(" \"chance\": " + item.rarity + "");
180
181 if (index + 1 == rare.size() && very_rare.isEmpty()) {
182 System.out.println(" }");
183 } else {
184 System.out.println(" },");
185 }
186 }
187 }
188
189 if (!very_rare.isEmpty()) {
190 for (int index = 0; index < very_rare.size(); index++) {
191 ItemDrop item = very_rare.get(index);
192
193 System.out.println(" {");
194 System.out.println(" \"id\": " + item.id + ",");
195 System.out.println(" \"minimum\": " + item.min + ",");
196 System.out.println(" \"maximum\": " + item.max + ",");
197 System.out.println(" \"chance\": " + item.rarity + "");
198
199 if (index + 1 == very_rare.size()) {
200 System.out.println(" }");
201 } else {
202 System.out.println(" },");
203 }
204 }
205 }
206
207 System.out.println(" ]");
208 System.out.println("},");
209
210 }
211
212 static class ItemDrop {
213enum Rarity {
214 ALWAYS,
215 COMMON,
216 UNCOMMON,
217 RARE,
218 VERY_RARE;
219
220 public static Rarity get(String rarity) {
221 for (Rarity r : values()) {
222 if (r.name().equals(rarity)) {
223 return r;
224 }
225 }
226 return UNCOMMON;
227 }
228 }
229
230 public final int id;
231 public final int min, max;
232 public final Rarity rarity;
233
234 public ItemDrop(int id, int min, int max, Rarity rarity) {
235 this.id = id;
236 this.min = min;
237 this.max = max;
238 this.rarity = rarity;
239 }
240
241 @Override
242 public String toString() {
243 return "[" + id + ", " + min + ", " + max + ", " + rarity.name() + "]";
244 }
245 }
246}