Kaynağa Gözat

Fixed an issue with RODEX's retrieve all (#6245)

Sometimes players would not be able to retrieve their items anymore.

Thanks to @Balferian and @limitro
Lemongrass3110 3 yıl önce
ebeveyn
işleme
d25ec40a8f
1 değiştirilmiş dosya ile 8 ekleme ve 4 silme
  1. 8 4
      src/map/mail.cpp

+ 8 - 4
src/map/mail.cpp

@@ -290,7 +290,7 @@ void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, i
 
 	for( i = 0; i < MAIL_MAX_ITEM; i++ ){
 		if( item[i].nameid > 0 && item[i].amount > 0 ){
-			struct item_data* id = itemdb_search( item->nameid );
+			struct item_data* id = itemdb_search( item[i].nameid );
 
 			// Item does not exist (anymore?)
 			if( id == nullptr ){
@@ -316,12 +316,16 @@ void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, i
 					break;
 				}
 			}else{
-				int slots = id->inventorySlotNeeded( item[i].amount );
+				char check = pc_checkadditem( sd, item[i].nameid, item[i].amount );
 
 				// Add the item normally
-				if( pc_additem( sd, &item[i], item[i].amount, LOG_TYPE_MAIL ) == ADDITEM_SUCCESS ){
+				if( check != CHKADDITEM_OVERAMOUNT && pc_additem( sd, &item[i], item[i].amount, LOG_TYPE_MAIL ) == ADDITEM_SUCCESS ){
 					item_received = true;
-					sd->mail.pending_slots -= slots;
+
+					// Only reduce slots if it really required a new slot
+					if( check == CHKADDITEM_NEW ){
+						sd->mail.pending_slots -= id->inventorySlotNeeded( item[i].amount );
+					}
 				}else{
 					// Do not send receive packet so that the mail is still displayed with item attachment
 					item_received = false;