From e2d843b65e2f6a89f82209797828113aceb98f66 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 26 Aug 2023 12:03:33 -0400 Subject: [PATCH] Signature refactor. --- .../handlers/MinionTrainingMsgHandler.java | 35 +------------------ src/engine/objects/Mob.java | 21 +++++------ 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/src/engine/net/client/handlers/MinionTrainingMsgHandler.java b/src/engine/net/client/handlers/MinionTrainingMsgHandler.java index 76f1d928..66db649a 100644 --- a/src/engine/net/client/handlers/MinionTrainingMsgHandler.java +++ b/src/engine/net/client/handlers/MinionTrainingMsgHandler.java @@ -8,7 +8,6 @@ import engine.gameManager.BuildingManager; import engine.gameManager.DbManager; import engine.gameManager.NPCManager; import engine.gameManager.SessionManager; -import engine.math.Vector3fImmutable; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; @@ -146,42 +145,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler { if (mobBase == 0) return true; - Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1); + Mob siegeMob = Mob.createSiegeMinion(npc, mobBase); if (siegeMob == null) return true; - - if (siegeMob != null) { - - siegeMob.setSpawnTime(60 * 15); - Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID()); - - siegeMob.building = building; - siegeMob.parentZone = zone; - - // Slot siege minion - // Can be either corner tower or bulwark. - - int slot; - - if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER)) - slot = 2; - else - slot = ((NPC) siegeMob.guardCaptain).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain - - BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot); - siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation()); - - // Rotate slot position by the building rotation - - siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY); - - siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc); - siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc); - - zone.zoneMobSet.add(siegeMob); - siegeMob.setLoc(siegeMob.bindLoc); - } } ManageNPCMsg mnm = new ManageNPCMsg(npc); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 743f795b..4a1b0f72 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -663,38 +663,39 @@ public class Mob extends AbstractIntelligenceAgent { return minionMobile; } - public static synchronized Mob createSiegeMob(NPC owner, int loadID, Guild guild, Zone parent, Vector3fImmutable loc, short level) { + public static synchronized Mob createSiegeMinion(NPC artyCaptain, int loadID) { Mob siegeMinion; - if (owner.getSiegeMinionMap().size() == 3) + if (artyCaptain.getSiegeMinionMap().size() == 3) return null; siegeMinion = new Mob(); siegeMinion.level = 1; siegeMinion.loadID = loadID; - siegeMinion.guildUUID = guild.getObjectUUID(); + siegeMinion.guildUUID = artyCaptain.guildUUID; siegeMinion.equipmentSetID = 0; - siegeMinion.buildingUUID = owner.buildingUUID; - siegeMinion.guardCaptain = owner; - siegeMinion.parentZoneUUID = parent.getObjectUUID(); + siegeMinion.buildingUUID = artyCaptain.buildingUUID; + siegeMinion.guardCaptain = artyCaptain; + siegeMinion.parentZoneUUID = artyCaptain.parentZoneUUID; siegeMinion.behaviourType = MobBehaviourType.SiegeEngine; siegeMinion.bindLoc = Vector3fImmutable.ZERO; + siegeMinion.spawnTime = (60 * 15); int slot = 0; - if (!owner.getSiegeMinionMap().containsValue(1)) + if (!artyCaptain.getSiegeMinionMap().containsValue(1)) slot = 1; - else if (!owner.getSiegeMinionMap().containsValue(2)) + else if (!artyCaptain.getSiegeMinionMap().containsValue(2)) slot = 2; - owner.getSiegeMinionMap().put(siegeMinion, slot); + artyCaptain.getSiegeMinionMap().put(siegeMinion, slot); siegeMinion.runAfterLoad(); - siegeMinion.despawned = true; DbManager.addToCache(siegeMinion); siegeMinion.setLoc(siegeMinion.bindLoc); + siegeMinion.despawn(); return siegeMinion; }