Skip to content

cards 卡牌

卡牌信息获取模块。

python
from bestdori import cards

类型定义

CardInfo 卡牌信息

卡牌详细信息字典。 all.{index}.json 信息字典为该字典中选取部分字段信息。

字段名类型描述
characterIdint角色 ID
attributeAttribute卡牌属性
prefixList[str | None]卡牌名称定长列表
rarityRarity卡牌稀有度
levelLimitint卡牌等级上限
resourceSetNamestr卡牌资源所在集合名。提取卡面等资源时需要提供。
releasedAtList[str | None]卡牌上线时间戳定长列表
skillIdint卡牌技能 ID
typestr卡牌类型
statStat卡牌数据信息
sdResourceNamestr卡牌 LIVE 服装资源名
episodesEpisodes卡牌故事
costumeIdint卡牌服装 ID
gachaTextList[str | None]卡牌上线招募名定长列表
skillNameList[str | None]卡牌技能名定长列表
sourceList[Source | NoneDict]卡牌招募信息定长列表

Attribute 属性

卡牌属性枚举类。

描述
powerful POWERFUL 属性卡牌
pure PURE 属性卡牌
cool COOL 属性卡牌
happy HAPPY 属性卡牌

Rarity 稀有度

卡牌稀有度枚举类。

描述
1 ★1 卡牌
2 ★2 卡牌
3 ★3 卡牌
4 ★4 卡牌
5 ★5 卡牌

Stat 卡牌数据

卡牌数据字典。该字典中字段 episodestraining 并非必定存在。

字段名类型描述
1, 2, ...StatInfo卡牌各等级下数据值。在 all.5.json 中只会包括最低等级与最高等级,在 CardInfo 中则会包括所有等级。
episodesList[StatInfo]卡牌故事阅读后增加数据值。数量为卡牌所有的卡牌故事数量,若没有卡牌故事则不存在该字段。
trainingStatTraining卡牌特训增加数据值。若卡牌无特训则不存在该字段。

StatInfo

字段名类型描述
performanceint卡牌演出值
techniqueint卡牌技巧值
visualint卡牌形象值

StatTraining

字段名类型描述
levelLimitint特训等级上限
performanceint卡牌演出值
techniqueint卡牌技巧值
visualint卡牌形象值

Episodes 卡牌故事

字段名类型描述
entriesList[EpisodesEntry]-

EpisodesEntry

字段名类型描述
episodeIdint故事 ID
episodeTypestr故事类型
situationIdstr-
scenarioIdint场景 ID
appendPerformancceint增加演出值
appendTechniqueint增加技巧值
appendVisualint增加形象值
releaseLevelint开放等级
costsEpisodesEntryCosts故事解锁所需道具
rewardsEpisodesEntryRewards故事奖励
titleList[str | None]故事标题定长列表
characterIdint故事角色 ID

EpisodesEntryCosts

字段名类型描述
entriesList[EpisodesEntryCostsEntry]-

EpisodesEntryCostsEntry

字段名类型描述
resourceIdint-
resourceTypestr-
quantityint-
lbBonusint-

EpisodesEntryRewards

字段名类型描述
entriesList[EpisodesEntryRewardsEntry]-

EpisodesEntryRewardsEntry

字段名类型描述
resourceTypestr-
quantityint-
lbBonusint-

Source 卡牌招募信息

字段名类型描述
gachaDict[str, SourceGacha]招募 ID 与抽取概率字典

SourceGacha

字段名类型描述
probabilityfloat招募抽取概率

TrainType 特训种类

描述
'normal'特训前
'after_training'特训后

def get_all() async

参数名类型默认值描述
indexint0指定获取的 JSON 信息
me keywordOptional[Me]None登录用户类

获取总卡牌信息,返回以卡牌 ID 为字段名、 CardAllInfo 为字段值的信息字典, CardAllInfo 为从 CardInfo 中截取出的部分信息。根据 index 参数值不同,获取到的 CardAllInfo 所包含的信息也不同。

特别地,当 index 值为 0 时,返回值为以卡牌 ID 为字段名、 NoneDict 为字段值的字典

index 可用参数值
参数值获取字段值末项字段名
0-
2attribute
3prefix
5stat
返回值: Dict[str, CardAllInfo | NoneDict]

def get_attribute_icon() async

参数名类型默认值描述
attributeAttribute-属性名称
me keywordOptional[Me]None登录用户类

获取属性图标资源。

返回值: bytes

def get_star_icon() async

参数名类型默认值描述
starstr-星标种类
me keywordOptional[Me]None登录用户类
type 可用参数值
描述
'star'特训前星标
'star_trained'特训后星标

获取星标图标资源。

返回值: bytes

def get_frame() async

参数名类型默认值描述
levelRarity-边框星级
me keywordOptional[Me]None登录用户类

获取指定稀有度卡牌边框资源。

返回值: bytes

def get_card_frame() async

参数名类型默认值描述
levelRarity-边框星级
me keywordOptional[Me]None登录用户类

获取指定稀有度卡牌缩略图边框资源。

返回值: bytes

class Card()

卡牌类,包含各种卡牌资源整合。

def init()

参数名类型默认值描述
idint-卡牌 ID
me keywordOptional[Me]None登录用户类

def get_info() async

获取卡牌信息。

返回值: CardInfo

def get_comment() async

参数名类型默认值描述
limitint20获取到的帖子数量上限
offsetint0获取帖子时的偏移量
orderOrder'TIME_ASC'

获取卡牌的社区评论列表。

返回值: PostList

def get_card() async

参数名类型默认值描述
typeTrainType-卡面种类。指定特训前或特训后

获取卡牌完整卡面图片资源。部分卡牌(如 卡牌)不存在特训后卡面,部分卡牌(如 KiraFes 卡牌)不存在特训前卡面,此时若尝试获取不存在的卡面会抛出异常。

返回值: bytes

def get_trim() async

参数名类型默认值描述
typeTrainType-卡面种类。指定特训前或特训后

获取卡牌无背景卡面图片资源。部分卡牌(如 卡牌)不存在特训后卡面,部分卡牌(如 KiraFes 卡牌)不存在特训前卡面,此时若尝试获取不存在的卡面会抛出异常。

返回值: bytes

def get_thumb() async

参数名类型默认值描述
typeTrainType-缩略图种类。指定特训前或特训后

获取卡牌缩略图图片资源。部分卡牌(如 卡牌)不存在特训后缩略图,部分卡牌(如 KiraFes 卡牌)不存在特训前缩略图,此时若尝试获取不存在的缩略图会抛出异常。

返回值: bytes

def get_livesd() async

获取 LIVE 服装图片。获取到的图片为多张图片放在一起的透明背景图片,需要进行额外拆分操作。

返回值: bytes