"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DungeonItemContainer = exports.DungeonItemManager = void 0;
const Z64API = __importStar(require("../../API/imports"));
const GameAliases_1 = require("./types/GameAliases");
class DungeonItemManager {
    emulator;
    DEKU_TREE;
    DODONGOS_CAVERN;
    JABJ_JABUS_BELLY;
    FOREST_TEMPLE;
    FIRE_TEMPLE;
    WATER_TEMPLE;
    SPIRIT_TEMPLE;
    SHADOW_TEMPLE;
    BOTTOM_OF_THE_WELL;
    ICE_CAVERN;
    GANONS_CASTLE;
    WOODFALL_TEMPLE;
    SNOWHEAD_TEMPLE;
    GREAT_BAY_TEMPLE;
    STONE_TOWER_TEMPLE;
    constructor(emulator) {
        this.emulator = emulator;
        this.DEKU_TREE = new DungeonItemContainer(this.emulator, 0 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.DEKU_TREE */);
        this.DODONGOS_CAVERN = new DungeonItemContainer(this.emulator, 1 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.DODONGOS_CAVERN */);
        this.JABJ_JABUS_BELLY = new DungeonItemContainer(this.emulator, 2 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.JABJ_JABUS_BELLY */);
        this.FOREST_TEMPLE = new DungeonItemContainer(this.emulator, 3 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.FOREST_TEMPLE */);
        this.FIRE_TEMPLE = new DungeonItemContainer(this.emulator, 4 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.FIRE_TEMPLE */);
        this.WATER_TEMPLE = new DungeonItemContainer(this.emulator, 5 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.WATER_TEMPLE */);
        this.SPIRIT_TEMPLE = new DungeonItemContainer(this.emulator, 6 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.SPIRIT_TEMPLE */);
        this.SHADOW_TEMPLE = new DungeonItemContainer(this.emulator, 7 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.SHADOW_TEMPLE */);
        this.BOTTOM_OF_THE_WELL = new DungeonItemContainer(this.emulator, 8 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.BOTTOM_OF_THE_WELL */);
        this.ICE_CAVERN = new DungeonItemContainer(this.emulator, 9 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.ICE_CAVERN */);
        this.GANONS_CASTLE = new DungeonItemContainer(this.emulator, 10 /* Z64API.OoT.VANILLA_DUNGEON_ITEM_INDEXES.GANONS_CASTLE */);
        this.WOODFALL_TEMPLE = new DungeonItemContainer(this.emulator, 0 /* Z64API.MM.VANILLA_DUNGEON_ITEM_INDEXES.WOODFALL_TEMPLE */);
        this.SNOWHEAD_TEMPLE = new DungeonItemContainer(this.emulator, 1 /* Z64API.MM.VANILLA_DUNGEON_ITEM_INDEXES.SNOWHEAD_TEMPLE */);
        this.GREAT_BAY_TEMPLE = new DungeonItemContainer(this.emulator, 2 /* Z64API.MM.VANILLA_DUNGEON_ITEM_INDEXES.GREAT_BAY_TEMPLE */);
        this.STONE_TOWER_TEMPLE = new DungeonItemContainer(this.emulator, 3 /* Z64API.MM.VANILLA_DUNGEON_ITEM_INDEXES.STONE_TOWER_TEMPLE */);
    }
    setRawBuffer(buf) {
        this.emulator.rdramWriteBuffer(GameAliases_1.Z64_SAVE + 0xa8, buf);
    }
    getRawBuffer() {
        return this.emulator.rdramReadBuffer(GameAliases_1.Z64_SAVE + 0xa8, 0x14);
    }
}
exports.DungeonItemManager = DungeonItemManager;
class DungeonItemContainer {
    addr = GameAliases_1.Z64_DUNGEON_ITEM_ADDR;
    emulator;
    index;
    constructor(emulator, index) {
        this.emulator = emulator;
        this.index = index;
    }
    get bossKey() {
        return this.emulator.rdramReadBit8(this.addr + this.index, 7);
    }
    set bossKey(bool) {
        this.emulator.rdramWriteBit8(this.addr + this.index, 7, bool);
    }
    get compass() {
        return this.emulator.rdramReadBit8(this.addr + this.index, 6);
    }
    set compass(bool) {
        this.emulator.rdramWriteBit8(this.addr + this.index, 6, bool);
    }
    get map() {
        return this.emulator.rdramReadBit8(this.addr + this.index, 5);
    }
    set map(bool) {
        this.emulator.rdramWriteBit8(this.addr + this.index, 5, bool);
    }
}
exports.DungeonItemContainer = DungeonItemContainer;
//# sourceMappingURL=DungeonItemManager.js.map