Load Skills, StartingKitTable, CharCreateRuneList and PowActionCostInfo

SkillParser: uid, name, icon, attribute weights and description per
Skills.cfg line (94 skills; the server's ids 1-63 stay in the DB).
StartingKitParser: each kit line is a list of up to 10 item ids under
its RACE= line, as the client reads it; the file's tab columns are not
used (451 kits, same count as static_rune_validkit).
CharCreateRuneParser: race (with sex), class, promotion and attribute
creation rune lists. PowActionCostParser: resource costs per id, the
source of static_effect_costmaps (524 entries). No consumers change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-22 11:22:27 -04:00
1 parent bd145b1e55
commit 3ae1c72f46
9 files changed
+457

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2026
// https://www.magicbane.com
package engine.parsers.wpak;
import engine.mbEnums;
import engine.parsers.objects.wpak.SkillTemplate;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashMap;
// Loads Skills.cfg (client loader ArcSkill_LoadSkillsCfg 0x584430).
public class SkillParser {
private static final String fileName = "Skills.cfg";
public static HashMap<String, SkillTemplate> parseSkillsFile() {
HashMap<String, SkillTemplate> skills = new HashMap<>();
ArrayList<WpakLine> lines;
SkillTemplate skill;
int failedCount = 0;
try {
lines = WpakFileReader.readLines(fileName);
} catch (Exception e) {
Logger.error(fileName + ": " + e.getMessage());
return null;
}
for (WpakLine line : lines) {
try {
skill = parseSkillLine(line);
if (skills.containsKey(skill.skill_uid))
Logger.warn(line.location() + ": duplicate skill " + skill.skill_uid + "; the later entry wins");
skills.put(skill.skill_uid, skill);
} catch (WpakFormatException e) {
Logger.error(e.getMessage());
failedCount++;
}
}
Logger.info("Loaded " + skills.size() + " of " + lines.size() + " skills");
if (failedCount > 0)
return null;
return skills;
}
// Attribute/weight pairs run until the "=" token; the description follows it
private static SkillTemplate parseSkillLine(WpakLine line) {
SkillTemplate skill = new SkillTemplate();
int index = 3;
skill.skill_uid = line.token(0);
skill.skill_name = line.token(1);
skill.icon_number = line.intToken(2);
while (line.has(index) && !line.token(index).equals("=")) {
skill.attr_weights.put(line.enumToken(mbEnums.AttributeType.class, index), line.intToken(index + 1));
index += 2;
}
skill.description = line.has(index + 1) ? line.token(index + 1) : "";
return skill;
}
}