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 += "Hidden : " + targetPC.getHidden() + newline;
|
||||||
output += "Target Loc: " + targetPC.loc + newline;
|
output += "Target Loc: " + targetPC.loc + newline;
|
||||||
output += "Player Loc: " + pc.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;
|
break;
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
|
|||||||
@@ -241,16 +241,6 @@ public enum CombatManager {
|
|||||||
if (ac == null)
|
if (ac == null)
|
||||||
return;
|
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
|
// Attempt to eat null targets until we can clean
|
||||||
// up this unholy mess and refactor it into a thread.
|
// up this unholy mess and refactor it into a thread.
|
||||||
|
|
||||||
@@ -322,6 +312,7 @@ public enum CombatManager {
|
|||||||
if(pet.combatTarget == null && pet.assist)
|
if(pet.combatTarget == null && pet.assist)
|
||||||
pet.setCombatTarget(attacker.combatTarget);
|
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).
|
//TODO Verify attacker has los (if not ranged weapon).
|
||||||
|
|
||||||
if (!attackFailure) {
|
if (!attackFailure) {
|
||||||
|
|||||||
@@ -5244,45 +5244,26 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
Logger.error("UPDATE ISSUE: " + e);
|
Logger.error("UPDATE ISSUE: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void unboxPlayer(PlayerCharacter player){
|
public static void unboxPlayer(PlayerCharacter player) {
|
||||||
String machineID = player.getClientConnection().machineID;
|
String machineID = player.getClientConnection().machineID;
|
||||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
|
||||||
if(!pc.equals(player) && pc. isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)){
|
if (!pc.equals(player) && pc.isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)) {
|
||||||
sameMachine.add(pc);
|
sameMachine.add(pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (PlayerCharacter pc : sameMachine) {
|
||||||
boolean valid = true;
|
if(pc.equals(player))
|
||||||
for(PlayerCharacter pc : sameMachine){
|
continue;
|
||||||
if(!pc.safeZone)
|
pc.isBoxed = true;
|
||||||
valid = false;
|
pc.title = CharacterTitle.PVE;
|
||||||
}
|
InterestManager.setObjectDirty(pc);
|
||||||
if(valid) {
|
InterestManager.reloadCharacter(pc, false);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
player.isBoxed = false;
|
||||||
|
player.title = CharacterTitle.NONE;
|
||||||
|
InterestManager.setObjectDirty(player);
|
||||||
|
InterestManager.reloadCharacter(player, false);
|
||||||
}
|
}
|
||||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||||
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user