From ef234beeb7962c74916f974e8f165851bd67f436 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 19 Jan 2025 14:59:05 -0600 Subject: [PATCH] added missing source types --- src/engine/mbEnums.java | 4 +- src/engine/wpak/PowersParser.java | 285 +++++++++++++++--------------- 2 files changed, 147 insertions(+), 142 deletions(-) diff --git a/src/engine/mbEnums.java b/src/engine/mbEnums.java index cd3034f3..df530814 100644 --- a/src/engine/mbEnums.java +++ b/src/engine/mbEnums.java @@ -1016,7 +1016,9 @@ public class mbEnums { Wizardry, HealthRecoverRate, ManaRecoverRate, - StaminaRecoverRate; + StaminaRecoverRate, + MeleeDamageModifier, + PowerDamageModifier; public static SourceType GetSourceType(String modName) { SourceType returnMod; diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index c884c580..a2bbc8ca 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -156,147 +156,150 @@ public class PowersParser { if(power.powerBase.equalsIgnoreCase("none")) continue; String loggerString = "PARSING: " + power.powerBase + " KEY: " + key; - Logger.info(loggerString); - switch (key) { - case "ACTION": - actionEntry = new ActionEntry(); - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - actionEntry.effect_id = arguments.get(0); - actionEntry.minTrains = Integer.parseInt(arguments.get(1)); - actionEntry.maxTrains = Integer.parseInt(arguments.get(2)); - actionEntry.duration = Float.parseFloat(arguments.get(3)); - actionEntry.curve = mbEnums.CompoundCurveType.valueOf(arguments.get(4)); - actionEntry.stackingCategory = arguments.get(5); - actionEntry.stackingPriority = Integer.parseInt(arguments.get(6)); - actionEntry.categoryToPower = mbEnums.CategoryToPowerType.valueOf(arguments.get(7)); - powerEntry.actionEntries.add(actionEntry); - break; - case "MaxLevel": - powerEntry.maxLevel = Integer.parseInt(lineValues.get(1).trim()); - break; - case "HateValue": - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - powerEntry.hateValue = Integer.parseInt(arguments.get(0)); - - // Not all entries have a curve. Defaults to DefaultFlat; - - if (arguments.size() > 1) - powerEntry.hateCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1)); - break; - case "LOOPANIMID": - powerEntry.loopAnimID = Integer.parseInt(lineValues.get(1).trim()); - break; - case "GRANTOVERRIDEVAR": - powerEntry.grantOverrideVar = lineValues.get(1).trim(); - break; - case "DESCRIPTION": - powerEntry.description.add(lineValues.get(1).trim()); - break; - case "CATEGORY": - powerEntry.category = lineValues.get(1).trim(); - break; - case "CURVE": - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - powerEntry.curves.put(arguments.get(0), mbEnums.CompoundCurveType.valueOf(arguments.get(1))); - break; - case "EQPREREQ": - argumentMatcher = STRSPLIT_REGEX.matcher(lineValues.get(1).trim()); - arguments = new ArrayList<>(); - - while (argumentMatcher.find()) - arguments.add(argumentMatcher.group().trim()); - - argumentIterator = arguments.iterator(); - - while (argumentIterator.hasNext()) { - EquipmentPreReq equipmentPreReq = new EquipmentPreReq(); - equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(argumentIterator.next()); - equipmentPreReq.skill = argumentIterator.next().replaceAll("\"", ""); - equipmentPreReq.required = Integer.parseInt(argumentIterator.next()); - powerEntry.equipmentPreReq.add(equipmentPreReq); - } - break; - case "CANCASTWHILEMOVING": - powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "CANCASTWHILEFLYING": - powerEntry.canCastWhileFlying = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "BLADETRAILS": - powerEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "EFFECTPREREQ": - Effect effectPreReq = new Effect(); - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - effectPreReq.effect_id = arguments.get(9); - effectPreReq.level = Integer.parseInt(arguments.get(1)); - effectPreReq.message = arguments.get(2); - powerEntry.effectPreReqs.add(effectPreReq); - break; - case "MONSTERTYPERESTRICTS": - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - - for (String restriction : arguments) - powerEntry.monsterRestricts.add(mbEnums.MonsterType.valueOf(restriction.trim())); - break; - case "MONSTERTYPEPREREQS": - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - - for (String restriction : arguments) - powerEntry.monsterPrereqs.add(mbEnums.MonsterType.valueOf(restriction.trim())); - break; - case "SHOULDCHECKPATH": - powerEntry.shouldCheckPath = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "STICKY": - powerEntry.sticky = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "PULSEINFO": - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - powerEntry.pulseCycle = Integer.parseInt(arguments.get(0)); - powerEntry.pulseDuration = Integer.parseInt(arguments.get(1)); - break; - case "MAXNUMMOBTARGETS": - powerEntry.maxMobTargets = Integer.parseInt(lineValues.get(1).trim()); - break; - case "MAXNUMPLAYERTARGETS": - powerEntry.maxPlayerTargets = Integer.parseInt(lineValues.get(1).trim()); - break; - case "ISADMINPOWER": - powerEntry.isAdminPower = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "ISPROJECTILE": - powerEntry.isProjectile = Boolean.parseBoolean(lineValues.get(1).trim()); - break; - case "CASTERSPULSEPARTICLE": - powerEntry.casterPulseParticle = Integer.parseInt(lineValues.get(1).trim()); - break; - case "TARGETEFFECTPREREQS_ORED": - Effect preReq = new Effect(); - arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); - preReq.effect_id = arguments.get(0); - preReq.level = Integer.parseInt(arguments.get(1)); - powerEntry.targetEffectPrereqs.add(preReq); - break; - case "SOUNDS": // Values not parsed - case "APPLYDAMAGESELF": - case "APPLYDAMAGECASTER": - case "APPLYDAMAGEOTHER": - case "APPLYDAMAGETARGET": - case "APPLYEFFECTSELF": - case "APPLYEFFECTOTHER": - case "APPLYEFFECTCASTER": - case "APPLYEFFECTTARGET": - case "FIZZLEOTHER": - case "FIZZLESELF": - case "INITSTRING": - case "SUCCESSOTHER": - case "SUCCESSSELF": - case "WEAROFFEFFECTOTHER": - case "WEAROFFEFFECTSELF": - break; - default: - Logger.error("Unhandled variable type:" + key + " for power: " + powerEntry.power_id); + try { + switch (key) { + case "ACTION": + actionEntry = new ActionEntry(); + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + actionEntry.effect_id = arguments.get(0); + actionEntry.minTrains = Integer.parseInt(arguments.get(1)); + actionEntry.maxTrains = Integer.parseInt(arguments.get(2)); + actionEntry.duration = Float.parseFloat(arguments.get(3)); + actionEntry.curve = mbEnums.CompoundCurveType.valueOf(arguments.get(4)); + actionEntry.stackingCategory = arguments.get(5); + actionEntry.stackingPriority = Integer.parseInt(arguments.get(6)); + actionEntry.categoryToPower = mbEnums.CategoryToPowerType.valueOf(arguments.get(7)); + powerEntry.actionEntries.add(actionEntry); + break; + case "MaxLevel": + powerEntry.maxLevel = Integer.parseInt(lineValues.get(1).trim()); + break; + case "HateValue": + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + powerEntry.hateValue = Integer.parseInt(arguments.get(0)); + + // Not all entries have a curve. Defaults to DefaultFlat; + + if (arguments.size() > 1) + powerEntry.hateCurve = mbEnums.CompoundCurveType.valueOf(arguments.get(1)); + break; + case "LOOPANIMID": + powerEntry.loopAnimID = Integer.parseInt(lineValues.get(1).trim()); + break; + case "GRANTOVERRIDEVAR": + powerEntry.grantOverrideVar = lineValues.get(1).trim(); + break; + case "DESCRIPTION": + powerEntry.description.add(lineValues.get(1).trim()); + break; + case "CATEGORY": + powerEntry.category = lineValues.get(1).trim(); + break; + case "CURVE": + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + powerEntry.curves.put(arguments.get(0), mbEnums.CompoundCurveType.valueOf(arguments.get(1))); + break; + case "EQPREREQ": + argumentMatcher = STRSPLIT_REGEX.matcher(lineValues.get(1).trim()); + arguments = new ArrayList<>(); + + while (argumentMatcher.find()) + arguments.add(argumentMatcher.group().trim()); + + argumentIterator = arguments.iterator(); + + while (argumentIterator.hasNext()) { + EquipmentPreReq equipmentPreReq = new EquipmentPreReq(); + equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(argumentIterator.next()); + equipmentPreReq.skill = argumentIterator.next().replaceAll("\"", ""); + equipmentPreReq.required = Integer.parseInt(argumentIterator.next()); + powerEntry.equipmentPreReq.add(equipmentPreReq); + } + break; + case "CANCASTWHILEMOVING": + powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "CANCASTWHILEFLYING": + powerEntry.canCastWhileFlying = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "BLADETRAILS": + powerEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "EFFECTPREREQ": + Effect effectPreReq = new Effect(); + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + effectPreReq.effect_id = arguments.get(9); + effectPreReq.level = Integer.parseInt(arguments.get(1)); + effectPreReq.message = arguments.get(2); + powerEntry.effectPreReqs.add(effectPreReq); + break; + case "MONSTERTYPERESTRICTS": + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + + for (String restriction : arguments) + powerEntry.monsterRestricts.add(mbEnums.MonsterType.valueOf(restriction.trim())); + break; + case "MONSTERTYPEPREREQS": + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + + for (String restriction : arguments) + powerEntry.monsterPrereqs.add(mbEnums.MonsterType.valueOf(restriction.trim())); + break; + case "SHOULDCHECKPATH": + powerEntry.shouldCheckPath = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "STICKY": + powerEntry.sticky = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "PULSEINFO": + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + powerEntry.pulseCycle = Integer.parseInt(arguments.get(0)); + powerEntry.pulseDuration = Integer.parseInt(arguments.get(1)); + break; + case "MAXNUMMOBTARGETS": + powerEntry.maxMobTargets = Integer.parseInt(lineValues.get(1).trim()); + break; + case "MAXNUMPLAYERTARGETS": + powerEntry.maxPlayerTargets = Integer.parseInt(lineValues.get(1).trim()); + break; + case "ISADMINPOWER": + powerEntry.isAdminPower = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "ISPROJECTILE": + powerEntry.isProjectile = Boolean.parseBoolean(lineValues.get(1).trim()); + break; + case "CASTERSPULSEPARTICLE": + powerEntry.casterPulseParticle = Integer.parseInt(lineValues.get(1).trim()); + break; + case "TARGETEFFECTPREREQS_ORED": + Effect preReq = new Effect(); + arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); + preReq.effect_id = arguments.get(0); + preReq.level = Integer.parseInt(arguments.get(1)); + powerEntry.targetEffectPrereqs.add(preReq); + break; + case "SOUNDS": // Values not parsed + case "APPLYDAMAGESELF": + case "APPLYDAMAGECASTER": + case "APPLYDAMAGEOTHER": + case "APPLYDAMAGETARGET": + case "APPLYEFFECTSELF": + case "APPLYEFFECTOTHER": + case "APPLYEFFECTCASTER": + case "APPLYEFFECTTARGET": + case "FIZZLEOTHER": + case "FIZZLESELF": + case "INITSTRING": + case "SUCCESSOTHER": + case "SUCCESSSELF": + case "WEAROFFEFFECTOTHER": + case "WEAROFFEFFECTSELF": + break; + default: + Logger.error("Unhandled variable type:" + key + " for power: " + powerEntry.power_id); + } + }catch(Exception e){ + Logger.info(loggerString + " ERROR: " + e); } }