homm3-parsers
Version:
Collection of binary parsers able to parse various file formats related to Heroes of Might and Magic III
21 lines • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const binary_markup_1 = require("binary-markup");
const common_bml_1 = require("../common.bml");
const quest_1 = require("../enums/quest");
const QuestType_1 = require("../contracts/enums/QuestType");
const questBranches = {
[QuestType_1.QuestType.NONE]: binary_markup_1.pass,
[QuestType_1.QuestType.Experience]: common_bml_1.experience,
[QuestType_1.QuestType.PrimarySkills]: common_bml_1.primarySkills,
[QuestType_1.QuestType.DefeatHero]: common_bml_1.absodId,
[QuestType_1.QuestType.DefeatMonster]: common_bml_1.absodId,
[QuestType_1.QuestType.Resources]: common_bml_1.resources,
[QuestType_1.QuestType.BeHero]: common_bml_1.hero,
[QuestType_1.QuestType.BePlayer]: common_bml_1.playerFlag,
[QuestType_1.QuestType.Creatures]: binary_markup_1.struct(binary_markup_1.byte `count`, binary_markup_1.array(common_bml_1.creatureSlot, binary_markup_1.ctx `count`) `creatures`),
[QuestType_1.QuestType.Artifacts]: binary_markup_1.struct(binary_markup_1.byte `count`, binary_markup_1.array(common_bml_1.artifact, binary_markup_1.ctx `count`) `artifacts`),
};
const messages = binary_markup_1.struct(common_bml_1.hommString `proposalMessage`, common_bml_1.hommString `progressMessage`, common_bml_1.hommString `completionMessage`);
exports.quest = binary_markup_1.struct(binary_markup_1.enums(binary_markup_1.byte, quest_1.questEnum) `questType`, binary_markup_1.branch(binary_markup_1.ctx `questType`, questBranches) `objective`, binary_markup_1.when(binary_markup_1.ctx `questType`.neq(QuestType_1.QuestType.NONE), binary_markup_1.int32) `deadline`, binary_markup_1.when(binary_markup_1.ctx `questType`.neq(QuestType_1.QuestType.NONE), messages) `messages`);
//# sourceMappingURL=quest.bml.js.map