sql-files/main.sql | 48 ++++++++++++++--------------- src/common/mmo.h | 6 +++- src/map/buyingstore.h | 6 +++- src/map/clif.c | 6 +++- src/map/itemdb.h | 4 ++- src/map/npc.h | 6 +++- src/map/packets_struct.h | 12 ++++++-- src/map/pc.c | 2 +- src/map/pc.h | 24 +++++++++++---- src/map/pet.c | 2 +- src/map/script.c | 7 ++--- src/map/searchstore.h | 6 +++- src/plugins/HPMHooking/HPMHooking.Hooks.inc | 6 ++-- 13 files changed, 88 insertions(+), 47 deletions(-) diff --git a/sql-files/main.sql b/sql-files/main.sql index 2504522..1efcd5f 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -17,10 +17,10 @@ CREATE TABLE IF NOT EXISTS `auction` ( `type` smallint(6) NOT NULL default '0', `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) unsigned NOT NULL default '0', - `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', + `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', `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`auction_id`) ) ENGINE=MyISAM; @@ -38,10 +38,10 @@ CREATE TABLE IF NOT EXISTS `cart_inventory` ( `identify` smallint(6) NOT NULL default '0', `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) NOT NULL default '0', - `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', + `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', `expire_time` int(11) unsigned NOT NULL default '0', `bound` tinyint(1) unsigned NOT NULL default '0', `unique_id` bigint(20) unsigned NOT NULL default '0', @@ -327,10 +327,10 @@ CREATE TABLE IF NOT EXISTS `guild_storage` ( `identify` smallint(6) unsigned NOT NULL default '0', `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) unsigned NOT NULL default '0', - `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', + `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', `expire_time` int(11) unsigned NOT NULL default '0', `bound` tinyint(1) unsigned NOT NULL default '0', `unique_id` bigint(20) unsigned NOT NULL default '0', @@ -391,10 +391,10 @@ CREATE TABLE IF NOT EXISTS `inventory` ( `identify` smallint(6) NOT NULL default '0', `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) unsigned NOT NULL default '0', - `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', + `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', `expire_time` int(11) unsigned NOT NULL default '0', `favorite` tinyint(3) unsigned NOT NULL default '0', `bound` tinyint(1) unsigned NOT NULL default '0', @@ -494,10 +494,10 @@ CREATE TABLE IF NOT EXISTS `mail` ( `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) unsigned NOT NULL default '0', `identify` smallint(6) NOT NULL default '0', - `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', + `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', `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM; @@ -692,10 +692,10 @@ CREATE TABLE IF NOT EXISTS `storage` ( `identify` smallint(6) unsigned NOT NULL default '0', `refine` tinyint(3) unsigned NOT NULL default '0', `attribute` tinyint(4) unsigned NOT NULL default '0', - `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', + `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', `expire_time` int(11) unsigned NOT NULL default '0', `bound` tinyint(1) unsigned NOT NULL default '0', `unique_id` bigint(20) unsigned NOT NULL default '0', diff --git a/src/common/mmo.h b/src/common/mmo.h index 07a0567..108d3c4 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -217,7 +217,11 @@ struct quest { struct item { int id; - short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif short amount; unsigned int equip; // Location(s) where item is equipped (using enum equip_pos for bitmasking). char identify; diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index 5141a10..d3e2306 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -40,7 +40,11 @@ enum e_buyingstore_failure { struct s_buyingstore_item { int price; unsigned short amount; - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif }; struct s_buyingstore { diff --git a/src/map/clif.c b/src/map/clif.c index 2fbf64e..7e2aacf 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17088,7 +17088,11 @@ void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) /// 083c .L .L .W void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) { - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif int account_id, store_id; struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 77fb2e2..b4f07ce 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -18,7 +18,9 @@ struct item_package; /** * Defines **/ -#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db) +#define MAX_ITEMDB 0x10000 // 65K array entries in array (the rest goes to the db) +//If you define MAX_ITEMDB over 65k arrays entries (item ids), you have to define the flag bellow AND apply the sql patch patch_itemdb_over65k.sql located insed of sql forlder to your database. +//#define ITEMDB_OVER65K #define MAX_ITEMDELAYS 10 // The maximum number of item delays #define MAX_SEARCH 5 //Designed for search functions, species max number of matches to display. #define MAX_ITEMS_PER_COMBO 6 /* maximum amount of items a combo may require */ diff --git a/src/map/npc.h b/src/map/npc.h index 346a9f8..6aa67e3 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -37,7 +37,11 @@ struct npc_label_list { int pos; }; struct npc_item_list { - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif unsigned int value; unsigned int qty; }; diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 55006db..4ba6763 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -316,7 +316,11 @@ struct packet_additem { short PacketType; unsigned short Index; unsigned short count; - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif uint8 IsIdentified; uint8 IsDamaged; unsigned char refiningLevel; @@ -938,7 +942,11 @@ struct packet_npc_market_open { short PacketLength; /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */ struct { - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif unsigned char type; unsigned int price; unsigned int qty; diff --git a/src/map/pc.c b/src/map/pc.c index ba66bf7..c46c9b0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1887,7 +1887,7 @@ int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_ return 1; } -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) { int i; //Apply config rate adjustment settings. diff --git a/src/map/pc.h b/src/map/pc.h index 70df9ca..b61eed4 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -101,7 +101,12 @@ struct s_addeffectonskill { unsigned char target; }; struct s_add_drop { - short id, group; + #ifdef ITEMDB_OVER65K + unsigned int id; + #else + unsigned short id; + #endif + short group; int race, rate; }; struct s_autobonus { @@ -254,7 +259,11 @@ struct map_session_data { int64 cansendmail_tick; /// Mail System Flood Protection int64 ks_floodprotect_tick; /// [Kill Steal Protection] struct { - short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif int64 tick; } item_delay[MAX_ITEMDELAYS]; // [Paradox924X] short weapontype1,weapontype2; @@ -304,8 +313,7 @@ struct map_session_data { } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS]; struct s_add_drop add_drop[MAX_PC_BONUS]; struct { - int nameid; - int rate; + int nameid, rate; } itemhealrate[MAX_PC_BONUS]; struct { short flag, rate; @@ -435,7 +443,11 @@ struct map_session_data { // Mail System [Zephyrus] struct { - short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif int index, amount, zeny; struct mail_data inbox; bool changed; // if true, should sync with charserver on next mailbox request @@ -980,7 +992,7 @@ struct pc_interface { int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id); int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, short rate, short arrow_rate, unsigned char flag); int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target); - 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); void (*calcexp) (struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src); int (*respawn_timer) (int tid, int64 tick, int id, intptr_t data); int (*jobchange_killclone) (struct block_list *bl, va_list ap); diff --git a/src/map/pet.c b/src/map/pet.c index b5870a8..5d998ba 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1205,7 +1205,7 @@ int read_petdb() { char* filename[] = {"pet_db.txt","pet_db2.txt"}; FILE *fp; - int nameid,i,j,k; + int nameid,i,j,k; // Remove any previous scripts in case reloaddb was invoked. for( j = 0; j < MAX_PET_DB; j++ ) diff --git a/src/map/script.c b/src/map/script.c index 3e11a51..b03e766 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6469,7 +6469,7 @@ int script_array_index_cmp(const void *a, const void *b) { * getitembound "",,{,}; *------------------------------------------*/ BUILDIN(getitem) { - int nameid,amount,get_count,i,flag = 0, offset = 0; + int nameid, amount,get_count,i,flag = 0, offset = 0; struct item it; TBL_PC *sd; struct item_data *item_data; @@ -6554,7 +6554,7 @@ int script_array_index_cmp(const void *a, const void *b) { * *------------------------------------------*/ BUILDIN(getitem2) { - int nameid,amount,i,flag = 0, offset = 0; + int nameid, amount,i,flag = 0, offset = 0; int iden,ref,attr,c1,c2,c3,c4, bound = 0; TBL_PC *sd; @@ -14983,8 +14983,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle) { const char* npcname = script_getstr(st,2); struct npc_data* nd = npc->name2id(npcname); - unsigned int nameid; - int n, i; + int nameid, n, i; int amount; int size; diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 827e390..bbfff92 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -50,7 +50,11 @@ struct s_search_store_info_item { unsigned int store_id; int account_id; char store_name[MESSAGE_SIZE]; - unsigned short nameid; + #ifdef ITEMDB_OVER65K + int nameid; + #else + unsigned short nameid; + #endif unsigned short amount; unsigned int price; short card[MAX_SLOTS]; diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 23f00ea..fed226b 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -49593,11 +49593,11 @@ int HP_pc_bonus_addeff_onskill(struct s_addeffectonskill *effect, int max, enum } return retVal___; } -int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) { +int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, int id, short group, int race, int rate) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_pc_bonus_item_drop_pre ) { - int (*preHookFunc) (struct s_add_drop *drop, const short *max, short *id, short *group, int *race, int *rate); + int (*preHookFunc) (struct s_add_drop *drop, const short *max, int *id, short *group, int *race, int *rate); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_item_drop_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_pc_bonus_item_drop_pre[hIndex].func; retVal___ = preHookFunc(drop, &max, &id, &group, &race, &rate); @@ -49611,7 +49611,7 @@ int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, sh retVal___ = HPMHooks.source.pc.bonus_item_drop(drop, max, id, group, race, rate); } if( HPMHooks.count.HP_pc_bonus_item_drop_post ) { - int (*postHookFunc) (int retVal___, struct s_add_drop *drop, const short *max, short *id, short *group, int *race, int *rate); + int (*postHookFunc) (int retVal___, struct s_add_drop *drop, const short *max, int *id, short *group, int *race, int *rate); for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_item_drop_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_pc_bonus_item_drop_post[hIndex].func; retVal___ = postHookFunc(retVal___, drop, &max, &id, &group, &race, &rate);