[TOOL]item_proto dumps zu .sql file

01/01/2010 09:08 iMer#1
Hab mal n Tool gescriptet das die item_proto dumps von tims archiver in .sql dateien umwandelt
Source:
PHP Code:
#include <String.au3>
#include <File.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode"1)
Global 
$ScriptDir = @ScriptDir
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("item_proto .xml zu .sql converter by iMer"353156193125)
GUISetOnEvent($GUI_EVENT_CLOSE"_close")
$input GUICtrlCreateInput("item_proto_dump.xml"801612921)
$Button1 GUICtrlCreateButton("Durchsuchen..."2161683250)
GUICtrlSetOnEvent($Button1"_input")
$Label1 GUICtrlCreateLabel("Source:"32164117)
$Label2 GUICtrlCreateLabel("Output:"32563917)
$output GUICtrlCreateInput("item_proto.sql"805612921)
$Button2 GUICtrlCreateButton("Durchsuchen..."2165681250)
GUICtrlSetOnEvent($Button2"_output")
$Button3 GUICtrlCreateButton("Start"1049675250)
GUICtrlSetOnEvent($Button3"_con")
GUISetState(@SW_SHOW)
$Form2 GUICreate("item_proto .xml zu .sql converter by iMer"264156194128)
GUISetOnEvent($GUI_EVENT_CLOSE"_close")
$t1we GUICtrlCreateLabel("Zeilen:"16163617)
$insgzeilen GUICtrlCreateLabel("loading..."56166517)
$dsv GUICtrlCreateLabel("Aktuell:"16563917)
$aktuellzeilen GUICtrlCreateLabel("loading..."56567017)
$Progress1 GUICtrlCreateProgress(169623017)
$Cancel GUICtrlCreateButton("Cancel"18412875250)
GUICtrlSetOnEvent($Cancel"_close")
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
;$string=_StringBetween($sString,$start,$ende)
while 
1
    sleep 
(100)
WEnd

Func _con 
()
    
$lin 0
    GUISetState
(@SW_HIDE,$Form1)
    
GUISetState(@SW_SHOW,$Form2)
    
$outfile GUICtrlRead($output)
    
$file =    GUICtrlRead($input)
    if 
$file "" Then
        MsgBox
(48,"Fehler","Keine .xml Datei angegeben!")
        
_input()
    EndIf
    if 
$outfile "" Then 
        
if FileExists($ScriptDir&"item_proto.sql"then
            _output 
()
        Else
        
$outfile "item_proto.sql"
    
EndIf
    EndIf
$lines _FileCountLines($file) - 1
$ges 
_FileCountLines($file) - 2
$start 
'"'
$ende '"'
While $lines->= 1
    $lin 
$lin+1
    $sString
FileReadLine($file,$lines)
    
$string=_StringBetween($sString,$start,$ende)
    
FileWrite($outfile,"INSERT INTO `item_proto` (`vnum`,`name`,`gb2312name`,`type`,`subtype`,`weight`,`size`,`antiflag`,`flag`,`wearflag`,`immuneflag`,`gold`,`shop_buy_price`,`limittype0`,`limitvalue0`,`limittype1`,`limitvalue1`,`applytype0`,`applyvalue0`,`applytype1`,`applyvalue1`,`applytype2`,`applyvalue2`,`value0`,`value1`,`value2`,`value3`,`value4`,`value5`,`socket0`,`socket1`,`socket2`,`socket3`,`socket4`,`socket5`,`refined_vnum`,`refine_set`,`magic_pct`,`specular`,`socket_pct`) VALUES (")
        
FileWrite($outfile,"'"&$string[0]&"',")
        
FileWrite($outfile,$string[1]&",")
    For 
$a 2 to 38 Step 1
        FileWrite
($outfile,"'"&$string[$a]&"',")
    
Next
    FileWrite
($outfile,"'"&$string[39]&"'")
    
FileWrite($outfile,");"&@CRLF)
    
Local $perc Round($lin/$ges*100)
    
GUICtrlSetData($Progress1,$perc)
    
GUICtrlSetData($insgzeilen,$ges)
    
GUICtrlSetData($aktuellzeilen,$lin)
$lines=$lines-1
WEnd
MsgBox
(64,"Fertig!","xml erfolgreich in sql umgewandelt!")
_ende ()
EndFunc

Func _input 
()
    
$in FileOpenDialog('Dateiauswahl',"",'xml-Datein(*.xml)')
    
GUICtrlSetData($input,$in)
EndFunc

Func _output 
()
    
$out FileOpenDialog('Dateiauswahl',"",'sql-Datein(*.sql)')
    
GUICtrlSetData($output,$out)
EndFunc

Func _ende 
()
    Exit
EndFunc

Func _close 
()
    Exit
EndFunc 
Ist in Autoit geschrieben
bin grad zu müde ne .exe hochzuladen
Scheint zu gehen habs nich genau getestet weil zu müde
gn8 und hf damit
01/01/2010 09:47 XxGiGoLoxX#2
was bewiirkt das genau?
01/01/2010 13:30 мзтіи2#3
NOT WORK !.

[Only registered and activated users can see links. Click Here To Register...]
01/01/2010 18:09 KaMeR1337#4
Quote:
Originally Posted by мзтіи2 View Post
NOT WORK !.
for me it works
01/01/2010 19:00 Tazaki#5
Quote:
Originally Posted by XxGiGoLoxX View Post
was bewiirkt das genau?
Frage ich mich auch...
...genauso, ob das in diesen Bereich gehört (aber ich weiß nicht ob ich mich irre, da ich den Sinn nicht ganz verstehe X.x)
01/01/2010 19:21 greenst0rm#6
is das nicht pserver bereich ?? wenn nicht verbessert mich bitte ;)
01/01/2010 21:13 мзтіи2#7
Quote:
Originally Posted by KaMeR1337 View Post
for me it works
oO how ?

[Only registered and activated users can see links. Click Here To Register...]
01/02/2010 13:13 dfish#8
auf jeden fall pserver bereich, vor allem sind da einige spaltennamen dabei die mir gar nichts sagen.
01/02/2010 15:27 Zonni#9
This Conwerter no dump to sql item_proto :/ '
Code:
[Err] 1136 - Column count doesn't match value count at row 1
[Err] 
[Msg] Finished - Unsuccessfully
--------------------------------------------------
01/02/2010 15:39 iMer#10
setze mich jez drann und fixxe es
€dit: fixxed
01/02/2010 18:31 мзтіи2#11
Not Work Please Fix.. Have Too Error

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ÇÕÆÇ,'Plywood','14','0','0','1','0','4','0','0',' 0','0','0','0','0','0','0','0',' at line 4
[Msg] Finished - Unsuccessfully
01/03/2010 14:00 kevinkevin3700#12
was bewirkt das
01/03/2010 14:05 [Ishtar]#13
Echt gut gemacht ;)
01/03/2010 20:12 FlashActiVe#14
Paar fragen was das tool bewirkt aber keine antwort... top upper...

ist es für denn Offizielen server oder nur für denn Privaten?
01/04/2010 20:18 iMer#15
Du kannst die Item_proto datei ausm extractor von tim (düt: [Only registered and activated users can see links. Click Here To Register...] )
theorethisch zu .sql dateien machen
bei nem testfile klappts
bei anderen nich
ka worans noch liegen kann
wer den fehler weiß ~> pn