08/16/2012, 22:00
|
#2
|
elite*gold: 260
Join Date: Jul 2009
Posts: 1,123
Received Thanks: 180
|
try this file to connect with php on your database and convert the database itemproto to a client item proto
Quote:
<?php
error_reporting(E_ALL);
$tmpfname = tempnam ("/tmp", "FOO");
//$fh = fopen('item_proto.xml', 'w');
$fh = fopen($tmpfname, 'w');
fwrite($fh, '<item_proto extended="true" version="1">' . "\r\n");
$c = mysql_connect('yourhost', 'youruser', 'yourpasswort');
$db = mysql_select_db('youdb');
$result = mysql_query('SELECT * FROM item_proto ORDER BY vnum ASC');
while ($row = mysql_fetch_object($result)) {
//$value = ($field !== 'name') ? $value = utf8_decode($value) : $value;
$tmp = array();
$tmp['vnum'] = $row->vnum;
$tmp['hashName'] = trim($row->name);
//$tmp['name'] = trim($row->locale_name);
$tmp['type'] = $row->type;
$tmp['subtype'] = $row->subtype;
$tmp['weight'] = $row->weight;
$tmp['size'] = $row->size;
$tmp['antiflag'] = $row->antiflag;
$tmp['flag'] = $row->flag;
$tmp['wearflag'] = $row->wearflag;
$tmp['immuneflag'] = floatval($row->immuneflag);
$tmp['gold'] = $row->gold;
$tmp['buy_price'] = $row->shop_buy_price;
$tmp['limittype0'] = $row->limittype0;
$tmp['limitvalue0'] = $row->limitvalue0;
$tmp['limittype1'] = $row->limittype1;
$tmp['limitvalue1'] = $row->limitvalue1;
$tmp['applytype0'] = $row->applytype0;
$tmp['applyvalue0'] = $row->applyvalue0;
$tmp['applytype1'] = $row->applytype1;
$tmp['applyvalue1'] = $row->applyvalue1;
$tmp['applytype2'] = $row->applytype2;
$tmp['applyvalue2'] = $row->applyvalue2;
$tmp['value0'] = $row->value0;
$tmp['value1'] = $row->value1;
$tmp['value2'] = $row->value2;
$tmp['value3'] = $row->value3;
$tmp['value4'] = $row->value4;
$tmp['value5'] = $row->value5;
$tmp['socket0'] = $row->socket0;
$tmp['socket1'] = $row->socket1;
$tmp['socket2'] = $row->socket2;
$tmp['socket3'] = $row->socket3;
$tmp['socket4'] = $row->socket4;
$tmp['socket5'] = $row->socket5;
$tmp['refine_vnum'] = $row->refined_vnum;
$tmp['refine_set'] = $row->refine_set;
$tmp['magic_pct'] = $row->magic_pct;
$tmp['specular'] = $row->specular;
$tmp['socket_pct'] = $row->socket_pct;
$t = array();
foreach ($tmp as $key => $value) {
$t[] = $key . '="' . $value . '"';
}
unset($tmp);
fwrite($fh, "\t\t" . '<Item ' . implode(' ', $t) . ' />' . "\r\n");
unset($tmp);
}
fwrite($fh, '</item_proto>');
fclose($fh);
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: binary");
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize('item_proto.xml'));
header('Content-Disposition: attachment; filename="item_proto.xml"');
readfile($tmpfname);
unlink($tmpfname);
exit;
|
|
|
|