.sql zu .txt? [40K]

04/24/2014 11:11 Sogma#1
Moin moin,

mich würde es mal interessieren, ob es möglich ist seine alte DB, also item_proto.sql zu der item_proto.txt und item_names.txt zu konvertieren. Da iMers Lib ja nicht bei der 40k Game geladen werden kann ist es ziemlich belastend, alle meine alten Einträge manuell in die txts zu bringen...

LG Sogma
04/24/2014 11:16 theo1990#2
schick mir mal ein beispiel wie die txt aussehen soll. Ich hab ein webscript das aus der db eine itemproto.xml erstellt das gleich kann ich abändern...
04/24/2014 11:23 Sogma#3
item_proto.txt
Code:
"Vnum"	"Name"	"Type"	"SubType"	"Size"	"AntiFlags"	"Flags"	"WearFlags"	"ImmuneFlags"	"Gold"	"ShopBuyPrice"	"RefinedVnum"	"RefineSet"	"AlterToMagicItemPercent"	"LimitType0"	"LimitValue0"	"LimitType1"	"LimitValue1"	"ApplyType0"	"ApplyValue0"	"ApplyType1"	"ApplyValue1"	"ApplyType2"	"ApplyValue2"	"Value0"	"Value1"	"Value2"	"Value3"	"Value4"	"Value5"	"Specular"	"GainSocketPercent"	"AddonType"
1	"µ·²Ù·¯¹Ì"	"ITEM_ELK"	0	1	"NONE"	"NONE"	"NONE"	"NONE"	0	0	0	0	0	"LIMIT_NONE"	0	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	0	0	0	0	0	0	0	0	0
2	"PYTHON_10302012"	"ITEM_NONE"	0	1	"NONE"	"NONE"	"NONE"	"NONE"	0	0	0	0	0	"LIMIT_NONE"	0	"LIMIT_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	"APPLY_NONE"	0	0	0	0	0	0	0	0	0	0
10	"µµ+0"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	0	0	11	1	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	0	0	1	0
11	"µµ+1"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	100	12	2	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	7	0	1	0
12	"µµ+2"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	100	13	3	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	14	0	1	0
13	"µµ+3"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	150	14	4	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	21	0	1	0
14	"µµ+4"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	150	15	5	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	28	30	1	0
15	"µµ+5"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	200	16	6	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	35	40	1	0
16	"µµ+6"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	250	17	7	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	42	50	1	0
17	"µµ+7"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	350	18	8	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	49	65	1	0
18	"µµ+8"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	500	19	9	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	56	80	1	0
19	"µµ+9"	"ITEM_WEAPON"	"WEAPON_SWORD"	2	"ANTI_MUDANG"	"ITEM_TUNABLE"	"WEAR_WEAPON"	"NONE"	100	750	0	0	22	"LEVEL"	0	"LIMIT_NONE"	0	"APPLY_ATT_SPEED"	22	"APPLY_NONE"	0	"APPLY_NONE"	0	0	15	19	13	15	63	100	1	0
item_names.txt
Code:
VNUM	LOCALE_NAME
1	Yang
2	Deutsche Version
10	Schwert+0
11	Schwert+1
12	Schwert+2
13	Schwert+3
14	Schwert+4
15	Schwert+5
16	Schwert+6
17	Schwert+7
18	Schwert+8
19	Schwert+9
04/24/2014 11:25 theo1990#4
ok es müssen tabulatoren dazwischen sein?
04/24/2014 11:30 Sogma#5
Ja, das ist halt die Stadardformatierung seit den 34k files
04/24/2014 11:33 theo1990#6
ok ich setzt mich dran
04/24/2014 11:38 Sogma#7
Generiert dein Script dann auch die item_names?
04/24/2014 11:39 theo1990#8
kannst du mir gerade eine itemproto irgendwie geben damit ich das script testen kann? muss keine echte von dir sein

Ja das werde ich berücksichtigen
04/24/2014 11:55 Sogma#9
Ja ich gebe es hier in den Anhang
04/24/2014 11:56 theo1990#10
ich brauch ein dump von der db sorry falsch ausgedrückt, damit ich testen kann^^
04/24/2014 11:58 Sogma#11
Serverside?
04/24/2014 12:01 theo1990#12
ein dump von ner itemproto tabelle . Also nicht die MYD dateien sondern .sql
04/24/2014 12:02 Sogma#13
Ahja, ok, ist im Anhang!
04/24/2014 13:02 theo1990#14
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($tmpfnameimplode("\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.
04/24/2014 13:06 Sogma#15
Alles klar um das jetzt benutzen zu können einfach eine php-Datei erstellen und auf einem Webspace ausführen?