Skip to content

Commit

Permalink
Implemented the permission "TRADE_UNCONDITIONAL" (#8182)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
  • Loading branch information
Atemo and aleos89 committed Mar 25, 2024
1 parent dd663c7 commit 42bd87d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions conf/groups.yml
Expand Up @@ -240,6 +240,7 @@ Body:
bypass_stat_onclone: true
bypass_max_stat: true
macro_register: true
trade_unconditional: true
#all_permission: true

Footer:
Expand Down
6 changes: 6 additions & 0 deletions doc/permissions.txt
Expand Up @@ -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 |
======================
Expand Down
14 changes: 10 additions & 4 deletions src/map/pc.cpp
Expand Up @@ -1258,15 +1258,15 @@ 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));
}

/**
* Determines if player can give / drop / trade / vend bounded items
*/
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));
}

/**
Expand Down Expand Up @@ -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)));
}
Expand Down
2 changes: 2 additions & 0 deletions src/map/pc_groups.hpp
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 42bd87d

Please sign in to comment.