I have noticed that some people have not figured out how to increase itemdb from 32k limit to a higher amount. This maybe because the solutions are like in 4 different posts. This guide should help those having thousands of custom items like me in my test server.
If you dont do the changes I have mentioned below, you would be getting this error :
[SQL]: DB error - data of field 'nameid' was truncated
[Debug]: column - 1
[Debug]: data - type=UNSIGNED MYSQL_TYPE_LONG, le
[Debug]: buffer - type=MYSQL_TYPE_SHORT, length=2
So do the following to make it go away :
1st : go to /src/map/itemdb.h:
edit this line:
#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db)
to this:
#define MAX_ITEMDB 0x10000 // 64k array entries in array (the rest goes to the db)
2nd: go to /src/common/mmo.h:
edit this line:
short nameid;
to this
unsigned short nameid;
3rd: go to sql-files/main.sql:
edit all these specific lines in the main.sql:
`card0` smallint(11) NOT NULL default '0',
`card1` smallint(11) NOT NULL default '0',
`card2` smallint(11) NOT NULL default '0',
`card3` smallint(11) NOT NULL default '0',
To this :
`card0` mediumint(11) NOT NULL default '0',
`card1` mediumint(11) NOT NULL default '0',
`card2` mediumint(11) NOT NULL default '0',
`card3` mediumint(11) NOT NULL default '0',
4th: go to src/map/pc.h:
edit this line :
struct s_add_drop {
short id, group;
To this:
struct s_add_drop {
unsigned short id, group;
and this line :
int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);
to this :
int (*bonus_item_drop) (struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate);
5th: (we are almost done hang in there xD) go to src/map/pc.c:
Change this line :
int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {
to this:
int pc_bonus_item_drop(struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate) {
Greetings Hercules,
I have noticed that some people have not figured out how to increase itemdb from 32k limit to a higher amount. This maybe because the solutions are like in 4 different posts. This guide should help those having thousands of custom items like me in my test server.
If you dont do the changes I have mentioned below, you would be getting this error :
[SQL]: DB error - data of field 'nameid' was truncated [Debug]: column - 1 [Debug]: data - type=UNSIGNED MYSQL_TYPE_LONG, le [Debug]: buffer - type=MYSQL_TYPE_SHORT, length=2
So do the following to make it go away :
1st : go to /src/map/itemdb.h:
edit this line:
#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db) to this: #define MAX_ITEMDB 0x10000 // 64k array entries in array (the rest goes to the db)
2nd: go to /src/common/mmo.h:
edit this line:
short nameid; to this unsigned short nameid;
3rd: go to sql-files/main.sql:
edit all these specific lines in the main.sql:
`card0` smallint(11) NOT NULL default '0', `card1` smallint(11) NOT NULL default '0', `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', To this : `card0` mediumint(11) NOT NULL default '0', `card1` mediumint(11) NOT NULL default '0', `card2` mediumint(11) NOT NULL default '0', `card3` mediumint(11) NOT NULL default '0',
4th: go to src/map/pc.h:
edit this line :
struct s_add_drop { short id, group; To this: struct s_add_drop { unsigned short id, group; and this line : int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate); to this : int (*bonus_item_drop) (struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate);
5th: (we are almost done hang in there xD) go to src/map/pc.c:
Change this line :
int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) { to this: int pc_bonus_item_drop(struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate) {
6th : go to /src/char/char.c:
edit this line :
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL) to this: || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &item.nameid, 0, NULL, NULL)
Rebuild your server and you should not encounter the error anymore
Share this post
Link to post
Share on other sites