Browse Source

Implemented the permission "TRADE_UNCONDITIONAL" (#8182)

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Atemo 1 year ago
parent
commit
42bd87d9b7
4 changed files with 19 additions and 4 deletions
  1. 1 0
      conf/groups.yml
  2. 6 0
      doc/permissions.txt
  3. 10 4
      src/map/pc.cpp
  4. 2 0
      src/map/pc_groups.hpp

+ 1 - 0
conf/groups.yml

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

+ 6 - 0
doc/permissions.txt

@@ -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 |
 ======================

+ 10 - 4
src/map/pc.cpp

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

+ 2 - 0
src/map/pc_groups.hpp

@@ -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{