mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-16 04:45:27 +00:00
✨ Support ZZZ stats cat notes
This commit is contained in:
parent
db6a9aab08
commit
3869616850
@ -1 +1 @@
|
||||
Subproject commit fb76a75ee1d10eb3c7c52abccde7f15a94726386
|
||||
Subproject commit 42ce49e834dfd4ca59f2f1e59145a0785052c85b
|
@ -60,13 +60,16 @@ class PlayerInfoSystem(Plugin):
|
||||
level=0,
|
||||
)
|
||||
|
||||
async def update_player_info(self, player: "Player", nickname: str, level: int):
|
||||
async def update_player_info(self, player: "Player", base_info: "PlayerAvatarInfo"):
|
||||
player_info = await self.player_info_service.get_form_sql(player)
|
||||
if player_info is not None and player_info.create_time is not None:
|
||||
player_info.nickname = nickname
|
||||
if player_info.extra_data is None:
|
||||
player_info.extra_data = ExtraPlayerInfo()
|
||||
player_info.extra_data.level = level
|
||||
player_info.nickname = base_info.nickname
|
||||
ex = player_info.extra_data
|
||||
player_info.extra_data = ExtraPlayerInfo()
|
||||
if ex is not None:
|
||||
ex.copy_to(player_info.extra_data)
|
||||
player_info.extra_data.level = base_info.level
|
||||
player_info.extra_data.avatar = base_info.avatar
|
||||
await self.player_info_service.update(player_info)
|
||||
|
||||
async def get_player_info_by_cookie(self, player: "Player", user_name: str) -> PlayerAvatarInfo:
|
||||
@ -75,10 +78,14 @@ class PlayerInfoSystem(Plugin):
|
||||
async with self.helper.genshin(player.user_id, player_id=player.player_id) as client:
|
||||
client: "ZZZClient"
|
||||
record_card = await client.get_record_card()
|
||||
index = await client.get_zzz_user()
|
||||
if record_card is not None:
|
||||
base_info.nickname = record_card.nickname
|
||||
base_info.level = record_card.level
|
||||
await self.update_player_info(player, base_info.nickname, base_info.level)
|
||||
if index is not None:
|
||||
base_info.avatar = index.cur_head_icon_url
|
||||
if base_info.level:
|
||||
await self.update_player_info(player, base_info)
|
||||
except Exception as e:
|
||||
logger.warning("卡片信息通过 cookie 请求失败 %s", str(e))
|
||||
return base_info
|
||||
@ -103,8 +110,9 @@ class PlayerInfoSystem(Plugin):
|
||||
):
|
||||
base_info = await self.get_player_info_by_cookie(player, player_info.nickname)
|
||||
else:
|
||||
base_info.nickname = player_info.nickname
|
||||
base_info.level = player_info.extra_data.level
|
||||
base_info.nickname = player_info.nickname or ""
|
||||
base_info.avatar = player_info.extra_data.avatar or base_info.avatar
|
||||
base_info.level = player_info.extra_data.level or 0
|
||||
|
||||
await self.set_form_cache(base_info)
|
||||
return base_info
|
||||
|
@ -55,11 +55,13 @@ class DailyNotePlugin(Plugin):
|
||||
"current_train_score": daily_info.current_train_score,
|
||||
"max_train_score": daily_info.max_train_score,
|
||||
"card_sign_status": daily_info.card_sign == ZZZNoteCardSignState.DONE,
|
||||
"bounty_commission": daily_info.bounty_commission,
|
||||
"survey_points": daily_info.survey_points,
|
||||
}
|
||||
render_result = await self.template_service.render(
|
||||
"zzz/daily_note/daily_note.jinja2",
|
||||
render_data,
|
||||
{"width": 600, "height": 390},
|
||||
{"width": 600, "height": 480},
|
||||
full_page=False,
|
||||
ttl=8 * 60,
|
||||
)
|
||||
|
@ -75,10 +75,12 @@ class PlayerStatsPlugins(Plugin):
|
||||
"stats_labels": [
|
||||
("活跃天数", "active_days"),
|
||||
("获取角色数", "avatar_num"),
|
||||
("绳网声望", "world_level_name"),
|
||||
("达成成就数", "achievement_count"),
|
||||
("式舆防卫战防线", "cur_period_zone_layer_count"),
|
||||
("获得邦布数", "buddy_num"),
|
||||
("绳网声望", "world_level_name"),
|
||||
],
|
||||
"cat_notes_list": user_info.cat_notes_list,
|
||||
"style": "main", # nosec
|
||||
}
|
||||
await self.add_theme_data(data, uid)
|
||||
|
@ -36,7 +36,7 @@
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="item">
|
||||
<img class="icon" src="items/Investigation-Point.png" alt="" />
|
||||
<img class="icon" src="./items/IconCoin.webp" alt="" />
|
||||
<div class="name">录像店经营</div>
|
||||
<div class="detail {% if exp_status == 'DONE' %}red{% endif %}">
|
||||
{% if exp_status == 'DONE' %} 已完成 {% else %} 正在营业 {% endif %}
|
||||
@ -57,6 +57,24 @@
|
||||
{% if card_sign_status %} 已完成 {% else %} 未完成 {% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% if bounty_commission %}
|
||||
<div class="item">
|
||||
<img class="icon" src="./items/ChallengeShopCoin.webp" alt="" />
|
||||
<div class="name">悬赏委托</div>
|
||||
<span class="detail {% if bounty_commission.num != bounty_commission.total %}red{% endif %}">
|
||||
{{ bounty_commission.num }}/{{ bounty_commission.total }}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if survey_points %}
|
||||
<div class="item">
|
||||
<img class="icon" src="./items/Investigation-Point.png" alt="" />
|
||||
<div class="name">调查点数</div>
|
||||
<span class="detail {% if survey_points.num != survey_points.total %}red{% endif %}">
|
||||
{{ survey_points.num }}/{{ survey_points.total }}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
BIN
resources/zzz/daily_note/items/ChallengeShopCoin.webp
Normal file
BIN
resources/zzz/daily_note/items/ChallengeShopCoin.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
resources/zzz/daily_note/items/IconCoin.webp
Normal file
BIN
resources/zzz/daily_note/items/IconCoin.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -77,9 +77,9 @@
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-x-6 gap-y-3 text-center">
|
||||
<!-- stats -->
|
||||
{% for label, key in stats_labels %} {% set value = stats[key] if
|
||||
stats[key] != "" else "-" %} {% set tag = "capsule" if label ==
|
||||
"活跃天数" or label == "获取角色数" %}
|
||||
{% for label, key in stats_labels %}
|
||||
{% set value = stats[key] if stats[key] != "" else "-" %}
|
||||
{% set tag = "capsule" if label == "活跃天数" or label == "获取角色数" %}
|
||||
<div
|
||||
class="{{ tag }} item flex justify-between px-5 items-center py-1 bg-dark rounded-full in-shadow"
|
||||
>
|
||||
@ -88,21 +88,44 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<!-- rogue -->
|
||||
{% if rogue %} {% for label, key in rogue_labels %}
|
||||
<div class="">
|
||||
<div class="text-xl box-stats">{{ rogue[key] }}</div>
|
||||
<div class="text-neutral-400 box-stats-label">{{ label }}</div>
|
||||
<!-- coins -->
|
||||
{% for v in stats.commemorative_coins_list %}
|
||||
{% set label = v.name %}
|
||||
{% set value = v.num %}
|
||||
<div
|
||||
class="item flex justify-between px-5 items-center py-1 bg-dark rounded-full in-shadow"
|
||||
>
|
||||
<div class="text-muted">{{ label }}</div>
|
||||
<div class="text-light">{{ value }}</div>
|
||||
</div>
|
||||
{% endfor %} {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- ledger -->
|
||||
{% if ledger %} {% for label, key in ledger_labels %}
|
||||
<div class="">
|
||||
<div class="text-xl box-stats">{{ ledger[key] }}</div>
|
||||
<div class="text-neutral-400 box-stats-label">{{ label }}</div>
|
||||
<div
|
||||
class="title inline-block w-auto mr-auto border-primary border-[4px] rounded-full"
|
||||
>
|
||||
<h2 class="flex items-center gap-x-4 capsule pl-5 text-xl text-light">
|
||||
喵吉的笔记
|
||||
<img
|
||||
class="box-content size-6 px-4 py-1 rounded-full bg-[#121212]"
|
||||
style="outline: 3.5px solid #424242"
|
||||
src="./items/arrows.png"
|
||||
alt="arrows"
|
||||
/>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-x-6 gap-y-3 text-center">
|
||||
<!-- cat note -->
|
||||
{% for v in cat_notes_list %}
|
||||
{% set label = v.name %}
|
||||
<div
|
||||
class="item flex justify-between px-5 items-center py-1 bg-dark rounded-full in-shadow"
|
||||
>
|
||||
<div class="text-muted">{{ label }}</div>
|
||||
<div class="text-light">{{ v.num }}/{{ v.total }}</div>
|
||||
</div>
|
||||
{% endfor %} {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="about text-center text-xs text-muted">
|
||||
|
Loading…
Reference in New Issue
Block a user