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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 4 deletions

View File

@ -240,6 +240,7 @@ Body:
bypass_stat_onclone: true
bypass_max_stat: true
macro_register: true
trade_unconditional: true
#all_permission: true
Footer:

View File

@ -125,6 +125,12 @@ item delay, etc).
---------------------------------------
*trade_unconditional
Allows player to ignore the trade conditions of items (drop, trade, sell, cart, storage/gstorage, mail and auction).
---------------------------------------
======================
| 3. Command-related |
======================

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)));
}

View File

@ -50,6 +50,7 @@ enum e_pc_permission : uint32 {
PC_PERM_ATTENDANCE,
PC_PERM_MACRO_DETECT,
PC_PERM_MACRO_REGISTER,
PC_PERM_TRADE_UNCONDITIONAL,
//.. add other here
PC_PERM_MAX,
};
@ -88,6 +89,7 @@ static const struct s_pcg_permission_name {
{ "attendance",PC_PERM_ATTENDANCE },
{ "macro_detect",PC_PERM_MACRO_DETECT },
{ "macro_register",PC_PERM_MACRO_REGISTER },
{ "trade_unconditional",PC_PERM_TRADE_UNCONDITIONAL },
};
struct s_player_group{