Initial Repository Push

This commit is contained in:
2022-04-30 09:41:17 -04:00
parent d4eef9097a
commit bbfdde57a3
835 changed files with 168392 additions and 0 deletions
+152
View File
@@ -0,0 +1,152 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.objects.AbstractWorldObject;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
public abstract class AbstractEffectJob extends AbstractScheduleJob {
protected String stackType;
protected AbstractWorldObject target;
protected AbstractWorldObject source;
protected int trains;
protected ActionsBase action;
protected PowersBase power;
protected EffectsBase eb;
protected boolean skipSendEffect=false;
protected boolean skipApplyEffect=false;
protected boolean isChant=false;
protected boolean skipCancelEffect=false;
private boolean noOverwrite;
private int effectSourceType = 0;
private int effectSourceID = 0;
public AbstractEffectJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb) {
super();
this.source = source;
this.target = target;
this.stackType = stackType;
this.trains = trains;
this.action = action;
this.power = power;
this.eb = eb;
}
@Override
protected abstract void doJob();
@Override
protected abstract void _cancelJob();
public String getStackType() {
return this.stackType;
}
public AbstractWorldObject getTarget() {
return this.target;
}
public AbstractWorldObject getSource() {
return this.target;
}
public int getTrains() {
return this.trains;
}
public ActionsBase getAction() {
return this.action;
}
public PowersBase getPower() {
return this.power;
}
public int getPowerToken() {
if (this.power == null)
return 0;
return this.power.getToken();
}
public EffectsBase getEffect() {
return this.eb;
}
public boolean skipSendEffect() {
return this.skipSendEffect;
}
public void setSkipSendEffect(boolean value) {
this.skipSendEffect = value;
}
public boolean skipApplyEffect() {
return this.skipApplyEffect;
}
public void setSkipApplyEffect(boolean value) {
this.skipApplyEffect = value;
}
public boolean skipCancelEffect() {
return this.skipCancelEffect;
}
public void setSkipCancelEffect(boolean value) {
this.skipCancelEffect = value;
}
public boolean isChant() {
return this.isChant;
}
public void setChant(boolean value) {
this.isChant = value;
}
public void endEffect() {
if (this.eb == null)
return;
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
}
public void endEffectNoPower() {
if (this.eb == null)
return;
this.eb.endEffectNoPower(this.trains,this);
}
public boolean isNoOverwrite() {
return noOverwrite;
}
public void setNoOverwrite(boolean noOverwrite) {
this.noOverwrite = noOverwrite;
}
public int getEffectSourceType() {
return effectSourceType;
}
public void setEffectSourceType(int effectSourceType) {
this.effectSourceType = effectSourceType;
}
public int getEffectSourceID() {
return effectSourceID;
}
public void setEffectSourceID(int effectSourceID) {
this.effectSourceID = effectSourceID;
}
}
+76
View File
@@ -0,0 +1,76 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum;
import engine.Enum.ChatChannelType;
import engine.gameManager.DbManager;
import engine.job.AbstractScheduleJob;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.City;
import org.pmw.tinylog.Logger;
public class ActivateBaneJob extends AbstractScheduleJob {
private final int cityUUID;
public ActivateBaneJob(int cityUUID) {
super();
this.cityUUID = cityUUID;
}
@Override
protected void doJob() {
City city;
city = (City) DbManager.getObject(Enum.GameObjectType.City, cityUUID);
if (city == null)
return;
if (city.getBane() == null) {
Logger.info( "No bane found for " + city.getCityName());
return;
}
if (city.getBane().isErrant()) {
Logger.info("Removed errant bane on " + city.getCityName());
city.getBane().remove();
return;
}
if (city.getBane() == null)
return;
if (city.protectionEnforced == true)
city.protectionEnforced = false;
else {
Logger.info("Bane on " + city.getCityName() + " activated for unprotected city?");
return;
}
Logger.info("ActivateBaneJob", "Bane on " + city.getCityName() + " is now active");
ChatSystemMsg msg = new ChatSystemMsg(null, "[Bane Channel] The Banecircle placed by " + city.getBane().getOwner().getGuild().getName() + " is now active! Buildings are now vulnerable to damage!");
msg.setMessageType(4); // Error message
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(msg);
}
@Override
protected void _cancelJob() {
}
}
+39
View File
@@ -0,0 +1,39 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.CombatManager;
import engine.job.AbstractJob;
import engine.objects.AbstractCharacter;
public class AttackJob extends AbstractJob {
private final AbstractCharacter source;
private final int slot;
private final boolean success;
public AttackJob(AbstractCharacter source, int slot, boolean success) {
super();
this.source = source;
this.slot = slot;
this.success = success;
}
@Override
protected void doJob() {
CombatManager.doCombat(this.source, slot);
}
public boolean success() {
return this.success;
}
protected void _cancelJob() {
}
}
+47
View File
@@ -0,0 +1,47 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.objects.Bane;
import org.joda.time.DateTime;
public class BaneDefaultTimeJob extends AbstractScheduleJob {
private final Bane bane;
public BaneDefaultTimeJob(Bane bane) {
super();
this.bane = bane;
}
@Override
protected void doJob() {
//bane already set.
if (this.bane.getLiveDate() != null) {
return;
}
DateTime defaultTime = new DateTime(this.bane.getPlacementDate());
defaultTime = defaultTime.plusDays(2);
defaultTime = defaultTime.hourOfDay().setCopy(22);
defaultTime = defaultTime.minuteOfHour().setCopy(0);
defaultTime = defaultTime.secondOfMinute().setCopy(0);
this.bane.setLiveDate(defaultTime);
}
@Override
protected void _cancelJob() {
}
}
+126
View File
@@ -0,0 +1,126 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractJob;
import engine.job.JobScheduler;
import org.pmw.tinylog.Logger;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* A generic execution job which is an extension of {@link AbstractJob}.
* <p>
* Intended to be used with the {@link JobScheduler}, a BasicScheduledJob will
* hold a reference to an execution method.
*
* @author Burfo
**/
public class BasicScheduledJob extends AbstractJob {
private Method execution;
private Object referenceObject;
/**
* Generates a new BasicScheduledJob that executes a static method that has
* no parameters.
*
* @param methodName
* Name of the static method to execute, such as "myMethod"
*
* @param methodClass
* The class in which {@code methodName} exists
*/
public BasicScheduledJob(String methodName, Class methodClass) {
this(methodName, methodClass, null);
}
/**
* Generates a new BasicScheduledJob that executes an instance method that
* has no parameters.
*
* @param methodName
* Name of the instance method to execute, such as "myMethod"
*
* @param methodClass
* The class in which {@code methodName} exists
*
* @param referenceObject
* Instance of {@code methodClass} against which {@code
* methodName} should be executed
*/
@SuppressWarnings("unchecked")
public BasicScheduledJob(String methodName, Class methodClass, Object referenceObject) {
super();
Method method = null;
try {
method = methodClass.getMethod(methodName);
} catch (SecurityException e) {
Logger.error( e);
} catch (NoSuchMethodException e) {
Logger.error( e);
}
setData(method, null);
}
/**
* Generates a new BasicScheduledJob that executes a static method that has
* no parameters.
*
* @param executionMethod
* Reference to the static method to execute
*/
public BasicScheduledJob(Method executionMethod) {
this(executionMethod, null);
}
/**
* Generates a new BasicScheduledJob that executes an instance method that
* has no parameters.
*
* @param executionMethod
* Reference to the static method to execute
*
* @param referenceObject
* Instanciated object against which {@code executionMethod}
* should be executed
*/
public BasicScheduledJob(Method executionMethod, Object referenceObject) {
super();
setData(executionMethod, referenceObject);
}
private void setData(Method executionMethod, Object referenceObject) {
this.execution = executionMethod;
this.referenceObject = referenceObject;
if (execution == null) {
Logger.error("BasicScheduledJob instanciated with no execution method.");
}
}
@Override
protected void doJob() {
if (execution == null) {
Logger.error( "BasicScheduledJob executed with nothing to execute.");
return;
}
try {
execution.invoke(referenceObject);
} catch (IllegalArgumentException | IllegalAccessException e) {
Logger.error( "BasicScheduledJob execution failed. Method: " + execution.toString(), e);
} catch (InvocationTargetException e) {
Logger.error( "BasicScheduledJob execution failed. " + "Method: " + execution.toString(), e);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractJob;
import engine.objects.AbstractCharacter;
public class BonusCalcJob extends AbstractJob {
private final AbstractCharacter ac;
public BonusCalcJob(AbstractCharacter ac) {
super();
this.ac = ac;
}
@Override
protected void doJob() {
if (this.ac != null) {
this.ac.applyBonuses();
}
}
}
+28
View File
@@ -0,0 +1,28 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.SessionManager;
import engine.job.AbstractJob;
public class CSessionCleanupJob extends AbstractJob {
private final String secKey;
public CSessionCleanupJob(String key) {
super();
this.secKey = key;
}
@Override
protected void doJob() {
SessionManager.cSessionCleanup(secKey);
}
}
+42
View File
@@ -0,0 +1,42 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.MovementManager;
import engine.job.AbstractScheduleJob;
import engine.objects.AbstractCharacter;
public class ChangeAltitudeJob extends AbstractScheduleJob {
private final AbstractCharacter ac;
private final float targetAlt;
private final float startAlt;
public ChangeAltitudeJob(AbstractCharacter ac, float startAlt, float targetAlt) {
super();
this.ac = ac;
this.startAlt = startAlt;
this.targetAlt = targetAlt;
}
@Override
protected void doJob() {
if (this.ac != null)
MovementManager.finishChangeAltitude(ac, targetAlt);
}
@Override
protected void _cancelJob() {
}
public float getStartAlt() {
return startAlt;
}
}
+103
View File
@@ -0,0 +1,103 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.gameManager.PowersManager;
import engine.gameManager.SessionManager;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.objects.PlayerBonuses;
import engine.objects.PlayerCharacter;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import java.util.HashSet;
public class ChantJob extends AbstractEffectJob {
private final AbstractEffectJob aej;
private int iteration = 0;
public ChantJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, AbstractEffectJob aej) {
super(source, target, stackType, trains, action, power, eb);
this.aej = aej;
}
@Override
protected void doJob() {
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
return;
PlayerBonuses bonuses = null;
//if player isnt in game, do not run chant.
if (this.source.getObjectType().equals(GameObjectType.PlayerCharacter)){
if (SessionManager.getPlayerCharacterByID(this.source.getObjectUUID()) == null)
return;
}
if (AbstractWorldObject.IsAbstractCharacter(source))
bonuses = ((AbstractCharacter)source).getBonuses();
if (!this.source.isAlive()) {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source))
((AbstractCharacter)source).cancelLastChant();
} else if (bonuses != null && bonuses.getBool(ModType.Silenced, SourceType.None)) {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source))
((AbstractCharacter)source).cancelLastChant();
}
else if (AbstractWorldObject.IsAbstractCharacter(source) && ((AbstractCharacter)source).isSit()){
return;
}else if (this.iteration < this.power.getChantIterations() && AbstractWorldObject.IsAbstractCharacter(source)) {
this.skipSendEffect = true;
this.iteration++;
// *** Refactor holy wtf batman
String stackType = action.getStackType();
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
HashSet<AbstractWorldObject> awolist = null;
if (this.source instanceof PlayerCharacter)
awolist = PowersManager.getAllTargets(this.source, this.source.getLoc(), (PlayerCharacter)this.source, this.power);
else
awolist = new HashSet<>();
for (AbstractWorldObject awo : awolist) {
if (awo == null)
continue;
PowersManager.finishApplyPowerA((AbstractCharacter) this.source, awo, awo.getLoc(), this.power, this.trains, true);
}
if (AbstractWorldObject.IsAbstractCharacter(source))
//handle invul
if(power.getUUID() != 334)
((AbstractCharacter)this.source).setLastChant((int)(this.power.getChantDuration()) * 1000, this);
else
((AbstractCharacter)this.source).setLastChant((int)(this.power.getChantDuration()) * 1000, this);
} else {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source)) {
((AbstractCharacter)source).cancelLastChant();
}
}
}
@Override
protected void _cancelJob() {
}
}
+44
View File
@@ -0,0 +1,44 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.RunegateType;
import engine.job.AbstractScheduleJob;
import engine.objects.Building;
import engine.objects.Runegate;
import org.pmw.tinylog.Logger;
public class CloseGateJob extends AbstractScheduleJob {
private final Building building;
private final RunegateType portalType;
public CloseGateJob(Building building, RunegateType portalType) {
super();
this.building = building;
this.portalType = portalType;
}
@Override
protected void doJob() {
if (building == null) {
Logger.error("Rungate building was null");
return;
}
Runegate.getRunegates()[RunegateType.getGateTypeFromUUID(building.getObjectUUID()).ordinal()].deactivatePortal(portalType);
}
@Override
protected void _cancelJob() {
}
}
+92
View File
@@ -0,0 +1,92 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.GameObjectType;
import engine.gameManager.PowersManager;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.objects.Building;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.powers.poweractions.DamageOverTimePowerAction;
public class DamageOverTimeJob extends AbstractEffectJob {
private final DamageOverTimePowerAction dot;
private int iteration = 0;
private int liveCounter = 0;
public DamageOverTimeJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DamageOverTimePowerAction dot) {
super(source, target, stackType, trains, action, power, eb);
this.dot = dot;
if (this.target != null && AbstractWorldObject.IsAbstractCharacter(target))
this.liveCounter = ((AbstractCharacter)target).getLiveCounter();
this.iteration = action.getDurationInSeconds(trains) / this.dot.getNumIterations();
}
@Override
protected void doJob() {
if (this.target.getObjectType().equals(GameObjectType.Building)
&& ((Building)this.target).isVulnerable() == false) {
_cancelJob();
return;
}
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null)
return;
if (AbstractWorldObject.IsAbstractCharacter(target) && ((AbstractCharacter)this.target).getLiveCounter() != liveCounter){
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
if (!this.target.isAlive()){
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
this.iteration--;
if (this.iteration < 0){
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
this.skipSendEffect = true;
String stackType = action.getStackType();
if (stackType.equals("IgnoreStack"))
this.target.addEffect(Integer.toString(action.getUUID()), getTickLength(), this, this.eb, this.trains);
else
this.target.addEffect(stackType, getTickLength(), this, this.eb, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source))
eb.startEffect((AbstractCharacter)this.source, this.target, this.trains, this);
}
@Override
protected void _cancelJob() {
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
public int getIteration() {
return this.iteration;
}
public int getTickLength() {
return this.dot.getNumIterations() * 1000;
}
public int inc() {
this.iteration++;
return this.iteration;
}
}
+65
View File
@@ -0,0 +1,65 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.GameObjectType;
import engine.gameManager.DbManager;
import engine.job.AbstractScheduleJob;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.PlayerCharacter;
public class DatabaseUpdateJob extends AbstractScheduleJob {
private final AbstractGameObject ago;
private final String type;
public DatabaseUpdateJob(AbstractGameObject ago, String type) {
super();
this.ago = ago;
this.type = type;
}
@Override
protected void doJob() {
if (this.ago == null)
return;
ago.removeDatabaseJob(this.type, false);
if (ago.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) ago;
switch (this.type) {
case "Skills":
pc.updateSkillsAndPowersToDatabase();
break;
case "Stats":
DbManager.PlayerCharacterQueries.UPDATE_CHARACTER_STATS(pc);
break;
case "EXP":
DbManager.PlayerCharacterQueries.UPDATE_CHARACTER_EXPERIENCE(pc);
break;
}
}
else if (ago instanceof Building) {
Building b = (Building) ago;
if (this.type.equals("health"))
DbManager.BuildingQueries.UPDATE_BUILDING_HEALTH(b.getObjectUUID(), (int)(b.getHealth()));
}
}
@Override
protected void _cancelJob() {
}
}
+61
View File
@@ -0,0 +1,61 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.ChatManager;
import engine.job.AbstractScheduleJob;
import engine.objects.PlayerCharacter;
public class DebugTimerJob extends AbstractScheduleJob {
private final PlayerCharacter pc;
private final String command;
private final int commandNum;
private final int duration;
public DebugTimerJob(PlayerCharacter pc, String command, int commandNum, int duration) {
super();
this.pc = pc;
this.command = command;
this.commandNum = commandNum;
this.duration = duration;
}
@Override
protected void doJob() {
if (this.pc == null) {
return;
}
String text;
switch (this.commandNum) {
case 1: //health
text = "Health: " + pc.getHealth();
ChatManager.chatSystemInfo(pc, text);
break;
case 2: //mana
text = "Mana: " + pc.getMana();
ChatManager.chatSystemInfo(pc, text);
break;
case 3: //stamina
text = "Stamina: " + pc.getStamina();
ChatManager.chatSystemInfo(pc, text);
break;
default:
}
//re-up the timer for this
this.pc.renewTimer(command, this, duration);
}
@Override
protected void _cancelJob() {
}
}
+109
View File
@@ -0,0 +1,109 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.CombatManager;
import engine.gameManager.PowersManager;
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 engine.powers.poweractions.ApplyEffectPowerAction;
import engine.powers.poweractions.DeferredPowerPowerAction;
public class DeferredPowerJob extends AbstractEffectJob {
private final DeferredPowerPowerAction def;
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, DeferredPowerPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = def;
}
public DeferredPowerJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, ApplyEffectPowerAction def) {
super(source, target, stackType, trains, action, power, eb);
this.def = null;
}
@Override
protected void doJob() {
//Power ended with no attack, cancel weapon power boost
if (this.source != null && this.source instanceof PlayerCharacter) {
((PlayerCharacter) this.source).setWeaponPower(null);
}
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
}
@Override
protected void _cancelJob() {
//Attack happened.
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
public void attack(AbstractWorldObject tar, float attackRange) {
if (this.source == null)
return;
if (!AbstractWorldObject.IsAbstractCharacter(tar))
return;
if (this.power == null)
return;
switch(this.source.getObjectType()){
case PlayerCharacter:
if (def == null) {
//No powers applied, just reset weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
return;
}
float powerRange = this.power.getWeaponRange();
// Wtf? Method returns TRUE if rage test fails? Seriously?
//DO valid range check ONLY for weapon powers with range less than attack range.
if (attackRange > powerRange)
if (CombatManager.NotInRange((AbstractCharacter)this.source, tar, powerRange))
return;
//Range check passed, apply power and clear weapon power.
((PlayerCharacter) this.source).setWeaponPower(null);
//weapon powers with no deferedpoweraction have null Def, but still have bonuses applied already and will finish here.
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
case Mob:
((Mob) this.source).setWeaponPower(null);
if (def == null) {
return;
}
PowersManager.applyPower((AbstractCharacter) this.source, tar, Vector3fImmutable.ZERO, def.getDeferredPowerID(), this.trains, false);
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
break;
}
}
}
+34
View File
@@ -0,0 +1,34 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.net.client.ClientConnection;
public class DisconnectJob extends AbstractScheduleJob {
private final ClientConnection origin;
public DisconnectJob(ClientConnection origin) {
super();
this.origin = origin;
}
@Override
protected void doJob() {
if (this.origin != null) {
this.origin.disconnect();
}
}
@Override
protected void _cancelJob() {
}
}
+63
View File
@@ -0,0 +1,63 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.DoorState;
import engine.job.AbstractScheduleJob;
import engine.net.DispatchMessage;
import engine.net.client.msg.DoorTryOpenMsg;
import engine.objects.Blueprint;
import engine.objects.Building;
public class DoorCloseJob extends AbstractScheduleJob {
Building building;
int door;
public DoorCloseJob(Building building, int door) {
super();
this.building = building;
this.door = door;
}
@Override
protected void doJob() {
int doorNumber;
if (this.building == null)
return;
doorNumber = Blueprint.getDoorNumberbyMesh(this.door);
this.building.setDoorState(doorNumber, DoorState.CLOSED);
DoorTryOpenMsg msg = new DoorTryOpenMsg(door, this.building.getObjectUUID(), 0, (byte) 0);
DispatchMessage.sendToAllInRange(building, msg);
}
@Override
protected void _cancelJob() {
}
}
+45
View File
@@ -0,0 +1,45 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.objects.AbstractWorldObject;
import engine.objects.Mob;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
public class EndFearJob extends AbstractEffectJob {
public EndFearJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb) {
super(source, target, stackType, trains, action, power, eb);
}
@Override
protected void doJob() {
//cancel fear for mob.
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).setFearedObject(null);
}
@Override
protected void _cancelJob() {
//cancel fear for mob.
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).setFearedObject(null);
}
}
@@ -0,0 +1,32 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.job.AbstractJob;
import engine.net.client.msg.PerformActionMsg;
import engine.objects.PlayerCharacter;
public class FinishCooldownTimeJob extends AbstractJob {
PlayerCharacter pc;
PerformActionMsg msg;
public FinishCooldownTimeJob(PlayerCharacter pc, PerformActionMsg msg) {
super();
this.pc = pc;
this.msg = msg;
}
@Override
protected void doJob() {
PowersManager.finishCooldownTime(this.msg, this.pc);
}
}
+33
View File
@@ -0,0 +1,33 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.objects.AbstractWorldObject;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
public class FinishEffectTimeJob extends AbstractEffectJob {
public FinishEffectTimeJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb) {
super(source, target, stackType, trains, action, power, eb);
}
@Override
protected void doJob() {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
}
@Override
protected void _cancelJob() {
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
}
+36
View File
@@ -0,0 +1,36 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.job.AbstractScheduleJob;
import engine.net.client.msg.PerformActionMsg;
import engine.objects.PlayerCharacter;
public class FinishRecycleTimeJob extends AbstractScheduleJob {
PlayerCharacter pc;
PerformActionMsg msg;
public FinishRecycleTimeJob(PlayerCharacter pc, PerformActionMsg msg) {
super();
this.pc = pc;
this.msg = msg;
}
@Override
protected void doJob() {
PowersManager.finishRecycleTime(this.msg, this.pc, false);
}
@Override
protected void _cancelJob() {
}
}
+37
View File
@@ -0,0 +1,37 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.objects.AbstractWorldObject;
import engine.objects.PlayerCharacter;
import engine.powers.EffectsBase;
public class FinishSpireEffectJob extends AbstractEffectJob {
public FinishSpireEffectJob(AbstractWorldObject target, String stackType, EffectsBase eb, int trains) {
super(null, target, stackType, trains, null, null, eb);
}
@Override
protected void doJob() {
PlayerCharacter pc = (PlayerCharacter) target;
if (pc == null)
return;
pc.endEffectNoPower(Integer.toString(eb.getUUID()));
}
@Override
protected void _cancelJob() {
}
}
+81
View File
@@ -0,0 +1,81 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.gameManager.PowersManager;
import engine.job.AbstractScheduleJob;
import engine.job.JobContainer;
import engine.net.client.msg.ErrorPopupMsg;
import engine.objects.PlayerCharacter;
import java.util.concurrent.ConcurrentHashMap;
public class FinishSummonsJob extends AbstractScheduleJob {
PlayerCharacter source;
PlayerCharacter target;
public FinishSummonsJob(PlayerCharacter source, PlayerCharacter target) {
super();
this.source = source;
this.target = target;
}
@Override
protected void doJob() {
if (this.target == null)
return;
//clear summon timer
ConcurrentHashMap<String, JobContainer> timers = this.target.getTimers();
if (timers != null && timers.containsKey("Summon"))
timers.remove("Summon");
if (this.source == null || !this.source.isAlive() || !this.target.isAlive())
return;
// cannot summon a player in combat
if (this.target.isCombat()) {
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
PowersManager.finishRecycleTime(428523680, this.source, false);
return;
}
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)){
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
ErrorPopupMsg.sendErrorMsg(this.source, "Target is blocked from receiving summons!");
return;
}
if (this.source.getRegion() != null)
this.target.setRegion(this.source.getRegion());
//teleport target to source
target.teleport(source.getLoc());
}
@Override
protected void _cancelJob() {
}
public PlayerCharacter getSource() {
return this.source;
}
public PlayerCharacter getTarget() {
return this.target;
}
}
+40
View File
@@ -0,0 +1,40 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.MovementManager;
import engine.job.AbstractScheduleJob;
import engine.net.client.msg.ChangeAltitudeMsg;
import engine.objects.PlayerCharacter;
public class FlightJob extends AbstractScheduleJob {
private final PlayerCharacter pc;
private final ChangeAltitudeMsg msg;
private final int duration;
public FlightJob(PlayerCharacter pc, ChangeAltitudeMsg msg, int duration) {
super();
this.msg = msg;
this.duration = duration;
this.pc = pc;
}
@Override
protected void doJob() {
if (this.pc != null && this.msg != null)
MovementManager.updateFlight(pc, msg, duration);
}
@Override
protected void _cancelJob() {
}
}
+48
View File
@@ -0,0 +1,48 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractJob;
import engine.net.client.ClientConnection;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import java.util.ArrayList;
public class LoadEffectsJob extends AbstractJob {
ArrayList<AbstractWorldObject> acsToLoad;
ClientConnection originToSend;
public LoadEffectsJob(ArrayList<AbstractWorldObject> acsToLoad, ClientConnection origin) {
this.acsToLoad = acsToLoad;
this.originToSend = origin;
}
@Override
protected void doJob() {
if (this.originToSend == null) {
return;
}
for (AbstractWorldObject awo : this.acsToLoad) {
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter acToLoad = (AbstractCharacter) awo;
acToLoad.sendAllEffects(this.originToSend);
}
}
}
}
+37
View File
@@ -0,0 +1,37 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.objects.PlayerCharacter;
import engine.server.world.WorldServer;
public class LogoutCharacterJob extends AbstractScheduleJob {
private final PlayerCharacter pc;
private final WorldServer server;
public LogoutCharacterJob(PlayerCharacter pc, WorldServer server) {
super();
this.pc = pc;
this.server = server;
}
@Override
protected void doJob() {
server.logoutCharacter(this.pc);
}
@Override
protected void _cancelJob() {
// TODO Auto-generated method stub
}
}
+71
View File
@@ -0,0 +1,71 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractJob;
import engine.objects.Mine;
import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
import java.util.ArrayList;
public class MineActiveJob extends AbstractJob {
public MineActiveJob() {
super();
}
@Override
protected void doJob() {
ArrayList<Mine> mines = Mine.getMines();
LocalDateTime now = LocalDateTime.now();
for (Mine mine : mines) {
try {
if (mine.getOwningGuild() == null){
mine.handleStartMineWindow();
Mine.setLastChange(System.currentTimeMillis());
continue;
}
//handle claimed mines
LocalDateTime mineWindow = mine.openDate.withMinute(0).withSecond(0).withNano(0);
if (mineWindow != null && now.plusMinutes(1).isAfter(mineWindow))
if (!mine.getIsActive()) {
Logger.info("activating mine. " + mineWindow.getHour() + " , " + now.getHour());
mine.handleStartMineWindow();
Mine.setLastChange(System.currentTimeMillis());
}else{
if (mine.handleEndMineWindow()){
Logger.info("Deactivating mine. " + mineWindow.getHour() + " , " + now.getHour());
Mine.setLastChange(System.currentTimeMillis());
}
}
}catch (Exception e) {
Logger.error( "mineID: " + mine.getObjectUUID() + e);
}
}
}
}
+28
View File
@@ -0,0 +1,28 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.objects.AbstractWorldObject;
import engine.powers.EffectsBase;
public class NoTimeJob extends AbstractEffectJob {
public NoTimeJob(AbstractWorldObject target, String stackType, EffectsBase eb, int trains) {
super(null, target, stackType, trains, null, null, eb);
}
@Override
protected void doJob() {
}
@Override
protected void _cancelJob() {
}
}
+110
View File
@@ -0,0 +1,110 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.GameObjectType;
import engine.gameManager.PowersManager;
import engine.math.Vector3fImmutable;
import engine.net.client.msg.PerformActionMsg;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.objects.PlayerCharacter;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import java.util.HashSet;
public class PersistentAoeJob extends AbstractEffectJob {
private final AbstractEffectJob aej;
private int iteration = 0;
private Vector3fImmutable targetLoc;
private Vector3fImmutable lastLoc;
public PersistentAoeJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, AbstractEffectJob aej, Vector3fImmutable targetLoc) {
super(source, target, stackType, trains, action, power, eb);
this.aej = aej;
if (target != null && this.target.getObjectType() == GameObjectType.PlayerCharacter)
this.targetLoc = this.target.getLoc();
else
this.targetLoc = targetLoc;
this.lastLoc = targetLoc;
}
@Override
protected void doJob() {
if (this.aej == null || this.source == null || this.action == null || this.power == null || this.source == null || this.eb == null)
return;
if (!this.source.isAlive())
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
else if (this.iteration < this.power.getChantIterations()) {
this.skipSendEffect = true;
this.iteration++;
if (this.target != null){
this.lastLoc = this.target.getLoc();
this.targetLoc = this.target.getLoc();
}
String stackType = action.getStackType();
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
HashSet<AbstractWorldObject> awolist = null;
if (this.source instanceof PlayerCharacter)
awolist = PowersManager.getAllTargets(null, this.targetLoc, (PlayerCharacter) this.source, this.power);
else
awolist = new HashSet<>();
PerformActionMsg msg = new PerformActionMsg(power.getToken(), 9999, source
.getObjectType().ordinal(), source.getObjectUUID(), source.getObjectType().ordinal(),
source.getObjectUUID(), 0, 0, 0, 2, 0);
for (AbstractWorldObject awo : awolist) {
//judge the defense of the target
if (awo == null
|| PowersManager.testAttack((PlayerCharacter) this.source, awo, this.power, msg))
continue;
PowersManager.finishApplyPowerA((AbstractCharacter) this.source, awo, this.targetLoc, this.power, this.trains, true);
if (this.target != null && !this.target.isAlive()){
this.target = null;
}
}
if (AbstractWorldObject.IsAbstractCharacter(source))
((AbstractCharacter) this.source).addPersistantAoe(stackType, (int) (this.power.getChantDuration() * 1000), this, this.eb, this.trains);
} else
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
}
@Override
protected void _cancelJob() {
}
public int getIteration() {
return this.iteration;
}
public int inc() {
this.iteration++;
return this.iteration;
}
}
+82
View File
@@ -0,0 +1,82 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.GroupManager;
import engine.job.AbstractJob;
import engine.net.client.ClientConnection;
import engine.objects.Group;
import engine.objects.PlayerCharacter;
public class RefreshGroupJob extends AbstractJob {
private final PlayerCharacter pc;
private ClientConnection origin;
private Group grp;
private PlayerCharacter pcToRefresh;
private final boolean wholeGroup;
public RefreshGroupJob(PlayerCharacter pc, PlayerCharacter pcToRefresh) {
super();
this.pc = pc;
if (pc != null) {
this.origin = pc.getClientConnection();
this.grp = GroupManager.getGroup(pc);
}
this.pcToRefresh = pcToRefresh;
this.wholeGroup = false;
}
public RefreshGroupJob(PlayerCharacter pc) {
super();
this.pc = pc;
if (pc != null) {
this.origin = pc.getClientConnection();
this.grp = GroupManager.getGroup(pc);
}
this.wholeGroup = true;
}
@Override
protected void doJob() {
if (this.pc == null || this.origin == null || grp == null) {
return;
}
if (wholeGroup) {
// refresh everyone in the group including me
// check that we are in the same group as when we submitted the job
if (GroupManager.getGroup(pc) != null && GroupManager.getGroup(pc) == grp) {
// refresh pc's group list for just the one player that needed refreshing
GroupManager.RefreshMyGroupList(pc, origin);
GroupManager.RefreshOthersGroupList(pc);
}
return;
}
// only refresh the single player
if (this.pcToRefresh == null)
return;
// check that we are in the same group as when we submitted the job
if (GroupManager.getGroup(pc) != null && GroupManager.getGroup(pc) == grp) {
// refresh pc's group list for just the one player that needed refreshing
GroupManager.RefreshMyGroupListSinglePlayer(pc, origin, pcToRefresh);
}
}
}
+35
View File
@@ -0,0 +1,35 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.objects.Corpse;
public class RemoveCorpseJob extends AbstractScheduleJob {
private final Corpse corpse;
public RemoveCorpseJob(Corpse corpse) {
super();
this.corpse = corpse;
}
@Override
protected void doJob() {
if (this.corpse != null)
Corpse.removeCorpse(corpse, true);
}
@Override
protected void _cancelJob() {
}
}
@@ -0,0 +1,78 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.objects.Building;
import engine.objects.City;
import org.pmw.tinylog.Logger;
public class SiegeSpireWithdrawlJob extends AbstractScheduleJob {
private Building spire = null;
public SiegeSpireWithdrawlJob(Building spire) {
super();
this.spire = spire;
}
@Override
protected void doJob() {
if (spire == null)
return;
// Early exit if someone disabled the spire
if (!spire.isSpireIsActive())
return;
City buildingCity = spire.getCity();
if (buildingCity == null)
return;
buildingCity.transactionLock.writeLock().lock();
try{
// If the spire runs out of money, disable it.
//*** Refactor: 5000 every 30 seconds? Wtf?
if (!spire.hasFunds(5000)){
spire.disableSpire(true);
return;
}
if (spire.getStrongboxValue() < 5000) {
spire.disableSpire(true);
return;
}
// Deduct the activation cost from the strongbox and resubmit the job
if (!spire.transferGold(-5000,false))
return;
JobContainer jc = JobScheduler.getInstance().scheduleJob(new SiegeSpireWithdrawlJob(spire), 300000);
spire.getTimers().put("SpireWithdrawl", jc);
}catch(Exception e){
Logger.error(e);
}finally{
buildingCity.transactionLock.writeLock().unlock();
}
}
@Override
protected void _cancelJob() {
}
}
+119
View File
@@ -0,0 +1,119 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.InterestManagement.WorldGrid;
import engine.job.AbstractScheduleJob;
import engine.math.Bounds;
import engine.math.Vector3fImmutable;
import engine.net.client.msg.ErrorPopupMsg;
import engine.objects.AbstractWorldObject;
import engine.objects.Building;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import java.util.HashSet;
public class StuckJob extends AbstractScheduleJob {
private final PlayerCharacter player;
public StuckJob(PlayerCharacter player) {
super();
this.player = player;
}
@Override
protected void doJob() {
Vector3fImmutable stuckLoc;
Building stuckBuilding = null;
if (player == null)
return;
if (player.getClientConnection() == null)
return;
HashSet<AbstractWorldObject>awoList = WorldGrid.getObjectsInRangePartial(player, 150, MBServerStatics.MASK_BUILDING);
for (AbstractWorldObject awo:awoList){
Building toStuckOutOf = (Building)awo;
if (toStuckOutOf.getStuckLocation() == null)
continue;
if (Bounds.collide(player.getLoc(), toStuckOutOf)){
stuckBuilding = toStuckOutOf;
break;
}
}
//Could not find closest building get stuck location of nearest building.
if (stuckBuilding == null){
ErrorPopupMsg.sendErrorMsg(player, "Unable to find desired location");
return;
} else
stuckLoc = stuckBuilding.getStuckLocation();
if (stuckLoc == null){
ErrorPopupMsg.sendErrorMsg(player, "Unable to find desired location");
return;
}
player.teleport(stuckLoc);
// Needs to be re-written with stuck locations
// Disabled for now.
/*
// Cannot have a null zone or player
if (this.player == null)
return;
if (ZoneManager.findSmallestZone(player.getLoc()) == null)
return;
// If player is on a citygrid make sure the stuck direction
// is facing away from the tree
if ((ZoneManager.findSmallestZone(player.getLoc()).isNPCCity()) ||
(ZoneManager.findSmallestZone(player.getLoc()).isPlayerCity())) {
zoneVector = player.getLoc().subtract(ZoneManager.findSmallestZone(player.getLoc()).getLoc());
zoneVector = zoneVector.normalize();
if (zoneVector.dot(player.getFaceDir()) > 0)
return;
}
player.teleport(player.getLoc().add(player.getFaceDir().mult(34)));
*/
}
@Override
protected void _cancelJob() {
}
private void sendTrackArrow(float rotation) {
}
}
+54
View File
@@ -0,0 +1,54 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.job.JobContainer;
import engine.objects.PlayerCharacter;
import java.util.concurrent.ConcurrentHashMap;
public class SummonSendJob extends AbstractScheduleJob {
PlayerCharacter source;
PlayerCharacter target;
public SummonSendJob(PlayerCharacter source, PlayerCharacter target) {
super();
this.source = source;
this.target = target;
}
@Override
protected void doJob() {
if (this.source == null)
return;
//clear summon send timer
ConcurrentHashMap<String, JobContainer> timers = this.source.getTimers();
if (timers != null && timers.containsKey("SummonSend"))
timers.remove("SummonSend");
}
@Override
protected void _cancelJob() {
}
public PlayerCharacter getSource() {
return this.source;
}
public PlayerCharacter getTarget() {
return this.target;
}
}
+65
View File
@@ -0,0 +1,65 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.math.Vector3fImmutable;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ErrorPopupMsg;
import engine.objects.NPC;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
public class TeleportJob extends AbstractScheduleJob {
private final ClientConnection origin;
private final NPC npc;
private final PlayerCharacter pc;
private final Vector3fImmutable loc;
private int oldLiveCounter;
private final boolean setSafeMode;
public TeleportJob(PlayerCharacter pc, NPC npc, Vector3fImmutable loc, ClientConnection origin, boolean setSafeMode) {
super();
this.pc = pc;
this.npc = npc;
this.loc = loc;
this.origin = origin;
this.setSafeMode = setSafeMode;
if (pc != null) {
this.oldLiveCounter = pc.getLiveCounter();
}
}
@Override
protected void doJob() {
if (this.pc == null || this.npc == null || this.origin == null)
return;
if (!pc.isAlive() || this.oldLiveCounter != pc.getLiveCounter())
return;
if (pc.getLoc().distanceSquared2D(npc.getLoc()) > MBServerStatics.NPC_TALK_RANGE * MBServerStatics.NPC_TALK_RANGE) {
ErrorPopupMsg.sendErrorPopup(pc, 114);
return;
}
pc.teleport(loc);
if (this.setSafeMode)
pc.setSafeMode();
}
@Override
protected void _cancelJob() {
}
}
+92
View File
@@ -0,0 +1,92 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum;
import engine.gameManager.PowersManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.msg.TrackArrowMsg;
import engine.objects.AbstractWorldObject;
import engine.objects.PlayerCharacter;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.powers.poweractions.TrackPowerAction;
import engine.server.MBServerStatics;
import static engine.math.FastMath.sqr;
public class TrackJob extends AbstractEffectJob {
private final TrackPowerAction tpa;
public TrackJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, TrackPowerAction tpa) {
super(source, target, stackType, trains, action, power, eb);
this.tpa = tpa;
}
@Override
protected void doJob() {
if (this.tpa == null || this.target == null || this.action == null || this.source == null || this.eb == null || !(this.source instanceof PlayerCharacter))
return;
if (this.target.isAlive() == false) {
sendTrackArrow(Float.intBitsToFloat(0x7E967699));
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
String stackType = action.getStackType();
float distanceSquared = this.target.getLoc().distanceSquared2D(this.source.getLoc());
int speed;
if (distanceSquared < sqr(MBServerStatics.TRACK_ARROW_FAST_RANGE))
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY_FAST;
else
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY;
this.source.addEffect(stackType, speed, this, this.eb, this.trains);
Vector3fImmutable dir = this.target.getLoc().subtract2D(this.source.getLoc());
dir = dir.normalize();
sendTrackArrow(dir.getRotation());
}
@Override
protected void _cancelJob() {
sendTrackArrow(Float.intBitsToFloat(0x7E967699));
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
private void sendTrackArrow(float rotation) {
if (this.source != null && this.source instanceof PlayerCharacter) {
PlayerCharacter pc = (PlayerCharacter) this.source;
if (pc == null)
return;
// We send track arrows over primary channel
TrackArrowMsg tam = new TrackArrowMsg(rotation);
Dispatch dispatch = Dispatch.borrow(pc, tam);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
}
}
}
+74
View File
@@ -0,0 +1,74 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.powers.poweractions.TransferStatOTPowerAction;
public class TransferStatOTJob extends AbstractEffectJob {
private final TransferStatOTPowerAction dot;
private int iteration = 0;
public TransferStatOTJob(AbstractWorldObject source, AbstractWorldObject target, String stackType, int trains, ActionsBase action, PowersBase power, EffectsBase eb, TransferStatOTPowerAction dot) {
super(source, target, stackType, trains, action, power, eb);
this.dot = dot;
this.iteration = action.getDurationInSeconds(trains) / this.dot.getNumIterations();
}
@Override
protected void doJob() {
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null || this.action == null || this.power == null)
return;
if (!this.target.isAlive()){
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
iteration--;
if (iteration < 0){
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
return;
}
this.skipSendEffect = true;
String stackType = action.getStackType();
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
this.target.addEffect(stackType, getTickLength(), this, this.eb, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source))
this.dot.runAction((AbstractCharacter)this.source, this.target, this.trains, this.action, this.power);
}
@Override
protected void _cancelJob() {
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
}
public int getIteration() {
return this.iteration;
}
public int getTickLength() {
return this.dot.getNumIterations() * 1000;
}
public int inc() {
this.iteration++;
return this.iteration;
}
}
+51
View File
@@ -0,0 +1,51 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.GroupManager;
import engine.job.AbstractScheduleJob;
import engine.job.JobScheduler;
import engine.objects.Group;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
public class UpdateGroupJob extends AbstractScheduleJob {
private final Group group;
public UpdateGroupJob(Group group) {
super();
this.group = group;
}
@Override
protected void doJob() {
if (this.group == null)
return;
PlayerCharacter lead = group.getGroupLead();
if (lead == null)
return;
try {
GroupManager.RefreshWholeGroupList(lead, lead.getClientConnection(), this.group);
} catch (Exception e) {
Logger.error( e);
}
JobScheduler.getInstance().scheduleJob(this, MBServerStatics.UPDATE_GROUP_RATE);
}
@Override
protected void _cancelJob() {
}
}
+55
View File
@@ -0,0 +1,55 @@
package engine.jobs;
import engine.job.AbstractScheduleJob;
import engine.objects.Building;
import org.pmw.tinylog.Logger;
/*
* This class handles upgrading of buildings, swapping the
* appropriate mesh according to the building's blueprint.
* @Author
*/
public class UpgradeBuildingJob extends AbstractScheduleJob {
private final Building rankingBuilding;
public UpgradeBuildingJob(Building building) {
super();
this.rankingBuilding = building;
}
@Override
protected void doJob() {
// Must have a building to rank!
if (rankingBuilding == null) {
Logger.error("Attempting to rank null building");
return;
}
// Make sure the building is currently set to upgrade
// (Duplicate job sanity check)
if (rankingBuilding.isRanking() == false)
return;
// SetCurrentRank also changes the mesh and maxhp
// accordingly for buildings with blueprints
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
// Reload the object
}
@Override
protected void _cancelJob() {
}
}
+64
View File
@@ -0,0 +1,64 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid;
import engine.job.AbstractScheduleJob;
import engine.objects.AbstractCharacter;
import engine.objects.Mob;
import engine.objects.NPC;
public class UpgradeNPCJob extends AbstractScheduleJob {
private final AbstractCharacter rankingAC;
boolean success;
public UpgradeNPCJob(AbstractCharacter ac) {
super();
this.rankingAC = ac;
}
@Override
protected void doJob() {
int newRank;
if (this.rankingAC.getObjectType() == GameObjectType.NPC){
if (this.rankingAC == null) //NPC could've been removed...
return;
newRank = (this.rankingAC.getRank() * 10) + 10;
((NPC)this.rankingAC).setRank(newRank);
((NPC)this.rankingAC).setUpgradeDateTime(null);
}else if (this.rankingAC.getObjectType() == GameObjectType.Mob){
if (this.rankingAC == null) //NPC could've been removed...
return;
newRank = (this.rankingAC.getRank() * 10) + 10;
((Mob)this.rankingAC).setRank(newRank);
Mob.setUpgradeDateTime((Mob)this.rankingAC, null);
WorldGrid.updateObject(this.rankingAC);
}
}
@Override
protected void _cancelJob() {
}
}
+57
View File
@@ -0,0 +1,57 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.job.AbstractScheduleJob;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter;
import engine.objects.AbstractWorldObject;
import engine.powers.PowersBase;
public class UseItemJob extends AbstractScheduleJob {
private final AbstractCharacter ac;
private final AbstractWorldObject target;
private final PowersBase pb;
private final int trains;
private final int liveCounter;
public UseItemJob(AbstractCharacter ac, AbstractWorldObject target, PowersBase pb, int trains, int liveCounter) {
super();
this.ac = ac;
this.target = target;
this.pb = pb;
this.trains = trains;
this.liveCounter = liveCounter;
}
@Override
protected void doJob() {
PowersManager.finishApplyPower(ac, target, Vector3fImmutable.ZERO, pb, trains, liveCounter);
}
@Override
protected void _cancelJob() {
this.ac.setItemCasting(false);
}
public PowersBase getPowersBase() {
return this.pb;
}
public int getTrains() {
return this.trains;
}
public AbstractWorldObject getTarget() {
return this.target;
}
}
+57
View File
@@ -0,0 +1,57 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.job.AbstractScheduleJob;
import engine.net.client.msg.PerformActionMsg;
import engine.objects.Mob;
import engine.powers.PowersBase;
public class UseMobPowerJob extends AbstractScheduleJob {
private final Mob caster;
private final PerformActionMsg msg;
private final int token;
private final PowersBase pb;
private final int casterLiveCounter;
private final int targetLiveCounter;
public UseMobPowerJob(Mob caster, PerformActionMsg msg, int token, PowersBase pb, int casterLiveCounter, int targetLiveCounter) {
super();
this.caster = caster;
this.msg = msg;
this.token = token;
this.pb = pb;
this.casterLiveCounter = casterLiveCounter;
this.targetLiveCounter = targetLiveCounter;
}
@Override
protected void doJob() {
PowersManager.finishUseMobPower(this.msg, this.caster, casterLiveCounter, targetLiveCounter);
}
@Override
protected void _cancelJob() {
}
public PowersBase getPowersBase() {
return this.pb;
}
public int getToken() {
return this.token;
}
public PerformActionMsg getMsg() {
return this.msg;
}
}
+59
View File
@@ -0,0 +1,59 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.jobs;
import engine.gameManager.PowersManager;
import engine.job.AbstractScheduleJob;
import engine.net.client.msg.PerformActionMsg;
import engine.objects.PlayerCharacter;
import engine.powers.PowersBase;
public class UsePowerJob extends AbstractScheduleJob {
private final PlayerCharacter pc;
private final PerformActionMsg msg;
private final int token;
private final PowersBase pb;
private final int casterLiveCounter;
private final int targetLiveCounter;
public UsePowerJob(PlayerCharacter pc, PerformActionMsg msg, int token, PowersBase pb, int casterLiveCounter, int targetLiveCounter) {
super();
this.pc = pc;
this.msg = msg;
this.token = token;
this.pb = pb;
this.casterLiveCounter = casterLiveCounter;
this.targetLiveCounter = targetLiveCounter;
}
@Override
protected void doJob() {
PowersManager.finishUsePower(this.msg, this.pc, casterLiveCounter, targetLiveCounter);
}
@Override
protected void _cancelJob() {
//cast stopped early, reset recycle timer
PowersManager.finishRecycleTime(this.msg, this.pc, true);
}
public PowersBase getPowersBase() {
return this.pb;
}
public int getToken() {
return this.token;
}
public PerformActionMsg getMsg() {
return this.msg;
}
}