diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 17 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 | ||||
-rw-r--r-- | src/map/packets.h | 7 | ||||
-rw-r--r-- | src/map/pc.c | 16 | ||||
-rw-r--r-- | src/map/pc.h | 2 |
6 files changed, 42 insertions, 3 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 1cd18b68d..3b15265f7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11484,6 +11484,22 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); } +/// Identifying item with right-click (CZ_REQ_ONECLICK_ITEMIDENTIFY). +/// 0A35 <index>.W +void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +{ + int cmd = RFIFOW(fd,0); + short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; + int n; + + if (idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0) + return; + + if ((n = pc->have_magnifier(sd) ) != INDEX_NOT_FOUND && + pc->delitem(sd, n, 1, 0, DELITEM_NORMAL, LOG_TYPE_OTHER) == 0) + skill->identify(sd, idx); +} + void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to arrow crafting item selection dialog (CZ_REQ_MAKINGARROW). /// 01ae <name id>.W @@ -19707,4 +19723,5 @@ void clif_defaults(void) { clif->add_random_options = clif_add_random_options; clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; clif->dressroom_open = clif_dressroom_open; + clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; } diff --git a/src/map/clif.h b/src/map/clif.h index 250689e90..3d43b064c 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1338,6 +1338,7 @@ struct clif_interface { void (*add_random_options) (unsigned char* buf, struct item* item); void (*pHotkeyRowShift) (int fd, struct map_session_data *sd); void (*dressroom_open) (struct map_session_data *sd, int view); + void (*pOneClick_ItemIdentify) (int fd,struct map_session_data *sd); /* Cart Deco */ void(*selectcart) (struct map_session_data *sd); void(*pSelectCart) (int fd, struct map_session_data *sd); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index cde73f3b4..8a0ec389d 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -64,6 +64,7 @@ enum item_itemid { ITEMID_BRANCH_OF_DEAD_TREE = 604, ITEMID_ANODYNE = 605, ITEMID_ALOEBERA = 606, + ITEMID_MAGNIFIER = 611, ITEMID_POISON_BOTTLE = 678, ITEMID_EMPTY_BOTTLE = 713, ITEMID_EMPERIUM = 714, @@ -136,6 +137,7 @@ enum item_itemid { ITEMID_MAGIC_CASTLE = 12308, ITEMID_BULGING_HEAD = 12309, ITEMID_THICK_MANUAL50 = 12312, + ITEMID_NOVICE_MAGNIFIER = 12325, ITEMID_ANCILLA = 12333, ITEMID_REPAIR_A = 12392, ITEMID_REPAIR_B = 12393, diff --git a/src/map/packets.h b/src/map/packets.h index 6174d76d2..0badd94f5 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2910,9 +2910,10 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x08A8,26,clif->pFriendsListAdd,2); packet(0x0817,5,clif->pHomMenu,2,4); packet(0x0923,36,clif->pStoragePassword,0); - packet(0x09e8,11,clif->pDull); // CZ_OPEN_MAILBOX - packet(0x0a2e,6,clif->pDull); // TITLE - packet(0x0a02,4); // ZC_DRESSROOM_OPEN + packet(0x09E8,11,clif->pDull); // CZ_OPEN_MAILBOX + packet(0x0A2E,6,clif->pDull); // TITLE + packet(0x0A02,4); // ZC_DRESSROOM_OPEN + packet(0x0A35,4,clif->pOneClick_ItemIdentify,2); #endif #if PACKETVER >= 20150805 // RagexeRE diff --git a/src/map/pc.c b/src/map/pc.c index 2dfd9519b..491584385 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -11479,6 +11479,20 @@ bool pc_db_checkid(unsigned int class_) || (class_ >= JOB_REBELLION && class_ < JOB_MAX ); } +/** + * checks if player have any kind of magnifier in inventory + * @param sd map_session_data of Player + * @return index of magnifer, INDEX_NOT_FOUND if it is not found + */ +int pc_have_magnifier(struct map_session_data *sd) +{ + int n; + n = pc->search_inventory(sd, ITEMID_MAGNIFIER); + if (n == INDEX_NOT_FOUND) + n = pc->search_inventory(sd, ITEMID_NOVICE_MAGNIFIER); + return n; +} + void do_final_pc(void) { db_destroy(pc->itemcd_db); pc->at_db->destroy(pc->at_db,pc->autotrade_final); @@ -11846,4 +11860,6 @@ void pc_defaults(void) { pc->check_job_name = pc_check_job_name; pc->update_idle_time = pc_update_idle_time; + + pc->have_magnifier = pc_have_magnifier; } diff --git a/src/map/pc.h b/src/map/pc.h index 23b46a631..06bc5e5ae 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1088,6 +1088,8 @@ END_ZEROED_BLOCK; /* End */ int (*check_job_name) (const char *name); void (*update_idle_time) (struct map_session_data* sd, enum e_battle_config_idletime type); + + int (*have_magnifier) (struct map_session_data *sd); }; #ifdef HERCULES_CORE |