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

Parses through the equipment definitions file and creates equipment definition object. More...

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

Public Member Functions

 EquipmentDefinitionParser ()
void initialize (int size)
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.
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 ()

Static Public Member Functions

static void main (String[] args)

Protected Member Functions

void onEnd ()
 This method handles what happens after the parser has ended.
void parse (JsonObject data)
 The method allows a user to modify the data as its being parsed.

Static Private Member Functions

static int getReq (String first, String second, EquipmentType type)

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 equipment definitions file and creates equipment definition object.

Author
Daniel | Obey

Definition at line 14 of file EquipmentDefinitionParser.java.

Constructor & Destructor Documentation

◆ EquipmentDefinitionParser()

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

Definition at line 16 of file EquipmentDefinitionParser.java.

16 {
17 super("def/equipment/equipment_definitions");
18 }

Referenced by main().

Here is the caller graph for this function:

Member Function Documentation

◆ getReq()

int com.runehive.util.parser.old.EquipmentDefinitionParser.getReq ( String first,
String second,
EquipmentType type )
staticprivate

Definition at line 60 of file EquipmentDefinitionParser.java.

60 {
61 switch (first) {
62 case "bronze":
63 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
64 return -1;
65 }
66 return 1;
67
68 case "iron":
69 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
70 return -1;
71 }
72 return 1;
73
74 case "steel":
75 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
76 return -1;
77 }
78 return 10;
79
80 case "mithril":
81 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
82 return -1;
83 }
84 return 20;
85
86 case "adamant":
87 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
88 return -1;
89 }
90 return 30;
91
92 case "rune":
93 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
94 return -1;
95 }
96 return 40;
97
98 case "dragon":
99 case "toktz-ket-xil":
100 if (type == EquipmentType.WEAPON || type == EquipmentType.ARROWS) {
101 return -1;
102 }
103 return 60;
104
105 case "bandos":
106 if (second.equals("mitre") || second.equals("robe")) {
107 return -1;
108 }
109
110 if (second.startsWith("plate") || second.startsWith("full") || second.startsWith("kite")) {
111 return 40;
112 }
113 if (type == EquipmentType.WEAPON) {
114 return -1;
115 }
116 return 65;
117
118 case "armadyl":
119 if (second.equals("mitre") || second.equals("robe")) {
120 return -1;
121 }
122
123 if (second.startsWith("plate") || second.startsWith("full") || second.startsWith("kite")) {
124 return 40;
125 }
126 if (type == EquipmentType.WEAPON) {
127 return -1;
128 }
129 return 70;
130
131 case "dharok's":
132 case "guthan's":
133 case "torag's":
134 case "verac's":
135 case "karil's":
136 case "ahrim's":
137 case "barrows":
138 if (type == EquipmentType.WEAPON) {
139 return -1;
140 }
141 return 70;
142
143 case "dragonfire":
144 return 75;
145
146 case "neitiznot":
147 return 55;
148
149 case "saradomin":
150 case "guthix":
151 case "zamorak":
152 if (second.equals("mitre") || second.equals("robe")) {
153 return -1;
154 }
155 if (type == EquipmentType.WEAPON) {
156 return -1;
157 }
158 return 40;
159
160 case "berserker":
161 case "archer":
162 case "farseer":
163 case "warrior":
164 if (type == EquipmentType.RING) {
165 return -1;
166 }
167 return 45;
168
169 case "green":
170 case "red":
171 case "blue":
172 case "black":
173 if (type != EquipmentType.BODY) {
174 return -1;
175 }
176
177 return 40;
178
179 case "hardleather":
180 if (type != EquipmentType.BODY) {
181 return -1;
182 }
183
184 return 10;
185
186 case "void":
187 return 42;
188
189 case "snakeskin":
190 return 30;
191
192 case "3rd":
193 return 45;
194
195 case "penance":
196 case "runner":
197 case "fighter":
198 if (type == EquipmentType.GLOVES) {
199 return -1;
200 }
201 return 40;
202 }
203 return -1;
204 }

References com.runehive.game.world.items.containers.equipment.EquipmentType.ARROWS, com.runehive.game.world.items.containers.equipment.EquipmentType.BODY, com.runehive.game.world.items.containers.equipment.EquipmentType.GLOVES, com.runehive.game.world.items.containers.equipment.EquipmentType.RING, and com.runehive.game.world.items.containers.equipment.EquipmentType.WEAPON.

◆ initialize()

void com.runehive.util.parser.old.EquipmentDefinitionParser.initialize ( int size)

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

Definition at line 27 of file EquipmentDefinitionParser.java.

27 {
28 ItemDefinition.createParser().run();
29 }

References com.runehive.game.world.items.ItemDefinition.createParser(), and com.runehive.util.parser.GenericParser.run().

Here is the call graph for this function:

◆ main()

void com.runehive.util.parser.old.EquipmentDefinitionParser.main ( String[] args)
static

Definition at line 20 of file EquipmentDefinitionParser.java.

20 {
21 new EquipmentDefinitionParser().run();
22 // ItemDefinition.merge("wiki/client_item_dump", "wiki/wiki_item_dump", "wiki/new_item_dump");
23 ItemDefinition.dump(ItemDefinition.create("wiki/new_item_dump"), "wiki/item_definitions");
24 }

References com.runehive.game.world.items.ItemDefinition.create(), com.runehive.game.world.items.ItemDefinition.dump(), and EquipmentDefinitionParser().

Here is the call graph for this function:

◆ onEnd()

void com.runehive.util.parser.old.EquipmentDefinitionParser.onEnd ( )
protected

This method handles what happens after the parser has ended.

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

Definition at line 56 of file EquipmentDefinitionParser.java.

56 {
57 ItemDefinition.dump("def/item/newer_item_definitions");
58 }

References com.runehive.game.world.items.ItemDefinition.dump().

Here is the call graph for this function:

◆ parse()

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

32 {
33 int id = data.get("id").getAsInt();
34 ItemDefinition definition = ItemDefinition.get(id);
35
36 if (definition.getEquipmentType() == EquipmentType.NOT_WIELDABLE) {
37 String name = definition.getName().toLowerCase();
38 if (name.startsWith("hood") || name.endsWith("hood")) {
39 definition.setEquipmentType(EquipmentType.FACE);
40 } else if (name.contains("full helm")) {
41 definition.setEquipmentType(EquipmentType.HELM);
42 } else if (name.contains("med helm")) {
43 definition.setEquipmentType(EquipmentType.FACE);
44 } else if (name.contains("helm")) {
45 if (name.startsWith("dharok")) {
46 definition.setEquipmentType(EquipmentType.FACE);
47 } else {
48 definition.setEquipmentType(EquipmentType.HELM);
49 }
50 }
51 }
52
53 }

References com.runehive.game.world.items.containers.equipment.EquipmentType.FACE, com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.items.ItemDefinition.getName(), com.runehive.game.world.items.containers.equipment.EquipmentType.HELM, and com.runehive.game.world.items.containers.equipment.EquipmentType.NOT_WIELDABLE.

Here is the call graph for this function:

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