Power Action Constructor (not finished)

This commit is contained in:
2024-09-02 16:30:47 -05:00
parent a5ccba2e27
commit 0fd6dfb648
13 changed files with 168 additions and 173 deletions
+123 -6
View File
@@ -27,12 +27,14 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.objects.*;
import engine.powers.*;
import engine.powers.poweractions.AbstractPowerAction;
import engine.powers.poweractions.*;
import engine.server.MBServerStatics;
import engine.wpak.EffectsParser;
import engine.wpak.PowerActionParser;
import engine.wpak.PowersParser;
import engine.wpak.data.ActionEntry;
import engine.wpak.data.Effect;
import engine.wpak.data.PowerAction;
import org.pmw.tinylog.Logger;
import java.sql.SQLException;
@@ -127,6 +129,124 @@ public enum PowersManager {
}
public static void InitializePowerActions(){
// Add PowerActions
//AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
HashMap<String, EffectsBase> effects = PowersManager.effectsBaseByIDString;
for (PowerAction rs : PowerActionParser.power_actions) {
AbstractPowerAction apa;
String type = rs.action_type;
String IDString = rs.action_id;
int token = DbManager.hasher.SBStringHash(IDString);
//cache token, used for applying effects.
PowersManager.ActionTokenByIDString.put(IDString, token);
apa = null;
switch (type) {
default:
Logger.error("valid type not found for poweraction of ID" + IDString);
break;
case "ApplyEffect":
apa = new ApplyEffectPowerAction(rs, effects);
break;
case "ApplyEffects":
apa = new ApplyEffectsPowerAction(rs, effects);
break;
case "DeferredPower":
apa = new DeferredPowerPowerAction(rs, effects);
break;
case "DamageOverTime":
apa = new DamageOverTimePowerAction(rs, effects);
break;
case "Peek":
apa = new PeekPowerAction(rs);
break;
case "Charm":
apa = new CharmPowerAction(rs);
break;
case "Fear":
apa = new FearPowerAction(rs);
break;
case "Confusion":
apa = new ConfusionPowerAction(rs);
break;
case "RemoveEffect":
apa = new RemoveEffectPowerAction(rs);
break;
case "Track":
apa = new TrackPowerAction(rs, effects);
break;
case "DirectDamage":
apa = new DirectDamagePowerAction(rs, effects);
break;
case "Transform":
apa = new TransformPowerAction(rs, effects);
break;
case "CreateMob":
apa = new CreateMobPowerAction(rs);
break;
case "Invis":
apa = new InvisPowerAction(rs, effects);
break;
case "ClearNearbyAggro":
apa = new ClearNearbyAggroPowerAction(rs);
break;
case "MobRecall":
apa = new MobRecallPowerAction(rs);
break;
case "SetItemFlag":
apa = new SetItemFlagPowerAction(rs);
break;
case "SimpleDamage":
apa = new SimpleDamagePowerAction(rs);
break;
case "TransferStatOT":
apa = new TransferStatOTPowerAction(rs, effects);
break;
case "TransferStat":
apa = new TransferStatPowerAction(rs, effects);
break;
case "Teleport":
apa = new TeleportPowerAction(rs);
break;
case "TreeChoke":
apa = new TreeChokePowerAction(rs);
break;
case "Block":
apa = new BlockPowerAction(rs);
break;
case "Resurrect":
apa = new ResurrectPowerAction(rs);
break;
case "ClearAggro":
apa = new ClearAggroPowerAction(rs);
break;
case "ClaimMine":
apa = new ClaimMinePowerAction(rs);
break;
case "Recall":
apa = new RecallPowerAction(rs);
break;
case "SpireDisable":
apa = new SpireDisablePowerAction(rs);
break;
case "Steal":
apa = new StealPowerAction(rs);
break;
case "Summon":
apa = new SummonPowerAction(rs);
break;
case "RunegateTeleport":
apa = new RunegateTeleportPowerAction(rs);
break;
case "OpenGate":
apa = new OpenGatePowerAction(rs);
break;
}
PowersManager.powerActionsByIDString.put(IDString, apa);
}
}
// This pre-loads all powers and effects
public static void InitializePowers() {
@@ -137,11 +257,8 @@ public enum PowersManager {
//Initialize Effects Data
InitializeEffects();
// Add PowerActions
AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
// Load valid Item Flags
// AbstractPowerAction.loadValidItemFlags(PowersManager.powerActionsByIDString);
//Initialize Power Actions
InitializePowerActions();
// get all PowersBase
ArrayList<PowersBase> pbList = dbSkillReqHandler.getAllPowersBase();