Browse Source

box flag checker

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
ead86efcf6
  1. 32
      src/engine/objects/PlayerCharacter.java
  2. 43
      src/engine/workthreads/BoxFlagThread.java

32
src/engine/objects/PlayerCharacter.java

@ -4859,8 +4859,8 @@ public class PlayerCharacter extends AbstractCharacter {
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding //if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false); // PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
//} //}
if(this.isEnteredWorld() && this.isActive()){ if(this.isEnteredWorld() && this.isActive()) {
if( this.getLevel() < 10) { if (this.getLevel() < 10) {
this.setLevel((short) 10); this.setLevel((short) 10);
boolean hasConc = false; boolean hasConc = false;
for (Item i : this.getCharItemManager().getInventory()) { for (Item i : this.getCharItemManager().getInventory()) {
@ -4873,20 +4873,20 @@ public class PlayerCharacter extends AbstractCharacter {
} }
} }
//if(this.isBoxed) { if (this.isBoxed) {
// if(this.title.equals(CharacterTitle.BOX) == false) { if (this.title.equals(CharacterTitle.BOX) == false) {
// this.title = CharacterTitle.BOX; this.title = CharacterTitle.BOX;
// InterestManager.reloadCharacter(this); InterestManager.reloadCharacter(this);
// } }
// if (this.containsEffect(1672601862) == false) {//Deathshroud if (this.containsEffect(1672601862) == false) {//Deathshroud
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
// } }
// }else{ } else {
// if(this.title.equals(CharacterTitle.NONE) == false) { if (this.title.equals(CharacterTitle.NONE) == false) {
// this.title = CharacterTitle.NONE; this.title = CharacterTitle.NONE;
// InterestManager.reloadCharacter(this); InterestManager.reloadCharacter(this);
// } }
// } }
} }
} catch (Exception e) { } catch (Exception e) {

43
src/engine/workthreads/BoxFlagThread.java

@ -35,26 +35,35 @@ public class BoxFlagThread implements Runnable {
LocalDateTime nextPulse = LocalDateTime.now().minusMinutes(1); LocalDateTime nextPulse = LocalDateTime.now().minusMinutes(1);
while(true){ while(true){
if(LocalDateTime.now().isAfter(nextPulse)) { if(LocalDateTime.now().isAfter(nextPulse)) {
HashMap<String,ArrayList<PlayerCharacter>> PlayersByMachineID = new HashMap<>();
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.isEnteredWorld() && pc.isActive()){ if(PlayersByMachineID.containsKey(pc.getClientConnection().machineID)){
ChatManager.chatSystemInfo(pc, " You Are Being Box Checked"); if(PlayersByMachineID.get(pc.getClientConnection().machineID).contains(pc) == false)
pc.isBoxed = PlayerCharacter.checkIfBoxed(pc); PlayersByMachineID.get(pc.getClientConnection().machineID).add(pc);
if(pc.isBoxed) { }else{
if(pc.title.equals(CharacterTitle.BOX) == false) { ArrayList<PlayerCharacter> newList = new ArrayList<>();
pc.title = CharacterTitle.BOX; newList.add(pc);
//InterestManager.reloadCharacter(pc); PlayersByMachineID.put(pc.getClientConnection().machineID,newList);
InterestManager.setObjectDirty(pc); }
if (pc.containsEffect(1672601862) == false) {//Deathshroud }
PowersManager.applyPower(pc, pc, Vector3fImmutable.ZERO, 1672601862, 40, false);
} for(String key : PlayersByMachineID.keySet()){
} ArrayList<PlayerCharacter> machinePlayers = PlayersByMachineID.get(key);
}else{ if(machinePlayers.size() > 1){
if(pc.title.equals(CharacterTitle.NONE) == false) { int unboxedCount = 0;
pc.title = CharacterTitle.NONE; for(PlayerCharacter pc : machinePlayers){
//InterestManager.reloadCharacter(pc); if(!pc.isBoxed)
InterestManager.setObjectDirty(pc); unboxedCount++;
}
if(unboxedCount > 1){
for(PlayerCharacter pc : machinePlayers){
pc.isBoxed = true;
} }
machinePlayers.get(0).isBoxed = false;
} }
}else{
machinePlayers.get(0).isBoxed = false;
} }
} }
nextPulse = nextPulse.plusSeconds(THREAD_DELAY_SECONDS); nextPulse = nextPulse.plusSeconds(THREAD_DELAY_SECONDS);

Loading…
Cancel
Save