Add wpak cfg reader and PowerActions.cfg loader

New engine.parsers.wpak importer (replaces engine.wpak, which stays unused).
WpakFileReader tokenizes cfg lines (quotes, '#'/'*' comments, trailing '#')
and builds XxxBEGIN/XxxEND blocks; every error names file:line.

PowerActionParser loads PowerActions.cfg into PowerActionTemplate._powerActions,
keyed by action id, at world boot. Header layouts per action type come from
the client's ArcPowerAction*_ParseHeader functions: the trailing 0/1 on
ApplyEffect and friends is the aggressive flag, not a level. effect_ids holds
the action -> effect map needed by Task 2.10b. Three ids (PRE-235..237)
repeat identically; the later entry wins, as in the client. No consumers change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-22 11:08:09 -04:00
1 parent 76dcdc0f72
commit 6c820940d3
7 files changed
+711

No files matched your search

@@ -0,0 +1,86 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2026
// https://www.magicbane.com
package engine.parsers.objects.wpak;
import engine.mbEnums;
import java.util.ArrayList;
import java.util.HashMap;
// One POWERACTIONBEGIN block of PowerActions.cfg.
//
// Header: <action_id> <action_type> <type-specific args>. The per-type layouts
// come from the client's ArcPowerAction*_ParseHeader functions. header_args keeps
// every arg as written, including ones the client reads but nothing names yet.
// KEY= lines map to the lower-case fields named after them.
//
// Read only once loaded.
public class PowerActionTemplate {
public static HashMap<String, PowerActionTemplate> _powerActions = new HashMap<>();
public String action_id;
public mbEnums.PowerActionType action_type;
public final ArrayList<String> header_args = new ArrayList<>();
// Header
// ApplyEffect, ApplyEffects, Block, Charm, DamageOverTime, DeferredPower,
// DirectDamage, Invis, SpireDisable, Track, Transform, TransferStatOT
public final ArrayList<String> effect_ids = new ArrayList<>();
public String deferred_power_id;
public int num_iterations;
public int mob_id;
public int mob_level;
public String effect_source_to_remove;
public mbEnums.ItemFlags item_flag;
public boolean item_flag_value;
public String track_filter;
public int max_track;
public mbEnums.CostType transfer_from_type;
public mbEnums.CostType transfer_to_type;
// The client reads both with String::ToInt, so 31.5 acts as 31 (0x56ADF0)
public float transfer_amount;
public String transfer_amount_curve;
public float transfer_efficiency;
public String transfer_efficiency_curve;
// Keys, plus the header's trailing aggressive flag (both set the same client field)
public boolean isaggressive;
public boolean bladetrails;
public boolean isresistable;
public String applyeffectself;
public String applyeffectother;
public String wearoffeffectself;
public String wearoffeffectother;
public boolean applyeffectblank;
public boolean wearoffeffectblank;
public boolean is_available_for_formulae;
public boolean removeall;
public final ArrayList<Integer> bodyparts = new ArrayList<>();
public final ArrayList<Integer> femalebodyparts = new ArrayList<>();
public boolean shouldshowweapons;
public boolean shouldshowarmor;
public final ArrayList<Integer> attackanims = new ArrayList<>();
public float[] scalefactor;
public String effectid;
public int levelcap;
public String levelcap_curve;
public boolean clearaggro;
public boolean targetbecomespet;
public boolean destroyoldpet;
public String rootfsmid;
public mbEnums.DamageType damagetype;
public final ArrayList<Integer> splashdamage = new ArrayList<>();
}