From c8473cbe031962a49a847381d17ea403232fe4e8 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 5 Sep 2024 21:12:39 -0500 Subject: [PATCH] stronghold mobs --- src/engine/gameManager/StrongholdManager.java | 6 +++++ src/engine/objects/Mob.java | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/engine/gameManager/StrongholdManager.java b/src/engine/gameManager/StrongholdManager.java index bb614dbd..c27df069 100644 --- a/src/engine/gameManager/StrongholdManager.java +++ b/src/engine/gameManager/StrongholdManager.java @@ -84,6 +84,8 @@ public class StrongholdManager { guard.defenseRating = 2200; guard.setFirstName("Elite Guardian"); InterestManager.setObjectDirty(guard); + WorldGrid.addObject(guard,loc.x,loc.z); + WorldGrid.updateObject(guard); guard.stronghold = mine; guard.mobPowers.clear(); guard.mobPowers.put(429399948,20); // find weakness @@ -121,6 +123,8 @@ public class StrongholdManager { commander.defenseRating = 3500; commander.setFirstName("Guardian Commander"); InterestManager.setObjectDirty(commander); + WorldGrid.addObject(commander,loc.x,loc.z); + WorldGrid.updateObject(commander); commander.stronghold = mine; } @@ -333,6 +337,8 @@ public class StrongholdManager { commander.defenseRating = 3500; commander.setFirstName("Defender of " + mine.getParentZone().getParent().getName()); InterestManager.setObjectDirty(commander); + WorldGrid.addObject(commander,loc.x,loc.z); + WorldGrid.updateObject(commander); commander.stronghold = mine; } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 5bba0c70..06cd902a 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -575,6 +575,32 @@ public class Mob extends AbstractIntelligenceAgent { return mob; } + public static Mob createStrongholdMob(int loadID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, Building building, int contractID, String pirateName, int level) { + + // Create a new Mob instance + Mob mobWithoutID = new Mob(pirateName, "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, guild, (byte) 0, loadID, isMob, parent, building, contractID); + + // Check if mobBase is null + if (mobWithoutID.mobBase == null) + return null; + + // Set mob level + mobWithoutID.level = (short) level; + + // Set the parent zone and parentZoneID + mobWithoutID.parentZone = parent; + mobWithoutID.parentZoneID = parent.getObjectUUID(); + + // If the mob is in a building, bind it to zero position + if (mobWithoutID.building != null) + mobWithoutID.bindLoc = Vector3fImmutable.ZERO; + + // Avoid database actions and directly return the created mobWithoutID + mobWithoutID.setObjectTypeMask(MBServerStatics.MASK_MOB | mobWithoutID.getTypeMasks()); + + return mobWithoutID; + } + public static Mob createPet(int loadID, Guild guild, Zone parent, PlayerCharacter owner, short level) { MobBase mobBase = MobBase.getMobBase(loadID); Mob mob = null;