UNPKG

@ginstone/nga-api

Version:

40 lines (39 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MissionCheckIn = void 0; const MissionInfo_1 = require("./MissionInfo"); const ObjUtils_1 = require("../../utils/ObjUtils"); class MissionCheckIn { constructor(raw) { // 是否完成 if (raw["0"]) { const child = (0, ObjUtils_1.values)(raw["0"]); this.completed = child && child[0] && child[0] == 7; } // 任务信息 const node1 = raw["1"]; if (node1) { // 任务信息 this.missionInfo = this.findMissionInfo(node1); // 奖励消息 if (node1["2"]) { const arr = (0, ObjUtils_1.values)(node1["2"]); if (arr && arr.length > 0) { this.message = arr[0]; } } } } findMissionInfo(node1) { const arr = (0, ObjUtils_1.values)(node1); for (let i = 0; i < arr.length; i++) { const node = arr[i]; const item = (0, ObjUtils_1.values)(node); if (item && item[0] && typeof item[0] === 'object') { return new MissionInfo_1.MissionInfo(item[0]); } } return undefined; } } exports.MissionCheckIn = MissionCheckIn;