ItemDB can support items with > 32k id

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
 

im agreed with Angelmelody, 64 K was enough space for its dont you think so??

@@Frey since im using txt db for mob_db then is there adition to add??

 
Hi @Frey i have countered error on my map server after make item with item id 40001

Message appeared on Char Server console

[SQL]: DB error - data of field 'nameid' was truncated.[Debug]: column - 1[Debug]: data - type=UNSIGNED MYSQL_TYPE_LONG, length=2[Debug]: buffer - type=MYSQL_TYPE_SHORT, length=2
 it appeared when i relog-jng my char, see my char server console log here http://upaste.me/r/7d20120740fdce91c

and here my patch files using lattest hercules git http://upaste.me/r/846a12075b37e0de8

 
Message appeared on Char Server console

Code:
[SQL]: DB error - data of field 'nameid' was truncated.[Debug]: column - 1[Debug]: data - type=UNSIGNED MYSQL_TYPE_LONG, length=2[Debug]: buffer - type=MYSQL_TYPE_SHORT, length=2
and here my patch files using lattest hercules git http://upaste.me/r/846a12075b37e0de8
Code:
diff --git a/src/char/char.c b/src/char/char.cindex 0b7d858..a417eda 100644--- a/src/char/char.c+++ b/src/char/char.c@@ -747,7 +747,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit 	}  	SQL->StmtBindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);-	SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);+	SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT,     &item.nameid,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL)@@ -890,7 +890,7 @@ int inventory_to_sql(const struct item items[], int max, int id) { 	}  	SQL->StmtBindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);-	SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);+	SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT,     &item.nameid,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);@@ -1251,7 +1251,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything 	||	SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) 	||	SQL_ERROR == SQL->StmtExecute(stmt) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  0, SQLDT_INT,       &tmp_item.id, 0, NULL, NULL)-	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  1, SQLDT_SHORT,     &tmp_item.nameid, 0, NULL, NULL)+	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  1, SQLDT_USHORT,     &tmp_item.nameid, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  2, SQLDT_SHORT,     &tmp_item.amount, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  3, SQLDT_UINT,      &tmp_item.equip, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt,  4, SQLDT_CHAR,      &tmp_item.identify, 0, NULL, NULL)@@ -1284,7 +1284,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything 	||	SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) 	||	SQL_ERROR == SQL->StmtExecute(stmt) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT,         &tmp_item.id, 0, NULL, NULL)-	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT,       &tmp_item.nameid, 0, NULL, NULL)+	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT,       &tmp_item.nameid, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT,       &tmp_item.amount, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT,        &tmp_item.equip, 0, NULL, NULL) 	||	SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR,        &tmp_item.identify, 0, NULL, NULL)diff --git a/src/char/int_storage.c b/src/char/int_storage.cindex 966e61b..b065f3d 100644--- a/src/char/int_storage.c+++ b/src/char/int_storage.c@@ -282,7 +282,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) 	}  	SQL->StmtBindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);-	SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);+	SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT,     &item.nameid,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT,    &item.equip,       0, NULL, NULL); 	SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
 
Last edited by a moderator:
I agree with it being added to source by default (with no ifdefs ;P) since gravity is already using 28k ID for some items, we are in need of higher IDs
default_smile.png
and btw 64k is enough IMO

 
So I just read the May Digest, and there's no word about this so I'm assuming it was never added. Is there any talk about it from the core devs though?

rAthena's already done it quite recently.

 
So I just read the May Digest, and there's no word about this so I'm assuming it was never added. Is there any talk about it from the core devs though?

rAthena's already done it quite recently.
It is not yet added @ Hercules.(Maybe i will make a pull request, so core dev can review it.)

 
Already implemented in latest rev.?? Coz when I try changing #define MAX_ITEMDB 0x10000

I got this compile error.
default_sad.png

 

itemdb.c: In function 'itemdb_validate_entry':
itemdb.c:1370: warning: comparison is always false due to limited range of data type
 
Last edited by a moderator:
Well , in case another unfortunate soul happens to come by this same mistake:


You can solve it by changing the actual SQL data save in :

src/char/char.c from short to ushort

Even if you already changed the definitions in src/map the emulator is apparently configured to send a short value regardless... which this change fixes

Well that's it , enjoy!

 
Last edited by a moderator:
Back
Top