local authenticZEnabled = getActivatedMods():contains('\\Authentic Z - Current') or getActivatedMods():contains('\\AuthenticZBackpacks+') or getActivatedMods():contains('\\AuthenticZLite')

local scriptManager = getScriptManager()

local attachmentOverrides = {
    ['PompsItems_MyLittlePony.SpikePlushie'] = 'RubberDuck',
}

--don't worry... not an item tweaker derivative
local function doItemParams(type, ...)
    local item = scriptManager:getItem(type)
    if item then
        for _,param in ipairs({...}) do
            item:DoParam(param)
        end
    end
end

Events.OnInitGlobalModData.Add(function()
    local items = require 'PI_PonyVariations'.getAllPonies() -- evil syntax
    if not SandboxVars.PompsItems.ReadablePonies then
        for _,type in ipairs(items) do
            doItemParams(type, 'ItemType = base:normal', 'UnhappyChange = 0', 'StressChange = 0', 'BoredomChange = 0', 'ReplaceOnUse = ', 'CustomContextMenu = ')
        end
    end
    if authenticZEnabled then
        for _,type in ipairs(items) do
            local attachmentType = attachmentOverrides[type] or 'SpiffoPlushie'
            doItemParams(type, 'AttachmentType = '..attachmentType)
        end
    end
end)