Skip to content

Commit

Permalink
Updated packages and black 2024 format
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Jan 27, 2024
1 parent 5c669a3 commit 336a0d7
Show file tree
Hide file tree
Showing 25 changed files with 621 additions and 538 deletions.
8 changes: 5 additions & 3 deletions app/core/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,11 @@ async def get_basic_svt(
"id": costume.id,
"costumeCollectionNo": costume.costumeCollectionNo,
"battleCharaId": costume.battleCharaId,
"shortName": get_translation(lang, costume.shortName)
if region == Region.JP and lang is not None
else costume.shortName,
"shortName": (
get_translation(lang, costume.shortName)
if region == Region.JP and lang is not None
else costume.shortName
),
}
if svtExtra.zeroLimitOverwriteName is not None:
basic_servant["name"] = svtExtra.zeroLimitOverwriteName
Expand Down
6 changes: 3 additions & 3 deletions app/core/nice/cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ async def get_nice_command_code(
illustrator=get_translation(
lang, raw_cc.mstIllustrator.name if raw_cc.mstIllustrator else ""
),
comment=raw_cc.mstCommandCodeComment.comment
if raw_cc.mstCommandCodeComment
else "",
comment=(
raw_cc.mstCommandCodeComment.comment if raw_cc.mstCommandCodeComment else ""
),
)

return nice_cc
Expand Down
24 changes: 14 additions & 10 deletions app/core/nice/enemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@ def get_enemy_passive(svt: UserSvt, all_skills: MultipleNiceSkills) -> EnemyPass
for skill_id in svt.classPassive
if SkillSvt(skill_id, svt.svtId) in all_skills
],
addPassive=[
all_skills[SkillSvt(skill_id, svt.svtId)]
for skill_id in svt.addPassive
if SkillSvt(skill_id, svt.svtId) in all_skills
]
if svt.addPassive
else [],
addPassive=(
[
all_skills[SkillSvt(skill_id, svt.svtId)]
for skill_id in svt.addPassive
if SkillSvt(skill_id, svt.svtId) in all_skills
]
if svt.addPassive
else []
),
addPassiveLvs=svt.addPassiveLvs,
appendPassiveSkillIds=svt.appendPassiveSkillIds,
appendPassiveSkillLvs=svt.appendPassiveSkillLvs,
Expand Down Expand Up @@ -535,9 +537,11 @@ async def get_war_board_enemies(
quest_detail.userSvt[0].svtId,
quest_detail.userSvt[0].limitCount,
quest_detail.userSvt[0].dispLimitCount,
quest_detail.userSvt[0].enemyScript.get("imageSvtId")
if quest_detail.userSvt[0].enemyScript
else None,
(
quest_detail.userSvt[0].enemyScript.get("imageSvtId")
if quest_detail.userSvt[0].enemyScript
else None
),
)
for quest_detail in quest_details
]
Expand Down
14 changes: 8 additions & 6 deletions app/core/nice/enemy_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ def get_nice_enemy_master_battle(
maxCommandSpell=battle.maxCommandSpell,
offsetX=battle.offsetX,
offsetY=battle.offsetY,
cutin=[
fmt_url(AssetURL.enemyMasterFigure, **base_settings, item_id=cutin_id)
for cutin_id in cutin_ids
]
if cutin_ids
else None,
cutin=(
[
fmt_url(AssetURL.enemyMasterFigure, **base_settings, item_id=cutin_id)
for cutin_id in cutin_ids
]
if cutin_ids
else None
),
)


Expand Down
22 changes: 12 additions & 10 deletions app/core/nice/event/bulletin_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ def get_nice_bulletin_board(
for release in bulletin_releases
if release.bulletinBoardId == raw_bulletin.id
],
script=[
get_nice_bulletin_board_script(
region,
script,
raw_bulletin.eventId,
)
for script in raw_bulletin.script
]
if raw_bulletin.script
else [],
script=(
[
get_nice_bulletin_board_script(
region,
script,
raw_bulletin.eventId,
)
for script in raw_bulletin.script
]
if raw_bulletin.script
else []
),
)
104 changes: 57 additions & 47 deletions app/core/nice/event/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,33 @@ async def get_nice_event(
originalName=raw_event.mstEvent.name,
shortName=raw_event.mstEvent.shortName,
detail=raw_event.mstEvent.detail,
noticeBanner=fmt_url(
AssetURL.banner,
**base_settings,
banner=f"event_war_{raw_event.mstEvent.noticeBannerId}",
)
if raw_event.mstEvent.noticeBannerId != 0
else None,
banner=fmt_url(
AssetURL.banner,
**base_settings,
banner=f"event_war_{raw_event.mstEvent.bannerId}",
)
if raw_event.mstEvent.bannerId != 0
else None,
icon=fmt_url(
AssetURL.banner,
**base_settings,
banner=f"banner_icon_{raw_event.mstEvent.iconId}",
)
if raw_event.mstEvent.iconId != 0
else None,
noticeBanner=(
fmt_url(
AssetURL.banner,
**base_settings,
banner=f"event_war_{raw_event.mstEvent.noticeBannerId}",
)
if raw_event.mstEvent.noticeBannerId != 0
else None
),
banner=(
fmt_url(
AssetURL.banner,
**base_settings,
banner=f"event_war_{raw_event.mstEvent.bannerId}",
)
if raw_event.mstEvent.bannerId != 0
else None
),
icon=(
fmt_url(
AssetURL.banner,
**base_settings,
banner=f"banner_icon_{raw_event.mstEvent.iconId}",
)
if raw_event.mstEvent.iconId != 0
else None
),
bannerPriority=raw_event.mstEvent.bannerPriority,
noticeAt=raw_event.mstEvent.noticeAt,
startedAt=raw_event.mstEvent.startedAt,
Expand Down Expand Up @@ -332,32 +338,36 @@ async def get_nice_event(
)
for recipe in raw_event.mstEventRecipe
],
digging=get_nice_digging(
region,
raw_event.mstEventDigging,
raw_event.mstEventDiggingBlock,
raw_event.mstEventDiggingReward,
item_map=item_map,
gift_data=gift_data,
common_consumes=common_consumes,
raw_consumes=raw_event.mstCommonConsume,
)
if raw_event.mstEventDigging
else None,
cooltime=NiceEventCooltime(
rewards=[
get_nice_event_cooltime(
region,
cooltime,
gift_data,
common_releases[cooltime.commonReleaseId],
raw_releases=raw_event.mstCommonRelease,
)
for cooltime in raw_event.mstEventCooltimeReward
]
)
if raw_event.mstEventCooltimeReward
else None,
digging=(
get_nice_digging(
region,
raw_event.mstEventDigging,
raw_event.mstEventDiggingBlock,
raw_event.mstEventDiggingReward,
item_map=item_map,
gift_data=gift_data,
common_consumes=common_consumes,
raw_consumes=raw_event.mstCommonConsume,
)
if raw_event.mstEventDigging
else None
),
cooltime=(
NiceEventCooltime(
rewards=[
get_nice_event_cooltime(
region,
cooltime,
gift_data,
common_releases[cooltime.commonReleaseId],
raw_releases=raw_event.mstCommonRelease,
)
for cooltime in raw_event.mstEventCooltimeReward
]
)
if raw_event.mstEventCooltimeReward
else None
),
fortifications=[
get_nice_fortification(
region,
Expand Down
18 changes: 10 additions & 8 deletions app/core/nice/event/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ def get_nice_pointBuff(
detail=pointBuff.detail,
icon=icon,
background=ITEM_BG_TYPE_NAME.get(pointBuff.bgImageId, NiceItemBGType.unknown),
skillIcon=fmt_url(
AssetURL.eventUi,
base_url=settings.asset_url,
region=region,
event=f"Prefabs/{pointBuff.eventId}/bufficon_{pointBuff.skillIconId:0>2}",
)
if pointBuff.skillIconId
else None,
skillIcon=(
fmt_url(
AssetURL.eventUi,
base_url=settings.asset_url,
region=region,
event=f"Prefabs/{pointBuff.eventId}/bufficon_{pointBuff.skillIconId:0>2}",
)
if pointBuff.skillIconId
else None
),
lv=pointBuff.lv,
value=pointBuff.value,
)
48 changes: 29 additions & 19 deletions app/core/nice/event/reward_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,26 @@ def get_nice_event_reward_scene(
image=get_guide_image_url(
region, guideImageId, reward_scene.guideLimitCounts[i], limit_adds
),
faceId=reward_scene.guideFaceIds[i]
if len(reward_scene.guideFaceIds) > i
else None,
displayName=reward_scene.guideDisplayNames[i]
if len(reward_scene.guideDisplayNames) > i
else None,
weight=reward_scene.guideWeights[i]
if len(reward_scene.guideWeights) > i
else None,
unselectedMax=reward_scene.guideUnselectedMax[i]
if len(reward_scene.guideUnselectedMax) > i
else None,
faceId=(
reward_scene.guideFaceIds[i]
if len(reward_scene.guideFaceIds) > i
else None
),
displayName=(
reward_scene.guideDisplayNames[i]
if len(reward_scene.guideDisplayNames) > i
else None
),
weight=(
reward_scene.guideWeights[i]
if len(reward_scene.guideWeights) > i
else None
),
unselectedMax=(
reward_scene.guideUnselectedMax[i]
if len(reward_scene.guideUnselectedMax) > i
else None
),
)
for i, guideImageId in enumerate(reward_scene.guideImageIds)
]
Expand All @@ -95,13 +103,15 @@ def get_nice_event_reward_scene(
**base_settings,
fname=f"btn_txt_off_{event_id}_{reward_scene.tabImageId}",
),
image=fmt_url(
AssetURL.eventReward,
**base_settings,
fname=f"event_type_txt_{event_id}_{reward_scene.imageId}",
)
if reward_scene.imageId > 0
else None,
image=(
fmt_url(
AssetURL.eventReward,
**base_settings,
fname=f"event_type_txt_{event_id}_{reward_scene.imageId}",
)
if reward_scene.imageId > 0
else None
),
bg=fmt_url(
AssetURL.back,
**base_settings,
Expand Down
26 changes: 15 additions & 11 deletions app/core/nice/event/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ def get_nice_set_item(
purchaseType=PURCHASE_TYPE_NAME[set_item.purchaseType],
targetId=set_item.targetId,
setNum=set_item.setNum,
gifts=get_nice_gifts(region, set_item.targetId, gift_data)
if set_item.purchaseType == PurchaseType.GIFT
else [],
gifts=(
get_nice_gifts(region, set_item.targetId, gift_data)
if set_item.purchaseType == PurchaseType.GIFT
else []
),
)


Expand Down Expand Up @@ -160,14 +162,16 @@ def get_nice_shop(
limitNum=shop.limitNum,
defaultLv=shop.defaultLv,
defaultLimitCount=shop.defaultLimitCount,
image=fmt_url(
AssetURL.items,
base_url=settings.asset_url,
region=region,
item_id=shop.imageId,
)
if shop.imageId != 0
else None,
image=(
fmt_url(
AssetURL.items,
base_url=settings.asset_url,
region=region,
item_id=shop.imageId,
)
if shop.imageId != 0
else None
),
openedAt=shop.openedAt,
closedAt=shop.closedAt,
)
Expand Down
Loading

0 comments on commit 336a0d7

Please sign in to comment.