|
@@ -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++ ){
|
|
for( i = 0; i < MAIL_MAX_ITEM; i++ ){
|
|
if( item[i].nameid > 0 && item[i].amount > 0 ){
|
|
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?)
|
|
// Item does not exist (anymore?)
|
|
if( id == nullptr ){
|
|
if( id == nullptr ){
|
|
@@ -316,12 +316,16 @@ void mail_getattachment(struct map_session_data* sd, struct mail_message* msg, i
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- int slots = id->inventorySlotNeeded( item[i].amount );
|
|
|
|
|
|
+ char check = pc_checkadditem( sd, item[i].nameid, item[i].amount );
|
|
|
|
|
|
// Add the item normally
|
|
// 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;
|
|
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{
|
|
}else{
|
|
// Do not send receive packet so that the mail is still displayed with item attachment
|
|
// Do not send receive packet so that the mail is still displayed with item attachment
|
|
item_received = false;
|
|
item_received = false;
|