ItemDB can support items with > 32k id

Dastgir

Core Developer
Messages
3,805
Points
0
Discord
Dastgir#1460
IRC Nickname
Dastgir
Github
dastgirp
Emulator
Client Version
2019-02-28 RE
While I was working on some item_data reconstruction(A Paid Source requested to me..) I discovered that we can create ItemID with greater than 32k ID. (Atleast on 2013-08-07,Since I use this mostly, I tested it with this client.), so maybe as kRO has reached almost 30k, they already increased itemid range...

Some of the testings: http://imgur.com/zKGwMFZ

Also I tried to make different items like equipable, usable, and I was able to wear and use them....

We would need to modify some mysql tables and change some "short" type(in source)...

Atleast I tested until 65535 , So maybe client is restricting ID > 65535 now?(Since Item Failed to create when tried with ID>65535).

So my suggestion is to change short types and mysql tables, and make itemdb support to 65535 by default...

 
Last edited by a moderator:
It would be good, For custom item

, Can you at least make a diff file for this ??

 
It would be good, For custom item

, Can you at least make a diff file for this ??
if you really need it fast
default_tongue.png
just take it here:

http://herc.ws/board/topic/5045-increasing-max-values-allowed-in-itemdb/?p=32497

 
confused in ' more adjust info '

Code:
and more adjustmysql card0~ card3 field type change to int // im using txt dbs not sql_db, how ??and adjust bonus script param type // the script change and add y value, then must i change the src part to ??bonus2 bAddMonsterDropItem,n,xbonus3 bAddMonsterDropItem,n,x,y;
 
the sql part is about main.sql for example:

`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',
 
change smallint to int, the bonus part I didn't looked at it :/
 
Last edited by a moderator:
the sql part is about main.sql for example:

`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',
 
change smallint to int, the bonus part I didn't looked at it :/
for bonus script  param

pc.h

struct s_add_drop {

  short id, group;

  int race, rate;

};

int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);

pc.c

int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {

short --> unsigned short

 
Last edited by a moderator:
for me who haven't understand this and that, it make me more confused, which parth i must replace or add

or someone can make a mini guide for this or my be a diff file can be more convinient

thanks

 
Last edited by a moderator:
This sounds great for servers with a ton of custom stuff. Hope it gets officially implemented to the emulator.

 
Hi guys,

I made a modification to increase the native limit to 64k and added the possibility to increase the limit over 65k..

I haven't tested yet, so please, fell free to indicate any bug or improvement

https://github.com/ragnaBR/Hercules/commit/c7a9ce03fddef370bec96f9d137051a4932ae00c
percentage chance doesn't need to be changed into mediumint since we are changing only itemIDs, not their drop chance
default_tongue.png


also there is no need to manually edit the HPM hooks since they will be updated automatically once it goes into main src

 
Last edited by a moderator:
Hi guys,

I made a modification to increase the native limit to 64k and added the possibility to increase the limit over 65k..

I haven't tested yet, so please, fell free to indicate any bug or improvement

https://github.com/ragnaBR/Hercules/commit/c7a9ce03fddef370bec96f9d137051a4932ae00c
percentage chance doesn't need to be changed into mediumint since we are changing only itemIDs, not their drop chance
default_tongue.png


also there is no need to manually edit the HPM hooks since they will be updated automatically once it goes into main src
Thanks evil, i've made this in a little hurry, i missed the sql detail.

About the HPM, i didin't know about it.. anyway, soon as possible i ll fix those small issues.

Thx!

 
One important thing:

i've used mediumint instead unsigned smallint on the cardX fields because they can receive negative values in some cases.

 
Last edited by a moderator:
Well i dont understand at all, from the guide @Angelmelody provide, there is slight different from what provided by @Frey

Angelmelody Guide :

pc.h- short id, group;+ unsigned short id, group;- int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);+ int (*bonus_item_drop) (struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate);pc.c- int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {+ int pc_bonus_item_drop(struct s_add_drop *drop, const short max, unsigned short id, short group, int race, int rate) {
Frey Patch File :

pc.h- short id, group;+ #ifdef ITEMDB_OVER65K+ unsigned int id;+ #else+ unsigned short id;+ #endif+ short group;- int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);+ int (*bonus_item_drop) (struct s_add_drop *drop, const short max, int id, short group, int race, int rate);pc.c-int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {+int pc_bonus_item_drop(struct s_add_drop *drop, const short max, int id, short group, int race, int rate) {
from Frey Patch File there is ITEMDB_OVER65K dif, is it mean can make item_db id more than 65 K ??

and when Angelmelody Just Adjust main.sql file and pc.h and pc.c from src part, Frey Patch File have addition src file to be patched

buyingstore.h, clif.c, npc.h, packets_struct.h, pet.c, script.c, searchstore.h, HPMHooking.Hooks.inc
for HPMHooking.Hooks.inc, read back comment from @evilpuncker, then its fine to leave it untoched ??

i was planning apply patch for this last week but my office work make me have no time to, test it and now im have free time to back testing it on offline server.

and here come my question,

1. what is different the part from Angelmelody and Frey on pc.c and pc.ha part ? "Int id / unsigned short id" ?

2. from frey patch file thereis src file that i listed before what is it stand for ?

3. Just for Frey, have you fixed the small isue that you mentioned above ?? i have take a look on ragnaBR repo thereis change 8 day ago and the file seems same from before

Im Sorry for being a noob, if some one have a time to answer it what i can do is being grateful for it, and thanks for you guys anyways

 
Hi there,

I've tried to cover all the places in the source code where the increase of the item_id could cause some trouble, because of that i've changed the size of some variables in another places.

About the differences in pc.c and pc.h

My one makes "native" the limit to 64k and gives you the option to go beyond, if you activate the ITEMDB_OVER65K, the limit becomes virtualy around 2kkk, but im pretty sure that there will be some client-side issues with high number ids.

The another differences are just conventions, i've used int instead unsigned short in some places just to keep the convention of positive and negative numbers that some of those parameters could receive.

The patch order is the following:

Aplly this one: https://github.com/ragnaBR/Hercules/commit/c7a9ce03fddef370bec96f9d137051a4932ae00c.patch

Then this one: https://github.com/ragnaBR/Hercules/commit/2050606df697456074d0592768dad66daa43c006.patch

Run this sql: /sql-files/upgrades/2014-04-19-14-21.sql

If you wanna active the ITEMDB_OVER65K you must run this sql too: /sql-files/patch_itemdb_over65k.sql

That is it, its pretty straight foward, i havent time yet to test it, but everything looks fine besides some optimizations that could be made.

 
Last edited by a moderator:
I don't think there's a need to increase over 65K , 65K space is large enough for general use , over it  is too crazy
default_sleep.png


 
Back
Top