Browse Source

box flag situation looked into

lakebane-master
FatBoy-DOTC 5 months ago
parent
commit
40bff54838
  1. 2
      src/engine/InterestManagement/InterestManager.java
  2. 28
      src/engine/objects/PlayerCharacter.java
  3. 2
      src/engine/server/world/WorldServer.java
  4. 73
      src/engine/workthreads/BoxFlagThread.java
  5. 24
      src/engine/workthreads/PowersThread.java

2
src/engine/InterestManagement/InterestManager.java

@ -524,7 +524,7 @@ public enum InterestManager implements Runnable {
player.setDirtyLoad(true); player.setDirtyLoad(true);
updateStaticList(player, origin); updateStaticList(player, origin);
updateMobileList(player, origin); updateMobileList(player, origin);
PlayerCharacter.checkIfBoxed(player); //PlayerCharacter.checkIfBoxed(player);
} }

28
src/engine/objects/PlayerCharacter.java

@ -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) {

2
src/engine/server/world/WorldServer.java

@ -553,6 +553,8 @@ public class WorldServer {
//Thread powerThread = new Thread(new PowersThread()); //Thread powerThread = new Thread(new PowersThread());
//powerThread.setName("power thread"); //powerThread.setName("power thread");
//powerThread.start(); //powerThread.start();
Logger.info("Starting Box Flag Thread");
BoxFlagThread.startBoxFlagThread();
return true; return true;
} }

73
src/engine/workthreads/BoxFlagThread.java

@ -0,0 +1,73 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.workthreads;
import engine.Enum;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.PowersManager;
import engine.gameManager.SessionManager;
import engine.gameManager.ZergManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class BoxFlagThread implements Runnable {
public final static int THREAD_DELAY = 5000;
public BoxFlagThread() {
}
@Override
public void run() {
long nextPulse = System.currentTimeMillis();
while(true){
if(System.currentTimeMillis() > nextPulse) {
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.isEnteredWorld() && pc.isActive()){
if(PlayerCharacter.checkIfBoxed(pc)) {
if(pc.title.equals(CharacterTitle.BOX) == false) {
pc.title = CharacterTitle.BOX;
//InterestManager.reloadCharacter(pc);
InterestManager.setObjectDirty(pc);
}
if (pc.containsEffect(1672601862) == false) {//Deathshroud
PowersManager.applyPower(pc, pc, Vector3fImmutable.ZERO, 1672601862, 40, false);
}
}else{
if(pc.title.equals(CharacterTitle.NONE) == false) {
pc.title = CharacterTitle.NONE;
//InterestManager.reloadCharacter(pc);
InterestManager.setObjectDirty(pc);
}
}
}
}
nextPulse += THREAD_DELAY;
}
}
}
public static void startBoxFlagThread() {
Thread boxFlag;
boxFlag = new Thread(new BoxFlagThread());
boxFlag.setName("boxFlagThread");
boxFlag.start();
}
}

24
src/engine/workthreads/PowersThread.java

@ -1,24 +0,0 @@
package engine.workthreads;
import engine.gameManager.PowersManager;
import java.util.ArrayList;
public class PowersThread implements Runnable {
public PowersThread(){
}
@Override
public void run() {
while(true){
ArrayList<PowersManager.PowerQueObject> purge = new ArrayList<>();
for(PowersManager.PowerQueObject pqo : PowersManager.static_power_que){
purge.add(pqo);
PowersManager.usePower(pqo.msg,pqo.origin,pqo.sendCastToSelf);
}
PowersManager.static_power_que.removeAll(purge);
}
}
}
Loading…
Cancel
Save