
scoreboard players set max_rand items_generic 5
function items_py:holder/random

function items_py:holder/weapon/d/1_rmv_ingame
function items_py:holder/weapon/d/2_rmv_times_appeared
execute if score active shop matches 1 run function items_py:holder/weapon/d/3_rmv_not_bought

execute as @e[sort=random,limit=1,tag=rand_item] run function items_py:holder/weapon/d/4_choose
kill @e[tag=rand_item]

execute unless predicate items:selected/barrier run tag @s add filled
execute if predicate items:selected/barrier run tag @s add no_d
execute if predicate items:selected/barrier run tag @s remove D