nwn.biowaredb

Bioware campaign database (Foxpro db)

Public Imports

nwn.types
public import nwn.types;
Undocumented in source.

Members

Aliases

BinaryObject
alias BinaryObject = ubyte[]

Type of the GFF raw data stored when using StoreCampaignObject

Classes

BiowareDB
class BiowareDB

Bioware database (in FoxPro format, ie dbf, cdx and ftp files)

BiowareDBException
class BiowareDBException

Structs

PCID
struct PCID

ID used by Bioware Database to 'uniquely' identify a specific character. Can be used as a char[32].

Examples

// Open ./yourdatabasename.dbf, ./yourdatabasename.cdx, ./yourdatabasename.fpt
auto db = new BiowareDB("./yourdatabasename");

// Set a campaign variable associated to a character
db.setVariableValue("YourAccount", "YourCharName", "TestFloat", 42.0f);

// Set a campaign variable associated with the module
db.setVariableValue(null, null, "TestVector", NWVector([1.0f, 2.0f, 3.0f]));

// Retrieve variable information
auto var = db.getVariable("YourAccount", "YourCharName", "TestFloat").get();

// Retrieve variable value using its index (fast)
float f = db.getVariableValue!NWFloat(var.index);

// Retrieve variable value by searching it
NWVector v = db.getVariableValue!NWVector(null, null, "TestVector").get();

// Iterate over all variables (using variable info)
foreach(varinfo ; db){
	if(varinfo.deleted == false)
		// Variable exists
	}
	else{
		// Variable has been deleted, skip it
		continue;
	}
}

// Save changes
auto serialized = db.serialize();
std.file.write("./yourdatabasename.dbf", serialized.dbf);
std.file.write("./yourdatabasename.fpt", serialized.fpt);

Meta