From a85391e5a4a36dfc3817791a1d18f40a849fca23 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 5 Apr 2023 19:49:20 -0400 Subject: [PATCH] Workaround for mob region issue. --- .../net/client/msg/LoadCharacterMsg.java | 25 ++++++++++++++----- src/engine/objects/NPC.java | 5 ---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/engine/net/client/msg/LoadCharacterMsg.java b/src/engine/net/client/msg/LoadCharacterMsg.java index 0471da38..59c5dc2e 100644 --- a/src/engine/net/client/msg/LoadCharacterMsg.java +++ b/src/engine/net/client/msg/LoadCharacterMsg.java @@ -9,6 +9,7 @@ package engine.net.client.msg; +import engine.Enum; import engine.Enum.GameObjectType; import engine.exception.SerializationException; import engine.net.AbstractConnection; @@ -102,13 +103,25 @@ public class LoadCharacterMsg extends ClientNetMsg { } } //TODO below is Mob Region Serialization, not implemented. default to -1, which is ground. - }else{ - writer.putInt(-1); - writer.putInt(-1); + }else { + + Mob mobile = (Mob) absChar; + + if (mobile.building != null && + mobile.building.getBlueprint() != null) { + + Blueprint blueprint = mobile.building.getBlueprint(); + + if (blueprint.getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER)) { + writer.putInt(-0); + writer.putInt(-0); + return; + } + + writer.putInt(-1); + writer.putInt(-1); + } } - - - } else if (corpse != null){ writer.putInt(-1); diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 4687945e..7ee76473 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -1451,11 +1451,6 @@ public class NPC extends AbstractCharacter { else if (!siegeMinionMap.containsValue(2)) slot = 2; - // Corner trebs always are slot 1 - - if (this.building.getBlueprint().getBuildingGroup().equals(BuildingGroup.ARTYTOWER)) - slot = 1; - siegeMinionMap.put(mob, slot); mob.setInBuildingLoc(this.building, this);