You last visited: Today at 02:49
Advertisement
Kick to convert: easy and fast way to convert your item_proto/mob_proto to txt files!
Discussion on Kick to convert: easy and fast way to convert your item_proto/mob_proto to txt files! within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.
09/21/2013, 12:41
#1
elite*gold: 0
Join Date: Sep 2013
Posts: 24
Received Thanks: 27
quick script: item_proto/mob_proto db to txt files for rev-34k game!
Hi all,
this is my first release
This "kick converter" will allow you to generate txt files (item_names, item_proto, mob_proto, mob_names) for the rev-34k game.
The script was written in python by me, so you need python 2.7 and MySQLDB (python extension) installed on your server.
If you found any error, please report it to me and I'll fix it as soon as possibile.
PS: If you get errors while converting the item_proto, please remove items that have type 29 or type 31.
PPS: The archive was created with 7zip.
PPPS: Remeber to open the .py files and change the mysql connection data.
The line to edit is the following:
Code:
db = MySQLdb.connect(host="localhost", user="root", passwd="psw", db="proto")
Have a nice day!
-------------------------------------------------
Changelog:
Code:
v2:
-fixed item_proto converter
-fixed item duration
v3:
-fixed addon_type
Attached Files
34kconverter.zip
(4.8 KB, 154 views)
34kconverter_v2.zip
(4.8 KB, 96 views)
34kconverter_v3.zip
(4.8 KB, 927 views)
09/21/2013, 12:54
#2
elite*gold: 0
Join Date: Jan 2010
Posts: 597
Received Thanks: 441
Bestimmt zu gebrauchen, Thank you!
09/21/2013, 19:17
#3
elite*gold: 260
Join Date: Jan 2013
Posts: 178
Received Thanks: 104
good work !!
09/21/2013, 19:22
#4
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
thanks dude
09/29/2013, 13:58
#5
elite*gold: 0
Join Date: Sep 2013
Posts: 24
Received Thanks: 27
Updated to v3.
09/29/2013, 16:48
#6
elite*gold: 0
Join Date: Nov 2011
Posts: 395
Received Thanks: 29
awasome thanks
09/29/2013, 22:41
#7
elite*gold: 0
Join Date: Dec 2007
Posts: 96
Received Thanks: 46
thanks <3333
10/02/2013, 09:15
#8
elite*gold: 50
Join Date: May 2011
Posts: 269
Received Thanks: 990
Not bad, but that Get*Flag is so unsightly
Check mine old xml converter:
Code:
## Metin2 ItemProto converter r34083
## By P3NG3R
## 2013.07.01 @ 11:30 AM item_names.txt | item_proto.txt
import os, sys#, time, md5
#from random import randint as rand
__USAGE__ = '''Metin2 ItemProto-XML Converter
This program convert item_proto_dump.xml to item_names.txt and item_proto.txt
Version 1.1.3 Alpha
Usage:
\t%s item_proto_dump.xml
''' % sys.argv[0].split(os.sep)[-1]
if sys.platform in ['linux', 'linux2']:
cls = lambda: os.system('clear')
w8 = lambda: None
mode = lambda: None
else:
cls = lambda: os.system('cls')
w8 = lambda: os.system("pause")
mode = lambda x,y: os.system("mode %d, %d" % (x, y))
# <!--AddonType="0"--><Item vnum="90060" name="Diamond(1,5 Md.)" gb2312name="Gyémántrúd(1,5 Md.)" type="18" subtype="0" weight="0" size="1" antiflag="98624" flag="4" 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="64992" socket2="127" socket3="64976" socket4="21631" socket5="4855" refine_vnum="0" refine_set="0" magic_pct="0" specular="0" socket_pct="0" />
TYPE = {
0 : "ITEM_NONE",
1 : "ITEM_WEAPON",
2 : "ITEM_ARMOR",
3 : "ITEM_USE",
4 : "ITEM_AUTOUSE",
5 : "ITEM_MATERIAL",
6 : "ITEM_SPECIAL",
7 : "ITEM_TOOL",
8 : "ITEM_LOTTERY",
9 : "ITEM_ELK",
10 : "ITEM_METIN",
11 : "ITEM_CONTAINER",
12 : "ITEM_FISH",
13 : "ITEM_ROD",
14 : "ITEM_RESOURCE",
15 : "ITEM_CAMPFIRE",
16 : "ITEM_UNIQUE",
17 : "ITEM_SKILLBOOK",
18 : "ITEM_QUEST",
19 : "ITEM_POLYMORPH",
20 : "ITEM_TREASURE_BOX",
21 : "ITEM_TREASURE_KEY",
22 : "ITEM_SKILLFORGET",
23 : "ITEM_GIFTBOX",
24 : "ITEM_PICK",
25 : "ITEM_HAIR",
26 : "ITEM_TOTEM",
27 : "ITEM_BLEND",
28 : "ITEM_COSTUME",
#29 : "ITEM_DS",
#30 : "ITEM_SPECIAL_DS",
}
SUBTYPE = {
0 : "NONE",
"ITEM_WEAPON" : {
0: "WEAPON_SWORD",
1: "WEAPON_DAGGER",
2: "WEAPON_BOW",
3: "WEAPON_TWO_HANDED",
4: "WEAPON_BELL",
5: "WEAPON_FAN",
6: "WEAPON_ARROW",
7: "WEAPON_MOUNT_SPEAR",
},
"ITEM_ARMOR" : {
0: "ARMOR_BODY",
1: "ARMOR_HEAD",
2: "ARMOR_SHIELD",
3: "ARMOR_WRIST",
4: "ARMOR_FOOTS",
5: "ARMOR_NECK",
6: "ARMOR_EAR",
7: "ARMOR_NUM_TYPES",
},
"ITEM_USE" : {
0: "USE_POTION",
1: "USE_TALISMAN",
2: "USE_TUNING",
3: "USE_MOVE",
4: "USE_TREASURE_BOX",
5: "USE_MONEYBAG",
6: "USE_BAIT",
7: "USE_ABILITY_UP",
8: "USE_AFFECT",
9: "USE_CREATE_STONE",
10: "USE_SPECIAL",
11: "USE_POTION_NODELAY",
12: "USE_CLEAR",
13: "USE_INVISIBILITY",
14: "USE_DETACHMENT",
15: "USE_BUCKET",
16: "USE_POTION_CONTINUE",
17: "USE_CLEAN_SOCKET",
18: "USE_CHANGE_ATTRIBUTE",
19: "USE_ADD_ATTRIBUTE",
20: "USE_ADD_ACCESSORY_SOCKET",
21: "USE_PUT_INTO_ACCESSORY_SOCKET",
22: "USE_ADD_ATTRIBUTE2",
23: "USE_RECIPE",
24: "USE_CHANGE_ATTRIBUTE2",
25: "USE_BIND",
26: "USE_UNBIND",
},
"ITEM_AUTOUSE" : {
0: "AUTOUSE_POTION",
1: "AUTOUSE_ABILITY_UP",
2: "AUTOUSE_BOMB",
3: "AUTOUSE_GOLD",
4: "AUTOUSE_MONEYBAG",
5: "AUTOUSE_TREASURE_BOX",
},
"ITEM_MATERIAL" : {
0: "MATERIAL_LEATHER",
1: "MATERIAL_BLOOD",
2: "MATERIAL_ROOT",
3: "MATERIAL_NEEDLE",
4: "MATERIAL_JEWEL",
#5: "MATERIAL_DS_REFINE_NORMAL",
#6: "MATERIAL_DS_REFINE_BLESSED",
#7: "MATERIAL_DS_REFINE_HOLLY",
},
"ITEM_SPECIAL" : {
0: "SPECIAL_MAP",
1: "SPECIAL_KEY",
2: "SPECIAL_DOC",
3: "SPECIAL_SPIRIT",
},
"ITEM_TOOL" : {
0: "TOOL_FISHING_ROD",
},
"ITEM_LOTTERY" : {
0: "LOTTERY_TICKET",
1: "LOTTERY_INSTANT",
},
"ITEM_METIN" : {
0: "METIN_NORMAL",
1: "METIN_GOLD",
},
"ITEM_FISH" : {
0: "FISH_ALIVE",
1: "FISH_DEAD",
},
"ITEM_RESOURCE" : {
0: "RESOURCE_FISHBONE",
1: "RESOURCE_WATERSTONEPIECE",
2: "RESOURCE_WATERSTONE",
3: "RESOURCE_BLOOD_PEARL",
4: "RESOURCE_BLUE_PEARL",
5: "RESOURCE_WHITE_PEARL",
6: "RESOURCE_BUCKET",
7: "RESOURCE_CRYSTAL",
8: "RESOURCE_GEM",
9: "RESOURCE_STONE",
10: "RESOURCE_METIN",
11: "RESOURCE_ORE",
},
"ITEM_UNIQUE" : {
0: "UNIQUE_NONE",
1: "UNIQUE_BOOK",
2: "UNIQUE_SPECIAL_RIDE",
3: "UNIQUE_3",
4: "UNIQUE_4",
5: "UNIQUE_5",
6: "UNIQUE_6",
7: "UNIQUE_7",
8: "UNIQUE_8",
9: "UNIQUE_9",
10: "USE_SPECIAL", #Bugfix XD
},
"ITEM_COSTUME" : {
0: "COSTUME_BODY",
1: "COSTUME_HAIR",
},
}
FLAG = {
0 : "NONE",
pow(2, 0) : "ITEM_TUNABLE",
pow(2, 1) : "ITEM_SAVE",
pow(2, 2) : "ITEM_STACKABLE",
pow(2, 3) : "COUNT_PER_1GOLD",
pow(2, 4) : "ITEM_SLOW_QUERY",
pow(2, 5) : "ITEM_UNIQUE",
pow(2, 6) : "ITEM_MAKECOUNT",
pow(2, 7) : "ITEM_IRREMOVABLE",
pow(2, 8) : "CONFIRM_WHEN_USE",
pow(2, 9) : "QUEST_USE",
pow(2, 10) : "QUEST_USE_MULTIPLE",
pow(2, 11) : "QUEST_GIVE",
pow(2, 12) : "ITEM_QUEST",
pow(2, 13) : "LOG",
pow(2, 14) : "STACKABLE",
pow(2, 15) : "SLOW_QUERY",
pow(2, 16) : "REFINEABLE",
pow(2, 17) : "IRREMOVABLE",
pow(2, 18) : "ITEM_APPLICABLE",
}
ANTIFLAG = {
0 : "NONE",
pow(2, 0) : "ANTI_FEMALE",
pow(2, 1) : "ANTI_MALE",
pow(2, 2) : "ANTI_MUSA",#Warrior
pow(2, 3) : "ANTI_ASSASSIN",
pow(2, 4) : "ANTI_SURA",
pow(2, 5) : "ANTI_MUDANG",#Shaman
pow(2, 6) : "ANTI_GET",
pow(2, 7) : "ANTI_DROP",
pow(2, 8) : "ANTI_SELL",
pow(2, 9) : "ANTI_EMPIRE_A",
pow(2, 10) : "ANTI_EMPIRE_B",
pow(2, 11) : "ANTI_EMPIRE_C",
pow(2, 12) : "ANTI_SAVE",
pow(2, 13) : "ANTI_GIVE",
pow(2, 14) : "ANTI_PKDROP",
pow(2, 15) : "ANTI_STACK",
pow(2, 16) : "ANTI_MYSHOP",
pow(2, 17) : "ANTI_SAFEBOX",
}
WEARFLAG = {
0 : "NONE",
pow(2, 0) : "WEAR_BODY",
pow(2, 1) : "WEAR_HEAD",
pow(2, 2) : "WEAR_FOOTS",
pow(2, 3) : "WEAR_WRIST",
pow(2, 4) : "WEAR_WEAPON",
pow(2, 5) : "WEAR_NECK",
pow(2, 6) : "WEAR_EAR",
pow(2, 7) : "WEAR_SHIELD",
pow(2, 8) : "WEAR_UNIQUE",
pow(2, 9) : "WEAR_ARROW",
pow(2, 10) : "WEAR_HAIR",
pow(2, 11) : "WEAR_ABILITY",
}
IMMUNEFLAG = {
0 : "NONE",
pow(2, 0) : "PARA",
pow(2, 1) : "CURSE",
pow(2, 2) : "STUN",
pow(2, 3) : "SLEEP",
pow(2, 4) : "SLOW",
pow(2, 5) : "POISON",
pow(2, 6) : "TERROR",
}
LIMITTYPE = {
0 : "LIMIT_NONE",
1 : "LEVEL",
2 : "STR",
3 : "DEX",
4 : "INT",
5 : "CON",
6 : "PC_BANG",
7 : "REAL_TIME",
8 : "REAL_TIME_FIRST_USE",
9 : "TIMER_BASED_ON_WEAR",
}
APPLYTYPE = {
0 : "APPLY_NONE",
1 : "APPLY_MAX_HP",
2 : "APPLY_MAX_SP",
3 : "APPLY_CON",
4 : "APPLY_INT",
5 : "APPLY_STR",
6 : "APPLY_DEX",
7 : "APPLY_ATT_SPEED",
8 : "APPLY_MOV_SPEED",
9 : "APPLY_CAST_SPEED",
10 : "APPLY_HP_REGEN",
11 : "APPLY_SP_REGEN",
12 : "APPLY_POISON_PCT",
13 : "APPLY_STUN_PCT",
14 : "APPLY_SLOW_PCT",
15 : "APPLY_CRITICAL_PCT",
16 : "APPLY_PENETRATE_PCT",
17 : "APPLY_ATTBONUS_HUMAN",
18 : "APPLY_ATTBONUS_ANIMAL",
19 : "APPLY_ATTBONUS_ORC",
20 : "APPLY_ATTBONUS_MILGYO",
21 : "APPLY_ATTBONUS_UNDEAD",
22 : "APPLY_ATTBONUS_DEVIL",
23 : "APPLY_STEAL_HP",
24 : "APPLY_STEAL_SP",
25 : "APPLY_MANA_BURN_PCT",
26 : "APPLY_DAMAGE_SP_RECOVER",
27 : "APPLY_BLOCK",
28 : "APPLY_DODGE",
29 : "APPLY_RESIST_SWORD",
30 : "APPLY_RESIST_TWOHAND",
31 : "APPLY_RESIST_DAGGER",
32 : "APPLY_RESIST_BELL",
33 : "APPLY_RESIST_FAN",
34 : "APPLY_RESIST_BOW",
35 : "APPLY_RESIST_FIRE",
36 : "APPLY_RESIST_ELEC",
37 : "APPLY_RESIST_MAGIC",
38 : "APPLY_RESIST_WIND",
39 : "APPLY_REFLECT_MELEE",
40 : "APPLY_REFLECT_CURSE",
41 : "APPLY_POISON_REDUCE",
42 : "APPLY_KILL_SP_RECOVER",
43 : "APPLY_EXP_DOUBLE_BONUS",
44 : "APPLY_GOLD_DOUBLE_BONUS",
45 : "APPLY_ITEM_DROP_BONUS",
46 : "APPLY_POTION_BONUS",
47 : "APPLY_KILL_HP_RECOVER",
48 : "APPLY_IMMUNE_STUN",
49 : "APPLY_IMMUNE_SLOW",
50 : "APPLY_IMMUNE_FALL",
51 : "APPLY_SKILL",
52 : "APPLY_BOW_DISTANCE",
53 : "APPLY_ATT_GRADE_BONUS",
54 : "APPLY_DEF_GRADE_BONUS",
55 : "APPLY_MAGIC_ATT_GRADE",
56 : "APPLY_MAGIC_DEF_GRADE",
57 : "APPLY_CURSE_PCT",
58 : "APPLY_MAX_STAMINA",
59 : "APPLY_ATTBONUS_WARRIOR",
60 : "APPLY_ATTBONUS_ASSASSIN",
61 : "APPLY_ATTBONUS_SURA",
62 : "APPLY_ATTBONUS_SHAMAN",
63 : "APPLY_ATTBONUS_MONSTER",
64 : "APPLY_MALL_ATTBONUS",
65 : "APPLY_MALL_DEFBONUS",
66 : "APPLY_MALL_EXPBONUS",
67 : "APPLY_MALL_ITEMBONUS",
68 : "APPLY_MALL_GOLDBONUS",
69 : "APPLY_MAX_HP_PCT",
70 : "APPLY_MAX_SP_PCT",
71 : "APPLY_SKILL_DAMAGE_BONUS",
72 : "APPLY_NORMAL_HIT_DAMAGE_BONUS",
73 : "APPLY_SKILL_DEFEND_BONUS",
74 : "APPLY_NORMAL_HIT_DEFEND_BONUS",
75 : "APPLY_PC_BANG_EXP_BONUS",
76 : "APPLY_PC_BANG_DROP_BONUS",
77 : "APPLY_EXTRACT_HP_PCT",
78 : "APPLY_RESIST_WARRIOR",
79 : "APPLY_RESIST_ASSASSIN",
80 : "APPLY_RESIST_SURA",
81 : "APPLY_RESIST_SHAMAN",
82 : "APPLY_ENERGY",
83 : "APPLY_DEF_GRADE",
84 : "APPLY_COSTUME_ATTR_BONUS",
85 : "APPLY_MAGIC_ATTBONUS_PER",
86 : "APPLY_MELEE_MAGIC_ATTBONUS_PER",
# 87 : "APPLY_RESIST_ICE",
# 88 : "APPLY_RESIST_EARTH",
# 89 : "APPLY_RESIST_DARK",
# 90 : "APPLY_ANTI_CRITICAL_PCT",
# 91 : "APPLY_ANTI_PENETRATE_PCT",
# 255 : "APPLY_MELEE_MAGIC_ATTBONUS_PER",#Pet
}
def IsXML(s):
buf = open(s, "r")
r = buf.read()
buf.close()
if (r.count('\t<Item vnum="') > 10 or r.count('\t<!--AddonType="0"--><Item vnum="') > 10) and r.count(' gb2312name="') > 10:
return True
return False
class Application:
def __init__(self, fname):
global FILENAME
self.filename = fname
self.ItemList = []
self.ItemProto = []
if not os.path.exists("addontypeitems.txt"):
f=open("addontypeitems.txt","w")
f.write('180\n181\n182\n183\n184\n185\n186\n187\n188\n189\n190\n191\n192\n193\n194\n195\n196\n197\n198\n199\n290\n291\n292\n293\n294\n295\n296\n297\n298\n299\n350\n351\n352\n353\n354\n355\n356\n357\n358\n359\n360\n361\n362\n363\n364\n365\n366\n367\n368\n369\n802\n803\n804\n805\n806\n807\n808\n809\n811\n812\n813\n814\n815\n816\n800\n810\n801\n817\n818\n819\n1130\n1131\n1132\n1133\n1134\n1135\n1136\n1137\n1138\n1139\n1170\n1171\n1172\n1173\n1174\n1175\n1176\n1177\n1178\n1179\n1300\n1301\n1302\n1303\n1304\n1305\n1306\n1307\n1308\n1309\n2150\n2151\n2152\n2153\n2154\n2155\n2156\n2157\n2158\n2159\n2170\n2171\n2172\n2173\n2174\n2175\n2176\n2177\n2178\n2179\n2340\n2341\n2342\n2343\n2344\n2345\n2346\n2347\n2348\n2349\n3160\n3161\n3162\n3163\n3164\n3165\n3166\n3167\n3168\n3169\n3210\n3211\n3212\n3213\n3214\n3215\n3216\n3217\n3218\n3219\n3330\n3331\n3332\n3333\n3334\n3335\n3336\n3337\n3338\n3339\n5110\n5111\n5112\n5113\n5114\n5115\n5116\n5117\n5118\n5119\n5120\n5121\n5122\n5123\n5124\n5125\n5126\n5127\n5128\n5129\n5290\n5291\n5292\n5293\n5294\n5295\n5296\n5297\n5298\n5299\n7160\n7161\n7162\n7163\n7164\n7165\n7166\n7167\n7168\n7169')
f.close()
del f
def __del__(self):
self.ItemList = []
def CreateTokens(self, line):
"""Creating 40 tokens from a line of item_proto"""
line = line[line.find("<Item ")+6:]
line = line.replace('" name','"&name')
line = line.replace('" gb2312name','"&gb2312name')
line = line.replace('" type','"&type')
line = line.replace('" subtype','"&subtype')
line = line.replace('" weight','"&weight')
line = line.replace('" size','"&size')
line = line.replace('" antiflag','"&antiflag')
line = line.replace('" flag','"&flag')
line = line.replace('" wearflag','"&wearflag')
line = line.replace('" immuneflag','"&immuneflag')
line = line.replace('" gold','"&gold')
line = line.replace('" buy_price','"&buy_price')
line = line.replace('" limittype0','"&limittype0')
line = line.replace('" limitvalue0','"&limitvalue0')
line = line.replace('" limittype1','"&limittype1')
line = line.replace('" limitvalue1','"&limitvalue1')
line = line.replace('" applytype0','"&applytype0')
line = line.replace('" applyvalue0','"&applyvalue0')
line = line.replace('" applytype1','"&applytype1')
line = line.replace('" applyvalue1','"&applyvalue1')
line = line.replace('" applytype2','"&applytype2')
line = line.replace('" applyvalue2','"&applyvalue2')
line = line.replace('" value0','"&value0')
line = line.replace('" value1','"&value1')
line = line.replace('" value2','"&value2')
line = line.replace('" value3','"&value3')
line = line.replace('" value4','"&value4')
line = line.replace('" value5','"&value5')
line = line.replace('" socket0','"&socket0')
line = line.replace('" socket1','"&socket1')
line = line.replace('" socket2','"&socket2')
line = line.replace('" socket3','"&socket3')
line = line.replace('" socket4','"&socket4')
line = line.replace('" socket5','"&socket5')
line = line.replace('" refine_vnum','"&refine_vnum')
line = line.replace('" refine_set','"&refine_set')
line = line.replace('" magic_pct','"&magic_pct')
line = line.replace('" specular','"&specular')
line = line.replace('" socket_pct','"&socket_pct')
return line.split('&')
def IsAddonItem(self, item):
lines = open("addontypeitems.txt","r").readlines()
for line in lines:
line = line.strip()
if int(line)==int(item):
return True
return False
def GetValue(self, s):
if s.count('"')<1:
return 0
data = s.split('"')[1]
if data.isdigit():
if long(data) > sys.maxint:
return hash(long(data))
return data
def Preparing(self):
lines = open(self.filename, 'r').readlines()
for line in lines[1:-1]:
try:
tokens = self.CreateTokens(line)
# s=open('tokens_ini', "w")
# s.write("---------------START---------------\n")
# for token in tokens:
# s.write("tokens[%i] ==> %s\n" % (tokens.index(token), token))
# s.write("----------------END----------------\n\n")
# s.close()
vnum = self.GetValue(tokens[0])
name = self.GetValue(tokens[1])
localename = self.GetValue(tokens[2])
type = self.GetValue(tokens[3])
subtype = self.GetValue(tokens[4])
size = self.GetValue(tokens[6])
antiflag = self.GetValue(tokens[7])
flag = self.GetValue(tokens[8])
wearflag = self.GetValue(tokens[9])
immuneflag = self.GetValue(tokens[10])
gold = self.GetValue(tokens[11])
shopbuyprice = self.GetValue(tokens[12])
refineset = self.GetValue(tokens[36])
refinesetd = self.GetValue(tokens[35])
refinedvnum = self.GetValue(tokens[35])
magicpct = self.GetValue(tokens[37])
limittype0 = self.GetValue(tokens[13])
limitvalue0 = self.GetValue(tokens[14])
limittype1 = self.GetValue(tokens[15])
limitvalue1 = self.GetValue(tokens[16])
applytype0 = self.GetValue(tokens[17])
applyvalue0 = self.GetValue(tokens[18])
applytype1 = self.GetValue(tokens[19])
applyvalue1 = self.GetValue(tokens[20])
applytype2 = self.GetValue(tokens[21])
applyvalue2 = self.GetValue(tokens[22])
value0 = self.GetValue(tokens[23])
value1 = self.GetValue(tokens[24])
value2 = self.GetValue(tokens[25])
value3 = self.GetValue(tokens[26])
value4 = self.GetValue(tokens[27])
value5 = self.GetValue(tokens[28])
specular = self.GetValue(tokens[38])
socketpct = self.GetValue(tokens[39])
if self.IsAddonItem(int(vnum)):
addontype = '-1'
else:
addontype = '0'
except Exception, e:
print("Exception: (%s), Error on line %s" % (e, lines.index(line)+1))
itemData = {
"VNUM" : vnum,
"NAME" : name,
"LOCALE_NAME" : localename,
"TYPE" : type,
"SUBTYPE" : subtype,
"WEIGHT" : '0',
"SIZE" : size,
"ANTIFLAG" : antiflag,
"FLAG" : flag,
"WEARFLAG" : wearflag,
"IMMUNEFLAG" : immuneflag,
"GOLD" : gold,
"SHOP_BUY_PRICE" : shopbuyprice,
"REFINED_VNUM" : refinedvnum,
"REFINE_SET" : refineset,
"REFINE_SET2" : '0',
"MAGIC_PCT" : magicpct,
"LIMITTYPE0" : limittype0,
"LIMITVALUE0" : limitvalue0,
"LIMITTYPE1" : limittype1,
"LIMITVALUE1" : limitvalue1,
"APPLYTYPE0" : applytype0,
"APPLYVALUE0" : applyvalue0,
"APPLYTYPE1" : applytype1,
"APPLYVALUE1" : applyvalue1,
"APPLYTYPE2" : applytype2,
"APPLYVALUE2" : applyvalue2,
"VALUE0" : value0,
"VALUE1" : value1,
"VALUE2" : value2,
"VALUE3" : value3,
"VALUE4" : value4,
"VALUE5" : value5,
"SPECULAR" : specular,
"SOCKET_PCT" : socketpct,
"ADDON_TYPE" : addontype
}
self.ItemList.append(itemData)
def GetAntiflag(self, aflag=None):
if aflag == None or type(aflag) != int or aflag == 0:
return ANTIFLAG[0]
temp = []
sep = ' | '
for i in xrange(19):
if aflag & pow(2,i) != 0:
temp.append(ANTIFLAG[pow(2,i)])
return sep.join(temp)
def GetFlag(self, flag=None):
if flag == None or type(flag) != int or flag == 0:
return FLAG[0]
temp = []
sep = ' | '
for i in xrange(19):
if flag & pow(2,i) != 0:
temp.append(FLAG[pow(2,i)])
return sep.join(temp)
def GetWearflag(self, wflag=None):
if wflag == None or type(wflag) != int or wflag == 0:
return WEARFLAG[0]
temp = []
sep = ' | '
for i in xrange(19):
if wflag & pow(2,i) != 0:
temp.append(WEARFLAG[pow(2,i)])
return sep.join(temp)
def Create(self):
dump1 = open("item_names.txt", "w")
dump1.write("VNUM\tLOCALE_NAME\n")
dump2 = open("item_proto.txt", "w")
dump2.write('"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"\t"AddonType"\n')
pre ='%d\t"%s"\t"%s"\t%s\t%d\t"%s"\t"%s"\t"%s"\t"%s"\t%d\t%d\t%d\t%d\t%d\t"%s"\t%d\t"%s"\t%d\t"%s"\t%d\t"%s"\t%d\t"%s"\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n'
for item in self.ItemList:
vnum = int(item["VNUM"])
name = str(item["NAME"])
localename = str(item["LOCALE_NAME"])
try:
type = str(TYPE[int(item["TYPE"])])
except:
type = str(TYPE[0])
try:
subtype = '"' + str(SUBTYPE[type][int(item["SUBTYPE"])]) + '"'
except:
subtype = "0"#str(SUBTYPE[0])
size = int(item["SIZE"])
antiflag = str(self.GetAntiflag(int(item["ANTIFLAG"])))
flag = str(self.GetFlag(int(item["FLAG"])))
wearflag = str(self.GetWearflag(int(item["WEARFLAG"])))
immuneflag = str(IMMUNEFLAG[int(item["IMMUNEFLAG"])])
gold = int(item["GOLD"])
shopbuyprice = int(item["SHOP_BUY_PRICE"])
refinedvnum = int(item["REFINED_VNUM"])
refineset = int(item["REFINE_SET"])
magicpct = int(item["MAGIC_PCT"])
limittype0 = str(LIMITTYPE[int(item["LIMITTYPE0"])])
limitvalue0 = int(item["LIMITVALUE0"])
limittype1 = str(LIMITTYPE[int(item["LIMITTYPE1"])])
limitvalue1 = int(item["LIMITVALUE1"])
applytype0 = str(APPLYTYPE[int(item["APPLYTYPE0"])])
applyvalue0 = int(item["APPLYVALUE0"])
applytype1 = str(APPLYTYPE[int(item["APPLYTYPE1"])])
applyvalue1 = int(item["APPLYVALUE1"])
applytype2 = str(APPLYTYPE[int(item["APPLYTYPE2"])])
applyvalue2 = int(item["APPLYVALUE2"])
value0 = int(item["VALUE0"])
value1 = int(item["VALUE1"])
value2 = int(item["VALUE2"])
value3 = int(item["VALUE3"])
value4 = int(item["VALUE4"])
value5 = int(item["VALUE5"])
specular = int(item["SPECULAR"])
socketpct = int(item["SOCKET_PCT"])
addontype = int(item["ADDON_TYPE"])
dump1.write("%d\t%s\n" % (vnum, localename))
dump2.write(pre % (vnum,name,type,subtype,size,antiflag,flag,wearflag,immuneflag,gold,shopbuyprice,
refinedvnum,refineset,magicpct,limittype0,limitvalue0,limittype1,limitvalue1,
applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,
value0,value1,value2,value3,value4,value5,specular,socketpct,addontype))
dump1.close()
dump2.close()
print('item_proto.txt was succesfully create.\n')
print('item_names.txt was succesfully create.\n')
print('All done!')
def Main():
cls()
mode(85, 30)
if sys.argv[1:]:
fname = sys.argv[1]
if not os.path.exists(fname):
print("%s is missing." % fname)
return 0
if IsXML(fname):
FILENAME = fname
print('Processing \'%s\'.' % fname)
wnd = Application(fname)
wnd.Preparing()
wnd.Create()
# wnd.CreateNames()
# wnd.CreateProto()
w8()
return 1
else:
print __USAGE__
w8()
if __name__ == '__main__':
Main()
Last word: Thanks.
10/10/2013, 08:42
#9
elite*gold: 0
Join Date: Mar 2008
Posts: 146
Received Thanks: 196
cd /usr/ports/databases/py-MySQLdb/
make install clean
Danke vielmals!
10/13/2013, 22:46
#10
elite*gold: 0
Join Date: Aug 2012
Posts: 66
Received Thanks: 2
what is the comand to use the script....
10/14/2013, 01:25
#11
elite*gold: 0
Join Date: Jan 2009
Posts: 104
Received Thanks: 126
./convert.sh
10/16/2013, 23:13
#12
elite*gold: 0
Join Date: Sep 2012
Posts: 120
Received Thanks: 36
PHP Code:
TypeError : cannot concatenate 'str' and 'NoneType' objects
10/28/2013, 18:52
#13
elite*gold: 0
Join Date: Feb 2013
Posts: 14
Received Thanks: 0
error "TypeError: cannot concatenate 'str' and 'NoneType' objects"
11/12/2013, 16:26
#14
elite*gold: 0
Join Date: Sep 2012
Posts: 7
Received Thanks: 0
a video tutorial please?
12/13/2013, 20:19
#15
elite*gold: 0
Join Date: Jul 2012
Posts: 68
Received Thanks: 2
install: py mysqldb. here
cd /usr/ports/databases/py-MySQLdb && make install clean
Similar Threads
convert my item_proto xml to sql
08/28/2013 - Metin2 Private Server - 0 Replies
Hallo All
I Have Problem When I Convert Item_proto.xml to sql
he make the refined_vnum 0
I Want Some One Convert This Item_proto.xml to sql and keep the refined_vnum ;)
Convert item_proto.sql to item_proto.txt (r34083)
07/26/2013 - Metin2 Private Server - 0 Replies
Solved
one requrest please onebody for me convert item_proto.xml or query to sql with code
12/09/2012 - Metin2 Private Server - 0 Replies
please onebody convert it xml or query to "sql with characters code" :
xml: Download item_proto_dump.xml from Sendspace.com - send big files the easy way
query: Download item_proto_query.sql from Sendspace.com - send big files the easy way
please onebody convert to sql file but with code crtyp characters
need help :)
Mob_proto Convert
07/22/2012 - Metin2 Private Server - 2 Replies
-
Share an easy way to convert AVCHD videos to AVI?
03/29/2010 - Video Art - 0 Replies
Again, it’s a piece of good news for those camcorder lovers – next month Sony will release its HDRAX2000 pro-sumer camcorder which can capture Full HD video using AVCHD technology. It's one of the first professional video cameras that records using the AVCHD format. As a Sony camera lover and user, I’d like to share my idea and experience about how to enjoy AVCHD camcorder video on Windows Media Player or Internet.
http://www.dvd-ripper-copy.com/images/article/son y-hdrax2000.jpg
Part 1:...
All times are GMT +2. The time now is 02:49 .