summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/clif.c21
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h6
-rw-r--r--src/map/storage.c6
4 files changed, 30 insertions, 4 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index a57f43613..1797a8fae 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2633,6 +2633,22 @@ static void clif_dropitem(struct map_session_data *sd, int n, int amount)
WFIFOSET(fd,packet_len(0xaf));
}
+static void clif_item_movefailed(struct map_session_data *sd, int n)
+{
+#if PACKETVER_MAIN_NUM >= 20161214 || PACKETVER_RE_NUM >= 20161130 || defined(PACKETVER_ZERO)
+ int fd = sd->fd;
+ const int len = sizeof(struct PACKET_ZC_INVENTORY_MOVE_FAILED);
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_INVENTORY_MOVE_FAILED *p = WFIFOP(fd, 0);
+ p->packetType = 0xaa7;
+ p->index = n;
+ p->unknown = 1;
+ WFIFOSET(fd, len);
+#else
+ clif->dropitem(sd, n, 0);
+#endif
+}
+
/// Notifies the client, that an inventory item was deleted (ZC_DELETE_ITEM_FROM_BODY).
/// 07fa <delete type>.W <index>.W <amount>.W
/// delete type: @see enum delitem_reason
@@ -11067,7 +11083,7 @@ static void clif_parse_DropItem(int fd, struct map_session_data *sd)
}
//Because the client does not like being ignored.
- clif->dropitem(sd, item_index, 0);
+ clif->item_movefailed(sd, item_index);
}
static void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -11562,7 +11578,7 @@ static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd)
if (!pc_iscarton(sd))
return;
if ( (flag = pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4))) ) {
- clif->dropitem(sd, RFIFOW(fd,2)-2,0);
+ clif->item_movefailed(sd, RFIFOW(fd,2)-2);
clif->cart_additem_ack(sd,flag == 1?0x0:0x1);
}
}
@@ -22067,6 +22083,7 @@ void clif_defaults(void)
clif->dropitem = clif_dropitem;
clif->delitem = clif_delitem;
clif->takeitem = clif_takeitem;
+ clif->item_movefailed = clif_item_movefailed;
clif->item_equip = clif_item_equip;
clif->item_normal = clif_item_normal;
clif->arrowequip = clif_arrowequip;
diff --git a/src/map/clif.h b/src/map/clif.h
index 9e71386b7..a94a08080 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -716,6 +716,7 @@ struct clif_interface {
void (*dropitem) (struct map_session_data *sd,int n,int amount);
void (*delitem) (struct map_session_data *sd,int n,int amount, short reason);
void (*takeitem) (struct block_list* src, struct block_list* dst);
+ void (*item_movefailed) (struct map_session_data *sd, int n);
void (*item_equip) (short idx, struct EQUIPITEM_INFO *p, struct item *i, struct item_data *id, int eqp_pos);
void (*item_normal) (short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id);
void (*arrowequip) (struct map_session_data *sd,int val);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 346c11692..1f22d5081 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -2721,6 +2721,12 @@ struct PACKET_ZC_GUILD_POSITION {
char position[];
} __attribute__((packed));
+struct PACKET_ZC_INVENTORY_MOVE_FAILED {
+ int16 packetType;
+ int16 index;
+ int16 unknown;
+} __attribute__((packed));
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris
diff --git a/src/map/storage.c b/src/map/storage.c
index 4123ddc7c..ba8dcee3a 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -297,7 +297,7 @@ static int storage_add_from_inventory(struct map_session_data *sd, int index, in
if (storage->additem(sd, &sd->status.inventory[index], amount) == 0)
pc->delitem(sd, index, amount, 0, DELITEM_TOSTORAGE, LOG_TYPE_STORAGE);
else
- clif->dropitem(sd, index, 0);
+ clif->item_movefailed(sd, index);
return 1;
}
@@ -398,7 +398,9 @@ static int storage_storagegettocart(struct map_session_data *sd, int index, int
if ((flag = pc->cart_additem(sd, it, amount, LOG_TYPE_STORAGE)) == 0)
storage->delitem(sd, index, amount);
else {
+ // probably this line is useless? it remove inventory lock but not storage [4144]
clif->dropitem(sd, index,0);
+
clif->cart_additem_ack(sd, flag == 1?0x0:0x1);
}
@@ -638,7 +640,7 @@ static int storage_guild_storageadd(struct map_session_data *sd, int index, int
if( gstorage->additem(sd,stor,&sd->status.inventory[index],amount) == 0 )
pc->delitem(sd, index, amount, 0, DELITEM_TOSTORAGE, LOG_TYPE_GSTORAGE);
else
- clif->dropitem(sd, index, 0);
+ clif->item_movefailed(sd, index);
return 1;
}