From 7f6fbd2bff4c5b6a36831cc58e273a181c3db04c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 24 Jan 2024 19:03:33 -0600 Subject: [PATCH 1/7] load mesh data and structure meshes --- src/engine/mobileAI/MobAI.java | 6 +++--- src/engine/objects/Mob.java | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 1f233837..6d37e96e 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -939,16 +939,16 @@ public class MobAI { //dont scan self. - if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true) + if (mob.equals(awoMob)) continue; Mob aggroMob = (Mob) awoMob; //don't attack other guards - - if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))) + if (aggroMob.isGuard() == true) continue; + //don't attack pets if (aggroMob.agentType.equals(Enum.AIAgentType.PET)) continue; diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 27f7d641..7ee7c33f 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1889,6 +1889,19 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { } } + public Boolean isGuard(){ + + switch(this.behaviourType){ + case GuardMinion: + case GuardCaptain: + case GuardWallArcher: + case HamletGuard: + case SimpleStandingGuard: + return true; + } + return false; + } + @Override public long getDelay(@NotNull TimeUnit unit) { long timeRemaining = this.respawnTime - System.currentTimeMillis(); From 165752f6d67c0ff6dab9d24fe438458bad9ae727 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 10:01:01 -0500 Subject: [PATCH 2/7] Null fix in dev command. --- src/engine/gameManager/BuildingManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index bde12730..62d14c32 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -545,7 +545,7 @@ public enum BuildingManager { NPC npc = null; - npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building); + npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building); if (npc == null) return false; From f845c0ad8077a582216ae3b32fe984663212bdc7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 10:15:55 -0500 Subject: [PATCH 3/7] Better handling of null guilds. --- src/engine/objects/NPC.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 7fb509e9..da0ea3ae 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -461,6 +461,8 @@ public class NPC extends AbstractCharacter { NPC newNPC = new NPC(); + newNPC.parentZoneUUID = parent.getObjectUUID(); + newNPC.name = name; newNPC.contractUUID = contractID; @@ -469,8 +471,10 @@ public class NPC extends AbstractCharacter { else newNPC.bindLoc = Vector3fImmutable.ZERO; - newNPC.parentZoneUUID = parent.getObjectUUID(); - newNPC.guildUUID = guild.getObjectUUID(); + if (guild == null) + newNPC.guildUUID = 0; + else + newNPC.guildUUID = guild.getObjectUUID(); if (building == null) newNPC.buildingUUID = 0; From 4ccf03dfd3ad1bf66fbb79d3e559ca748124335a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 10:31:02 -0500 Subject: [PATCH 4/7] Zone offset not world loc. --- src/engine/objects/NPC.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index da0ea3ae..c54d5925 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -467,7 +467,7 @@ public class NPC extends AbstractCharacter { newNPC.contractUUID = contractID; if (building == null) - newNPC.bindLoc = spawn; + newNPC.bindLoc = ZoneManager.worldToLocal(spawn, parent); else newNPC.bindLoc = Vector3fImmutable.ZERO; From 6a3bd890950161f54477935a5bfc1ace6ddb50a6 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 11:24:20 -0500 Subject: [PATCH 5/7] Handling of mobs not in buildings. --- src/engine/objects/Mob.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 7ee7c33f..c42db2f4 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -418,7 +418,11 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { mobile.guildUUID = guild.getObjectUUID(); mobile.parentZoneUUID = parent.getObjectUUID(); - mobile.buildingUUID = building.getObjectUUID(); + + if (building == null) + mobile.buildingUUID = 0; + else + mobile.buildingUUID = building.getObjectUUID(); if (mobile.buildingUUID != 0) mobile.bindLoc = Vector3fImmutable.ZERO; From 70e76d9a1a3fe2cf721c11174923e997ab9f46d4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 11:26:54 -0500 Subject: [PATCH 6/7] Handling of mobs not in buildings. --- src/engine/objects/Mob.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index c42db2f4..eb96da05 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -406,7 +406,6 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { Mob mobile = new Mob(); mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; - //mobile.agentType = AIAgentType.MOBILE; this method is only called to make guard captains and wall archers mobile.agentType = mobType; mobile.behaviourType = MobBehaviourType.None; mobile.loadID = loadID; @@ -427,7 +426,8 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { if (mobile.buildingUUID != 0) mobile.bindLoc = Vector3fImmutable.ZERO; else - mobile.bindLoc = spawn; + mobile.bindLoc = ZoneManager.worldToLocal(spawn, parent); + ; mobile.firstName = pirateName; From fcd37cbae21aa455a43be50684fa4110bbb33634 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 28 Jan 2024 11:30:54 -0500 Subject: [PATCH 7/7] Dev cmd cleanup --- src/engine/devcmd/cmds/AddMobCmd.java | 35 +++++---------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/engine/devcmd/cmds/AddMobCmd.java b/src/engine/devcmd/cmds/AddMobCmd.java index 1bb09c47..49e872d3 100644 --- a/src/engine/devcmd/cmds/AddMobCmd.java +++ b/src/engine/devcmd/cmds/AddMobCmd.java @@ -10,18 +10,15 @@ package engine.devcmd.cmds; import engine.Enum; -import engine.Enum.GameObjectType; import engine.devcmd.AbstractDevCmd; import engine.gameManager.ChatManager; -import engine.gameManager.DbManager; import engine.gameManager.ZoneManager; -import engine.math.Vector3fImmutable; -import engine.objects.*; +import engine.objects.AbstractGameObject; +import engine.objects.Mob; +import engine.objects.PlayerCharacter; +import engine.objects.Zone; import org.pmw.tinylog.Logger; -/** - * @author Eighty - */ public class AddMobCmd extends AbstractDevCmd { public AddMobCmd() { @@ -38,27 +35,8 @@ public class AddMobCmd extends AbstractDevCmd { Zone zone = ZoneManager.findSmallestZone(pc.getLoc()); - if (words[0].equals("all")) { - - for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) { - MobBase mb = (MobBase) mobbaseAGO; - int loadID = mb.getObjectUUID(); - Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100), - null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE); - if (mob != null) { - mob.updateDatabase(); - this.setResult(String.valueOf(mob.getDBID())); - } else { - throwbackError(pc, "Failed to create mob of type " + loadID); - Logger.error("Failed to create mob of type " - + loadID); - } - } - return; - } - - int loadID; + try { loadID = Integer.parseInt(words[0]); } catch (NumberFormatException e) { @@ -72,7 +50,6 @@ public class AddMobCmd extends AbstractDevCmd { return; // NaN } - if (zone == null) { throwbackError(pc, "Failed to find zone to place mob in."); return; @@ -83,9 +60,9 @@ public class AddMobCmd extends AbstractDevCmd { return; } - Mob mob = Mob.createMob(loadID, pc.getLoc(), null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE); + if (mob != null) { mob.updateDatabase(); ChatManager.chatSayInfo(pc,