forked from MagicBane/Server
Merge remote-tracking branch 'origin/magicbox1.5' into trywithpass
This commit is contained in:
@@ -305,10 +305,13 @@ public class MobileFSM {
|
|||||||
public static void DetermineAction(Mob mob) {
|
public static void DetermineAction(Mob mob) {
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return;
|
return;
|
||||||
if (mob.despawned && mob.getMobBase().getLoadID() == 13171) {
|
if (mob.playerAgroMap.isEmpty() && !mob.isPlayerGuard)
|
||||||
//trebuchet spawn handler
|
//no players loaded, no need to proceed
|
||||||
CheckForRespawn(mob);
|
|
||||||
return;
|
return;
|
||||||
|
else{
|
||||||
|
if(mob.isPlayerGuard && mob.guardedCity._playerMemory.size() < 1 && mob.playerAgroMap.isEmpty())
|
||||||
|
//guards use aggro map and players in their local city zone
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (mob.despawned && mob.isPlayerGuard) {
|
if (mob.despawned && mob.isPlayerGuard) {
|
||||||
//override for guards
|
//override for guards
|
||||||
@@ -331,9 +334,6 @@ public class MobileFSM {
|
|||||||
CheckForRespawn(mob);
|
CheckForRespawn(mob);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false)
|
|
||||||
//no players loaded, no need to proceed
|
|
||||||
return;
|
|
||||||
if (mob.isCombat() && mob.getCombatTarget() == null) {
|
if (mob.isCombat() && mob.getCombatTarget() == null) {
|
||||||
mob.setCombat(false);
|
mob.setCombat(false);
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
@@ -492,21 +492,19 @@ public class MobileFSM {
|
|||||||
if (mob.isPlayerGuard() && !mob.despawned) {
|
if (mob.isPlayerGuard() && !mob.despawned) {
|
||||||
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||||
if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false || mob.playerAgroMap.isEmpty()) {
|
if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false || mob.playerAgroMap.isEmpty()) {
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
MovementManager.translocate(mob,mob.getBindLoc(),null);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()){
|
if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()){
|
||||||
//guard captain pulls his minions home with him
|
//guard captain pulls his minions home with him
|
||||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||||
PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40);
|
MovementManager.translocate(minion.getKey(),mob.getBindLoc(),null);
|
||||||
minion.getKey().setCombatTarget(null);
|
minion.getKey().setCombatTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
else if(MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
MovementManager.translocate(mob,mob.getBindLoc(),null);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
package engine.ai;
|
package engine.ai;
|
||||||
|
import engine.gameManager.SessionManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
@@ -88,7 +89,7 @@ public class MobileFSMManager {
|
|||||||
for (Mob mob : zone.zoneMobSet) {
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mob != null)
|
if (mob != null && SessionManager.getActivePlayerCharacterCount() > 0)
|
||||||
MobileFSM.DetermineAction(mob);
|
MobileFSM.DetermineAction(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Players who have entered the city (used for adding and removing affects)
|
// Players who have entered the city (used for adding and removing affects)
|
||||||
|
|
||||||
private final HashSet<Integer> _playerMemory = new HashSet<>();
|
public final HashSet<Integer> _playerMemory = new HashSet<>();
|
||||||
|
|
||||||
public volatile boolean protectionEnforced = true;
|
public volatile boolean protectionEnforced = true;
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
private DeferredPowerJob weaponPower;
|
private DeferredPowerJob weaponPower;
|
||||||
private DateTime upgradeDateTime = null;
|
private DateTime upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
|
public City guardedCity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
@@ -806,6 +807,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
mob.npcOwner = guardCaptain;
|
mob.npcOwner = guardCaptain;
|
||||||
mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
||||||
mob.BehaviourType = Enum.MobBehaviourType.GuardMinion;
|
mob.BehaviourType = Enum.MobBehaviourType.GuardMinion;
|
||||||
|
mob.guardedCity = guardCaptain.guardedCity;
|
||||||
mob.parentZone = parent;
|
mob.parentZone = parent;
|
||||||
parent.zoneMobSet.add(mob);
|
parent.zoneMobSet.add(mob);
|
||||||
return mob;
|
return mob;
|
||||||
@@ -1987,6 +1989,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
else {
|
else {
|
||||||
this.BehaviourType = MobBehaviourType.GuardCaptain;
|
this.BehaviourType = MobBehaviourType.GuardCaptain;
|
||||||
this.spawnTime = 900;
|
this.spawnTime = 900;
|
||||||
|
this.guardedCity = ZoneManager.getCityAtLocation(this.bindLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.deathTime = 0;
|
this.deathTime = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user