From dcae131b67134a8f4e32c0743ee7c817e2e16626 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 11:07:57 -0400 Subject: [PATCH] Removed Fidality garbage. Fixed mobs in buildings. --- src/engine/devcmd/cmds/InfoCmd.java | 2 - src/engine/net/client/ClientMessagePump.java | 17 +--- src/engine/objects/Mob.java | 102 +++++-------------- 3 files changed, 25 insertions(+), 96 deletions(-) diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 656e7520..d41e1ac8 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -456,8 +456,6 @@ 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; output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum(); diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index adbe76ee..51f9e993 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1130,15 +1130,12 @@ 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(); - if (fidelityEquipID != 0){ for (MobEquipment equip: mobTarget.getEquip().values()){ - if (equip.getObjectUUID() == fidelityEquipID){ - TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.getSlot()); + TransferItemFromEquipToInventoryMsg back = new TransferItemFromEquipToInventoryMsg(mobTarget, equip.getSlot()); DispatchMessage.dispatchMsgToInterestArea(mobTarget, back, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false); LootMsg lootMsg = new LootMsg(0,0,tar.getObjectType().ordinal(), tar.getObjectUUID(), equip); @@ -1146,23 +1143,13 @@ public class ClientMessagePump implements NetMsgHandler { DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); break; } - } } - - } } - } - } - } - else { - } - - } else if (targetType == GameObjectType.Corpse.ordinal()) { corpse = Corpse.getCorpse(targetID); if (corpse == null) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 8f1fb8e1..6c19d35c 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -105,7 +105,6 @@ public class Mob extends AbstractIntelligenceAgent { private DeferredPowerJob weaponPower; private DateTime upgradeDateTime = null; private boolean lootSync = false; - private int fidalityID = 0; private int equipmentSetID = 0; public int runeSetID = 0; public int bootySetID = 0; @@ -257,12 +256,7 @@ public class Mob extends AbstractIntelligenceAgent { int guildID = rs.getInt("mob_guildUID"); - if (this.fidalityID != 0) { - if (this.building != null) - this.guild = this.building.getGuild(); - else - this.guild = Guild.getGuild(guildID); - } else if (this.building != null) + if (this.building != null) this.guild = this.building.getGuild(); else this.guild = Guild.getGuild(guildID); @@ -294,9 +288,6 @@ public class Mob extends AbstractIntelligenceAgent { this.setParentZone(ZoneManager.getZoneByUUID(this.parentZoneID)); - - this.fidalityID = rs.getInt("fidalityID"); - this.equipmentSetID = rs.getInt("equipmentSet"); this.runeSetID = rs.getInt("runeSet"); this.bootySetID = rs.getInt("bootySet"); @@ -306,8 +297,7 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSet = (rs.getInt("lootSet")); - if (this.fidalityID != 0) - this.nameOverride = rs.getString("mob_name"); + this.nameOverride = rs.getString("mob_name"); } catch (Exception e) { Logger.error(currentID + ""); @@ -780,58 +770,6 @@ public class Mob extends AbstractIntelligenceAgent { mob.upgradeDateTime = upgradeDateTime; } - public static Vector3fImmutable GetSpawnRadiusLocation(Mob mob) { - - Vector3fImmutable returnLoc = Vector3fImmutable.ZERO; - - if (mob.fidalityID != 0 && mob.building != null) { - - - Vector3fImmutable spawnRadiusLoc = Vector3fImmutable.getRandomPointInCircle(mob.localLoc, mob.spawnRadius); - - Vector3fImmutable buildingWorldLoc = ZoneManager.convertLocalToWorld(mob.building, spawnRadiusLoc); - - return buildingWorldLoc; - - - } else { - - boolean run = true; - - while (run) { - Vector3fImmutable localLoc = new Vector3fImmutable(mob.statLat + mob.parentZone.absX, mob.statAlt + mob.parentZone.absY, mob.statLon + mob.parentZone.absZ); - Vector3fImmutable spawnRadiusLoc = Vector3fImmutable.getRandomPointInCircle(localLoc, mob.spawnRadius); - - //not a roaming mob, just return the random loc. - if (mob.spawnRadius < 12000) - return spawnRadiusLoc; - - Zone spawnZone = ZoneManager.findSmallestZone(spawnRadiusLoc); - //dont spawn roaming mobs in npc cities - if (spawnZone.isNPCCity()) - continue; - - //dont spawn roaming mobs in player cities. - if (spawnZone.isPlayerCity()) - continue; - - //don't spawn mobs in water. - if (HeightMap.isLocUnderwater(spawnRadiusLoc)) - continue; - - run = false; - - return spawnRadiusLoc; - - } - - } - - //shouldn't ever get here. - - return returnLoc; - } - private void clearStatic() { if (this.parentZone != null) @@ -872,7 +810,7 @@ public class Mob extends AbstractIntelligenceAgent { this.level = 1; //add this npc to building - if (this.building != null && this.loadID != 0 && this.fidalityID == 0) { + if (this.building != null && this.loadID != 0 && building.getBlueprintUUID() != 0) { int maxSlots; maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank()); @@ -1003,16 +941,29 @@ public class Mob extends AbstractIntelligenceAgent { public void setParentZone(Zone zone) { - if (this.parentZone == null) { + if (this.parentZone == null){ zone.zoneMobSet.add(this); this.parentZone = zone; } - this.bindLoc = Mob.GetSpawnRadiusLocation(this); - this.lastBindLoc = bindLoc; - this.setLoc(bindLoc); - this.stopMovement(bindLoc); - } + + 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.endLoc = buildingWorldLoc; + this.stopMovement(endLoc); + return; + } + + Vector3fImmutable localLoc = new Vector3fImmutable(this.statLat + zone.absX, this.statAlt + zone.absY, this.statLon + zone.absZ); + this.setBindLoc(localLoc); + this.setLoc(localLoc); + this.endLoc = localLoc; + this.stopMovement(endLoc); + } public int getParentZoneID() { @@ -1371,10 +1322,7 @@ public class Mob extends AbstractIntelligenceAgent { this.combatTarget = null; this.isAlive.set(true); - if (!this.isSiege) - this.lastBindLoc = Mob.GetSpawnRadiusLocation(this); - else - this.lastBindLoc = this.bindLoc; + this.lastBindLoc = this.bindLoc; this.bindLoc = this.lastBindLoc; this.setLoc(this.lastBindLoc); this.stopMovement(this.lastBindLoc); @@ -2510,10 +2458,6 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSync = lootSync; } - public int getFidalityID() { - return fidalityID; - } - public HashMap getEquip() { return equip; }