Skip to content

Commit

Permalink
✨ 补全api.minigg
Browse files Browse the repository at this point in the history
  • Loading branch information
KimigaiiWuyi committed Feb 28, 2023
1 parent d62b34b commit 6f05693
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 83 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"Wuyi"
],
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
Expand Down
2 changes: 1 addition & 1 deletion gsuid_utils/api/ambr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AmbrPromote(TypedDict):


class AmbrUpgrade(TypedDict):
prop: AmbrProp
prop: List[AmbrProp]
promote: List[AmbrPromote]


Expand Down
291 changes: 286 additions & 5 deletions gsuid_utils/api/minigg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import annotations

import sys
from typing import List, TypedDict
from typing import Dict, List, Literal, TypedDict

# https://peps.python.org/pep-0655/#usage-in-python-3-11
if sys.version_info >= (3, 11):
Expand All @@ -26,7 +26,7 @@ class FandomUrl(TypedDict):
fandom: str


class Image(TypedDict):
class WeaponImage(TypedDict):
image: str
nameicon: str
namegacha: str
Expand All @@ -40,7 +40,7 @@ class AscendItem(TypedDict):
count: int


class WeaponCosts(TypedDict):
class Costs(TypedDict):
ascend1: List[AscendItem]
ascend2: List[AscendItem]
ascend3: List[AscendItem]
Expand All @@ -65,14 +65,295 @@ class Weapon(TypedDict):
r4: R
r5: R
weaponmaterialtype: str
images: Image
images: WeaponImage
url: NotRequired[FandomUrl]
version: str
costs: WeaponCosts
costs: Costs


class WeaponStats(TypedDict):
level: int
ascension: int
attack: float
specialized: float


class Character(TypedDict):
name: str
fullname: str
title: str
description: str
rarity: str
element: str
weapontype: str
substat: str
gender: Literal['男', '女']
body: str
association: str
region: Literal['蒙德', '璃月', '稻妻', '须弥', '枫丹', '纳塔', '至冬', '穆纳塔']
affiliation: str
birthdaymmdd: str
birthday: str
constellation: str
cv: CharacterCv
costs: Costs
image: CharacterImage
url: FandomUrl
version: str


class CharacterCv(TypedDict):
english: str
chinese: str
japanese: str
korean: str


class CharacterImage(TypedDict):
card: str
portrait: str
icon: str
sideicon: str
cover1: str
cover2: str
hoyolab_avatar: str
nameicon: str
nameiconcard: str
namegachasplash: str
namegachaslice: str
namesideicon: str


class CharacterStats(TypedDict):
level: int
ascension: int
hp: float
attack: float
defense: float
specialized: float


class CharacterConstellations(TypedDict):
name: str
c1: CharacterConstellation
c2: CharacterConstellation
c3: CharacterConstellation
c4: CharacterConstellation
c5: CharacterConstellation
c6: CharacterConstellation
images: ConstellationsImage
version: str


class CharacterConstellation(TypedDict):
name: str
effect: str


class ConstellationsImage(TypedDict):
c1: str
c2: str
c3: str
c4: str
c5: str
c6: str


class MiniGGError(TypedDict):
retcode: int
error: str


class CharacterTalents(TypedDict):
name: str
combat1: TalentCombat
combat2: TalentCombat
combat3: TalentCombat
passive1: TalentPassive
passive2: TalentPassive
passive3: TalentPassive
passive4: NotRequired[TalentPassive]
costs: TalentsCosts
images: TalentsImages


class TalentsCosts(TypedDict):
lvl2: List[AscendItem]
lvl3: List[AscendItem]
lvl4: List[AscendItem]
lvl5: List[AscendItem]
lvl6: List[AscendItem]
lvl7: List[AscendItem]
lvl8: List[AscendItem]
lvl9: List[AscendItem]
lvl10: List[AscendItem]


class TalentsImages(TypedDict):
combat1: str
combat2: str
combat3: str
passive1: str
passive2: str
passive3: str
passive4: NotRequired[str]


class TalentCombat(TypedDict):
name: str
info: str
description: NotRequired[str]
attributes: TalentAttr


class TalentPassive(TypedDict):
name: str
info: str


class TalentAttr(TypedDict):
labels: List[str]
parameters: Dict[str, List[float]]


class Food(TypedDict):
name: str
rarity: str
foodtype: str
foodfilter: str
foodcategory: str
effect: str
description: str
suspicious: FoodEffect
normal: FoodEffect
delicious: FoodEffect
ingredients: List[AscendItem]
images: Image
url: FandomUrl
version: str


class FoodEffect(TypedDict):
effect: str
description: str


class Image(TypedDict):
nameicon: str


class Enemy(TypedDict):
name: str
specialname: str
enemytype: str
category: str
description: str
investigation: EnemyInvest
rewardpreview: List[EnemyReward]
images: Image
version: str


class EnemyReward(TypedDict):
name: str
count: NotRequired[float]


class EnemyInvest(TypedDict):
name: str
category: str
description: str


class Domain(TypedDict):
name: str
region: Literal['蒙德', '璃月', '稻妻', '须弥', '枫丹', '纳塔', '至冬', '穆纳塔']
domainentrance: str
domaintype: str
description: str
recommendedlevel: int
recommendedelements: List[
Literal['冰元素', '火元素', '雷元素', '水元素', '草元素', '岩元素', '风元素']
]
daysofweek: List[Literal['周日', '周一', '周二', '周三', '周四', '周五', '周六']]
unlockrank: int
rewardpreview: List[EnemyReward]
disorder: List[str]
monsterlist: List[str]
images: Image
version: str


class Piece(TypedDict):
name: str
description: str
story: str


class PieceFlower(Piece):
relictype: Literal['生之花']


class PiecePlume(Piece):
relictype: Literal['死之羽']


class PieceSands(Piece):
relictype: Literal['时之沙']


class PieceGoblet(Piece):
relictype: Literal['空之杯']


class PieceCirclet(Piece):
relictype: Literal['理之冠']


class PieceImages(TypedDict):
flower: str
plume: str
sands: str
goblet: str
circlet: str
nameflower: str
nameplume: str
namesands: str
namegoblet: str
namecirclet: str


Artifact = TypedDict(
'Artifact',
{
'name': str,
'rarity': List[str],
'2pc': str,
'4pc': str,
'flower': PieceFlower,
'plume': PiecePlume,
'sands': PieceSands,
'goblet': PieceGoblet,
'circlet': PieceCirclet,
'images': PieceImages,
'url': FandomUrl,
'version': str,
},
)


class MaterialImage(TypedDict):
nameicon: str
redirect: str


class Material(TypedDict):
name: str
description: str
sortorder: int
rarity: str
category: str
materialtype: str
source: List[str]
images: MaterialImage
version: str
Loading

0 comments on commit 6f05693

Please sign in to comment.