Jump to content
  • 0
Sign in to follow this  
Cabrera

[Guide] Increasing max itemdb (32k+)

Question

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 :grimace: :

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 :smile:

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.