Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2008, 05:15 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by MNWatchdog View Post
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).
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #2  
Old 11-18-2008, 08:00 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by AndMetal View Post
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).
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #3  
Old 11-24-2008, 07:13 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

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.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #4  
Old 11-24-2008, 08:34 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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$
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-24-2008 at 04:51 PM..
Reply With Quote
  #5  
Old 11-24-2008, 08:55 AM
jenco420
Banned
 
Join Date: Jan 2006
Location: /dev/null
Posts: 99
Default

should be able to just

Code:
sh export_spells.pl
but i don't have a linux box near me atm
Reply With Quote
  #6  
Old 11-24-2008, 11:57 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by jenco420 View Post
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.
Reply With Quote
  #7  
Old 11-24-2008, 01:46 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

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..
Reply With Quote
  #8  
Old 11-24-2008, 09:22 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-24-2008 at 05:39 PM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:43 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3