local L=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local p=L:WaitForChild("\099\111\109\109\111\110")local A=require(p:WaitForChild("\065\115\115\101\116\067\097\116\097\103\111\114\105\101\115"))local C=require(p:WaitForChild("\065\115\115\101\116\115"))return function(L,p,K)L=L or{}if p.type=="\065\083\083\069\084\095\069\081\085\073\080"then local f=C.byId[p.assetId]if f then local C=A.byId[f.type]if C and C.id==K then local A=C.maxEquipped or 1 local K={}K[1]=p.assetId for p=1,math.min(#L,A-1),1 do K[p+1]=L[p]end return K end end end return L end
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local common = ReplicatedStorage:WaitForChild("common")

local AssetCatagories = require(common:WaitForChild("AssetCatagories"))
local Assets = require(common:WaitForChild("Assets"))

return function(equipped, action, cataId)
    equipped = equipped or {}
    if action.type == "ASSET_EQUIP" then
        local asset = Assets.byId[action.assetId]
        if asset then
            local catagory = AssetCatagories.byId[asset.type]
            if catagory and catagory.id == cataId then
                local max = catagory.maxEquipped or 1
                local newEquipped = {}

                newEquipped[1] = action.assetId
                for i = 1, math.min(#equipped, max - 1) do
                    newEquipped[i + 1] = equipped[i]
                end

                return newEquipped
            end
        end
    end

    return equipped
end