Browse Source

Removed leftover junk from mobbase.

master
MagicBot 2 years ago
parent
commit
6b146bfdc4
  1. 104
      src/engine/db/handlers/dbMobBaseHandler.java
  2. 75
      src/engine/objects/MobBase.java
  3. 57
      src/engine/objects/MobbaseGoldEntry.java
  4. 7
      src/engine/server/world/WorldServer.java

104
src/engine/db/handlers/dbMobBaseHandler.java

@ -80,14 +80,6 @@ public class dbMobBaseHandler extends dbHandlerBase { @@ -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<Integer, Integer> LOAD_STATIC_POWERS(int mobBaseUUID) {
HashMap<Integer, Integer> powersList = new HashMap<>();
prepareCallable("SELECT * FROM `static_npc_mobbase_powers` WHERE `mobbaseUUID`=?");
@ -108,28 +100,6 @@ public class dbMobBaseHandler extends dbHandlerBase { @@ -108,28 +100,6 @@ public class dbMobBaseHandler extends dbHandlerBase {
}
public ArrayList<MobBaseEffects> LOAD_STATIC_EFFECTS(int mobBaseUUID) {
ArrayList<MobBaseEffects> 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<MobBaseEffects> GET_RUNEBASE_EFFECTS(int runeID) {
ArrayList<MobBaseEffects> effectsList = new ArrayList<>();
prepareCallable("SELECT * FROM `static_npc_mobbase_effects` WHERE `mobbaseUUID` = ?");
@ -182,13 +152,6 @@ public class dbMobBaseHandler extends dbHandlerBase { @@ -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 { @@ -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<MobLootBase> 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<MobLootBase> 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 { @@ -252,40 +185,5 @@ public class dbMobBaseHandler extends dbHandlerBase {
} finally {
closeCallable();
}
}
public HashMap<Integer, MobbaseGoldEntry> LOAD_GOLD_FOR_MOBBASE() {
HashMap<Integer, MobbaseGoldEntry> 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;
}
}

75
src/engine/objects/MobBase.java

@ -31,15 +31,9 @@ public class MobBase extends AbstractGameObject { @@ -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<Enum.MobFlagType> flags;
private int mask;
private int goldMod;
private int seeInvis;
private int spawnTime = 0;
@ -47,12 +41,9 @@ public class MobBase extends AbstractGameObject { @@ -47,12 +41,9 @@ public class MobBase extends AbstractGameObject {
private int atr = 0;
private float minDmg = 0;
private float maxDmg = 0;
private ArrayList<MobBaseEffects> raceEffectsList;
private float attackRange;
private boolean isNecroPet = false;
private MobBaseStats mobBaseStats;
private ArrayList<RuneBase> runes;
private HashMap<Integer, Integer> staticPowers;
private float walk = 0;
@ -75,12 +66,12 @@ public class MobBase extends AbstractGameObject { @@ -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 { @@ -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 { @@ -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 { @@ -174,14 +146,6 @@ public class MobBase extends AbstractGameObject {
return equip;
}
public HashMap<Integer, Integer> 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 { @@ -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 { @@ -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<Enum.MobFlagType> 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 { @@ -265,8 +214,6 @@ public class MobBase extends AbstractGameObject {
return this.spawnTime;
}
/*
* Database
*/
@ -324,20 +271,6 @@ public class MobBase extends AbstractGameObject { @@ -324,20 +271,6 @@ public class MobBase extends AbstractGameObject {
this.defense = defense;
}
/**
* @return the raceEffectsList
*/
public ArrayList<MobBaseEffects> getRaceEffectsList() {
return raceEffectsList;
}
/**
* @return the runes
*/
public ArrayList<RuneBase> getRunes() {
return runes;
}
public float getAttackRange() {
return attackRange;
}

57
src/engine/objects/MobbaseGoldEntry.java

@ -1,57 +0,0 @@ @@ -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<Integer, MobbaseGoldEntry> 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;
}
}

7
src/engine/server/world/WorldServer.java

@ -288,13 +288,6 @@ public class WorldServer { @@ -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();

Loading…
Cancel
Save