local ____lualib = require("lualib_bundle")
local __TS__StringSplit = ____lualib.__TS__StringSplit
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
local PocketItemSlot = ____isaac_2Dtypescript_2Ddefinitions.PocketItemSlot
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
local ____cachedEnumValues = require("cachedEnumValues")
local GRID_ENTITY_TYPE_VALUES = ____cachedEnumValues.GRID_ENTITY_TYPE_VALUES
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
local sfxManager = ____cachedClasses.sfxManager
local ____constants = require("core.constants")
local DOGMA_ROOM_GRID_INDEX = ____constants.DOGMA_ROOM_GRID_INDEX
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
local MAX_NUM_FAMILIARS = ____constants.MAX_NUM_FAMILIARS
local ____constantsFirstLast = require("core.constantsFirstLast")
local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
local FIRST_HORSE_PILL_COLOR = ____constantsFirstLast.FIRST_HORSE_PILL_COLOR
local FIRST_PILL_COLOR = ____constantsFirstLast.FIRST_PILL_COLOR
local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
local ____HealthType = require("enums.HealthType")
local HealthType = ____HealthType.HealthType
local ____cards = require("functions.cards")
local getCardName = ____cards.getCardName
local isValidCardType = ____cards.isValidCardType
local ____characters = require("functions.characters")
local getCharacterName = ____characters.getCharacterName
local ____charge = require("functions.charge")
local addCharge = ____charge.addCharge
local getTotalCharge = ____charge.getTotalCharge
local ____collectibles = require("functions.collectibles")
local isValidCollectibleType = ____collectibles.isValidCollectibleType
local ____console = require("functions.console")
local printEnabled = ____console.printEnabled
local ____deepCopyTests = require("functions.deepCopyTests")
local runDeepCopyTests = ____deepCopyTests.runDeepCopyTests
local ____entitiesSpecific = require("functions.entitiesSpecific")
local getNPCs = ____entitiesSpecific.getNPCs
local ____enums = require("functions.enums")
local isEnumValue = ____enums.isEnumValue
local ____flag = require("functions.flag")
local addFlag = ____flag.addFlag
local ____gridEntities = require("functions.gridEntities")
local spawnGridEntity = ____gridEntities.spawnGridEntity
local ____levelGrid = require("functions.levelGrid")
local getRoomGridIndexesForType = ____levelGrid.getRoomGridIndexesForType
local ____logMisc = require("functions.logMisc")
local logMusic = ____logMisc.logMusic
local logPlayerEffects = ____logMisc.logPlayerEffects
local logRoom = ____logMisc.logRoom
local logSeedEffects = ____logMisc.logSeedEffects
local logSounds = ____logMisc.logSounds
local ____mergeTests = require("functions.mergeTests")
local runMergeTests = ____mergeTests.runMergeTests
local ____pickupsSpecific = require("functions.pickupsSpecific")
local spawnCard = ____pickupsSpecific.spawnCard
local spawnPill = ____pickupsSpecific.spawnPill
local spawnTrinketFunction = ____pickupsSpecific.spawnTrinket
local ____pills = require("functions.pills")
local getHorsePillColor = ____pills.getHorsePillColor
local getPillEffectName = ____pills.getPillEffectName
local isValidPillEffect = ____pills.isValidPillEffect
local ____playerCollectibles = require("functions.playerCollectibles")
local addCollectibleCostume = ____playerCollectibles.addCollectibleCostume
local removeCollectibleCostume = ____playerCollectibles.removeCollectibleCostume
local useActiveItemTemp = ____playerCollectibles.useActiveItemTemp
local ____playerIndex = require("functions.playerIndex")
local getPlayers = ____playerIndex.getPlayers
local ____players = require("functions.players")
local getPlayerName = ____players.getPlayerName
local ____roomData = require("functions.roomData")
local getRoomData = ____roomData.getRoomData
local ____roomGrid = require("functions.roomGrid")
local gridCoordinatesToWorldPosition = ____roomGrid.gridCoordinatesToWorldPosition
local ____roomTransition = require("functions.roomTransition")
local reloadRoomFunction = ____roomTransition.reloadRoom
local ____rooms = require("functions.rooms")
local changeRoom = ____rooms.changeRoom
local ____run = require("functions.run")
local onSetSeed = ____run.onSetSeed
local restart = ____run.restart
local setUnseeded = ____run.setUnseeded
local ____spawnCollectible = require("functions.spawnCollectible")
local spawnCollectibleFunc = ____spawnCollectible.spawnCollectible
local ____stage = require("functions.stage")
local onStage = ____stage.onStage
local setStage = ____stage.setStage
local ____string = require("functions.string")
local getMapPartialMatch = ____string.getMapPartialMatch
local ____trinkets = require("functions.trinkets")
local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
local isValidTrinketType = ____trinkets.isValidTrinketType
local ____types = require("functions.types")
local parseIntSafe = ____types.parseIntSafe
local ____utils = require("functions.utils")
local iRange = ____utils.iRange
local ____cardNameToTypeMap = require("maps.cardNameToTypeMap")
local CARD_NAME_TO_TYPE_MAP = ____cardNameToTypeMap.CARD_NAME_TO_TYPE_MAP
local ____characterNameToTypeMap = require("maps.characterNameToTypeMap")
local CHARACTER_NAME_TO_TYPE_MAP = ____characterNameToTypeMap.CHARACTER_NAME_TO_TYPE_MAP
local ____collectibleNameToTypeMap = require("maps.collectibleNameToTypeMap")
local COLLECTIBLE_NAME_TO_TYPE_MAP = ____collectibleNameToTypeMap.COLLECTIBLE_NAME_TO_TYPE_MAP
local ____pillNameToEffectMap = require("maps.pillNameToEffectMap")
local PILL_NAME_TO_EFFECT_MAP = ____pillNameToEffectMap.PILL_NAME_TO_EFFECT_MAP
local ____roomNameToTypeMap = require("maps.roomNameToTypeMap")
local ROOM_NAME_TO_TYPE_MAP = ____roomNameToTypeMap.ROOM_NAME_TO_TYPE_MAP
local ____trinketNameToTypeMap = require("maps.trinketNameToTypeMap")
local TRINKET_NAME_TO_TYPE_MAP = ____trinketNameToTypeMap.TRINKET_NAME_TO_TYPE_MAP
local ____roomTypeNames = require("objects.roomTypeNames")
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
local ____subroutines = require("classes.features.other.extraConsoleCommands.subroutines")
local addHeart = ____subroutines.addHeart
local devilAngel = ____subroutines.devilAngel
local listEntities = ____subroutines.listEntities
local listGridEntities = ____subroutines.listGridEntities
local movePlayer = ____subroutines.movePlayer
local spawnTrapdoorOrCrawlSpace = ____subroutines.spawnTrapdoorOrCrawlSpace
local warpNextToRoomType = ____subroutines.warpNextToRoomType
local warpToRoomType = ____subroutines.warpToRoomType
local ____v = require("classes.features.other.extraConsoleCommands.v")
local v = ____v.v
--- Warps to the first Boss Room on the floor (or the Delirium Boss Room if on The Void).
function ____exports.bossRoom(self)
    local roomType = RoomType.BOSS
    local roomGridIndexes = getRoomGridIndexesForType(nil, roomType)
    local roomGridIndex = roomGridIndexes[1]
    if onStage(nil, LevelStage.VOID) then
        roomGridIndex = __TS__ArrayFind(
            roomGridIndexes,
            function(____, thisRoomGridIndex)
                local ____opt_0 = getRoomData(nil, thisRoomGridIndex)
                return (____opt_0 and ____opt_0.Subtype) == BossID.DELIRIUM
            end
        )
    end
    local roomTypeName = ROOM_TYPE_NAMES[RoomType.BOSS]
    if roomGridIndex == nil then
        print(("There are no " .. roomTypeName) .. "s on this floor.")
        return
    end
    changeRoom(nil, roomGridIndex)
    print(((("Warped to room type: " .. roomTypeName) .. " (") .. tostring(roomType)) .. ")")
end
--- Toggles Chaos Card tears for the player. Useful for killing enemies very fast without using
-- "debug 10".
function ____exports.chaosCardTears(self)
    v.persistent.chaosCardTears = not v.persistent.chaosCardTears
    printEnabled(nil, v.persistent.chaosCardTears, "Chaos Card tears")
end
--- Warps to the Devil Room for the floor. If the Angel Room has already been visited or initialized,
-- this will uninitialize it and make an Devil Room instead.
function ____exports.devilRoom(self)
    devilAngel(nil, true)
end
--- Gives the player a golden bomb.
function ____exports.goldenBomb(self)
    local player = Isaac.GetPlayer()
    player:AddGoldenBomb()
end
--- Gives a golden heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.goldenHearts(self, params)
    addHeart(nil, params, HealthType.GOLDEN)
end
--- Gives the player a golden key.
function ____exports.goldenKey(self)
    local player = Isaac.GetPlayer()
    player:AddGoldenKey()
end
--- Alias for the "debug 2" command. Useful for seeing the grid costs of each tile in the room.
function ____exports.gridCosts(self)
    Isaac.ExecuteCommand("debug 2")
end
--- Warps to the I AM ERROR room for the floor.
function ____exports.iAmErrorRoom(self)
    changeRoom(nil, GridRoom.ERROR)
end
--- Sets every NPC in the room to 1 HP.
function ____exports.oneHP(self)
    for ____, npc in ipairs(getNPCs(nil)) do
        npc.HitPoints = 1
    end
    print("Set every NPC to 1 HP.")
end
--- Gives a pill with the specified pill effect. Accepts either the effect ID or the partial name of
-- the effect.
-- 
-- For example:
-- 
-- - `pill 5` - Gives a "Full Health" pill.
-- - `pill suns` - Gives a "Feels like I'm walking on sunshine" pill.
function ____exports.pill(self, params, isHorse)
    if isHorse == nil then
        isHorse = false
    end
    if params == "" then
        print("You must specify a pill name or number.")
        return
    end
    local pillEffect
    local num = parseIntSafe(nil, params)
    if num == nil then
        local match = getMapPartialMatch(nil, params, PILL_NAME_TO_EFFECT_MAP)
        if match == nil then
            print("Unknown pill effect: " .. params)
            return
        end
        pillEffect = match[2]
    else
        if not isValidPillEffect(nil, num) then
            print("Invalid pill effect ID: " .. tostring(num))
            return
        end
        pillEffect = num
    end
    local pillEffectName = getPillEffectName(nil, pillEffect)
    Isaac.ExecuteCommand("g p" .. tostring(pillEffect))
    if isHorse then
        local player = Isaac.GetPlayer()
        local pillColor = player:GetPill(PocketItemSlot.SLOT_1)
        local horsePillColor = getHorsePillColor(nil, pillColor)
        player:SetPill(PocketItemSlot.SLOT_1, horsePillColor)
    end
    if isHorse then
        print(((("Gave horse pill: " .. pillEffectName) .. " (") .. tostring(pillEffect)) .. ")")
    else
        print(((("Gave pill: " .. pillEffectName) .. " (") .. tostring(pillEffect)) .. ")")
    end
end
--- Gives a poop mana charge. This only affects Tainted Blue Baby. Provide a number to give a custom
-- amount of charges. (You can use negative numbers to remove charges.)
function ____exports.poopMana(self, params)
    local charges = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid mana amount: " .. tostring(num))
            return
        end
        charges = num
    end
    local player = Isaac.GetPlayer()
    player:AddPoopMana(charges)
end
--- Play the supplied sound effect.
-- 
-- For example:
-- - sound 1 - Plays the 1-Up sound effect.
function ____exports.sound(self, params)
    local soundEffect = parseIntSafe(nil, params)
    if soundEffect == nil or not isEnumValue(nil, soundEffect, SoundEffect) then
        print(("Invalid sound effect ID: " .. tostring(soundEffect)) .. ".")
        return
    end
    sfxManager:Play(soundEffect)
end
--- Spawns a collectible in the center of the room. You must specify the collectible name or the
-- number corresponding to the collectible type.
-- 
-- For example, all of the following commands would spawn Spoon Bender:
-- 
-- ```text
-- spawnCollectible spoon bender
-- spawnCollectible spoon
-- spawnCollectible spo
-- spawnCollectible 3
-- ```
function ____exports.spawnCollectible(self, params)
    if params == "" then
        print("You must specify the collectible name or the number corresponding to the collectible type.")
        return
    end
    local num = parseIntSafe(nil, params)
    local collectibleType
    if num == nil then
        local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
        if match == nil then
            print("Unknown collectible: " .. params)
            return
        end
        collectibleType = match[2]
    else
        if not isValidCollectibleType(nil, num) then
            print("Invalid collectible type: " .. tostring(num))
        end
        collectibleType = num
    end
    local roomClass = game:GetRoom()
    local centerPos = roomClass:GetCenterPos()
    spawnCollectibleFunc(nil, collectibleType, centerPos, nil)
end
--- The same thing as the `spawnTrinket` command but spawns a golden version of the specified
-- trinket.
function ____exports.spawnGoldenTrinket(self, params)
    ____exports.spawnTrinket(nil, params, true)
end
--- Spawns a trinket in the center of the room. You must specify the trinket name or the number
-- corresponding to the trinket type.
-- 
-- For example, all of the following commands would spawn the Wiggle Worm trinket:
-- 
-- ```text
-- spawnTrinket wiggle worm
-- spawnTrinket wiggle
-- spawnTrinket wig
-- spawnTrinket 10
-- ```
-- 
-- Also see the `spawnGoldenTrinket` command.
function ____exports.spawnTrinket(self, params, golden)
    if golden == nil then
        golden = false
    end
    if params == "" then
        print("You must specify the name or number corresponding to the trinket type.")
        return
    end
    local num = parseIntSafe(nil, params)
    local trinketType
    if num == nil then
        local match = getMapPartialMatch(nil, params, TRINKET_NAME_TO_TYPE_MAP)
        if match == nil then
            print("Unknown trinket: " .. params)
            return
        end
        trinketType = match[2]
    else
        if not isValidTrinketType(nil, num) then
            print("Invalid trinket type: " .. tostring(num))
            return
        end
        trinketType = num
    end
    local roomClass = game:GetRoom()
    local centerPos = roomClass:GetCenterPos()
    local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
    local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
    spawnTrinketFunction(nil, trinketTypeToSpawn, centerPos)
end
--- Spawns a trinket at a specific grid tile location. You must specify the number corresponding to
-- the trinket type and the number corresponding to the grid tile location.
-- 
-- For example, this would spawn Wiggle Worm in the top-left corner of a 1x1 room:
-- 
-- ```text
-- spawnTrinketAt 10 16
-- ```
-- 
-- (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
-- a grid tile.)
function ____exports.spawnTrinketAt(self, params, golden)
    if golden == nil then
        golden = false
    end
    if params == "" then
        print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
        return
    end
    local args = __TS__StringSplit(params, " ")
    if #args ~= 2 then
        print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
        return
    end
    local trinketTypeString, gridIndexString = table.unpack(args)
    if trinketTypeString == nil or gridIndexString == nil then
        return
    end
    local trinketType = parseIntSafe(nil, trinketTypeString)
    if trinketType == nil or not isValidTrinketType(nil, trinketType) then
        print("Invalid trinket type: " .. trinketTypeString)
        return
    end
    local gridIndex = parseIntSafe(nil, gridIndexString)
    if gridIndex == nil or gridIndex < 0 then
        print("Failed to parse the grid index of: " .. tostring(args[2]))
        return
    end
    local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
    local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
    spawnTrinketFunction(nil, trinketTypeToSpawn, gridIndex)
end
--- Warps to the starting room of the floor.
function ____exports.startingRoom(self)
    local level = game:GetLevel()
    local startingRoomIndex = level:GetStartingRoomIndex()
    changeRoom(nil, startingRoomIndex)
end
--- Adds a single charge to the player's specified active item. You must provide the active slot
-- number. Provide a second number to give a custom amount of charges. (You can use negative numbers
-- to remove charge.)
function ____exports.addCharges(self, params)
    if params == "" then
        print("You must specify a slot number. (Use 0 for the primary slot, 1 for the Schoolbag slot, 2 for the pocket item slot, and 3 for the Dice Bag slot.)")
        return
    end
    local args = __TS__StringSplit(params, " ")
    if #args ~= 1 and #args ~= 2 then
        print("Invalid amount of arguments: " .. tostring(#args))
        return
    end
    local activeSlotString, numChargeString = table.unpack(args)
    if activeSlotString == nil then
        return
    end
    local activeSlot = parseIntSafe(nil, activeSlotString)
    if activeSlot == nil or not isEnumValue(nil, activeSlot, ActiveSlot) then
        print("Invalid slot number: " .. tostring(activeSlot))
        return
    end
    local numCharges = 1
    if numChargeString ~= nil then
        local numChargesAttempt = parseIntSafe(nil, numChargeString)
        if numChargesAttempt == nil then
            print("Invalid charge amount: " .. numChargeString)
            return
        end
        numCharges = numChargesAttempt
    end
    local player = Isaac.GetPlayer()
    addCharge(nil, player, activeSlot, numCharges)
end
--- Warps to the Angel Room for the floor. If the Devil Room has already been visited or initialized,
-- this will uninitialize it and make an Angel Room instead.
function ____exports.angelRoom(self)
    devilAngel(nil, false)
end
--- Activates the flags for the Ascent (i.e. Backwards Path).
function ____exports.ascent(self)
    game:SetStateFlag(GameStateFlag.BACKWARDS_PATH_INIT, true)
    game:SetStateFlag(GameStateFlag.BACKWARDS_PATH, true)
    print("Set Ascent flags.")
end
--- Warps to the first Clean Bedroom or Dirty Bedroom on the floor.
function ____exports.bedroom(self)
    local cleanBedroomGridIndexes = getRoomGridIndexesForType(nil, RoomType.CLEAN_BEDROOM)
    if #cleanBedroomGridIndexes > 0 then
        warpToRoomType(nil, RoomType.CLEAN_BEDROOM)
        return
    end
    local dirtyBedroomGridIndexes = getRoomGridIndexesForType(nil, RoomType.DIRTY_BEDROOM)
    if #dirtyBedroomGridIndexes > 0 then
        warpToRoomType(nil, RoomType.DIRTY_BEDROOM)
        return
    end
    print("There are no Clean Bedrooms or Dirty Bedrooms on this floor.")
end
--- Gives a half black heart. Provide a number to give a custom amount of hearts. (You can use
-- negative numbers to remove hearts.)
function ____exports.blackHearts(self, params)
    addHeart(nil, params, HealthType.BLACK)
end
--- Warps to the Black Market for the floor.
function ____exports.blackMarket(self)
    changeRoom(nil, GridRoom.BLACK_MARKET)
end
--- Toggles permanent Curse of the Blind.
function ____exports.blind(self)
    v.persistent.blind = not v.persistent.blind
    printEnabled(nil, v.persistent.blind, "permanent Curse of the Blind")
end
--- Gives a blood charge. This only affects Bethany. Provide a number to give a custom amount of
-- charges. (You can use negative numbers to remove charges.)
function ____exports.bloodCharges(self, params)
    local charges = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid charge amount: " .. tostring(num))
            return
        end
        charges = num
    end
    local player = Isaac.GetPlayer()
    player:AddBloodCharge(charges)
end
--- Alias for the "blackMarket" command.
function ____exports.bm(self)
    ____exports.blackMarket(nil)
end
--- Gives a bomb. Provide a number to give a custom amount of bombs. (You can use negative numbers to
-- remove bombs.)
function ____exports.bomb(self, params)
    local numBombs = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid bomb amount: " .. tostring(num))
            return
        end
        numBombs = num
    end
    local player = Isaac.GetPlayer()
    player:AddBombs(numBombs)
end
--- Gives 99 bombs. Provide a number to give a custom amount of bombs. (You can use negative numbers
-- to remove bombs.)
function ____exports.bombs(self, params)
    local numBombs = 99
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid bomb amount: " .. tostring(num))
            return
        end
        numBombs = num
    end
    local player = Isaac.GetPlayer()
    player:AddBombs(numBombs)
end
--- Gives a bone heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.boneHearts(self, params)
    addHeart(nil, params, HealthType.BONE)
end
--- Alias for the "bossRoom" command.
function ____exports.boss(self)
    ____exports.bossRoom(nil)
end
--- Warps to the room next to the first Boss Room on the floor.
function ____exports.bossNextRoom(self)
    warpNextToRoomType(nil, RoomType.BOSS)
end
--- Warps to the Boss Rush for the floor.
function ____exports.bossRush(self)
    changeRoom(nil, GridRoom.BOSS_RUSH)
end
--- Gives a broken heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.brokenHearts(self, params)
    addHeart(nil, params, HealthType.BROKEN)
end
--- Gives the specified card. Accepts either the card type or the partial name of the card.
-- 
-- For example:
-- - card 5 - Gives The Emperor.
-- - card spa - Gives 2 of Spades.
function ____exports.card(self, params)
    if params == "" then
        print("You must specify a card name or number.")
        return
    end
    local cardType
    local num = parseIntSafe(nil, params)
    if num == nil then
        local match = getMapPartialMatch(nil, params, CARD_NAME_TO_TYPE_MAP)
        if match == nil then
            print("Unknown card: " .. params)
            return
        end
        cardType = match[2]
    else
        if not isValidCardType(nil, num) then
            print("Invalid card type: " .. tostring(num))
            return
        end
        cardType = num
    end
    local cardName = getCardName(nil, cardType)
    Isaac.ExecuteCommand("g k" .. tostring(cardType))
    print(((("Gave card: " .. cardName) .. " (") .. tostring(cardType)) .. ")")
end
--- Spawns every card on the ground, starting at the top-left-most tile.
function ____exports.cards(self)
    local cardType = FIRST_CARD_TYPE
    do
        local y = 0
        while y <= 6 do
            do
                local x = 0
                while x <= 12 do
                    if cardType > LAST_VANILLA_CARD_TYPE then
                        return
                    end
                    local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
                    spawnCard(nil, cardType, worldPosition)
                    cardType = cardType + 1
                    x = x + 1
                end
            end
            y = y + 1
        end
    end
end
--- Alias for the "chaosCardTears" command.
function ____exports.cc(self)
    ____exports.chaosCardTears(nil)
end
--- Restart as the specified character. Accepts either the character sub-type or the partial name of
-- the character.
-- 
-- For example:
-- - character 2 - Restarts as Cain.
-- - character ta - Restarts as Tainted Azazel.
function ____exports.character(self, params)
    if params == "" then
        print("You must specify a character name or number.")
        return
    end
    local playerType
    local num = parseIntSafe(nil, params)
    if num == nil then
        local match = getMapPartialMatch(nil, params, CHARACTER_NAME_TO_TYPE_MAP)
        if match == nil then
            print("Unknown character: " .. params)
            return
        end
        playerType = match[2]
    else
        if not isEnumValue(nil, num, PlayerType) or num == PlayerType.POSSESSOR then
            print("Invalid character number: " .. tostring(num))
            return
        end
        playerType = num
    end
    local characterName = getCharacterName(nil, playerType)
    restart(nil, playerType)
    print(((("Restarting as character: " .. characterName) .. " (") .. tostring(playerType)) .. ")")
end
--- Alias for the "addCharges" command.
function ____exports.charge(self, params)
    ____exports.addCharges(nil, params)
end
--- Warps to the first Clean Bedroom on the floor.
function ____exports.cleanBedroom(self)
    warpToRoomType(nil, RoomType.CLEAN_BEDROOM)
end
--- Gives a coin. Provide a number to give a custom amount of coins. (You can use negative numbers to
-- remove coins.)
function ____exports.coin(self, params)
    local numCoins = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid coin amount: " .. tostring(num))
            return
        end
        numCoins = num
    end
    local player = Isaac.GetPlayer()
    player:AddCoins(numCoins)
end
--- Gives 999 coins. Provide a number to give a custom amount of coins. (You can use negative numbers
-- to remove coins.)
function ____exports.coins(self, params)
    local numCoins = 999
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid coin amount: " .. tostring(num))
            return
        end
        numCoins = num
    end
    local player = Isaac.GetPlayer()
    player:AddCoins(numCoins)
end
--- Alias for the "spawnCollectible" command.
function ____exports.collectible(self, params)
    ____exports.spawnCollectible(nil, params)
end
--- Creates a crawl space next to the player.
function ____exports.crawlSpace(self)
    spawnTrapdoorOrCrawlSpace(nil, false)
end
--- Toggles permanent Curse of the Cursed.
function ____exports.cursed(self)
    v.persistent.cursed = not v.persistent.cursed
    printEnabled(nil, v.persistent.cursed, "permanent Curse of the Cursed")
end
--- Uses the D20.
function ____exports.d20(self)
    local player = Isaac.GetPlayer()
    useActiveItemTemp(nil, player, CollectibleType.D20)
end
--- Uses the D6.
function ____exports.d6(self)
    local player = Isaac.GetPlayer()
    useActiveItemTemp(nil, player, CollectibleType.D6)
end
--- Warps to the Mausoleum 2 Boss Room that has Dad's Note in it.
function ____exports.dadsNote(self)
    game:SetStateFlag(GameStateFlag.BACKWARDS_PATH_INIT, true)
    setStage(nil, LevelStage.DEPTHS_2, StageType.REPENTANCE)
    ____exports.bossRoom(nil)
end
--- Toggles a set damage stat for the player. You can provide an optional argument to this command in
-- order to set the damage to a specific amount. Default is 500.
function ____exports.damage(self, params)
    if params ~= "" then
        local num = tonumber(params)
        if num == nil then
            print("Invalid damage amount: " .. params)
            return
        end
        v.persistent.damageAmount = num
    end
    v.persistent.damage = not v.persistent.damage
    local player = Isaac.GetPlayer()
    player:AddCacheFlags(CacheFlag.DAMAGE)
    player:EvaluateItems()
    printEnabled(nil, v.persistent.damage, "set damage")
end
--- Toggles permanent Curse of Darkness.
function ____exports.darkness(self)
    v.persistent.darkness = not v.persistent.darkness
    printEnabled(nil, v.persistent.darkness, "permanent Curse of Darkness")
end
--- Alias for the "devil" command.
function ____exports.dd(self)
    ____exports.devilRoom(nil)
end
--- Warps to the first Dirty Bedroom on the floor.
function ____exports.dirtyBedroom(self)
    warpToRoomType(nil, RoomType.DIRTY_BEDROOM)
end
--- Toggles whether curses can appear.
function ____exports.disableCurses(self)
    v.persistent.disableCurses = not v.persistent.disableCurses
    printEnabled(nil, not v.persistent.disableCurses, "curses")
end
--- Warps to the Dogma Boss Room.
function ____exports.dogma(self)
    setStage(nil, LevelStage.HOME, StageType.WRATH_OF_THE_LAMB)
    changeRoom(nil, DOGMA_ROOM_GRID_INDEX)
end
--- Moves the player 0.5 units down. Provide a number to move a custom amount of units.
function ____exports.down(self, params)
    movePlayer(nil, params, Direction.DOWN)
end
--- Warps to the Dungeon (i.e. the crawl space room) for the floor.
function ____exports.dungeon(self)
    changeRoom(nil, GridRoom.DUNGEON)
end
--- Logs the player's current temporary effects to the "log.txt" file.
function ____exports.effects(self)
    local player = Isaac.GetPlayer()
    logPlayerEffects(player)
    print("Logged the player's effects to the \"log.txt\" file.")
end
--- Alias for the "iAmError" command.
function ____exports.errorRoom(self)
    ____exports.iAmErrorRoom(nil)
end
--- Gives an eternal heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.eternalHearts(self, params)
    addHeart(nil, params, HealthType.ETERNAL)
end
--- Grants the maximum amount of blue flies to the player.
function ____exports.flies(self)
    local player = Isaac.GetPlayer()
    player:AddBlueFlies(MAX_NUM_FAMILIARS, player.Position, nil)
end
--- Toggles flight for the player.
function ____exports.flight(self, params)
    local player = Isaac.GetPlayer()
    v.persistent.flight = not v.persistent.flight
    if params == "true" then
        v.persistent.flight = true
    elseif params == "false" then
        v.persistent.flight = false
    end
    player:AddCacheFlags(CacheFlag.FLYING)
    player:EvaluateItems()
    local collectibleUsedToShowFlight = CollectibleType.FATE
    if v.persistent.flight then
        addCollectibleCostume(nil, player, collectibleUsedToShowFlight)
    else
        removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
    end
    printEnabled(nil, v.persistent.flight, "flight")
end
--- Alias for the "startingRoom" command.
function ____exports.fool(self)
    ____exports.startingRoom(nil)
end
--- Displays the current challenge, if any.
function ____exports.getChallenge(self)
    local challenge = Isaac.GetChallenge()
    local challengeName = Challenge[challenge]
    local challengeDescription = challengeName == nil and tostring(challenge) .. " (custom)" or ((("Challenge." .. challengeName) .. " (") .. tostring(challenge)) .. ")"
    print("The current challenge is: " .. challengeDescription)
end
--- Prints the charge for the specified slot. By default, will use `ActiveSlot.PRIMARY`.
function ____exports.getCharge(self, params)
    local activeSlot = ActiveSlot.PRIMARY
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil or not isEnumValue(nil, num, ActiveSlot) then
            print("Invalid slot number: " .. params)
            return
        end
        activeSlot = num
    end
    local player = Isaac.GetPlayer()
    local totalCharge = getTotalCharge(nil, player, activeSlot)
    print((((("Total charge for ActiveSlot." .. ActiveSlot[activeSlot]) .. " (") .. tostring(activeSlot)) .. ") is: ") .. tostring(totalCharge))
end
--- Prints the current position of all players.
function ____exports.getPosition(self)
    for ____, player in ipairs(getPlayers(nil)) do
        local playerName = getPlayerName(nil, player)
        print(((((("Player position for " .. playerName) .. ": (") .. tostring(player.Position.X)) .. ", ") .. tostring(player.Position.Y)) .. ")")
    end
end
--- Toggles permanent Curse of the Giant.
function ____exports.giant(self)
    v.persistent.giant = not v.persistent.giant
    printEnabled(nil, v.persistent.giant, "permanent Curse of the Giant")
end
--- Gives a Giga Bomb. Provide a number to give a custom amount of Giga Bombs. (You can use negative
-- numbers to remove bombs.)
function ____exports.gigaBomb(self, params)
    local numBombs = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid Giga Bomb amount: " .. tostring(num))
            return
        end
        numBombs = num
    end
    local player = Isaac.GetPlayer()
    player:AddGigaBombs(numBombs)
end
--- Alias for the "goldenBomb" command.
function ____exports.goldBomb(self)
    ____exports.goldenBomb(nil)
end
--- Alias for the "goldenHearts" command.
function ____exports.goldHearts(self, params)
    ____exports.goldenHearts(nil, params)
end
--- Alias for the "goldenKey" command.
function ____exports.goldKey(self)
    ____exports.goldenKey(nil)
end
--- Alias for the "spawnGoldenTrinket" command.
function ____exports.goldTrinket(self, params)
    ____exports.spawnGoldenTrinket(nil, params)
end
--- Alias for the "spawnGoldenTrinket" command.
function ____exports.goldenTrinket(self, params)
    ____exports.spawnGoldenTrinket(nil, params)
end
--- Alias for the "debug 11" command. Useful for seeing the coordinates and grid index of each tile
-- in the room.
function ____exports.grid(self)
    Isaac.ExecuteCommand("debug 11")
end
--- Alias for the "gridCosts" command.
function ____exports.grid2(self)
    ____exports.gridCosts(nil)
end
--- Spawns every grid entity, starting at the top-left-most tile.
function ____exports.gridEntities(self)
    local gridEntityTypeIndex = -1
    do
        local y = 0
        while y <= 6 do
            do
                local x = 0
                while x <= 12 do
                    gridEntityTypeIndex = gridEntityTypeIndex + 1
                    local gridEntityType = GRID_ENTITY_TYPE_VALUES[gridEntityTypeIndex + 1]
                    if gridEntityType == nil then
                        return
                    end
                    local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
                    spawnGridEntity(nil, gridEntityType, worldPosition)
                    x = x + 1
                end
            end
            y = y + 1
        end
    end
end
--- Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.hearts(self, params)
    addHeart(nil, params, HealthType.RED)
end
--- Alias for the "debug 6" command.
function ____exports.hitboxes(self)
    Isaac.ExecuteCommand("debug 6")
end
--- The same thing as the `pill` command, but gives a horse pill instead of a normal pill.
function ____exports.horse(self, params)
    ____exports.pill(nil, params, true)
end
--- Warps to the Blue Womb Boss Room.
function ____exports.hush(self)
    setStage(nil, LevelStage.BLUE_WOMB, StageType.ORIGINAL)
    ____exports.bossRoom(nil)
end
--- Gives a key. Provide a number to give a custom amount of key. (You can use negative numbers to
-- remove keys.)
function ____exports.key(self, params)
    local numKeys = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid key amount: " .. tostring(num))
            return
        end
        numKeys = num
    end
    local player = Isaac.GetPlayer()
    player:AddKeys(numKeys)
end
--- Gives 99 keys. Provide a number to give a custom amount of coins. (You can use negative numbers
-- to remove keys.)
function ____exports.keys(self, params)
    local numKeys = 99
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid key amount: " .. tostring(num))
            return
        end
        numKeys = num
    end
    local player = Isaac.GetPlayer()
    player:AddKeys(numKeys)
end
--- Toggles permanent Curse of the Labyrinth.
function ____exports.labyrinth(self)
    v.persistent.labyrinth = not v.persistent.labyrinth
    printEnabled(nil, v.persistent.labyrinth, "permanent Curse of the Labyrinth")
end
--- Moves the player 0.5 units left. Provide a number to move a custom amount of units.
function ____exports.left(self, params)
    movePlayer(nil, params, Direction.LEFT)
end
--- Warps to the first Library on the floor.
function ____exports.library(self)
    warpToRoomType(nil, RoomType.LIBRARY)
end
--- Logs the entities in the room to the "log.txt" file. Provide a number to only log that specific
-- `EntityType`.
-- 
-- By default, this command will exclude background effects. If that is not desired, use the
-- "listAll" command instead.
function ____exports.list(self, params)
    listEntities(nil, params, false)
end
--- Logs the entities in the room to the "log.txt" file. Provide a number to only log that specific
-- `EntityType`.
function ____exports.listAll(self, params)
    listEntities(nil, params, true)
end
--- Logs the grid entities in the room to the "log.txt" file. Provide a number to only log that
-- specific `GridEntityType`.
-- 
-- By default, this command will exclude walls. If that is not desired, use the "listGridAll"
-- command instead.
function ____exports.listGrid(self, params)
    listGridEntities(nil, params, false)
end
--- Logs the grid entities in the room to the "log.txt" file. Provide a number to only log that
-- specific `GridEntityType`.
function ____exports.listGridAll(self, params)
    listGridEntities(nil, params, true)
end
--- Toggles permanent Curse of the Lost.
function ____exports.lost(self)
    v.persistent.lost = not v.persistent.lost
    printEnabled(nil, v.persistent.lost, "permanent Curse of the Lost")
end
--- Alias for the "1hp" command.
function ____exports.lowHP(self)
    ____exports.oneHP(nil)
end
--- Alias for "debug 9".
function ____exports.luck(self)
    Isaac.ExecuteCommand("debug 9")
end
--- Alias for the "poopMana" command.
function ____exports.mana(self, params)
    ____exports.poopMana(nil, params)
end
--- Completely reveals the entire map, including the Ultra Secret Room.
function ____exports.map(self)
    local level = game:GetLevel()
    local displayFlags = addFlag(nil, DisplayFlag.VISIBLE, DisplayFlag.SHADOW, DisplayFlag.SHOW_ICON)
    for ____, roomGridIndex in ipairs(iRange(nil, MAX_LEVEL_GRID_INDEX)) do
        local roomDesc = level:GetRoomByIdx(roomGridIndex)
        roomDesc.DisplayFlags = displayFlags
    end
    level:UpdateVisibility()
end
--- Gives a heart container. Provide a number to give a custom amount of heart containers. (You can
-- use negative numbers to remove heart containers.)
function ____exports.maxHearts(self, params)
    addHeart(nil, params, HealthType.MAX_HEARTS)
end
--- Toggles permanent Curse of the Maze.
function ____exports.maze(self)
    v.persistent.maze = not v.persistent.maze
    printEnabled(nil, v.persistent.maze, "permanent Curse of the Maze")
end
--- Warps to the first Miniboss Room on the floor.
function ____exports.miniboss(self)
    warpToRoomType(nil, RoomType.MINI_BOSS)
end
--- Logs the currently playing music track to the "log.txt" file.
function ____exports.music(self)
    logMusic()
    print("Logged the currently playing music track to the \"log.txt\" file.")
end
--- Alias for the "disableCurses" command.
function ____exports.noCurses(self)
    ____exports.disableCurses(nil)
end
--- Spawns every pill on the ground, starting at the top-left-most tile.
function ____exports.pills(self)
    local y
    local pillColor
    y = 1
    pillColor = FIRST_PILL_COLOR
    do
        local x = 0
        while x <= 12 do
            if pillColor >= PillColor.GOLD then
                break
            end
            local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
            spawnPill(nil, pillColor, worldPosition)
            pillColor = pillColor + 1
            x = x + 1
        end
    end
    y = 2
    pillColor = FIRST_HORSE_PILL_COLOR
    do
        local x = 0
        while x <= 12 do
            if pillColor >= PillColor.HORSE_GOLD then
                break
            end
            local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
            spawnPill(nil, pillColor, worldPosition)
            pillColor = pillColor + 1
            x = x + 1
        end
    end
    y = 3
    local worldPosition1 = gridCoordinatesToWorldPosition(nil, 0, y)
    spawnPill(nil, PillColor.GOLD, worldPosition1)
    local worldPosition2 = gridCoordinatesToWorldPosition(nil, 1, y)
    spawnPill(nil, PillColor.HORSE_GOLD, worldPosition2)
end
--- Warps to the first Planetarium on the floor.
function ____exports.planetarium(self)
    warpToRoomType(nil, RoomType.PLANETARIUM)
end
--- Alias for the "sound" command.
function ____exports.playSound(self, params)
    ____exports.sound(nil, params)
end
--- Sets the player's pocket item to the specified collectible type.
function ____exports.pocket(self, params)
    if params == "" then
        print("You must supply a collectible type to put as the pocket item.")
        return
    end
    local collectibleType = parseIntSafe(nil, params)
    if collectibleType == nil or not isValidCollectibleType(nil, collectibleType) then
        print("Invalid collectible type: " .. tostring(collectibleType))
        return
    end
    local player = Isaac.GetPlayer()
    player:SetPocketActiveItem(collectibleType, ActiveSlot.POCKET)
end
--- Creates a poop grid entity next to the player.
function ____exports.poop(self)
    local roomClass = game:GetRoom()
    local player = Isaac.GetPlayer()
    local tilePosition = roomClass:FindFreeTilePosition(player.Position, 0)
    spawnGridEntity(nil, GridEntityType.POOP, tilePosition)
end
--- Alias for the "getPosition" command.
function ____exports.position(self)
    ____exports.getPosition(nil)
end
--- Alias for the "hearts" command.
function ____exports.redHearts(self, params)
    ____exports.hearts(nil, params)
end
--- Starts a room transition to the same room that you are already in.
function ____exports.reloadRoom(self)
    reloadRoomFunction(nil)
end
--- Moves the player 0.5 units right. Provide a number to move a custom amount of units.
function ____exports.right(self, params)
    movePlayer(nil, params, Direction.RIGHT)
end
--- Logs information about the room to the "log.txt" file.
function ____exports.room(self)
    logRoom()
    print("Logged room information to the \"log.txt\" file.")
end
--- Gives a rotten heart. Provide a number to give a custom amount of hearts. (You can use negative
-- numbers to remove hearts.)
function ____exports.rottenHearts(self, params)
    addHeart(nil, params, HealthType.ROTTEN)
end
--- Run the suite of tests that prove that the "deepCopy" helper function and the "merge" function
-- work properly. For more information, see the `runDeepCopyTests` and the `runMergeTests`
-- functions.
-- 
-- In general, running the tests is only useful if you are troubleshooting the save data manager.
function ____exports.runTests(self)
    runDeepCopyTests(nil)
    runMergeTests(nil)
end
--- Alias for the "stage" command.
-- 
-- For example:
-- - s 3 - Warps to Caves 1.
-- - s 1c - Warps to Downpour 1.
function ____exports.s(self, params)
    if params == "" then
        print("You must specify a stage number.")
        return
    end
    local finalCharacter = string.sub(params, -1)
    local stageString
    local stageTypeLetter
    if finalCharacter == "a" or finalCharacter == "b" or finalCharacter == "c" or finalCharacter == "d" then
        stageString = string.sub(params, 1, -2)
        stageTypeLetter = finalCharacter
    else
        stageString = params
        stageTypeLetter = ""
    end
    local stage = parseIntSafe(nil, stageString)
    if stage == nil or not isEnumValue(nil, stage, StageType) then
        print("Invalid stage number: " .. tostring(stage))
        return
    end
    Isaac.ExecuteCommand(("stage " .. tostring(stage)) .. stageTypeLetter)
end
--- Warps to the first Sacrifice Room on the floor.
function ____exports.sacrificeRoom(self)
    warpToRoomType(nil, RoomType.SACRIFICE)
end
--- Warps to the first Secret Room on the floor.
function ____exports.secretRoom(self)
    warpToRoomType(nil, RoomType.SECRET)
end
--- Warps to the Secret Shop that you would normally get to with a Member Card.
function ____exports.secretShop(self)
    changeRoom(nil, GridRoom.SECRET_SHOP)
end
--- Changes to a seeded run, using the seed of the current run.
function ____exports.seedStick(self)
    local seedsClass = game:GetSeeds()
    local startSeedString = seedsClass:GetStartSeedString()
    Isaac.ExecuteCommand("seed " .. startSeedString)
    print("Sticking to seed: " .. startSeedString)
end
--- Logs all of the current run's seed effects to the "log.txt" file.
function ____exports.seeds(self)
    logSeedEffects()
    print("Logged the seed effects to the \"log.txt\" file.")
end
--- Sets a charge to the player's specified active item. You must provide the active slot number and
-- the number of charges to set.
function ____exports.setCharges(self, params)
    if params == "" then
        print("You must specify a slot number and a charge amount. (Use 0 for the primary slot, 1 for the Schoolbag slot, 2 for the pocket item slot, and 3 for the Dice Bag slot.)")
        return
    end
    local args = __TS__StringSplit(params, " ")
    if #args == 1 then
        print("You must specify the amount of charge to set.")
        return
    end
    if #args ~= 2 then
        print("Invalid amount of arguments: " .. tostring(#args))
        return
    end
    local activeSlotString, chargeString = table.unpack(args)
    if activeSlotString == nil or chargeString == nil then
        return
    end
    local activeSlot = parseIntSafe(nil, activeSlotString)
    if activeSlot == nil or not isEnumValue(nil, activeSlot, ActiveSlot) then
        print("Invalid slot number: " .. activeSlotString)
        return
    end
    local chargeNum = parseIntSafe(nil, chargeString)
    if chargeNum == nil then
        print("Invalid charge amount: " .. chargeString)
        return
    end
    if chargeNum < 0 then
        print("Invalid charge amount: " .. tostring(chargeNum))
        return
    end
    local player = Isaac.GetPlayer()
    player:SetActiveCharge(chargeNum, activeSlot)
end
--- Moves the first player to the specified position.
-- 
-- For example:
-- - setPosition 100 50
function ____exports.setPosition(self, params)
    if params == "" then
        print("You must specify a position. (e.g. \"setPosition 100 50\")")
        return
    end
    local args = __TS__StringSplit(params, " ")
    if #args ~= 2 then
        print("You must specify a position. (e.g. \"setPosition 100 50\")")
        return
    end
    local xString, yString = table.unpack(args)
    if xString == nil or yString == nil then
        return
    end
    local x = parseIntSafe(nil, xString)
    if x == nil then
        print("Invalid x value: " .. xString)
        return
    end
    local y = parseIntSafe(nil, yString)
    if y == nil then
        print("Invalid y value: " .. yString)
        return
    end
    local player = Isaac.GetPlayer()
    local newPosition = Vector(x, y)
    player.Position = newPosition
end
--- Warps to the first shop on the floor.
function ____exports.shop(self)
    warpToRoomType(nil, RoomType.SHOP)
end
--- Uses the Smelter to smelt the current player's trinket.
function ____exports.smelt(self)
    local player = Isaac.GetPlayer()
    useActiveItemTemp(nil, player, CollectibleType.SMELTER)
end
--- Gives a soul charge. This only affects Tainted Bethany. Provide a number to give a custom amount
-- of charges. (You can use negative numbers to remove charges.)
function ____exports.soulCharges(self, params)
    local charges = 1
    if params ~= "" then
        local num = parseIntSafe(nil, params)
        if num == nil then
            print("Invalid charges amount: " .. tostring(num))
            return
        end
        charges = num
    end
    local player = Isaac.GetPlayer()
    player:AddSoulCharge(charges)
end
--- Gives a half soul heart. Provide a number to give a custom amount of hearts. (You can use
-- negative numbers to remove hearts.)
function ____exports.soulHearts(self, params)
    addHeart(nil, params, HealthType.SOUL)
end
--- Logs all of the currently playing sound effects to the "log.txt" file.
function ____exports.sounds(self)
    logSounds()
    print("Logged the currently playing sound effects to the \"log.txt\" file.")
end
--- Toggles spamming Blood Rights on every frame. Useful for killing enemies very fast without using
-- "debug 10".
function ____exports.spam(self)
    v.persistent.spamBloodRights = not v.persistent.spamBloodRights
    printEnabled(nil, v.persistent.spamBloodRights, "spamming Blood Rights")
end
--- Spawns a collectible at a specific grid tile location. You must specify the number corresponding
-- to the collectible type and the number corresponding to the grid tile location.
-- 
-- For example, this would spawn Spoon Bender in the top-left corner of a 1x1 room:
-- 
-- ```text
-- spawnCollectibleAt 3 16
-- ```
-- 
-- (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
-- a grid tile.)
function ____exports.spawnCollectibleAt(self, params)
    if params == "" then
        print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
        return
    end
    local args = __TS__StringSplit(params, " ")
    if #args ~= 2 then
        print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
        return
    end
    local collectibleTypeString, gridIndexString = table.unpack(args)
    if collectibleTypeString == nil or gridIndexString == nil then
        return
    end
    local collectibleType = parseIntSafe(nil, collectibleTypeString)
    if collectibleType == nil or not isValidCollectibleType(nil, collectibleType) then
        print("Invalid collectible type: " .. tostring(args[1]))
        return
    end
    local gridIndex = parseIntSafe(nil, gridIndexString)
    if gridIndex == nil or gridIndex < 0 then
        print("Failed to parse the grid index of: " .. tostring(args[2]))
        return
    end
    spawnCollectibleFunc(nil, collectibleType, gridIndex, nil)
end
--- Alias for the `spawnGoldenTrinket` command.
function ____exports.spawnGoldTrinket(self, params)
    ____exports.spawnGoldenTrinket(nil, params)
end
--- The same thing as the `spawnTrinketAt` command but spawns a golden version of the specified
-- trinket.
function ____exports.spawnGoldenTrinketAt(self, params)
    ____exports.spawnTrinketAt(nil, params, true)
end
--- Toggles a set movement speed and flight for the player. You can provide an optional argument to
-- this command in order to set the speed to a specific amount. Default is 2.0 (which is the maximum
-- that the stat can be set to).
function ____exports.speed(self, params)
    local player = Isaac.GetPlayer()
    if params ~= "" then
        local num = tonumber(params)
        if num == nil then
            print("Invalid speed amount: " .. params)
            return
        end
        v.persistent.damageAmount = num
    end
    v.persistent.speed = not v.persistent.speed
    player:AddCacheFlags(CacheFlag.SPEED)
    player:EvaluateItems()
    local value = tostring(v.persistent.speed)
    ____exports.flight(nil, value)
    printEnabled(nil, v.persistent.speed, "set speed")
end
--- Creates a spikes grid entity next to the player.
function ____exports.spikes(self)
    local roomClass = game:GetRoom()
    local player = Isaac.GetPlayer()
    local tilePosition = roomClass:FindFreeTilePosition(player.Position, 0)
    spawnGridEntity(nil, GridEntityType.SPIKES, tilePosition)
end
--- Alias for the "startingRoom" command.
function ____exports.startRoom(self)
    ____exports.startingRoom(nil)
end
--- Warps to the first Super Secret Room on the floor.
function ____exports.superSecretRoom(self)
    warpToRoomType(nil, RoomType.SUPER_SECRET)
end
--- Toggles a set tear delay (e.g. fire rate) for the player. You can provide an optional argument to
-- this command in order to set the tear delay to a specific amount. Default is 1 (which is
-- equivalent to the Soy Milk tear rate).
function ____exports.tears(self, params)
    if params ~= "" then
        local num = tonumber(params)
        if num == nil then
            print("Invalid tear delay amount: " .. params)
            return
        end
        v.persistent.tearsAmount = num
    end
    v.persistent.tears = not v.persistent.tears
    local player = Isaac.GetPlayer()
    player:AddCacheFlags(CacheFlag.FIRE_DELAY)
    player:EvaluateItems()
    printEnabled(nil, v.persistent.damage, "set tear delay")
end
--- Alias for the "runTests" command.
function ____exports.tests(self)
    ____exports.runTests(nil)
end
--- Creates a trapdoor next to the player.
function ____exports.trapdoor(self)
    spawnTrapdoorOrCrawlSpace(nil, true)
end
--- Warps to the first Treasure Room on the floor.
function ____exports.treasureRoom(self)
    warpToRoomType(nil, RoomType.TREASURE)
end
--- Alias for the "spawnTrinket" command.
function ____exports.trinket(self, params)
    ____exports.spawnTrinket(nil, params)
end
--- Warps to the first Ultra Secret Room on the floor.
function ____exports.ultraSecretRoom(self)
    warpToRoomType(nil, RoomType.ULTRA_SECRET)
end
--- Toggles permanent Curse of the Unknown.
function ____exports.unknown(self)
    v.persistent.unknown = not v.persistent.unknown
    printEnabled(nil, v.persistent.unknown, "permanent Curse of the Unknown")
end
--- If currently on a set seed, changes to an unseeded state and restarts the game.
function ____exports.unseed(self)
    if not onSetSeed(nil) then
        print("You are not on a set seed, so you cannot unseed the run.")
        return
    end
    setUnseeded(nil)
    restart(nil)
end
--- Moves the player 0.5 units up. Provide a number to move a custom amount of units.
function ____exports.up(self, params)
    movePlayer(nil, params, Direction.UP)
end
--- Warps to the specified room type. Accepts either the room type number or the partial name of the
-- room type.
-- 
-- For example:
-- - warp 5 - Warps to the first Boss Room on the floor, if any.
-- - warp tr - Warps to the first Treasure Room on the floor, if any.
function ____exports.warp(self, params)
    if params == "" then
        print("You must specify a room type name or number.")
        return
    end
    local roomType
    local num = parseIntSafe(nil, params)
    if num == nil then
        local match = getMapPartialMatch(nil, params, ROOM_NAME_TO_TYPE_MAP)
        if match == nil then
            print("Unknown room type: " .. params)
            return
        end
        roomType = match[2]
    else
        if not isEnumValue(nil, num, RoomType) then
            print("Invalid room type: " .. tostring(num))
            return
        end
        roomType = num
    end
    warpToRoomType(nil, roomType)
end
--- Alias for the "labyrinth" command.
function ____exports.xl(self)
    ____exports.labyrinth(nil)
end
return ____exports
