|
|
@ -18,6 +18,7 @@ import engine.objects.Item; |
|
|
|
import engine.powers.ActionsBase; |
|
|
|
import engine.powers.ActionsBase; |
|
|
|
import engine.powers.EffectsBase; |
|
|
|
import engine.powers.EffectsBase; |
|
|
|
import engine.powers.PowersBase; |
|
|
|
import engine.powers.PowersBase; |
|
|
|
|
|
|
|
import engine.wpak.data.PowerAction; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.Connection; |
|
|
@ -46,13 +47,12 @@ public abstract class AbstractPowerAction { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* ResultSet Constructor |
|
|
|
* ResultSet Constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public AbstractPowerAction(ResultSet rs) throws SQLException { |
|
|
|
public AbstractPowerAction(PowerAction rs){ |
|
|
|
|
|
|
|
|
|
|
|
this.UUID = rs.getInt("ID"); |
|
|
|
this.IDString = rs.action_id; |
|
|
|
this.IDString = rs.getString("IDString"); |
|
|
|
this.type = rs.action_type; |
|
|
|
this.type = rs.getString("type"); |
|
|
|
int flags = rs.itemFlag.ordinal(); |
|
|
|
int flags = rs.getInt("flags"); |
|
|
|
this.isAggressive = rs.isAggressive; |
|
|
|
this.isAggressive = ((flags & 128) != 0) ? true : false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AbstractPowerAction(int uUID, String iDString, String type, boolean isAggressive, |
|
|
|
public AbstractPowerAction(int uUID, String iDString, String type, boolean isAggressive, |
|
|
@ -64,139 +64,6 @@ public abstract class AbstractPowerAction { |
|
|
|
this.isAggressive = false; |
|
|
|
this.isAggressive = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void getAllPowerActions(HashMap<String, AbstractPowerAction> powerActions, HashMap<Integer, AbstractPowerAction> powerActionsByID, HashMap<String, EffectsBase> effects) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_poweraction")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
String IDString, type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
|
|
|
|
AbstractPowerAction apa; |
|
|
|
|
|
|
|
type = rs.getString("type"); |
|
|
|
|
|
|
|
IDString = rs.getString("IDString"); |
|
|
|
|
|
|
|
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" + rs.getInt("ID")); |
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerActions.put(IDString, apa); |
|
|
|
|
|
|
|
powerActionsByID.put(apa.UUID, apa); |
|
|
|
|
|
|
|
apa.validItemFlags = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rs.close(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
Logger.error(e.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Add OpenGatePowerAction
|
|
|
|
|
|
|
|
AbstractPowerAction openGateAction = new OpenGatePowerAction(5000, "OPENGATE", "OpenGate", false, 0); |
|
|
|
|
|
|
|
powerActions.put("OPENGATE", openGateAction); |
|
|
|
|
|
|
|
powerActionsByID.put(openGateAction.UUID, openGateAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) { |
|
|
|
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) { |
|
|
|
this._startAction(source, awo, targetLoc, numTrains, ab, pb); |
|
|
|
this._startAction(source, awo, targetLoc, numTrains, ab, pb); |
|
|
|
} |
|
|
|
} |
|
|
|