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

Public Member Functions

 CombatProjectileParser ()
void parse (JsonObject reader)
 The method allows a user to modify the data as its being parsed.
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 ()

Additional Inherited Members

Protected Member Functions inherited from com.runehive.util.parser.GsonParser
void onEnd ()
 This method handles what happens after the parser has ended.
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 13 of file CombatProjectileParser.java.

Constructor & Destructor Documentation

◆ CombatProjectileParser()

com.runehive.util.parser.impl.CombatProjectileParser.CombatProjectileParser ( )

Definition at line 15 of file CombatProjectileParser.java.

15 {
16 super("def/combat/projectile_definitions", false);
17 }

Member Function Documentation

◆ parse()

void com.runehive.util.parser.impl.CombatProjectileParser.parse ( JsonObject data)

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 CombatProjectileParser.java.

20 {
21 String name = reader.get("name").getAsString();
22
23 int hitDelay = -1;
24 if (reader.has("hit-delay")) {
25 hitDelay = reader.get("hit-delay").getAsInt();
26 }
27
28 int hitsplatDelay = -1;
29 if (reader.has("hitsplat-delay")) {
30 hitsplatDelay = reader.get("hitsplat-delay").getAsInt();
31 }
32
33 int maxHit = -1;
34 if (reader.has("max-hit")) {
35 maxHit = reader.get("max-hit").getAsInt();
36 }
37
38 CombatImpact effect = null;
39 if (reader.has("magic-effect")) {
40 String effectName = reader.get("magic-effect").getAsString();
41 effect = MagicImpact.valueOf(effectName).getEffect();
42 } else if (reader.has("ranged-effect")) {
43 String effectName = reader.get("ranged-effect").getAsString();
44 effect = RangedEffects.valueOf(effectName).getEffect();
45 }
46
47 Animation animation = null;
48 if (reader.has("animation")) {
49 animation = builder.fromJson(reader.get("animation"), Animation.class);
50 }
51
52 Graphic start = null;
53 if (reader.has("start")) {
54 start = builder.fromJson(reader.get("start"), Graphic.class);
55 }
56
57 Graphic end = null;
58 if (reader.has("end")) {
59 end = builder.fromJson(reader.get("end"), Graphic.class);
60 }
61
62 Projectile projectile = null;
63 if (reader.has("projectile")) {
64 projectile = builder.fromJson(reader.get("projectile"), Projectile.class);
65 }
66
67 CombatProjectile.definitions.put(name, new CombatProjectile(name, maxHit, effect, animation, start, end, projectile, hitDelay, hitsplatDelay));
68 }

References com.runehive.util.parser.GsonParser.builder, com.runehive.game.world.entity.combat.projectile.CombatProjectile.definitions, com.runehive.game.world.entity.combat.magic.MagicImpact.getEffect(), and com.runehive.game.world.entity.combat.ranged.RangedEffects.getEffect().

Here is the call graph for this function:

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