Implemented the permission "TRADE_UNCONDITIONAL" (#8182)

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
Atemo
2024-03-25 16:09:11 +01:00
committed by GitHub
parent dd663c7eb4
commit 42bd87d9b7
4 changed files with 19 additions and 4 deletions

View File

@@ -1258,7 +1258,7 @@ bool pc_can_sell_item(map_session_data *sd, struct item *item, enum npc_subtype
*/
bool pc_can_give_items(map_session_data *sd)
{
return pc_has_permission(sd, PC_PERM_TRADE);
return (pc_has_permission(sd, PC_PERM_TRADE) || pc_has_permission(sd, PC_PERM_TRADE_UNCONDITIONAL));
}
/**
@@ -1266,7 +1266,7 @@ bool pc_can_give_items(map_session_data *sd)
*/
bool pc_can_give_bounded_items(map_session_data *sd)
{
return pc_has_permission(sd, PC_PERM_TRADE_BOUNDED);
return (pc_has_permission(sd, PC_PERM_TRADE_BOUNDED) || pc_has_permission(sd, PC_PERM_TRADE_UNCONDITIONAL));
}
/**
@@ -11156,9 +11156,15 @@ void pc_setmadogear(map_session_data *sd, bool flag, e_mado_type type)
*------------------------------------------*/
bool pc_candrop(map_session_data *sd, struct item *item)
{
if( item && ((item->expire_time || (item->bound && !pc_can_give_bounded_items(sd))) || (itemdb_ishatched_egg(item))) )
if (sd->sc.cant.drop)
return false;
if( !pc_can_give_items(sd) || sd->sc.cant.drop) //check if this GM level can drop items
if( item && itemdb_ishatched_egg(item) )
return false;
if (pc_has_permission(sd, PC_PERM_TRADE_UNCONDITIONAL)) // no restriction
return true;
if( !pc_can_give_items(sd) )
return false;
if( item && (item->expire_time || (item->bound && !pc_can_give_bounded_items(sd))) )
return false;
return (itemdb_isdropable(item, pc_get_group_level(sd)));
}