Files
prestonbane/src/engine/parsers/wpak/StartingKitParser.java
T
MagicBotandClaude Opus 5.5 3ae1c72f46 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>
2026-10-22 11:22:27 -04:00

79 lines
2.9 KiB
Java

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2026
// https://www.magicbane.com
package engine.parsers.wpak;
import engine.mbEnums;
import engine.parsers.objects.wpak.StartingKitTemplate;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
// Loads StartingKitTable.cfg (client loader ArcBaseKitManager_LoadStartingKitTable 0x620250).
public class StartingKitParser {
private static final String fileName = "StartingKitTable.cfg";
private static final int maxKitItems = 10;
public static ArrayList<StartingKitTemplate> parseStartingKitFile() {
ArrayList<StartingKitTemplate> kits = new ArrayList<>();
ArrayList<WpakLine> lines;
StartingKitTemplate kit;
String race = null;
mbEnums.SexType sex = null;
String baseClass = null;
int kitNumber = 0;
int failedCount = 0;
try {
lines = WpakFileReader.readLines(fileName);
} catch (Exception e) {
Logger.error(fileName + ": " + e.getMessage());
return null;
}
for (WpakLine line : lines) {
try {
if (line.token(0).equals("RACE=")) {
race = line.token(1);
sex = line.enumToken(mbEnums.SexType.class, 2);
baseClass = line.token(3);
kitNumber = 0;
continue;
}
if (race == null)
throw line.error("kit line before the first RACE=");
if (line.size() > maxKitItems)
throw line.error("kit has " + line.size() + " items; the client reads at most " + maxKitItems);
kit = new StartingKitTemplate();
kit.race = race;
kit.sex = sex;
kit.base_class = baseClass;
kit.kit_number = kitNumber++;
kit.item_ids.addAll(line.intTokensFrom(0));
kits.add(kit);
} catch (WpakFormatException e) {
Logger.error(e.getMessage());
failedCount++;
}
}
Logger.info("Loaded " + kits.size() + " starting kits");
if (failedCount > 0)
return null;
return kits;
}
}