|
|
|
@ -207,7 +207,6 @@ public enum PowersManager {
@@ -207,7 +207,6 @@ public enum PowersManager {
|
|
|
|
|
origin); |
|
|
|
|
if (playerCharacter == null) |
|
|
|
|
return false; |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 1"); |
|
|
|
|
boolean CSRCast = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -220,7 +219,6 @@ public enum PowersManager {
@@ -220,7 +219,6 @@ 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 +228,6 @@ public enum PowersManager {
@@ -230,7 +228,6 @@ public enum PowersManager {
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 3"); |
|
|
|
|
|
|
|
|
|
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
|
|
|
|
|
// sendPowerMsg(pc, 10, msg);
|
|
|
|
@ -241,10 +238,8 @@ public enum PowersManager {
@@ -241,10 +238,8 @@ public enum PowersManager {
|
|
|
|
|
// ChatManager.chatSayInfo(pc, "Recycle timer not finished!");
|
|
|
|
|
|
|
|
|
|
Logger.warn("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' recycle timer not finished " + playerCharacter.getName()); |
|
|
|
|
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 +252,8 @@ public enum PowersManager {
@@ -257,10 +252,8 @@ 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -271,13 +264,11 @@ public enum PowersManager {
@@ -271,13 +264,11 @@ public enum PowersManager {
|
|
|
|
|
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
|
|
|
|
|
|
|
|
|
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName()); |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Cheat Attempted2?"); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} else |
|
|
|
|
CSRCast = true; |
|
|
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 7"); |
|
|
|
|
// get numTrains for power
|
|
|
|
|
int trains = msg.getNumTrains(); |
|
|
|
|
|
|
|
|
@ -286,7 +277,6 @@ public enum PowersManager {
@@ -286,7 +277,6 @@ 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()); |
|
|
|
@ -300,7 +290,6 @@ public enum PowersManager {
@@ -300,7 +290,6 @@ public enum PowersManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 9"); |
|
|
|
|
// get recycle time in ms
|
|
|
|
|
int time = pb.getRecycleTime(trains); |
|
|
|
|
|
|
|
|
@ -320,7 +309,6 @@ public enum PowersManager {
@@ -320,7 +309,6 @@ 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(); |
|
|
|
|
|
|
|
|
@ -335,7 +323,6 @@ public enum PowersManager {
@@ -335,7 +323,6 @@ 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())
|
|
|
|
@ -349,12 +336,10 @@ public enum PowersManager {
@@ -349,12 +336,10 @@ 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())) |
|
|
|
@ -362,7 +347,6 @@ public enum PowersManager {
@@ -362,7 +347,6 @@ public enum PowersManager {
|
|
|
|
|
} 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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -370,13 +354,13 @@ public enum PowersManager {
@@ -370,13 +354,13 @@ public enum PowersManager {
|
|
|
|
|
} else { |
|
|
|
|
// get target
|
|
|
|
|
AbstractWorldObject target = getTarget(msg); |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Error Track 15"); |
|
|
|
|
if (target == null) |
|
|
|
|
|
|
|
|
|
if (target == null) { |
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "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
|
|
|
|
|
|
|
|
|
@ -385,16 +369,13 @@ public enum PowersManager {
@@ -385,16 +369,13 @@ 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); |
|
|
|
@ -404,7 +385,6 @@ public enum PowersManager {
@@ -404,7 +385,6 @@ 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) { |
|
|
|
|
|
|
|
|
@ -418,11 +398,9 @@ public enum PowersManager {
@@ -418,11 +398,9 @@ 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) { |
|
|
|
|
|
|
|
|
@ -2246,6 +2224,13 @@ public enum PowersManager {
@@ -2246,6 +2224,13 @@ public enum PowersManager {
|
|
|
|
|
|
|
|
|
|
private static AbstractWorldObject getTarget(PerformActionMsg msg) { |
|
|
|
|
|
|
|
|
|
PlayerCharacter pc = PlayerCharacter.getPlayerCharacter(msg.getSourceID()); |
|
|
|
|
ChatManager.chatSystemInfo(pc,"Target Type = " + msg.getTargetType()); |
|
|
|
|
ChatManager.chatSystemInfo(pc,"Target ID = " + msg.getTargetID()); |
|
|
|
|
ChatManager.chatSystemInfo(pc,"Power ID = " + msg.getPowerUsedID()); |
|
|
|
|
PowersBase pb = PowersManager.getPowerByToken(msg.getPowerUsedID()); |
|
|
|
|
ChatManager.chatSystemInfo(pc,"Power Name = " + pb.getName()); |
|
|
|
|
ChatManager.chatSystemInfo(pc,"Power Type = " + pb.getPowerCategoryType()); |
|
|
|
|
int type = msg.getTargetType(); |
|
|
|
|
int UUID = msg.getTargetID(); |
|
|
|
|
|
|
|
|
|