working with base 2das separate from prc 2das
This commit is contained in:
@@ -361,73 +361,50 @@ public class EntryGeneration {
|
||||
* Creates a list of spells.2da rows that should contain a psionic power's class-specific
|
||||
* entry.
|
||||
*/
|
||||
public static void listPsionicPowers() {
|
||||
public static void listPsionicPowers(TwoDAStore twoDA) {
|
||||
// A map of power name to class-specific spells.2da entry
|
||||
psiPowMap = new HashMap<String, Integer>();
|
||||
|
||||
// Load cls_psipw_*.2da
|
||||
String[] fileNames = new File("../../trunk/2das").list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.toLowerCase().startsWith("cls_psipw_") &&
|
||||
name.toLowerCase().endsWith(".2da");
|
||||
}
|
||||
});
|
||||
HashMap<String, Data_2da> potentials = twoDA.findAll("cls_psipw_");
|
||||
|
||||
listAMSEntries(fileNames, psiPowMap);
|
||||
listAMSEntries(potentials, psiPowMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of spells.2da rows that should contain a truenaming utterance's
|
||||
*/
|
||||
public static void listTruenameUtterances() {
|
||||
public static void listTruenameUtterances(TwoDAStore twoDA) {
|
||||
// A map of power name to class-specific spells.2da entry
|
||||
utterMap = new HashMap<String, Integer>();
|
||||
|
||||
// Load cls_*_utter.2da
|
||||
String[] fileNames = new File("../../trunk/2das").list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.toLowerCase().startsWith("cls_") &&
|
||||
name.toLowerCase().endsWith("_utter.2da");
|
||||
}
|
||||
});
|
||||
HashMap<String, Data_2da> potentials = twoDA.findAll("_utter");
|
||||
|
||||
listAMSEntries(fileNames, utterMap);
|
||||
listAMSEntries(potentials, utterMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of spells.2da rows that should contain invocations
|
||||
*/
|
||||
public static void listInvocations() {
|
||||
public static void listInvocations(TwoDAStore twoDA) {
|
||||
// A map of power name to class-specific spells.2da entry
|
||||
invMap = new HashMap<String, Integer>();
|
||||
|
||||
// Load cls_*_utter.2da
|
||||
String[] fileNames = new File("../../trunk/2das").list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.toLowerCase().startsWith("cls_inv_") &&
|
||||
name.toLowerCase().endsWith(".2da");
|
||||
}
|
||||
});
|
||||
var potentials = twoDA.findAll("cls_inv_");
|
||||
|
||||
listAMSEntries(fileNames, invMap);
|
||||
listAMSEntries(potentials, invMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of spells.2da rows that should contain maneuvers
|
||||
*/
|
||||
public static void listManeuvers() {
|
||||
public static void listManeuvers(TwoDAStore twoDA) {
|
||||
// A map of power name to class-specific spells.2da entry
|
||||
maneuverMap = new HashMap<String, Integer>();
|
||||
|
||||
// Load cls_*_utter.2da
|
||||
String[] fileNames = new File("../../trunk/2das").list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.toLowerCase().startsWith("cls_move_") &&
|
||||
name.toLowerCase().endsWith(".2da");
|
||||
}
|
||||
});
|
||||
var potentials = twoDA.findAll("cls_move_");
|
||||
|
||||
listAMSEntries(fileNames, maneuverMap);
|
||||
listAMSEntries(potentials, maneuverMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,31 +414,28 @@ public class EntryGeneration {
|
||||
* @param fileNames List of 2da files that contain the entries to be listed
|
||||
* @param storeMap Map to store the entries in
|
||||
*/
|
||||
private static void listAMSEntries(String[] fileNames, Map<String, Integer> storeMap) {
|
||||
Data_2da spells2da = twoDA.get("spells");
|
||||
Data_2da[] list2das = new Data_2da[fileNames.length];
|
||||
for (int i = 0; i < fileNames.length; i++)
|
||||
//Strip out the ".2da" from the filenames before loading, since the loader function assumes it's missing
|
||||
list2das[i] = twoDA.get(fileNames[i].replace(".2da", ""));
|
||||
|
||||
private static void listAMSEntries(HashMap<String, Data_2da> list2das, Map<String, Integer> storeMap) {
|
||||
Data_2da spells2da = twoDA.get("spells");
|
||||
// Parse the 2das
|
||||
for (Data_2da list2da : list2das) {
|
||||
for (int i = 0; i < list2da.getEntryCount(); i++) {
|
||||
list2das.entrySet().stream().forEach(
|
||||
list2da -> {
|
||||
var value2da = list2da.getValue();
|
||||
for (int i = 0; i < value2da.getEntryCount(); i++) {
|
||||
// Column FeatID is used to determine if the row specifies the main entry of a power
|
||||
if (!list2da.getEntry("FeatID", i).equals("****")) {
|
||||
if (!value2da.getEntry("FeatID", i).equals("****")) {
|
||||
try {
|
||||
//look up spells.2da name of the realspellid if we don't have a name column
|
||||
if (list2da.getEntry("Name", i) == null) {
|
||||
storeMap.put(tlk.get(spells2da.getEntry("Name", list2da.getEntry("RealSpellID", i))), Integer.parseInt(list2da.getEntry("RealSpellID", i)));
|
||||
if (value2da.getEntry("Name", i) == null) {
|
||||
storeMap.put(tlk.get(spells2da.getEntry("Name", value2da.getEntry("RealSpellID", i))), Integer.parseInt(value2da.getEntry("RealSpellID", i)));
|
||||
} else {
|
||||
storeMap.put(tlk.get(list2da.getEntry("Name", i)), Integer.parseInt(list2da.getEntry("SpellID", i)));
|
||||
storeMap.put(tlk.get(value2da.getEntry("Name", i)), Integer.parseInt(value2da.getEntry("SpellID", i)));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
err_pr.println("Error: Invalid SpellID entry in " + list2da.getName() + ", line " + i);
|
||||
err_pr.println("Error: Invalid SpellID entry in " + value2da.getName() + ", line " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -177,6 +177,7 @@ public class Main {
|
||||
|
||||
var baseDirectory = "../../trunk"; // @TODO: Move to a Configuration File
|
||||
var folders = getFoldersInFolder(baseDirectory);
|
||||
folders.add("base_nwn_files"); // this is where we store the base nwn 2da files
|
||||
for (var folder : folders) {
|
||||
if (folder.endsWith("2das")) {
|
||||
var files = getFilesInFolder(folder);
|
||||
@@ -249,6 +250,7 @@ public class Main {
|
||||
try {
|
||||
var basePath = "../../trunk";
|
||||
var potentialPaths = getFoldersInFolder(basePath);
|
||||
potentialPaths.add("base_nwn_files"); // this is where we store the base nwn 2da files
|
||||
for (var folder : potentialPaths) {
|
||||
var file = new File(Paths.get(folder, name + ".2da").toAbsolutePath().toString());
|
||||
if (file.exists()) {
|
||||
@@ -267,6 +269,12 @@ public class Main {
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<String, Data_2da> findAll(String name) {
|
||||
HashMap<String, Data_2da> copy = new HashMap<String, Data_2da>(data);
|
||||
copy.keySet().removeIf(key -> !key.contains(name));
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -782,7 +790,7 @@ public class Main {
|
||||
if (!(readTemplates() && buildDirectories())) continue;
|
||||
|
||||
// Do the actual work
|
||||
createPages();
|
||||
createPages(twoDA);
|
||||
createMenus();
|
||||
}
|
||||
|
||||
@@ -990,14 +998,14 @@ public class Main {
|
||||
/**
|
||||
* Page creation. Calls all the specific functions for different page types
|
||||
*/
|
||||
private static void createPages() {
|
||||
private static void createPages(TwoDAStore twoDA) {
|
||||
/* First, do the pages that do not require linking to other pages */
|
||||
doSkills();
|
||||
doCrafting();
|
||||
listPsionicPowers();
|
||||
listTruenameUtterances();
|
||||
listInvocations();
|
||||
listManeuvers();
|
||||
listPsionicPowers(twoDA);
|
||||
listTruenameUtterances(twoDA);
|
||||
listInvocations(twoDA);
|
||||
listManeuvers(twoDA);
|
||||
doSpells();
|
||||
|
||||
/* Then, build the feats */
|
||||
|
Reference in New Issue
Block a user