BootySets generated with cache data loaded at bootstrap.

This commit is contained in:
2023-03-28 18:01:46 -04:00
parent 00d0048fd0
commit 8e236d0780
4 changed files with 83 additions and 0 deletions
@@ -10,6 +10,7 @@
package engine.db.handlers;
import engine.gameManager.NPCManager;
import engine.objects.BootySetEntry;
import engine.objects.EquipmentSetEntry;
import engine.objects.ItemBase;
import org.pmw.tinylog.Logger;
@@ -191,4 +192,46 @@ public class dbItemBaseHandler extends dbHandlerBase {
}
return runeSets;
}
public HashMap<Integer, ArrayList<BootySetEntry>> LOAD_BOOTY_FOR_MOBS() {
HashMap<Integer, ArrayList<BootySetEntry>> bootySets = new HashMap<>();
BootySetEntry bootySetEntry;
int bootySetID;
int recordsRead = 0;
prepareCallable("SELECT * FROM static_npc_bootySet");
try {
ResultSet rs = executeQuery();
while (rs.next()) {
recordsRead++;
bootySetID = rs.getInt("bootySet");
bootySetEntry = new BootySetEntry(rs);
if (bootySets.get(bootySetID) == null){
ArrayList<BootySetEntry> bootyList = new ArrayList<>();
bootyList.add(bootySetEntry);
bootySets.put(bootySetID, bootyList);
}
else{
ArrayList<BootySetEntry>bootyList = bootySets.get(bootySetID);
bootyList.add(bootySetEntry);
bootySets.put(bootySetID, bootyList);
}
}
Logger.info("read: " + recordsRead + " cached: " + bootySets.size());
} catch (SQLException e) {
Logger.error( e.toString());
} finally {
closeCallable();
}
return bootySets;
}
}