RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.parser.old.ItemDefinitionParser Class Reference

Parses through the item definitions file and creates ItemDefinitions on startup. More...

Inheritance diagram for com.runehive.util.parser.old.ItemDefinitionParser:
Collaboration diagram for com.runehive.util.parser.old.ItemDefinitionParser:

Public Member Functions

 ItemDefinitionParser ()
Public Member Functions inherited from com.runehive.util.parser.GsonParser
final void deserialize ()
 The method that deserializes the file information.
 GsonParser (String path)
 Creates a new GsonParser.
 GsonParser (String path, boolean log)
 Creates a new GsonParser.
void initialize (int size)
Public Member Functions inherited from com.runehive.util.parser.GenericParser
 GenericParser (String path, String extension, boolean log)
 Creates a new GenericParser.
final int getIndex ()
 Gets the current index of the line being parsed.
void onRead ()
 The method called after all the data has been parsed.
void run ()
String toString ()

Protected Member Functions

void parse (JsonObject data)
 The method allows a user to modify the data as its being parsed.
Protected Member Functions inherited from com.runehive.util.parser.GsonParser
void onEnd ()
 This method handles what happens after the parser has ended.

Additional Inherited Members

Protected Attributes inherited from com.runehive.util.parser.GsonParser
transient Gson builder
 The Gson object.
Protected Attributes inherited from com.runehive.util.parser.GenericParser
int index
 The index of the current line being parsed.
final Path path
 The path of the file to parse.

Detailed Description

Parses through the item definitions file and creates ItemDefinitions on startup.

Author
Daniel | Obey

Definition at line 13 of file ItemDefinitionParser.java.

Constructor & Destructor Documentation

◆ ItemDefinitionParser()

com.runehive.util.parser.old.ItemDefinitionParser.ItemDefinitionParser ( )

Definition at line 15 of file ItemDefinitionParser.java.

15 {
16 super("def/item/item_definitions");
17 }

Member Function Documentation

◆ parse()

void com.runehive.util.parser.old.ItemDefinitionParser.parse ( JsonObject data)
protected

The method allows a user to modify the data as its being parsed.

Parameters
dataThe JsonObject that contains all serialized information.

Reimplemented from com.runehive.util.parser.GsonParser.

Definition at line 20 of file ItemDefinitionParser.java.

20 {
21 final int id = data.get("id").getAsInt();
22 final String name = data.get("name").getAsString();
23 final boolean members = data.get("gameMembers").getAsBoolean();
24 final boolean tradeable = data.get("tradeable").getAsBoolean();
25 final boolean stackable = data.get("stackable").getAsBoolean();
26 final boolean droppable = data.get("droppable").getAsBoolean();
27 final boolean noteable = data.get("noteable").getAsBoolean();
28 final boolean noted = data.get("noted").getAsBoolean();
29 final int notedId = data.get("notedId").getAsInt();
30 final int street_value = data.get("street_value").getAsInt();
31 final int base_value = data.get("base_value").getAsInt();
32 final int high_alch = data.get("high_alch").getAsInt();
33 final int low_alch = data.get("low_alch").getAsInt();
34 final String examine = data.get("examine").getAsString();
35
36 String destroyMessage = "This item is valuable, you will not\\nget it back once lost.";
37 if (data.get("destroy_message") != null) {
38 destroyMessage = data.get("destroy_message").getAsString();
39 }
40
41 final double weight = data.get("weight").getAsDouble();
42
43 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);
44 }

References com.runehive.game.world.items.ItemDefinition.DEFINITIONS.


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