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