Initial Repository Push
This commit is contained in:
@@ -0,0 +1,274 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PreparedStatementShared;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public abstract class AbstractPowerAction {
|
||||
|
||||
protected PowersBase parent;
|
||||
protected int UUID;
|
||||
protected String IDString;
|
||||
protected String type;
|
||||
protected boolean isAggressive;
|
||||
protected long validItemFlags;
|
||||
|
||||
/**
|
||||
* No Table ID Constructor
|
||||
*/
|
||||
public AbstractPowerAction() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public AbstractPowerAction(ResultSet rs) throws SQLException {
|
||||
|
||||
this.UUID = rs.getInt("ID");
|
||||
this.IDString = rs.getString("IDString");
|
||||
this.type = rs.getString("type");
|
||||
int flags = rs.getInt("flags");
|
||||
this.isAggressive = ((flags & 128) != 0) ? true : false;
|
||||
}
|
||||
|
||||
public AbstractPowerAction( int uUID, String iDString, String type, boolean isAggressive,
|
||||
long validItemFlags) {
|
||||
super();
|
||||
UUID = uUID;
|
||||
IDString = iDString;
|
||||
this.type = type;
|
||||
this.isAggressive = false;
|
||||
}
|
||||
|
||||
public static void getAllPowerActions(HashMap<String, AbstractPowerAction> powerActions, HashMap<Integer, AbstractPowerAction> powerActionsByID, HashMap<String, EffectsBase> effects) {
|
||||
PreparedStatementShared ps = null;
|
||||
try {
|
||||
ps = new PreparedStatementShared("SELECT * FROM static_power_poweraction");
|
||||
ResultSet rs = ps.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);
|
||||
if (type.equals("ApplyEffect"))
|
||||
apa = new ApplyEffectPowerAction(rs, effects);
|
||||
else if (type.equals("ApplyEffects"))
|
||||
apa = new ApplyEffectsPowerAction(rs, effects);
|
||||
else if (type.equals("DeferredPower"))
|
||||
apa = new DeferredPowerPowerAction(rs, effects);
|
||||
else if (type.equals("DamageOverTime"))
|
||||
apa = new DamageOverTimePowerAction(rs, effects);
|
||||
else if (type.equals("Peek"))
|
||||
apa = new PeekPowerAction(rs);
|
||||
else if (type.equals("Charm"))
|
||||
apa = new CharmPowerAction(rs);
|
||||
else if (type.equals("Fear"))
|
||||
apa = new FearPowerAction(rs);
|
||||
else if (type.equals("Confusion"))
|
||||
apa = new ConfusionPowerAction(rs);
|
||||
else if (type.equals("RemoveEffect"))
|
||||
apa = new RemoveEffectPowerAction(rs);
|
||||
else if (type.equals("Track"))
|
||||
apa = new TrackPowerAction(rs, effects);
|
||||
else if (type.equals("DirectDamage"))
|
||||
apa = new DirectDamagePowerAction(rs, effects);
|
||||
else if (type.equals("Transform"))
|
||||
apa = new TransformPowerAction(rs, effects);
|
||||
else if (type.equals("CreateMob"))
|
||||
apa = new CreateMobPowerAction(rs);
|
||||
else if (type.equals("Invis"))
|
||||
apa = new InvisPowerAction(rs, effects);
|
||||
else if (type.equals("ClearNearbyAggro"))
|
||||
apa = new ClearNearbyAggroPowerAction(rs);
|
||||
else if (type.equals("MobRecall"))
|
||||
apa = new MobRecallPowerAction(rs);
|
||||
else if (type.equals("SetItemFlag"))
|
||||
apa = new SetItemFlagPowerAction(rs);
|
||||
else if (type.equals("SimpleDamage"))
|
||||
apa = new SimpleDamagePowerAction(rs);
|
||||
else if (type.equals("TransferStatOT"))
|
||||
apa = new TransferStatOTPowerAction(rs, effects);
|
||||
else if (type.equals("TransferStat"))
|
||||
apa = new TransferStatPowerAction(rs, effects);
|
||||
else if (type.equals("Teleport"))
|
||||
apa = new TeleportPowerAction(rs);
|
||||
else if (type.equals("TreeChoke"))
|
||||
apa = new TreeChokePowerAction(rs);
|
||||
else if (type.equals("Block"))
|
||||
apa = new BlockPowerAction(rs);
|
||||
else if (type.equals("Resurrect"))
|
||||
apa = new ResurrectPowerAction(rs);
|
||||
else if (type.equals("ClearAggro"))
|
||||
apa = new ClearAggroPowerAction(rs);
|
||||
else if (type.equals("ClaimMine"))
|
||||
apa = new ClaimMinePowerAction(rs);
|
||||
else if (type.equals("Recall"))
|
||||
apa = new RecallPowerAction(rs);
|
||||
else if (type.equals("SpireDisable"))
|
||||
apa = new SpireDisablePowerAction(rs);
|
||||
else if (type.equals("Steal"))
|
||||
apa = new StealPowerAction(rs);
|
||||
else if (type.equals("Summon"))
|
||||
apa = new SummonPowerAction(rs);
|
||||
else if (type.equals("RunegateTeleport"))
|
||||
apa = new RunegateTeleportPowerAction(rs);
|
||||
else if (type.equals("RunegateTeleport"))
|
||||
apa = new RunegateTeleportPowerAction(rs);
|
||||
else if (type.equals("OpenGate"))
|
||||
apa = new OpenGatePowerAction(rs);
|
||||
else {
|
||||
Logger.error("valid type not found for poweraction of ID" + rs.getInt("ID"));
|
||||
continue;
|
||||
}
|
||||
powerActions.put(IDString, apa);
|
||||
powerActionsByID.put(apa.UUID, apa);
|
||||
apa.validItemFlags = 0;
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error( e.toString());
|
||||
} finally {
|
||||
ps.release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//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) {
|
||||
this._startAction(source, awo, targetLoc, numTrains, ab, pb);
|
||||
}
|
||||
|
||||
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
this._startAction(source, awo, targetLoc, numTrains, ab, pb,duration);
|
||||
}
|
||||
|
||||
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
|
||||
|
||||
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration);
|
||||
|
||||
public void handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) {
|
||||
this._handleChant(source, target, targetLoc, numTrains, ab, pb);
|
||||
}
|
||||
|
||||
protected abstract void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
|
||||
|
||||
public int getUUID() {
|
||||
return this.UUID;
|
||||
}
|
||||
|
||||
public String getIDString() {
|
||||
return this.IDString;
|
||||
}
|
||||
|
||||
// public String getMessageType() {
|
||||
// return this.type;
|
||||
// }
|
||||
|
||||
public boolean isAggressive() {
|
||||
return this.isAggressive;
|
||||
}
|
||||
|
||||
public PowersBase getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void setParent(PowersBase value) {
|
||||
this.parent = value;
|
||||
}
|
||||
|
||||
public void applyEffectForItem(Item item, int trains) {
|
||||
if (this instanceof ApplyEffectPowerAction)
|
||||
((ApplyEffectPowerAction)this)._applyEffectForItem(item, trains);
|
||||
if (this instanceof ApplyEffectsPowerAction)
|
||||
((ApplyEffectsPowerAction)this)._applyEffectForItem(item, trains);
|
||||
}
|
||||
public void applyBakedInStatsForItem(Item item, int trains) {
|
||||
if (this instanceof ApplyEffectPowerAction)
|
||||
((ApplyEffectPowerAction)this)._applyBakedInStatsForItem(item, trains);
|
||||
if (this instanceof ApplyEffectsPowerAction)
|
||||
((ApplyEffectsPowerAction)this)._applyBakedInStatsForItem(item, trains);
|
||||
}
|
||||
|
||||
public EffectsBase getEffectsBase() {
|
||||
if (this instanceof ApplyEffectPowerAction)
|
||||
return ((ApplyEffectPowerAction)this).getEffect();
|
||||
else if (this instanceof ApplyEffectsPowerAction)
|
||||
return ((ApplyEffectsPowerAction)this).getEffect();
|
||||
return null;
|
||||
}
|
||||
|
||||
public EffectsBase getEffectsBase2() {
|
||||
if (this instanceof ApplyEffectsPowerAction)
|
||||
return ((ApplyEffectsPowerAction)this).getEffect2();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void loadValidItemFlags(HashMap<String, AbstractPowerAction> powerActions) {
|
||||
PreparedStatementShared ps = null;
|
||||
try {
|
||||
ps = new PreparedStatementShared("SELECT * FROM `static_power_effect_allowed_item`");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
String IDS;
|
||||
long flags;
|
||||
while (rs.next()) {
|
||||
AbstractPowerAction apa;
|
||||
flags = rs.getLong("flags");
|
||||
IDS = rs.getString("IDString");
|
||||
if (powerActions.containsKey(IDS)) {
|
||||
apa = powerActions.get(IDS);
|
||||
apa.validItemFlags = flags;
|
||||
} else {
|
||||
Logger.error("Unable to find PowerAction " + IDS);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
} finally {
|
||||
ps.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//These functions verify a powerAction is valid for an item type
|
||||
public long getValidItemFlags() {
|
||||
return this.validItemFlags;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.ai.MobileFSM;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.jobs.ChantJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.jobs.FinishEffectTimeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ApplyEffectPowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private EffectsBase effect;
|
||||
private String effectParentID;
|
||||
private EffectsBase effectParent;
|
||||
|
||||
public ApplyEffectPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
this.effectParentID = rs.getString("IDString");
|
||||
this.effectParent = effects.get(this.effectParentID);
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public ApplyEffectPowerAction(ResultSet rs, EffectsBase effect) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effect = effect;
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (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 = 0;
|
||||
// if (pb.isChant())
|
||||
// duration = (int)pb.getChantDuration() * 1000;
|
||||
// else
|
||||
duration = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
if (stackType.equals("WeaponMove")) {
|
||||
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, 10000, eff, this.effect, trains);
|
||||
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
((PlayerCharacter)awo).setWeaponPower(eff);
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
} else {
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
|
||||
|
||||
if (blockInvul(pb, source, awo)) {
|
||||
this.effect.endEffect(source, awo, trains, pb, eff);
|
||||
return;
|
||||
}
|
||||
|
||||
// Effect lastEff = awo.getEffects().get(eff.getStackType());
|
||||
//
|
||||
// if (lastEff != null && lastEff.getPowerToken() == eff.getPowerToken())
|
||||
// lastEff.cancelJob(true);
|
||||
|
||||
if (duration > 0) {
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, duration, eff, effect, trains);
|
||||
} else
|
||||
awo.applyAllBonuses();
|
||||
// //TODO if chant, start cycle
|
||||
// if (pb.isChant() && source.equals(awo)) {
|
||||
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
|
||||
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
|
||||
// eff.setChant(true);
|
||||
// }
|
||||
|
||||
if (this.effectID.equals("TAUNT")){
|
||||
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
|
||||
MobileFSM.setAggro((Mob)awo,source.getObjectUUID());
|
||||
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
|
||||
DispatchMessage.sendToAllInRange(source, msg);
|
||||
}
|
||||
}
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
}
|
||||
|
||||
protected void _applyEffectForItem(Item item, int trains) {
|
||||
if (item == null || this.effect == null)
|
||||
return;
|
||||
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
|
||||
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
|
||||
}
|
||||
protected void _applyBakedInStatsForItem(Item item, int trains) {
|
||||
if (item == null)
|
||||
return;
|
||||
if (this.effect == null){
|
||||
Logger.error( "Unknown Token: EffectBase ID " + this.effectID + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.effectParent == null){
|
||||
Logger.error("Unknown Token: EffectBase ID " + this.effectParentID + '.');
|
||||
return;
|
||||
}
|
||||
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
|
||||
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
|
||||
if (eff != null && eff3 != null){
|
||||
eff3.setBakedInStat(true);
|
||||
item.getEffectNames().add(this.effect.getIDString());
|
||||
item.getEffectNames().add(this.effectParent.getIDString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (source != null) {
|
||||
PlayerBonuses bonuses = source.getBonuses();
|
||||
|
||||
if (bonuses == null)
|
||||
return;
|
||||
|
||||
boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.None);
|
||||
|
||||
if (noSilence)
|
||||
return;
|
||||
|
||||
}
|
||||
String stackType = ab.stackType;
|
||||
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
|
||||
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, effect);
|
||||
ChantJob cj = new ChantJob(source, target, stackType, trains, ab, pb, effect, eff);
|
||||
//handle invul
|
||||
if(pb.getUUID() != 334)
|
||||
source.setLastChant((int)(pb.getChantDuration()) * 1000, cj);
|
||||
else
|
||||
source.setLastChant((int)(pb.getChantDuration()) * 1000, cj);
|
||||
eff.setChant(true);
|
||||
}
|
||||
|
||||
private static boolean blockInvul(PowersBase pb, AbstractCharacter source, AbstractWorldObject awo) {
|
||||
if (awo == null || pb == null || source == null)
|
||||
return false;
|
||||
|
||||
if (source.getObjectUUID() == awo.getObjectUUID())
|
||||
return false;
|
||||
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(awo))
|
||||
return false;
|
||||
|
||||
AbstractCharacter ac = (AbstractCharacter) awo;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||
int trains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
if (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
|
||||
// if (pb.isChant())
|
||||
// duration = (int)pb.getChantDuration() * 1000;
|
||||
// else
|
||||
|
||||
String stackType = ab.getStackType();
|
||||
if (stackType.equals("WeaponMove")) {
|
||||
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, 10000, eff, this.effect, trains);
|
||||
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
((PlayerCharacter)awo).setWeaponPower(eff);
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
} else {
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
|
||||
|
||||
if (blockInvul(pb, source, awo)) {
|
||||
this.effect.endEffect(source, awo, trains, pb, eff);
|
||||
return;
|
||||
}
|
||||
|
||||
if (duration > 0) {
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, duration, eff, effect, trains);
|
||||
} else
|
||||
awo.applyAllBonuses();
|
||||
// //TODO if chant, start cycle
|
||||
// if (pb.isChant() && source.equals(awo)) {
|
||||
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
|
||||
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
|
||||
// eff.setChant(true);
|
||||
// }
|
||||
|
||||
if (this.effectID.equals("TAUNT")){
|
||||
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
|
||||
MobileFSM.setAggro((Mob)awo,source.getObjectUUID());
|
||||
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
|
||||
DispatchMessage.sendToAllInRange(source, msg);
|
||||
}
|
||||
}
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Effect;
|
||||
import engine.objects.Item;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class ApplyEffectsPowerAction extends AbstractPowerAction {
|
||||
private String IDString;
|
||||
private String effectID;
|
||||
private String effectID2;
|
||||
private EffectsBase effect;
|
||||
private EffectsBase effect2;
|
||||
private EffectsBase effectParent;
|
||||
|
||||
public ApplyEffectsPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
this.IDString = rs.getString("IDString");
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effectID2 = rs.getString("effectID2");
|
||||
this.effect = effects.get(this.effectID);
|
||||
this.effect2 = effects.get(this.effectID2);
|
||||
this.effectParent = effects.get(this.IDString);
|
||||
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public String getEffectID2() {
|
||||
return this.effectID2;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect2() {
|
||||
return this.effect2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
protected void _applyEffectForItem(Item item, int trains) {
|
||||
if (item == null || this.effect == null)
|
||||
return;
|
||||
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
|
||||
if (this.effect2 != null)
|
||||
item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains,false);
|
||||
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
|
||||
}
|
||||
protected void _applyBakedInStatsForItem(Item item, int trains) {
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (this.effect == null){
|
||||
Logger.error( "Unknown Token: EffectBase ID " + this.effectID + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.effect2 == null){
|
||||
Logger.error( "Unknown Token: EffectBase ID " + this.effectID2 + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.effectParent == null){
|
||||
Logger.error( "Unknown Token: EffectBase ID " + this.IDString + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
|
||||
Effect eff2 = item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains,false);
|
||||
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
|
||||
|
||||
if (eff != null && eff2 != null && eff3 != null){
|
||||
eff3.setBakedInStat(true);
|
||||
item.getEffectNames().add(this.effect.getIDString());
|
||||
item.getEffectNames().add(this.effect2.getIDString());
|
||||
item.getEffectNames().add(this.effectParent.getIDString());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
}
|
||||
|
||||
public String getIDString() {
|
||||
return IDString;
|
||||
}
|
||||
|
||||
public void setIDString(String iDString) {
|
||||
IDString = iDString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class BlockPowerAction extends AbstractPowerAction {
|
||||
|
||||
public BlockPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class CharmPowerAction extends AbstractPowerAction {
|
||||
|
||||
private int levelCap;
|
||||
private int levelCapRamp;
|
||||
|
||||
public CharmPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
this.levelCap = rs.getInt("levelCap");
|
||||
this.levelCapRamp = rs.getInt("levelCapRamp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) source;
|
||||
ClientConnection origin = owner.getClientConnection();
|
||||
|
||||
if (origin == null)
|
||||
return;
|
||||
|
||||
//verify is mob, not pet or guard
|
||||
Mob mob = (Mob) awo;
|
||||
if (!mob.isMob())
|
||||
return;
|
||||
|
||||
//make sure mob isn't too high level
|
||||
int cap = this.levelCap + (this.levelCapRamp * trains);
|
||||
if (mob.getLevel() > cap && pb.getToken() != 1577464266)
|
||||
return;
|
||||
|
||||
//turn mob into pet.
|
||||
owner.commandSiegeMinion(mob);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class ClaimMinePowerAction extends AbstractPowerAction {
|
||||
|
||||
public ClaimMinePowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (source == null || awo == null)
|
||||
return;
|
||||
|
||||
if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
if (!(awo.getObjectType().equals(Enum.GameObjectType.Building)))
|
||||
return;
|
||||
|
||||
Building b = (Building)awo;
|
||||
|
||||
if (b.getRank() > 0)
|
||||
return;
|
||||
|
||||
Mine m = Mine.getMineFromTower(b.getObjectUUID());
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
m.claimMine((PlayerCharacter) source);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.ai.MobileFSM.STATE;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class ClearAggroPowerAction extends AbstractPowerAction {
|
||||
|
||||
public ClearAggroPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
|
||||
((Mob)awo).setNoAggro(true);
|
||||
((Mob)awo).setState(STATE.Patrol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.ai.MobileFSM.STATE;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class ClearNearbyAggroPowerAction extends AbstractPowerAction {
|
||||
|
||||
public ClearNearbyAggroPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (source.getObjectType() == GameObjectType.Mob){
|
||||
((Mob)source).setState(STATE.Patrol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class ConfusionPowerAction extends AbstractPowerAction {
|
||||
|
||||
public ConfusionPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.ai.MobileFSM.STATE;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
|
||||
private int mobID;
|
||||
private int mobLevel;
|
||||
|
||||
public CreateMobPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.mobID = rs.getInt("mobID");
|
||||
this.mobLevel = rs.getInt("mobLevel");
|
||||
}
|
||||
|
||||
public int getMobID() {
|
||||
return this.mobID;
|
||||
}
|
||||
|
||||
public int getMobLevel() {
|
||||
return this.mobLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) source;
|
||||
Mob currentPet = owner.getPet();
|
||||
Zone seaFloor = ZoneManager.getSeaFloor();
|
||||
Guild guild = Guild.getErrantGuild();
|
||||
ClientConnection origin = owner.getClientConnection();
|
||||
|
||||
if (seaFloor == null || guild == null || origin == null)
|
||||
return;
|
||||
|
||||
MobBase mobbase = MobBase.getMobBase(mobID);
|
||||
|
||||
if (mobbase == null) {
|
||||
Logger.error("Attempt to summon pet with null mobbase: " + mobID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mobbase.isNecroPet() && owner.inSafeZone())
|
||||
return;
|
||||
|
||||
//create Pet
|
||||
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short)mobLevel);
|
||||
|
||||
|
||||
if(pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
|
||||
if(currentPet!= null && !currentPet.isNecroPet() && !currentPet.isSiege()) {
|
||||
DbManager.removeFromCache(currentPet);
|
||||
WorldGrid.RemoveWorldObject(currentPet);
|
||||
currentPet.setState(STATE.Disabled);
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
if (currentPet.getParentZone() != null)
|
||||
currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
||||
|
||||
currentPet.getPlayerAgroMap().clear();
|
||||
|
||||
try {
|
||||
currentPet.clearEffects();
|
||||
}catch(Exception e){
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
//currentPet.disableIntelligence();
|
||||
}else if (currentPet != null && currentPet.isSiege()){
|
||||
currentPet.setMob();
|
||||
currentPet.setOwner(null);
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
if (currentPet.isAlive())
|
||||
WorldGrid.updateObject(currentPet);
|
||||
}
|
||||
//remove 10th pet
|
||||
|
||||
|
||||
owner.spawnNecroPet(pet);
|
||||
|
||||
}
|
||||
else { //is not a necro pet
|
||||
if(currentPet != null) {
|
||||
if(!currentPet.isNecroPet() && !currentPet.isSiege()) {
|
||||
DbManager.removeFromCache(currentPet);
|
||||
currentPet.setCombatTarget(null);
|
||||
currentPet.setState(STATE.Disabled);
|
||||
|
||||
currentPet.setOwner(null);
|
||||
WorldGrid.RemoveWorldObject(currentPet);
|
||||
|
||||
currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
||||
currentPet.getPlayerAgroMap().clear();
|
||||
currentPet.clearEffects();
|
||||
//currentPet.disableIntelligence();
|
||||
}
|
||||
else {
|
||||
if (currentPet.isSiege()){
|
||||
currentPet.setMob();
|
||||
currentPet.setOwner(null);
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
if (currentPet.isAlive())
|
||||
WorldGrid.updateObject(currentPet);
|
||||
}
|
||||
|
||||
}
|
||||
PlayerCharacter.auditNecroPets(owner);
|
||||
PlayerCharacter.resetNecroPets(owner);
|
||||
}
|
||||
}
|
||||
/* if(owner.getPet() != null) {
|
||||
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
|
||||
//if not a necro pet, remove pet
|
||||
WorldGrid.removeWorldObject(owner.getPet());
|
||||
owner.getPet().disableIntelligence();
|
||||
Mob.removePet(owner.getPet().getUUID());
|
||||
owner.setPet(null);
|
||||
}
|
||||
else {
|
||||
//if it is a necro pet, add it to the line and set as mob
|
||||
owner.getPet().setMob();
|
||||
}
|
||||
}*/
|
||||
|
||||
// if (mobID == 12021 || mobID == 12022) //Necro Pets
|
||||
// pet.setPet(owner, true);
|
||||
owner.setPet(pet);
|
||||
PetMsg pm = new PetMsg(5, pet);
|
||||
Dispatch dispatch = Dispatch.borrow(owner, pm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.DamageOverTimeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class DamageOverTimePowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private int numIterations;
|
||||
private EffectsBase effect;
|
||||
|
||||
public DamageOverTimePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.numIterations = rs.getInt("numIterations");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public int getNumIterations() {
|
||||
return this.numIterations;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (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 = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
DamageOverTimeJob eff = new DamageOverTimeJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
||||
int tick = eff.getTickLength();
|
||||
if (duration > 0) {
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), eff.getTickLength(), eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, tick, eff, this.effect, trains);
|
||||
}
|
||||
|
||||
//start effect icon for client. Skip applying dot until first iteration.
|
||||
eff.setSkipApplyEffect(true);
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
eff.setSkipApplyEffect(false);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class DeferredPowerPowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private String deferedPowerID;
|
||||
private EffectsBase effect;
|
||||
// private EffectsBase deferedPower;
|
||||
|
||||
public DeferredPowerPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.deferedPowerID = rs.getString("deferredPowerID");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public String getDeferredPowerID() {
|
||||
return this.deferedPowerID;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (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
|
||||
|
||||
String stackType = ab.getStackType();
|
||||
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, 10000, eff, this.effect, trains);
|
||||
|
||||
switch (awo.getObjectType()){
|
||||
case PlayerCharacter:
|
||||
((PlayerCharacter)awo).setWeaponPower(eff);
|
||||
break;
|
||||
case Mob:
|
||||
((Mob)awo).setWeaponPower(eff);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.FinishEffectTimeJob;
|
||||
import engine.jobs.PersistentAoeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class DirectDamagePowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private EffectsBase effect;
|
||||
|
||||
public DirectDamagePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (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 = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
|
||||
eff.setSkipSendEffect(true);
|
||||
if (duration > 0) {
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, duration, eff, this.effect, trains);
|
||||
}
|
||||
|
||||
// //if chant, start cycle
|
||||
// if (pb.isChant() && targetLoc.x != 0f && targetLoc.z != 0f) {
|
||||
// PersistentAoeJob paoe = new PersistentAoeJob(source, stackType, trains, ab, pb, effect, eff, targetLoc);
|
||||
// source.addPersistantAoe(stackType, (int)(pb.getChantDuration() * 1000), paoe, effect, trains);
|
||||
// eff.setChant(true);
|
||||
// }
|
||||
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
String stackType = ab.getStackType();
|
||||
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, this.effect);
|
||||
if (targetLoc.x != 0f && targetLoc.z != 0f) {
|
||||
PersistentAoeJob paoe = new PersistentAoeJob(source,target, stackType, trains, ab, pb, effect, eff, targetLoc);
|
||||
source.addPersistantAoe(stackType, (int)(pb.getChantDuration() * 1000), paoe, effect, trains);
|
||||
eff.setChant(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.EndFearJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class FearPowerAction extends AbstractPowerAction {
|
||||
|
||||
private int levelCap;
|
||||
private int levelCapRamp;
|
||||
|
||||
public FearPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
this.levelCap = rs.getInt("levelCap");
|
||||
this.levelCapRamp = rs.getInt("levelCapRamp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) source;
|
||||
ClientConnection origin = owner.getClientConnection();
|
||||
if (origin == null)
|
||||
return;
|
||||
|
||||
//verify is mob, not pet or guard
|
||||
Mob mob = (Mob) awo;
|
||||
if (!mob.isMob())
|
||||
return;
|
||||
|
||||
//make sure mob isn't too high level
|
||||
int cap = this.levelCap + (this.levelCapRamp * trains);
|
||||
if (mob.getLevel() > cap || mob.getLevel() > 79)
|
||||
return;
|
||||
|
||||
//Apply fear to mob
|
||||
int duration = 10 + ((int)(trains * 0.5));
|
||||
String stackType = ab.getStackType();
|
||||
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
|
||||
((Mob)awo).setFearedObject(source);
|
||||
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.FinishEffectTimeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class InvisPowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private EffectsBase effect;
|
||||
|
||||
public InvisPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (this.effect == null || pb == null || ab == null) {
|
||||
//TODO log error here
|
||||
return;
|
||||
}
|
||||
|
||||
// if (this.effect.ignoreMod())
|
||||
// trains = 50; //set above see invis for safe mode and csr-invis
|
||||
|
||||
//add schedule job to end it if needed and add effect to pc
|
||||
int duration = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
|
||||
if (duration > 0) {
|
||||
if (stackType.equals("IgnoreStack"))
|
||||
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
|
||||
else
|
||||
awo.addEffect(stackType, duration, eff, this.effect, trains);
|
||||
}
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.ai.MobileFSM;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class MobRecallPowerAction extends AbstractPowerAction {
|
||||
|
||||
public MobRecallPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
|
||||
return;
|
||||
AbstractCharacter awoac = (AbstractCharacter)awo;
|
||||
|
||||
if (awo.getObjectType() != GameObjectType.Mob)
|
||||
return;
|
||||
|
||||
|
||||
MovementManager.translocate(awoac,awoac.getBindLoc(), null);
|
||||
if (awoac.getObjectType() == GameObjectType.Mob){
|
||||
MobileFSM.setAwake((Mob)awoac,true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.RunegateType;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Runegate;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class OpenGatePowerAction extends AbstractPowerAction {
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public OpenGatePowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
public OpenGatePowerAction(int uUID, String iDString, String type, boolean isAggressive, long validItemFlags) {
|
||||
super(uUID, iDString, type, isAggressive, validItemFlags);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
|
||||
if (awo.getObjectType().equals(GameObjectType.Building) == false)
|
||||
return;
|
||||
|
||||
Building targetBuilding = (Building) awo;
|
||||
Runegate runeGate;
|
||||
RunegateType runegateType;
|
||||
RunegateType portalType;
|
||||
int token;
|
||||
|
||||
// Sanity check.
|
||||
|
||||
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Building)) || pb == null)
|
||||
return;
|
||||
|
||||
// Make sure building has a blueprint
|
||||
|
||||
if (targetBuilding.getBlueprintUUID() == 0)
|
||||
return;
|
||||
|
||||
// Make sure building is actually a runegate.
|
||||
|
||||
if (targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.RUNEGATE)
|
||||
return;
|
||||
|
||||
// Which portal was opened?
|
||||
|
||||
token = pb.getToken();
|
||||
portalType = RunegateType.AIR;
|
||||
|
||||
switch (token) {
|
||||
case 428937084: //Death Gate
|
||||
portalType = RunegateType.OBLIV;
|
||||
break;
|
||||
|
||||
case 429756284: //Chaos Gate
|
||||
portalType = RunegateType.CHAOS;
|
||||
break;
|
||||
|
||||
case 429723516: //Khar Gate
|
||||
portalType = RunegateType.MERCHANT;
|
||||
break;
|
||||
|
||||
case 429559676: //Spirit Gate
|
||||
portalType = RunegateType.SPIRIT;
|
||||
break;
|
||||
|
||||
case 429592444: //Water Gate
|
||||
portalType = RunegateType.WATER;
|
||||
break;
|
||||
|
||||
case 429428604: //Fire Gate
|
||||
portalType = RunegateType.FIRE;
|
||||
break;
|
||||
|
||||
case 429526908: //Air Gate
|
||||
portalType = RunegateType.AIR;
|
||||
break;
|
||||
|
||||
case 429625212: //Earth Gate
|
||||
portalType = RunegateType.EARTH;
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
// Which runegate was clicked on?
|
||||
|
||||
runegateType = RunegateType.getGateTypeFromUUID(targetBuilding.getObjectUUID());
|
||||
runeGate = Runegate.getRunegates()[runegateType.ordinal()];
|
||||
|
||||
runeGate.activatePortal(portalType);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.LootWindowResponseMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
|
||||
public class PeekPowerAction extends AbstractPowerAction {
|
||||
|
||||
public PeekPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter pc = null;
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
pc = (PlayerCharacter) source;
|
||||
|
||||
AbstractCharacter target = null;
|
||||
if (AbstractWorldObject.IsAbstractCharacter(awo))
|
||||
target = (AbstractCharacter) awo;
|
||||
|
||||
//test probability of successful peek
|
||||
boolean peekSuccess = peekSuccess(source, awo);
|
||||
if (peekSuccess) {
|
||||
ChatManager.chatPeekSteal(pc, target, null, true, peekDetect(source, awo), -1);
|
||||
} else {
|
||||
ChatManager.chatPeekSteal(pc, target, null, false, false, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
LootWindowResponseMsg lwrm = null;
|
||||
|
||||
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
PlayerCharacter tar = (PlayerCharacter)awo;
|
||||
|
||||
if (!tar.isAlive())
|
||||
return;
|
||||
|
||||
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
|
||||
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
|
||||
|
||||
Mob tar = (Mob) awo;
|
||||
|
||||
if (!tar.isAlive())
|
||||
return;
|
||||
|
||||
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
|
||||
}
|
||||
if (lwrm == null)
|
||||
return;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(pc, lwrm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
}
|
||||
|
||||
protected static boolean peekSuccess(AbstractCharacter pc, AbstractWorldObject awo) {
|
||||
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
|
||||
return false;
|
||||
|
||||
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
|
||||
|
||||
if (!pc.getPowers().containsKey(429494332))
|
||||
return false;
|
||||
|
||||
CharacterPower cp = pc.getPowers().get(429494332);
|
||||
int trains = cp.getTotalTrains();
|
||||
|
||||
float chance = 30 + (trains * 1.5f) + levelDif;
|
||||
chance = (chance < 5f) ? 5f : chance;
|
||||
chance = (chance > 95f) ? 95f : chance;
|
||||
|
||||
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
|
||||
|
||||
return roll < chance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected static boolean peekDetect(AbstractCharacter pc, AbstractWorldObject awo) {
|
||||
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
|
||||
return false;
|
||||
|
||||
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
|
||||
|
||||
if (!pc.getPowers().containsKey(429494332))
|
||||
return false;
|
||||
|
||||
CharacterPower cp = pc.getPowers().get(429494332);
|
||||
int trains = cp.getTotalTrains();
|
||||
|
||||
// check if peek is detected
|
||||
float chance = 30 + (40-trains)*1.5f - levelDif;
|
||||
chance = (chance < 5f) ? 5f : chance;
|
||||
chance = (chance > 95f) ? 95f : chance;
|
||||
|
||||
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
|
||||
return roll < chance;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.ai.MobileFSM;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.PromptRecallMsg;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class RecallPowerAction extends AbstractPowerAction {
|
||||
|
||||
public RecallPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
|
||||
return;
|
||||
AbstractCharacter awoac = (AbstractCharacter)awo;
|
||||
|
||||
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
|
||||
if (pc.hasBoon())
|
||||
return;
|
||||
|
||||
ClientConnection cc = pc.getClientConnection();
|
||||
|
||||
if(source.getObjectUUID() != pc.getObjectUUID()) {
|
||||
pc.setTimeStampNow("PromptRecall");
|
||||
pc.setTimeStamp("LastRecallType",1); //recall to bind
|
||||
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
|
||||
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
} else {
|
||||
MovementManager.translocate(awoac, awoac.getBindLoc(), null);
|
||||
}
|
||||
} else {
|
||||
Vector3fImmutable bindloc = awoac.getBindLoc();
|
||||
if (bindloc.x == 0.0f || bindloc.y == 0.0f)
|
||||
awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ);
|
||||
awoac.teleport(awoac.getBindLoc());
|
||||
if (awoac.getObjectType() == GameObjectType.Mob){
|
||||
MobileFSM.setAwake((Mob)awoac,true);
|
||||
if (awoac.isAlive())
|
||||
WorldGrid.updateObject(awoac);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.EffectSourceType;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class RemoveEffectPowerAction extends AbstractPowerAction {
|
||||
|
||||
|
||||
public EffectSourceType sourceType;
|
||||
private boolean removeAll;
|
||||
|
||||
public RemoveEffectPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
String effectTypeToRemove = rs.getString("effectSourceToRemove").replace("-", "").trim();
|
||||
sourceType = EffectSourceType.GetEffectSourceType(effectTypeToRemove);
|
||||
int flags = rs.getInt("flags");
|
||||
this.removeAll = ((flags & 2) != 0) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (awo != null) {
|
||||
|
||||
|
||||
if (this.removeAll)
|
||||
awo.removeEffectBySource(this.sourceType, trains, true);
|
||||
else
|
||||
if (this.getIDString().equals("SNC-003A"))
|
||||
trains = 40;
|
||||
awo.removeEffectBySource(this.sourceType, trains, false);
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class ResurrectPowerAction extends AbstractPowerAction {
|
||||
|
||||
public ResurrectPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.RunegateType;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PromptRecallMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
import static engine.math.FastMath.sqrt;
|
||||
|
||||
public class RunegateTeleportPowerAction extends AbstractPowerAction {
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public RunegateTeleportPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(awo .getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
float dist = 9999999999f;
|
||||
Building rg = null;
|
||||
Vector3fImmutable rgLoc;
|
||||
|
||||
for (Runegate runegate: Runegate.getRunegates()) {
|
||||
|
||||
if ((runegate.getGateType() == RunegateType.OBLIV) ||
|
||||
(runegate.getGateType() == RunegateType.CHAOS))
|
||||
continue;
|
||||
|
||||
for (Runegate thisGate : Runegate.getRunegates()) {
|
||||
|
||||
rgLoc = thisGate.getGateType().getGateBuilding().getLoc();
|
||||
|
||||
float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc);
|
||||
|
||||
if (distanceToRunegateSquared < sqr(dist)) {
|
||||
dist = sqrt(distanceToRunegateSquared);
|
||||
rg = thisGate.getGateType().getGateBuilding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(source.getObjectUUID() != pc.getObjectUUID()) {
|
||||
pc.setTimeStampNow("PromptRecall");
|
||||
pc.setTimeStamp("LastRecallType",0); //recall to rg
|
||||
|
||||
if (rg != null) {
|
||||
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
|
||||
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (rg != null) {
|
||||
pc.teleport(rg.getLoc());
|
||||
pc.setSafeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.CharacterItemManager;
|
||||
import engine.objects.Item;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class SetItemFlagPowerAction extends AbstractPowerAction {
|
||||
|
||||
public SetItemFlagPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(awo .getObjectType().equals(Enum.GameObjectType.Item)))
|
||||
return;
|
||||
|
||||
Item item = (Item) awo;
|
||||
|
||||
if (item.containerType != Enum.ItemContainerType.INVENTORY)
|
||||
return; //Send an error here?
|
||||
|
||||
//until this is shown to do something else, just use it as item identify spell.
|
||||
item.setIsID(true);
|
||||
|
||||
if (!DbManager.ItemQueries.UPDATE_FLAGS(item))
|
||||
item.setIsID(false); //update failed, reset
|
||||
|
||||
//update inventory
|
||||
CharacterItemManager cim = source.getCharItemManager();
|
||||
if (cim != null)
|
||||
cim.updateInventory();
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class SimpleDamagePowerAction extends AbstractPowerAction {
|
||||
|
||||
private int simpleDamage;
|
||||
|
||||
public SimpleDamagePowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.simpleDamage = rs.getInt("simpleDamage");
|
||||
}
|
||||
|
||||
public int getSimpleDamage() {
|
||||
return this.simpleDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SpireDisablePowerAction extends AbstractPowerAction {
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public SpireDisablePowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (awo == null)
|
||||
return;
|
||||
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
PlayerCharacter pc = null;
|
||||
|
||||
if (source.getObjectType() == GameObjectType.PlayerCharacter)
|
||||
pc = (PlayerCharacter)source;
|
||||
else
|
||||
return;
|
||||
|
||||
if (awo.getObjectType() != GameObjectType.Building)
|
||||
return;
|
||||
|
||||
|
||||
//Check if Building is Spire.
|
||||
|
||||
Building spire = (Building)awo;
|
||||
|
||||
if ((spire.getBlueprintUUID() == 0) ||
|
||||
(spire.getBlueprint() != null && spire.getBlueprint().getBuildingGroup() != BuildingGroup.SPIRE)) {
|
||||
ChatManager.chatSystemError((PlayerCharacter)source, "This Building is not a spire.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!spire.isSpireIsActive())
|
||||
return;
|
||||
|
||||
spire.disableSpire(false);
|
||||
|
||||
if (trains > 20)
|
||||
trains = 20;
|
||||
|
||||
long duration = trains * 4500 + 30000;
|
||||
spire.setTimeStamp("DISABLED", System.currentTimeMillis() + duration);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LootMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
|
||||
|
||||
public class StealPowerAction extends AbstractPowerAction {
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public StealPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(awo.getObjectType().equals(Enum.GameObjectType.Item)))
|
||||
return;
|
||||
|
||||
PlayerCharacter sourcePlayer = (PlayerCharacter) source;
|
||||
|
||||
if (sourcePlayer.isSafeMode())
|
||||
return;
|
||||
|
||||
if (!sourcePlayer.isAlive())
|
||||
return;
|
||||
|
||||
//prevent stealing no steal mob loot
|
||||
if (awo instanceof MobLoot && ((MobLoot)awo).noSteal())
|
||||
return;
|
||||
|
||||
Item tar = (Item) awo;
|
||||
AbstractWorldObject owner = (AbstractWorldObject) tar.getOwner();
|
||||
|
||||
if (owner == null)
|
||||
return;
|
||||
|
||||
|
||||
AbstractCharacter ownerAC = null;
|
||||
if (AbstractWorldObject.IsAbstractCharacter(owner))
|
||||
ownerAC = (AbstractCharacter) owner;
|
||||
|
||||
if (ownerAC != null)
|
||||
if (ownerAC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
|
||||
return;
|
||||
|
||||
//only steal from players or mobs
|
||||
|
||||
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
PlayerCharacter ownerPC = (PlayerCharacter)owner;
|
||||
|
||||
if (ownerPC.isSafeMode() || sourcePlayer.inSafeZone() || ownerPC.inSafeZone())
|
||||
return;
|
||||
|
||||
if (ownerPC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
|
||||
return;
|
||||
|
||||
//dupe check, validate player has item
|
||||
if (!tar.validForInventory(ownerPC.getClientConnection(), ownerPC, ownerPC.getCharItemManager()))//pc.getCharItemManager()))
|
||||
return;
|
||||
|
||||
//mark thief and target as player aggressive
|
||||
sourcePlayer.setLastPlayerAttackTime();
|
||||
ownerPC.setLastPlayerAttackTime();
|
||||
|
||||
//Handle target attacking back if in combat and has no other target
|
||||
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
|
||||
|
||||
} else if (owner.getObjectType().equals(Enum.GameObjectType.Mob)) {
|
||||
sourcePlayer.setLastMobAttackTime(); //mark thief as mob aggressive
|
||||
} else
|
||||
return;
|
||||
|
||||
ClientConnection origin = sourcePlayer.getClientConnection();
|
||||
|
||||
if (origin == null)
|
||||
return;
|
||||
|
||||
int amount = getAmountToSteal(tar);
|
||||
|
||||
//test probability of steal success
|
||||
if (!stealSuccess(sourcePlayer, owner)) {
|
||||
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, false, false, -1);
|
||||
return;
|
||||
} else {
|
||||
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, true, false, amount);
|
||||
//TODO send steal failure success
|
||||
}
|
||||
|
||||
//attempt transfer item
|
||||
CharacterItemManager myCIM = sourcePlayer.getCharItemManager();
|
||||
CharacterItemManager ownerCIM = ((AbstractCharacter)owner).getCharItemManager();
|
||||
if (myCIM == null || ownerCIM == null)
|
||||
return;
|
||||
|
||||
if (tar.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
//stealing gold
|
||||
if (!myCIM.transferGoldToMyInventory((AbstractCharacter)owner, amount))
|
||||
return;
|
||||
} else {
|
||||
//stealing items
|
||||
if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null)
|
||||
return;
|
||||
}
|
||||
|
||||
//send loot message to person stealing.
|
||||
LootMsg lm = new LootMsg(source.getObjectType().ordinal(), source.getObjectUUID(), owner.getObjectType().ordinal(), owner.getObjectUUID(), tar);
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, lm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
//update thief's inventory
|
||||
if (sourcePlayer.getCharItemManager() != null)
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
|
||||
//update victims inventory
|
||||
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter ownerPC = (PlayerCharacter) owner;
|
||||
|
||||
if (ownerPC.getCharItemManager() != null)
|
||||
ownerPC.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
//TODO if victim is trading, cancel trade window for both people involved in trade
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
}
|
||||
|
||||
protected static boolean stealSuccess(PlayerCharacter pc, AbstractWorldObject awo) {
|
||||
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
|
||||
return false;
|
||||
|
||||
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
|
||||
|
||||
if (!pc.getPowers().containsKey(429396028))
|
||||
return false;
|
||||
|
||||
CharacterPower cp = pc.getPowers().get(429396028);
|
||||
int trains = cp.getTotalTrains();
|
||||
|
||||
float chance = 20 + (trains * 1.5f) + levelDif;
|
||||
chance = (chance < 5f) ? 5f : chance;
|
||||
chance = (chance > 85f) ? 85f : chance;
|
||||
|
||||
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
|
||||
|
||||
return roll < chance;
|
||||
|
||||
}
|
||||
|
||||
//called to get amount of gold to steal between 0 and max gold
|
||||
protected static int getAmountToSteal(Item i) {
|
||||
if (i.getItemBase() != null && i.getItemBase().getUUID() == 7) {
|
||||
int amount = i.getNumOfItems();
|
||||
if (amount < 1)
|
||||
return -1;
|
||||
int a = ThreadLocalRandom.current().nextInt(amount + 1);
|
||||
int b = ThreadLocalRandom.current().nextInt(amount + 1);
|
||||
int c = ThreadLocalRandom.current().nextInt(amount + 1);
|
||||
return (a + b + c) / 3;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.RecvSummonsRequestMsg;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SummonPowerAction extends AbstractPowerAction {
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public SummonPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab,
|
||||
PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter target = (PlayerCharacter) awo;
|
||||
|
||||
ClientConnection conn = SessionManager.getClientConnection(target);
|
||||
|
||||
if (conn == null)
|
||||
return;
|
||||
|
||||
// TODO get location of summoning player
|
||||
Zone zone = ZoneManager.findSmallestZone(source.getLoc());
|
||||
String location = "Somewhere";
|
||||
|
||||
if (zone != null)
|
||||
location = zone.getName();
|
||||
|
||||
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(source.getObjectType().ordinal(), source.getObjectUUID(), source.getFirstName(),
|
||||
location, false);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(target, rsrm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class TeleportPowerAction extends AbstractPowerAction {
|
||||
|
||||
private boolean ignoreNoTeleSpire;
|
||||
|
||||
public TeleportPowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
int flags = rs.getInt("flags");
|
||||
this.ignoreNoTeleSpire = ((flags & 32768) != 0) ? true : false;
|
||||
}
|
||||
|
||||
public boolean ignoreNoTeleSpire() {
|
||||
return this.ignoreNoTeleSpire;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(awo))
|
||||
return;
|
||||
|
||||
AbstractCharacter awoac = (AbstractCharacter) awo;
|
||||
|
||||
//verify targetLoc within range
|
||||
|
||||
if (awo.getLoc().distanceSquared2D(targetLoc) > MBServerStatics.MAX_TELEPORT_RANGE * MBServerStatics.MAX_TELEPORT_RANGE) {
|
||||
if (awo.equals(source))
|
||||
failTeleport(pb, awoac);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.getBonuses().getBool(ModType.BlockedPowerType, SourceType.TELEPORT))
|
||||
return;
|
||||
|
||||
City city = ZoneManager.getCityAtLocation(targetLoc);
|
||||
|
||||
// Intentionally fail if target location is not on
|
||||
// the actual city zone.
|
||||
if (city != null)
|
||||
if (city.isLocationOnCityZone(targetLoc) == false)
|
||||
city = null;
|
||||
|
||||
if (city != null){
|
||||
|
||||
for (String eff : city.getEffects().keySet()){
|
||||
|
||||
Effect spireEffect = city.getEffects().get(eff);
|
||||
|
||||
for (AbstractEffectModifier aem : spireEffect.getEffectModifiers()){
|
||||
|
||||
if (aem.getType().equals("TELEPORT") && !this.ignoreNoTeleSpire){
|
||||
if (awo.equals(source))
|
||||
failTeleport(pb, awoac);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO verify target loc is valid loc
|
||||
|
||||
Regions region = Regions.GetRegionForTeleport(targetLoc);
|
||||
|
||||
if (region != null && !region.isOutside())
|
||||
return;
|
||||
|
||||
MovementManager.translocate(awoac,targetLoc, region);
|
||||
}
|
||||
|
||||
private static void failTeleport(PowersBase pb, AbstractCharacter awo) {
|
||||
|
||||
if (pb == null || awo == null || (!(awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
|
||||
return;
|
||||
|
||||
//teleport failed. Reset teleport power
|
||||
PowersManager.finishRecycleTime(pb.getToken(), (PlayerCharacter) awo, true);
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// 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.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) == 1) ? true : false;
|
||||
this.trackCorpse = ((flags & 2048) == 1) ? 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 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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.TransferStatOTJob;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class TransferStatOTPowerAction extends TransferStatPowerAction {
|
||||
|
||||
private int numIterations;
|
||||
|
||||
public TransferStatOTPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs, effects);
|
||||
|
||||
this.numIterations = rs.getInt("numIterations");
|
||||
}
|
||||
|
||||
public int getNumIterations() {
|
||||
return this.numIterations;
|
||||
}
|
||||
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3f targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
this.__startAction(source, awo, trains, ab, pb);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void __startAction(AbstractCharacter source, AbstractWorldObject awo, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (this.effect == null || source == null || awo == null || ab == null || pb == null)
|
||||
return;
|
||||
|
||||
//add schedule job to end it if needed and add effect to pc
|
||||
int duration = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType;
|
||||
TransferStatOTJob eff = new TransferStatOTJob(source, awo, stackType, trains, ab, pb, this.effect, this);
|
||||
int tick = eff.getTickLength();
|
||||
|
||||
if (duration > 0)
|
||||
awo.addEffect(stackType, tick, eff, this.effect, trains);
|
||||
|
||||
//start effect icon for client. Skip applying dot until first iteration.
|
||||
eff.setSkipApplyEffect(true);
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
eff.setSkipApplyEffect(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DamageType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ModifyHealthKillMsg;
|
||||
import engine.net.client.msg.ModifyHealthMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.effectmodifiers.HealthEffectModifier;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class TransferStatPowerAction extends AbstractPowerAction {
|
||||
|
||||
protected String effectID;
|
||||
protected boolean transferFromHealth = false;
|
||||
protected boolean transferFromMana = false;
|
||||
protected boolean transferFromStamina = false;
|
||||
protected boolean transferToHealth = false;
|
||||
protected boolean transferToMana = false;
|
||||
protected boolean transferToStamina = false;
|
||||
protected float transferAmount;
|
||||
protected float transferRamp;
|
||||
protected boolean transferRampAdd;
|
||||
protected float transferEfficiency;
|
||||
protected float transferEfficiencyRamp;
|
||||
protected boolean transferEfficiencyRampAdd;
|
||||
protected boolean targetToCaster;
|
||||
protected DamageType damageType;
|
||||
protected EffectsBase effect;
|
||||
|
||||
public TransferStatPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
this.effectID = rs.getString("effectID");
|
||||
String st = rs.getString("transferFromType");
|
||||
if (st.equals("HEALTH"))
|
||||
this.transferFromHealth = true;
|
||||
else if (st.equals("MANA"))
|
||||
this.transferFromMana = true;
|
||||
else
|
||||
this.transferFromStamina = true;
|
||||
st = rs.getString("transferToType");
|
||||
if (st.equals("HEALTH"))
|
||||
this.transferToHealth = true;
|
||||
else if (st.equals("MANA"))
|
||||
this.transferToMana = true;
|
||||
else
|
||||
this.transferToStamina = true;
|
||||
this.transferAmount = rs.getFloat("transferAmount");
|
||||
this.transferRamp = rs.getFloat("transferRamp");
|
||||
this.transferEfficiency = rs.getFloat("transferEfficiency");
|
||||
this.transferEfficiencyRamp = rs.getFloat("transferEfficiencyRamp");
|
||||
int flags = rs.getInt("flags");
|
||||
this.transferRampAdd = ((flags & 4096) != 0) ? true : false;
|
||||
this.transferEfficiencyRampAdd = ((flags & 8192) != 0) ? true : false;
|
||||
this.targetToCaster = ((flags & 16384) != 0) ? true : false;
|
||||
this.effect = effects.get(this.effectID);
|
||||
try {
|
||||
String damageString = rs.getString("damageType");
|
||||
// Damage type can sometimes be null in the DB.
|
||||
|
||||
if (damageString.isEmpty() == false)
|
||||
this.damageType = DamageType.valueOf(damageString);
|
||||
} catch (Exception e) {
|
||||
this.damageType = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public boolean transferFromHealth() {
|
||||
return this.transferFromHealth;
|
||||
}
|
||||
|
||||
public boolean transferFromMana() {
|
||||
return this.transferFromMana;
|
||||
}
|
||||
|
||||
public boolean transferFromStamina() {
|
||||
return this.transferFromStamina;
|
||||
}
|
||||
|
||||
public boolean transferToHealth() {
|
||||
return this.transferToHealth;
|
||||
}
|
||||
|
||||
public boolean transferToMana() {
|
||||
return this.transferToMana;
|
||||
}
|
||||
|
||||
public boolean transferToStamina() {
|
||||
return this.transferToStamina;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
public float getTransferAmount(float trains) {
|
||||
// if (this.transferRampAdd)
|
||||
return this.transferAmount + (this.transferRamp * trains);
|
||||
// else
|
||||
// return this.transferAmount * (1 + (this.transferRamp * trains));
|
||||
}
|
||||
|
||||
public float getTransferEfficiency(float trains) {
|
||||
return this.transferEfficiency + (this.transferEfficiencyRamp * trains);
|
||||
}
|
||||
|
||||
public boolean targetToCaster() {
|
||||
return this.targetToCaster;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
this.__startAction(source, awo, trains, ab, pb);
|
||||
}
|
||||
|
||||
//Added for dependancy check on TransferStatOTPowerAction
|
||||
protected void __startAction(AbstractCharacter source, AbstractWorldObject awo, int trains, ActionsBase ab, PowersBase pb) {
|
||||
this.runAction(source, awo, trains, ab, pb);
|
||||
}
|
||||
|
||||
public void runAction(AbstractCharacter source, AbstractWorldObject awo, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (source == null || awo == null || ab == null || pb == null)
|
||||
return;
|
||||
|
||||
if (!source.isAlive() || !awo.isAlive())
|
||||
return;
|
||||
|
||||
AbstractWorldObject fromAwo;
|
||||
AbstractWorldObject toAwo;
|
||||
if (this.targetToCaster) {
|
||||
fromAwo = awo;
|
||||
toAwo = source;
|
||||
} else {
|
||||
fromAwo = source;
|
||||
toAwo = awo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(fromAwo) && AbstractWorldObject.IsAbstractCharacter(toAwo)) {
|
||||
AbstractCharacter from = (AbstractCharacter) fromAwo;
|
||||
AbstractCharacter to = (AbstractCharacter) toAwo;
|
||||
|
||||
//get amount to drain
|
||||
float fromAmount = getTransferAmount(trains);
|
||||
|
||||
//modify for resists if needed
|
||||
if (this.damageType != null) {
|
||||
Resists resists = from.getResists();
|
||||
if (resists != null)
|
||||
fromAmount = resists.getResistedDamage(to, from, this.damageType, fromAmount * -1, trains) * -1;
|
||||
}
|
||||
|
||||
float min = fromAmount;// * (getTransferEfficiency(trains) / 100);
|
||||
float max = min;
|
||||
float damage = 0f;
|
||||
|
||||
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) source;
|
||||
float focus;
|
||||
CharacterSkill skill = pc.getSkills().get(pb.getSkillName());
|
||||
if (skill == null)
|
||||
focus = CharacterSkill.getQuickMastery(pc, pb.getSkillName());
|
||||
else
|
||||
focus = skill.getModifiedAmount();
|
||||
|
||||
//TODO fix this formula later
|
||||
float intt = (pc.getStatIntCurrent() >= 1) ? (float)pc.getStatIntCurrent() : 1f;
|
||||
float spi = (pc.getStatSpiCurrent() >= 1) ? (float)pc.getStatSpiCurrent() : 1f;
|
||||
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
|
||||
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
|
||||
// min *= (0.62 + 0.0192 * pc.getStatSpiCurrent() + 0.00415 * pc.getStatIntCurrent() + 0.015 * focus) / 2;
|
||||
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus) / 2;
|
||||
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
|
||||
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
|
||||
|
||||
// get range between min and max
|
||||
float range = max - min;
|
||||
|
||||
//debug for spell damage and atr
|
||||
if (pc.getDebug(16)) {
|
||||
String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
|
||||
ChatManager.chatSystemInfo(pc, smsg);
|
||||
}
|
||||
|
||||
// Damage is calculated twice to average a more central point
|
||||
damage = ThreadLocalRandom.current().nextFloat() * range;
|
||||
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||
|
||||
// put it back between min and max
|
||||
damage += min;
|
||||
}
|
||||
|
||||
// Apply any power effect modifiers (such as stances)
|
||||
PlayerBonuses bonus = source.getBonuses();
|
||||
if (bonus != null)
|
||||
damage *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None));
|
||||
|
||||
//get amount to transfer
|
||||
fromAmount = damage;
|
||||
float toAmount = fromAmount * (getTransferEfficiency(trains) / 100);
|
||||
|
||||
//get max amount to transfer, don't give more then the target has
|
||||
float maxDrain;
|
||||
if (this.transferFromHealth)
|
||||
maxDrain = from.getCurrentHitpoints();
|
||||
else if (this.transferFromMana)
|
||||
maxDrain = from.getMana();
|
||||
else
|
||||
maxDrain = from.getStamina();
|
||||
if (toAmount > maxDrain)
|
||||
toAmount = maxDrain;
|
||||
|
||||
//prep messages for transfer
|
||||
int powerID = pb.getToken();
|
||||
int effectID = 496519310;
|
||||
String powerName = pb.getName();
|
||||
ModifyHealthMsg mhmTo;
|
||||
// ModifyHealthMsg mhmFrom;
|
||||
AbstractNetMsg mhmFrom = null;
|
||||
|
||||
//stop if target is immune to drains
|
||||
if ( from.getBonuses().getBool(ModType.ImmuneTo, SourceType.Drain)) {
|
||||
ModifyHealthMsg mhm = new ModifyHealthMsg(source, to, 0f, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
mhm.setUnknown03(5); //set target is immune
|
||||
DispatchMessage.sendToAllInRange(from, mhm);
|
||||
return;
|
||||
}
|
||||
|
||||
//apply transfer bonus
|
||||
if (this.transferToHealth) {
|
||||
to.modifyHealth(toAmount, source, false);
|
||||
mhmTo = new ModifyHealthMsg(source, to, toAmount, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
} else if (this.transferToMana) {
|
||||
to.modifyMana(toAmount, source);
|
||||
mhmTo = new ModifyHealthMsg(source, to, 0f, toAmount, 0f, powerID, powerName, trains, effectID);
|
||||
} else {
|
||||
to.modifyStamina(toAmount, source);
|
||||
mhmTo = new ModifyHealthMsg(source, to, 0f, 0f, toAmount, powerID, powerName, trains, effectID);
|
||||
}
|
||||
|
||||
//subtract transfer amount
|
||||
if (this.transferFromHealth) {
|
||||
float modFrom = from.modifyHealth(-fromAmount, source, false);
|
||||
float cur = from.getHealth();
|
||||
if (cur < 0 && modFrom != 0)
|
||||
mhmFrom = new ModifyHealthKillMsg(source, from, -fromAmount, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
else
|
||||
mhmFrom = new ModifyHealthMsg(source, from, -fromAmount, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
} else if (this.transferFromMana) {
|
||||
from.modifyMana(-fromAmount, source);
|
||||
mhmFrom = new ModifyHealthMsg(source, from, 0f, -fromAmount, 0f, powerID, powerName, trains, effectID);
|
||||
} else {
|
||||
from.modifyStamina(-fromAmount, source);
|
||||
mhmFrom = new ModifyHealthMsg(source, from, 0f, 0f, -fromAmount, powerID, powerName, trains, effectID);
|
||||
}
|
||||
|
||||
DispatchMessage.sendToAllInRange(to, mhmTo);
|
||||
DispatchMessage.sendToAllInRange(from, mhmFrom);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.jobs.FinishEffectTimeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class TransformPowerAction extends AbstractPowerAction {
|
||||
|
||||
private String effectID;
|
||||
private EffectsBase effect;
|
||||
|
||||
public TransformPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
|
||||
super(rs);
|
||||
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.effect = effects.get(this.effectID);
|
||||
}
|
||||
|
||||
public String getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
if (this.effect == null || pb == null || ab == null) {
|
||||
//TODO log error here
|
||||
return;
|
||||
}
|
||||
|
||||
int duration = ab.getDuration(trains);
|
||||
String stackType = ab.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType;
|
||||
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
|
||||
if (duration > 0)
|
||||
awo.addEffect(stackType, duration, eff, effect, trains);
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.poweractions;
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class TreeChokePowerAction extends AbstractPowerAction {
|
||||
|
||||
public TreeChokePowerAction(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user