import {z} from 'zod' export type Region = 'JP' | 'NA' | 'CN' | 'KR' | 'TW'; export type ReverseDepth = 'function' | 'skillNp' | 'servant'; export type NiceFuncType = 'none' | 'addState' | 'subState' | 'damage' | 'damageNp' | 'gainStar' | 'gainHp' | 'gainNp' | 'lossNp' | 'shortenSkill' | 'extendSkill' | 'releaseState' | 'lossHp' | 'instantDeath' | 'damageNpPierce' | 'damageNpIndividual' | 'addStateShort' | 'gainHpPer' | 'damageNpStateIndividual' | 'hastenNpturn' | 'delayNpturn' | 'damageNpHpratioHigh' | 'damageNpHpratioLow' | 'cardReset' | 'replaceMember' | 'lossHpSafe' | 'damageNpCounter' | 'damageNpStateIndividualFix' | 'damageNpSafe' | 'callServant' | 'ptShuffle' | 'lossStar' | 'changeServant' | 'changeBg' | 'damageValue' | 'withdraw' | 'fixCommandcard' | 'shortenBuffturn' | 'extendBuffturn' | 'shortenBuffcount' | 'extendBuffcount' | 'changeBgm' | 'displayBuffstring' | 'resurrection' | 'gainNpBuffIndividualSum' | 'setSystemAliveFlag' | 'forceInstantDeath' | 'damageNpRare' | 'gainNpFromTargets' | 'gainHpFromTargets' | 'lossHpPer' | 'lossHpPerSafe' | 'shortenUserEquipSkill' | 'quickChangeBg' | 'shiftServant' | 'damageNpAndOrCheckIndividuality' | 'absorbNpturn' | 'overwriteDeadType' | 'forceAllBuffNoact' | 'breakGaugeUp' | 'breakGaugeDown' | 'moveToLastSubmember' | 'extendUserEquipSkill' | 'updateEnemyEntryMaxCountEachTurn' | 'expUp' | 'qpUp' | 'dropUp' | 'friendPointUp' | 'eventDropUp' | 'eventDropRateUp' | 'eventPointUp' | 'eventPointRateUp' | 'transformServant' | 'qpDropUp' | 'servantFriendshipUp' | 'userEquipExpUp' | 'classDropUp' | 'enemyEncountCopyRateUp' | 'enemyEncountRateUp' | 'enemyProbDown' | 'getRewardGift' | 'sendSupportFriendPoint' | 'movePosition' | 'revival' | 'damageNpIndividualSum' | 'damageValueSafe' | 'friendPointUpDuplicate' | 'moveState' | 'changeBgmCostume' | 'lossCommandSpell' | 'gainCommandSpell' | 'updateEntryPositions' | 'buddyPointUp' | 'addFieldChangeToField' | 'subFieldBuff' | 'eventFortificationPointUp' | 'gainNpIndividualSum' | 'setQuestRouteFlag' | 'lastUsePlayerSkillCopy' | 'changeEnemyMasterFace' | 'damageValueSafeOnce' | 'addBattleValue' | 'setBattleValue' | 'gainMultiplyNp' | 'lossMultiplyNp' | 'addBattlePoint' | 'damageNpBattlePointPhase' | 'setNpExecutedState' | 'hideOverGauge' | 'gainNpTargetSum' | 'enemyCountChange' | 'displayBattleMessage' | 'generateBattleSkillDrop' | 'changeMasterFace' | 'enableMasterSkill' | 'enableMasterCommandSpell' | 'battleModelChange' | 'gainNpCriticalstarSum' | 'addBattleMissionValue' | 'setBattleMissionValue' | 'changeEnemyStatusUiType' | 'swapFieldPosition' | 'setDisplayDirectBattleMessageInFsm' | 'addStateToField' | 'addStateShortToField' | 'gainNpFromOtherUsedNpValue' | 'hastenNpturnFromOtherUsedNpturn' | 'damageFuncType164' | 'damageFuncType165' | 'subBattlePoint' | 'setBattleMissionValueAsMax' | 'addStateUserEquipSkillAvailable' | 'addStateShortUserEquipSkillAvailable'; export type NiceFuncTargetType = 'self' | 'ptOne' | 'ptAnother' | 'ptAll' | 'enemy' | 'enemyAnother' | 'enemyAll' | 'ptFull' | 'enemyFull' | 'ptOther' | 'ptOneOther' | 'ptRandom' | 'enemyOther' | 'enemyRandom' | 'ptOtherFull' | 'enemyOtherFull' | 'ptselectOneSub' | 'ptselectSub' | 'ptOneAnotherRandom' | 'ptSelfAnotherRandom' | 'enemyOneAnotherRandom' | 'ptSelfAnotherFirst' | 'ptSelfBefore' | 'ptSelfAfter' | 'ptSelfAnotherLast' | 'commandTypeSelfTreasureDevice' | 'fieldOther' | 'enemyOneNoTargetNoAction' | 'ptOneHpLowestValue' | 'ptOneHpLowestRate' | 'enemyRange' | 'handCommandcardRandomOne' | 'fieldAll' | 'noTarget' | 'fieldRandom' | 'playerAttackPreselectTargetPtOne'; export type FuncApplyTarget = 'player' | 'enemy' | 'playerAndEnemy'; export type Trait = 'unknown' | 'genderMale' | 'genderFemale' | 'genderUnknown' | 'classSaber' | 'classLancer' | 'classArcher' | 'classRider' | 'classCaster' | 'classAssassin' | 'classBerserker' | 'classShielder' | 'classRuler' | 'classAlterEgo' | 'classAvenger' | 'classDemonGodPillar' | 'classLoreGrandCaster' | 'classBeastI' | 'classBeastII' | 'classMoonCancer' | 'classBeastIIIR' | 'classForeigner' | 'classBeastIIIL' | 'classBeastUnknown' | 'classPretender' | 'classUOlgaMarie' | 'classUOlgaMarieGrand' | 'classGrandUnBeastUOlgaMarieAlienGod' | 'classAquaFragment' | 'classUOlgaMarieStellar' | 'classUnBeastOlgaMarie' | 'classGrandSaber' | 'classGrandLancer' | 'classGrandArcher' | 'classGrandRider' | 'classGrandCaster' | 'classGrandAssassin' | 'classGrandBerserker' | 'classGrandShielder' | 'classGrandRuler' | 'classGrandAlterego' | 'classGrandAvenger' | 'classGrandMoonCancer' | 'classGrandForeigner' | 'classGrandPretender' | 'classGrandUnBeast' | 'attributeSky' | 'attributeEarth' | 'attributeHuman' | 'attributeStar' | 'attributeBeast' | 'alignmentLawful' | 'alignmentChaotic' | 'alignmentNeutral' | 'alignmentGood' | 'alignmentEvil' | 'alignmentBalanced' | 'alignmentMadness' | 'alignmentSummer' | 'basedOnServant' | 'human' | 'undead' | 'artificialDemon' | 'demonBeast' | 'daemon' | 'demon' | 'soldier' | 'amazoness' | 'skeleton' | 'zombie' | 'ghost' | 'automata' | 'golem' | 'spellBook' | 'homunculus' | 'lamia' | 'centaur' | 'werebeast' | 'chimera' | 'wyvern' | 'dragonType' | 'gazer' | 'handOrDoor' | 'demonGodPillar' | 'oni' | 'hand' | 'door' | 'threatToHumanity' | 'divine' | 'humanoid' | 'dragon' | 'dragonSlayer' | 'roman' | 'wildbeast' | 'atalante' | 'saberface' | 'weakToEnumaElish' | 'riding' | 'arthur' | 'skyOrEarth' | 'skyOrEarthServant' | 'brynhildsBeloved' | 'undeadOrDaemon' | 'undeadOrDemon' | 'demonic' | 'skyOrEarthExceptPseudoAndDemi' | 'skyOrEarthExceptPseudoAndDemiServant' | 'divineOrDaemonOrUndead' | 'divineOrDemonOrUndead' | 'saberClassServant' | 'superGiant' | 'king' | 'greekMythologyMales' | 'illya' | 'feminineLookingServant' | 'argonaut' | 'associatedToTheArgo' | 'genderCaenisServant' | 'hominidaeServant' | 'blessedByKur' | 'demonicBeastServant' | 'canBeInBattle' | 'notBasedOnServant' | 'livingHuman' | 'cardArts' | 'cardBuster' | 'cardQuick' | 'cardExtra' | 'buffPositiveEffect' | 'buffNegativeEffect' | 'buffIncreaseDamage' | 'buffIncreaseDefence' | 'buffDecreaseDamage' | 'buffDecreaseDefence' | 'buffMentalEffect' | 'buffPoison' | 'buffCharm' | 'buffPetrify' | 'buffStun' | 'buffBurn' | 'buffSpecialResistUp' | 'buffSpecialResistDown' | 'buffEvadeAndInvincible' | 'buffSureHit' | 'buffNpSeal' | 'buffEvade' | 'buffInvincible' | 'buffTargetFocus' | 'buffGuts' | 'skillSeal' | 'buffCurse' | 'buffAtkUp' | 'buffPowerModStrUp' | 'buffDamagePlus' | 'buffNpDamageUp' | 'buffCritDamageUp' | 'buffCritRateUp' | 'buffAtkDown' | 'buffPowerModStrDown' | 'buffDamageMinus' | 'buffNpDamageDown' | 'buffCritDamageDown' | 'buffCritRateDown' | 'buffDeathResistDown' | 'buffDefenceUp' | 'buffMaxHpUpPercent' | 'buffMaxHpDownPercent' | 'buffMaxHpUp' | 'buffMaxHpDown' | 'buffImmobilize' | 'buffIncreasePoisonEffectiveness' | 'buffPigify' | 'buffCurseEffectUp' | 'buffTerrorStunChanceAfterTurn' | 'buffConfusion' | 'buffOffensiveMode' | 'buffDefensiveMode' | 'buffLockCardsDeck' | 'buffDisableColorCard' | 'buffChangeField' | 'buffIncreaseDefenceAgainstIndividuality' | 'buffDefUp' | 'buffInvinciblePierce' | 'buffHpRecoveryPerTurn' | 'buffNegativeEffectImmunity' | 'buffNegativeEffectAtTurnEnd' | 'attackPhysical' | 'attackProjectile' | 'attackMagical' | 'criticalHit' | 'faceCard' | 'cardNP' | 'kingproteaGrowth' | 'kingproteaInfiniteProliferation' | 'kingproteaProliferation' | 'kingproteaProliferationNPDefense' | 'fieldSunlight' | 'fieldShore' | 'fieldForest' | 'fieldBurning' | 'fieldCity' | 'shadowServant' | 'aoeNP' | 'stNP' | 'giant' | 'childServant' | 'buffSpecialInvincible' | 'buffSkillRankUp' | 'buffSleep' | 'nobunaga' | 'fieldImaginarySpace' | 'existenceOutsideTheDomain' | 'curse' | 'fieldShoreOrImaginarySpace' | 'shutenOnField' | 'shuten' | 'genji' | 'vengeance' | 'enemyGardenOfSinnersLivingCorpse' | 'enemyGardenOfSinnersApartmentGhostAndSkeleton' | 'enemyGardenOfSinnersBaseModel' | 'enemyGardenOfSinnersVengefulSpiritOfSevenPeople' | 'enemySaberEliWerebeastAndHomunculusAndKnight' | 'enemySaberEliSkeletonAndGhostAndLamia' | 'enemySaberEliBugAndGolem' | 'enemySeraphEater' | 'enemySeraphShapeshifter' | 'enemySeraphTypeI' | 'enemySeraphTypeSakura' | 'enemyHimejiCastleKnightAndGazerAndMassProduction' | 'enemyHimejiCastleDronesAndHomunculusAndAutomata' | 'enemyHimejiCastleSkeletonAndScarecrow' | 'enemyGuda3MiniNobu' | 'enemyDavinciTrueEnemy' | 'enemyDavinciFalseEnemy' | 'enemyCaseFilesRareEnemy' | 'enemyLasVegasBonusEnemy' | 'enemySummerCampRareEnemy' | 'enemyLittleBigTenguTsuwamonoEnemy' | 'eventSaberWars' | 'eventRashomon' | 'eventOnigashima' | 'eventOnigashimaRaid' | 'eventPrisma' | 'eventPrismaWorldEndMatch' | 'eventNeroFest2' | 'eventGuda2' | 'eventNeroFest3' | 'eventSetsubun' | 'eventApocrypha' | 'eventBattleInNewYork1' | 'eventOniland' | 'eventOoku' | 'eventGuda4' | 'eventLasVegas' | 'eventBattleInNewYork2' | 'eventSaberWarsII' | 'eventSummerCamp' | 'eventGuda5' | 'cursedBook' | 'buffCharmFemale' | 'mechanical' | 'fae' | 'hasCostume' | 'weakPointsRevealed' | 'chenGongNpBlock' | 'knightsOfTheRound' | 'divineSpirit' | 'buffNullifyBuff' | 'enemyGudaMiniNobu' | 'burningLove' | 'buffStrongAgainstWildBeast' | 'buffStrongAgainstDragon' | 'fairyTaleServant' | 'classBeastIV' | 'havingAnimalsCharacteristics' | 'like' | 'exaltation' | 'gubijin' | 'yuMeiren' | 'milleniumCastle' | 'protoMerlinNPChargeBlock' | 'valkyrie' | 'immuneToPigify' | 'summerModeServant' | 'shinsengumiServant' | 'ryozanpaku' | 'demonUnused' | 'levitating' | 'obstacleMaker' | 'defender' | 'hasGoddessMetamorphosis' | 'servantsWithSkyAttribute' | 'moon' | 'cardWeak' | 'cardStrong' | 'servant' | 'shadow' | 'chenGongNp' | 'cantBeSacrificed' | 'gutsBlock' | 'classBeastILost' | 'holdingHolyGrail' | 'standardClassServant' | 'classBeast' | 'classBeastVI' | 'classBeastVIBoss' | 'buffBound' | 'buffDamageCut' | 'marking' | 'manuscriptComplete' | 'myFairSoldier' | 'zeroStarServant' | 'oneStarServant' | 'twoStarServant' | 'threeStarServant' | 'fourStarServant' | 'fiveStarServant' | 'wrathOfTheEnshrinedDeity' | 'caitCuCerpriestessAscension0To2' | 'caitCuCerpriestessAscension3To4' | 'fieldAir' | 'caitCuCerpriestessOnTheField' | 'buffNpPerTurn' | 'buffStarPerTurn' | 'burnEffectivenessUp' | 'murasamaAscension0' | 'classUOlgaMarieFlare' | 'elementalsWrath' | 'buffBuffSuccessRateUp' | 'groupServant' | 'takeruDummyTrait' | 'artsBuff' | 'busterBuff' | 'quickBuff' | 'FSNServant' | 'fieldDarkness' | 'magicBullet' | 'protagonistCorrection' | 'normalAokoBuff' | 'magicBulletAtkBuff' | 'demeritFunction' | 'extraBuff' | 'robinCounter' | 'kuonjiAliceHasSkill3' | 'kuonjiAliceStage3' | 'instantDeathFunction' | 'forceInstantDeathFunction' | 'buffGutsOnInstantDeath' | 'robinAllGone' | 'classBeastEresh' | 'alignmentBeast' | 'bunnyServant' | 'buffSpecialDmgAgainstAlignmentGood' | 'buffSpecialDmgAgainstAlignmentEvil' | 'hasSupereffectiveNPAgainstAlignmentGood' | 'hasSupereffectiveNPAgainstAlignmentEvil' | 'happyHalloween' | 'happyHalloweenCounter' | 'protectedByBBDubai' | 'notProtectedByBBDubai' | 'canFlyInSpace' | 'buffSpecialInvinciblePierce' | 'sakuraSeries' | 'buffDefenceDown' | 'fieldHeaven' | 'fieldHell' | 'markOfSin' | 'quickChain' | 'artsChain' | 'busterChain' | 'mightyChain' | 'braveChain' | 'chainError' | 'classBeastDraco'; export type GetApiRawRegionFunctionSearchArgs = {region: Region, reverse?: boolean | undefined, reverseDepth?: ReverseDepth | undefined, expand?: boolean | undefined, popupText?: (string | null) | undefined, type?: Array | undefined, targetType?: Array | undefined, targetTeam?: Array | undefined, vals?: (Array) | undefined, tvals?: (Array) | undefined, questTvals?: (Array) | undefined, funcIndividuality?: (Array) | undefined}; export type GetApiRawRegionFunctionSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const mstBuff = z.object({vals: z.array(z.number().int()), tvals: z.array(z.number().int()), ckSelfIndv: z.array(z.number().int()), ckOpIndv: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), id: z.number().int(), buffGroup: z.number().int(), type: z.number().int(), name: z.string(), detail: z.string(), iconId: z.number().int(), maxRate: z.number().int()}); export const buffEntityNoReverse = z.object({mstBuff: mstBuff}); export const mstFunc = z.object({vals: z.array(z.number().int()), expandedVals: z.array(buffEntityNoReverse).optional(), tvals: z.array(z.number().int()), questTvals: z.array(z.number().int()), effectList: z.array(z.number().int()), popupTextColor: z.number().int(), script: z.record(z.string(), z.unknown()).nullable().optional(), overWriteTvalsList: z.array(z.array(z.number().int())).nullable().optional(), id: z.number().int(), cond: z.number().int().optional(), funcType: z.number().int(), targetType: z.number().int(), applyTarget: z.number().int(), popupIconId: z.number().int(), popupText: z.string()}); export const mstFuncGroup = z.object({funcId: z.number().int(), eventId: z.number().int(), baseFuncId: z.number().int(), nameTotal: z.string(), name: z.string(), iconId: z.number().int(), priority: z.number().int(), isDispValue: z.boolean()}); export const mstSkill = z.object({effectList: z.array(z.number().int()), actIndividuality: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), id: z.number().int(), type: z.number().int(), name: z.string(), ruby: z.string(), maxLv: z.number().int(), iconId: z.number().int(), motion: z.number().int()}); export const mstSkillDetail = z.object({id: z.number().int(), detail: z.string(), detailShort: z.string()}); export const mstSvtSkill = z.object({script: z.record(z.string(), z.unknown()).nullable().optional(), strengthStatus: z.number().int(), svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), skillId: z.number().int(), condQuestId: z.number().int(), condQuestPhase: z.number().int(), condLv: z.number().int().optional(), condLimitCount: z.number().int(), eventId: z.number().int(), flag: z.number().int()}); export const mstSkillAdd = z.object({skillId: z.number().int(), priority: z.number().int(), commonReleaseId: z.number().int(), name: z.string(), ruby: z.string()}); export const mstSvtSkillRelease = z.object({svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), idx: z.number().int(), condType: z.number().int(), condTargetId: z.number().int(), condNum: z.number().int(), condGroup: z.number().int()}); export const mstCommonRelease = z.object({id: z.number().int(), priority: z.number().int(), condGroup: z.number().int(), condType: z.number().int(), condId: z.number().int(), condNum: z.number().int()}); export const functionEntityNoReverse = z.object({mstFunc: mstFunc, mstFuncGroup: z.array(mstFuncGroup)}); export const mstSkillLv = z.object({funcId: z.array(z.number().int()), expandedFuncId: z.array(functionEntityNoReverse).nullable().optional(), svals: z.array(z.string()), script: z.record(z.string(), z.unknown()), skillId: z.number().int(), lv: z.number().int(), chargeTurn: z.number().int(), skillDetailId: z.number().int(), priority: z.number().int()}); export const mstSkillGroup = z.object({id: z.number().int(), skillId: z.number().int(), lv: z.number().int()}); export const mstSkillGroupOverwrite = z.object({funcId: z.array(z.number().int()), svals: z.array(z.string()), skillGroupId: z.number().int(), startedAt: z.number().int(), endedAt: z.number().int(), iconId: z.number().int(), vals: z.string(), skillDetailId: z.number().int(), expandedFuncId: z.array(functionEntityNoReverse).nullable().optional()}); export const mstSkillIndividuality = z.object({individuality: z.array(z.number().int()), skillId: z.number().int()}); export const skillEntityNoReverse = z.object({mstSkill: mstSkill, mstSkillDetail: z.array(mstSkillDetail), mstSvtSkill: z.array(mstSvtSkill), mstSkillAdd: z.array(mstSkillAdd), mstSvtSkillRelease: z.array(mstSvtSkillRelease), mstCommonRelease: z.array(mstCommonRelease), mstSkillLv: z.array(mstSkillLv), mstSkillGroup: z.array(mstSkillGroup), mstSkillGroupOverwrite: z.array(mstSkillGroupOverwrite), mstSkillIndividuality: mstSkillIndividuality.nullable().optional(), aiIds: z.record(z.string(), z.array(z.number().int())).nullable().optional()}); export const mstSvt = z.object({relateQuestIds: z.array(z.number().int()), individuality: z.array(z.number().int()), classPassive: z.array(z.number().int()), expandedClassPassive: z.array(skillEntityNoReverse).optional(), cardIds: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), id: z.number().int(), baseSvtId: z.number().int(), name: z.string(), ruby: z.string(), battleName: z.string(), classId: z.number().int(), type: z.number().int(), limitMax: z.number().int(), rewardLv: z.number().int(), friendshipId: z.number().int(), maxFriendshipRank: z.number().int(), genderType: z.number().int(), attri: z.number().int(), combineSkillId: z.number().int(), combineLimitId: z.number().int(), sellQp: z.number().int(), sellMana: z.number().int(), sellRarePri: z.number().int(), expType: z.number().int(), combineMaterialId: z.number().int(), cost: z.number().int(), battleSize: z.number().int(), hpGaugeY: z.number().int(), starRate: z.number().int(), deathRate: z.number().int(), attackAttri: z.number().int(), illustratorId: z.number().int(), cvId: z.number().int(), collectionNo: z.number().int(), materialStoryPriority: z.number().int(), flag: z.number().int()}); export const mstTreasureDevice = z.object({individuality: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), id: z.number().int(), seqId: z.number().int(), name: z.string(), ruby: z.string(), rank: z.string(), maxLv: z.number().int(), typeText: z.string(), attackAttri: z.number().int(), effectFlag: z.number().int()}); export const mstTreasureDeviceDetail = z.object({id: z.number().int(), detail: z.string(), detailShort: z.string()}); export const mstSvtTreasureDevice = z.object({damage: z.array(z.number().int()), strengthStatus: z.number().int(), treasureDeviceNum: z.number().int().nullable().optional(), svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), flag: z.number().int(), imageIndex: z.number().int(), treasureDeviceId: z.number().int(), condQuestId: z.number().int(), condQuestPhase: z.number().int(), condLv: z.number().int().optional(), condFriendshipRank: z.number().int().optional(), motion: z.number().int(), cardId: z.number().int()}); export const mstTreasureDeviceLv = z.object({funcId: z.array(z.number().int()), expandedFuncId: z.array(functionEntityNoReverse).nullable().optional(), svals: z.array(z.string()), svals2: z.array(z.string()), svals3: z.array(z.string()), svals4: z.array(z.string()), svals5: z.array(z.string()), treaureDeviceId: z.number().int(), lv: z.number().int(), script: z.record(z.string(), z.unknown()).nullable().optional(), gaugeCount: z.number().int(), detailId: z.number().int(), tdPoint: z.number().int(), tdPointQ: z.number().int(), tdPointA: z.number().int(), tdPointB: z.number().int(), tdPointEx: z.number().int(), tdPointDef: z.number().int(), qp: z.number().int()}); export const mstSvtTreasureDeviceRelease = z.object({svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), idx: z.number().int(), condType: z.number().int(), condTargetId: z.number().int(), condNum: z.number().int(), condGroup: z.number().int()}); export const tdEntityNoReverse = z.object({mstTreasureDevice: mstTreasureDevice, mstTreasureDeviceDetail: z.array(mstTreasureDeviceDetail), mstSvtTreasureDevice: z.array(mstSvtTreasureDevice), mstTreasureDeviceLv: z.array(mstTreasureDeviceLv), mstSvtTreasureDeviceRelease: z.array(mstSvtTreasureDeviceRelease)}); export const mstSvtIndividuality = z.object({individuality: z.array(z.number().int()), svtId: z.number().int(), idx: z.number().int(), limitCount: z.number().int(), condType: z.number().int().nullable().optional(), condId: z.number().int().nullable().optional(), condNum: z.number().int().nullable().optional(), startedAt: z.number().int().nullable().optional(), eventId: z.number().int().nullable().optional(), endedAt: z.number().int().nullable().optional()}); export const mstSvtCard = z.object({normalDamage: z.array(z.number().int()), singleDamage: z.array(z.number().int()), trinityDamage: z.array(z.number().int()), unisonDamage: z.array(z.number().int()), grandDamage: z.array(z.number().int()), attackIndividuality: z.array(z.number().int()), svtId: z.number().int(), cardId: z.number().int(), motion: z.number().int(), attackType: z.number().int()}); export const mstSvtCardAdd = z.object({svtId: z.number().int(), cardId: z.number().int(), script: z.string()}); export const mstSvtLimit = z.object({weaponColor: z.number().int(), svtId: z.number().int(), limitCount: z.number().int(), rarity: z.number().int(), lvMax: z.number().int(), weaponGroup: z.number().int(), weaponScale: z.number().int(), effectFolder: z.number().int(), hpBase: z.number().int(), hpMax: z.number().int(), atkBase: z.number().int(), atkMax: z.number().int(), criticalWeight: z.number().int(), power: z.number().int(), defense: z.number().int(), agility: z.number().int(), magic: z.number().int(), luck: z.number().int(), treasureDevice: z.number().int(), policy: z.number().int(), personality: z.number().int(), deity: z.number().int(), stepProbability: z.number().int(), strParam: z.string()}); export const mstCombineSkill = z.object({itemIds: z.array(z.number().int()), itemNums: z.array(z.number().int()), id: z.number().int(), skillLv: z.number().int(), qp: z.number().int()}); export const mstCombineLimit = z.object({itemIds: z.array(z.number().int()), itemNums: z.array(z.number().int()), id: z.number().int(), svtLimit: z.number().int(), qp: z.number().int()}); export const mstCombineCostume = z.object({itemIds: z.array(z.number().int()), itemNums: z.array(z.number().int()), svtId: z.number().int(), costumeId: z.number().int(), qp: z.number().int()}); export const mstCombineMaterial = z.object({id: z.number().int(), lv: z.number().int(), value: z.number().int(), createdAt: z.number().int().optional()}); export const mstSvtLimitAdd = z.object({individuality: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), svtId: z.number().int(), limitCount: z.number().int(), battleCharaId: z.number().int(), fileConvertLimitCount: z.number().int(), battleCharaLimitCount: z.number().int(), battleCharaOffsetX: z.number().int(), battleCharaOffsetY: z.number().int(), battleCharaOffsetZ: z.number().int(), svtVoiceId: z.number().int(), voicePrefix: z.number().int(), attri: z.number().int().nullable().optional()}); export const mstSvtLimitImage = z.object({svtId: z.number().int(), limitCount: z.number().int(), priority: z.number().int(), defaultLimitCount: z.number().int(), condType: z.number().int(), condTargetId: z.number().int(), condNum: z.number().int()}); export const mstSvtChange = z.object({beforeTreasureDeviceIds: z.array(z.number().int()), afterTreasureDeviceIds: z.array(z.number().int()), svtId: z.number().int(), priority: z.number().int(), condType: z.number().int(), condTargetId: z.number().int(), condValue: z.number().int(), name: z.string(), ruby: z.string(), battleName: z.string(), svtVoiceId: z.number().int(), limitCount: z.number().int(), flag: z.number().int(), battleSvtId: z.number().int()}); export const mstSvtCostume = z.object({svtId: z.number().int(), id: z.number().int(), groupIndex: z.number().int(), name: z.string(), shortName: z.string(), detail: z.string(), itemGetInfo: z.string(), releaseInfo: z.string(), costumeReleaseDetail: z.string(), priority: z.number().int(), flag: z.number().int(), costumeCollectionNo: z.number().int(), iconId: z.number().int().nullable().optional(), openedAt: z.number().int(), endedAt: z.number().int(), script: z.record(z.string(), z.unknown()).nullable().optional()}); export const mstSvtScript = z.object({extendData: z.record(z.string(), z.unknown()), id: z.number().int(), form: z.number().int(), faceX: z.number().int(), faceY: z.number().int(), bgImageId: z.number().int().optional(), scale: z.number(), offsetX: z.number().int(), offsetY: z.number().int(), offsetXMyroom: z.number().int(), offsetYMyroom: z.number().int(), svtId: z.number().int().nullable().optional(), limitCount: z.number().int().nullable().optional()}); export const mstSvtAdd = z.object({svtId: z.number().int(), script: z.record(z.string(), z.unknown())}); export const mstSvtPassiveSkill = z.object({svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), skillId: z.number().int(), condQuestId: z.number().int(), condQuestPhase: z.number().int(), condLv: z.number().int().optional(), condLimitCount: z.number().int().optional(), condFriendshipRank: z.number().int(), eventId: z.number().int(), flag: z.number().int().optional(), commonReleaseId: z.number().int().nullable().optional(), startedAt: z.number().int(), endedAt: z.number().int(), script: z.record(z.string(), z.unknown()).nullable().optional()}); export const mstSvtAppendPassiveSkill = z.object({svtId: z.number().int(), num: z.number().int(), priority: z.number().int(), skillId: z.number().int()}); export const mstSvtAppendPassiveSkillUnlock = z.object({svtId: z.number().int(), num: z.number().int(), itemIds: z.array(z.number().int()), itemNums: z.array(z.number().int())}); export const mstCombineAppendPassiveSkill = z.object({svtId: z.number().int(), num: z.number().int(), skillLv: z.number().int(), qp: z.number().int(), itemIds: z.array(z.number().int()), itemNums: z.array(z.number().int())}); export const mstSvtOverwrite = z.object({svtId: z.number().int(), type: z.number().int(), priority: z.number().int(), condType: z.number().int(), condTargetId: z.number().int(), condValue: z.number().int(), overwriteValue: z.record(z.string(), z.unknown())}); export const mstSvtBattlePoint = z.object({svtId: z.number().int(), battlePointId: z.number().int(), individuality: z.array(z.array(z.number().int())).nullable().optional()}); export const mstBattlePoint = z.object({script: z.record(z.string(), z.unknown()).nullable().optional(), id: z.number().int(), name: z.string().nullable().optional(), flag: z.number().int()}); export const mstBattlePointPhase = z.object({battlePointId: z.number().int(), phase: z.number().int(), value: z.number().int(), name: z.string(), effectId: z.number().int()}); export const mstItemSelect = z.object({itemId: z.number().int(), idx: z.number().int(), candidateGiftId: z.number().int(), requireNum: z.number().int(), detail: z.string()}); export const mstGift = z.object({sort_id: z.number().int().optional(), id: z.number().int(), type: z.number().int(), objectId: z.number().int(), priority: z.number().int(), num: z.number().int(), lv: z.number().int().nullable().optional(), limitCount: z.number().int().nullable().optional()}); export const mstGiftAdd = z.object({priorGiftIconIds: z.array(z.number().int()), giftId: z.number().int(), priority: z.number().int().nullable().optional(), condType: z.number().int(), targetId: z.number().int(), targetNum: z.number().int(), priorGiftId: z.number().int(), script: z.string()}); export const mstItem = z.object({individuality: z.array(z.number().int()), script: z.record(z.string(), z.unknown()), eventId: z.number().int().optional(), eventGroupId: z.number().int().optional(), isPresent: z.boolean().optional(), maxNum: z.number().int().optional(), id: z.number().int(), name: z.string(), detail: z.string(), imageId: z.number().int(), bgImageId: z.number().int(), type: z.number().int(), unit: z.string(), value: z.number().int(), sellQp: z.number().int(), isSell: z.boolean(), priority: z.number().int(), dropPriority: z.number().int(), startedAt: z.number().int(), endedAt: z.number().int(), useSkill: z.boolean().optional(), useAppendSkill: z.boolean().optional(), useAscension: z.boolean().optional(), useCostume: z.boolean().optional(), mstItemSelect: z.array(mstItemSelect).optional(), mstGift: z.array(mstGift).optional(), mstGiftAdd: z.array(mstGiftAdd).optional()}); export const mstImagePartsGroup = z.object({script: z.record(z.string(), z.unknown()), id: z.number().int(), idx: z.number().int(), typeValue: z.number().int(), imageValue: z.number().int(), condType: z.number().int(), condId: z.number().int(), condNum: z.number().int()}); export const mstSvtCoin = z.object({svtId: z.number().int(), summonNum: z.number().int(), itemId: z.number().int()}); export const mstCv = z.object({id: z.number().int(), name: z.string(), comment: z.string().optional()}); export const mstIllustrator = z.object({id: z.number().int(), name: z.string(), comment: z.string().optional()}); export const mstSvtExp = z.object({type: z.number().int(), lv: z.number().int(), exp: z.number().int(), curve: z.number().int()}); export const mstFriendship = z.object({itemIds: z.array(z.number().int()).optional(), itemNums: z.array(z.number().int()).optional(), id: z.number().int(), rank: z.number().int(), friendship: z.number().int(), qp: z.number().int().optional()}); export const mstFriendshipSvt = z.object({svtId: z.number().int(), rank: z.number().int(), giftId: z.number().int()}); export const niceValentineScript = z.object({scriptId: z.string(), script: z.string().min(1).max(2083), scriptName: z.string()}); export const niceCostume = z.object({id: z.number().int(), costumeCollectionNo: z.number().int(), battleCharaId: z.number().int(), name: z.string(), shortName: z.string(), detail: z.string(), priority: z.number().int()}); export const mstSvtExtra = z.object({svtId: z.number().int(), mstSvt: mstSvt, zeroLimitOverwriteName: z.string().nullable().optional(), bondEquip: z.number().int(), bondEquips: z.array(z.number().int()), bondEquipOwner: z.number().int().nullable().optional(), valentineEquip: z.array(z.number().int()), valentineScript: z.array(niceValentineScript), valentineEquipOwner: z.number().int().nullable().optional(), costumeLimitSvtIdMap: z.record(z.string(), niceCostume).optional(), limitAdds: z.array(mstSvtLimitAdd).optional(), limits: z.array(mstSvtLimit).optional()}); export const mstSvtComment = z.object({condValues: z.array(z.number().int()).nullable().optional(), script: z.record(z.string(), z.unknown()).nullable().optional(), svtId: z.number().int(), id: z.number().int(), priority: z.number().int(), condMessage: z.string(), comment: z.string(), condType: z.number().int(), condValue2: z.number().int()}); export const mstSvtCommentAdd = z.object({svtId: z.number().int(), id: z.number().int(), priority: z.number().int(), idx: z.number().int(), condType: z.number().int(), condValues: z.array(z.number().int()), condValue2: z.number().int()}); export const scriptJsonInfo = z.object({id: z.string(), face: z.number().int(), delay: z.number(), text: z.string().nullable().optional(), form: z.number().int().optional(), changeEffect: z.number().int().optional(), multiFace: z.array(z.number().int()).nullable().optional(), multiForm: z.array(z.number().int()).nullable().optional()}); export const scriptJsonCond = z.object({condType: z.number().int(), value: z.number().int(), eventId: z.number().int().optional()}); export const scriptJson = z.object({summonScript: z.string().nullable().optional(), overwriteName: z.string().nullable().optional(), overwritePriority: z.number().int().nullable().optional(), infos: z.array(scriptJsonInfo).optional(), conds: z.array(scriptJsonCond).nullable().optional(), condAddItem: z.number().int().optional(), materialOverwriteName: z.string().nullable().optional()}); export const mstSvtVoice = z.object({scriptJson: z.array(scriptJson.nullable()), scriptJsonAdditory: z.array(scriptJson).nullable().optional(), id: z.number().int(), voicePrefix: z.number().int(), type: z.number().int()}); export const mstSvtMultiPortrait = z.object({commonPosition: z.array(z.number().int()), summonPosition: z.array(z.number().int()), withMasterPhotoPosition: z.array(z.number().int()).nullable().optional(), svtId: z.number().int(), limitCount: z.number().int(), idx: z.number().int(), type: z.number().int().nullable().optional(), portraitImageId: z.number().int(), displayPriority: z.number().int()}); export const mstVoice = z.object({id: z.string(), priority: z.number().int(), svtVoiceType: z.number().int(), name: z.string(), nameDefault: z.string(), condType: z.number().int(), condValue: z.number().int(), voicePlayedValue: z.number().int(), firstPlayPriority: z.number().int(), closedType: z.number().int(), flag: z.number().int()}); export const mstSvtGroup = z.object({id: z.number().int(), svtId: z.number().int()}); export const globalNewMstSubtitle = z.object({id: z.string(), serif: z.string()}); export const mstVoicePlayCond = z.object({svtId: z.number().int(), script: z.record(z.string(), z.unknown()).nullable().optional(), voicePrefix: z.number().int(), voiceId: z.string(), idx: z.number().int(), condGroup: z.number().int(), condType: z.number().int(), targetId: z.number().int(), condValues: z.array(z.number().int())}); export const servantEntity = z.object({mstSvt: mstSvt, mstSkill: z.array(skillEntityNoReverse), mstTreasureDevice: z.array(tdEntityNoReverse), mstSvtIndividuality: z.array(mstSvtIndividuality), mstSvtCard: z.array(mstSvtCard), mstSvtCardAdd: z.array(mstSvtCardAdd), mstSvtLimit: z.array(mstSvtLimit), mstCombineSkill: z.array(mstCombineSkill), mstCombineLimit: z.array(mstCombineLimit), mstCombineCostume: z.array(mstCombineCostume), mstCombineMaterial: z.array(mstCombineMaterial), mstSvtLimitAdd: z.array(mstSvtLimitAdd), mstSvtLimitImage: z.array(mstSvtLimitImage), mstSvtChange: z.array(mstSvtChange), mstSvtCostume: z.array(mstSvtCostume), mstSvtScript: z.array(mstSvtScript), mstSvtAdd: mstSvtAdd.nullable().optional(), mstSvtPassiveSkill: z.array(mstSvtPassiveSkill), expandedExtraPassive: z.array(skillEntityNoReverse).optional(), mstSvtAppendPassiveSkill: z.array(mstSvtAppendPassiveSkill), expandedAppendPassive: z.array(skillEntityNoReverse).optional(), mstSvtAppendPassiveSkillUnlock: z.array(mstSvtAppendPassiveSkillUnlock), mstCombineAppendPassiveSkill: z.array(mstCombineAppendPassiveSkill), mstSvtOverwrite: z.array(mstSvtOverwrite), mstSvtBattlePoint: z.array(mstSvtBattlePoint), mstBattlePoint: z.array(mstBattlePoint), mstBattlePointPhase: z.array(mstBattlePointPhase), mstItem: z.array(mstItem), mstCommonRelease: z.array(mstCommonRelease), mstImagePartsGroup: z.array(mstImagePartsGroup), mstSvtCoin: mstSvtCoin.nullable().optional(), mstCv: mstCv.nullable().optional(), mstIllustrator: mstIllustrator.nullable().optional(), mstSvtExp: z.array(mstSvtExp).optional(), mstFriendship: z.array(mstFriendship).optional(), mstFriendshipSvt: z.array(mstFriendshipSvt).optional(), mstGift: z.array(mstGift).optional(), mstGiftAdd: z.array(mstGiftAdd).optional(), mstSvtExtra: mstSvtExtra.nullable().optional(), mstSvtComment: z.array(mstSvtComment).optional(), mstSvtCommentAdd: z.array(mstSvtCommentAdd).optional(), mstSvtVoice: z.array(mstSvtVoice).optional(), mstSvtMultiPortrait: z.array(mstSvtMultiPortrait).optional(), mstVoice: z.array(mstVoice).optional(), mstSvtGroup: z.array(mstSvtGroup).optional(), mstSubtitle: z.array(globalNewMstSubtitle).optional(), mstVoicePlayCond: z.array(mstVoicePlayCond).optional()}); export const mstEquip = z.object({id: z.number().int(), name: z.string(), detail: z.string(), condUserLv: z.number().int(), maxLv: z.number().int(), maleImageId: z.number().int(), femaleImageId: z.number().int(), imageId: z.number().int(), maleSpellId: z.number().int(), femaleSpellId: z.number().int(), shortName: z.string().nullable().optional()}); export const mstEquipExp = z.object({equipId: z.number().int(), lv: z.number().int(), exp: z.number().int(), skillLv1: z.number().int(), skillLv2: z.number().int(), skillLv3: z.number().int()}); export const mstEquipAdd = z.object({id: z.number().int(), equipId: z.number().int(), commonReleaseId: z.number().int(), maleImageId: z.number().int(), femaleImageId: z.number().int()}); export const mysticCodeEntity = z.object({mstEquip: mstEquip, mstSkill: z.array(skillEntityNoReverse), mstEquipExp: z.array(mstEquipExp), mstEquipAdd: z.array(mstEquipAdd), mstCommonRelease: z.array(mstCommonRelease)}); export const mstCommandCode = z.object({id: z.number().int(), collectionNo: z.number().int(), name: z.string(), ruby: z.string(), rarity: z.number().int(), sellQp: z.number().int(), sellMana: z.number().int(), sellRarePri: z.number().int().optional()}); export const mstCommandCodeComment = z.object({commandCodeId: z.number().int(), comment: z.string(), illustratorId: z.number().int()}); export const commandCodeEntity = z.object({mstCommandCode: mstCommandCode, mstSkill: z.array(skillEntityNoReverse), mstCommandCodeComment: mstCommandCodeComment.nullable().optional(), mstIllustrator: mstIllustrator.nullable().optional()}); export const reversedSkillTd = z.object({servant: z.array(servantEntity).optional(), MC: z.array(mysticCodeEntity).optional(), CC: z.array(commandCodeEntity).optional()}); export const reversedSkillTdType = z.object({raw: reversedSkillTd.nullable().optional()}); export const skillEntity = z.object({mstSkill: mstSkill, mstSkillDetail: z.array(mstSkillDetail), mstSvtSkill: z.array(mstSvtSkill), mstSkillAdd: z.array(mstSkillAdd), mstSvtSkillRelease: z.array(mstSvtSkillRelease), mstCommonRelease: z.array(mstCommonRelease), mstSkillLv: z.array(mstSkillLv), mstSkillGroup: z.array(mstSkillGroup), mstSkillGroupOverwrite: z.array(mstSkillGroupOverwrite), mstSkillIndividuality: mstSkillIndividuality.nullable().optional(), aiIds: z.record(z.string(), z.array(z.number().int())).nullable().optional(), reverse: reversedSkillTdType.nullable().optional()}); export const tdEntity = z.object({mstTreasureDevice: mstTreasureDevice, mstTreasureDeviceDetail: z.array(mstTreasureDeviceDetail), mstSvtTreasureDevice: z.array(mstSvtTreasureDevice), mstTreasureDeviceLv: z.array(mstTreasureDeviceLv), mstSvtTreasureDeviceRelease: z.array(mstSvtTreasureDeviceRelease), reverse: reversedSkillTdType.nullable().optional()}); export const reversedFunction = z.object({skill: z.array(skillEntity).optional(), NP: z.array(tdEntity).optional()}); export const reversedFunctionType = z.object({raw: reversedFunction.nullable().optional()}); export const functionEntity = z.object({mstFunc: mstFunc, mstFuncGroup: z.array(mstFuncGroup), reverse: reversedFunctionType.nullable().optional()}); export const getApiRawRegionFunctionSearchResponse = z.array(functionEntity); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Find and get function data * * GET /raw/{region}/function/search */ export const getApiRawRegionFunctionSearch = async (args: GetApiRawRegionFunctionSearchArgs, options?: GetApiRawRegionFunctionSearchOptions) => { const {baseUrl = "https://api.atlasacademy.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.reverse != null) query.append("reverse", String(args.reverse)) if (args.reverseDepth != null) query.append("reverseDepth", String(args.reverseDepth)) if (args.expand != null) query.append("expand", String(args.expand)) if (args.popupText != null) query.append("popupText", String(args.popupText)) for (const item of args.type ?? []) query.append("type", String(item)) for (const item of args.targetType ?? []) query.append("targetType", String(item)) for (const item of args.targetTeam ?? []) query.append("targetTeam", String(item)) for (const item of args.vals ?? []) query.append("vals", String(item)) for (const item of args.tvals ?? []) query.append("tvals", String(item)) for (const item of args.questTvals ?? []) query.append("questTvals", String(item)) for (const item of args.funcIndividuality ?? []) query.append("funcIndividuality", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/raw/${encodeURIComponent(String(args.region))}/function/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(getApiRawRegionFunctionSearchResponse, await res.json()) };