"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.QuestStatus = void 0;
const FlagManager_1 = require("modloader64_api/FlagManager");
const JSONTemplate_1 = require("modloader64_api/JSONTemplate");
const Z64CORE = __importStar(require("../importsZ64"));
class QuestStatus extends JSONTemplate_1.JSONTemplate {
    emulator;
    instance = Z64CORE.Z64.Z64_SAVE;
    questFlags;
    skulltulaAddr = this.instance + 0x00d0;
    questFlagsAddr = this.instance + 0x00a4;
    jsonFields = [
        'gerudoMembershipCard',
        'stoneOfAgony',
        'displayGoldSkulltulas',
        'goldSkulltulas',
        'heartPieces',
        'zeldasLullaby',
        'eponasSong',
        'sariasSong',
        'sunsSong',
        'songOfTime',
        'songOfStorms',
        'preludeOfLight',
        'minuetOfForest',
        'boleroOfFire',
        'serenadeOfWater',
        'nocturneOfShadow',
        'requiemOfSpirit',
        'lightMedallion',
        'forestMedallion',
        'waterMedallion',
        'fireMedallion',
        'spiritMedallion',
        'shadowMedallion',
        'kokiriEmerald',
        'goronRuby',
        'zoraSapphire',
    ];
    constructor(emu) {
        super();
        this.emulator = emu;
        this.questFlags = new FlagManager_1.FlagManager(emu, this.questFlagsAddr);
    }
    gerudoMembershipCardFlag = new FlagManager_1.Flag(1, 1);
    get gerudoMembershipCard() {
        return this.questFlags.isFlagSet(this.gerudoMembershipCardFlag);
    }
    set gerudoMembershipCard(bool) {
        this.questFlags.setFlag(this.gerudoMembershipCardFlag, bool);
    }
    stoneOfAgonyFlag = new FlagManager_1.Flag(1, 2);
    get stoneOfAgony() {
        return this.questFlags.isFlagSet(this.stoneOfAgonyFlag);
    }
    set stoneOfAgony(bool) {
        this.questFlags.setFlag(this.stoneOfAgonyFlag, bool);
    }
    displayGoldSkulltulasFlag = new FlagManager_1.Flag(1, 0);
    get displayGoldSkulltulas() {
        return this.questFlags.isFlagSet(this.displayGoldSkulltulasFlag);
    }
    set displayGoldSkulltulas(bool) {
        this.questFlags.setFlag(this.displayGoldSkulltulasFlag, bool);
    }
    get goldSkulltulas() {
        return this.emulator.rdramRead16(this.skulltulaAddr);
    }
    set goldSkulltulas(count) {
        this.emulator.rdramWrite16(this.skulltulaAddr, count);
    }
    get heartPieces() {
        return this.emulator.rdramRead8(this.questFlagsAddr) / 0x10;
    }
    set heartPieces(count) {
        let pieces = count * 0x10;
        this.emulator.rdramWrite8(this.questFlagsAddr, pieces);
    }
    zeldaasLullabyFlag = new FlagManager_1.Flag(2, 3);
    get zeldasLullaby() {
        return this.questFlags.isFlagSet(this.zeldaasLullabyFlag);
    }
    set zeldasLullaby(bool) {
        this.questFlags.setFlag(this.zeldaasLullabyFlag, bool);
    }
    eponasSongFlag = new FlagManager_1.Flag(2, 2);
    get eponasSong() {
        return this.questFlags.isFlagSet(this.eponasSongFlag);
    }
    set eponasSong(bool) {
        this.questFlags.setFlag(this.eponasSongFlag, bool);
    }
    sariasSongFlag = new FlagManager_1.Flag(2, 1);
    get sariasSong() {
        return this.questFlags.isFlagSet(this.sariasSongFlag);
    }
    set sariasSong(bool) {
        this.questFlags.setFlag(this.sariasSongFlag, bool);
    }
    sunsSongFlag = new FlagManager_1.Flag(2, 0);
    get sunsSong() {
        return this.questFlags.isFlagSet(this.sunsSongFlag);
    }
    set sunsSong(bool) {
        this.questFlags.setFlag(this.sunsSongFlag, bool);
    }
    songOfTimeFlag = new FlagManager_1.Flag(1, 7);
    get songOfTime() {
        return this.questFlags.isFlagSet(this.songOfTimeFlag);
    }
    set songOfTime(bool) {
        this.questFlags.setFlag(this.songOfTimeFlag, bool);
    }
    songOfStormsFlag = new FlagManager_1.Flag(1, 6);
    get songOfStorms() {
        return this.questFlags.isFlagSet(this.songOfStormsFlag);
    }
    set songOfStorms(bool) {
        this.questFlags.setFlag(this.songOfStormsFlag, bool);
    }
    preludeOfLightFlag = new FlagManager_1.Flag(2, 4);
    get preludeOfLight() {
        return this.questFlags.isFlagSet(this.preludeOfLightFlag);
    }
    set preludeOfLight(bool) {
        this.questFlags.setFlag(this.preludeOfLightFlag, bool);
    }
    minuetOfForestFlag = new FlagManager_1.Flag(3, 1);
    get minuetOfForest() {
        return this.questFlags.isFlagSet(this.minuetOfForestFlag);
    }
    set minuetOfForest(bool) {
        this.questFlags.setFlag(this.minuetOfForestFlag, bool);
    }
    boleroOfFireFlag = new FlagManager_1.Flag(3, 0);
    get boleroOfFire() {
        return this.questFlags.isFlagSet(this.boleroOfFireFlag);
    }
    set boleroOfFire(bool) {
        this.questFlags.setFlag(this.boleroOfFireFlag, bool);
    }
    serenadeOfWaterFlag = new FlagManager_1.Flag(2, 7);
    get serenadeOfWater() {
        return this.questFlags.isFlagSet(this.serenadeOfWaterFlag);
    }
    set serenadeOfWater(bool) {
        this.questFlags.setFlag(this.serenadeOfWaterFlag, bool);
    }
    nocturneOfShadowFlag = new FlagManager_1.Flag(2, 5);
    get nocturneOfShadow() {
        return this.questFlags.isFlagSet(this.nocturneOfShadowFlag);
    }
    set nocturneOfShadow(bool) {
        this.questFlags.setFlag(this.nocturneOfShadowFlag, bool);
    }
    requiemOfSpiritFlag = new FlagManager_1.Flag(2, 6);
    get requiemOfSpirit() {
        return this.questFlags.isFlagSet(this.requiemOfSpiritFlag);
    }
    set requiemOfSpirit(bool) {
        this.questFlags.setFlag(this.requiemOfSpiritFlag, bool);
    }
    lightMedallionFlag = new FlagManager_1.Flag(3, 2);
    get lightMedallion() {
        return this.questFlags.isFlagSet(this.lightMedallionFlag);
    }
    set lightMedallion(bool) {
        this.questFlags.setFlag(this.lightMedallionFlag, bool);
    }
    forestMedallionFlag = new FlagManager_1.Flag(3, 7);
    get forestMedallion() {
        return this.questFlags.isFlagSet(this.forestMedallionFlag);
    }
    set forestMedallion(bool) {
        this.questFlags.setFlag(this.forestMedallionFlag, bool);
    }
    fireMedallionFlag = new FlagManager_1.Flag(3, 6);
    get fireMedallion() {
        return this.questFlags.isFlagSet(this.fireMedallionFlag);
    }
    set fireMedallion(bool) {
        this.questFlags.setFlag(this.fireMedallionFlag, bool);
    }
    waterMedallionFlag = new FlagManager_1.Flag(3, 5);
    get waterMedallion() {
        return this.questFlags.isFlagSet(this.waterMedallionFlag);
    }
    set waterMedallion(bool) {
        this.questFlags.setFlag(this.waterMedallionFlag, bool);
    }
    shadowMedallionFlag = new FlagManager_1.Flag(3, 3);
    get shadowMedallion() {
        return this.questFlags.isFlagSet(this.shadowMedallionFlag);
    }
    set shadowMedallion(bool) {
        this.questFlags.setFlag(this.shadowMedallionFlag, bool);
    }
    spiritMedallionFlag = new FlagManager_1.Flag(3, 4);
    get spiritMedallion() {
        return this.questFlags.isFlagSet(this.spiritMedallionFlag);
    }
    set spiritMedallion(bool) {
        this.questFlags.setFlag(this.spiritMedallionFlag, bool);
    }
    kokiriEmeraldFlag = new FlagManager_1.Flag(1, 5);
    get kokiriEmerald() {
        return this.questFlags.isFlagSet(this.kokiriEmeraldFlag);
    }
    set kokiriEmerald(bool) {
        this.questFlags.setFlag(this.kokiriEmeraldFlag, bool);
    }
    goronRubyFlag = new FlagManager_1.Flag(1, 4);
    get goronRuby() {
        return this.questFlags.isFlagSet(this.goronRubyFlag);
    }
    set goronRuby(bool) {
        this.questFlags.setFlag(this.goronRubyFlag, bool);
    }
    zoraSapphireFlag = new FlagManager_1.Flag(1, 3);
    get zoraSapphire() {
        return this.questFlags.isFlagSet(this.zoraSapphireFlag);
    }
    set zoraSapphire(bool) {
        this.questFlags.setFlag(this.zoraSapphireFlag, bool);
    }
}
exports.QuestStatus = QuestStatus;
//# sourceMappingURL=QuestStatus.js.map