PHP Code:
<?php
error_reporting(E_ALL);
$tmpfname = fopen( "item_proto.txt" , "w" );
//$tmpfname = fopen('item_proto.xml', 'w');
$test = fwrite($tmpfname, "Vnum \t Name \t Type \t SubType \t Size \t AntiFlags \t Flags \t WearFlags \t ImmuneFlags \t Gold \t ShopBuyPrice \t RefinedVnum \t RefineSet \t AlterToMagicItemPercent \t LimitType0 \t LimitValue0 \t LimitType1 \t LimitValue1 \t ApplyType0 \t ApplyValue0 \t ApplyType1 \t ApplyValue1 \t ApplyType2 \t ApplyValue2 \t Value0 \t Value1 \t Value2 \t Value3 \t Value4 \t Value5 \t Specular \t GainSocketPercent AddonType 1\t µ·²Ù·¯¹Ì \t ITEM_ELK \t0\1\t NONE \t NONE \t NONE \t NONE \t0\t0\t0\0\t0\t LIMIT_NONE \t0\t LIMIT_NONE \t0\t APPLY_NONE \t0\t APPLY_NONE \t0\t APPLY_NONE \t0\t0\t0\t0\t0\t0\t0\t0\t0\t0 \r\n ");
$c = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('mt2');
$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) {
if(!preg_match('/[a-zA-Z]/',$value))
{
$t[] = (int) $value;
}
else
{
$t[] = "'" . $value . "'" ;
}
}
unset($tmp);
fwrite($tmpfname, implode("\t ", $t) . "\r\n" );
}
var_dump($tmpfname);
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-Disposition: attachment; filename= item_proto.txt ');
readfile( "item_proto.txt" );
fclose($tmpfname);
exit;
Sooo also das sollte nun funktionieren. das gibt jetzt die item_proto.txt aus.
Um die andere rauszubekommen musste einfach nur alle felder rausnehmen bis auf vnum und den namen halt.