RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ItemDefinitionParser.java
1package com.osroyale.util.parser.old;
2
3import com.google.gson.JsonObject;
4import com.osroyale.util.parser.GsonParser;
5import com.osroyale.util.parser.old.defs.ItemDefinition;
6
35
36public class ItemDefinitionParser extends GsonParser {
37
38 public ItemDefinitionParser() {
39 super("def/item/item_definitions");
40 }
41
42 @Override
43 protected void parse(JsonObject data) {
44 final int id = data.get("id").getAsInt();
45 final String name = data.get("name").getAsString();
46 final boolean members = data.get("gameMembers").getAsBoolean();
47 final boolean tradeable = data.get("tradeable").getAsBoolean();
48 final boolean stackable = data.get("stackable").getAsBoolean();
49 final boolean droppable = data.get("droppable").getAsBoolean();
50 final boolean noteable = data.get("noteable").getAsBoolean();
51 final boolean noted = data.get("noted").getAsBoolean();
52 final int notedId = data.get("notedId").getAsInt();
53 final int street_value = data.get("street_value").getAsInt();
54 final int base_value = data.get("base_value").getAsInt();
55 final int high_alch = data.get("high_alch").getAsInt();
56 final int low_alch = data.get("low_alch").getAsInt();
57 final String examine = data.get("examine").getAsString();
58
59 String destroyMessage = "This item is valuable, you will not\\nget it back once lost.";
60 if (data.get("destroy_message") != null) {
61 destroyMessage = data.get("destroy_message").getAsString();
62 }
63
64 final double weight = data.get("weight").getAsDouble();
65
66 ItemDefinition.DEFINITIONS[id] = new ItemDefinition(id, name, members, tradeable, stackable, droppable, noteable, noted, notedId, street_value, base_value, high_alch, low_alch, examine, destroyMessage, weight);
67 }
68}