|
|
|
@ -207,7 +207,7 @@ public enum PowersManager {
@@ -207,7 +207,7 @@ public enum PowersManager {
|
|
|
|
|
origin); |
|
|
|
|
if (playerCharacter == null) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 1"); |
|
|
|
|
boolean CSRCast = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -220,7 +220,7 @@ public enum PowersManager {
@@ -220,7 +220,7 @@ public enum PowersManager {
|
|
|
|
|
+ Integer.toHexString(msg.getPowerUsedID()) + " (" |
|
|
|
|
+ msg.getPowerUsedID() + ')'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 2"); |
|
|
|
|
//Sending recycle message to player if died while casting.
|
|
|
|
|
if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor
|
|
|
|
|
|
|
|
|
@ -230,7 +230,7 @@ public enum PowersManager {
@@ -230,7 +230,7 @@ public enum PowersManager {
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 3"); |
|
|
|
|
|
|
|
|
|
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
|
|
|
|
|
// sendPowerMsg(pc, 10, msg);
|
|
|
|
@ -244,7 +244,7 @@ public enum PowersManager {
@@ -244,7 +244,7 @@ public enum PowersManager {
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Cheat Attempted?"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 4"); |
|
|
|
|
// get power
|
|
|
|
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); |
|
|
|
|
if (pb == null) { |
|
|
|
@ -257,10 +257,10 @@ public enum PowersManager {
@@ -257,10 +257,10 @@ public enum PowersManager {
|
|
|
|
|
return true; |
|
|
|
|
// return false;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 5"); |
|
|
|
|
if (playerCharacter.getLastPower() != null) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 6"); |
|
|
|
|
//Check if Power Target is allowed to cast.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -277,6 +277,7 @@ public enum PowersManager {
@@ -277,6 +277,7 @@ public enum PowersManager {
|
|
|
|
|
} else |
|
|
|
|
CSRCast = true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 7"); |
|
|
|
|
// get numTrains for power
|
|
|
|
|
int trains = msg.getNumTrains(); |
|
|
|
|
|
|
|
|
@ -285,7 +286,7 @@ public enum PowersManager {
@@ -285,7 +286,7 @@ public enum PowersManager {
|
|
|
|
|
trains = pb.getMaxTrains(); |
|
|
|
|
msg.setNumTrains(trains); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 8"); |
|
|
|
|
// can't go over total trains by player
|
|
|
|
|
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) { |
|
|
|
|
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID()); |
|
|
|
@ -299,7 +300,7 @@ public enum PowersManager {
@@ -299,7 +300,7 @@ public enum PowersManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 9"); |
|
|
|
|
// get recycle time in ms
|
|
|
|
|
int time = pb.getRecycleTime(trains); |
|
|
|
|
|
|
|
|
@ -319,7 +320,7 @@ public enum PowersManager {
@@ -319,7 +320,7 @@ public enum PowersManager {
|
|
|
|
|
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); |
|
|
|
|
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType))) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 10"); |
|
|
|
|
// if moving make sure spell valid for movement
|
|
|
|
|
Vector3fImmutable endLoc = playerCharacter.getEndLoc(); |
|
|
|
|
|
|
|
|
@ -334,6 +335,7 @@ public enum PowersManager {
@@ -334,6 +335,7 @@ public enum PowersManager {
|
|
|
|
|
if (distanceLeftSquared > sqr(playerCharacter.getSpeed())) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 11"); |
|
|
|
|
// if flying, make sure spell valid for flying.
|
|
|
|
|
// if (pc.getAltitude() > 0)
|
|
|
|
|
// if (!pb.canCastWhileFlying())
|
|
|
|
@ -347,33 +349,34 @@ public enum PowersManager {
@@ -347,33 +349,34 @@ public enum PowersManager {
|
|
|
|
|
if (!pb.usePointBlank()) { |
|
|
|
|
AbstractWorldObject target = getTarget(msg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 12"); |
|
|
|
|
if (target != null && target.getObjectType() == GameObjectType.Building && !pb.targetBuilding()) { |
|
|
|
|
PowersManager.sendPowerMsg(playerCharacter, 9, new PerformActionMsg(msg)); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 13"); |
|
|
|
|
if (target == null) { |
|
|
|
|
if (playerCharacter.getLoc().distanceSquared2D(msg.getTargetLoc()) > sqr(pb |
|
|
|
|
.getRange())) |
|
|
|
|
return true; |
|
|
|
|
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange())) |
|
|
|
|
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange())) { |
|
|
|
|
// pc.getLoc().distance(target.getLoc()) >
|
|
|
|
|
// pb.getRange())
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 14"); |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// get target
|
|
|
|
|
AbstractWorldObject target = getTarget(msg); |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 15"); |
|
|
|
|
if (target == null) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 16"); |
|
|
|
|
if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 17"); |
|
|
|
|
float range = pb.getRange(); |
|
|
|
|
// verify target is in range
|
|
|
|
|
|
|
|
|
@ -382,16 +385,16 @@ public enum PowersManager {
@@ -382,16 +385,16 @@ public enum PowersManager {
|
|
|
|
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
|
|
|
|
// TODO send message that target is out of range
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 18"); |
|
|
|
|
// verify target is valid type
|
|
|
|
|
if (!validateTarget(target, playerCharacter, pb)) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 19"); |
|
|
|
|
if (AbstractWorldObject.IsAbstractCharacter(target)) |
|
|
|
|
targetLiveCounter = ((AbstractCharacter) target).getLiveCounter(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 20"); |
|
|
|
|
// verify regular player can cast spell, otherwise authenticate
|
|
|
|
|
if (!pb.regularPlayerCanCast()) { |
|
|
|
|
Account a = SessionManager.getAccount(playerCharacter); |
|
|
|
@ -401,7 +404,7 @@ public enum PowersManager {
@@ -401,7 +404,7 @@ public enum PowersManager {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 21"); |
|
|
|
|
// verify player has proper effects applied to use power
|
|
|
|
|
if (pb.getEffectPrereqs().size() > 0 && playerCharacter.getEffects() != null) { |
|
|
|
|
|
|
|
|
@ -415,11 +418,11 @@ public enum PowersManager {
@@ -415,11 +418,11 @@ public enum PowersManager {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 22"); |
|
|
|
|
if (!passed) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 23"); |
|
|
|
|
//verify player has proper equipment to use power
|
|
|
|
|
if (pb.getEquipPrereqs().size() > 0) { |
|
|
|
|
|
|
|
|
|