Browse Source

Workorders cleared with hireling removal.

combat-2
MagicBot 8 months ago
parent
commit
408e3a45ca
  1. 2
      src/engine/devcmd/cmds/InfoCmd.java
  2. 12
      src/engine/devcmd/cmds/PurgeObjectsCmd.java
  3. 16
      src/engine/devcmd/cmds/RemoveObjectCmd.java
  4. 47
      src/engine/gameManager/BuildingManager.java
  5. 2
      src/engine/mobileAI/MobAI.java
  6. 3
      src/engine/mobileAI/utilities/MovementUtilities.java
  7. 10
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  8. 6
      src/engine/objects/AbstractIntelligenceAgent.java
  9. 5
      src/engine/objects/NPC.java
  10. 6
      src/engine/objects/PlayerCharacter.java

2
src/engine/devcmd/cmds/InfoCmd.java

@ -475,7 +475,7 @@ public class InfoCmd extends AbstractDevCmd { @@ -475,7 +475,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "EquipSet: " + targetMob.equipmentSetID;
output += newline;
try {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
output += "Parent Zone LoadNum : " + targetMob.parentZone.templateID;
} catch (Exception ex) {
//who cares
}

12
src/engine/devcmd/cmds/PurgeObjectsCmd.java

@ -64,8 +64,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd { @@ -64,8 +64,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
if (mob.getParentZone() != null) {
mob.getParentZone().zoneMobSet.remove(mob);
}
}
DbManager.NPCQueries.DELETE_NPC(npc);
@ -78,8 +79,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd { @@ -78,8 +79,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
if (mob.getParentZone() != null) {
mob.getParentZone().zoneMobSet.remove(mob);
}
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(GameObjectType.Mob,
@ -159,8 +161,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd { @@ -159,8 +161,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
if (mob.getParentZone() != null) {
mob.getParentZone().zoneMobSet.remove(mob);
}
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(mbEnums.GameObjectType.NPC,
@ -172,8 +175,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd { @@ -172,8 +175,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
if (mob.getParentZone() != null) {
mob.getParentZone().zoneMobSet.remove(mob);
}
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(mbEnums.GameObjectType.Mob,

16
src/engine/devcmd/cmds/RemoveObjectCmd.java

@ -180,8 +180,9 @@ public class RemoveObjectCmd extends AbstractDevCmd { @@ -180,8 +180,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(minionMob);
WorldGrid.removeObject(minionMob, pc);
if (minionMob.getParentZone() != null)
if (minionMob.getParentZone() != null) {
minionMob.getParentZone().zoneMobSet.remove(minionMob);
}
}
DbManager.NPCQueries.DELETE_NPC(npc);
@ -202,9 +203,11 @@ public class RemoveObjectCmd extends AbstractDevCmd { @@ -202,9 +203,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
return;
}
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
return;
if (mob.getParentZone() != null) {
if (mob.parentZone != currentZone && !mob.isPet() && !mob.isNecroPet()) {
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
return;
}
}
// Remove npc from hirelings list.
@ -222,8 +225,9 @@ public class RemoveObjectCmd extends AbstractDevCmd { @@ -222,8 +225,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
if (mob.parentZone != null) {
mob.parentZone.zoneMobSet.remove(mob);
}
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " removed");

47
src/engine/gameManager/BuildingManager.java

@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid; @@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid;
import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.UpgradeBuildingJob;
import engine.loot.WorkOrder;
import engine.math.Bounds;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
@ -49,8 +50,7 @@ public enum BuildingManager { @@ -49,8 +50,7 @@ public enum BuildingManager {
// Some meshes might not have slot locations assigned.
if (slotLocations == null ||
slotLocations.isEmpty())
if (slotLocations == null || slotLocations.isEmpty())
return -1;
int numOfSlots = _slotLocations.get(building.meshUUID).size();
@ -69,8 +69,7 @@ public enum BuildingManager { @@ -69,8 +69,7 @@ public enum BuildingManager {
// Some meshes might not have slot locations assigned.
if (slotLocations == null ||
slotLocations.isEmpty())
if (slotLocations == null || slotLocations.isEmpty())
return -1;
int numOfSlots = _slotLocations.get(building.meshUUID).size();
@ -127,22 +126,16 @@ public enum BuildingManager { @@ -127,22 +126,16 @@ public enum BuildingManager {
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
return true;
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
return true;
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
return true;
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
return true;
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()))
return true;
return false;
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
//TODO test friends list once added
//does not meet above criteria. Cannot access.
@ -168,7 +161,7 @@ public enum BuildingManager { @@ -168,7 +161,7 @@ public enum BuildingManager {
//Somehow guild leader check fails? lets check if Player is true Guild GL.
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
return true;
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
return false;
@ -274,9 +267,7 @@ public enum BuildingManager { @@ -274,9 +267,7 @@ public enum BuildingManager {
// Submit upgrade job for future date or current instant
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building),
building.getUpgradeDateTime().atZone(ZoneId.systemDefault())
.toInstant().toEpochMilli());
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
} else
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
}
@ -335,10 +326,16 @@ public enum BuildingManager { @@ -335,10 +326,16 @@ public enum BuildingManager {
WorldGrid.RemoveWorldObject(minionMob);
WorldGrid.unloadObject(minionMob);
if (minionMob.getParentZone() != null)
minionMob.getParentZone().zoneMobSet.remove(minionMob);
if (minionMob.parentZone != null)
minionMob.parentZone.zoneMobSet.remove(minionMob);
}
// Clear all workorders for this hireling
if (hireling.getObjectType().equals(GameObjectType.NPC))
if (ForgeManager.vendorWorkOrderLookup.contains(hireling))
for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hireling))
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
// Remove hireling from building
building.getHirelings().remove(hireling);
@ -349,9 +346,11 @@ public enum BuildingManager { @@ -349,9 +346,11 @@ public enum BuildingManager {
Mob hirelingMob = (Mob) hireling;
if (hirelingMob.getParentZone() != null)
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
if (hirelingMob.parentZone != null) {
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob)) {
hirelingMob.parentZone.zoneMobSet.remove(hireling);
}
}
}
@ -451,7 +450,7 @@ public enum BuildingManager { @@ -451,7 +450,7 @@ public enum BuildingManager {
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
return false;
return GuildStatusController.isGuildLeader(player.getGuildStatus()) != false || GuildStatusController.isInnerCouncil(player.getGuildStatus()) != false;
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
}
//This is mainly used for Rolling and gold sharing between building and warehouse.
@ -825,7 +824,7 @@ public enum BuildingManager { @@ -825,7 +824,7 @@ public enum BuildingManager {
else
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
if (success == false) {
if (!success) {
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
return;
}

2
src/engine/mobileAI/MobAI.java

@ -432,7 +432,7 @@ public class MobAI { @@ -432,7 +432,7 @@ public class MobAI {
ChatManager.chatSayInfo(null, mob.getName() + " calls for help!");
Zone mobCamp = mob.getParentZone();
Zone mobCamp = mob.parentZone;
for (Mob helper : mobCamp.zoneMobSet) {
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {

3
src/engine/mobileAI/utilities/MovementUtilities.java

@ -68,8 +68,9 @@ public class MovementUtilities { @@ -68,8 +68,9 @@ public class MovementUtilities {
float zoneRange = 250;
if (agent.getParentZone() != null) {
if (agent.getParentZone().bounds != null)
if (agent.getParentZone().bounds != null) {
zoneRange = agent.getParentZone().bounds.getHalfExtents().x * 2;
}
}
if (zoneRange > 300)

10
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -65,8 +65,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -65,8 +65,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
WorldGrid.RemoveWorldObject(toRemove);
if (toRemove.getParentZone() != null)
if (toRemove.getParentZone() != null) {
toRemove.getParentZone().zoneMobSet.remove(toRemove);
}
DbManager.removeFromCache(toRemove);
@ -189,8 +190,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -189,8 +190,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
WorldGrid.RemoveWorldObject(toRemove);
if (toRemove.getParentZone() != null)
toRemove.getParentZone().zoneMobSet.remove(toRemove);
if (toRemove.parentZone != null) {
toRemove.parentZone.zoneMobSet.remove(toRemove);
}
DbManager.removeFromCache(toRemove);
@ -227,7 +229,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { @@ -227,7 +229,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
//Add Minion
} else {
Zone zone = npc.getParentZone();
Zone zone = npc.parentZone;
if (zone == null)
return true;

6
src/engine/objects/AbstractIntelligenceAgent.java

@ -154,9 +154,11 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { @@ -154,9 +154,11 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
WorldGrid.RemoveWorldObject(this);
if (this.getObjectType() == GameObjectType.Mob)
if (((Mob) this).getParentZone() != null)
if (this.getObjectType() == GameObjectType.Mob) {
if (((Mob) this).getParentZone() != null) {
((Mob) this).getParentZone().zoneMobSet.remove(this);
}
}
} else { //revert charmed pet
this.agentType = mbEnums.AIAgentType.MOBILE;

5
src/engine/objects/NPC.java

@ -651,8 +651,9 @@ public class NPC extends AbstractCharacter { @@ -651,8 +651,9 @@ public class NPC extends AbstractCharacter {
Logger.error(e.getMessage());
}
if (minionMob.getParentZone() != null)
minionMob.getParentZone().zoneMobSet.remove(minionMob);
if (minionMob.parentZone != null) {
minionMob.parentZone.zoneMobSet.remove(minionMob);
}
WorldGrid.RemoveWorldObject(minionMob);
DbManager.removeFromCache(minionMob);

6
src/engine/objects/PlayerCharacter.java

@ -4172,9 +4172,9 @@ public class PlayerCharacter extends AbstractCharacter { @@ -4172,9 +4172,9 @@ public class PlayerCharacter extends AbstractCharacter {
currentPet.setCombatTarget(null);
if (currentPet.getParentZone() != null)
currentPet.getParentZone().zoneMobSet.remove(currentPet);
if (currentPet.parentZone != null) {
currentPet.parentZone.zoneMobSet.remove(currentPet);
}
try {
currentPet.clearEffects();

Loading…
Cancel
Save