|
|
@ -207,7 +207,6 @@ 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 +219,6 @@ 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 +228,6 @@ 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);
|
|
|
@ -241,10 +238,8 @@ public enum PowersManager { |
|
|
|
// ChatManager.chatSayInfo(pc, "Recycle timer not finished!");
|
|
|
|
// ChatManager.chatSayInfo(pc, "Recycle timer not finished!");
|
|
|
|
|
|
|
|
|
|
|
|
Logger.warn("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' recycle timer not finished " + playerCharacter.getName()); |
|
|
|
Logger.warn("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' recycle timer not finished " + playerCharacter.getName()); |
|
|
|
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 +252,8 @@ 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -271,13 +264,11 @@ public enum PowersManager { |
|
|
|
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
|
|
|
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName()); |
|
|
|
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName()); |
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Cheat Attempted2?"); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} 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(); |
|
|
|
|
|
|
|
|
|
|
@ -286,7 +277,6 @@ 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()); |
|
|
@ -300,7 +290,6 @@ 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); |
|
|
|
|
|
|
|
|
|
|
@ -320,7 +309,6 @@ 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(); |
|
|
|
|
|
|
|
|
|
|
@ -335,7 +323,6 @@ 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())
|
|
|
@ -349,12 +336,10 @@ 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())) |
|
|
@ -362,7 +347,6 @@ public enum PowersManager { |
|
|
|
} 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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -370,13 +354,13 @@ public enum PowersManager { |
|
|
|
} 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) { |
|
|
|
|
|
|
|
ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "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
|
|
|
|
|
|
|
|
|
|
|
@ -385,16 +369,13 @@ 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); |
|
|
@ -404,7 +385,6 @@ 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) { |
|
|
|
|
|
|
|
|
|
|
@ -418,11 +398,9 @@ 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) { |
|
|
|
|
|
|
|
|
|
|
@ -2246,6 +2224,13 @@ public enum PowersManager { |
|
|
|
|
|
|
|
|
|
|
|
private static AbstractWorldObject getTarget(PerformActionMsg msg) { |
|
|
|
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 type = msg.getTargetType(); |
|
|
|
int UUID = msg.getTargetID(); |
|
|
|
int UUID = msg.getTargetID(); |
|
|
|
|
|
|
|
|
|
|
|