attempt to fix boxed combat
This commit is contained in:
@@ -346,7 +346,8 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "Hidden : " + targetPC.getHidden() + newline;
|
||||
output += "Target Loc: " + targetPC.loc + newline;
|
||||
output += "Player Loc: " + pc.loc + newline;
|
||||
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc);
|
||||
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc) + newline;
|
||||
output += "IsBoxed: " + pc.isBoxed;
|
||||
break;
|
||||
|
||||
case NPC:
|
||||
|
||||
@@ -241,16 +241,6 @@ public enum CombatManager {
|
||||
if (ac == null)
|
||||
return;
|
||||
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)ac;
|
||||
if(pc.isBoxed){
|
||||
if(pc.combatTarget != null && pc.combatTarget.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
ChatManager.chatSystemInfo(pc, " You Are PvE Flagged: Cannot Attack Players.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to eat null targets until we can clean
|
||||
// up this unholy mess and refactor it into a thread.
|
||||
|
||||
@@ -322,6 +312,7 @@ public enum CombatManager {
|
||||
if(pet.combatTarget == null && pet.assist)
|
||||
pet.setCombatTarget(attacker.combatTarget);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -513,6 +504,16 @@ public enum CombatManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
||||
if(pc.isBoxed){
|
||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
ChatManager.chatSystemInfo(pc, "You Are PvE Flagged: Cannot Attack Players.");
|
||||
attackFailure = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Verify attacker has los (if not ranged weapon).
|
||||
|
||||
if (!attackFailure) {
|
||||
|
||||
@@ -5244,45 +5244,26 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
Logger.error("UPDATE ISSUE: " + e);
|
||||
}
|
||||
}
|
||||
public static void unboxPlayer(PlayerCharacter player){
|
||||
public static void unboxPlayer(PlayerCharacter player) {
|
||||
String machineID = player.getClientConnection().machineID;
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(!pc.equals(player) && pc. isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)){
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
|
||||
if (!pc.equals(player) && pc.isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)) {
|
||||
sameMachine.add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
boolean valid = true;
|
||||
for(PlayerCharacter pc : sameMachine){
|
||||
if(!pc.safeZone)
|
||||
valid = false;
|
||||
}
|
||||
if(valid) {
|
||||
for (PlayerCharacter pc : sameMachine) {
|
||||
pc.isBoxed = true;
|
||||
if (!pc.title.equals(CharacterTitle.PVE)) {
|
||||
pc.title = CharacterTitle.PVE;
|
||||
InterestManager.setObjectDirty(pc);
|
||||
InterestManager.reloadCharacter(pc, true);
|
||||
pc.setDirtyLoad(true);
|
||||
//pc.getClientConnection().forceDisconnect();
|
||||
}
|
||||
}
|
||||
player.isBoxed = false;
|
||||
if (!player.title.equals(CharacterTitle.NONE)) {
|
||||
player.title = CharacterTitle.NONE;
|
||||
InterestManager.setObjectDirty(player);
|
||||
InterestManager.reloadCharacter(player, true);
|
||||
player.setDirtyLoad(true);
|
||||
//player.getClientConnection().forceDisconnect();
|
||||
}
|
||||
//if (player.containsEffect(1672601862)) {
|
||||
// player.removeEffectBySource(EffectSourceType.DeathShroud, 41, false);
|
||||
//}
|
||||
}else{
|
||||
ChatManager.chatSystemInfo(player, "All Boxes Must Be In Safezone To Switch");
|
||||
for (PlayerCharacter pc : sameMachine) {
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
pc.isBoxed = true;
|
||||
pc.title = CharacterTitle.PVE;
|
||||
InterestManager.setObjectDirty(pc);
|
||||
InterestManager.reloadCharacter(pc, false);
|
||||
}
|
||||
player.isBoxed = false;
|
||||
player.title = CharacterTitle.NONE;
|
||||
InterestManager.setObjectDirty(player);
|
||||
InterestManager.reloadCharacter(player, false);
|
||||
}
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
||||
|
||||
Reference in New Issue
Block a user