prevent moving/dropping the pet egg if it's hatched (#4179)
Fixes #4178
This commit is contained in:
committed by
Lemongrass3110
parent
87b858199b
commit
454163c48f
@@ -573,6 +573,12 @@ bool itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, bool (*func)(st
|
||||
return true;
|
||||
}
|
||||
|
||||
bool itemdb_ishatched_egg(struct item* item) {
|
||||
if (item && item->card[0] == CARD0_PET && item->attribute == 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Specifies if item-type should drop unidentified.
|
||||
* @param nameid ID of item
|
||||
*/
|
||||
|
||||
@@ -932,6 +932,7 @@ bool itemdb_canguildstore_sub(struct item_data *itd, int gmlv, int unused);
|
||||
bool itemdb_canmail_sub(struct item_data *itd, int gmlv, int unused);
|
||||
bool itemdb_canauction_sub(struct item_data *itd, int gmlv, int unused);
|
||||
bool itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, bool (*func)(struct item_data*, int, int));
|
||||
bool itemdb_ishatched_egg(struct item* item);
|
||||
#define itemdb_isdropable(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_isdropable_sub)
|
||||
#define itemdb_cantrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_cantrade_sub)
|
||||
#define itemdb_canpartnertrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_canpartnertrade_sub)
|
||||
|
||||
@@ -146,6 +146,9 @@ enum mail_attach_result mail_setitem(struct map_session_data *sd, short idx, uin
|
||||
if( idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == nullptr )
|
||||
return MAIL_ATTACH_ERROR;
|
||||
|
||||
if (itemdb_ishatched_egg(&sd->inventory.u.items_inventory[idx]))
|
||||
return MAIL_ATTACH_ERROR;
|
||||
|
||||
if( sd->inventory.u.items_inventory[idx].equipSwitch ){
|
||||
return MAIL_ATTACH_EQUIPSWITCH;
|
||||
}
|
||||
|
||||
@@ -729,6 +729,9 @@ bool pc_can_sell_item(struct map_session_data *sd, struct item *item, enum npc_s
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemdb_ishatched_egg(item))
|
||||
return false;
|
||||
|
||||
switch (shoptype) {
|
||||
case NPCTYPE_SHOP:
|
||||
if (item->bound && battle_config.allow_bound_sell&ISR_BOUND_SELLABLE && (
|
||||
@@ -5359,6 +5362,10 @@ enum e_additem_result pc_cart_additem(struct map_session_data *sd,struct item *i
|
||||
|
||||
if(item->nameid == 0 || amount <= 0)
|
||||
return ADDITEM_INVALID;
|
||||
|
||||
if (itemdb_ishatched_egg(item))
|
||||
return ADDITEM_INVALID;
|
||||
|
||||
data = itemdb_search(item->nameid);
|
||||
|
||||
if( data->stack.cart && amount > data->stack.amount )
|
||||
@@ -9374,7 +9381,7 @@ void pc_setmadogear(struct map_session_data* sd, int flag)
|
||||
*------------------------------------------*/
|
||||
bool pc_candrop(struct map_session_data *sd, struct item *item)
|
||||
{
|
||||
if( item && (item->expire_time || (item->bound && !pc_can_give_bounded_items(sd))) )
|
||||
if( item && ((item->expire_time || (item->bound && !pc_can_give_bounded_items(sd))) || (itemdb_ishatched_egg(item))) )
|
||||
return false;
|
||||
if( !pc_can_give_items(sd) || sd->sc.cant.drop) //check if this GM level can drop items
|
||||
return false;
|
||||
|
||||
@@ -212,6 +212,9 @@ static enum e_storage_add storage_canAddItem(struct s_storage *stor, int idx, st
|
||||
if (amount < 1 || amount > items[idx].amount)
|
||||
return STORAGE_ADD_INVALID;
|
||||
|
||||
if (itemdb_ishatched_egg(&items[idx]))
|
||||
return STORAGE_ADD_INVALID;
|
||||
|
||||
if (!stor->state.put)
|
||||
return STORAGE_ADD_NOACCESS;
|
||||
|
||||
|
||||
@@ -385,6 +385,9 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemdb_ishatched_egg(item))
|
||||
return;
|
||||
|
||||
if( item->expire_time ) { // Rental System
|
||||
clif_displaymessage (sd->fd, msg_txt(sd,260));
|
||||
clif_tradeitemok(sd, index+2, 1);
|
||||
|
||||
Reference in New Issue
Block a user