Initial MSVC 2008 projects workspace
This commit is contained in:
16487
l2detect/sql/l2detect_items.sql
Normal file
16487
l2detect/sql/l2detect_items.sql
Normal file
File diff suppressed because it is too large
Load Diff
9785
l2detect/sql/l2detect_mobs.sql
Normal file
9785
l2detect/sql/l2detect_mobs.sql
Normal file
File diff suppressed because it is too large
Load Diff
6601
l2detect/sql/l2detect_skills.sql
Normal file
6601
l2detect/sql/l2detect_skills.sql
Normal file
File diff suppressed because it is too large
Load Diff
104
l2detect/sql/l2j_db_to_sqlite.php
Normal file
104
l2detect/sql/l2j_db_to_sqlite.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
function qq( $s )
|
||||
{
|
||||
$ss = '';
|
||||
for( $i=0; $i<strlen($s); $i++ )
|
||||
{
|
||||
if( $s[$i] == "'" ) $ss .= "'";
|
||||
$ss .= $s[$i];
|
||||
}
|
||||
return $ss;
|
||||
}
|
||||
|
||||
mysql_connect( 'localhost', 'root', '' );
|
||||
mysql_query( 'USE l2jdb' );
|
||||
|
||||
/*$f = fopen( 'l2detect_items.sql', 'wt' );
|
||||
fwrite( $f,
|
||||
"CREATE TABLE `items` (
|
||||
`id` int NOT NULL default '0',
|
||||
`name` text NOT NULL default '',
|
||||
`pic` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
);\n" );
|
||||
|
||||
$res = mysql_query( 'SELECT * FROM etcitem ORDER BY item_id' );
|
||||
$i = 0;
|
||||
while( ($row = mysql_fetch_assoc( $res )) !== false )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO items( id, name, pic ) VALUES ( '".$row['item_id']."', '".qq($row['name'])."', 'none' );\n" );
|
||||
$i++;
|
||||
}
|
||||
fwrite( $f, "\n" );
|
||||
echo "$i items\n";
|
||||
|
||||
|
||||
$res = mysql_query( 'SELECT * FROM armor ORDER BY item_id' );
|
||||
$i = 0;
|
||||
while( ($row = mysql_fetch_assoc( $res )) !== false )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO items( id, name, pic ) VALUES ( '".$row['item_id']."', '".qq($row['name'])."', 'none' );\n" );
|
||||
$i++;
|
||||
}
|
||||
fwrite( $f, "\n" );
|
||||
echo "$i armors\n";
|
||||
|
||||
|
||||
$res = mysql_query( 'SELECT * FROM weapon ORDER BY item_id' );
|
||||
$i = 0;
|
||||
while( ($row = mysql_fetch_assoc( $res )) !== false )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO items( id, name, pic ) VALUES ( '".$row['item_id']."', '".qq($row['name'])."', 'none' );\n" );
|
||||
$i++;
|
||||
}
|
||||
fwrite( $f, "\n" );
|
||||
echo "$i weapons\n";
|
||||
|
||||
fclose( $f );
|
||||
*/
|
||||
|
||||
|
||||
$f = fopen( 'l2detect_mobs.sql', 'wt' );
|
||||
fwrite( $f,
|
||||
"CREATE TABLE `mobs` (
|
||||
`id` int NOT NULL default '0',
|
||||
`name` text NOT NULL default '',
|
||||
`title` text NOT NULL default '',
|
||||
`level` int NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);\n" );
|
||||
|
||||
$res = mysql_query( 'SELECT * FROM npc ORDER BY idTemplate' );
|
||||
$i = 0;
|
||||
while( ($row = mysql_fetch_assoc( $res )) !== false )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO mobs( `id`, `name`, `title`, `level` ) ".
|
||||
"VALUES ( '".$row['idTemplate']."', '".qq($row['name'])."', '".qq($row['title'])."', '".$row['level']."' );\n" );
|
||||
$i++;
|
||||
}
|
||||
fwrite( $f, "\n" );
|
||||
echo "$i NPCs\n";
|
||||
fclose( $f );
|
||||
|
||||
|
||||
/*$f = fopen( 'l2detect_skills.sql', 'wt' );
|
||||
fwrite( $f,
|
||||
"CREATE TABLE `skills` (
|
||||
`id` int NOT NULL default '0',
|
||||
`name` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
);\n" );
|
||||
|
||||
$res = mysql_query( 'SELECT DISTINCT(skill_id), name FROM `skill_trees` ORDER BY skill_id' );
|
||||
$i = 0;
|
||||
while( ($row = mysql_fetch_assoc( $res )) !== false )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO skills( `id`, `name` ) VALUES ( '".$row['skill_id']."', '".qq($row['name'])."' );\n" );
|
||||
$i++;
|
||||
}
|
||||
fwrite( $f, "\n" );
|
||||
echo "$i skills\n";
|
||||
fclose( $f );*/
|
||||
|
||||
?>
|
||||
82
l2detect/sql/l2j_xml_skills_to_sql.php
Normal file
82
l2detect/sql/l2j_xml_skills_to_sql.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
$DP_DIR = 'Y:/bin/l2pvp/gameserver/data/stats/skills';
|
||||
$skills = array();
|
||||
|
||||
function echo_file_err( $fn, $nl, $err )
|
||||
{
|
||||
$fnb = basename( $fn );
|
||||
echo "ERROR [$fnb:$nl]: $err\n";
|
||||
}
|
||||
|
||||
function process_file( $fn )
|
||||
{
|
||||
global $skills;
|
||||
$f = fopen( $fn, 'rt' );
|
||||
if( $f === false )
|
||||
{
|
||||
echo "ERROR: cannot open [$fn]!\n";
|
||||
return;
|
||||
}
|
||||
$nl = 0;
|
||||
while( !feof( $f ) )
|
||||
{
|
||||
$s = fgets( $f, 4096 );
|
||||
if( $s === false ) continue;
|
||||
$nl++;
|
||||
$pos = stripos( $s, '<skill' );
|
||||
if( $pos === false ) continue;
|
||||
$id_pos = stripos( $s, 'id="' );
|
||||
$name_pos = stripos( $s, 'name="' );
|
||||
if( $id_pos === false || $name_pos === false )
|
||||
{
|
||||
echo_file_err( $fn, $nl, 'id_pos or name_pos are false, line=['.$s.']' );
|
||||
continue;
|
||||
}
|
||||
// get skill id
|
||||
$id_pos += 4; // 'id="'
|
||||
$id_s = '';
|
||||
while( $s[$id_pos] != '"' )
|
||||
{
|
||||
$id_s .= $s[$id_pos];
|
||||
$id_pos++;
|
||||
}
|
||||
// get skill name
|
||||
$name_pos += 6; // 'name="'
|
||||
$name_s = '';
|
||||
while( $s[$name_pos] != '"' )
|
||||
{
|
||||
$name_s .= $s[$name_pos];
|
||||
$name_pos++;
|
||||
}
|
||||
//echo $s.': id ['.$id_s.'] name ['.$name_s."]\n";
|
||||
$name = str_replace( "'", "''", $name_s );
|
||||
$skills[(int)$id_s] = $name;
|
||||
}
|
||||
fclose( $f );
|
||||
}
|
||||
|
||||
$dir = opendir( $DP_DIR );
|
||||
echo "Parsing XML files...\n";
|
||||
while( ($fn = readdir( $dir )) !== false )
|
||||
{
|
||||
if( $fn != '.' && $fn != '..' )
|
||||
process_file( $DP_DIR.'/'.$fn );
|
||||
}
|
||||
echo "Parsed ".count($skills)." skills\n";
|
||||
|
||||
echo "Creating SQL file...\n";
|
||||
$f = fopen( 'skills_t24.sql', 'wt' );
|
||||
fwrite( $f,
|
||||
"CREATE TABLE `skills` (\n".
|
||||
" `id` int NOT NULL default '0',\n".
|
||||
" `name` text NOT NULL default '',\n".
|
||||
" PRIMARY KEY (`id`)\n".
|
||||
");\n\n" );
|
||||
foreach( $skills as $skillId => $skillName )
|
||||
{
|
||||
fwrite( $f, "INSERT INTO skills( `id`, `name` ) VALUES ( '".$skillId."', '".$skillName."' );\n" );
|
||||
}
|
||||
fclose( $f );
|
||||
echo "Done.\n";
|
||||
|
||||
?>
|
||||
7
l2detect/sql/readme.txt
Normal file
7
l2detect/sql/readme.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
commands are like:
|
||||
|
||||
sqlite3 L2Detect_items.sqlite3db
|
||||
.read l2detect_items.sql
|
||||
.exit
|
||||
|
||||
takes too long time )
|
||||
Reference in New Issue
Block a user