RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.parser.old.WeaponDefinitionParser Class Reference
Inheritance diagram for com.runehive.util.parser.old.WeaponDefinitionParser:
Collaboration diagram for com.runehive.util.parser.old.WeaponDefinitionParser:

Public Member Functions

 WeaponDefinitionParser ()
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

Definition at line 8 of file WeaponDefinitionParser.java.

Constructor & Destructor Documentation

◆ WeaponDefinitionParser()

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

Definition at line 10 of file WeaponDefinitionParser.java.

10 {
11 super("def/item/weapon_definitions");
12 }

Member Function Documentation

◆ parse()

void com.runehive.util.parser.old.WeaponDefinitionParser.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 15 of file WeaponDefinitionParser.java.

15 {
16 int id = data.get("id").getAsInt();
17 String name = data.get("name").getAsString();
18 boolean twoHanded = data.get("twoHanded").getAsBoolean();
19 String weaponType = data.get("weaponType").getAsString();
20
21 RangedWeaponDefinition rangedDefinition = null;
22 if (data.has("rangedDefinition")) {
23 rangedDefinition = builder.fromJson(data.get("rangedDefinition"), RangedWeaponDefinition.class);
24 }
25
26 int standAnimation = data.get("stand").getAsInt();
27 int walkAnimation = data.get("walk").getAsInt();
28 int runAnimation = data.get("run").getAsInt();
29
30 WeaponDefinition.DEFINITIONS[id] = new WeaponDefinition(id, name, twoHanded, weaponType, rangedDefinition, standAnimation, walkAnimation, runAnimation);
31 }

References com.runehive.util.parser.GsonParser.builder, and com.runehive.util.parser.old.defs.WeaponDefinition.DEFINITIONS.


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