Browse Source

Merge branch 'feature-config-parsing2' into feature-config-usage

# Conflicts:
#	src/engine/powers/EffectsBase.java
feature-config-usage
FatBoy-DOTC 3 months ago
parent
commit
e09bd9aae0
  1. 2
      src/engine/gameManager/BuildingManager.java
  2. 12
      src/engine/gameManager/PowersManager.java
  3. 2
      src/engine/mbEnums.java
  4. 2
      src/engine/objects/Building.java
  5. 25
      src/engine/objects/City.java
  6. 3
      src/engine/objects/Mine.java
  7. 48
      src/engine/workthreads/DestroyCityThread.java
  8. 132
      src/engine/wpak/EffectsParser.java
  9. 136
      src/engine/wpak/PowerActionParser.java
  10. 14
      src/engine/wpak/PowersParser.java
  11. 13
      src/engine/wpak/data/Effect.java
  12. 18
      src/engine/wpak/data/EffectDescription.java
  13. 4
      src/engine/wpak/data/ModifierEntry.java
  14. 69
      src/engine/wpak/data/Power.java
  15. 4
      src/engine/wpak/data/PowerAction.java
  16. 17
      src/engine/wpak/data/PowerData.java
  17. 58
      src/engine/wpak/data/PowerEntry.java

2
src/engine/gameManager/BuildingManager.java

@ -798,7 +798,7 @@ public enum BuildingManager {
// Attempt to write to database or delete the building // Attempt to write to database or delete the building
// if we are destroying it. // if we are destroying it.
if (rank == -1) if (rank < 0)
success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building); success = DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
else else
success = DbManager.BuildingQueries.updateBuildingRank(building, rank); success = DbManager.BuildingQueries.updateBuildingRank(building, rank);

12
src/engine/gameManager/PowersManager.java

@ -32,7 +32,7 @@ import engine.server.MBServerStatics;
import engine.wpak.EffectsParser; import engine.wpak.EffectsParser;
import engine.wpak.PowerActionParser; import engine.wpak.PowerActionParser;
import engine.wpak.PowersParser; import engine.wpak.PowersParser;
import engine.wpak.data.EffectEntry; import engine.wpak.data.Effect;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.SQLException; import java.sql.SQLException;
@ -118,7 +118,7 @@ public enum PowersManager {
// Add EffectsBase // Add EffectsBase
ArrayList<EffectsBase> effectList = new ArrayList<>(); ArrayList<EffectsBase> effectList = new ArrayList<>();
for (EffectEntry entry : EffectsParser.effect_data.values()) { for (Effect entry : EffectsParser.effect_data.values()) {
EffectsBase effectBase = new EffectsBase(entry); EffectsBase effectBase = new EffectsBase(entry);
effectList.add(effectBase); effectList.add(effectBase);
PowersManager.effectsBaseByToken.put(effectBase.getToken(), effectBase); PowersManager.effectsBaseByToken.put(effectBase.getToken(), effectBase);
@ -950,7 +950,7 @@ public enum PowersManager {
// if (!stackType.equals("IgnoreStack")) { // if (!stackType.equals("IgnoreStack")) {
if (target.getEffects().containsKey(stackType)) { if (target.getEffects().containsKey(stackType)) {
// remove any existing power that overrides // remove any existing power that overrides
Effect ef = target.getEffects().get(stackType); engine.objects.Effect ef = target.getEffects().get(stackType);
AbstractEffectJob effect = null; AbstractEffectJob effect = null;
if (ef != null) { if (ef != null) {
JobContainer jc = ef.getJobContainer(); JobContainer jc = ef.getJobContainer();
@ -1122,7 +1122,7 @@ public enum PowersManager {
// if (!stackType.equals("IgnoreStack")) { // if (!stackType.equals("IgnoreStack")) {
if (target.getEffects().containsKey(stackType)) { if (target.getEffects().containsKey(stackType)) {
// remove any existing power that overrides // remove any existing power that overrides
Effect ef = target.getEffects().get(stackType); engine.objects.Effect ef = target.getEffects().get(stackType);
AbstractEffectJob effect = null; AbstractEffectJob effect = null;
if (ef != null) { if (ef != null) {
JobContainer jc = ef.getJobContainer(); JobContainer jc = ef.getJobContainer();
@ -1436,7 +1436,7 @@ public enum PowersManager {
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType; stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType;
if (target.getEffects().containsKey(stackType)) { if (target.getEffects().containsKey(stackType)) {
// remove any existing power that overrides // remove any existing power that overrides
Effect ef = target.getEffects().get(stackType); engine.objects.Effect ef = target.getEffects().get(stackType);
AbstractEffectJob effect = null; AbstractEffectJob effect = null;
if (ef != null) { if (ef != null) {
JobContainer jc = ef.getJobContainer(); JobContainer jc = ef.getJobContainer();
@ -1883,7 +1883,7 @@ public enum PowersManager {
stackType = (stackType.equals("IgnoreStack")) ? Integer stackType = (stackType.equals("IgnoreStack")) ? Integer
.toString(toRemove.getUUID()) : stackType; .toString(toRemove.getUUID()) : stackType;
if (fromChant) { if (fromChant) {
Effect eff = awo.getEffects().get(stackType); engine.objects.Effect eff = awo.getEffects().get(stackType);
if (eff != null) if (eff != null)
eff.cancelJob(true); eff.cancelJob(true);
} else } else

2
src/engine/mbEnums.java

@ -2732,7 +2732,7 @@ public class mbEnums {
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20), DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
GALVOR(1580017, -1683992404, -1596311545, 2000, 5), GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
IRON(1580002, -1673518119, 2504297, 2000, 20), IRON(1580002, -1673518119, 2504297, 2000, 20),
LUMBER(1580004, 1628412684, -1603256692, 10000, 100), LUMBER(1580004, -1628412684, -1603256692, 10000, 100),
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10), MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
MITHRIL(1580021, 626743397, -1761257186, 500, 5), MITHRIL(1580021, 626743397, -1761257186, 500, 5),
OAK(1580005, -1653034775, 74767, 3000, 30), OAK(1580005, -1653034775, 74767, 3000, 30),

2
src/engine/objects/Building.java

@ -561,7 +561,7 @@ public class Building extends AbstractWorldObject {
BuildingManager.setRank(barracksBuilding, -1); BuildingManager.setRank(barracksBuilding, -1);
} }
// If the tree is R8 and deranking, we need to update it's // If the tree is R8 and deranking, we need to update the
// mesh along with buildings losing their health bonus // mesh along with buildings losing their health bonus
if (this.rank == 8) { if (this.rank == 8) {

25
src/engine/objects/City.java

@ -41,6 +41,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
public class City extends AbstractWorldObject { public class City extends AbstractWorldObject {
@ -80,6 +81,7 @@ public class City extends AbstractWorldObject {
private String hash; private String hash;
public Warehouse warehouse; public Warehouse warehouse;
public Realm realm; public Realm realm;
public AtomicBoolean isDestroyed = new AtomicBoolean(false);
/** /**
* ResultSet Constructor * ResultSet Constructor
@ -306,6 +308,21 @@ public class City extends AbstractWorldObject {
if (city.parentZone == null) if (city.parentZone == null)
continue; continue;
// Can't teleport to something without a tree
if (city.getTOL() == null)
continue;
// No abandoned cities
if (city.getTOL().getGuild().isEmptyGuild())
continue;
// No destroyed cities
if (city.getTOL().getRank() == -1)
continue;
//can't repledge to a guild you're already part of //can't repledge to a guild you're already part of
if (repledge && city.getGuild().equals(playerCharacter.guild)) if (repledge && city.getGuild().equals(playerCharacter.guild))
@ -1102,17 +1119,21 @@ public class City extends AbstractWorldObject {
public final void destroy() { public final void destroy() {
if (this.isDestroyed.compareAndSet(false, true)) {
Thread destroyCityThread = new Thread(new DestroyCityThread(this)); Thread destroyCityThread = new Thread(new DestroyCityThread(this));
destroyCityThread.setName("destroyCity:" + this.getName()); destroyCityThread.setName("destroyCity:" + this.getParent().zoneName);
destroyCityThread.start(); destroyCityThread.start();
} else
Logger.error("Attempt to destroy destroyed city");
} }
public final void transfer(AbstractCharacter newOwner) { public final void transfer(AbstractCharacter newOwner) {
Thread transferCityThread = new Thread(new TransferCityThread(this, newOwner)); Thread transferCityThread = new Thread(new TransferCityThread(this, newOwner));
transferCityThread.setName("TransferCity:" + this.getName()); transferCityThread.setName("TransferCity:" + this.getParent().zoneName);
transferCityThread.start(); transferCityThread.start();
} }

3
src/engine/objects/Mine.java

@ -220,8 +220,7 @@ public class Mine extends AbstractGameObject {
// Only inactive mines are returned. // Only inactive mines are returned.
for (Mine mine : Mine.mineMap.keySet()) { for (Mine mine : Mine.mineMap.keySet()) {
if (mine.owningGuild.getObjectUUID() == guildID && if (mine.owningGuild.getObjectUUID() == guildID)
mine.isActive == false)
mineList.add(mine); mineList.add(mine);
} }
return mineList; return mineList;

48
src/engine/workthreads/DestroyCityThread.java

@ -53,11 +53,14 @@ public class DestroyCityThread implements Runnable {
// Member variable assignment // Member variable assignment
try {
cityZone = city.getParent(); cityZone = city.getParent();
newParent = cityZone.parent; newParent = cityZone.parent;
formerGuild = city.getTOL().getGuild(); formerGuild = city.getTOL().getGuild();
// Former guild loses it's tree! Logger.info("Destroy city thread started for: " + cityZone.zoneName);
// Former guild loses tree!
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) { if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {
@ -83,10 +86,10 @@ public class DestroyCityThread implements Runnable {
} }
} }
Building tol = null;
// Build list of buildings within this parent zone // Build list of buildings within this parent zone
ArrayList<Building> destroySet = new ArrayList<>();
for (Building cityBuilding : cityZone.zoneBuildingSet) { for (Building cityBuilding : cityZone.zoneBuildingSet) {
// Sanity Check in case player deletes the building // Sanity Check in case player deletes the building
@ -100,13 +103,6 @@ public class DestroyCityThread implements Runnable {
if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE)) if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE))
continue; continue;
// TOL is processed after all other structures in the city zone
if (cityBuilding.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.TOL)) {
tol = cityBuilding;
continue;
}
// All buildings are moved to a location relative // All buildings are moved to a location relative
// to their new parent zone // to their new parent zone
@ -132,33 +128,27 @@ public class DestroyCityThread implements Runnable {
city.warehouse = null; city.warehouse = null;
} }
// Destroy all remaining city assets // Mark all auto protected buildings for destruction
if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK) if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.SHRINE) || (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.TOL) || (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.WAREHOUSE))
|| (cityBuilding.getBlueprint().isWallPiece()) destroySet.add(cityBuilding);
|| (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.SHRINE)
|| (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.TOL)
|| (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.SPIRE)
|| (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.WAREHOUSE)) {
if (cityBuilding.getRank() != -1)
BuildingManager.setRank(cityBuilding, -1);
}
} }
// Destroy the tol // Destroy set of auto-protected buildings
if (tol != null) for (Building building : destroySet)
BuildingManager.setRank(tol, -1); if (building.getRank() != -1)
BuildingManager.setRank(building, -1);
if (city.realm != null) if (city.realm != null) {
city.realm.removeCity(city.getObjectUUID()); city.realm.removeCity(city.getObjectUUID());
city.realm = null;
}
// It's now safe to delete the city zone from the database // It's now safe to delete the city zone from the database
// which will cause a cascade delete of everything else // which will cause a cascade delete of everything else
if (!DbManager.ZoneQueries.DELETE_ZONE(cityZone)) {
if (DbManager.ZoneQueries.DELETE_ZONE(cityZone) == false) {
Logger.error("DestroyCityThread", "Database error when deleting city zone: " + cityZone.getObjectUUID()); Logger.error("DestroyCityThread", "Database error when deleting city zone: " + cityZone.getObjectUUID());
return; return;
} }
@ -167,6 +157,10 @@ public class DestroyCityThread implements Runnable {
City.lastCityUpdate = System.currentTimeMillis(); City.lastCityUpdate = System.currentTimeMillis();
} catch (Exception e) {
Logger.error(e);
}
// Zone and city should vanish upon next reboot // Zone and city should vanish upon next reboot
// if the codebase reaches here. // if the codebase reaches here.

132
src/engine/wpak/EffectsParser.java

@ -11,8 +11,8 @@ package engine.wpak;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.mbEnums; import engine.mbEnums;
import engine.wpak.data.ConditionEntry; import engine.wpak.data.ConditionEntry;
import engine.wpak.data.EffectEntry; import engine.wpak.data.Effect;
import engine.wpak.data.EffectModifier; import engine.wpak.data.ModifierEntry;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.io.IOException; import java.io.IOException;
@ -25,7 +25,7 @@ import java.util.regex.Pattern;
public class EffectsParser { public class EffectsParser {
public static String effectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg"; public static String effectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg";
public static HashMap<String, EffectEntry> effect_data = new HashMap<>(); public static HashMap<String, Effect> effect_data = new HashMap<>();
private static final Pattern EFFECT_REGEX = Pattern.compile("(?<=EFFECTBEGIN)(.+?)(?=EFFECTEND)", Pattern.DOTALL); private static final Pattern EFFECT_REGEX = Pattern.compile("(?<=EFFECTBEGIN)(.+?)(?=EFFECTEND)", Pattern.DOTALL);
private static final Pattern SOURCE_REGEX = Pattern.compile("(?<=SOURCEBEGIN)(.+?)(?=SOURCEEND)", Pattern.DOTALL); private static final Pattern SOURCE_REGEX = Pattern.compile("(?<=SOURCEBEGIN)(.+?)(?=SOURCEEND)", Pattern.DOTALL);
private static final Pattern MODS_REGEX = Pattern.compile("(?<=MODSBEGIN)(.+?)(?=MODSEND)", Pattern.DOTALL); private static final Pattern MODS_REGEX = Pattern.compile("(?<=MODSBEGIN)(.+?)(?=MODSEND)", Pattern.DOTALL);
@ -51,21 +51,21 @@ public class EffectsParser {
Matcher matcher = EFFECT_REGEX.matcher(fileContents); Matcher matcher = EFFECT_REGEX.matcher(fileContents);
while (matcher.find()) { while (matcher.find()) {
EffectEntry effectEntry = parseEffectEntry(matcher.group()); Effect effect = parseEffectEntry(matcher.group());
effect_data.put(effectEntry.effect_id, effectEntry); effect_data.put(effect.effect_id, effect);
} }
} }
private static EffectEntry parseEffectEntry(String effectData) { private static Effect parseEffectEntry(String effectData) {
EffectEntry effectEntry = new EffectEntry(); Effect effect = new Effect();
// Parse fields that lie outside the other tags // Parse fields that lie outside the other tags
effectEntry.isItemEffect = effectData.contains("IsItemEffect"); effect.isItemEffect = effectData.contains("IsItemEffect");
effectEntry.isSpireEffect = effectData.contains("IsSpireEffect"); effect.isSpireEffect = effectData.contains("IsSpireEffect");
effectEntry.ignoreNoMod = effectData.contains("IgnoreNoMod"); effect.ignoreNoMod = effectData.contains("IgnoreNoMod");
effectEntry.dontSave = effectData.contains("DontSave"); effect.dontSave = effectData.contains("DontSave");
// Remove all lines that contain a # and leading/trailing blank lines // Remove all lines that contain a # and leading/trailing blank lines
@ -90,24 +90,24 @@ public class EffectsParser {
while (matcher.find()) while (matcher.find())
effectHeader.add(matcher.group().trim()); effectHeader.add(matcher.group().trim());
effectEntry.effect_id = effectHeader.get(0); effect.effect_id = effectHeader.get(0);
effectEntry.effect_name = effectHeader.get(1); effect.effect_name = effectHeader.get(1);
effectEntry.effect_name = effectEntry.effect_name.replaceAll("\"", ""); effect.effect_name = effect.effect_name.replaceAll("\"", "");
// Some effect mods have no icon // Some effect mods have no icon
// (SEEINVIS-SHADE "See Invis") // (SEEINVIS-SHADE "See Invis")
if (effectHeader.size() == 3) if (effectHeader.size() == 3)
effectEntry.icon = Integer.parseInt(effectHeader.get(2)); effect.icon = Integer.parseInt(effectHeader.get(2));
else else
effectEntry.icon = 0; effect.icon = 0;
// Parse source entries // Parse source entries
matcher = SOURCE_REGEX.matcher(effectData); matcher = SOURCE_REGEX.matcher(effectData);
while (matcher.find()) while (matcher.find())
effectEntry.sources.add(matcher.group().trim()); effect.sources.add(matcher.group().trim());
// Parse modifier entries // Parse modifier entries
@ -116,8 +116,8 @@ public class EffectsParser {
// Iterate effect entries from .wpak config data // Iterate effect entries from .wpak config data
while (matcher.find()) { while (matcher.find()) {
EffectModifier effectModifier = parseModEntry(matcher.group()); ModifierEntry modifierEntry = parseModEntry(matcher.group());
effectEntry.mods.add(effectModifier); effect.mods.add(modifierEntry);
} }
// Parse Conditions // Parse Conditions
@ -141,16 +141,16 @@ public class EffectsParser {
while (iterator.hasNext()) while (iterator.hasNext())
conditionEntry.damageTypes.add(mbEnums.DamageType.valueOf(iterator.next().toUpperCase())); conditionEntry.damageTypes.add(mbEnums.DamageType.valueOf(iterator.next().toUpperCase()));
effectEntry.conditions.add(conditionEntry); effect.conditions.add(conditionEntry);
} }
} }
return effectEntry; return effect;
} }
private static EffectModifier parseModEntry(String modData) { private static ModifierEntry parseModEntry(String modData) {
EffectModifier effectModifier = new EffectModifier(); ModifierEntry modifierEntry = new ModifierEntry();
String[] modEntries = modData.trim().split("\n"); String[] modEntries = modData.trim().split("\n");
@ -162,40 +162,22 @@ public class EffectsParser {
while (matcher.find()) while (matcher.find())
modValues.add(matcher.group().trim()); modValues.add(matcher.group().trim());
effectModifier.type = mbEnums.ModType.valueOf(modValues.get(0).trim()); modifierEntry.type = mbEnums.ModType.valueOf(modValues.get(0).trim());
switch (effectModifier.type) { switch (modifierEntry.type) {
case BladeTrails: // No parm modifiers
case ImmuneToAttack:
case ImmuneToPowers:
case Ambidexterity:
case Silenced:
case IgnorePassiveDefense:
case Stunned:
case PowerCostHealth:
case Charmed:
case Fly:
case CannotMove:
case CannotTrack:
case CannotAttack:
case CannotCast:
case SpireBlock:
case Invisible:
case SeeInvisible:
break;
case AnimOverride: case AnimOverride:
effectModifier.min = Float.parseFloat(modValues.get(1).trim()); modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
effectModifier.max = Float.parseFloat(modValues.get(2).trim()); modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
break; break;
case Health: case Health:
case Mana: case Mana:
case Stamina: case Stamina:
effectModifier.min = Float.parseFloat(modValues.get(1).trim()); modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
effectModifier.max = Float.parseFloat(modValues.get(2).trim()); modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
effectModifier.scale = Float.parseFloat(modValues.get(3).trim()); modifierEntry.value = Float.parseFloat(modValues.get(3).trim());
// Parameter 4 is always 0. // Parameter 4 is always 0.
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(5).trim()); modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(5).trim());
effectModifier.arg1 = modValues.get(6).trim(); modifierEntry.arg1 = modValues.get(6).trim();
break; break;
case Attr: case Attr:
case Resistance: case Resistance:
@ -210,12 +192,12 @@ public class EffectsParser {
case Slay: case Slay:
case Fade: case Fade:
case Durability: case Durability:
effectModifier.min = Float.parseFloat(modValues.get(1).trim()); modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
effectModifier.scale = Float.parseFloat(modValues.get(2).trim()); modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim()); modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
if (modValues.size() > 4) if (modValues.size() > 4)
effectModifier.arg1 = modValues.get(4).trim(); // Some HeathFull entries do not have an argument modifierEntry.arg1 = modValues.get(4).trim(); // Some HeathFull entries do not have an argument
break; break;
case MeleeDamageModifier: case MeleeDamageModifier:
case OCV: case OCV:
@ -236,44 +218,62 @@ public class EffectsParser {
case Block: case Block:
case Parry: case Parry:
case Dodge: case Dodge:
case WeaponRange:
case ScanRange: case ScanRange:
case ScaleHeight: case ScaleHeight:
case ScaleWidth: case ScaleWidth:
case WeaponRange: modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
effectModifier.min = Float.parseFloat(modValues.get(1).trim()); modifierEntry.max = Float.parseFloat(modValues.get(2).trim());
effectModifier.scale = Float.parseFloat(modValues.get(2).trim()); modifierEntry.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
break; break;
case ItemName: case ItemName:
case BlockedPowerType: case BlockedPowerType:
case ImmuneTo: case ImmuneTo:
case BlackMantle: case BlackMantle:
effectModifier.arg1 = modValues.get(1).trim(); modifierEntry.arg1 = modValues.get(1).trim();
// Some BlockedPowerType entries have only one argument // Some BlockedPowerType entries have only one argument
if (modValues.size() > 2) if (modValues.size() > 2)
effectModifier.arg2 = modValues.get(2).trim(); modifierEntry.arg2 = modValues.get(2).trim();
break; break;
case NoMod: case NoMod:
case ConstrainedAmbidexterity: case ConstrainedAmbidexterity:
case ProtectionFrom: case ProtectionFrom:
case ExclusiveDamageCap: case ExclusiveDamageCap:
case IgnoreDamageCap: case IgnoreDamageCap:
effectModifier.arg1 = modValues.get(1).trim(); modifierEntry.arg1 = modValues.get(1).trim();
break; break;
case WeaponProc: case WeaponProc:
effectModifier.min = Float.parseFloat(modValues.get(1).trim()); modifierEntry.min = Float.parseFloat(modValues.get(1).trim());
effectModifier.arg1 = modValues.get(2).trim(); modifierEntry.arg1 = modValues.get(2).trim();
effectModifier.scale = Float.parseFloat(modValues.get(3).trim()); modifierEntry.max = Float.parseFloat(modValues.get(3).trim());
break;
case BladeTrails: // These tags have no parms or are not parsed
case ImmuneToAttack:
case ImmuneToPowers:
case Ambidexterity:
case Silenced:
case IgnorePassiveDefense:
case Stunned:
case PowerCostHealth:
case Charmed:
case Fly:
case CannotMove:
case CannotTrack:
case CannotAttack:
case CannotCast:
case SpireBlock:
case Invisible:
case SeeInvisible:
break; break;
default: default:
Logger.error("Unhandled type: " + effectModifier.type); Logger.error("Unhandled type: " + modifierEntry.type);
break; break;
} }
} }
return effectModifier; return modifierEntry;
} }
} }

136
src/engine/wpak/PowerActionParser.java

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

14
src/engine/wpak/PowersParser.java

@ -49,14 +49,14 @@ public class PowersParser {
while (matcher.find()) { while (matcher.find()) {
PowerEntry powerEntry = parsePowerEntry(matcher.group().trim()); Power power = parsePowerEntry(matcher.group().trim());
} }
} }
private static PowerEntry parsePowerEntry(String powerData) { private static Power parsePowerEntry(String powerData) {
PowerEntry powerEntry = new PowerEntry(); Power powerEntry = new Power();
StringBuilder conditionBuilder = new StringBuilder(); StringBuilder conditionBuilder = new StringBuilder();
StringBuilder powerBuilder = new StringBuilder(); StringBuilder powerBuilder = new StringBuilder();
String conditionString; String conditionString;
@ -101,7 +101,7 @@ public class PowersParser {
powerEntry.power_id = iterator.next(); powerEntry.power_id = iterator.next();
powerEntry.power = iterator.next().replaceAll("\"", ""); powerEntry.power = iterator.next().replaceAll("\"", "");
PowerData power = new PowerData(); PowerEntry power = new PowerEntry();
power.power_type = mbEnums.PowerType.valueOf(iterator.next()); power.power_type = mbEnums.PowerType.valueOf(iterator.next());
power.icon = Integer.parseInt(iterator.next()); power.icon = Integer.parseInt(iterator.next());
power.powerBase = iterator.next().replaceAll("\"", ""); power.powerBase = iterator.next().replaceAll("\"", "");
@ -112,7 +112,7 @@ public class PowersParser {
// Account for second definition // Account for second definition
if (nextValue.equals("SPELL") || nextValue.equals("SKILL")) { if (nextValue.equals("SPELL") || nextValue.equals("SKILL")) {
power = new PowerData(); power = new PowerEntry();
power.power_type = mbEnums.PowerType.valueOf(nextValue); power.power_type = mbEnums.PowerType.valueOf(nextValue);
power.icon = Integer.parseInt(iterator.next()); power.icon = Integer.parseInt(iterator.next());
power.powerBase = iterator.next().replaceAll("\"", ""); power.powerBase = iterator.next().replaceAll("\"", "");
@ -222,7 +222,7 @@ public class PowersParser {
powerEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim()); powerEntry.bladeTrails = Boolean.parseBoolean(lineValues.get(1).trim());
break; break;
case "EFFECTPREREQ": case "EFFECTPREREQ":
EffectDescription effectPreReq = new EffectDescription(); Effect effectPreReq = new Effect();
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
effectPreReq.effect_id = arguments.get(9); effectPreReq.effect_id = arguments.get(9);
effectPreReq.level = Integer.parseInt(arguments.get(1)); effectPreReq.level = Integer.parseInt(arguments.get(1));
@ -268,7 +268,7 @@ public class PowersParser {
powerEntry.casterPulseParticle = Integer.parseInt(lineValues.get(1).trim()); powerEntry.casterPulseParticle = Integer.parseInt(lineValues.get(1).trim());
break; break;
case "TARGETEFFECTPREREQS_ORED": case "TARGETEFFECTPREREQS_ORED":
EffectDescription preReq = new EffectDescription(); Effect preReq = new Effect();
arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+")); arguments = Arrays.asList(lineValues.get(1).trim().split("\\s+"));
preReq.effect_id = arguments.get(0); preReq.effect_id = arguments.get(0);
preReq.level = Integer.parseInt(arguments.get(1)); preReq.level = Integer.parseInt(arguments.get(1));

13
src/engine/wpak/data/EffectEntry.java → src/engine/wpak/data/Effect.java

@ -13,16 +13,25 @@ import engine.powers.effectmodifiers.AbstractEffectModifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
public class EffectEntry { public class Effect {
public String effect_id; public String effect_id;
public String effect_name; public String effect_name;
public int icon; public int icon;
public HashSet<String> sources = new HashSet<>(); public HashSet<String> sources = new HashSet<>();
public ArrayList<EffectModifier> mods = new ArrayList<>(); public ArrayList<ModifierEntry> mods = new ArrayList<>();
public ArrayList<ConditionEntry> conditions = new ArrayList<>(); public ArrayList<ConditionEntry> conditions = new ArrayList<>();
// Additional variables outside of tags or parsed
// elsewhere from Effects.cfg
public boolean isItemEffect; public boolean isItemEffect;
public boolean isSpireEffect; public boolean isSpireEffect;
public boolean ignoreNoMod; public boolean ignoreNoMod;
public boolean dontSave; public boolean dontSave;
public String type;
public int level;
public String message;
public int cycleDuration;
public int cycleDelay;
} }

18
src/engine/wpak/data/EffectDescription.java

@ -1,18 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2024
// www.magicbane.com
package engine.wpak.data;
public class EffectDescription {
public String effect_id;
public String type;
public int level;
public String message;
public int cycleDuration;
public int cycleDelay;
}

4
src/engine/wpak/data/EffectModifier.java → src/engine/wpak/data/ModifierEntry.java

@ -10,11 +10,11 @@ package engine.wpak.data;
import engine.mbEnums; import engine.mbEnums;
public class EffectModifier { public class ModifierEntry {
public mbEnums.ModType type; public mbEnums.ModType type;
public float min; public float min;
public float max; public float max;
public float scale; public float value;
public mbEnums.CompoundCurveType compoundCurveType; public mbEnums.CompoundCurveType compoundCurveType;
public String arg1; // ItemName "Masterwork" "" public String arg1; // ItemName "Masterwork" ""
public String arg2; // ItemName "" "of the Defender" public String arg2; // ItemName "" "of the Defender"

69
src/engine/wpak/data/Power.java

@ -0,0 +1,69 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2024
// www.magicbane.com
package engine.wpak.data;
import engine.mbEnums;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
public class Power {
public String power_id;
public String power;
public ArrayList<PowerEntry> powers = new ArrayList<>();
public mbEnums.PowerTargetType target_type;
public int range;
public mbEnums.AreaType areaType;
public int areaRange;
public mbEnums.ExcludeType excludeType;
public mbEnums.CostType costType;
public float cost;
public float difficulty;
public float precision;
public float init_time;
public float release_time;
public float recycle_time;
public int hitRollYN;
public mbEnums.CastingModeType castingMode;
public int initAmin;
public int releaseAnim;
public mbEnums.TargetSelectType targetSelect;
// Additional key/value type power entries
public ArrayList<ActionEntry> actionEntries = new ArrayList<>();
public int maxLevel;
public int hateValue;
public mbEnums.CompoundCurveType hateCurve = mbEnums.CompoundCurveType.DefaultFlat;
public int loopAnimID;
public String grantOverrideVar;
public ArrayList<String> description = new ArrayList<>();
public HashMap<String, mbEnums.CompoundCurveType> curves = new HashMap<>();
public String category;
public boolean canCastWhileMoving = false;
public boolean bladeTrails = false;
public ArrayList<Effect> effectPreReqs = new ArrayList<>();
public ArrayList<EquipmentPreReq> equipmentPreReq = new ArrayList<>();
public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class);
public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class);
public boolean shouldCheckPath = false;
public boolean sticky = false;
public int pulseCycle;
public int pulseDuration;
public int maxMobTargets;
public int maxPlayerTargets;
public boolean isAdminPower = false;
public int casterPulseParticle;
public ArrayList<Effect> targetEffectPrereqs = new ArrayList<>();
public boolean canCastWhileFlying = false;
public boolean isProjectile = false;
public HashMap<String, Float> conditions = new HashMap<>();
}

4
src/engine/wpak/data/PowerActionEntry.java → src/engine/wpak/data/PowerAction.java

@ -12,13 +12,13 @@ import engine.mbEnums;
import java.util.ArrayList; import java.util.ArrayList;
public class PowerActionEntry { public class PowerAction {
// Header values // Header values
public String action_id; public String action_id;
public String action_type; public String action_type;
public ArrayList<EffectDescription> effects = new ArrayList<>(); public ArrayList<Effect> effects = new ArrayList<>();
public int petLevel; public int petLevel;
public int petRace; public int petRace;
public StatTransfer statTransfer; public StatTransfer statTransfer;

17
src/engine/wpak/data/PowerData.java

@ -1,17 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2024
// www.magicbane.com
package engine.wpak.data;
import engine.mbEnums;
public class PowerData {
public mbEnums.PowerType power_type;
public int icon;
public String powerBase;
}

58
src/engine/wpak/data/PowerEntry.java

@ -10,60 +10,8 @@ package engine.wpak.data;
import engine.mbEnums; import engine.mbEnums;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
public class PowerEntry { public class PowerEntry {
public String power_id; public mbEnums.PowerType power_type;
public String power; public int icon;
public ArrayList<PowerData> powers = new ArrayList<>(); public String powerBase;
public mbEnums.PowerTargetType target_type;
public int range;
public mbEnums.AreaType areaType;
public int areaRange;
public mbEnums.ExcludeType excludeType;
public mbEnums.CostType costType;
public float cost;
public float difficulty;
public float precision;
public float init_time;
public float release_time;
public float recycle_time;
public int hitRollYN;
public mbEnums.CastingModeType castingMode;
public int initAmin;
public int releaseAnim;
public mbEnums.TargetSelectType targetSelect;
// Additional key/value type power entries
public ArrayList<ActionEntry> actionEntries = new ArrayList<>();
public int maxLevel;
public int hateValue;
public mbEnums.CompoundCurveType hateCurve = mbEnums.CompoundCurveType.DefaultFlat;
public int loopAnimID;
public String grantOverrideVar;
public ArrayList<String> description = new ArrayList<>();
public HashMap<String, mbEnums.CompoundCurveType> curves = new HashMap<>();
public String category;
public boolean canCastWhileMoving = false;
public boolean bladeTrails = false;
public ArrayList<EffectDescription> effectPreReqs = new ArrayList<>();
public ArrayList<EquipmentPreReq> equipmentPreReq = new ArrayList<>();
public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class);
public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class);
public boolean shouldCheckPath = false;
public boolean sticky = false;
public int pulseCycle;
public int pulseDuration;
public int maxMobTargets;
public int maxPlayerTargets;
public boolean isAdminPower = false;
public int casterPulseParticle;
public ArrayList<EffectDescription> targetEffectPrereqs = new ArrayList<>();
public boolean canCastWhileFlying = false;
public boolean isProjectile = false;
public HashMap<String, Float> conditions = new HashMap<>();
} }

Loading…
Cancel
Save