SkillsBase name, description, token (SBStringHash of the name) and attribute weights now come from SkillTemplate._skills. The skill ids stay in static_skill_skillsbase (ID, name), which dyn_character_skill and SkillReq use; the loader joins each row's name to the cfg skill and logs an error for a name with no cfg entry. Both servers load all 63 at boot after Skills.cfg; GET_BASE/GET_BASE_BY_NAME/GET_BASE_BY_TOKEN read the boot caches only. The other 31 cfg skills stay in SkillTemplate. Parity (scripts/p43.py, dev DB): 63/63 names, 63/63 tokens, 63/63 weights. Only value change: description was empty for all 63 in the DB and is now the cfg text (no server reader). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.3 KiB
Java
62 lines
2.3 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
|
|
package engine.db.handlers;
|
|
|
|
import engine.gameManager.DbManager;
|
|
import engine.mbEnums;
|
|
import engine.mbEnums.GameObjectType;
|
|
import engine.objects.SkillsBase;
|
|
import org.pmw.tinylog.Logger;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import java.util.HashMap;
|
|
|
|
public class dbSkillBaseHandler extends dbHandlerBase {
|
|
|
|
public dbSkillBaseHandler() {
|
|
this.localClass = SkillsBase.class;
|
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
|
}
|
|
|
|
public SkillsBase GET_BASE(final int objectUUID) {
|
|
return (SkillsBase) DbManager.getFromCache(GameObjectType.SkillsBase, objectUUID);
|
|
}
|
|
|
|
public SkillsBase GET_BASE_BY_NAME(String name) {
|
|
return SkillsBase.getFromCache(name);
|
|
}
|
|
|
|
public SkillsBase GET_BASE_BY_TOKEN(final int token) {
|
|
return SkillsBase.getFromCache(token);
|
|
}
|
|
|
|
public HashMap<Integer, String> GET_ALL_SKILL_NAMES() {
|
|
|
|
HashMap<Integer, String> skillNames = new HashMap<>();
|
|
|
|
try (Connection connection = DbManager.getConnection();
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT ID, name FROM static_skill_skillsbase")) {
|
|
|
|
ResultSet rs = preparedStatement.executeQuery();
|
|
|
|
while (rs.next())
|
|
skillNames.put(rs.getInt("ID"), rs.getString("name"));
|
|
|
|
} catch (SQLException e) {
|
|
Logger.error(e);
|
|
}
|
|
|
|
return skillNames;
|
|
}
|
|
}
|