Hey Everyone
In this post i'll be showing you how to fix the error TypeError: cannot concatenate 'str' and 'NoneType' objects that you get while trying to use the python script to convert your database item_proto.sql into item_proto.txt and item_names.txt
The error will look like this to you:
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
I saw many comments saying they got this error. Here for example...
If you're not familiar with the tool, here's a link to it. You might find it useful
The tutorial will cover everything step by step with an explanation, and does not require any advanced python knowledge... just some common sense. So just follow and hopefully at the end you'll have the problem solved :3
Let's not talk a lot and jump right into business.
Open Navicat and go to Item_proto table then go to Filter and add these filters :
Then press Ctrl+R to apply them.
The result you get is what's causing the problem. I'll explain why at the end of the post
Simply change the type and subtype to 0 if you don't need it, or change it to a value of the following :
Type should have a value between 0-34. Here's a list of what each value is about (I copied it right out of the script itself)
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",
31: "ITEM_EXTRACT",
32: "ITEM_SECONDARY_COIN",
33: "ITEM_RING",
34: "ITEM_BELT"
If type = 1 ; subtype should be between 0-8 :
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",
8: "WEAPON_NUM_TYPES",
For type = 2 ; subtype should be between 0-7 :
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",
For type = 3 subtype should be between 0-30 :
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",
27: "USE_TIME_CHARGE_PER",
28: "USE_TIME_CHARGE_FIX",
29: "USE_PUT_INTO_BELT_SOCKET",
30: "USE_PUT_INTO_RING_SOCKET",
For type = 4 subtype should be between 0-5 :
0: "AUTOUSE_POTION",
1: "AUTOUSE_ABILITY_UP",
2: "AUTOUSE_BOMB",
3: "AUTOUSE_GOLD",
4: "AUTOUSE_MONEYBAG",
5: "AUTOUSE_TREASURE_BOX",
For type = 5 subtype should be between 0-7 :
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",
For type = 6 subtype should be between 0-3 :
0: "SPECIAL_MAP",
1: "SPECIAL_KEY",
2: "SPECIAL_DOC",
3: "SPECIAL_SPIRIT",
For type = 7 subtype should be 0 :
0 : "TOOL_FISHING_ROD",
For type = 8 subtype should be either 0 or 1 :
0: "LOTTERY_TICKET",
1: "LOTTERY_INSTANT",
For type = 9 subtype can be anything
For type = 10 subtype should be either 0 or 1 :
0: "METIN_NORMAL",
1: "METIN_GOLD",
For type = 11 subtype can be anything
For type = 12 subtype should be either 0 or 1 :
0: "FISH_ALIVE",
1: "FISH_DEAD",
For type = 13 subtype can be anything
For type = 14 subtype should be between 0-11 :
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",
For type = 15 subtype can be anything
For type = 16 subtype should be between 0-10 :
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",
For type = 17 to 27 subtype can be anything
For type = 28 subtype should be either 0 or 1 :
0: "COSTUME_BODY",
1: "COSTUME_HAIR",
For type = 29 subtype should be between 0-5 :
0: "DS_SLOT1",
1: "DS_SLOT2",
2: "DS_SLOT3",
3: "DS_SLOT4",
4: "DS_SLOT5",
5: "DS_SLOT6",
For type = 30 subtype can be anything
For type = 31 subtype should be either 0 or 1 :
0: "EXTRACT_DRAGON_SOUL",
1: "EXTRACT_DRAGON_HEART",
***** I Copied everything here for better reference. You can find everything in the script. I didn't come up with anything by myself *****
After adjusting the values as they should be, try converting the proto again. If you still get the error don't panic, there's probably something wrong with the wearflag. We'll fix it right away.
Apply these filters to check the wearflag values :
Press Ctrl+R to apply them.
The result you get is what's causing the problem.
Simply change the wearflag to 0 if you don't need it, or change it to one of the values below :
1: "WEAR_BODY",
2: "WEAR_HEAD",
4: "WEAR_FOOTS",
8: "WEAR_WRIST",
16: "WEAR_WEAPON",
32: "WEAR_NECK",
64: "WEAR_EAR",
128: "WEAR_SHIELD",
256: "WEAR_UNIQUE",
512: "WEAR_ARROW",
1024: "WEAR_HAIR",
2048: "WEAR_ABILITY",
Explanation:
The script is written to cover the items with a TYPE value between 0 and 34, and for each TYPE, there's a specific max
value of SUBTYPES as you can see above.
So if you have any item with a TYPE value bigger than 34 or negative value, or the SUBTYPE value for the specified
TYPE is not listed in the script, does not exist at all, or is a negative value, you'll probably get the error.
Same applies to the WEARFLAG value. If you have an item with a WEARFLAG value which is not listed in the script, you'll get the error.
What we did is:
We filtered out the records with the values causing the error. (because if we don't filter them out it's impossible to get it done)
Then we adjusted the wrong values to correct ones.
Et Voilà!
I hope it helped.
Cheers