UNPKG

maplestory-openapi

Version:

This JavaScript library enables the use of the MapleStory OpenAPI of Nexon.

937 lines (934 loc) 40.4 kB
import axios from 'axios'; import '../../../node_modules/buffer/index.js'; import { removeQuery } from '../common/lib.js'; import { CharacterDto } from './dto/character/character.js'; import { CharacterAbilityDto } from './dto/character/characterAbility.js'; import { CharacterAndroidEquipmentDto } from './dto/character/characterAndroidEquipment.js'; import { CharacterBasicDto } from './dto/character/characterBasic.js'; import { CharacterBeautyEquipmentDto } from './dto/character/characterBeautyEquipment.js'; import { CharacterCashItemEquipmentDto } from './dto/character/characterCashItemEquipment.js'; import { CharacterDojangDto } from './dto/character/characterDojang.js'; import { CharacterFamiliarDto } from './dto/character/characterFamiliar.js'; import { CharacterHexaMatrixDto } from './dto/character/characterHexaMatrix.js'; import { CharacterHexaMatrixStatDto } from './dto/character/characterHexaMatrixStat.js'; import { CharacterHyperStatDto } from './dto/character/characterHyperStat.js'; import { CharacterImageDto } from './dto/character/characterImage.js'; import { CharacterItemEquipmentDto } from './dto/character/characterItemEquipment.js'; import { CharacterLinkSkillDto } from './dto/character/characterLinkSkill.js'; import { CharacterPetEquipmentDto } from './dto/character/characterPetEquipment.js'; import { CharacterPopularityDto } from './dto/character/characterPopularity.js'; import { CharacterPropensityDto } from './dto/character/characterPropensity.js'; import { CharacterSetEffectDto } from './dto/character/characterSetEffect.js'; import { CharacterSkillDto } from './dto/character/characterSkill.js'; import { CharacterStatDto } from './dto/character/characterStat.js'; import { CharacterSymbolEquipmentDto } from './dto/character/characterSymbolEquipment.js'; import { CharacterVMatrixDto } from './dto/character/characterVMatrix.js'; import { GuildDto } from './dto/guild/guild.js'; import { GuildBasicDto } from './dto/guild/guildBasic.js'; import { UnionDto } from './dto/union/union.js'; import { UnionArtifactDto } from './dto/union/unionArtifact.js'; import { UnionChampionDto } from './dto/union/unionChampion.js'; import { UnionRaiderDto } from './dto/union/unionRaider.js'; import { CharacterImageAction, CharacterImageEmotion, CharacterImageWeaponMotion } from '../common/enum/characterImage.js'; import { MapleStoryApi as MapleStoryApi$1 } from '../common/mapleStoryApi.js'; import { __exports as buffer } from '../../../_virtual/index.js_commonjs-exports.js'; /** * MapleStory OpenAPI client for TMS.<br> * This is an implementation of <a href="https://openapi.nexon.com/game/maplestorytw">MapleStory API</a> */ class MapleStoryApi extends MapleStoryApi$1 { subUrl = 'maplestorytw'; timezoneOffset = 480; constructor(apiKey) { super(apiKey); } //#region 檢視角色資訊 /** * 檢視角色辨識器 (OCID)。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param characterName 角色名稱 */ async getCharacter(characterName) { const path = `${this.subUrl}/v1/id`; const { data } = await this.client.get(path, { params: { character_name: characterName, }, }); return new CharacterDto(data); } /** * 檢視基本資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterBasic(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/basic`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterBasicDto(data); } /** * 檢視角色外型圖片資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param imageOptions 圖像選項 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterImage(ocid, imageOptions, dateOptions) { const basic = await this.getCharacterBasic(ocid, dateOptions); if (!basic) { return null; } const { date, characterImage } = basic; const action = imageOptions?.action ?? CharacterImageAction.Stand1; const emotion = imageOptions?.emotion ?? CharacterImageEmotion.Default; const wmotion = imageOptions?.wmotion ?? CharacterImageWeaponMotion.Default; const actionFrame = imageOptions?.actionFrame ?? 0; const emotionFrame = imageOptions?.emotionFrame ?? 0; const width = 96; const height = 96; const x = imageOptions?.x ?? null; const y = imageOptions?.y ?? null; const path = removeQuery(characterImage); const query = { action: `${action}.${actionFrame}`, emotion: `${emotion}.${emotionFrame}`, wmotion, width, height, x, y, }; const urlImageToBase64 = async (path, query) => { const { data, headers } = await axios.get(path, { params: query, responseType: 'arraybuffer', }); const base64 = buffer.Buffer.from(data, 'binary').toString('base64'); const mimeType = headers['content-type']; return `data:${mimeType};base64,${base64}`; }; const [originImage, image] = await Promise.all([ urlImageToBase64(path), urlImageToBase64(path, query), ]); return new CharacterImageDto({ date, originUrl: path, originImage, image, action, emotion, wmotion, actionFrame, emotionFrame, width, height, x, y, }); } /** * 檢視名聲資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterPopularity(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/popularity`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterPopularityDto(data); } /** * 檢視綜合能力值資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterStat(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/stat`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterStatDto(data); } /** * 檢視極限屬性資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterHyperStat(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/hyper-stat`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterHyperStatDto(data); } /** * 檢視性向資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterPropensity(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/propensity`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterPropensityDto(data); } /** * 檢視能力資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterAbility(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/ability`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterAbilityDto(data); } /** * 檢視已裝備道具資訊 (不含現金道具)。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterItemEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/item-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterItemEquipmentDto(data); } /** * 檢視已裝備現金道具資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterCashItemEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/cashitem-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterCashItemEquipmentDto(data); } /** * 檢視已裝備符文資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterSymbolEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/symbol-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterSymbolEquipmentDto(data); } /** * 檢視目前套用的套裝效果資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterSetEffect(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/set-effect`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterSetEffectDto(data); } /** * 檢視目前已裝備的髮型、臉型與膚色資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterBeautyEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/beauty-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterBeautyEquipmentDto(data); } /** * 檢視已裝備機器人資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterAndroidEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/android-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterAndroidEquipmentDto(data); } /** * 檢視已裝備寵物、寵物技能與寵物道具資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterPetEquipment(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/pet-equipment`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterPetEquipmentDto(data); } /** * 檢視角色技能與超技能資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param characterSkillGrade 您要檢視的轉職階段 <a href="https://openapi.nexon.com/game/maplestorytw/?id=49">Available values</a> * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterSkill(ocid, characterSkillGrade, dateOptions) { const path = `${this.subUrl}/v1/character/skill`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, character_skill_grade: characterSkillGrade, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterSkillDto(data); } /** * 檢視已裝備連結技能資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterLinkSkill(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/link-skill`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterLinkSkillDto(data); } /** * 檢視 V 矩陣欄位資訊與已裝備 V 核心資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterVMatrix(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/vmatrix`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterVMatrixDto(data); } /** * 檢視已裝備於 HEXA 矩陣的 HEXA 核心資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterHexaMatrix(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/hexamatrix`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterHexaMatrixDto(data); } /** * 檢視設定於 HEXA 矩陣中的 HEXA 屬性資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterHexaMatrixStat(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/hexamatrix-stat`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterHexaMatrixStatDto(data); } /** * 檢視角色在武陵道場的最高紀錄資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterDojang(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/dojang`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterDojangDto(data); } /** * 檢視萌獸資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getCharacterFamiliar(ocid, dateOptions) { const path = `${this.subUrl}/v1/character/familiar`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new CharacterFamiliarDto(data); } //#endregion //#region 檢視聯盟資訊 /** * 檢視戰地等級與戰地階級資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getUnion(ocid, dateOptions) { const path = `${this.subUrl}/v1/user/union`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new UnionDto(data); } /** * 檢視詳細資訊,例如派遣至聯盟的攻擊單位成員效果,以及攻擊單位佔領效果。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getUnionRaider(ocid, dateOptions) { const path = `${this.subUrl}/v1/user/union-raider`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new UnionRaiderDto(data); } /** * 檢視戰地神器資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getUnionArtifact(ocid, dateOptions) { const path = `${this.subUrl}/v1/user/union-artifact`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new UnionArtifactDto(data); } /** * 查詢聯盟冠軍資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 12 月 18 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param ocid 角色辨識器 * @param dateOptions 要搜尋的日期 (TST) */ async getUnionChampion(ocid, dateOptions) { const path = `${this.subUrl}/v1/user/union-champion`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 12, day: 18, }) : undefined; const query = { ocid: ocid, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new UnionChampionDto(data); } //#endregion //#region 檢視公會資訊 /** * 檢視公會識別碼 (oguild_id) 資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param guildName 公會名稱 * @param worldName 世界名稱 <a href="https://openapi.nexon.com/game/maplestorytw/?id=51">Available values</a> */ async getGuild(guildName, worldName) { const path = `${this.subUrl}/v1/guild/id`; const { data } = await this.client.get(path, { params: { guild_name: guildName, world_name: worldName, }, }); if (this.isEmptyResponse(data)) { return null; } return new GuildDto(data); } /** * 檢視公會基本資訊。 * - 楓之谷遊戲資料平均在 15 分鐘後即可使用。 * - 您可以從 2025 年 10 月 15 日起搜尋資料。 * - 您可以輸入所需日期以搜尋過往資料。前一日的資料將於翌日凌晨 2:00 起提供。(當您搜尋 10 月 15 日的資料時,將會擷取從 15 日 00:00 到 16 日 00:00 的資料。) * - 由於遊戲內容變動,OCID 可能會有所變更。在更新以 OCID 為基礎的服務時,請務必留意。 * - 此 API 提供來自楓之谷台灣的資料。 * @param guildId 公會識別碼 * @param dateOptions 要搜尋的日期 (TST) */ async getGuildBasic(guildId, dateOptions) { const path = `${this.subUrl}/v1/guild/basic`; const date = dateOptions ? this.toDateString(dateOptions, { year: 2025, month: 10, day: 15, }) : undefined; const query = { oguild_id: guildId, date: date, }; const { data } = await this.client.get(path, { params: query, }); if (this.isEmptyResponse(data)) { return null; } return new GuildBasicDto(data); } } export { MapleStoryApi };