Deucalion 249 Posted April 28, 2014 Share Posted April 28, 2014 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hi. I wanna to show you how can you convert item_proto to sql and later to txt files. XML -> SQL First we need this program: This is the hidden content, please Sign In or Sign Up scan: This is the hidden content, please Sign In or Sign Up Ther is something, but i haven't better program so you download it for your own responsibility With it, we can convert our xml proto to sql But first, from our xml file, we need to delete all <!--AddonType="0"--> and <!--AddonType="99"--> easy with notepad++ and ctrl+h and now we run our program and select file to convert. After moment we'll have a sql file, but if we have a locale_name column in item_proto we need to change also with ctr+h all gb2312name to locale_name, and now we can upload file with "execute sql file" or simpy with query to our database SQL -> TXT To convert item_proto sql to txt files, you need this script in python http://pastebin.com/K5EDE4b6 Configuration: You need MySQLdb on your freebsd If you haven't it, just install it - it's a mysql library to python cd /usr/ports/databases/py-MySQLdb/ && make install clean You need also change the connection properties in script default it's: host_mysql = 'localhost' user_mysql = 'mt2' passwd_mysql = 'mt2!@#' And if you want convert also mob_proto in this way, you need onlu change from #print mob_proto() to print mob_proto() in the end of file. Now script should generate our protos in his directory . These programs are not mine. The python script i found somewhere and just modified it to 40k version I think that it's all, if you have any better program or any better way or idea you can show it Maybe in the future I will write to that one big script, but now I have no time for this ;/ If there are any problems, I'll try to help #Updated python script Regards Deucalion 97 1 8 1 2 2 1 2 1 39 5 73 Link to comment Share on other sites More sharing options...
arsenlupin 1 Posted April 28, 2014 Share Posted April 28, 2014 do you have source i deleted AddonType="0" 99 dont have all is AddonType="0" got error 1 Link to comment Share on other sites More sharing options...
arsenlupin 1 Posted April 28, 2014 Share Posted April 28, 2014 need to change AddonType="0" delete VnumRange="99" delete Socket2="0" change To Socket2="0" Socket3="0" Socket4="0" Socket5="0" good work man ty Link to comment Share on other sites More sharing options...
Mercury 5 Posted April 29, 2014 Share Posted April 29, 2014 What is the command to run the script? where I have to place it? you could explain a little more? thanks Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 29, 2014 Author Share Posted April 29, 2014 You put script e.g. To /convert ,then you go to this directory and run it by python name_script.py . Soon I will write a full converter in python and i''ll release it :-P Sent from my ST25i using Tapatalk 1 Link to comment Share on other sites More sharing options...
astinasti 7 Posted May 4, 2014 Share Posted May 4, 2014 When i run the script appear one error # cd /usr/home/game/share # python convert.py File "convert.py", line 396 180, ^ SyntaxError: invalid syntax line 396 is : addon_type = { 180, Link to comment Share on other sites More sharing options...
Deucalion 249 Posted May 4, 2014 Author Share Posted May 4, 2014 Hmm... I can check it tomorrow,if you want it now check my python system ( in signature) and there you have command 'convert item_proto' Sent from my ST25i using Tapatalk Link to comment Share on other sites More sharing options...
loel2010 4 Posted June 2, 2014 Share Posted June 2, 2014 Nice script its working! But is there any way to make the convertor takes the sql file from the convertor folder directory? Link to comment Share on other sites More sharing options...
Deucalion 249 Posted June 2, 2014 Author Share Posted June 2, 2014 Yes it's possible, but I haven't time for this right now :/ Sent from my ST25i using Tapatalk Link to comment Share on other sites More sharing options...
Night 366 Posted June 2, 2014 Share Posted June 2, 2014 i was searching for this thanx 31: "ITEM_EXTRACT", 32: "ITEM_SECONDARY_COIN", 33: "ITEM_RING", 34: "ITEM_BELT" ^^ Link to comment Share on other sites More sharing options...
BEST 0 Posted July 3, 2014 Share Posted July 3, 2014 getting this: convert_itemm.py:583: SyntaxWarning: name 'errors' is assigned to before global declaration global errors convert_itemm.py:592: SyntaxWarning: name 'errors' is assigned to before global declaration global errors Connecting to database proto... Connected. Converting item_proto... Traceback (most recent call last): File "convert_itemm.py", line 867, in <module> print item_proto() File "convert_itemm.py", line 857, in item_proto item_proto_line = "%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%s" % (row[0], """ + row[1] + """, """ + get_item_type(row[3], row[0]) + """ , """ + get_item_subtype(row[3], row[4], row[0]) + """, row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) IndexError: tuple index out of range and not work for me Link to comment Share on other sites More sharing options...
sucopowa 7 Posted July 8, 2014 Share Posted July 8, 2014 hey Deucalion, im at the first step right now and well, i have to say that this converts my xml ind an succesfully query, but sometimes he miss lines, and sometimes lines are double, im i doing soemthing wrong? i just renamed gb123name or w/e into "local_name" like my itemproto table is, and well, just removed that addontype=0 and 99. nothing else :/ an expample could be this: <Item vnum="1" name="돈꾸러미" locale_name="Yang" type="9" subtype="0" weight="0" size="1" antiflag="0" flag="0" wearflag="0" immuneflag="0" gold="0" buy_price="0" limittype0="0" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="0" applyvalue0="0" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="0" value2="0" value3="0" value4="0" value5="0" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="0" refine_set="0" magic_pct="0" specular="0" socket_pct="0" /> <Item vnum="2" name="한국무쌍버젼" locale_name="Versi? Espa?la" type="0" subtype="0" weight="0" size="1" antiflag="0" flag="0" wearflag="0" immuneflag="0" gold="0" buy_price="0" limittype0="0" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="0" applyvalue0="0" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="0" value2="0" value3="0" value4="0" value5="0" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="0" refine_set="0" magic_pct="0" specular="0" socket_pct="0" /> <Item vnum="10" name="도+0" locale_name="Espada +0" type="1" subtype="0" weight="0" size="2" antiflag="32" flag="1" wearflag="16" immuneflag="0" gold="0" buy_price="0" limittype0="1" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="7" applyvalue0="22" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="15" value2="19" value3="13" value4="15" value5="0" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="11" refine_set="1" magic_pct="15" specular="0" socket_pct="1" /> <Item vnum="11" name="도+1" locale_name="Espada +1" type="1" subtype="0" weight="0" size="2" antiflag="32" flag="1" wearflag="16" immuneflag="0" gold="100" buy_price="100" limittype0="1" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="7" applyvalue0="22" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="15" value2="19" value3="13" value4="15" value5="7" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="12" refine_set="2" magic_pct="15" specular="0" socket_pct="1" /> <Item vnum="12" name="도+2" locale_name="Espada +2" type="1" subtype="0" weight="0" size="2" antiflag="32" flag="1" wearflag="16" immuneflag="0" gold="100" buy_price="100" limittype0="1" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="7" applyvalue0="22" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="15" value2="19" value3="13" value4="15" value5="14" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="13" refine_set="3" magic_pct="15" specular="0" socket_pct="1" /> <Item vnum="13" name="도+3" locale_name="Espada +3" type="1" subtype="0" weight="0" size="2" antiflag="32" flag="1" wearflag="16" immuneflag="0" gold="100" buy_price="150" limittype0="1" limitvalue0="0" limittype1="0" limitvalue1="0" applytype0="7" applyvalue0="22" applytype1="0" applyvalue1="0" applytype2="0" applyvalue2="0" value0="0" value1="15" value2="19" value3="13" value4="15" value5="21" socket0="0" socket1="0" socket2="0" socket3="0" socket4="0" socket5="0" refine_vnum="14" refine_set="4" magic_pct="15" specular="0" socket_pct="1" /> and converted; INSERT INTO `item_proto` VALUES ('2', 'Versi? Espa?la', 'Versi? Espa?la', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `item_proto` VALUES ('10', 'Espada +0', 'Espada +0', '1', '0', '0', '2', '32', '1', '16', '0', '0', '0', '11', '1', '0', '15', '1', '0', '0', '0', '7', '22', '0', '0', '0', '0', '0', '15', '19', '13', '15', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0'); INSERT INTO `item_proto` VALUES ('10', 'Espada +0', 'Espada +0', '1', '0', '0', '2', '32', '1', '16', '0', '0', '0', '11', '1', '0', '15', '1', '0', '0', '0', '7', '22', '0', '0', '0', '0', '0', '15', '19', '13', '15', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0'); INSERT INTO `item_proto` VALUES ('12', 'Espada +2', 'Espada +2', '1', '0', '0', '2', '32', '1', '16', '0', '100', '100', '13', '3', '0', '15', '1', '0', '0', '0', '7', '22', '0', '0', '0', '0', '0', '15', '19', '13', '15', '14', '0', '0', '0', '0', '0', '0', '1', '0', '0'); INSERT INTO `item_proto` VALUES ('12', 'Espada +2', 'Espada +2', '1', '0', '0', '2', '32', '1', '16', '0', '100', '100', '13', '3', '0', '15', '1', '0', '0', '0', '7', '22', '0', '0', '0', '0', '0', '15', '19', '13', '15', '14', '0', '0', '0', '0', '0', '0', '1', '0', '0'); INSERT INTO `item_proto` VALUES ('13', 'Espada +3', 'Espada +3', '1', '0', '0', '2', '32', '1', '16', '0', '100', '150', '14', '4', '0', '15', '1', '0', '0', '0', '7', '22', '0', '0', '0', '0', '0', '15', '19', '13', '15', '21', '0', '0', '0', '0', '0', '0', '1', '0', '0'); some lines missing, and other doubles as i said :/ thanks fro reading and for your work ^^ Link to comment Share on other sites More sharing options...
Toxic 11 Posted July 15, 2014 Share Posted July 15, 2014 proto.py:583: SyntaxWarning: name 'errors' is assigned to before global declaration global errors proto.py:592: SyntaxWarning: name 'errors' is assigned to before global declaration global errors It's ok? :S Link to comment Share on other sites More sharing options...
Toxic 11 Posted July 15, 2014 Share Posted July 15, 2014 item_proto_line = "%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%s" % (row[0], """ + row[1] + """, """ + get_item_type(row[3], row[0]) + """ , """ + get_item_subtype(row[3], row[4], row[0]) + """, row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) TypeError: cannot concatenate 'str' and 'NoneType' objects WTF? Link to comment Share on other sites More sharing options...
HellRoad 4 Posted October 4, 2014 Share Posted October 4, 2014 getting this: convert_itemm.py:583: SyntaxWarning: name 'errors' is assigned to before global declaration global errors convert_itemm.py:592: SyntaxWarning: name 'errors' is assigned to before global declaration global errors Connecting to database proto... Connected. Converting item_proto... Traceback (most recent call last): File "convert_itemm.py", line 867, in <module> print item_proto() File "convert_itemm.py", line 857, in item_proto item_proto_line = "%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%s" % (row[0], """ + row[1] + """, """ + get_item_type(row[3], row[0]) + """ , """ + get_item_subtype(row[3], row[4], row[0]) + """, row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) IndexError: tuple index out of range and not work for me item_proto_line = "%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%st%s" % (row[0], """ + row[1] + """, """ + get_item_type(row[3], row[0]) + """ , """ + get_item_subtype(row[3], row[4], row[0]) + """, row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) TypeError: cannot concatenate 'str' and 'NoneType' objects WTF? Take a look here Link to comment Share on other sites More sharing options...
kzi 1 Posted January 4, 2015 Share Posted January 4, 2015 How can I solv this error: File "convert.py", line 396 180, ^ SyntaxError: invalid syntax Link to comment Share on other sites More sharing options...
Premium iRETEMAG 137 Posted January 19, 2015 Premium Share Posted January 19, 2015 python not found ?? Link to comment Share on other sites More sharing options...
Human 18 Posted March 26, 2016 Share Posted March 26, 2016 Excellent guide it works good ... but i have problem with converting item proto using convertproto.py if any1 can correct it will be good Error while converting Hide contents File "convert_proto.py", line 857, in item_proto item_proto_line = "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (row[0], "\"" + row[1] + "\"", "\"" + get_item_type(row[3], row[0]) + "\"" , "\"" + get_item_subtype(row[3], row[4], row[0]) + "\"", row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) TypeError: cannot concatenate 'str' and 'long' objects I tell you why it is happening normal convert proto the vnum_range will be last so it wont make problem but here we added vnum_range next to vnum that is row 2... so its making problem So any one who correct this will be helpful i tried but it says " TypeError: not enough arguments for format string " Here is my Convert proto.py Error section Hide contents out_file_itemproto = open("item_proto.txt", "w") out_file_itemnames = open("item_names.txt", "w") print "Converting item_proto..." for row in rows: item_proto_line = "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (row[0], "\"" + row[1] + "\"", "\"" + get_item_type(row[3], row[0]) + "\"" , "\"" + get_item_subtype(row[3], row[4], row[0]) + "\"", row[6] , get_antiflag(row[7], row[0]), get_flag(row[8], row[0]), get_wearflag(row[9], row[0]), get_immuneflag(row[10]), row[11], row[12], row[13], row[14], row[16], get_limittype(row[17]), row[18], get_limittype(row[19]), row[20], get_apply(row[21]), row[22], get_apply(row[23]), row[24], get_apply(row[25]), row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[39], row[40], row[41]) item_names_line = "%s\t%s" % (row[0], row[2]) out_file_itemproto.write(item_proto_line + "\r\n") out_file_itemnames.write(item_names_line + "\r\n") out_file_itemproto.close() Thanks in Advance 1 Link to comment Share on other sites More sharing options...
Recommended Posts