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:
1 parent
bd145b1e55
commit
3ae1c72f46
9 files changed
+457
No files matched your search
@@ -0,0 +1,59 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2026
|
||||
// https://www.magicbane.com
|
||||
|
||||
package engine.parsers.wpak;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.parsers.objects.wpak.PowActionCostTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
// Loads PowActionCostInfo.cfg (client loader EffectCostMap_LoadPowActionCostInfo 0x6E00C0).
|
||||
|
||||
public class PowActionCostParser {
|
||||
|
||||
private static final String fileName = "PowActionCostInfo.cfg";
|
||||
|
||||
public static HashMap<String, PowActionCostTemplate> parsePowActionCostFile() {
|
||||
|
||||
HashMap<String, PowActionCostTemplate> costs = new HashMap<>();
|
||||
ArrayList<WpakLine> lines;
|
||||
PowActionCostTemplate cost;
|
||||
int failedCount = 0;
|
||||
|
||||
try {
|
||||
lines = WpakFileReader.readLines(fileName);
|
||||
} catch (Exception e) {
|
||||
Logger.error(fileName + ": " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
for (WpakLine line : lines) {
|
||||
try {
|
||||
// A repeated id adds its pairs to the existing entry, as the client does
|
||||
cost = costs.computeIfAbsent(line.token(0), id -> new PowActionCostTemplate());
|
||||
cost.id = line.token(0);
|
||||
|
||||
for (int i = 1; i < line.size(); i += 2)
|
||||
cost.costs.put(line.enumToken(mbEnums.ResourceType.class, i), line.intToken(i + 1));
|
||||
} catch (WpakFormatException e) {
|
||||
Logger.error(e.getMessage());
|
||||
failedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.info("Loaded " + costs.size() + " power action resource costs from " + lines.size() + " lines");
|
||||
|
||||
if (failedCount > 0)
|
||||
return null;
|
||||
|
||||
return costs;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user