|
@@ -3586,26 +3586,26 @@ int pc_checkadditem(struct map_session_data *sd,int nameid,int amount)
|
|
|
nullpo_ret(sd);
|
|
|
|
|
|
if(amount > MAX_AMOUNT)
|
|
|
- return ADDITEM_OVERAMOUNT;
|
|
|
+ return CHKADDITEM_OVERAMOUNT;
|
|
|
|
|
|
data = itemdb_search(nameid);
|
|
|
|
|
|
if(!itemdb_isstackable2(data))
|
|
|
- return ADDITEM_NEW;
|
|
|
+ return CHKADDITEM_NEW;
|
|
|
|
|
|
if( data->stack.inventory && amount > data->stack.amount )
|
|
|
- return ADDITEM_OVERAMOUNT;
|
|
|
+ return CHKADDITEM_OVERAMOUNT;
|
|
|
|
|
|
for(i=0;i<MAX_INVENTORY;i++){
|
|
|
// FIXME: This does not consider the checked item's cards, thus could check a wrong slot for stackability.
|
|
|
if(sd->status.inventory[i].nameid==nameid){
|
|
|
if( amount > MAX_AMOUNT - sd->status.inventory[i].amount || ( data->stack.inventory && amount > data->stack.amount - sd->status.inventory[i].amount ) )
|
|
|
- return ADDITEM_OVERAMOUNT;
|
|
|
- return ADDITEM_EXIST;
|
|
|
+ return CHKADDITEM_OVERAMOUNT;
|
|
|
+ return CHKADDITEM_EXIST;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return ADDITEM_NEW;
|
|
|
+ return CHKADDITEM_NEW;
|
|
|
}
|
|
|
|
|
|
/*==========================================
|
|
@@ -3810,14 +3810,14 @@ int pc_search_inventory(struct map_session_data *sd,int item_id)
|
|
|
/*==========================================
|
|
|
* Attempt to add a new item to inventory.
|
|
|
* Return:
|
|
|
- 0 = success
|
|
|
- 1 = invalid itemid not found or negative amount
|
|
|
- 2 = overweight
|
|
|
- 3 = ?
|
|
|
- 4 = no free place found
|
|
|
- 5 = max amount reached
|
|
|
- 6 = ?
|
|
|
- 7 = stack limitation
|
|
|
+ 0 = success
|
|
|
+ 1 = invalid itemid not found or negative amount
|
|
|
+ 2 = overweight
|
|
|
+ 3 = ?
|
|
|
+ 4 = no free place found
|
|
|
+ 5 = max amount reached
|
|
|
+ 6 = ?
|
|
|
+ 7 = stack limitation
|
|
|
*------------------------------------------*/
|
|
|
int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type)
|
|
|
{
|
|
@@ -3829,20 +3829,20 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
|
|
|
nullpo_retr(1, item_data);
|
|
|
|
|
|
if( item_data->nameid <= 0 || amount <= 0 )
|
|
|
- return 1;
|
|
|
+ return ADDITEM_INVALID;
|
|
|
if( amount > MAX_AMOUNT )
|
|
|
- return 5;
|
|
|
+ return ADDITEM_OVERAMOUNT;
|
|
|
|
|
|
data = itemdb_search(item_data->nameid);
|
|
|
|
|
|
if( data->stack.inventory && amount > data->stack.amount )
|
|
|
{// item stack limitation
|
|
|
- return 7;
|
|
|
+ return ADDITEM_STACKLIMIT;
|
|
|
}
|
|
|
|
|
|
w = data->weight*amount;
|
|
|
if(sd->weight + w > sd->max_weight)
|
|
|
- return 2;
|
|
|
+ return ADDITEM_OVERWEIGHT;
|
|
|
|
|
|
i = MAX_INVENTORY;
|
|
|
|
|
@@ -3865,7 +3865,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
|
|
|
{
|
|
|
i = pc_search_inventory(sd,0);
|
|
|
if( i < 0 )
|
|
|
- return 4;
|
|
|
+ return ADDITEM_OVERITEM;
|
|
|
|
|
|
memcpy(&sd->status.inventory[i], item_data, sizeof(sd->status.inventory[0]));
|
|
|
// clear equips field first, just in case
|
|
@@ -3900,7 +3900,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
+ return ADDITEM_SUCCESS;
|
|
|
}
|
|
|
|
|
|
/*==========================================
|