import {z} from 'zod' export type Region = 'JP' | 'NA' | 'CN' | 'KR' | 'TW'; export type ReverseDepth = 'function' | 'skillNp' | 'servant'; export type Language = 'jp' | 'en'; export type GetApiBasicRegionBuffBuffIdArgs = {region: Region, buff_id: number, reverse?: boolean | undefined, reverseDepth?: ReverseDepth | undefined, lang?: (Language | null) | undefined}; export type GetApiBasicRegionBuffBuffIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const niceBuffType = z.enum(["none", "invalid", "upCommandatk", "upStarweight", "upCriticalpoint", "downCriticalpoint", "regainNp", "regainStar", "regainHp", "reduceHp", "upAtk", "downAtk", "upDamage", "downDamage", "addDamage", "subDamage", "upNpdamage", "downNpdamage", "upDropnp", "upCriticaldamage", "downCriticaldamage", "addSelfdamage", "subSelfdamage", "avoidance", "breakAvoidance", "invincible", "upGrantstate", "downGrantstate", "upTolerance", "downTolerance", "avoidState", "donotAct", "donotSkill", "donotNoble", "donotRecovery", "disableGender", "guts", "upHate", "addIndividuality", "subIndividuality", "upDefence", "downDefence", "upCommandstar", "upCommandnp", "upCommandall", "downCommandall", "downStarweight", "reduceNp", "downDropnp", "upGainHp", "downGainHp", "downCommandatk", "upCriticalrate", "downCriticalrate", "pierceInvincible", "avoidInstantdeath", "upResistInstantdeath", "upNonresistInstantdeath", "delayFunction", "regainNpUsedNoble", "deadFunction", "upMaxhp", "downMaxhp", "addMaxhp", "subMaxhp", "battlestartFunction", "wavestartFunction", "selfturnendFunction", "damageFunction", "upGivegainHp", "downGivegainHp", "commandattackAfterFunction", "deadattackFunction", "upSpecialdefence", "downSpecialdefence", "upDamagedropnp", "downDamagedropnp", "entryFunction", "upChagetd", "reflectionFunction", "upGrantSubstate", "downGrantSubstate", "upToleranceSubstate", "downToleranceSubstate", "upGrantInstantdeath", "downGrantInstantdeath", "gutsRatio", "upDefencecommandall", "downDefencecommandall", "overwriteBattleclass", "overwriteClassrelatioAtk", "overwriteClassrelatioDef", "upDamageIndividuality", "downDamageIndividuality", "upDamageIndividualityActiveonly", "downDamageIndividualityActiveonly", "upNpturnval", "downNpturnval", "multiattack", "upGiveNp", "downGiveNp", "upResistanceDelayNpturn", "downResistanceDelayNpturn", "pierceDefence", "upGutsHp", "downGutsHp", "upFuncgainNp", "downFuncgainNp", "upFuncHpReduce", "downFuncHpReduce", "upDefenceCommanddamage", "downDefenceCommanddamage", "npattackPrevBuff", "fixCommandcard", "donotGainnp", "fieldIndividuality", "donotActCommandtype", "upDamageEventPoint", "upDamageSpecial", "attackAfterFunction", "commandcodeattackBeforeFunction", "donotNobleCondMismatch", "donotSelectCommandcard", "donotReplace", "shortenUserEquipSkill", "tdTypeChange", "overwriteClassRelation", "tdTypeChangeArts", "tdTypeChangeBuster", "tdTypeChangeQuick", "commandattackBeforeFunction", "gutsFunction", "upCriticalRateDamageTaken", "downCriticalRateDamageTaken", "upCriticalStarDamageTaken", "downCriticalStarDamageTaken", "skillRankUp", "avoidanceIndividuality", "changeCommandCardType", "specialInvincible", "preventDeathByDamage", "commandcodeattackAfterFunction", "attackBeforeFunction", "donotSkillSelect", "buffRate", "invisibleBattleChara", "counterFunction", "notTargetSkill", "hpReduceToRegain", "selfturnstartFunction", "overwriteDeadType", "upActionCount", "downActionCount", "shiftGuts", "shiftGutsRatio", "masterSkillValueUp", "buffConvert", "subFieldIndividuality", "commandcodeattackBeforeFunctionMainOnly", "commandcodeattackAfterFunctionMainOnly", "commandattackBeforeFunctionMainOnly", "commandattackAfterFunctionMainOnly", "attackBeforeFunctionMainOnly", "attackAfterFunctionMainOnly", "warBoardNotAttacked", "warBoardIgnoreDefeatpoint", "skillAfterFunction", "treasureDeviceAfterFunction", "skillAfterFunctionMainOnly", "treasureDeviceAfterFunctionMainOnly", "preventInvisibleWhenInstantDeath", "overwriteSubattribute", "avoidanceAttackDeathDamage", "avoidFunctionExecuteSelf", "pierceSubdamage", "continueFunction", "addSpecialdamage", "subSpecialdamage", "addFuncHpReduce", "subFuncHpReduce", "changeBgm", "confirmCommandFunction", "skillBeforeFunction", "skillTargetedBeforeFunction", "fieldIndividualityChangedFunction", "treasureDeviceBeforeFunction", "stepInAfterFunction", "shortenSkillAfterUseSkill", "pierceSpecialInvincible", "functionedFunction", "donotActCommandcard", "upNpdamageIndividualitySum", "comboStartFunction", "comboEndFunction", "overwriteSvtCardType", "upDefenceDamage", "downDefenceDamage", "upDefenceCriticaldamage", "downDefenceCriticaldamage", "upDefenceNpdamage", "downDefenceNpdamage", "upDefenceCommandnp", "downDefenceCommandnp", "upDefenceCommandstar", "downCommandstar", "downDefenceCommandstar", "wavestartAnimationBeforeFunction", "subFixedSelfdamage", "overwriteFixedDefenceDamage", "extendActionCount", "gutsBeforeFunction", "overwriteBuffUseRate", "upBuffUseRate", "downBuffUseRate", "reactiveDamageGainHp", "upHateToGrantedOpponent", "upBaseHp", "addBaseHp", "substituteInstantDeath", "substituteAddState", "otherTreasureDevicePreBeforeFunction", "attackPhaseStartFunction", "treasureDevicePostAfterFunction", "multiDeadFunction", "multiGutsFunction", "multiGutsBeforeFunction", "limitMaxNp", "limitMinNp", "lastSelfturnprogressFunction", "addMaxBattlePoint", "subMaxBattlePoint", "selfturnprogressFunction", "toFieldChangeField", "toFieldAvoidBuff", "toFieldSubIndividualityField", "upSelfdamage", "downSelfdamage", "downCommanstar", "downCommandnp"]); export const niceClassRelationOverwriteType = z.enum(["overwriteForce", "overwriteMoreThanTarget", "overwriteLessThanTarget"]); export const relationOverwriteDetail = z.object({damageRate: z.number().int(), type: niceClassRelationOverwriteType}); export const niceBuffRelationOverwrite = z.object({atkSide: z.record(z.string(), z.record(z.string(), relationOverwriteDetail)), defSide: z.record(z.string(), z.record(z.string(), relationOverwriteDetail))}); export const trait = z.enum(["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 const niceTrait = z.object({id: z.number().int(), name: trait, negative: z.boolean().nullable().optional()}); export const niceBuffConvertLimitType = z.enum(["all", "self"]); export const niceBuffConvertType = z.enum(["none", "buff", "individuality"]); export const buffConvertScript = z.object({OverwritePopupText: z.array(z.string())}); export const buffConvert = z.object({targetLimit: niceBuffConvertLimitType, convertType: niceBuffConvertType, targets: z.union([z.array(z.number().int()), z.array(niceTrait), z.array(z.record(z.string(), z.unknown()))]), targetBuffs: z.array(z.record(z.string(), z.unknown())), targetIndividualities: z.array(niceTrait), convertBuffs: z.array(z.record(z.string(), z.unknown())), script: buffConvertScript, effectId: z.number().int()}); export const niceBuffConditionTargetType = z.enum(["none", "ptAll", "enemyAll", "fieldAll", "ptFull", "enemyFull", "ptOtherAll", "ptOtherFull", "fieldOtherAll", "relativePositionPt"]); export const condBuffValue = z.object({buffType: niceBuffType, condValue: z.string(), buffCheckIndvType: z.number().int().nullable().optional(), buffIndividualities: z.array(niceTrait), valueCondTargetType: niceBuffConditionTargetType, filterActivePassive: z.number().int().nullable().optional(), filterSubStateEnable: z.number().int().nullable().optional()}); export const buffScript = z.object({checkIndvType: z.number().int().nullable().optional(), CheckOpponentBuffTypes: z.array(niceBuffType).nullable().optional(), relationId: niceBuffRelationOverwrite.nullable().optional(), ReleaseText: z.string().nullable().optional(), DamageRelease: z.number().int().nullable().optional(), INDIVIDUALITIE: niceTrait.nullable().optional(), INDIVIDUALITIE_COUNT_ABOVE: z.number().int().nullable().optional(), INDIVIDUALITIE_COUNT_BELOW: z.number().int().nullable().optional(), INDIVIDUALITIE_AND: z.array(niceTrait).nullable().optional(), INDIVIDUALITIE_OR: z.array(niceTrait).nullable().optional(), ckSelfCountIndividuality: z.array(niceTrait).nullable().optional(), ckOpCountIndividuality: z.array(niceTrait).nullable().optional(), ckIndvCountAbove: z.number().int().nullable().optional(), ckIndvCountBelow: z.number().int().nullable().optional(), UpBuffRateBuffIndiv: z.array(niceTrait).nullable().optional(), HP_LOWER: z.number().int().nullable().optional(), HP_HIGHER: z.number().int().nullable().optional(), CounterMessage: z.string().nullable().optional(), avoidanceText: z.string().nullable().optional(), gutsText: z.string().nullable().optional(), missText: z.string().nullable().optional(), AppId: z.number().int().nullable().optional(), IncludeIgnoreIndividuality: z.number().int().nullable().optional(), ProgressSelfTurn: z.number().int().nullable().optional(), TargetIndiv: niceTrait.nullable().optional(), extendLowerLimit: z.number().int().nullable().optional(), convert: buffConvert.nullable().optional(), useFirstTimeInTurn: z.number().int().nullable().optional(), fromCommandSpell: z.number().int().nullable().optional(), fromMasterEquip: z.number().int().nullable().optional(), NotPierceIndividuality: z.array(z.array(niceTrait)).nullable().optional(), condBuffValue: z.array(condBuffValue).nullable().optional()}); export const niceFuncType = z.enum(["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 const niceFuncTargetType = z.enum(["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 const funcApplyTarget = z.enum(["player", "enemy", "playerAndEnemy"]); export const basicBuff = z.object({id: z.number().int(), name: z.string(), originalName: z.string(), detail: z.string(), icon: z.string().min(1).max(2083), type: niceBuffType, buffGroup: z.number().int(), script: buffScript, originalScript: z.record(z.string(), z.unknown()), vals: z.array(niceTrait), tvals: z.array(niceTrait), ckSelfIndv: z.array(niceTrait), ckOpIndv: z.array(niceTrait), maxRate: z.number().int()}); export const niceSvtType = z.enum(["normal", "heroine", "combineMaterial", "enemy", "enemyCollection", "servantEquip", "statusUp", "svtEquipMaterial", "enemyCollectionDetail", "all", "commandCode", "svtMaterialTd"]); export const niceSvtFlag = z.enum(["onlyUseForNpc", "svtEquipFriendShip", "ignoreCombineLimitSpecial", "svtEquipExp", "svtEquipChocolate", "svtEquipManaExchange", "svtEquipCampaign", "svtEquipEvent", "svtEquipEventReward", "svtEquipRarityLevelNumMission", "normal", "goetia", "matDropRateUpCe", "unknown"]); export const niceSvtFlagOriginal = z.enum(["onlyUseForNpc", "svtEquipFriendShip", "ignoreCombineLimitSpecial", "svtEquipExp", "svtEquipChocolate", "svtEquipManaExchange", "svtEquipCampaign", "svtEquipEvent", "svtEquipEventReward", "svtEquipRarityLevelNumMission"]); export const svtClass = z.enum(["saber", "archer", "lancer", "rider", "caster", "assassin", "berserker", "shielder", "ruler", "alterEgo", "avenger", "demonGodPillar", "loreGrandSaber", "loreGrandArcher", "loreGrandLancer", "loreGrandRider", "loreGrandCaster", "loreGrandAssassin", "loreGrandBerserker", "beastII", "ushiChaosTide", "beastI", "moonCancer", "beastIIIR", "foreigner", "beastIIIL", "beastUnknown", "pretender", "beastIV", "beastILost", "uOlgaMarieAlienGod", "uOlgaMarie", "beast", "beastVI", "beastVIBoss", "beastVII", "uOlgaMarieFlare", "beastEresh", "uOlgaMarieAqua", "uOlgaMarieGrand", "uOlgaMarieStellar", "unBeastOlgaMarie", "aquaFragment", "unknown", "agarthaPenth", "cccFinaleEmiyaAlter", "salemAbby", "OTHER", "ALL", "EXTRA", "MIX", "EXTRA1", "EXTRA2", "uOlgaMarieFlareCollection", "uOlgaMarieAquaCollection", "uOlgaMarieGrandCollection", "uOlgaMarieStellarCollection", "atlasUnmappedClass", "grandSaber", "grandArcher", "grandLancer", "grandRider", "grandCaster", "grandAssassin", "grandBerserker", "grandShielder", "grandRuler", "grandAlterego", "grandAvenger", "grandMoonCancer", "grandForeigner", "grandPretender", "grandUnBeastUOlgaMarieAlienGod", "grandUnBeastDraco", "grandUnBeastEresh", "grandUnBeastUOlgaMarie"]); export const attribute = z.enum(["none", "default", "human", "sky", "earth", "star", "beast", "void"]); export const basicCostume = z.object({id: z.number().int(), costumeCollectionNo: z.number().int(), battleCharaId: z.number().int(), shortName: z.string()}); export const basicServant = z.object({id: z.number().int(), collectionNo: z.number().int(), name: z.string(), originalName: z.string(), overwriteName: z.string().nullable().optional(), originalOverwriteName: z.string().nullable().optional(), type: niceSvtType, flag: niceSvtFlag, flags: z.array(niceSvtFlagOriginal), classId: z.number().int(), className: z.union([svtClass, z.string()]), attribute: attribute, traits: z.array(niceTrait), rarity: z.number().int(), atkMax: z.number().int(), hpMax: z.number().int(), face: z.string().min(1).max(2083), costume: z.record(z.string(), basicCostume)}); export const mCAssets = z.object({male: z.string().min(1).max(2083), female: z.string().min(1).max(2083)}); export const basicMysticCode = z.object({id: z.number().int(), name: z.string(), item: mCAssets}); export const basicCommandCode = z.object({id: z.number().int(), collectionNo: z.number().int(), name: z.string(), rarity: z.number().int(), face: z.string().min(1).max(2083)}); export const basicReversedSkillTd = z.object({servant: z.array(basicServant).optional(), MC: z.array(basicMysticCode).optional(), CC: z.array(basicCommandCode).optional()}); export const basicReversedSkillTdType = z.object({basic: basicReversedSkillTd.nullable().optional()}); export const basicSkillReverse = z.object({id: z.number().int(), name: z.string(), ruby: z.string(), icon: z.string().min(1).max(2083).nullable().optional(), reverse: basicReversedSkillTdType.nullable().optional()}); export const basicTdReverse = z.object({id: z.number().int(), name: z.string(), ruby: z.string(), reverse: basicReversedSkillTdType.nullable().optional()}); export const basicReversedFunction = z.object({skill: z.array(basicSkillReverse).optional(), NP: z.array(basicTdReverse).optional()}); export const basicReversedFunctionType = z.object({basic: basicReversedFunction.nullable().optional()}); export const basicFunctionReverse = z.object({funcId: z.number().int(), funcType: niceFuncType, funcTargetType: niceFuncTargetType, funcTargetTeam: funcApplyTarget, functvals: z.array(niceTrait), overWriteTvalsList: z.array(z.array(niceTrait)), funcquestTvals: z.array(niceTrait), funcPopupText: z.string(), traitVals: z.array(niceTrait).optional(), buffs: z.array(basicBuff), reverse: basicReversedFunctionType.nullable().optional()}); export const basicReversedBuff = z.object({function: z.array(basicFunctionReverse).optional()}); export const basicReversedBuffType = z.object({basic: basicReversedBuff.nullable().optional()}); export const basicBuffReverse = z.object({id: z.number().int(), name: z.string(), originalName: z.string(), detail: z.string(), icon: z.string().min(1).max(2083), type: niceBuffType, buffGroup: z.number().int(), script: buffScript, originalScript: z.record(z.string(), z.unknown()), vals: z.array(niceTrait), tvals: z.array(niceTrait), ckSelfIndv: z.array(niceTrait), ckOpIndv: z.array(niceTrait), maxRate: z.number().int(), reverse: basicReversedBuffType.nullable().optional()}); 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 }; /** * Get buff data * * GET /basic/{region}/buff/{buff_id} */ export const getApiBasicRegionBuffBuffId = async (args: GetApiBasicRegionBuffBuffIdArgs, options?: GetApiBasicRegionBuffBuffIdOptions) => { 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.lang != null) query.append("lang", String(args.lang)) const url = `${baseUrl.replace(/\/+$/, '')}/basic/${encodeURIComponent(String(args.region))}/buff/${encodeURIComponent(String(args.buff_id))}${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(basicBuffReverse, await res.json()) };