Drop the server-made mobbase rows and the dead mobbase columns

The 406 ID <> loadID mobbases (15000-17266) were junk: no RUNE file, nothing
on dev references them. MobBase now always reads its core fields from the
race rune and logs an error if the rune is missing; the loader skips any
ID <> loadID rows still present. GetClassType only matched those IDs, so it
always returned 2518 and is replaced by the constant.

DB: MBDATA/JSON-Refactor-Plan/sql/3.6-mobbase-cleanup.sql deletes the rows,
the 10 orphan static_npc_mobbase_effects rows (17061/17122/17154) and drops
13 columns no longer read: lootTableID, name, level, health, atr, defense,
minDmg, maxDmg, noaggro, raceType, fsm, notEnemy, enemy.

Value changes: none for the 2375 loaded mobbases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-23 14:03:27 -04:00
1 parent c811ba9f4e
commit ccc9d9f0ed
3 files changed
+14 -46

No files matched your search

+5 -10
View File
@@ -15,7 +15,6 @@ import engine.mbEnums.GameObjectType;
import engine.objects.MobBase;
import engine.objects.MobBaseEffects;
import engine.objects.MobBaseStats;
import engine.parsers.objects.RuneTemplate;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -42,7 +41,7 @@ public class dbMobBaseHandler extends dbHandlerBase {
return mobBase;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase` WHERE `ID`=?")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase` WHERE `ID`=? AND `ID` = `loadID`")) {
preparedStatement.setInt(1, id);
@@ -60,10 +59,11 @@ public class dbMobBaseHandler extends dbHandlerBase {
public ArrayList<MobBase> GET_ALL_MOBBASES() {
ArrayList<MobBase> mobbaseList = new ArrayList<>();
int runeCount = 0;
// ID <> loadID rows were junk server-made mobbases (15000-17266); skip them on databases that still have them.
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase`;")) {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase` WHERE `ID` = `loadID`;")) {
ResultSet rs = preparedStatement.executeQuery();
mobbaseList = getObjectsFromRs(rs, 1000);
@@ -72,12 +72,7 @@ public class dbMobBaseHandler extends dbHandlerBase {
Logger.error(e);
}
for (MobBase mobBase : mobbaseList)
if (mobBase.getObjectUUID() == mobBase.getLoadID() && RuneTemplate._runes.containsKey(mobBase.getLoadID()))
runeCount++;
Logger.info("Loaded " + mobbaseList.size() + " mobbases: " + runeCount + " from runes, "
+ (mobbaseList.size() - runeCount) + " server-made from the DB");
Logger.info("Loaded " + mobbaseList.size() + " mobbases");
return mobbaseList;
}
+1 -1
View File
@@ -181,7 +181,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneTwo.ordinal(), 252621); //guard rune
} else if (mob.contract != null || mob.isPlayerGuard()) {
writer.putInt(3);
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), 2518); //warrior class
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
} else
writer.putInt(1);
+8 -35
View File
@@ -16,6 +16,7 @@ import engine.loot.BootySetEntry;
import engine.mbEnums;
import engine.parsers.objects.RuneTemplate;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -63,11 +64,7 @@ public class MobBase extends AbstractGameObject {
String fsmName;
this.loadID = rs.getInt("loadID");
// Server-made mobbases (15000+) borrow a playable race rune as loadID; only their DB row describes them.
if (this.getObjectUUID() == this.loadID)
rune = RuneTemplate._runes.get(this.loadID);
rune = RuneTemplate._runes.get(this.loadID);
if (rune != null) {
this.firstName = rune.obj_name;
@@ -82,16 +79,12 @@ public class MobBase extends AbstractGameObject {
this.notEnemy = EnumSet.copyOf(rune.rune_not_enemy_monster_types);
this.enemy = EnumSet.copyOf(rune.rune_enemy_monster_types);
} else {
this.firstName = rs.getString("name");
this.level = rs.getByte("level");
this.healthMax = rs.getInt("health");
this.damageMin = rs.getFloat("minDmg");
this.damageMax = rs.getFloat("maxDmg");
this.attackRating = rs.getInt("atr");
this.defenseRating = rs.getInt("defense");
this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm"));
this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class);
this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class);
Logger.error("Mobbase " + this.getObjectUUID() + " has no race rune " + this.loadID);
this.firstName = "";
this.level = 0;
this.fsm = mbEnums.MobBehaviourType.None;
this.notEnemy = EnumSet.noneOf(mbEnums.MonsterType.class);
this.enemy = EnumSet.noneOf(mbEnums.MonsterType.class);
}
this.goldMod = rs.getInt("goldMod");
@@ -165,26 +158,6 @@ public class MobBase extends AbstractGameObject {
return DbManager.MobBaseQueries.GET_MOBBASE(id);
}
public static int GetClassType(int mobbaseID) {
switch (mobbaseID) {
case 17235:
case 17233:
case 17256:
case 17259:
case 17260:
case 17261:
return 2518;
case 17258:
case 17257:
case 17237:
case 17234:
return 2521;
default:
return 2518;
}
}
public void updateSpeeds(float walk, float walkCombat, float run, float runCombat) {
this.walk = walk;
this.walkCombat = walkCombat;