From f4da8544d331552848ee1de3c88602ce84b0dad7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 10:14:40 -0400 Subject: [PATCH 1/4] Fidelity > Fidality --- src/engine/objects/Mob.java | 47 ++++--------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 81d9dde0..01e9bf9c 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -214,7 +214,6 @@ public class Mob extends AbstractIntelligenceAgent { super(rs); - try { this.dbID = rs.getInt(1); this.state = STATE.Idle; this.loadID = rs.getInt("mob_mobbaseID"); @@ -256,13 +255,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,7 +287,6 @@ public class Mob extends AbstractIntelligenceAgent { this.setParentZone(ZoneManager.getZoneByUUID(this.parentZoneID)); - this.fidalityID = rs.getInt("fidalityID"); this.equipmentSetID = rs.getInt("equipmentSet"); @@ -304,34 +296,7 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSet = (rs.getInt("lootSet")); - if (this.fidalityID != 0) - this.nameOverride = rs.getString("mob_name"); - - if (this.fidalityID != 0) { - - Zone parentZone = ZoneManager.getZoneByUUID(this.parentZoneID); - if (parentZone != null) { - this.fidelityRunes = WorldServer.ZoneFidelityMobRunes.get(parentZone.getLoadNum()).get(this.fidalityID); - - if (this.fidelityRunes != null) - for (Integer runeID : this.fidelityRunes) { - if (runeID == 252623) { - this.isGuard = true; - this.noAggro = true; - } - } - } - } - } catch (Exception e) { - Logger.error(currentID + ""); - } - - try { - initializeMob(false, false, this.isPlayerGuard); - } catch (Exception e) { - Logger.error(e); - } - + this.nameOverride = rs.getString("mob_name"); } public static void __serializeForClientMsg(Mob mob, ByteBufferWriter writer) throws SerializationException { @@ -821,7 +786,7 @@ public class Mob extends AbstractIntelligenceAgent { Vector3fImmutable returnLoc = Vector3fImmutable.ZERO; - if (mob.fidalityID != 0 && mob.building != null) { + if (mob.building != null) { Vector3fImmutable spawnRadiusLoc = Vector3fImmutable.getRandomPointInCircle(mob.localLoc, mob.spawnRadius); @@ -909,7 +874,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) { int maxSlots; maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank()); @@ -2775,10 +2740,6 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSync = lootSync; } - public int getFidalityID() { - return fidalityID; - } - public HashMap getEquip() { return equip; } From 2befa063ef2e47db3d468ed48d108d2c5c3f6d6e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 10:28:46 -0400 Subject: [PATCH 2/4] 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() { From 5a0910eb5c99acaaac5129a6cfcfc698c4623417 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 10:32:08 -0400 Subject: [PATCH 3/4] Revert "Fidelity > Fidality" This reverts commit f4da8544d331552848ee1de3c88602ce84b0dad7. --- src/engine/objects/Mob.java | 47 +++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index ca142371..d148fe03 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -214,6 +214,7 @@ public class Mob extends AbstractIntelligenceAgent { super(rs); + try { this.dbID = rs.getInt(1); this.state = STATE.Idle; this.loadID = rs.getInt("mob_mobbaseID"); @@ -255,7 +256,13 @@ public class Mob extends AbstractIntelligenceAgent { int guildID = rs.getInt("mob_guildUID"); - if (this.building != null) + + if (this.fidalityID != 0) { + if (this.building != null) + this.guild = this.building.getGuild(); + else + this.guild = Guild.getGuild(guildID); + } else if (this.building != null) this.guild = this.building.getGuild(); else this.guild = Guild.getGuild(guildID); @@ -287,6 +294,7 @@ public class Mob extends AbstractIntelligenceAgent { this.setParentZone(ZoneManager.getZoneByUUID(this.parentZoneID)); + this.fidalityID = rs.getInt("fidalityID"); this.equipmentSetID = rs.getInt("equipmentSet"); @@ -296,7 +304,34 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSet = (rs.getInt("lootSet")); - this.nameOverride = rs.getString("mob_name"); + if (this.fidalityID != 0) + this.nameOverride = rs.getString("mob_name"); + + if (this.fidalityID != 0) { + + Zone parentZone = ZoneManager.getZoneByUUID(this.parentZoneID); + if (parentZone != null) { + this.fidelityRunes = WorldServer.ZoneFidelityMobRunes.get(parentZone.getLoadNum()).get(this.fidalityID); + + if (this.fidelityRunes != null) + for (Integer runeID : this.fidelityRunes) { + if (runeID == 252623) { + this.isGuard = true; + this.noAggro = true; + } + } + } + } + } catch (Exception e) { + Logger.error(currentID + ""); + } + + try { + initializeMob(false, false, this.isPlayerGuard); + } catch (Exception e) { + Logger.error(e); + } + } public static void __serializeForClientMsg(Mob mob, ByteBufferWriter writer) throws SerializationException { @@ -786,7 +821,7 @@ public class Mob extends AbstractIntelligenceAgent { Vector3fImmutable returnLoc = Vector3fImmutable.ZERO; - if (mob.building != null) { + if (mob.fidalityID != 0 && mob.building != null) { Vector3fImmutable spawnRadiusLoc = Vector3fImmutable.getRandomPointInCircle(mob.localLoc, mob.spawnRadius); @@ -874,7 +909,7 @@ public class Mob extends AbstractIntelligenceAgent { this.level = 1; //add this npc to building - if (this.building != null && this.loadID != 0) { + if (this.building != null && this.loadID != 0 && this.fidalityID == 0) { int maxSlots; maxSlots = building.getBlueprint().getSlotsForRank(this.building.getRank()); @@ -2755,6 +2790,10 @@ public class Mob extends AbstractIntelligenceAgent { this.lootSync = lootSync; } + public int getFidalityID() { + return fidalityID; + } + public HashMap getEquip() { return equip; } From f5d5dce79148ffdce539020463c7b60e311ced2e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 30 Mar 2023 10:34:15 -0400 Subject: [PATCH 4/4] Revert "Fidality borking mobs in buildings unborked." This reverts commit 2befa063ef2e47db3d468ed48d108d2c5c3f6d6e. --- src/engine/devcmd/cmds/InfoCmd.java | 3 +- src/engine/net/client/ClientMessagePump.java | 12 +++++++- src/engine/objects/Mob.java | 31 +++++--------------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index c44d413b..656e7520 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -455,7 +455,8 @@ 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 ded3913a..adbe76ee 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,10 +1148,20 @@ 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 d148fe03..81d9dde0 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1257,32 +1257,17 @@ 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.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); + 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); } public int getParentZoneID() {