Project cleanup pre merge.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
package engine.jobs;
|
||||
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
@@ -18,135 +18,137 @@ 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;
|
||||
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;
|
||||
}
|
||||
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();
|
||||
@Override
|
||||
protected abstract void doJob();
|
||||
|
||||
public String getStackType() {
|
||||
return this.stackType;
|
||||
}
|
||||
@Override
|
||||
protected abstract void _cancelJob();
|
||||
|
||||
public AbstractWorldObject getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
public String getStackType() {
|
||||
return this.stackType;
|
||||
}
|
||||
|
||||
public AbstractWorldObject getSource() {
|
||||
return this.target;
|
||||
}
|
||||
public AbstractWorldObject getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public int getTrains() {
|
||||
return this.trains;
|
||||
}
|
||||
public AbstractWorldObject getSource() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public ActionsBase getAction() {
|
||||
return this.action;
|
||||
}
|
||||
public int getTrains() {
|
||||
return this.trains;
|
||||
}
|
||||
|
||||
public PowersBase getPower() {
|
||||
return this.power;
|
||||
}
|
||||
public ActionsBase getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public int getPowerToken() {
|
||||
if (this.power == null)
|
||||
return 0;
|
||||
return this.power.getToken();
|
||||
}
|
||||
public PowersBase getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
public EffectsBase getEffect() {
|
||||
return this.eb;
|
||||
}
|
||||
public int getPowerToken() {
|
||||
if (this.power == null)
|
||||
return 0;
|
||||
return this.power.getToken();
|
||||
}
|
||||
|
||||
public boolean skipSendEffect() {
|
||||
return this.skipSendEffect;
|
||||
}
|
||||
public EffectsBase getEffect() {
|
||||
return this.eb;
|
||||
}
|
||||
|
||||
public void setSkipSendEffect(boolean value) {
|
||||
this.skipSendEffect = value;
|
||||
}
|
||||
public boolean skipSendEffect() {
|
||||
return this.skipSendEffect;
|
||||
}
|
||||
|
||||
public boolean skipApplyEffect() {
|
||||
return this.skipApplyEffect;
|
||||
}
|
||||
public void setSkipSendEffect(boolean value) {
|
||||
this.skipSendEffect = value;
|
||||
}
|
||||
|
||||
public void setSkipApplyEffect(boolean value) {
|
||||
this.skipApplyEffect = value;
|
||||
}
|
||||
public boolean skipApplyEffect() {
|
||||
return this.skipApplyEffect;
|
||||
}
|
||||
|
||||
public boolean skipCancelEffect() {
|
||||
return this.skipCancelEffect;
|
||||
}
|
||||
public void setSkipApplyEffect(boolean value) {
|
||||
this.skipApplyEffect = value;
|
||||
}
|
||||
|
||||
public void setSkipCancelEffect(boolean value) {
|
||||
this.skipCancelEffect = value;
|
||||
}
|
||||
public boolean skipCancelEffect() {
|
||||
return this.skipCancelEffect;
|
||||
}
|
||||
|
||||
public boolean isChant() {
|
||||
return this.isChant;
|
||||
}
|
||||
public void setSkipCancelEffect(boolean value) {
|
||||
this.skipCancelEffect = value;
|
||||
}
|
||||
|
||||
public void setChant(boolean value) {
|
||||
this.isChant = value;
|
||||
}
|
||||
public boolean isChant() {
|
||||
return this.isChant;
|
||||
}
|
||||
|
||||
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 setChant(boolean value) {
|
||||
this.isChant = value;
|
||||
}
|
||||
|
||||
public void setNoOverwrite(boolean noOverwrite) {
|
||||
this.noOverwrite = noOverwrite;
|
||||
}
|
||||
public void endEffect() {
|
||||
if (this.eb == null)
|
||||
return;
|
||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||
}
|
||||
|
||||
public int getEffectSourceType() {
|
||||
return effectSourceType;
|
||||
}
|
||||
public void endEffectNoPower() {
|
||||
if (this.eb == null)
|
||||
return;
|
||||
this.eb.endEffectNoPower(this.trains, this);
|
||||
}
|
||||
|
||||
public void setEffectSourceType(int effectSourceType) {
|
||||
this.effectSourceType = effectSourceType;
|
||||
}
|
||||
public boolean isNoOverwrite() {
|
||||
return noOverwrite;
|
||||
}
|
||||
|
||||
public int getEffectSourceID() {
|
||||
return effectSourceID;
|
||||
}
|
||||
public void setNoOverwrite(boolean noOverwrite) {
|
||||
this.noOverwrite = noOverwrite;
|
||||
}
|
||||
|
||||
public void setEffectSourceID(int effectSourceID) {
|
||||
this.effectSourceID = effectSourceID;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
|
||||
|
||||
if (city.getBane() == null) {
|
||||
Logger.info( "No bane found for " + city.getCityName());
|
||||
Logger.info("No bane found for " + city.getCityName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
package engine.jobs;
|
||||
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.job.AbstractJob;
|
||||
@@ -15,25 +15,26 @@ import engine.objects.AbstractCharacter;
|
||||
|
||||
public class AttackJob extends AbstractJob {
|
||||
|
||||
private final AbstractCharacter source;
|
||||
private final int slot;
|
||||
private final boolean success;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
CombatManager.doCombat(this.source, slot);
|
||||
}
|
||||
|
||||
public boolean success() {
|
||||
return this.success;
|
||||
}
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
public boolean success() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
}
|
||||
@@ -22,105 +22,93 @@ import java.lang.reflect.Method;
|
||||
* <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;
|
||||
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 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 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 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);
|
||||
}
|
||||
/**
|
||||
* 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.");
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
@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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BonusCalcJob extends AbstractJob {
|
||||
protected void doJob() {
|
||||
if (this.ac != null) {
|
||||
this.ac.applyBonuses();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,22 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
package engine.jobs;
|
||||
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.job.AbstractJob;
|
||||
|
||||
public class CSessionCleanupJob extends AbstractJob {
|
||||
|
||||
private final String secKey;
|
||||
private final String secKey;
|
||||
|
||||
public CSessionCleanupJob(String key) {
|
||||
super();
|
||||
this.secKey = key;
|
||||
}
|
||||
public CSessionCleanupJob(String key) {
|
||||
super();
|
||||
this.secKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
SessionManager.cSessionCleanup(secKey);
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
SessionManager.cSessionCleanup(secKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,77 +27,76 @@ import java.util.HashSet;
|
||||
|
||||
public class ChantJob extends AbstractEffectJob {
|
||||
|
||||
private final AbstractEffectJob aej;
|
||||
private int iteration = 0;
|
||||
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;
|
||||
}
|
||||
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++;
|
||||
@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;
|
||||
|
||||
// *** Refactor holy wtf batman
|
||||
//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++;
|
||||
|
||||
String stackType = action.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
|
||||
// *** Refactor holy wtf batman
|
||||
|
||||
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) {
|
||||
String stackType = action.getStackType();
|
||||
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(action.getUUID()) : stackType;
|
||||
|
||||
if (awo == null)
|
||||
continue;
|
||||
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) {
|
||||
|
||||
PowersManager.finishApplyPowerA((AbstractCharacter) this.source, awo, awo.getLoc(), this.power, this.trains, true);
|
||||
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() {
|
||||
}
|
||||
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() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
package engine.jobs;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.PortalType;
|
||||
@@ -15,32 +15,32 @@ 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 Enum.PortalType portalType;
|
||||
private final Building building;
|
||||
private final Enum.PortalType portalType;
|
||||
|
||||
public CloseGateJob(Building building, PortalType portalType) {
|
||||
public CloseGateJob(Building building, PortalType portalType) {
|
||||
|
||||
super();
|
||||
this.building = building;
|
||||
this.portalType = portalType;
|
||||
}
|
||||
super();
|
||||
this.building = building;
|
||||
this.portalType = portalType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
if (building == null) {
|
||||
Logger.error("Rungate building was null");
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
Runegate._runegates.get(building.getObjectUUID()).deactivatePortal(portalType);
|
||||
}
|
||||
if (building == null) {
|
||||
Logger.error("Rungate building was null");
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
Runegate._runegates.get(building.getObjectUUID()).deactivatePortal(portalType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,71 +22,71 @@ import engine.powers.poweractions.DamageOverTimePowerAction;
|
||||
|
||||
public class DamageOverTimeJob extends AbstractEffectJob {
|
||||
|
||||
private final DamageOverTimePowerAction dot;
|
||||
private int iteration = 0;
|
||||
private int liveCounter = 0;
|
||||
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);
|
||||
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();
|
||||
}
|
||||
this.dot = dot;
|
||||
if (this.target != null && AbstractWorldObject.IsAbstractCharacter(target))
|
||||
this.liveCounter = ((AbstractCharacter) target).getLiveCounter();
|
||||
|
||||
@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);
|
||||
}
|
||||
this.iteration = action.getDurationInSeconds(trains) / this.dot.getNumIterations();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.target.getObjectType().equals(GameObjectType.Building)
|
||||
&& ((Building) this.target).isVulnerable() == false) {
|
||||
_cancelJob();
|
||||
return;
|
||||
}
|
||||
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
|
||||
public int getTickLength() {
|
||||
return this.dot.getNumIterations() * 1000;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
package engine.jobs;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
@@ -18,48 +18,47 @@ import engine.objects.PlayerCharacter;
|
||||
|
||||
public class DatabaseUpdateJob extends AbstractScheduleJob {
|
||||
|
||||
private final AbstractGameObject ago;
|
||||
private final String type;
|
||||
private final AbstractGameObject ago;
|
||||
private final String type;
|
||||
|
||||
public DatabaseUpdateJob(AbstractGameObject ago, String type) {
|
||||
super();
|
||||
this.ago = ago;
|
||||
this.type = 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;
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.ago == null)
|
||||
return;
|
||||
ago.removeDatabaseJob(this.type, false);
|
||||
|
||||
}
|
||||
else if (ago instanceof Building) {
|
||||
Building b = (Building) ago;
|
||||
if (this.type.equals("health"))
|
||||
DbManager.BuildingQueries.UPDATE_BUILDING_HEALTH(b.getObjectUUID(), (int)(b.getHealth()));
|
||||
}
|
||||
if (ago.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
|
||||
}
|
||||
PlayerCharacter pc = (PlayerCharacter) ago;
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
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() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,86 +24,84 @@ import engine.powers.poweractions.DeferredPowerPowerAction;
|
||||
|
||||
public class DeferredPowerJob extends AbstractEffectJob {
|
||||
|
||||
private final DeferredPowerPowerAction def;
|
||||
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, 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;
|
||||
}
|
||||
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 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);
|
||||
}
|
||||
@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) {
|
||||
public void attack(AbstractWorldObject tar, float attackRange) {
|
||||
|
||||
if (this.source == null)
|
||||
return;
|
||||
if (this.source == null)
|
||||
return;
|
||||
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(tar))
|
||||
return;
|
||||
if (!AbstractWorldObject.IsAbstractCharacter(tar))
|
||||
return;
|
||||
|
||||
if (this.power == null)
|
||||
return;
|
||||
if (this.power == null)
|
||||
return;
|
||||
|
||||
|
||||
switch(this.source.getObjectType()){
|
||||
switch (this.source.getObjectType()) {
|
||||
|
||||
case PlayerCharacter:
|
||||
case PlayerCharacter:
|
||||
|
||||
if (def == null) {
|
||||
//No powers applied, just reset weapon power.
|
||||
((PlayerCharacter) this.source).setWeaponPower(null);
|
||||
return;
|
||||
}
|
||||
float powerRange = this.power.getWeaponRange();
|
||||
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?
|
||||
// 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;
|
||||
//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);
|
||||
//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.
|
||||
//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;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
@@ -19,7 +16,6 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.Enum.DoorState;
|
||||
@@ -48,10 +44,10 @@ public class DoorCloseJob extends AbstractScheduleJob {
|
||||
if (this.building == null)
|
||||
return;
|
||||
|
||||
doorNumber = Blueprint.getDoorNumberbyMesh(this.door);
|
||||
doorNumber = Blueprint.getDoorNumberbyMesh(this.door);
|
||||
|
||||
this.building.setDoorState(doorNumber, DoorState.CLOSED);
|
||||
|
||||
this.building.setDoorState(doorNumber, DoorState.CLOSED);
|
||||
|
||||
DoorTryOpenMsg msg = new DoorTryOpenMsg(door, this.building.getObjectUUID(), 0, (byte) 0);
|
||||
DispatchMessage.sendToAllInRange(building, msg);
|
||||
|
||||
|
||||
@@ -23,23 +23,23 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
|
||||
@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)))
|
||||
|
||||
if (this.target == null || (!(this.target instanceof Mob)))
|
||||
return;
|
||||
|
||||
|
||||
((Mob) this.target).setFearedObject(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ public class FinishSpireEffectJob extends AbstractEffectJob {
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
|
||||
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
|
||||
pc.endEffectNoPower(Integer.toString(eb.getUUID()));
|
||||
|
||||
}
|
||||
|
||||
@@ -21,61 +21,61 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class FinishSummonsJob extends AbstractScheduleJob {
|
||||
|
||||
PlayerCharacter source;
|
||||
PlayerCharacter target;
|
||||
PlayerCharacter source;
|
||||
PlayerCharacter target;
|
||||
|
||||
public FinishSummonsJob(PlayerCharacter source, PlayerCharacter target) {
|
||||
super();
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
public FinishSummonsJob(PlayerCharacter source, PlayerCharacter target) {
|
||||
super();
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
if (this.target == null)
|
||||
return;
|
||||
if (this.target == null)
|
||||
return;
|
||||
|
||||
//clear summon timer
|
||||
//clear summon timer
|
||||
|
||||
ConcurrentHashMap<String, JobContainer> timers = this.target.getTimers();
|
||||
ConcurrentHashMap<String, JobContainer> timers = this.target.getTimers();
|
||||
|
||||
if (timers != null && timers.containsKey("Summon"))
|
||||
timers.remove("Summon");
|
||||
if (timers != null && timers.containsKey("Summon"))
|
||||
timers.remove("Summon");
|
||||
|
||||
if (this.source == null || !this.source.isAlive() || !this.target.isAlive())
|
||||
return;
|
||||
if (this.source == null || !this.source.isAlive() || !this.target.isAlive())
|
||||
return;
|
||||
|
||||
// cannot summon a player in combat
|
||||
if (this.target.isCombat()) {
|
||||
// cannot summon a player in combat
|
||||
if (this.target.isCombat()) {
|
||||
|
||||
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||
|
||||
PowersManager.finishRecycleTime(428523680, this.source, false);
|
||||
return;
|
||||
}
|
||||
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.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.region != null)
|
||||
this.target.setRegion(this.source.region);
|
||||
//teleport target to source
|
||||
target.teleport(source.getLoc());
|
||||
}
|
||||
if (this.source.region != null)
|
||||
this.target.setRegion(this.source.region);
|
||||
//teleport target to source
|
||||
target.teleport(source.getLoc());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
|
||||
public PlayerCharacter getSource() {
|
||||
return this.source;
|
||||
}
|
||||
public PlayerCharacter getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
public PlayerCharacter getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
public PlayerCharacter getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,31 +18,31 @@ import java.util.ArrayList;
|
||||
|
||||
public class LoadEffectsJob extends AbstractJob {
|
||||
|
||||
ArrayList<AbstractWorldObject> acsToLoad;
|
||||
ClientConnection originToSend;
|
||||
ArrayList<AbstractWorldObject> acsToLoad;
|
||||
ClientConnection originToSend;
|
||||
|
||||
public LoadEffectsJob(ArrayList<AbstractWorldObject> acsToLoad, ClientConnection origin) {
|
||||
this.acsToLoad = acsToLoad;
|
||||
this.originToSend = origin;
|
||||
public LoadEffectsJob(ArrayList<AbstractWorldObject> acsToLoad, ClientConnection origin) {
|
||||
this.acsToLoad = acsToLoad;
|
||||
this.originToSend = origin;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.originToSend == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
protected void doJob() {
|
||||
if (this.originToSend == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractWorldObject awo : this.acsToLoad) {
|
||||
for (AbstractWorldObject awo : this.acsToLoad) {
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||
AbstractCharacter acToLoad = (AbstractCharacter) awo;
|
||||
acToLoad.sendAllEffects(this.originToSend);
|
||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||
AbstractCharacter acToLoad = (AbstractCharacter) awo;
|
||||
acToLoad.sendAllEffects(this.originToSend);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ public class LogoutCharacterJob extends AbstractScheduleJob {
|
||||
server.logoutCharacter(this.pc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,87 +24,86 @@ import java.util.HashSet;
|
||||
|
||||
public class PersistentAoeJob extends AbstractEffectJob {
|
||||
|
||||
private final AbstractEffectJob aej;
|
||||
private int iteration = 0;
|
||||
private Vector3fImmutable targetLoc;
|
||||
private Vector3fImmutable lastLoc;
|
||||
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;
|
||||
}
|
||||
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() {
|
||||
@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.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()) {
|
||||
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++;
|
||||
this.skipSendEffect = true;
|
||||
this.iteration++;
|
||||
|
||||
|
||||
if (this.target != null){
|
||||
this.lastLoc = this.target.getLoc();
|
||||
this.targetLoc = this.target.getLoc();
|
||||
}
|
||||
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;
|
||||
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);
|
||||
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) {
|
||||
for (AbstractWorldObject awo : awolist) {
|
||||
|
||||
//judge the defense of the target
|
||||
//judge the defense of the target
|
||||
|
||||
|
||||
if (awo == null
|
||||
|| PowersManager.testAttack((PlayerCharacter) this.source, awo, this.power, msg))
|
||||
continue;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
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() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ import engine.objects.PlayerCharacter;
|
||||
public class RefreshGroupJob extends AbstractJob {
|
||||
|
||||
private final PlayerCharacter pc;
|
||||
private final boolean wholeGroup;
|
||||
private ClientConnection origin;
|
||||
private Group grp;
|
||||
private PlayerCharacter pcToRefresh;
|
||||
private final boolean wholeGroup;
|
||||
|
||||
public RefreshGroupJob(PlayerCharacter pc, PlayerCharacter pcToRefresh) {
|
||||
super();
|
||||
@@ -52,21 +52,21 @@ public class RefreshGroupJob extends AbstractJob {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -23,10 +23,10 @@ public class RemoveCorpseJob extends AbstractScheduleJob {
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
|
||||
if (this.corpse != null)
|
||||
Corpse.removeCorpse(corpse, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,62 +17,61 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
public class SiegeSpireWithdrawlJob extends AbstractScheduleJob {
|
||||
|
||||
private Building spire = null;
|
||||
private Building spire = null;
|
||||
|
||||
public SiegeSpireWithdrawlJob(Building spire) {
|
||||
super();
|
||||
this.spire = spire;
|
||||
}
|
||||
public SiegeSpireWithdrawlJob(Building spire) {
|
||||
super();
|
||||
this.spire = spire;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
if (spire == null)
|
||||
return;
|
||||
if (spire == null)
|
||||
return;
|
||||
|
||||
// Early exit if someone disabled the spire
|
||||
// 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.isSpireIsActive())
|
||||
return;
|
||||
|
||||
if (!spire.hasFunds(5000)){
|
||||
spire.disableSpire(true);
|
||||
return;
|
||||
}
|
||||
if (spire.getStrongboxValue() < 5000) {
|
||||
spire.disableSpire(true);
|
||||
return;
|
||||
}
|
||||
City buildingCity = spire.getCity();
|
||||
|
||||
// Deduct the activation cost from the strongbox and resubmit the job
|
||||
if (buildingCity == null)
|
||||
return;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
buildingCity.transactionLock.writeLock().lock();
|
||||
try {
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
// 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() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@ public class SummonSendJob extends AbstractScheduleJob {
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
if (this.source == null)
|
||||
|
||||
if (this.source == null)
|
||||
return;
|
||||
|
||||
//clear summon send timer
|
||||
ConcurrentHashMap<String, JobContainer> timers = this.source.getTimers();
|
||||
|
||||
if (timers != null && timers.containsKey("SummonSend"))
|
||||
|
||||
if (timers != null && timers.containsKey("SummonSend"))
|
||||
timers.remove("SummonSend");
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class TeleportJob extends AbstractScheduleJob {
|
||||
private final NPC npc;
|
||||
private final PlayerCharacter pc;
|
||||
private final Vector3fImmutable loc;
|
||||
private int oldLiveCounter;
|
||||
private final boolean setSafeMode;
|
||||
private int oldLiveCounter;
|
||||
|
||||
public TeleportJob(PlayerCharacter pc, NPC npc, Vector3fImmutable loc, ClientConnection origin, boolean setSafeMode) {
|
||||
super();
|
||||
@@ -40,23 +40,23 @@ public class TeleportJob extends AbstractScheduleJob {
|
||||
|
||||
@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
|
||||
|
||||
@@ -36,33 +36,33 @@ public class TrackJob extends AbstractEffectJob {
|
||||
|
||||
@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) {
|
||||
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());
|
||||
String stackType = action.getStackType();
|
||||
|
||||
int speed;
|
||||
|
||||
if (distanceSquared < sqr(MBServerStatics.TRACK_ARROW_FAST_RANGE))
|
||||
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY_FAST;
|
||||
else
|
||||
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY;
|
||||
float distanceSquared = this.target.getLoc().distanceSquared2D(this.source.getLoc());
|
||||
|
||||
this.source.addEffect(stackType, speed, this, this.eb, this.trains);
|
||||
int speed;
|
||||
|
||||
Vector3fImmutable dir = this.target.getLoc().subtract2D(this.source.getLoc());
|
||||
dir = dir.normalize();
|
||||
if (distanceSquared < sqr(MBServerStatics.TRACK_ARROW_FAST_RANGE))
|
||||
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY_FAST;
|
||||
else
|
||||
speed = MBServerStatics.TRACK_ARROW_SENSITIVITY;
|
||||
|
||||
sendTrackArrow(dir.getRotation());
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TrackJob extends AbstractEffectJob {
|
||||
}
|
||||
|
||||
private void sendTrackArrow(float rotation) {
|
||||
|
||||
|
||||
if (this.source != null && this.source instanceof PlayerCharacter) {
|
||||
PlayerCharacter pc = (PlayerCharacter) this.source;
|
||||
|
||||
@@ -87,6 +87,6 @@ public class TrackJob extends AbstractEffectJob {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,56 +19,56 @@ import engine.powers.poweractions.TransferStatOTPowerAction;
|
||||
|
||||
public class TransferStatOTJob extends AbstractEffectJob {
|
||||
|
||||
private final TransferStatOTPowerAction dot;
|
||||
private int iteration = 0;
|
||||
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();
|
||||
}
|
||||
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 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
PowersManager.cancelEffectTime(this.source, this.target, this.power, this.eb, this.action, this.trains, this);
|
||||
}
|
||||
iteration--;
|
||||
|
||||
public int getIteration() {
|
||||
return this.iteration;
|
||||
}
|
||||
if (iteration < 0) {
|
||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||
return;
|
||||
}
|
||||
|
||||
public int getTickLength() {
|
||||
return this.dot.getNumIterations() * 1000;
|
||||
}
|
||||
this.skipSendEffect = true;
|
||||
|
||||
public int inc() {
|
||||
this.iteration++;
|
||||
return this.iteration;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,19 +27,19 @@ public class UpdateGroupJob extends AbstractScheduleJob {
|
||||
|
||||
@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);
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
JobScheduler.getInstance().scheduleJob(this, MBServerStatics.UPDATE_GROUP_RATE);
|
||||
|
||||
@@ -11,45 +11,43 @@ import org.pmw.tinylog.Logger;
|
||||
*/
|
||||
public class UpgradeBuildingJob extends AbstractScheduleJob {
|
||||
|
||||
private final Building rankingBuilding;
|
||||
private final Building rankingBuilding;
|
||||
|
||||
public UpgradeBuildingJob(Building building) {
|
||||
super();
|
||||
this.rankingBuilding = building;
|
||||
public UpgradeBuildingJob(Building building) {
|
||||
super();
|
||||
this.rankingBuilding = building;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
|
||||
// Must have a building to rank!
|
||||
|
||||
// Must have a building to rank!
|
||||
if (rankingBuilding == null) {
|
||||
Logger.error("Attempting to rank null building");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rankingBuilding == null) {
|
||||
Logger.error("Attempting to rank null building");
|
||||
return;
|
||||
}
|
||||
// Make sure the building is currently set to upgrade
|
||||
// (Duplicate job sanity check)
|
||||
|
||||
// Make sure the building is currently set to upgrade
|
||||
// (Duplicate job sanity check)
|
||||
if (rankingBuilding.isRanking() == false)
|
||||
return;
|
||||
|
||||
if (rankingBuilding.isRanking() == false)
|
||||
return;
|
||||
// SetCurrentRank also changes the mesh and maxhp
|
||||
// accordingly for buildings with blueprints
|
||||
|
||||
// SetCurrentRank also changes the mesh and maxhp
|
||||
// accordingly for buildings with blueprints
|
||||
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
|
||||
|
||||
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
|
||||
|
||||
// Reload the object
|
||||
// Reload the object
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,47 +18,45 @@ import engine.objects.NPC;
|
||||
|
||||
public class UpgradeNPCJob extends AbstractScheduleJob {
|
||||
|
||||
private final AbstractCharacter rankingAC;
|
||||
boolean success;
|
||||
private final AbstractCharacter rankingAC;
|
||||
boolean success;
|
||||
|
||||
public UpgradeNPCJob(AbstractCharacter ac) {
|
||||
super();
|
||||
this.rankingAC = ac;
|
||||
}
|
||||
public UpgradeNPCJob(AbstractCharacter ac) {
|
||||
super();
|
||||
this.rankingAC = ac;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doJob() {
|
||||
@Override
|
||||
protected void doJob() {
|
||||
|
||||
int newRank;
|
||||
int newRank;
|
||||
|
||||
if (this.rankingAC.getObjectType() == GameObjectType.NPC){
|
||||
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;
|
||||
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);
|
||||
|
||||
}
|
||||
((Mob) this.rankingAC).setRank(newRank);
|
||||
Mob.setUpgradeDateTime((Mob) this.rankingAC, null);
|
||||
WorldGrid.updateObject(this.rankingAC);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class UseItemJob extends AbstractScheduleJob {
|
||||
|
||||
@Override
|
||||
protected void _cancelJob() {
|
||||
this.ac.setItemCasting(false);
|
||||
this.ac.setItemCasting(false);
|
||||
}
|
||||
|
||||
public PowersBase getPowersBase() {
|
||||
|
||||
Reference in New Issue
Block a user