From 2befa063ef2e47db3d468ed48d108d2c5c3f6d6e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 10:28:46 -0400 Subject: [PATCH] Fidality borking mobs in buildings unborked. --- src/engine/devcmd/cmds/InfoCmd.java | 3 +- src/engine/net/client/ClientMessagePump.java | 12 +------- src/engine/objects/Mob.java | 31 +++++++++++++++----- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 656e7520..c44d413b 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -455,8 +455,7 @@ public class InfoCmd extends AbstractDevCmd { output += newline; output += "Speed : " + targetMob.getSpeed(); - output += newline; - output += "Fidelity ID: " + targetMob.getFidalityID(); + output += newline; output += "EquipSet: " + targetMob.getEquipmentSetID(); output += newline; diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index adbe76ee..ded3913a 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1130,7 +1130,7 @@ public class ClientMessagePump implements NetMsgHandler { //Take equipment off mob if (tar.getObjectType() == GameObjectType.Mob && itemRet != null){ Mob mobTarget = (Mob)tar; - if (mobTarget.getFidalityID() != 0){ + if (item != null && item.getObjectType() == GameObjectType.MobLoot){ int fidelityEquipID = ((MobLoot)item).getFidelityEquipID(); @@ -1148,20 +1148,10 @@ public class ClientMessagePump implements NetMsgHandler { } } } - - - } } - - } } - - } - else { - } - } else if (targetType == GameObjectType.Corpse.ordinal()) { corpse = Corpse.getCorpse(targetID); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 01e9bf9c..ca142371 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1222,17 +1222,32 @@ public class Mob extends AbstractIntelligenceAgent { return this.parentZone; } + + public void setParentZone(Zone zone) { - if (this.parentZone == null) { - zone.zoneMobSet.add(this); - this.parentZone = zone; - } + if (this.parentZone == null){ + zone.zoneMobSet.add(this); + this.parentZone = zone; + } + + if (this.building != null) { + + Vector3fImmutable localLoc = new Vector3fImmutable(this.statLat,this.statAlt,this.statLon); + Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(this.building, localLoc); + this.setBindLoc(buildingWorldLoc); + this.setLoc(buildingWorldLoc); + this.stopMovement(buildingWorldLoc); + return; + } + + Vector3fImmutable localLoc = new Vector3fImmutable(this.statLat + zone.absX, this.statAlt + zone.absY, this.statLon + zone.absZ); + Vector3fImmutable spawnRadiusLoc = Vector3fImmutable.getRandomPointInCircle(localLoc, this.spawnRadius); + + this.setBindLoc(spawnRadiusLoc); + this.setLoc(spawnRadiusLoc); + this.stopMovement(spawnRadiusLoc); - this.bindLoc = Mob.GetSpawnRadiusLocation(this); - this.lastBindLoc = bindLoc; - this.setLoc(bindLoc); - this.stopMovement(bindLoc); } public int getParentZoneID() {