Handler created for RecvSummonsMsg
This commit is contained in:
@@ -18,7 +18,10 @@ import engine.job.AbstractJob;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.*;
|
||||
import engine.jobs.AbstractEffectJob;
|
||||
import engine.jobs.FinishRecycleTimeJob;
|
||||
import engine.jobs.UseItemJob;
|
||||
import engine.jobs.UsePowerJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.Dispatch;
|
||||
@@ -1240,101 +1243,6 @@ public enum PowersManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void recvSummon(RecvSummonsMsg msg, ClientConnection origin) {
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
PlayerCharacter source = PlayerCharacter.getFromCache(msg.getSourceID());
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
long tooLate = pc.getSummoner(source.getObjectUUID());
|
||||
if (tooLate < System.currentTimeMillis()) {
|
||||
ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
|
||||
pc.removeSummoner(source.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pc.getBonuses() != null && pc.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "You have been blocked from receiving summons!");
|
||||
ErrorPopupMsg.sendErrorMsg(source, "Target is blocked from receiving summons!");
|
||||
pc.removeSummoner(source.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
pc.removeSummoner(source.getObjectUUID());
|
||||
|
||||
// Handle Accepting or Denying a summons.
|
||||
// set timer based on summon type.
|
||||
boolean wentThrough = false;
|
||||
if (msg.accepted())
|
||||
// summons accepted, let's move the player if within time
|
||||
if (source.isAlive()) {
|
||||
|
||||
// //make sure summons handled in time
|
||||
ConcurrentHashMap<String, JobContainer> timers = source.getTimers();
|
||||
// if (timers == null || !timers.containsKey("SummonSend")) {
|
||||
// ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // clear last summons accept timer
|
||||
// timers.get("SummonSend").cancelJob();
|
||||
//timers.remove("SummonSend");
|
||||
// cancel any other summons waiting
|
||||
timers = pc.getTimers();
|
||||
if (timers != null && timers.containsKey("Summon"))
|
||||
timers.get("Summon").cancelJob();
|
||||
|
||||
// get time to wait before summons goes through
|
||||
BaseClass base = source.baseClass;
|
||||
PromotionClass promo = source.getPromotionClass();
|
||||
int duration;
|
||||
|
||||
|
||||
//determine if in combat with another player
|
||||
|
||||
|
||||
//comment out this block to disable combat timer
|
||||
// if (lastAttacked < 60000) {
|
||||
// if (pc.inSafeZone()) //player in safe zone, no need for combat timer
|
||||
// combat = false;
|
||||
// else if (source.inSafeZone()) //summoner in safe zone, apply combat timer
|
||||
// combat = true;
|
||||
// else if ((source.getLoc().distance2D(pc.getLoc())) > 6144f)
|
||||
// combat = true; //more than 1.5x width of zone, not tactical summons
|
||||
// }
|
||||
|
||||
if (promo != null && promo.getObjectUUID() == 2519)
|
||||
duration = 10000; // Priest summons, 10 seconds
|
||||
else if (base != null && base.getObjectUUID() == 2501)
|
||||
duration = 15000; // Healer Summons, 15 seconds
|
||||
else
|
||||
duration = 45000; // Belgosh Summons, 45 seconds
|
||||
|
||||
|
||||
// Teleport to summoners location
|
||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(fsj,
|
||||
duration);
|
||||
if (timers != null)
|
||||
timers.put("Summon", jc);
|
||||
wentThrough = true;
|
||||
}
|
||||
|
||||
// Summons failed
|
||||
if (!wentThrough)
|
||||
// summons refused. Let's be nice and reset recycle timer
|
||||
if (source != null) {
|
||||
|
||||
// Send summons refused Message
|
||||
ErrorPopupMsg.sendErrorPopup(source, 29);
|
||||
|
||||
// recycle summons power
|
||||
//finishRecycleTime(428523680, source, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendRecyclePower(int token, ClientConnection origin) {
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user