forked from MagicBane/Server
box flag situation looked into
This commit is contained in:
@@ -524,7 +524,7 @@ public enum InterestManager implements Runnable {
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
PlayerCharacter.checkIfBoxed(player);
|
||||
//PlayerCharacter.checkIfBoxed(player);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4873,20 +4873,20 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.isBoxed) {
|
||||
if(this.title.equals(CharacterTitle.BOX) == false) {
|
||||
this.title = CharacterTitle.BOX;
|
||||
InterestManager.reloadCharacter(this);
|
||||
}
|
||||
if (this.containsEffect(1672601862) == false) {//Deathshroud
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
}else{
|
||||
if(this.title.equals(CharacterTitle.NONE) == false) {
|
||||
this.title = CharacterTitle.NONE;
|
||||
InterestManager.reloadCharacter(this);
|
||||
}
|
||||
}
|
||||
//if(this.isBoxed) {
|
||||
// if(this.title.equals(CharacterTitle.BOX) == false) {
|
||||
// this.title = CharacterTitle.BOX;
|
||||
// InterestManager.reloadCharacter(this);
|
||||
// }
|
||||
// if (this.containsEffect(1672601862) == false) {//Deathshroud
|
||||
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
// }
|
||||
// }else{
|
||||
// if(this.title.equals(CharacterTitle.NONE) == false) {
|
||||
// this.title = CharacterTitle.NONE;
|
||||
// InterestManager.reloadCharacter(this);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -553,6 +553,8 @@ public class WorldServer {
|
||||
//Thread powerThread = new Thread(new PowersThread());
|
||||
//powerThread.setName("power thread");
|
||||
//powerThread.start();
|
||||
Logger.info("Starting Box Flag Thread");
|
||||
BoxFlagThread.startBoxFlagThread();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user