MySQL version of the PRC precacher data
Updated: Tue 3rd October 2006
After it choking on a few Bioware 2da files that were badly formed and having to start again each time, I got the out.sql file finally. I only needed to make minor changes to for it work with mySQL. I tested it by importing it into a mySQL database. I didn’t bother to do anything with the Bioware 2da files it didn’t like, most were empty anyway.
Precacher steps:
- extract Bioware 2da files
- extract PRC 2da files from prc_2das.hak, prc_craft2das.hak and prc_race.hak
- move the PRC files to the folder with the Bio ones and overwrite any duplicates with the PRC version
- using the command line go to the directory the precacher is in
- enter:
java -Xmx100m -jar prc.jar 2datosql precacher2das sqlite - wait…and wait…
Modifications to get it to work with mySQL
- removed
BEGIN IMMEDIATE(transaction start) - removed
PRAGMA [...] - escaped ‘ in bioware 2das packspbar1.2da etc for bull’s strength, cat’s grace etc (this is probably needed for sqlite too…). Update: I just took those 2da files out – quicker than escaping all the apostrophes.
- the field name int was changed to `int` as it is a keyword in
CREATE TABLE classes [...] - removed
COMMIT(transaction end)
Importing it into mySQL
For Windows, assumes mySQL is in the PATH:
- open a command prompt
- go to the directory you unRARed the file
- type:
mysql -u user -p databasename < out.sql > out.log(er…replace the user and databasename with whatever it should be) - enter the password when prompted
- go do something else for 5 minutes (the sql instructions are 50MB uncompressed)
For Linux (with thanks to Tom), the command line is:
cat out.sql| mysql -u user -p databasename
There are several arguements that mysql takes, eg -u username and –user=username are equivalent, see the MySQL manual.
The log file will be empty, but it stops mySQL echoing a confirmation after every line of the sql file (it has a lot of lines) and it stops if it encounters an error.
The out30f.sql file compressed, version for PRC3.0f/NWN1.68 (RAR, 1.7MB).
These SQL statements will remove the cache tables without deleting the entire database, then the database can be updated with the new SQL file (this might also be useful for when the PRC update their 2da files).
DROP TABLE IF EXISTS `prc_cached2da`; DROP TABLE IF EXISTS `prc_cached2da_appearance`; DROP TABLE IF EXISTS `prc_cached2da_classes`; DROP TABLE IF EXISTS `prc_cached2da_cls_feat`; DROP TABLE IF EXISTS `prc_cached2da_feat`; DROP TABLE IF EXISTS `prc_cached2da_ireq`; DROP TABLE IF EXISTS `prc_cached2da_item_to_ireq`; DROP TABLE IF EXISTS `prc_cached2da_portraits`; DROP TABLE IF EXISTS `prc_cached2da_racialtypes`; DROP TABLE IF EXISTS `prc_cached2da_soundset`; DROP TABLE IF EXISTS `prc_cached2da_spells`;
I used the sqlite arguement for the precacher rather than the MySQL one because in the version of the PRC server pack I took the precacher from (1.4), the MySQL option produced more errors.
If you want to add it to your tutorial, the Linux commandline command for importing the sql file into the database could also be written like
cat out.sql| mysql –user= –password=
regards Tom
Thank you.
I’m going to update the tutorial once my host has finished migrating the site to a new server and upload the updated sql file for version 3.0d then too.
Manual 2da compiling for nwnx2 and PRC. YOU MUST HAVE PRC INSTALLED AS WELL AS THE JAVA RUNTIME
1. Download the latest PRC server pack from the nwn-prc website
2. Move to C: drive root (This will show folders called program files and Windows) as well as others
3. Create folder named PRC
4. Create a folder INSIDE the PRC folder named precacher2das (It MUST be named exactly like this for the compiler to work.
5. Extract server pack to your NWN root folder (This should be something similar to C:\NeverwinterNights\ )
3. Extract bioware2das rar folder to the C:\PRC\precacher2das
4. Copy the file named prc.jar from the NWN root folder to the c:\PRC is must be in the directory where the precacher2das folder is i.e. C:\PRC\
5. Using the NWN viewer extract the files prc_2das.hak and prc_race.hak to another seperate folder (Any one you make it fine) This should be located in the C:\NeverwinterNights\hak folder
If you intend to use the PRC crafting you must also extract the prc crafting.hak to this folder.
6. COPY all the files you extracted from the prc_2das.hak file to the C:\PRC\precacher2das\ folder Overwrite any file it asks to
6a. This step is needed until things are sorted out with the current releases of everything. In the C:\PRC\precacher2das\ folder delete the files that begin with packsp*** there should be a few of them, they will have class names directly after the packsp letters
7. Click the Start button in WinXP and then go to run
8. Type cmd press enter
9. You should now be at a DOS prompt
10. type cd\ press enter
11. type cd PRC press enter
12. type java -Xmx100m -jar prc.jar 2datosql precacher2das sqlite press enter
13 If you’ve done things properly to this point you will now be waiting for about 5 hours for the databases to be updated properly. Just let it run it’s supposed to take a while.
14. Once this process finished you will see a file called out.sql in the same folder as the prc.jar Copy the out.sql file to your Neverwinter Nights directory
15. Make sure sqlite.exe is in your Neverwinter Nights folder
16. you need to add the contents of out.sql into the sqlite database. Go back to the command prompt and change directory to your Neverwinter directory, probably C:\NeverwinterNights\NWN\
17. type sqlite sqlite.db “.read out.sql” press enter