From 5d0166a29a705a2ca8717e6cc38ec31be9a78d2d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 14 Apr 2023 16:46:10 -0400 Subject: [PATCH] EquipmentSets merged into bootySet system. --- src/engine/db/handlers/dbItemBaseHandler.java | 17 +++++------ src/engine/gameManager/NPCManager.java | 2 +- src/engine/objects/EquipmentSetEntry.java | 29 ------------------- src/engine/objects/MobBase.java | 6 ++-- 4 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 src/engine/objects/EquipmentSetEntry.java diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index a54c8185..0bb90bcb 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -10,7 +10,6 @@ package engine.db.handlers; import engine.objects.BootySetEntry; -import engine.objects.EquipmentSetEntry; import engine.objects.ItemBase; import org.pmw.tinylog.Logger; @@ -108,16 +107,16 @@ public class dbItemBaseHandler extends dbHandlerBase { } } - public HashMap> LOAD_EQUIPMENT_FOR_NPC_AND_MOBS() { + public HashMap> LOAD_EQUIPMENT_FOR_NPC_AND_MOBS() { - HashMap> equipmentSets; - EquipmentSetEntry equipmentSetEntry; + HashMap> equipmentSets; + BootySetEntry equipmentSetEntry; int equipSetID; equipmentSets = new HashMap<>(); int recordsRead = 0; - prepareCallable("SELECT * FROM static_npc_equipmentset"); + prepareCallable("SELECT * FROM static_npc_bootySet WHERE bootyType='EQUIP'"); try { ResultSet rs = executeQuery(); @@ -126,16 +125,16 @@ public class dbItemBaseHandler extends dbHandlerBase { recordsRead++; - equipSetID = rs.getInt("equipmentSet"); - equipmentSetEntry = new EquipmentSetEntry(rs); + equipSetID = rs.getInt("bootySet"); + equipmentSetEntry = new BootySetEntry(rs); if (equipmentSets.get(equipSetID) == null){ - ArrayList equipList = new ArrayList<>(); + ArrayList equipList = new ArrayList<>(); equipList.add(equipmentSetEntry); equipmentSets.put(equipSetID, equipList); } else{ - ArrayListequipList = equipmentSets.get(equipSetID); + ArrayListequipList = equipmentSets.get(equipSetID); equipList.add(equipmentSetEntry); equipmentSets.put(equipSetID, equipList); } diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 7262f2d8..b537a458 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -18,7 +18,7 @@ import java.util.HashMap; public enum NPCManager { NPC_MANAGER; - public static HashMap> _equipmentSetMap = new HashMap<>(); + public static HashMap> _equipmentSetMap = new HashMap<>(); public static HashMap> _runeSetMap = new HashMap<>(); public static HashMap> _bootySetMap = new HashMap<>(); diff --git a/src/engine/objects/EquipmentSetEntry.java b/src/engine/objects/EquipmentSetEntry.java deleted file mode 100644 index aae0ed3d..00000000 --- a/src/engine/objects/EquipmentSetEntry.java +++ /dev/null @@ -1,29 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - - -package engine.objects; - -import java.sql.ResultSet; -import java.sql.SQLException; - -public class EquipmentSetEntry { - - public int itemID; - public float dropChance; - - /** - * ResultSet Constructor - */ - - public EquipmentSetEntry(ResultSet rs) throws SQLException { - this.itemID = (rs.getInt("itemID")); - this.dropChance = (rs.getFloat("dropChance")); - } - -} diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index a200bf2a..e8c02e4f 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -146,7 +146,7 @@ public class MobBase extends AbstractGameObject { public static HashMap loadEquipmentSet(int equipmentSetID){ - ArrayList equipList; + ArrayList equipList; HashMap equip = new HashMap<>(); if (equipmentSetID == 0) @@ -157,9 +157,9 @@ public class MobBase extends AbstractGameObject { if (equipList == null) return equip; - for (EquipmentSetEntry equipmentSetEntry : equipList) { + for (BootySetEntry equipmentSetEntry : equipList) { - MobEquipment mobEquipment = new MobEquipment(equipmentSetEntry.itemID, equipmentSetEntry.dropChance); + MobEquipment mobEquipment = new MobEquipment(equipmentSetEntry.itemBase, equipmentSetEntry.dropChance); ItemBase itemBase = mobEquipment.getItemBase(); if (itemBase != null) {