Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76284cf3c9 | |||
| 9d79afa395 | |||
| 944290f958 | |||
| e6eb753666 | |||
| 4ad7e0f021 | |||
| 8d587538e0 | |||
| 4ae64ab94c | |||
| c5e6205801 | |||
| 5a3f4e690f | |||
| 048474b014 | |||
| 24e01acff4 | |||
| a75670bf0e | |||
| d56d58492a | |||
| 7b33c1392a | |||
| 86c95f0eb5 | |||
| 6ed648d6d4 | |||
| c722450f65 |
@@ -27,6 +27,7 @@ import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.session.Session;
|
||||
import engine.util.KeyCloneAudit;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -84,6 +85,10 @@ public enum ChatManager {
|
||||
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
|
||||
isFlood = true;
|
||||
|
||||
if(KeyCloneAudit.auditChatMsg(pc,msg.getMessage())){
|
||||
return;
|
||||
}
|
||||
|
||||
switch (protocolMsg) {
|
||||
case CHATSAY:
|
||||
ChatManager.chatSay(pc, msg.getMessage(), isFlood);
|
||||
|
||||
@@ -301,6 +301,17 @@ public enum CombatManager {
|
||||
if (target == null)
|
||||
return 0;
|
||||
|
||||
//pet to assist in attacking target
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter attacker = (PlayerCharacter)abstractCharacter;
|
||||
if(attacker.getPet() != null){
|
||||
Mob pet = attacker.getPet();
|
||||
if(pet.combatTarget == null && pet.assist)
|
||||
pet.setCombatTarget(attacker.combatTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//target must be valid type
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||
|
||||
@@ -1627,6 +1627,7 @@ public enum PowersManager {
|
||||
case 431511776:
|
||||
case 429578587:
|
||||
case 429503360:
|
||||
case 44106356:
|
||||
trackChars = getTrackList(playerCharacter);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
@@ -106,6 +107,12 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.getPet() != null && target.getPet().isAlive() && !target.getPet().isSiege()){
|
||||
mob.setCombatTarget(target.getPet());
|
||||
AttackTarget(mob,mob.combatTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.BehaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
|
||||
@@ -156,6 +163,12 @@ public class MobAI {
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
||||
target.getPet().setCombatTarget(mob);
|
||||
|
||||
try{
|
||||
InterestManager.forceLoad(mob);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
|
||||
}
|
||||
@@ -1216,6 +1229,7 @@ public class MobAI {
|
||||
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||
CheckForAttack(mob);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package engine.mobileAI.Threads;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mobileAI.behaviours.GuardAI;
|
||||
import engine.mobileAI.behaviours.SiegeEngineAI;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -35,13 +33,6 @@ public class MobAIThread implements Runnable{
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
try {
|
||||
if (mob != null) {
|
||||
if(mob.isSiege()){
|
||||
SiegeEngineAI.run(mob);
|
||||
continue;
|
||||
}else if(mob.isPlayerGuard){
|
||||
GuardAI.run(mob);
|
||||
continue;
|
||||
}
|
||||
MobAI.DetermineAction(mob);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -43,14 +43,13 @@ public class MobRespawnThread implements Runnable {
|
||||
if (zones != null) {
|
||||
for (Zone zone : zones) {
|
||||
synchronized (zone) { // Optional: Synchronize on zone
|
||||
if (!zone.respawnQue.isEmpty() &&
|
||||
zone.lastRespawn + RESPAWN_INTERVAL < System.currentTimeMillis()) {
|
||||
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + RESPAWN_INTERVAL < System.currentTimeMillis()) {
|
||||
|
||||
Mob respawner = zone.respawnQue.iterator().next();
|
||||
Mob respawner = Zone.respawnQue.iterator().next();
|
||||
if (respawner != null) {
|
||||
respawner.respawn();
|
||||
zone.respawnQue.remove(respawner);
|
||||
zone.lastRespawn = System.currentTimeMillis();
|
||||
Zone.respawnQue.remove(respawner);
|
||||
Zone.lastRespawn = System.currentTimeMillis();
|
||||
Thread.sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
package engine.mobileAI.behaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.*;
|
||||
import engine.powers.MobPowerEntry;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class GuardAI {
|
||||
|
||||
public static HashMap<Mob,PowersBase> quedPowerCasts = new HashMap<>();
|
||||
|
||||
public static void run(Mob guard){
|
||||
|
||||
//1. check for players nearby to aggro to
|
||||
if(guard.combatTarget == null)
|
||||
CheckForPlayerGuardAggro(guard);
|
||||
|
||||
//2. patrol if no target acquired
|
||||
if(guard.combatTarget == null) {
|
||||
patrol(guard);
|
||||
return;
|
||||
}
|
||||
|
||||
//3. attack based on whether spellcaster, archer or mele
|
||||
if(guard.mobPowers.isEmpty()){
|
||||
if(guard.getEquip().get(2) != null && guard.getEquip().get(2).getItemBase().getRange() > 20) {
|
||||
runArcher(guard);
|
||||
}else {
|
||||
runMele(guard);
|
||||
}
|
||||
}else{
|
||||
runCaster(guard);
|
||||
}
|
||||
}
|
||||
|
||||
public static void runCaster(Mob guard){
|
||||
|
||||
}
|
||||
|
||||
public static void runMele(Mob guard){
|
||||
|
||||
}
|
||||
|
||||
public static void runArcher(Mob guard){
|
||||
|
||||
}
|
||||
|
||||
public static void CheckForPlayerGuardAggro(Mob mob) {
|
||||
|
||||
try {
|
||||
|
||||
//looks for and sets mobs combatTarget
|
||||
|
||||
if (!mob.isAlive())
|
||||
return;
|
||||
|
||||
ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
|
||||
|
||||
for (Map.Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
int playerID = (int) playerEntry.getKey();
|
||||
PlayerCharacter loadedPlayer = PlayerCharacter.getFromCache(playerID);
|
||||
|
||||
//Player is null, let's remove them from the list.
|
||||
|
||||
if (loadedPlayer == null) {
|
||||
loadedPlayers.remove(playerID);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map.
|
||||
|
||||
if (!loadedPlayer.isAlive()) {
|
||||
loadedPlayers.remove(playerID);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Can't see target, skip aggro.
|
||||
|
||||
if (!mob.canSee(loadedPlayer))
|
||||
continue;
|
||||
|
||||
// No aggro for this player
|
||||
|
||||
if (GuardCanAggro(mob, loadedPlayer) == false)
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer) && mob.getCombatTarget() == null) {
|
||||
mob.setCombatTarget(loadedPlayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
return false;
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
||||
if (((Mob) mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
} else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//first check condemn list for aggro allowed (allies button is checked)
|
||||
|
||||
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
||||
for (Map.Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
if (entry.getValue().getPlayerUID() == target.getObjectUUID() && entry.getValue().isActive())
|
||||
return false;
|
||||
|
||||
//target's guild is listed
|
||||
|
||||
if (Guild.getGuild(entry.getValue().getGuildUID()) == target.getGuild())
|
||||
return false;
|
||||
|
||||
//target's nation is listed
|
||||
|
||||
if (Guild.getGuild(entry.getValue().getGuildUID()) == target.getGuild().getNation())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
//allies button is not checked
|
||||
|
||||
for (Map.Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
if (entry.getValue().getPlayerUID() == target.getObjectUUID() && entry.getValue().isActive())
|
||||
return true;
|
||||
|
||||
//target's guild is listed
|
||||
|
||||
if (Guild.getGuild(entry.getValue().getGuildUID()) == target.getGuild())
|
||||
return true;
|
||||
|
||||
//target's nation is listed
|
||||
|
||||
if (Guild.getGuild(entry.getValue().getGuildUID()) == target.getGuild().getNation())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCanAggro" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void randomGuardPatrolPoint(Mob mob) {
|
||||
|
||||
try {
|
||||
|
||||
//early exit for a mob who is already moving to a patrol point
|
||||
//while mob moving, update lastPatrolTime so that when they stop moving the 10 second timer can begin
|
||||
|
||||
if (mob.isMoving() == true) {
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
|
||||
//wait between 10 and 15 seconds after reaching patrol point before moving
|
||||
|
||||
int patrolDelay = ThreadLocalRandom.current().nextInt(10000) + 5000;
|
||||
|
||||
//early exit while waiting to patrol again
|
||||
|
||||
if (mob.stopPatrolTime + patrolDelay > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
float xPoint = ThreadLocalRandom.current().nextInt(400) - 200;
|
||||
float zPoint = ThreadLocalRandom.current().nextInt(400) - 200;
|
||||
Vector3fImmutable TreePos = mob.getGuild().getOwnedCity().getLoc();
|
||||
mob.destination = new Vector3fImmutable(TreePos.x + xPoint, TreePos.y, TreePos.z + zPoint);
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||
for (Map.Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (minion.getKey().despawned == false) {
|
||||
if (MovementUtilities.canMove(minion.getKey())) {
|
||||
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
||||
minion.getKey().updateLocation();
|
||||
Vector3fImmutable formationPatrolPoint = new Vector3fImmutable(mob.destination.x + minionOffset.x, mob.destination.y, mob.destination.z + minionOffset.z);
|
||||
MovementUtilities.aiMove(minion.getKey(), formationPatrolPoint, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: randomGuardPatrolPoints" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void patrol(Mob guard){
|
||||
if (!guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain) && guard.npcOwner.isAlive())
|
||||
return;
|
||||
|
||||
//patrol
|
||||
Building barracks = guard.building;
|
||||
|
||||
if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) {
|
||||
guard.patrolPoints = barracks.patrolPoints;
|
||||
} else {
|
||||
randomGuardPatrolPoint(guard);
|
||||
return;
|
||||
}
|
||||
if (guard.lastPatrolPointIndex > guard.patrolPoints.size() - 1)
|
||||
guard.lastPatrolPointIndex = 0;
|
||||
|
||||
guard.destination = guard.patrolPoints.get(guard.lastPatrolPointIndex);
|
||||
guard.lastPatrolPointIndex += 1;
|
||||
|
||||
MovementUtilities.aiMove(guard, guard.destination, true);
|
||||
|
||||
if (guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
for (Map.Entry<Mob, Integer> minion : guard.siegeMinionMap.entrySet())
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (!minion.getKey().despawned) {
|
||||
if (MovementUtilities.canMove(minion.getKey())) {
|
||||
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
||||
minion.getKey().updateLocation();
|
||||
Vector3fImmutable formationPatrolPoint = new Vector3fImmutable(guard.destination.x + minionOffset.x, guard.destination.y, guard.destination.z + minionOffset.z);
|
||||
MovementUtilities.aiMove(minion.getKey(), formationPatrolPoint, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package engine.mobileAI.behaviours;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class PetAI {
|
||||
|
||||
public static void run(Mob pet){
|
||||
|
||||
//1. check for combat
|
||||
|
||||
//2. check for distance from player
|
||||
|
||||
//3. follow player
|
||||
|
||||
//4. chase combat target
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package engine.mobileAI.behaviours;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Mob;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class SiegeEngineAI {
|
||||
|
||||
public static void run(Mob engine) {
|
||||
|
||||
//1. check to respawn if engine is dead or initially spawning
|
||||
if (!engine.isAlive() || engine.despawned) {
|
||||
if (System.currentTimeMillis() - engine.deathTime > MBServerStatics.FIFTEEN_MINUTES) {
|
||||
engine.respawn();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//2. early exit if owner is null, siege engines cannot act with player intervention
|
||||
if (engine.getOwner() == null)
|
||||
return;
|
||||
|
||||
//3. early exit if target is null, siege engines have no purpose without a target
|
||||
if (engine.combatTarget == null)
|
||||
return;
|
||||
|
||||
//4. early exit if target is not a building, siege engines can only attack buildings
|
||||
if (!engine.combatTarget.getObjectType().equals(Enum.GameObjectType.Building)) {
|
||||
engine.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
//5. early exit if target is out of range, engines don't move and neither do buildings, avoid infinite loop
|
||||
if(CombatManager.NotInRange(engine,engine.combatTarget,engine.getRange())) {
|
||||
engine.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
//6. attack target, sanity checks passed, attack target
|
||||
AttackBuilding(engine,(Building) engine.combatTarget);
|
||||
}
|
||||
|
||||
public static void AttackBuilding(Mob engine, Building target) {
|
||||
|
||||
try {
|
||||
|
||||
if (engine == null || target == null)
|
||||
return;
|
||||
|
||||
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||
engine.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
City playercity = ZoneManager.getCityAtLocation(engine.getLoc());
|
||||
|
||||
if (playercity != null)
|
||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||
if (guard.BehaviourType != null && guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (guard.getCombatTarget() == null && guard.getGuild() != null && engine.getGuild() != null && !guard.getGuild().equals(engine.getGuild()))
|
||||
guard.setCombatTarget(engine);
|
||||
|
||||
|
||||
MovementManager.sendRWSSMsg(engine);
|
||||
|
||||
CombatUtilities.combatCycle(engine, target, true, null);
|
||||
int delay = 15000;
|
||||
engine.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
|
||||
|
||||
//if (mob.isSiege()) {
|
||||
// PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
// ppm.setRange(50);
|
||||
// DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(engine.getObjectUUID() + " " + engine.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package engine.mobileAI.behaviours;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class StandardAI {
|
||||
public static void run(Mob mob){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -201,12 +201,10 @@ public class CombatUtilities {
|
||||
return;
|
||||
|
||||
int anim = 75;
|
||||
float speed;
|
||||
|
||||
if (mainHand)
|
||||
speed = agent.getSpeedHandOne();
|
||||
else
|
||||
speed = agent.getSpeedHandTwo();
|
||||
//handle the retaliate here because even if the mob misses you can still retaliate
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||
CombatManager.handleRetaliate((AbstractCharacter) target, agent);
|
||||
|
||||
DamageType dt = DamageType.Crush;
|
||||
|
||||
@@ -288,11 +286,6 @@ public class CombatUtilities {
|
||||
if (((Mob) target).isSiege())
|
||||
return;
|
||||
|
||||
//handle the retaliate
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||
CombatManager.handleRetaliate((AbstractCharacter) target, agent);
|
||||
|
||||
if (target.getObjectType() == GameObjectType.Mob) {
|
||||
Mob targetMob = (Mob) target;
|
||||
if (targetMob.isSiege())
|
||||
|
||||
@@ -620,6 +620,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
DbManager.addToCache(mob);
|
||||
mob.setPet(owner, true);
|
||||
mob.setWalkMode(false);
|
||||
mob.level = level;
|
||||
mob.runAfterLoad();
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -628,8 +629,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
createLock.writeLock().unlock();
|
||||
}
|
||||
parent.zoneMobSet.add(mob);
|
||||
mob.level = level;
|
||||
mob.healthMax = mob.getMobBase().getHealthMax() * (mob.level * 0.5f);
|
||||
// mob.level = level;
|
||||
float healthMax = mob.getMobBase().getHealthMax();
|
||||
if(mob.bonuses != null){
|
||||
healthMax += mob.bonuses.getFloat(ModType.HealthFull,SourceType.None);
|
||||
}
|
||||
mob.healthMax = healthMax;
|
||||
mob.health.set(mob.healthMax);
|
||||
return mob;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,10 @@ public class MobBase extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public static void applyMobbaseEffects(Mob mob){
|
||||
if(mob.getMobBaseID() == 12008)
|
||||
mob.level = 65;
|
||||
else if(mob.getMobBaseID() == 12019)
|
||||
mob.level = 80;
|
||||
for(MobBaseEffects mbe : mob.mobBase.mobbaseEffects){
|
||||
if(mob.level >= mbe.getReqLvl()){
|
||||
try {
|
||||
|
||||
@@ -5147,26 +5147,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
forceRespawn(this);
|
||||
return;
|
||||
}
|
||||
if(!this.timestamps.containsKey("stamTick")){
|
||||
this.timestamps.put("stamTick", System.currentTimeMillis());
|
||||
}else{
|
||||
if(this.containsEffect(441156479) || this.containsEffect(441156455)) {
|
||||
if(System.currentTimeMillis() - this.timestamps.get("stamTick") > 5000){
|
||||
boolean worked = false;
|
||||
while(!worked) {
|
||||
float old = this.stamina.get();
|
||||
float mod = old + 4;
|
||||
if (mod > this.staminaMax)
|
||||
mod = this.staminaMax;
|
||||
|
||||
worked = this.stamina.compareAndSet(old, mod);
|
||||
}
|
||||
this.timestamps.put("stamTick", System.currentTimeMillis());
|
||||
}
|
||||
}else{
|
||||
this.timestamps.put("stamTick", System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isAlive() && this.isActive && this.enteredWorld) {
|
||||
|
||||
@@ -5204,8 +5184,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
if (this.isBoxed && !this.containsEffect(508555434)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 508555434, 40, false);
|
||||
}
|
||||
|
||||
if (this.ZergMultiplier != 1.0f && !this.containsEffect(-906894951)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, -906894951, 40, false);
|
||||
}else if(this.containsEffect(-906894951)){
|
||||
this.effects.remove("Zerg Penalty");
|
||||
}
|
||||
|
||||
if (this.isFlying()) {
|
||||
@@ -5249,14 +5235,22 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
for(PlayerCharacter pc : sameMachine)
|
||||
pc.isBoxed = true;
|
||||
|
||||
player.isBoxed = false;
|
||||
if(player.containsEffect(1672601862)) {
|
||||
player.removeEffectBySource(EffectSourceType.DeathShroud,41,false);
|
||||
boolean valid = true;
|
||||
for(PlayerCharacter pc : sameMachine){
|
||||
if(!pc.safeZone)
|
||||
valid = false;
|
||||
}
|
||||
if(valid) {
|
||||
for (PlayerCharacter pc : sameMachine)
|
||||
pc.isBoxed = true;
|
||||
|
||||
player.isBoxed = false;
|
||||
if (player.containsEffect(1672601862)) {
|
||||
player.removeEffectBySource(EffectSourceType.DeathShroud, 41, false);
|
||||
}
|
||||
}else{
|
||||
ChatManager.chatSystemInfo(player, "All Boxes Must Be In Safezone To Switch");
|
||||
}
|
||||
}
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
||||
@@ -5905,10 +5899,16 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
// Reset this char's frame time.
|
||||
this.lastUpdateTime = System.currentTimeMillis();
|
||||
this.lastStamUpdateTime = System.currentTimeMillis();
|
||||
|
||||
//this.updateMovementState();
|
||||
///boolean updateHealth = this.regenerateHealth();
|
||||
//boolean updateMana = this.regenerateMana();
|
||||
//boolean updateStamina = this.regenerateStamina();
|
||||
//boolean consumeStamina = this.consumeStamina();
|
||||
if (this.timestamps.get("SyncClient") + 5000L < System.currentTimeMillis()) {
|
||||
this.syncClient();
|
||||
this.timestamps.put("SyncClient", System.currentTimeMillis());
|
||||
//if (updateHealth || updateMana || updateStamina || consumeStamina) {
|
||||
this.syncClient();
|
||||
this.timestamps.put("SyncClient", System.currentTimeMillis());
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,17 @@ public class WorldServer {
|
||||
long uptimeSeconds = Math.abs(uptimeDuration.getSeconds());
|
||||
String uptime = String.format("%d hours %02d minutes %02d seconds", uptimeSeconds / 3600, (uptimeSeconds % 3600) / 60, (uptimeSeconds % 60));
|
||||
outString += "uptime: " + uptime;
|
||||
outString += " pop: " + SessionManager.getActivePlayerCharacterCount() + " max pop: " + SessionManager._maxPopulation;
|
||||
int activePop = 0;
|
||||
int boxedPop = 0;
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.isBoxed){
|
||||
boxedPop ++;
|
||||
}else{
|
||||
activePop ++;
|
||||
}
|
||||
}
|
||||
//outString += " pop: " + SessionManager.getActivePlayerCharacterCount() + " max pop: " + SessionManager._maxPopulation;
|
||||
outString += "Active Players: " + activePop + " Boxed Players: " + boxedPop;
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to build string");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package engine.util;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
@@ -15,6 +16,25 @@ import org.pmw.tinylog.Logger;
|
||||
public enum KeyCloneAudit {
|
||||
KEYCLONEAUDIT;
|
||||
|
||||
public static boolean auditChatMsg(PlayerCharacter pc, String message) {
|
||||
|
||||
if(pc.combatTarget != null && message.contains(String.valueOf(pc.combatTarget.getObjectUUID()))) {
|
||||
//targeting software detected
|
||||
|
||||
Group g = GroupManager.getGroup(pc);
|
||||
|
||||
if (g == null)
|
||||
pc.getClientConnection().forceDisconnect();
|
||||
else
|
||||
for (PlayerCharacter member : g.members)
|
||||
member.getClientConnection().forceDisconnect();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void audit(PlayerCharacter player, Group group) {
|
||||
|
||||
int machineCount = 0;
|
||||
|
||||
@@ -45,18 +45,12 @@ public class UpdateThread implements Runnable {
|
||||
public void run() {
|
||||
lastRun = System.currentTimeMillis();
|
||||
while (true) {
|
||||
if (System.currentTimeMillis() >= lastRun + instancedelay) { // Correct condition
|
||||
try {
|
||||
this.processPlayerUpdate();
|
||||
lastRun = System.currentTimeMillis(); // Update lastRun after processing
|
||||
}else {
|
||||
try {
|
||||
Thread.sleep(100); // Pause for 100ms to reduce CPU usage
|
||||
} catch (InterruptedException e) {
|
||||
Logger.error("Thread interrupted", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
Thread.sleep(100); // Pause for 100ms to reduce CPU usage
|
||||
} catch (InterruptedException e) {
|
||||
Logger.error("Thread interrupted", e);
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user