Public Repository for the Magicbane Shadowbane Emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.0 KiB

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// 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.*;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class BoxFlagThread implements Runnable {
public final static int THREAD_DELAY_SECONDS = 10;
public BoxFlagThread() {
}
@Override
public void run() {
LocalDateTime nextPulse = LocalDateTime.now().minusMinutes(1);
while(true){
if(LocalDateTime.now().isAfter(nextPulse)) {
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.isEnteredWorld() && pc.isActive()){
ChatManager.chatSystemInfo(pc, " You Are Being Box Checked");
pc.isBoxed = PlayerCharacter.checkIfBoxed(pc);
if(pc.isBoxed) {
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 = nextPulse.plusSeconds(THREAD_DELAY_SECONDS);
}
}
}
public static void startBoxFlagThread() {
Thread boxFlag;
boxFlag = new Thread(new BoxFlagThread());
boxFlag.setName("boxFlagThread");
boxFlag.start();
}
}