forked from MagicBane/Server
PowersManager.loadPowerActions builds every AbstractPowerAction from PowerActionTemplate (template ctor on all subclasses), in id order with IDs 1..3046; OPENGATE keeps 5000. The ResultSet loader stays until removal. The parser now reads the SimpleDamage (min, max), Teleport (bool), Track (two bools) and TransferStat (bool at token 8) header fields. Parity (JSON-Refactor-Plan/scripts/p47.py, every column): ids 3046/3046 plus the DB-only AELFBORN row, which nothing references (the cfg has BOON-AELFBORN). Effect ids, deferred powers, RemoveEffect source/REMOVEALL, track filter/max, transfer types/ramps/ramp-add, mob level identical. The old flags match the new header fields: Track 1024/2048 = tokens 3/4, TransferStat 16384 = token 8, Teleport 32768 = SAB-001A's TRUE. Value changes (PowerActions.cfg wins): - DamageOverTime/TransferStatOT: the cfg value is the tick count; tick length = action duration / ticks. The DB stored cfg+1 as tick seconds, which only worked for 30s DoTs (5 x 6s, unchanged). HOLY-DOT-17 (60s) goes 10 -> 5 ticks, BLEED-DOT (4s) 0 -> 4, TransferStatOT 30s 6 -> 5 ticks. - TransferStat amounts are read with ToInt as the client does: 16 actions drop by 0.5 (BEL-001A 31.5 -> 31, CON-001A 13.5 -> 13, ...). - PRE-334..337 become ApplyEffects with one effect; ApplyEffectsPowerAction now allows a missing second effect on baked-in items. - Charm level cap ramp from the LEVELCAP= curve (same values as the DB). - Charm actions with effect FEAR/CONFUSION (12, DB type Confusion) stay ConfusionPowerAction no-ops; CHARM ones use CharmPowerAction (decided). - CreateMob: the cfg client mob id (49..74, 3500, 3501) maps to the mobbase through a map in CreateMobPowerAction, from the old DB values. - The 50 Charm/Block/SpireDisable rows with no DB effect id get the cfg id (unread by those classes); isAggressive differs on 330 rows (unread). - SimpleDamage keeps min/max instead of the always-0 simpleDamage (unread). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
147 lines
5.3 KiB
Java
147 lines
5.3 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
|
|
package engine.powers.poweractions;
|
|
|
|
import engine.jobs.TrackJob;
|
|
import engine.math.Vector3fImmutable;
|
|
import engine.objects.AbstractCharacter;
|
|
import engine.objects.AbstractWorldObject;
|
|
import engine.parsers.objects.wpak.PowerActionTemplate;
|
|
import engine.powers.ActionsBase;
|
|
import engine.powers.EffectsBase;
|
|
import engine.powers.PowersBase;
|
|
import engine.server.MBServerStatics;
|
|
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import java.util.HashMap;
|
|
|
|
|
|
public class TrackPowerAction extends AbstractPowerAction {
|
|
|
|
private String effectID;
|
|
private boolean trackPlayer;
|
|
private boolean trackCorpse;
|
|
private boolean trackAll;
|
|
private boolean trackDragon;
|
|
private boolean trackGiant;
|
|
private boolean trackNPC;
|
|
private boolean trackUndead;
|
|
private boolean trackVampire;
|
|
private int maxTrack;
|
|
private EffectsBase effect;
|
|
|
|
public TrackPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
|
super(rs);
|
|
|
|
this.effectID = rs.getString("effectID");
|
|
int flags = rs.getInt("flags");
|
|
this.trackPlayer = ((flags & 1024) != 0) ? true : false;
|
|
this.trackCorpse = ((flags & 2048) != 0) ? true : false;
|
|
String trackFilter = rs.getString("trackFilter");
|
|
this.trackAll = trackFilter.equals("All") ? true : false;
|
|
this.trackDragon = trackFilter.equals("Dragon") ? true : false;
|
|
this.trackGiant = trackFilter.equals("Giant") ? true : false;
|
|
this.trackNPC = trackFilter.equals("NPC") ? true : false;
|
|
this.trackUndead = trackFilter.equals("Undead") ? true : false;
|
|
this.trackVampire = trackFilter.equals("Vampire") ? true : false;
|
|
|
|
this.maxTrack = rs.getInt("maxTrack");
|
|
this.effect = effects.get(this.effectID);
|
|
}
|
|
|
|
public TrackPowerAction(PowerActionTemplate powerActionTemplate, int id, HashMap<String, EffectsBase> effects) {
|
|
super(powerActionTemplate, id);
|
|
|
|
this.effectID = effectIDAt(powerActionTemplate, 0);
|
|
this.trackPlayer = powerActionTemplate.track_player;
|
|
this.trackCorpse = powerActionTemplate.track_corpse;
|
|
String trackFilter = powerActionTemplate.track_filter;
|
|
this.trackAll = trackFilter.equals("All") ? true : false;
|
|
this.trackDragon = trackFilter.equals("Dragon") ? true : false;
|
|
this.trackGiant = trackFilter.equals("Giant") ? true : false;
|
|
this.trackNPC = trackFilter.equals("NPC") ? true : false;
|
|
this.trackUndead = trackFilter.equals("Undead") ? true : false;
|
|
this.trackVampire = trackFilter.equals("Vampire") ? true : false;
|
|
|
|
this.maxTrack = powerActionTemplate.max_track;
|
|
this.effect = effects.get(this.effectID);
|
|
}
|
|
|
|
public String getEffectID() {
|
|
return this.effectID;
|
|
}
|
|
|
|
public boolean trackPlayer() {
|
|
return this.trackPlayer;
|
|
}
|
|
|
|
public boolean trackCorpse() {
|
|
return this.trackCorpse;
|
|
}
|
|
|
|
public boolean trackAll() {
|
|
return this.trackAll;
|
|
}
|
|
|
|
public boolean trackDragon() {
|
|
return this.trackDragon;
|
|
}
|
|
|
|
public boolean trackGiant() {
|
|
return this.trackGiant;
|
|
}
|
|
|
|
public boolean trackNPC() {
|
|
return this.trackNPC;
|
|
}
|
|
|
|
public boolean trackUndead() {
|
|
return this.trackUndead;
|
|
}
|
|
|
|
public boolean trackVampire() {
|
|
return this.trackVampire;
|
|
}
|
|
|
|
public int getMaxTrack() {
|
|
return this.maxTrack;
|
|
}
|
|
|
|
public EffectsBase getEffect() {
|
|
return this.effect;
|
|
}
|
|
|
|
@Override
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
if (source == null || awo == null || this.effect == null || pb == null || ab == null) {
|
|
//TODO log error here
|
|
return;
|
|
}
|
|
|
|
//add schedule job to end it if needed and add effect to pc
|
|
int duration = MBServerStatics.TRACK_ARROW_SENSITIVITY;
|
|
String stackType = ab.getStackType();
|
|
TrackJob eff = new TrackJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
|
source.addEffect(stackType, duration, eff, this.effect, trains);
|
|
}
|
|
|
|
@Override
|
|
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
}
|
|
|
|
@Override
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
|
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
}
|