瀏覽代碼

Oneclick Itemidentify Packet Implemented
* New Feature for 2015-05-13 client or newer
Request 1 Magnifier when use (ctrl + click right)

Napster 9 年之前
父節點
當前提交
5fe81455b0
共有 3 個文件被更改,包括 34 次插入3 次删除
  1. 3 0
      db/packet_db.txt
  2. 30 3
      src/map/clif.c
  3. 1 0
      src/map/itemdb.h

+ 3 - 0
db/packet_db.txt

@@ -2506,6 +2506,9 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr]
 0x0A10,-1		// ZC_STORE_ITEMLIST_EQUIP_V6
 0x0A2D,-1	// ZC_EQUIPWIN_MICROSCOPE_V6
 
+// OneClick Itemidentify
+0x0A35,4,oneclick_itemidentify,2	// CZ_REQ_ONECLICK_ITEMIDENTIFY
+
 // Title System
 0x0A2E,6,dull,0	// CZ_REQ_CHANGE_TITLE
 0x0A2F,7		// ZC_ACK_CHANGE_TITLE

+ 30 - 3
src/map/clif.c

@@ -18486,8 +18486,7 @@ void clif_broadcast_obtain_special_item(const char *char_name, unsigned short na
 	clif_send(buf, WBUFW(buf, 2), NULL, ALL_CLIENT);
 }
 
-void clif_dressing_room(struct map_session_data *sd, int view)
-{
+void clif_dressing_room(struct map_session_data *sd, int view) {
 	int fd;
 
 	nullpo_retv(sd);
@@ -18499,6 +18498,32 @@ void clif_dressing_room(struct map_session_data *sd, int view)
 	WFIFOSET(fd, packet_len(0xa02));
 }
 
+/// Parsing a request from the client item identify oneclick (CZ_REQ_ONECLICK_ITEMIDENTIFY).
+/// 0A35 <result>.W
+void clif_parse_Oneclick_Itemidentify(int fd, struct map_session_data *sd) {
+#if PACKETVER >= 20150513
+	short idx = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]) - 2;
+	int i;
+
+    // Invalid index - ignore the request
+    if ( idx < 0 )
+        return;
+
+    // Item already identified - ignore the request
+    if ( sd->status.inventory[idx].identify )
+        return;
+
+    if ( ( i = pc_search_inventory(sd,ITEMID_MAGNIFIER) ) == -1 )
+        return;
+
+    if ( pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER) != 0 ) {
+        // TODO: deleting magnifier failed, for whatever reason...
+    }
+
+    skill_identify(sd, idx);
+#endif
+}
+
 /*==========================================
  * Main client packet processing function
  *------------------------------------------*/
@@ -18900,7 +18925,7 @@ void packetdb_readdb(bool reload)
 #endif
 		-1,  0,  0, 26,  0,  0,  0,  0,  14,  2, 23,  2, -1,  2,  3,  2,
 	   21,  3,  5,  0, 66,  0,  0,  0,  3,  0,  0,  0,  0,  -1,  0,  0,
- 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 		0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	};
 	struct {
 		void (*func)(int, struct map_session_data *);
@@ -19137,6 +19162,8 @@ void packetdb_readdb(bool reload)
 		{ clif_parse_merge_item_cancel, "mergeitem_cancel"},
 		// HotkeyRowShift
 		{ clif_parse_HotkeyRowShift, "hotkeyrowshift"},
+		// OneClick Item Identify
+		{ clif_parse_Oneclick_Itemidentify, "oneclick_itemidentify" },
 		{NULL,NULL}
 	};
 	struct {

+ 1 - 0
src/map/itemdb.h

@@ -52,6 +52,7 @@ enum item_itemid
 	ITEMID_WING_OF_BUTTERFLY			= 602,
 	ITEMID_ANODYNE						= 605,
 	ITEMID_ALOEBERA						= 606,
+	ITEMID_MAGNIFIER					= 611,
 	ITEMID_POISON_BOTTLE				= 678,
 	ITEMID_EMPTY_BOTTLE					= 713,
 	ITEMID_EMPERIUM						= 714,