|
|
|
@ -10,8 +10,8 @@ package engine.wpak;
@@ -10,8 +10,8 @@ package engine.wpak;
|
|
|
|
|
|
|
|
|
|
import engine.gameManager.ConfigManager; |
|
|
|
|
import engine.mbEnums; |
|
|
|
|
import engine.wpak.data.EffectDescription; |
|
|
|
|
import engine.wpak.data.PowerActionEntry; |
|
|
|
|
import engine.wpak.data.Effect; |
|
|
|
|
import engine.wpak.data.PowerAction; |
|
|
|
|
import engine.wpak.data.StatTransfer; |
|
|
|
|
import engine.wpak.data.TrackEntry; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
@ -51,15 +51,15 @@ public class PowerActionParser {
@@ -51,15 +51,15 @@ public class PowerActionParser {
|
|
|
|
|
|
|
|
|
|
while (matcher.find()) { |
|
|
|
|
|
|
|
|
|
PowerActionEntry powerActionEntry = parsePowerActionEntry(matcher.group().trim()); |
|
|
|
|
PowerAction powerAction = parsePowerActionEntry(matcher.group().trim()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static PowerActionEntry parsePowerActionEntry(String powerActionData) { |
|
|
|
|
private static PowerAction parsePowerActionEntry(String powerActionData) { |
|
|
|
|
|
|
|
|
|
PowerActionEntry powerActionEntry = new PowerActionEntry(); |
|
|
|
|
EffectDescription effectDescription; |
|
|
|
|
PowerAction powerAction = new PowerAction(); |
|
|
|
|
Effect effect; |
|
|
|
|
StatTransfer statTransfer; |
|
|
|
|
TrackEntry trackEntry; |
|
|
|
|
|
|
|
|
@ -81,34 +81,34 @@ public class PowerActionParser {
@@ -81,34 +81,34 @@ public class PowerActionParser {
|
|
|
|
|
headerData.add(matcher.group().trim()); |
|
|
|
|
|
|
|
|
|
Iterator<String> headerIterator = headerData.iterator(); |
|
|
|
|
powerActionEntry.action_id = headerIterator.next(); |
|
|
|
|
powerActionEntry.action_type = headerIterator.next(); |
|
|
|
|
powerAction.action_id = headerIterator.next(); |
|
|
|
|
powerAction.action_type = headerIterator.next(); |
|
|
|
|
|
|
|
|
|
switch (powerActionEntry.action_type) { |
|
|
|
|
switch (powerAction.action_type) { |
|
|
|
|
case "RemoveEffect": |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
break; |
|
|
|
|
case "CreateMob": |
|
|
|
|
powerActionEntry.petLevel = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerActionEntry.petRace = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerAction.petLevel = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerAction.petRace = Integer.parseInt(headerIterator.next()); |
|
|
|
|
break; |
|
|
|
|
case "DamageOverTime": |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
effectDescription.cycleDuration = Integer.parseInt(headerIterator.next()); |
|
|
|
|
effectDescription.cycleDelay = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
effect.cycleDuration = Integer.parseInt(headerIterator.next()); |
|
|
|
|
effect.cycleDelay = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
break; |
|
|
|
|
case "ApplyEffects": |
|
|
|
|
int level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
|
|
|
|
|
while (headerIterator.hasNext()) { |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.level = level; |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.level = level; |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "Transform": |
|
|
|
@ -118,15 +118,15 @@ public class PowerActionParser {
@@ -118,15 +118,15 @@ public class PowerActionParser {
|
|
|
|
|
case "DirectDamage": |
|
|
|
|
case "SpireDisable": |
|
|
|
|
while (headerIterator.hasNext()) { |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
|
|
|
|
|
// Some applyEffect entries are naked withot a level
|
|
|
|
|
|
|
|
|
|
if (headerData.size() > 3) |
|
|
|
|
effectDescription.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
effect.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
|
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "TransferStat": |
|
|
|
@ -139,7 +139,7 @@ public class PowerActionParser {
@@ -139,7 +139,7 @@ public class PowerActionParser {
|
|
|
|
|
statTransfer.toCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next()); |
|
|
|
|
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next()); |
|
|
|
|
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next()); |
|
|
|
|
powerActionEntry.statTransfer = statTransfer; |
|
|
|
|
powerAction.statTransfer = statTransfer; |
|
|
|
|
break; |
|
|
|
|
case "TransferStatOT": |
|
|
|
|
statTransfer = new StatTransfer(); |
|
|
|
@ -153,26 +153,26 @@ public class PowerActionParser {
@@ -153,26 +153,26 @@ public class PowerActionParser {
|
|
|
|
|
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next()); |
|
|
|
|
statTransfer.transfer_action = headerIterator.next(); |
|
|
|
|
statTransfer.transfer_ticks = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerActionEntry.statTransfer = statTransfer; |
|
|
|
|
powerAction.statTransfer = statTransfer; |
|
|
|
|
break; |
|
|
|
|
case "Charm": |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
effectDescription.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
effectDescription.type = headerIterator.next(); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
effect.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
effect.type = headerIterator.next(); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
break; |
|
|
|
|
case "Block": |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = headerIterator.next(); |
|
|
|
|
effectDescription.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = headerIterator.next(); |
|
|
|
|
effect.level = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
break; |
|
|
|
|
case "Resurrect": |
|
|
|
|
powerActionEntry.levelCap = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerAction.levelCap = Integer.parseInt(headerIterator.next()); |
|
|
|
|
break; |
|
|
|
|
case "SetItemFlag": |
|
|
|
|
powerActionEntry.itemFlag = mbEnums.ItemFlags.valueOf(headerIterator.next()); |
|
|
|
|
powerAction.itemFlag = mbEnums.ItemFlags.valueOf(headerIterator.next()); |
|
|
|
|
break; |
|
|
|
|
case "Track": |
|
|
|
|
trackEntry = new TrackEntry(); |
|
|
|
@ -182,7 +182,7 @@ public class PowerActionParser {
@@ -182,7 +182,7 @@ public class PowerActionParser {
|
|
|
|
|
trackEntry.type = headerIterator.next(); |
|
|
|
|
trackEntry.min = Integer.parseInt(headerIterator.next()); |
|
|
|
|
trackEntry.max = Integer.parseInt(headerIterator.next()); |
|
|
|
|
powerActionEntry.trackEntry = trackEntry; |
|
|
|
|
powerAction.trackEntry = trackEntry; |
|
|
|
|
break; |
|
|
|
|
case "Recall": // No arguments for these tags or not parsed
|
|
|
|
|
case "Summon": |
|
|
|
@ -198,7 +198,7 @@ public class PowerActionParser {
@@ -198,7 +198,7 @@ public class PowerActionParser {
|
|
|
|
|
case "Steal": |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
Logger.error("Unhandled type " + powerActionEntry.action_type + " for Pow4erAction: " + powerActionEntry.action_id); |
|
|
|
|
Logger.error("Unhandled type " + powerAction.action_type + " for Pow4erAction: " + powerAction.action_id); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -215,81 +215,81 @@ public class PowerActionParser {
@@ -215,81 +215,81 @@ public class PowerActionParser {
|
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
|
|
|
|
|
for (String bodyPart : arguments) |
|
|
|
|
powerActionEntry.bodyparts.add(Integer.parseInt(bodyPart)); |
|
|
|
|
powerAction.bodyparts.add(Integer.parseInt(bodyPart)); |
|
|
|
|
break; |
|
|
|
|
case "FEMALEBODYPARTS": |
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
|
|
|
|
|
for (String bodyPart : arguments) |
|
|
|
|
powerActionEntry.femaleBodyParts.add(Integer.parseInt(bodyPart)); |
|
|
|
|
powerAction.femaleBodyParts.add(Integer.parseInt(bodyPart)); |
|
|
|
|
break; |
|
|
|
|
case "SCALEFACTOR": |
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
|
|
|
|
|
for (String scaleFactor : arguments) |
|
|
|
|
powerActionEntry.scaleFactor.add(Float.parseFloat(scaleFactor)); |
|
|
|
|
powerAction.scaleFactor.add(Float.parseFloat(scaleFactor)); |
|
|
|
|
break; |
|
|
|
|
case "ISRESISTABLE": |
|
|
|
|
powerActionEntry.isResistible = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.isResistible = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "ISAGGRESSIVE": |
|
|
|
|
powerActionEntry.isAggressive = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.isAggressive = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "BLADETRAILS": |
|
|
|
|
powerActionEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "SHOULDSHOWWEAPONS": |
|
|
|
|
powerActionEntry.shouldShowWeapons = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.shouldShowWeapons = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "SHOULDSHOWARMOR": |
|
|
|
|
powerActionEntry.shouldShowArmor = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.shouldShowArmor = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "APPLYEFFECTBLANK": |
|
|
|
|
powerActionEntry.applyEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.applyEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "WEAROFFEFFECTBLANK": |
|
|
|
|
powerActionEntry.wearOffEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.wearOffEffectBlank = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "ATTACKANIMS": |
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
|
|
|
|
|
for (String animation : arguments) |
|
|
|
|
powerActionEntry.attackAnimations.add(Integer.parseInt(animation)); |
|
|
|
|
powerAction.attackAnimations.add(Integer.parseInt(animation)); |
|
|
|
|
break; |
|
|
|
|
case "REMOVEALL": |
|
|
|
|
powerActionEntry.removeAll = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.removeAll = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "EFFECTID": |
|
|
|
|
effectDescription = new EffectDescription(); |
|
|
|
|
effectDescription.effect_id = lineValues.get(1).trim(); |
|
|
|
|
powerActionEntry.effects.add(effectDescription); |
|
|
|
|
effect = new Effect(); |
|
|
|
|
effect.effect_id = lineValues.get(1).trim(); |
|
|
|
|
powerAction.effects.add(effect); |
|
|
|
|
break; |
|
|
|
|
case "LEVELCAP": |
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
powerActionEntry.levelCap = Integer.parseInt(arguments.get(0)); |
|
|
|
|
powerAction.levelCap = Integer.parseInt(arguments.get(0)); |
|
|
|
|
|
|
|
|
|
if (arguments.size() > 1) // Not all level caps have a curve
|
|
|
|
|
powerActionEntry.levelCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1)); |
|
|
|
|
powerAction.levelCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1)); |
|
|
|
|
break; |
|
|
|
|
case "CLEARAGGRO": |
|
|
|
|
powerActionEntry.clearAggro = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.clearAggro = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "TARGETBECOMESPET": |
|
|
|
|
powerActionEntry.targetBecomesPet = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.targetBecomesPet = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "DESTROYOLDPET": |
|
|
|
|
powerActionEntry.destroyOldPet = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
powerAction.destroyOldPet = Boolean.parseBoolean(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "DAMAGETYPE": |
|
|
|
|
powerActionEntry.damageType = mbEnums.DamageType.valueOf(lineValues.get(1).trim().toUpperCase()); |
|
|
|
|
powerAction.damageType = mbEnums.DamageType.valueOf(lineValues.get(1).trim().toUpperCase()); |
|
|
|
|
break; |
|
|
|
|
case "ROOTFSMID": |
|
|
|
|
powerActionEntry.rootFsmID = mbEnums.MobBehaviourType.valueOf(lineValues.get(1).trim()); |
|
|
|
|
powerAction.rootFsmID = mbEnums.MobBehaviourType.valueOf(lineValues.get(1).trim()); |
|
|
|
|
break; |
|
|
|
|
case "SPLASHDAMAGE": |
|
|
|
|
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); |
|
|
|
|
powerActionEntry.splashDamageMin = Integer.parseInt(arguments.get(0)); |
|
|
|
|
powerActionEntry.splashDamageMax = Integer.parseInt(arguments.get(1)); |
|
|
|
|
powerAction.splashDamageMin = Integer.parseInt(arguments.get(0)); |
|
|
|
|
powerAction.splashDamageMax = Integer.parseInt(arguments.get(1)); |
|
|
|
|
break; |
|
|
|
|
case "APPLYEFFECTOTHER": |
|
|
|
|
case "APPLYEFFECTSELF": |
|
|
|
@ -297,9 +297,9 @@ public class PowerActionParser {
@@ -297,9 +297,9 @@ public class PowerActionParser {
|
|
|
|
|
case "WEAROFFEFFECTSELF": |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
Logger.error("Unhandled variable type:" + key + " for powerAction: " + powerActionEntry.action_id); |
|
|
|
|
Logger.error("Unhandled variable type:" + key + " for powerAction: " + powerAction.action_id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return powerActionEntry; |
|
|
|
|
return powerAction; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|