From 6b146bfdc49189447e84756992053de411d42369 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 24 Apr 2023 03:26:35 -0400 Subject: [PATCH] Removed leftover junk from mobbase. --- src/engine/db/handlers/dbMobBaseHandler.java | 104 +------------------ src/engine/objects/MobBase.java | 75 +------------ src/engine/objects/MobbaseGoldEntry.java | 57 ---------- src/engine/server/world/WorldServer.java | 7 -- 4 files changed, 5 insertions(+), 238 deletions(-) delete mode 100644 src/engine/objects/MobbaseGoldEntry.java diff --git a/src/engine/db/handlers/dbMobBaseHandler.java b/src/engine/db/handlers/dbMobBaseHandler.java index 6a7c5a69..001bf0a6 100644 --- a/src/engine/db/handlers/dbMobBaseHandler.java +++ b/src/engine/db/handlers/dbMobBaseHandler.java @@ -80,14 +80,6 @@ public class dbMobBaseHandler extends dbHandlerBase { } - public boolean UPDATE_FLAGS(int mobBaseID, long flags) { - prepareCallable("UPDATE `static_npc_mobbase` SET `flags` = ? WHERE `ID` = ?"); - setLong(1, flags); - setInt(2, mobBaseID); - return (executeUpdate() > 0); - - } - public HashMap LOAD_STATIC_POWERS(int mobBaseUUID) { HashMap powersList = new HashMap<>(); prepareCallable("SELECT * FROM `static_npc_mobbase_powers` WHERE `mobbaseUUID`=?"); @@ -108,28 +100,6 @@ public class dbMobBaseHandler extends dbHandlerBase { } - public ArrayList LOAD_STATIC_EFFECTS(int mobBaseUUID) { - ArrayList effectsList = new ArrayList<>(); - - prepareCallable("SELECT * FROM `static_npc_mobbase_effects` WHERE `mobbaseUUID` = ?"); - setInt(1, mobBaseUUID); - - try { - ResultSet rs = executeQuery(); - while (rs.next()) { - MobBaseEffects mbs = new MobBaseEffects(rs); - effectsList.add(mbs); - } - rs.close(); - } catch (SQLException e) { - Logger.error( e.getMessage()); - } finally { - closeCallable(); - } - return effectsList; - - } - public ArrayList GET_RUNEBASE_EFFECTS(int runeID) { ArrayList effectsList = new ArrayList<>(); prepareCallable("SELECT * FROM `static_npc_mobbase_effects` WHERE `mobbaseUUID` = ?"); @@ -182,13 +152,6 @@ public class dbMobBaseHandler extends dbHandlerBase { return (executeUpdate() > 0); } - public boolean ADD_MOBBASE_RUNE(int mobBaseUUID, int runeID) { - prepareCallable("INSERT INTO `static_npc_mobbase_runes` (`mobbaseUUID`, `runeID`) VALUES (?, ?);"); - setInt(1, mobBaseUUID); - setInt(2, runeID); - return (executeUpdate() > 0); - } - public boolean RENAME_MOBBASE(int ID, String newName) { prepareCallable("UPDATE `static_npc_mobbase` SET `name`=? WHERE `ID`=?;"); setString(1, newName); @@ -196,43 +159,13 @@ public class dbMobBaseHandler extends dbHandlerBase { return (executeUpdate() > 0); } - - public void LOAD_ALL_MOBBASE_LOOT(int mobBaseID) { - - if (mobBaseID == 0) - return; - ArrayList mobLootList = new ArrayList<>(); - prepareCallable("SELECT * FROM `static_mob_loottable` WHERE `mobBaseID` = ?"); - setInt(1,mobBaseID); - - try { - ResultSet rs = executeQuery(); - - //shrines cached in rs for easy cache on creation. - while (rs.next()) { - - MobLootBase mobLootBase = new MobLootBase(rs); - mobLootList.add(mobLootBase); - - } - - MobLootBase.MobLootSet.put(mobBaseID, mobLootList); - - } catch (SQLException e) { - Logger.error( e.getErrorCode() + ' ' + e.getMessage(), e); - } finally { - closeCallable(); - } - - } - public void LOAD_ALL_MOBBASE_SPEEDS(MobBase mobBase) { if (mobBase.getLoadID() == 0) return; ArrayList mobLootList = new ArrayList<>(); prepareCallable("SELECT * FROM `static_npc_mobbase_race` WHERE `mobbaseID` = ?"); - setInt(1,mobBase.getLoadID()); + setInt(1, mobBase.getLoadID()); try { ResultSet rs = executeQuery(); @@ -252,40 +185,5 @@ public class dbMobBaseHandler extends dbHandlerBase { } finally { closeCallable(); } - - } - - public HashMap LOAD_GOLD_FOR_MOBBASE() { - - HashMap goldSets; - MobbaseGoldEntry goldSetEntry; - int mobbaseID; - - goldSets = new HashMap<>(); - int recordsRead = 0; - - prepareCallable("SELECT * FROM static_npc_mobbase_gold"); - - try { - ResultSet rs = executeQuery(); - - while (rs.next()) { - - recordsRead++; - - mobbaseID = rs.getInt("mobbaseID"); - goldSetEntry = new MobbaseGoldEntry(rs); - goldSets.put(mobbaseID, goldSetEntry); - - } - - Logger.info("read: " + recordsRead + " cached: " + goldSets.size()); - - } catch (SQLException e) { - Logger.error(e.getErrorCode() + ' ' + e.getMessage(), e); - } finally { - closeCallable(); - } - return goldSets; } } diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index b1686a5e..3587815c 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -31,15 +31,9 @@ public class MobBase extends AbstractGameObject { private float damageMin; private float damageMax; private float hitBoxRadius; - private final int lootTable; private final float scale; - - private int minGold; - private int maxGold; - private EnumBitSet flags; private int mask; - private int goldMod; private int seeInvis; private int spawnTime = 0; @@ -47,12 +41,9 @@ public class MobBase extends AbstractGameObject { private int atr = 0; private float minDmg = 0; private float maxDmg = 0; - private ArrayList raceEffectsList; private float attackRange; private boolean isNecroPet = false; - private MobBaseStats mobBaseStats; - private ArrayList runes; private HashMap staticPowers; private float walk = 0; @@ -75,12 +66,12 @@ public class MobBase extends AbstractGameObject { this.firstName = rs.getString("name"); this.level = rs.getByte("level"); - this.lootTable = rs.getInt("lootTableID"); this.goldMod = rs.getInt("goldMod"); this.spawnTime = rs.getInt("spawnTime"); LevelDefault levelDefault = LevelDefault.getLevelDefault(this.level); + this.healthMax = rs.getInt("health"); this.damageMin = rs.getFloat("minDmg"); this.damageMax = rs.getFloat("maxDmg"); @@ -92,26 +83,9 @@ public class MobBase extends AbstractGameObject { this.fsm = Enum.MobBehaviourType.valueOf(rs.getString("fsm")); - if (MobbaseGoldEntry.MobbaseGoldMap.containsKey(this.loadID)){ - MobbaseGoldEntry goldEntry = MobbaseGoldEntry.MobbaseGoldMap.get(this.loadID); - - if (goldEntry != null){ - this.minGold = goldEntry.getMin(); - this.maxGold = goldEntry.getMax(); - } - } - else - if (levelDefault != null) { - this.minGold = (levelDefault.goldMin * this.goldMod / 100); - this.maxGold = (levelDefault.goldMax * this.goldMod / 100); - } else { - this.minGold = 10; - this.maxGold = 30; - } - - this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), Enum.MobFlagType.class); - this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class); - this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class); + this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), Enum.MobFlagType.class); + this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class); + this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class); this.seeInvis = rs.getInt("seeInvis"); this.scale = rs.getFloat("scale"); @@ -137,9 +111,7 @@ public class MobBase extends AbstractGameObject { if (Enum.MobFlagType.RAT.elementOf(this.flags)) this.mask += MBServerStatics.MASK_RAT; - this.raceEffectsList = DbManager.MobBaseQueries.LOAD_STATIC_EFFECTS(this.loadID); this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID); - DbManager.MobBaseQueries.LOAD_ALL_MOBBASE_LOOT(this.loadID); DbManager.MobBaseQueries.LOAD_ALL_MOBBASE_SPEEDS(this); } @@ -174,14 +146,6 @@ public class MobBase extends AbstractGameObject { return equip; } - public HashMap getStaticPowers() { - return staticPowers; - } - - public void updateStaticEffects() { - this.raceEffectsList = DbManager.MobBaseQueries.LOAD_STATIC_EFFECTS(this.getObjectUUID()); - } - public void updatePowers() { this.staticPowers = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(this.getObjectUUID()); } @@ -209,10 +173,6 @@ public class MobBase extends AbstractGameObject { return this.level; } - public int getLootTable() { - return this.lootTable; - } - public float getHealthMax() { return this.healthMax; } @@ -233,22 +193,11 @@ public class MobBase extends AbstractGameObject { return this.defenseRating; } - public int getMinGold() { - return this.minGold; - } - - public int getMaxGold() { - return this.maxGold; - } public EnumBitSet getFlags() { return this.flags; } - public int getGoldMod() { - return this.goldMod; - } - public float getScale() { return this.scale; } @@ -265,8 +214,6 @@ public class MobBase extends AbstractGameObject { return this.spawnTime; } - - /* * Database */ @@ -324,20 +271,6 @@ public class MobBase extends AbstractGameObject { this.defense = defense; } - /** - * @return the raceEffectsList - */ - public ArrayList getRaceEffectsList() { - return raceEffectsList; - } - - /** - * @return the runes - */ - public ArrayList getRunes() { - return runes; - } - public float getAttackRange() { return attackRange; } diff --git a/src/engine/objects/MobbaseGoldEntry.java b/src/engine/objects/MobbaseGoldEntry.java deleted file mode 100644 index 5a6a1dbd..00000000 --- a/src/engine/objects/MobbaseGoldEntry.java +++ /dev/null @@ -1,57 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - - -package engine.objects; - -import engine.gameManager.DbManager; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; - -public class MobbaseGoldEntry { - - private float chance; - private int min; - private int max; - - public static HashMap MobbaseGoldMap = new HashMap<>(); - - /** - * ResultSet Constructor - */ - - public MobbaseGoldEntry(ResultSet rs) throws SQLException { - - this.chance = rs.getFloat("chance"); - this.min = rs.getInt("min"); - this.max = (rs.getInt("max")); - } - - public static void LoadMobbaseGold() { - MobbaseGoldMap = DbManager.MobBaseQueries.LOAD_GOLD_FOR_MOBBASE(); - } - - public float getChance() { - return chance; - } - - public int getMin() { - return min; - } - - public int getMax() { - return max; - } - - - - - -} diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index af4224a2..22570711 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -288,13 +288,6 @@ public class WorldServer { Logger.info("Loading Mobile Booty Sets"); NPCManager.LoadAllBootySets(); - Logger.info("Loading Gold Loot for Mobbases"); - MobbaseGoldEntry.LoadMobbaseGold(); - - //load lootTable - //Logger.info("Loading Loot Tables"); - //LootTable.populateLootTables(); - // Load new loot system Logger.info("Loading New Loot Tables"); LootManager.loadLootData();