|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum) |
10-28-2008, 05:15 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Quote:
Originally Posted by MNWatchdog
Personally, I think you should change to the DB method and it only with a importer and exporter app for the spells.txt file.
|
I think that's the route I'll go.
I'll probably just make a Perl script to do both (since not everyone has PHP installed on their server systems), although I'm already to the point where I have about 80% of the base Titanium spell file in a .sql file that can be easily sourced (80% being the table structure, 20% importing it from the spells file).
|
10-28-2008, 08:51 AM
|
Developer
|
|
Join Date: Jul 2007
Location: my own little world
Posts: 751
|
|
Quote:
Originally Posted by AndMetal
That's the way it currently works (which is a pita, and why most, if not all servers, use either the straight Titanium spell file or slightly modified version), and I think that's why I'm confused about where you're coming from.
|
Your very first post said something about modifying spells which seemed to me to be the pita way.
|
11-18-2008, 08:00 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Quote:
Originally Posted by AndMetal
I'll probably just make a Perl script
|
http://code.google.com/p/projecteqem...port_spells.pl
Code:
Usage: import_spells.pl [-c path] [-s path] [-t table] [-d]
-c path path/to/eqemu_config.xml. defaults to eqemu_config.xml
-s path path/to/spells_us.txt. defaults to spells_us.txt
-t table table to load the spells into. defaults to spells_new
-d erase all spells from the database first
Tested it out several times and it works fine, including the erasing of the table.
I feel there are probably some opportunities to clean up the script a little (I've never worked with DBI before), so if anyone has any recommendations, let me know (or if you have SVN access, feel free to change it).
|
11-24-2008, 07:13 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Just finished up the export script:
Code:
Usage: import_spells.pl [-c path] [-t table] [-i column] [-s path] [-o]
-c path path/to/eqemu_config.xml. defaults to eqemu_config.xml
-t table table to load the spells from. defaults to spells_new
-i column name of the column in the database table to order by. defaults to id
-s path path/to/export/spells_us.txt. defaults to spells_us.txt
-o overwrite spells_us.txt if it exists
The is also now officially in SVN as of revision 230. If anyone is confused about what to do, let me know.
|
|
|
|
11-24-2008, 08:34 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Can you give an example of using the script? Also, how do you disable using this so it continues to use the normal spells file? From reading the changelog, it sounds like it is supposed to use this table by default. I am guessing that means it will ignore the spells file unless you disable this feature? Or, will it use the spells file if it can't find the table?
BTW, your code box in your export script post says "import", not "export" for usage.
So, to import spells into the database, I would do this?:
Code:
/utils/import_spells.pl -c /home/eqemu/server/eqemu_config.xml -s /home/eqemu/server/spells_us.txt -t spells_new -d
And to export the table, I would do this?:
Code:
/utils/export_spells.pl -c /home/eqemu/server/eqemu_config.xml -t spells_new -s /home/eqemu/server/spells_us.txt
EDIT: Just tried to run this, but I haven't ran a .pl file before and it doesn't seem to run just from a terminal window. Is there something else I need to do to run it?
Code:
eqemu@muse:~/source/EQEmuServer2/utils$ ls
0.6.1-upgrade.sql items-0.6.0-DR2-0.6.1-DR1-convert.sql ppskillfix
apathing itemtablechanges.sql schema.xml
asmtools load_13thfloor_items.pl serialize_items.pl
azone Makefile spell_explorer.cpp
azone2 opcodes.conf sql
charmove patch_6.2.conf struct_fields.sh
cleanipc.cpp patch_Anniversary.conf TaskMaster
defaults patch_Live.conf throwpackets.pl
export_spells.pl patch_Titanium.conf wr_update.sql
hexvis perlxs ZONECFG.SQL
import_showeq ppconvert
import_spells.pl ppreader.pl
eqemu@muse:~/source/EQEmuServer2/utils$ import_spells.pl -h bash: import_spells.pl: command not found
eqemu@muse:~/source/EQEmuServer2/utils$ ./import_spells.pl -h
bash: ./import_spells.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
eqemu@muse:~/source/EQEmuServer2/utils$
Last edited by trevius; 11-24-2008 at 04:51 PM..
|
|
|
|
11-24-2008, 08:55 AM
|
Banned
|
|
Join Date: Jan 2006
Location: /dev/null
Posts: 99
|
|
should be able to just
Code:
sh export_spells.pl
but i don't have a linux box near me atm
|
|
|
|
11-24-2008, 09:22 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
This is what I get from sh:
Code:
eqemu@muse:~/source/EQEmuServer2/utils$ sh export_spells.pl -h
: command not foundine 2:
export_spells.pl: line 5: use: command not found
: command not foundine 5:
export_spells.pl: line 6: use: command not found
: command not foundine 6:
: command not foundine 7:
export_spells.pl: line 9: syntax error near unexpected token `'c:t:i:s:oh''
'xport_spells.pl: line 9: `getopts('c:t:i:s:oh');
eqemu@muse:~/source/EQEmuServer2/utils$ sh import_spells.pl -c /home/eqemu/server/eqemu_config.xml -s /home/eqemu/server/spells_us.txt -t spells_new -d
: command not foundine 2:
import_spells.pl: line 5: use: command not found
: command not foundine 5:
import_spells.pl: line 6: use: command not found
: command not foundine 6:
: command not foundine 7:
import_spells.pl: line 9: syntax error near unexpected token `'c:s:t:dh''
'mport_spells.pl: line 9: `getopts('c:s:t:dh');
eqemu@muse:~/source/EQEmuServer2/utils$
And, to set it back to load the normal spell file, I am guessing I need to modify this part of the spdat.h?:
Code:
//#define NEW_LoadSPDat
#define DB_LoadSPDat //load from DB vs spells_us.txt. for now, we're piggybacking NEW_LoadSPDat, so it will take precedence
Or does that mean this is still disabled by default? Change log says enabled by default, so I am not understanding. Do I just need to comment out #define DB_LoadSPDat ? I can't even get it to compile if that line is commented out. If loading spells from the DB is now enabled by default, and it doesn't automatically use the spells_us.txt file if the spells_new table isn't available, then I think this needs to be disabled ASAP. Or we at least need a complete noobie guide to setting it up, because I know that if I am having trouble with it, many others will too.
Last edited by trevius; 11-24-2008 at 05:39 PM..
|
|
|
|
11-24-2008, 11:57 AM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
Quote:
Originally Posted by jenco420
should be able to just
Code:
sh export_spells.pl
but i don't have a linux box near me atm
|
egads! Don't feed it to shell. Make sure the script is at least executable, ie 755 or whatever you want it to be and make sure the first line of the script points to the location of your perl executable. Depending on you distro and how you installed it, it could be in either /usr/bin or /usr/local/bin, unless you installed it intentionally in another location.
Edit: Looked at your error and it seems to be picking up the ^M from the DOS file type. You can edit those out or you can run dos2unix to remove them.
|
11-24-2008, 01:46 PM
|
|
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
It's a perl script, not a shell script so use:
Code:
perl export_spells.pl
It'll work on either Windows or Linux of course.
Not sure if anybody would use it, but here is the sql dump of the spells file: http://projecteq.net/cavedude/spells_new.zip Source utils/230_spells_table.sql first for the schema, as that is just data. It'll appear as a system table in PEQ CVS.
Last edited by cavedude; 11-24-2008 at 10:10 PM..
|
11-24-2008, 03:35 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
Just for the future: I'd rather you turn large (potentially game breaking) features off by default at least at first when they coexist with previous implementations.
|
11-24-2008, 03:53 PM
|
|
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
It doesn't look like it can be disabled. :( Without the table, zones crash as soon as a spell is cast, with a blank table, the zones won't boot at all.
|
11-24-2008, 04:36 PM
|
Discordant
|
|
Join Date: Sep 2006
Location: Green Bay, WI
Posts: 436
|
|
Been trying the export script for 2 hours now with no luck
Code:
perl export_spells.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at (eval 4) line 3, <F> line 36.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysqlPP.
at export_spells.pl line 62
*waves the white flag*
|
11-24-2008, 04:44 PM
|
Dragon
|
|
Join Date: Feb 2007
Posts: 659
|
|
Quote:
Originally Posted by leslamarch
Been trying the export script for 2 hours now with no luck
Code:
perl export_spells.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at (eval 4) line 3, <F> line 36.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysqlPP.
at export_spells.pl line 62
*waves the white flag*
|
Did you install the DBD::mysql module? It's got a new name and I don't remember what it is off the top of my head. You should be able to use ppm to find it though. I'm not sure what the mysqlPP is, but it typically means mysql Pure Perl. I'm not sure if that's the same thing or not. I don't run it on my windows box anymore so I don't know for sure.
|
11-24-2008, 07:33 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Is it possible to retract an SVN submission? Would be pretty awesome to just be able to remove it and not have to either manually remove everything added in it, or commit an older version to revert it.
I was hoping to get the new food stats fix in that I got done last night, but couldn't because of the problems with this.
|
|
|
|
11-25-2008, 02:03 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Sheesh, I go away for 17 hours and everyone freaks out...
Anyways, to address the questions:
Quote:
Originally Posted by trevius
Can you give an example of using the script?
|
cavedude pretty much got it. I would recommend using the -h (for [h]elp) switch, recommended in the changelog:
Quote:
==11/24/2008==
AndMetal: Spells can now be loaded from the database, and is now enabled by default. Use utils/import_spells.pl to import, utils/export_spells.pl to export. Use -h on either for usage.
Required SQL: utils/sql/svn/229_spells_table.sql
|
Code:
perl import_spells.pl -h
perl export_spells.pl -h
which gives the usage (which I also posted above):
Quote:
Originally Posted by AndMetal
Code:
Usage: import_spells.pl [-c path] [-s path] [-t table] [-d]
-c path path/to/eqemu_config.xml. defaults to eqemu_config.xml
-s path path/to/spells_us.txt. defaults to spells_us.txt
-t table table to load the spells into. defaults to spells_new
-d erase all spells from the database first
|
Quote:
Originally Posted by AndMetal
Code:
Usage: export_spells.pl [-c path] [-t table] [-i column] [-s path] [-o]
-c path path/to/eqemu_config.xml. defaults to eqemu_config.xml
-t table table to load the spells from. defaults to spells_new
-i column name of the column in the database table to order by. defaults to id
-s path path/to/export/spells_us.txt. defaults to spells_us.txt
-o overwrite spells_us.txt if it exists
|
By default, it will look for both eqemu_config.xml & spells_us.txt in the current directory (as indicated in the usage info for the switches, since they don't have any /'s before the names of the files), so you could easily just execute it from your server directory. For me, I would end up using something like this, cause even though symbolic links are awesome, I don't really like making them a lot:
Code:
eqemu@amsk-server:~/svn/EQEmuServer/utils$ perl import_spells.pl -c ~/server/eqemu_config.xml -s ~/server/spells_us.txt -d
eqemu@amsk-server:~/svn/EQEmuServer/utils$ perl export_spells.pl -c ~/server/eqemu_config.xml -s /var/www/eqemu/spells_us.txt -o
Then, you can just add the export to your startup script so it exports at runtime if you wanna be one of the cool kids
Quote:
Originally Posted by trevius
Also, how do you disable using this so it continues to use the normal spells file? From reading the changelog, it sounds like it is supposed to use this table by default. I am guessing that means it will ignore the spells file unless you disable this feature? Or, will it use the spells file if it can't find the table?
|
The idea is this will replace using the spells file. The only reason I didn't just straight take out the old stuff is so everyone can continue to use it if they want to (just like turning bots on, SPELL_EFFECT_SPAM, etc) by changing the #defines in zone/spdat.h:
Code:
//#define NEW_LoadSPDat
#define DB_LoadSPDat //load from DB vs spells_us.txt. for now, we're piggybacking NEW_LoadSPDat, so it will take precedence
One change I might make would be to create a default case if neither are defined:
Code:
//#define NEW_LoadSPDat
#define DB_LoadSPDat //load from DB vs spells_us.txt. for now, we're piggybacking NEW_LoadSPDat, so it will take precedence
#if !defined(NEW_LoadSPDat) && !defined(DB_LoadSPDat)
#define NEW_LoadSPDat
#endif
However, then we're completely rid of the real old way of doing it (lots of hard coding). I honestly don't think anyone's using that old code, but who knows.
Quote:
Originally Posted by trevius
BTW, your code box in your export script post says "import", not "export" for usage.
|
Minor typo. I was copying/pasting the top half of the scripts, and forgot to make that change.
Quote:
Originally Posted by KLS
Just for the future: I'd rather you turn large (potentially game breaking) features off by default at least at first when they coexist with previous implementations.
|
I've actually been using this code, successfully, for just shy of a month (since October 27th to be specific). The only thing that took a little time was the scripts to import/export the spells (having a kid in the middle of all that did slow things down a bit). Not only that, but the main thing it's doing is loading spells into the spells[] "array" from the database instead of the spells_us.txt file. There were also a few unknown values in the SPDat_Spell_Struct struct that I came across, but I made sure it worked with the spells_us.txt file before I even tested with the database (which caused problems with sharedmem a few months ago when I first started working on it). I personally don't consider it to be a "large feature", rather just a bunch of copying, pasting, & tweaking of existing code.
Quote:
Originally Posted by leslamarch
Been trying the export script for 2 hours now with no luck
Code:
perl export_spells.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at (eval 4) line 3, <F> line 36.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysqlPP.
at export_spells.pl line 62
*waves the white flag*
|
I'm running Debian & have libdbi-perl & libdbd-mysql-perl. The scripts use DBI, so Perl probably just assumes MySQL when trying to connect to the server (automatically negotiated maybe?):
Code:
use DBI;
use Getopt::Std;
As far as I can tell, both of the DB packages are installed automatically when installing the MySQL 5.0 server, again at least on Debian.
I guess the question now is anyone actually having problems after getting the spells into the database? Because other than that, I'm not sure what all the ruckus is about...
I know it compiles, I know it runs, I know it works, and made sure to test it thoroughly before I got to this point. I even just checked my launcher status page & haven't had any zone crashes since my server was booted up at 6:28am today.
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:31 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|