diff --git a/src/config/core.h b/src/config/core.h index a32d9a4ec7..a000977ae9 100644 --- a/src/config/core.h +++ b/src/config/core.h @@ -64,6 +64,14 @@ /// Uncomment to enable the job base HP/SP table (job_basehpsp_db.txt) //#define HP_SP_TABLES +/// Enable separated item by `guid`. [Cydh] +/// See db/[pre-]re/item_flag.txt and doc/item_group.txt for the `guid` explanation. +/// NOTE: +/// If this feature is disabled "in the middle" of your game, the separated is still +/// separated in inventory, storage, or guild storage until player move the item +/// to/from storage/inventory to restack them. +#define ENABLE_ITEM_GUID + /// Uncomment to enable VIP system. //#define VIP_ENABLE diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 5837512c62..79a1fae152 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1268,8 +1268,10 @@ ACMD_FUNC(item) item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.bound = bound; +#ifdef ENABLE_ITEM_GUID if (item_data[j]->flag.guid) item_tmp.unique_id = pc_generate_unique_id(sd); +#endif if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif_additem(sd, 0, 0, flag); } @@ -1360,8 +1362,10 @@ ACMD_FUNC(item2) item_tmp.card[2] = c3; item_tmp.card[3] = c4; item_tmp.bound = bound; +#ifdef ENABLE_ITEM_GUID if (item_data->flag.guid) item_tmp.unique_id = pc_generate_unique_id(sd); +#endif if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif_additem(sd, 0, 0, flag); } diff --git a/src/map/clif.c b/src/map/clif.c index 0c540c4976..4dd082bcd8 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13207,9 +13207,11 @@ void clif_parse_GM_Item_Monster(int fd, struct map_session_data *sd) if( !itemdb_isstackable2(id) ) //Nonstackable StringBuf_Printf(&command, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand_symbol, id->nameid); else { +#ifdef ENABLE_ITEM_GUID if (id->flag.guid) StringBuf_Printf(&command, "%citem %d 1", atcommand_symbol, id->nameid); else +#endif StringBuf_Printf(&command, "%citem %d 20", atcommand_symbol, id->nameid); } is_atcommand(fd, sd, StringBuf_Value(&command), 1); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 7b8c178962..a9c56e4565 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -199,7 +199,9 @@ static void itemdb_pc_get_itemgroup_sub(struct map_session_data *sd, struct s_it // Do loop for non-stackable item for (i = 0; i < data->amount; i++) { char flag = 0; +#ifdef ENABLE_ITEM_GUID tmp.unique_id = data->GUID ? pc_generate_unique_id(sd) : 0; // Generate UID +#endif if ((flag = pc_additem(sd, &tmp, tmp.amount, LOG_TYPE_SCRIPT))) clif_additem(sd, 0, 0, flag); else if (!flag && data->isAnnounced) { @@ -442,17 +444,17 @@ bool itemdb_isequip2(struct item_data *id) */ bool itemdb_isstackable2(struct item_data *id) { - nullpo_ret(id); - switch(id->type) { - case IT_WEAPON: - case IT_ARMOR: - case IT_PETEGG: - case IT_PETARMOR: - case IT_SHADOWGEAR: - return false; - default: - return true; - } + nullpo_ret(id); + switch(id->type) { + case IT_WEAPON: + case IT_ARMOR: + case IT_PETEGG: + case IT_PETARMOR: + case IT_SHADOWGEAR: + return false; + default: + return true; + } } @@ -662,7 +664,9 @@ static void itemdb_read_itemgroup_sub(const char* filename, bool silent) if (str[3] != NULL) entry.amount = cap_value(atoi(str[3]),1,MAX_AMOUNT); if (str[5] != NULL) entry.isAnnounced= atoi(str[5]); if (str[6] != NULL) entry.duration = cap_value(atoi(str[6]),0,UINT16_MAX); +#ifdef ENABLE_ITEM_GUID if (str[7] != NULL) entry.GUID = atoi(str[7]); +#endif if (str[8] != NULL) entry.bound = cap_value(atoi(str[8]),BOUND_NONE,BOUND_MAX-1); if (str[9] != NULL) entry.isNamed = atoi(str[9]); @@ -917,7 +921,9 @@ static bool itemdb_read_flag(char* fields[], int columns, int current) { if (flag&1) id->flag.dead_branch = set ? 1 : 0; if (flag&2) id->flag.group = set ? 1 : 0; +#ifdef ENABLE_ITEM_GUID if (flag&4 && itemdb_isstackable2(id)) id->flag.guid = set ? 1 : 0; +#endif return true; } diff --git a/src/map/pc.c b/src/map/pc.c index 8ea8ce49cf..8d7b85b3aa 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4292,7 +4292,9 @@ char pc_additem(struct map_session_data *sd,struct item *item,int amount,e_log_p if( sd->status.inventory[i].nameid == item->nameid && sd->status.inventory[i].bound == item->bound && sd->status.inventory[i].expire_time == 0 && +#ifdef ENABLE_ITEM_GUID sd->status.inventory[i].unique_id == item->unique_id && +#endif memcmp(&sd->status.inventory[i].card, &item->card, sizeof(item->card)) == 0 ) { diff --git a/src/map/script.c b/src/map/script.c index a1c3e2a6fe..28daef1f51 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6559,7 +6559,9 @@ BUILDIN_FUNC(getitem) // if not pet egg if (!pet_create_egg(sd, nameid)) { +#ifdef ENABLE_ITEM_GUID it.unique_id = (id->flag.guid) ? pc_generate_unique_id(sd) : 0; +#endif if ((flag = pc_additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif_additem(sd, 0, 0, flag); @@ -6679,7 +6681,9 @@ BUILDIN_FUNC(getitem2) if (!pet_create_egg(sd, nameid)) { unsigned char flag = 0; +#ifdef ENABLE_ITEM_GUID item_tmp.unique_id = (item_data->flag.guid) ? pc_generate_unique_id(sd) : 0; +#endif if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) { clif_additem(sd, 0, 0, flag); diff --git a/src/map/storage.c b/src/map/storage.c index 05f7cb9f34..479ff0752e 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -131,7 +131,7 @@ int storage_storageopen(struct map_session_data *sd) } /** - * check if 2 item a and b have same values + * Check if 2 item a and b have same values * @param a : item 1 * @param b : item 2 * @return 1:same, 0:are different @@ -143,8 +143,11 @@ int compare_item(struct item *a, struct item *b) a->refine == b->refine && a->attribute == b->attribute && a->expire_time == b->expire_time && - a->bound == b->bound && - a->unique_id == b->unique_id ) + a->bound == b->bound +#ifdef ENABLE_ITEM_GUID + && a->unique_id == b->unique_id +#endif + ) { int i;