RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.world.items.ItemDefinition Class Reference

Represents all of an in-game Item's attributes. More...

Collaboration diagram for com.runehive.game.world.items.ItemDefinition:

Public Member Functions

String getDestroyMessage ()
 Gets the item destroy message.
int getId ()
 Gets the item id.
String getName ()
 Gets the item name.
boolean isNoted ()
 Gets the item note state.
 ItemDefinition (int id, String name)

Static Public Member Functions

static ItemDefinition[] create (String path)
static GsonParser createParser ()
static void dump (ItemDefinition[] definitions, String path)
static void dump (String path)
static ItemDefinition[] fromClientDump (String path)
static ItemDefinition get (int id)
 Gets an item definition.
static void merge (String clientDumpFilePath, String wikiDumpPath, String dumpPath)

Static Public Attributes

static final ItemDefinition DEFAULT = new ItemDefinition(1, "null")
static ItemDefinition[] DEFINITIONS
 An array of item definitions.

Private Attributes

int attack_anim
Map< FightType, Integer > attack_animations
int base_value
int block_animation
int[] bonuses
boolean destroyable
String destroyMessage
EquipmentType equipmentType
int highAlch
final int id
int lowAlch
final String name
int notedId
RangedWeaponDefinition rangedDefinition
int[] requirements
int run_animation
boolean stackable
int stand_animation
int street_value
boolean tradeable
boolean twoHanded
int unnotedId
int walk_animation
WeaponInterface weaponInterface
double weight

Static Private Attributes

static final Map< FightType, Integer > EMPTY = new HashMap<>()

Detailed Description

Represents all of an in-game Item's attributes.

Author
Michael | Chex
Daniel | Obey

Definition at line 28 of file ItemDefinition.java.

Constructor & Destructor Documentation

◆ ItemDefinition()

com.runehive.game.world.items.ItemDefinition.ItemDefinition ( int id,
String name )

Definition at line 63 of file ItemDefinition.java.

63 {
64 this.id = id;
65 this.name = name;
66 this.destroyMessage = null;
67 this.destroyable = false;
68 this.stackable = false;
69 this.tradeable = true;
70 this.twoHanded = false;
71 this.unnotedId = id;
72 this.notedId = id;
73 this.street_value = 0;
74 this.base_value = 0;
75 this.highAlch = 0;
76 this.lowAlch = 0;
77 this.weight = 0;
78 this.stand_animation = MobAnimation.PLAYER_STAND;
79 this.walk_animation = MobAnimation.PLAYER_WALK;
80 this.run_animation = MobAnimation.PLAYER_RUN;
81 this.attack_animations = EMPTY;
82 this.block_animation = -1;
83 this.equipmentType = EquipmentType.NOT_WIELDABLE;
84 this.weaponInterface = null;
85 this.rangedDefinition = null;
86 this.requirements = EMPTY_REQUIREMENTS;
87 this.bonuses = EMPTY_BONUSES;
88 }

References EMPTY, id, name, com.runehive.game.world.items.containers.equipment.EquipmentType.NOT_WIELDABLE, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_RUN, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_STAND, and com.runehive.game.world.entity.mob.MobAnimation.PLAYER_WALK.

Referenced by create(), createParser(), dump(), dump(), fromClientDump(), get(), and merge().

Here is the caller graph for this function:

Member Function Documentation

◆ create()

ItemDefinition[] com.runehive.game.world.items.ItemDefinition.create ( String path)
static

Definition at line 226 of file ItemDefinition.java.

226 {
227 ItemDefinition[] definitions = new ItemDefinition[Config.ITEM_DEFINITION_LIMIT];
228
229 new GsonParser(path) {
230
231 @Override
232 public void initialize(int size) {
233 createParser().run();
234 }
235
236 @Override
237 protected void parse(JsonObject data) {
238 int id = data.get("id").getAsInt();
239 String name = data.get("name").getAsString();
240
241 ItemDefinition definition = definitions[id] = new ItemDefinition(id, name);
242 ItemDefinition old = DEFINITIONS[id];
243
244 if (data.has("destroyable")) {
245 definition.destroyable = data.get("destroyable").getAsBoolean();
246 }
247
248 if (data.has("destroy-message")) {
249 definition.destroyable = true;
250 definition.destroyMessage = data.get("destroy-message").getAsString();
251 }
252
253 if (data.has("stackable")) {
254 definition.stackable = data.get("stackable").getAsBoolean();
255 }
256
257 if (data.has("tradeable")) {
258 definition.tradeable = data.get("tradeable").getAsBoolean();
259 }
260
261 if (data.has("two-handed")) {
262 definition.twoHanded = data.get("two-handed").getAsBoolean();
263 }
264
265 if (data.has("noted-id")) {
266 definition.notedId = data.get("noted-id").getAsInt();
267 }
268
269 if (data.has("unnoted-id")) {
270 definition.unnotedId = data.get("unnoted-id").getAsInt();
271 }
272
273 if (data.has("street-value")) {
274 definition.street_value = data.get("street-value").getAsInt();
275 } else if (old != null) {
276 definition.street_value = old.street_value;
277 }
278
279 if (data.has("base-value")) {
280 definition.base_value = data.get("base-value").getAsInt();
281 }
282
283 if (data.has("high-alch")) {
284 definition.highAlch = data.get("high-alch").getAsInt();
285 }
286
287 if (data.has("low-alch")) {
288 definition.lowAlch = data.get("low-alch").getAsInt();
289 }
290
291 if (data.has("weight")) {
292 definition.weight = data.get("weight").getAsDouble();
293 }
294
295 if (old != null && old.equipmentType != EquipmentType.NOT_WIELDABLE) {
296 definition.equipmentType = old.equipmentType;
297 } else if (data.has("equipment-slot")) {
298 definition.equipmentType = EquipmentType.valueOf(data.get("equipment-slot").getAsString());
299 }
300
301 for (int index = 0; index < BONUS_CONFIG_FIELD_NAMES.length; index++) {
302 String bonusName = BONUS_CONFIG_FIELD_NAMES[index];
303 if (data.has(bonusName)) {
304 if (definition.bonuses == EMPTY_BONUSES) {
305 definition.bonuses = new int[EMPTY_BONUSES.length];
306 }
307 definition.bonuses[index] = data.get(bonusName).getAsInt();
308 }
309 }
310
311 if (old != null) {
312 definition.weaponInterface = old.weaponInterface;
313 definition.requirements = old.requirements;
314 definition.rangedDefinition = old.rangedDefinition;
315 definition.stand_animation = old.stand_animation;
316 definition.walk_animation = old.walk_animation;
317 definition.run_animation = old.run_animation;
318 definition.attack_animations = old.attack_animations;
319 definition.block_animation = old.block_animation;
320 }
321 }
322 }.run();
323
324 return definitions;
325 }
val index

References attack_animations, block_animation, bonuses, createParser(), DEFINITIONS, equipmentType, id, com.runehive.Config.ITEM_DEFINITION_LIMIT, ItemDefinition(), name, com.runehive.game.world.items.containers.equipment.EquipmentType.NOT_WIELDABLE, rangedDefinition, requirements, com.runehive.util.parser.GenericParser.run(), run_animation, stand_animation, street_value, walk_animation, and weaponInterface.

Referenced by com.runehive.util.parser.old.EquipmentDefinitionParser.main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createParser()

GsonParser com.runehive.game.world.items.ItemDefinition.createParser ( )
static

Definition at line 90 of file ItemDefinition.java.

90 {
91 return new GsonParser("def/item/item_definitions", false) {
92
93 @Override
94 public void initialize(int size) {
95 DEFINITIONS = new ItemDefinition[Config.ITEM_DEFINITION_LIMIT];
96 }
97
98 @Override
99 protected void parse(JsonObject data) {
100 int id = data.get("id").getAsInt();
101 String name = data.get("name").getAsString();
102
103 ItemDefinition definition = new ItemDefinition(id, name);
104
105 if (data.has("destroyable")) {
106 definition.destroyable = data.get("destroyable").getAsBoolean();
107 }
108
109 if (data.has("destroy-message")) {
110 definition.destroyable = true;
111 definition.destroyMessage = data.get("destroy-message").getAsString();
112 }
113
114 if (data.has("stackable")) {
115 definition.stackable = data.get("stackable").getAsBoolean();
116 }
117
118 if (data.has("tradeable")) {
119 definition.tradeable = data.get("tradeable").getAsBoolean();
120 }
121
122 if (data.has("two-handed")) {
123 definition.twoHanded = data.get("two-handed").getAsBoolean();
124 }
125
126 if (data.has("noted-id")) {
127 definition.notedId = data.get("noted-id").getAsInt();
128 }
129
130 if (data.has("unnoted-id")) {
131 definition.unnotedId = data.get("unnoted-id").getAsInt();
132 }
133
134 if (data.has("street-value")) {
135 definition.street_value = data.get("street-value").getAsInt();
136 }
137
138 if (data.has("base-value")) {
139 definition.base_value = data.get("base-value").getAsInt();
140 }
141
142 if (data.has("high-alch")) {
143 definition.highAlch = data.get("high-alch").getAsInt();
144 }
145
146 if (data.has("low-alch")) {
147 definition.lowAlch = data.get("low-alch").getAsInt();
148 }
149
150 if (data.has("weight")) {
151 definition.weight = data.get("weight").getAsDouble();
152 }
153
154 if (data.has("equipment-slot")) {
155 definition.equipmentType = EquipmentType.valueOf(data.get("equipment-slot").getAsString());
156 }
157
158 if (data.has("weapon-interface")) {
159 definition.weaponInterface = WeaponInterface.valueOf(data.get("weapon-interface").getAsString());
160 }
161
162 for (int index = 0; index < SKILL_REQUIREMENT_CONFIG_FIELD_NAMES.length; index++) {
163 String skillRequirement = SKILL_REQUIREMENT_CONFIG_FIELD_NAMES[index];
164 if (data.has(skillRequirement)) {
165 if (definition.requirements == EMPTY_REQUIREMENTS) {
166 definition.requirements = new int[EMPTY_REQUIREMENTS.length];
167 }
168 definition.requirements[index] = data.get(skillRequirement).getAsInt();
169 }
170 }
171
172 for (int index = 0; index < BONUS_CONFIG_FIELD_NAMES.length; index++) {
173 String bonusName = BONUS_CONFIG_FIELD_NAMES[index];
174 if (data.has(bonusName)) {
175 if (definition.bonuses == EMPTY_BONUSES) {
176 definition.bonuses = new int[EMPTY_BONUSES.length];
177 }
178 definition.bonuses[index] = data.get(bonusName).getAsInt();
179 }
180 }
181
182 if (data.has("ranged-type") && data.has("allowed")) {
183 RangedWeaponType type = builder.fromJson(data.get("ranged-type"), RangedWeaponType.class);
184 RangedAmmunition[] allowed = builder.fromJson(data.get("allowed"), RangedAmmunition[].class);
185 definition.rangedDefinition = new RangedWeaponDefinition(type, allowed);
186 }
187
188 if (data.has("stand-animation")) {
189 definition.stand_animation = data.get("stand-animation").getAsInt();
190 }
191
192 if (data.has("walk-animation")) {
193 definition.walk_animation = data.get("walk-animation").getAsInt();
194 }
195
196 if (data.has("run-animation")) {
197 definition.run_animation = data.get("run-animation").getAsInt();
198 }
199
200 if (data.has("attack-animations")) {
201 JsonObject object = (JsonObject) data.get("attack-animations");
202 definition.attack_animations = new HashMap<>(object.entrySet().size());
203
204 for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
205 FightType fightType = FightType.valueOf(entry.getKey());
206 int animation = entry.getValue().getAsInt();
207
208 definition.attack_animations.put(fightType, animation);
209 }
210 }
211
212 if (data.has("block-animation")) {
213 definition.block_animation = data.get("block-animation").getAsInt();
214 }
215
216 DEFINITIONS[id] = definition;
217 }
218
219 @Override
220 protected void onEnd() {
221 ItemDefLoader.load();
222 }
223 };
224 }

References attack_animations, bonuses, DEFINITIONS, id, com.runehive.Config.ITEM_DEFINITION_LIMIT, ItemDefinition(), name, and requirements.

Referenced by create(), com.runehive.util.tools.wiki.impl.BonusParser.finish(), com.runehive.util.tools.wiki.impl.NpcDropsParser.generateTables(), com.runehive.util.parser.old.EquipmentDefinitionParser.initialize(), com.runehive.game.world.entity.mob.npc.drop.NpcDropTable.main(), com.runehive.util.tools.ItemDBdefUpdate.main(), and com.runehive.RuneHive.processSequentialStartupTasks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump() [1/2]

void com.runehive.game.world.items.ItemDefinition.dump ( ItemDefinition[] definitions,
String path )
static

Definition at line 432 of file ItemDefinition.java.

432 {
433 JsonSaver saver = new JsonSaver();
434
435 for (ItemDefinition definition : definitions) {
436 if (definition == null) continue;
437 if (definition.name.equals("null")) continue;
438
439 saver.current().addProperty("id", definition.id);
440 saver.current().addProperty("name", definition.name);
441
442 if (definition.destroyMessage != null) {
443 saver.current().addProperty("destroy-message", definition.destroyMessage);
444 } else if (definition.destroyable) {
445 saver.current().addProperty("destroyable", true);
446 }
447
448 if (definition.stackable) {
449 saver.current().addProperty("stackable", true);
450 }
451
452 if (!definition.tradeable) {
453 saver.current().addProperty("tradeable", false);
454 }
455
456 if (definition.twoHanded) {
457 saver.current().addProperty("two-handed", true);
458 }
459
460 if (definition.unnotedId != definition.id) {
461 saver.current().addProperty("unnoted-id", definition.unnotedId);
462 }
463
464 if (definition.notedId != definition.id) {
465 saver.current().addProperty("noted-id", definition.notedId);
466 }
467
468 if (definition.lowAlch > 1) {
469 saver.current().addProperty("low-alch", definition.lowAlch);
470 }
471
472 if (definition.highAlch > 1) {
473 saver.current().addProperty("high-alch", definition.highAlch);
474 }
475
476 if (definition.base_value > 1) {
477 saver.current().addProperty("base-value", definition.base_value);
478 }
479
480 if (definition.street_value > 1) {
481 saver.current().addProperty("street-value", definition.street_value);
482 }
483
484 if (definition.weight != 0) {
485 saver.current().addProperty("weight", definition.weight);
486 }
487
488 if (definition.stand_animation != MobAnimation.PLAYER_STAND) {
489 saver.current().addProperty("stand-animation", definition.stand_animation);
490 }
491
492 if (definition.walk_animation != MobAnimation.PLAYER_WALK) {
493 saver.current().addProperty("walk-animation", definition.walk_animation);
494 }
495
496 if (definition.run_animation != MobAnimation.PLAYER_RUN) {
497 saver.current().addProperty("run-animation", definition.run_animation);
498 }
499
500 if (definition.attack_animations != EMPTY) {
501 saver.current().add("attack-animations", saver.serializer().toJsonTree(definition.attack_animations));
502 }
503
504 if (definition.block_animation != -1) {
505 saver.current().addProperty("block-animation", definition.block_animation);
506 }
507
508 if (definition.equipmentType != EquipmentType.NOT_WIELDABLE) {
509 saver.current().addProperty("equipment-slot", definition.equipmentType.name());
510 }
511
512 if (definition.weaponInterface != null && definition.weaponInterface != WeaponInterface.UNARMED) {
513 saver.current().addProperty("weapon-interface", definition.weaponInterface.name());
514 }
515
516 for (int index = 0; index < SKILL_REQUIREMENT_CONFIG_FIELD_NAMES.length; index++) {
517 if (definition.requirements[index] > 0)
518 saver.current().addProperty(SKILL_REQUIREMENT_CONFIG_FIELD_NAMES[index], definition.requirements[index]);
519 }
520
521 for (int index = 0; index < BONUS_CONFIG_FIELD_NAMES.length; index++) {
522 if (definition.bonuses[index] != 0)
523 saver.current().addProperty(BONUS_CONFIG_FIELD_NAMES[index], definition.bonuses[index]);
524 }
525
526 if (definition.rangedDefinition != null) {
527 saver.current().addProperty("ranged-type", definition.rangedDefinition.getType().name());
528 saver.current().add("allowed", saver.serializer().toJsonTree(definition.rangedDefinition.getAllowed()));
529 }
530
531 saver.split();
532 }
533
534 saver.publish("./data/" + path + ".json");
535 }

References com.runehive.util.parser.JsonSaver.current(), EMPTY, ItemDefinition(), com.runehive.game.world.items.containers.equipment.EquipmentType.NOT_WIELDABLE, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_RUN, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_STAND, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_WALK, com.runehive.util.parser.JsonSaver.publish(), com.runehive.util.parser.JsonSaver.serializer, com.runehive.util.parser.JsonSaver.split(), and com.runehive.game.world.entity.combat.weapon.WeaponInterface.UNARMED.

Referenced by com.runehive.util.tools.wiki.impl.BonusParser.finish(), com.runehive.util.parser.old.EquipmentDefinitionParser.main(), merge(), and com.runehive.util.parser.old.EquipmentDefinitionParser.onEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump() [2/2]

void com.runehive.game.world.items.ItemDefinition.dump ( String path)
static

Definition at line 537 of file ItemDefinition.java.

537 {
538 JsonSaver saver = new JsonSaver();
539
540 for (ItemDefinition definition : DEFINITIONS) {
541 if (definition == null) continue;
542 if (definition.name.equals("null")) continue;
543
544 saver.current().addProperty("id", definition.id);
545 saver.current().addProperty("name", definition.name);
546
547 if (definition.destroyMessage != null) {
548 saver.current().addProperty("destroy-message", definition.destroyMessage);
549 } else if (definition.destroyable) {
550 saver.current().addProperty("destroyable", true);
551 }
552
553 if (definition.stackable) {
554 saver.current().addProperty("stackable", true);
555 }
556
557 if (!definition.tradeable) {
558 saver.current().addProperty("tradeable", false);
559 }
560
561 if (definition.twoHanded) {
562 saver.current().addProperty("two-handed", true);
563 }
564
565 if (definition.unnotedId != definition.id) {
566 saver.current().addProperty("unnoted-id", definition.unnotedId);
567 }
568
569 if (definition.notedId != definition.id) {
570 saver.current().addProperty("noted-id", definition.notedId);
571 }
572
573 if (definition.lowAlch > 1) {
574 saver.current().addProperty("low-alch", definition.lowAlch);
575 }
576
577 if (definition.highAlch > 1) {
578 saver.current().addProperty("high-alch", definition.highAlch);
579 }
580
581 if (definition.base_value > 1) {
582 saver.current().addProperty("base-value", definition.base_value);
583 }
584
585 if (definition.street_value > 1) {
586 saver.current().addProperty("street-value", definition.street_value);
587 }
588
589 if (definition.weight != 0) {
590 saver.current().addProperty("weight", definition.weight);
591 }
592
593 if (definition.stand_animation != MobAnimation.PLAYER_STAND) {
594 saver.current().addProperty("stand-animation", definition.stand_animation);
595 }
596
597 if (definition.walk_animation != MobAnimation.PLAYER_WALK) {
598 saver.current().addProperty("walk-animation", definition.walk_animation);
599 }
600
601 if (definition.run_animation != MobAnimation.PLAYER_RUN) {
602 saver.current().addProperty("run-animation", definition.run_animation);
603 }
604
605 if (definition.attack_animations != EMPTY) {
606 saver.current().add("attack-animations", saver.serializer().toJsonTree(definition.attack_animations));
607 }
608
609 if (definition.block_animation != -1) {
610 saver.current().addProperty("block-animation", definition.block_animation);
611 }
612
613 if (definition.equipmentType != EquipmentType.NOT_WIELDABLE) {
614 saver.current().addProperty("equipment-slot", definition.equipmentType.name());
615 }
616
617 if (definition.weaponInterface != null && definition.weaponInterface != WeaponInterface.UNARMED) {
618 saver.current().addProperty("weapon-interface", definition.weaponInterface.name());
619 }
620
621 for (int index = 0; index < SKILL_REQUIREMENT_CONFIG_FIELD_NAMES.length; index++) {
622 if (definition.requirements[index] > 0)
623 saver.current().addProperty(SKILL_REQUIREMENT_CONFIG_FIELD_NAMES[index], definition.requirements[index]);
624 }
625
626 for (int index = 0; index < BONUS_CONFIG_FIELD_NAMES.length; index++) {
627 if (definition.bonuses[index] != 0)
628 saver.current().addProperty(BONUS_CONFIG_FIELD_NAMES[index], definition.bonuses[index]);
629 }
630
631 if (definition.rangedDefinition != null) {
632 saver.current().addProperty("ranged-type", definition.rangedDefinition.getType().name());
633 saver.current().add("allowed", saver.serializer().toJsonTree(definition.rangedDefinition.getAllowed()));
634 }
635
636 saver.split();
637 }
638
639 saver.publish("./data/" + path + ".json");
640 }

References com.runehive.util.parser.JsonSaver.current(), DEFINITIONS, EMPTY, ItemDefinition(), com.runehive.game.world.items.containers.equipment.EquipmentType.NOT_WIELDABLE, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_RUN, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_STAND, com.runehive.game.world.entity.mob.MobAnimation.PLAYER_WALK, com.runehive.util.parser.JsonSaver.publish(), com.runehive.util.parser.JsonSaver.serializer, com.runehive.util.parser.JsonSaver.split(), and com.runehive.game.world.entity.combat.weapon.WeaponInterface.UNARMED.

Here is the call graph for this function:

◆ fromClientDump()

ItemDefinition[] com.runehive.game.world.items.ItemDefinition.fromClientDump ( String path)
static

Definition at line 327 of file ItemDefinition.java.

327 {
328 ItemDefinition[] definitions = new ItemDefinition[Config.ITEM_DEFINITION_LIMIT];
329
330 new GsonParser(path) {
331 @Override
332 protected void parse(JsonObject data) {
333 int id = data.get("id").getAsInt();
334 String name = data.get("name").getAsString();
335
336 ItemDefinition definition = definitions[id] = new ItemDefinition(id, name);
337
338 if (data.has("stackable")) {
339 definition.stackable = data.get("stackable").getAsBoolean();
340 }
341 if (data.has("destroyable")) {
342 definition.destroyable = data.get("destroyable").getAsBoolean();
343 }
344 if (data.has("noted-id")) {
345 definition.notedId = data.get("noted-id").getAsInt();
346 }
347 if (data.has("unnoted-id")) {
348 definition.unnotedId = data.get("unnoted-id").getAsInt();
349 }
350 if (data.has("base-value")) {
351 definition.base_value = data.get("base-value").getAsInt();
352 definition.lowAlch = (int) (definition.base_value * 0.40);
353 definition.highAlch = (int) (definition.base_value * 0.60);
354 }
355 if (data.has("equipment-type")) {
356 definition.equipmentType = EquipmentType.valueOf(data.get("equipment-type").getAsString());
357 }
358 }
359 }.run();
360
361 return definitions;
362 }

References base_value, id, com.runehive.Config.ITEM_DEFINITION_LIMIT, ItemDefinition(), and name.

Referenced by merge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

ItemDefinition com.runehive.game.world.items.ItemDefinition.get ( int id)
static

Gets an item definition.

Parameters
idThe definition's item id.
Returns
The item definition for the item id, or null if the item id is out of bounds.

Definition at line 649 of file ItemDefinition.java.

649 {
650 if (id < 0 || id >= DEFINITIONS.length) {
651 return DEFAULT;
652 }
653
654 if (DEFINITIONS[id] == null) {
655 return DEFINITIONS[id] = new ItemDefinition(id, "null");
656 }
657
658
659 return DEFINITIONS[id];
660 }

References DEFAULT, DEFINITIONS, id, and ItemDefinition().

Referenced by com.runehive.content.tradingpost.TradingPost.addToItemHistory(), com.runehive.content.RoyaltyProgram.append(), com.runehive.content.skill.impl.crafting.impl.Glass.blow(), com.runehive.content.tradingpost.TradingPost.buyingDialogueOptions(), com.runehive.content.skill.impl.DestructionSkillAction.canRun(), com.runehive.content.skill.impl.hunter.net.Netting.canSchedule(), com.runehive.content.bags.ItemBag.check(), com.runehive.content.skill.impl.woodcutting.WoodcuttingAction.chop(), com.runehive.content.skill.impl.crafting.impl.Jewellery.click(), com.runehive.content.skill.impl.cooking.Cooking.cook(), com.runehive.content.skill.impl.crafting.impl.Glass.craft(), com.runehive.content.gambling.GambleManager.deposit(), com.runehive.content.skill.impl.magic.spell.SpellCasting.enchant(), com.runehive.content.skill.impl.fishing.FishingAction.fish(), com.runehive.game.world.items.Item.getDefinition(), com.runehive.content.tradingpost.TradingPost.getItemArrayFromActiveListings(), com.runehive.content.tradingpost.TradingPost.getItemArrayFromItemHistory(), com.runehive.content.tradingpost.TradingPost.getSearchResults(), com.runehive.content.lms.LMSGame.giveChestItems(), com.runehive.content.tradingpost.TradingPost.handleBuyingButton(), com.runehive.net.packet.in.DropItemPacketListener.handlePacket(), com.runehive.content.skill.impl.fishing.Fishing.hasFishingItems(), com.runehive.content.activity.impl.duelarena.DuelRule.inventorySlotsRequired(), com.runehive.content.bags.impl.CoalBag.isAllowed(), com.runehive.content.bags.impl.GemBag.isAllowed(), com.runehive.content.itemaction.impl.CrawsBow.itemOnItem(), com.runehive.content.itemaction.impl.ThammaronsSceptre.itemOnItem(), com.runehive.content.itemaction.impl.ViggorasChainmace.itemOnItem(), com.runehive.content.collectionlog.CollectionLog.logItem(), com.runehive.util.tools.ItemDBdefUpdate.main(), com.runehive.content.lms.LMSGame.onKill(), com.runehive.util.parser.impl.NpcDropParser.parse(), com.runehive.util.parser.old.EquipmentDefinitionParser.parse(), com.runehive.content.tradingpost.TradingPost.purchase(), com.runehive.content.clanchannel.content.ClanShowcase.remove(), com.runehive.content.lms.LMSGame.resupplyKiller(), com.runehive.content.skill.impl.prayer.BoneSacrifice.sacrifice(), com.runehive.content.DropDisplay.search(), com.runehive.content.dialogue.ChatBoxItemDialogue.sendInterface(), com.runehive.content.tradingpost.TradingPost.sendItemHistoryData(), com.runehive.content.skill.impl.crafting.impl.Stringing.string(), com.runehive.content.skill.impl.crafting.impl.Tanning.tan(), com.runehive.content.store.currency.impl.ItemCurrency.toString(), com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets(), and com.runehive.game.world.items.containers.bank.Bank.withdraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDestroyMessage()

String com.runehive.game.world.items.ItemDefinition.getDestroyMessage ( )

Gets the item destroy message.

Returns
The item destroy message.

Definition at line 685 of file ItemDefinition.java.

685 {
686 return destroyMessage;
687 }

References destroyMessage.

Referenced by com.runehive.game.world.items.Item.getDestroyMessage().

Here is the caller graph for this function:

◆ getId()

int com.runehive.game.world.items.ItemDefinition.getId ( )

Gets the item id.

Returns
The item id.

Definition at line 667 of file ItemDefinition.java.

667 {
668 return id;
669 }

References id.

Referenced by com.runehive.util.tools.wiki.impl.NpcDropsParser.generateTables(), com.runehive.util.tools.ItemDBdefUpdate.main(), com.runehive.game.world.items.containers.pricechecker.PriceChecker.search(), and com.runehive.game.world.items.containers.pricechecker.PriceChecker.searchItem().

Here is the caller graph for this function:

◆ getName()

String com.runehive.game.world.items.ItemDefinition.getName ( )

Gets the item name.

Returns
The item name.

Definition at line 676 of file ItemDefinition.java.

676 {
677 return name;
678 }

References name.

Referenced by com.runehive.content.tradingpost.TradingPost.addToItemHistory(), com.runehive.content.RoyaltyProgram.append(), com.runehive.content.skill.impl.crafting.impl.Glass.blow(), com.runehive.content.tradingpost.TradingPost.buyingDialogueOptions(), com.runehive.content.skill.impl.DestructionSkillAction.canRun(), com.runehive.content.skill.impl.hunter.net.Netting.canSchedule(), com.runehive.content.bags.ItemBag.check(), com.runehive.content.skill.impl.woodcutting.WoodcuttingAction.chop(), com.runehive.content.skill.impl.crafting.impl.Jewellery.click(), com.runehive.content.skill.impl.cooking.Cooking.cook(), com.runehive.content.skill.impl.crafting.impl.Glass.craft(), com.runehive.content.skill.impl.magic.spell.SpellCasting.enchant(), com.runehive.util.tools.wiki.impl.BonusParser.finish(), com.runehive.content.skill.impl.fishing.FishingAction.fish(), com.runehive.util.tools.wiki.impl.NpcDropsParser.generateTables(), com.runehive.game.world.items.Item.getName(), com.runehive.content.tradingpost.TradingPost.getSearchResults(), com.runehive.content.lms.LMSGame.giveChestItems(), com.runehive.content.tradingpost.TradingPost.handleBuyingButton(), com.runehive.content.skill.impl.fishing.Fishing.hasFishingItems(), com.runehive.content.bags.impl.CoalBag.isAllowed(), com.runehive.content.bags.impl.GemBag.isAllowed(), com.runehive.content.itemaction.impl.CrawsBow.itemOnItem(), com.runehive.content.itemaction.impl.ThammaronsSceptre.itemOnItem(), com.runehive.content.itemaction.impl.ViggorasChainmace.itemOnItem(), com.runehive.content.collectionlog.CollectionLog.logItem(), com.runehive.util.tools.ItemDBdefUpdate.main(), com.runehive.util.parser.old.EquipmentDefinitionParser.parse(), com.runehive.content.tradingpost.TradingPost.purchase(), com.runehive.content.clanchannel.content.ClanShowcase.remove(), com.runehive.content.skill.impl.prayer.BoneSacrifice.sacrifice(), com.runehive.content.DropDisplay.search(), com.runehive.game.world.items.containers.pricechecker.PriceChecker.search(), com.runehive.game.world.items.containers.pricechecker.PriceChecker.searchItem(), com.runehive.content.tradingpost.TradingPost.selectItemToList(), com.runehive.content.dialogue.ChatBoxItemDialogue.sendInterface(), com.runehive.content.tradingpost.TradingPost.sendItemHistoryData(), com.runehive.content.skill.impl.crafting.impl.Stringing.string(), com.runehive.content.skill.impl.crafting.impl.Tanning.tan(), com.runehive.content.store.currency.impl.ItemCurrency.toString(), and com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets().

Here is the caller graph for this function:

◆ isNoted()

boolean com.runehive.game.world.items.ItemDefinition.isNoted ( )

Gets the item note state.

Returns
True if the item is noted;

Definition at line 694 of file ItemDefinition.java.

694 {
695 return unnotedId != id;
696 }

References id, and unnotedId.

Referenced by com.runehive.content.tradingpost.TradingPost.getItemArrayFromActiveListings(), com.runehive.content.tradingpost.TradingPost.getItemArrayFromItemHistory(), com.runehive.game.world.items.Item.isNoted(), and com.runehive.game.world.items.containers.pricechecker.PriceChecker.searchItem().

Here is the caller graph for this function:

◆ merge()

void com.runehive.game.world.items.ItemDefinition.merge ( String clientDumpFilePath,
String wikiDumpPath,
String dumpPath )
static

Definition at line 364 of file ItemDefinition.java.

364 {
365 new GsonParser(wikiDumpPath) {
366 LinkedListMultimap<String, JsonObject> multimap = LinkedListMultimap.create();
367
368 @Override
369 protected void parse(JsonObject data) {
370 String name = data.get("name").getAsString();
371
372 if (name.isEmpty())
373 return;
374
375 multimap.put(name, data);
376 }
377
378 @Override
379 protected void onEnd() {
380 ItemDefinition[] definitions = fromClientDump(clientDumpFilePath);
381
382 for (ItemDefinition definition : definitions) {
383 if (definition == null || definition.name.equals("null") || definition.name.isEmpty())
384 continue;
385
386 if (!multimap.containsKey(definition.name))
387 continue;
388
389 List<JsonObject> value = multimap.get(definition.name);
390 JsonObject object = value.get(value.size() - 1);
391
392 if (value.size() > 1)
393 multimap.remove(definition.name, object);
394
395 if (object.has("destroy-message"))
396 definition.destroyMessage = object.get("destroy-message").getAsString();
397
398 if (object.has("tradable"))
399 definition.tradeable = object.get("tradable").getAsBoolean();
400
401 if (object.has("weight"))
402 definition.weight = object.get("weight").getAsDouble();
403
404 if (definition.isNoted()) {
405 continue;
406 }
407
408 if (object.has("two-handed"))
409 definition.twoHanded = object.get("two-handed").getAsBoolean();
410
411 if (object.has("equipment-type"))
412 definition.equipmentType = EquipmentType.valueOf(object.get("equipment-type").getAsString());
413
414 for (int index = 0; index < BONUS_CONFIG_FIELD_NAMES.length; index++) {
415 String bonusName = BONUS_CONFIG_FIELD_NAMES[index];
416 if (object.has(bonusName)) {
417 if (definition.bonuses == EMPTY_BONUSES) {
418 definition.bonuses = new int[EMPTY_BONUSES.length];
419 }
420 definition.bonuses[index] = object.get(bonusName).getAsInt();
421 }
422 }
423 }
424
425 DEFINITIONS = definitions;
426 dump(dumpPath);
427 }
428
429 }.run();
430 }

References DEFINITIONS, dump(), fromClientDump(), ItemDefinition(), and name.

Here is the call graph for this function:

Member Data Documentation

◆ attack_anim

int com.runehive.game.world.items.ItemDefinition.attack_anim
private

Definition at line 45 of file ItemDefinition.java.

◆ attack_animations

Map<FightType, Integer> com.runehive.game.world.items.ItemDefinition.attack_animations
private

Definition at line 48 of file ItemDefinition.java.

Referenced by create(), and createParser().

◆ base_value

int com.runehive.game.world.items.ItemDefinition.base_value
private

Definition at line 53 of file ItemDefinition.java.

Referenced by fromClientDump().

◆ block_animation

int com.runehive.game.world.items.ItemDefinition.block_animation
private

Definition at line 49 of file ItemDefinition.java.

Referenced by create().

◆ bonuses

int [] com.runehive.game.world.items.ItemDefinition.bonuses
private

Definition at line 61 of file ItemDefinition.java.

Referenced by create(), and createParser().

◆ DEFAULT

final ItemDefinition com.runehive.game.world.items.ItemDefinition.DEFAULT = new ItemDefinition(1, "null")
static

Definition at line 35 of file ItemDefinition.java.

Referenced by get().

◆ DEFINITIONS

◆ destroyable

boolean com.runehive.game.world.items.ItemDefinition.destroyable
private

Definition at line 40 of file ItemDefinition.java.

◆ destroyMessage

String com.runehive.game.world.items.ItemDefinition.destroyMessage
private

Definition at line 39 of file ItemDefinition.java.

Referenced by getDestroyMessage().

◆ EMPTY

final Map<FightType, Integer> com.runehive.game.world.items.ItemDefinition.EMPTY = new HashMap<>()
staticprivate

Definition at line 34 of file ItemDefinition.java.

Referenced by dump(), dump(), and ItemDefinition().

◆ equipmentType

EquipmentType com.runehive.game.world.items.ItemDefinition.equipmentType
private

Definition at line 57 of file ItemDefinition.java.

Referenced by create().

◆ highAlch

int com.runehive.game.world.items.ItemDefinition.highAlch
private

Definition at line 54 of file ItemDefinition.java.

◆ id

final int com.runehive.game.world.items.ItemDefinition.id
private

◆ lowAlch

int com.runehive.game.world.items.ItemDefinition.lowAlch
private

Definition at line 55 of file ItemDefinition.java.

◆ name

final String com.runehive.game.world.items.ItemDefinition.name
private

Definition at line 38 of file ItemDefinition.java.

Referenced by create(), createParser(), fromClientDump(), getName(), ItemDefinition(), and merge().

◆ notedId

int com.runehive.game.world.items.ItemDefinition.notedId
private

Definition at line 51 of file ItemDefinition.java.

◆ rangedDefinition

RangedWeaponDefinition com.runehive.game.world.items.ItemDefinition.rangedDefinition
private

Definition at line 59 of file ItemDefinition.java.

Referenced by create().

◆ requirements

int [] com.runehive.game.world.items.ItemDefinition.requirements
private

Definition at line 60 of file ItemDefinition.java.

Referenced by create(), and createParser().

◆ run_animation

int com.runehive.game.world.items.ItemDefinition.run_animation
private

Definition at line 47 of file ItemDefinition.java.

Referenced by create().

◆ stackable

boolean com.runehive.game.world.items.ItemDefinition.stackable
private

Definition at line 41 of file ItemDefinition.java.

◆ stand_animation

int com.runehive.game.world.items.ItemDefinition.stand_animation
private

Definition at line 44 of file ItemDefinition.java.

Referenced by create().

◆ street_value

int com.runehive.game.world.items.ItemDefinition.street_value
private

Definition at line 52 of file ItemDefinition.java.

Referenced by create().

◆ tradeable

boolean com.runehive.game.world.items.ItemDefinition.tradeable
private

Definition at line 43 of file ItemDefinition.java.

◆ twoHanded

boolean com.runehive.game.world.items.ItemDefinition.twoHanded
private

Definition at line 42 of file ItemDefinition.java.

◆ unnotedId

int com.runehive.game.world.items.ItemDefinition.unnotedId
private

Definition at line 50 of file ItemDefinition.java.

Referenced by isNoted().

◆ walk_animation

int com.runehive.game.world.items.ItemDefinition.walk_animation
private

Definition at line 46 of file ItemDefinition.java.

Referenced by create().

◆ weaponInterface

WeaponInterface com.runehive.game.world.items.ItemDefinition.weaponInterface
private

Definition at line 58 of file ItemDefinition.java.

Referenced by create().

◆ weight

double com.runehive.game.world.items.ItemDefinition.weight
private

Definition at line 56 of file ItemDefinition.java.


The documentation for this class was generated from the following file: