Update /weapon result, add some weapon's alias

This commit is contained in:
LittleMengBot 2023-04-07 21:07:59 +08:00 committed by GitHub
parent ca8ee8b82e
commit 7c3d198c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 2 deletions

View File

@ -641,6 +641,9 @@ weapons = {
"护摩之杖": ["护摩", "护摩枪", "护膜", "胡桃专武"],
"千岩长枪": ["千岩枪"],
"千岩古剑": ["千岩剑", "千岩大剑"],
"西风长枪": ["西风枪"],
"西风猎弓": ["西风弓"],
"西风秘典": ["西风书"],
"暗巷闪光": ["暗巷剑", "暗巷小剑", "暗巷"],
"暗巷猎手": ["暗巷弓"],
"暗巷的酒与诗": ["暗巷法器", "暗巷书"],

View File

@ -99,7 +99,7 @@ class Weapon(WikiModel):
affix = WeaponAffix(
name=get_table_text(7), description=[i.find_all("td")[1].text for i in tables[3].find_all("tr")[1:]]
)
description = get_table_text(-1) if len(tables) < 11 else get_table_text(9)
description = get_table_text(9)
if story_table := find_table("quotes"):
story = story_table[0].text.strip()
else:

View File

@ -71,6 +71,7 @@ class WeaponPlugin(Plugin):
bonus = str(round(float(bonus)))
_template_data = {
"weapon_name": _weapon_data.name,
"weapon_rarity": _weapon_data.rarity,
"weapon_info_type_img": await self.download_resource(_weapon_data.weapon_type.icon_url()),
"progression_secondary_stat_value": bonus,
"progression_secondary_stat_name": _weapon_data.attribute.type.value,
@ -85,10 +86,12 @@ class WeaponPlugin(Plugin):
],
"special_ability_name": _weapon_data.affix.name,
"special_ability_info": _weapon_data.affix.description[0],
"weapon_description": _weapon_data.description,
}
else:
_template_data = {
"weapon_name": _weapon_data.name,
"weapon_rarity": _weapon_data.rarity,
"weapon_info_type_img": await self.download_resource(_weapon_data.weapon_type.icon_url()),
"progression_secondary_stat_value": " ",
"progression_secondary_stat_name": "无其它属性加成",
@ -102,7 +105,8 @@ class WeaponPlugin(Plugin):
for mid in _weapon_data.ascension[-3:]
],
"special_ability_name": "",
"special_ability_info": _weapon_data.description,
"special_ability_info": "",
"weapon_description": _weapon_data.description,
}
return _template_data

View File

@ -5,12 +5,26 @@
<title>weapon</title>
<script src="https://cdn.tailwindcss.com/"></script>
<link type="text/css" href="./weapon.css" rel="stylesheet">
<style>
.material-star {
position: relative;
top: -5px;
width: 100%;
display: flex;
align-items: center;
}
</style>
</head>
<body>
<div class="container mx-auto px-6 py-6 max-w-lg" id="container">
<div class="base-weapon-info rounded-xl flex mb-4">
<div class="base-weapon-info-name flex-grow m-5 ml-2 text-4xl text-white">
<h1>测试</h1>
<div class="material-star mt-4" style="height: 40px;width: 20px;">
<img alt="star" src="../../background/rarity/star.webp"/>
<img alt="star" src="../../background/rarity/star.webp"/>
<img alt="star" src="../../background/rarity/star.webp"/>
</div>
</div>
<div class="base-weapon-info-type m-2 mr-8 flex-shrink h-16 w-16">
<img src="./../../img/example/256x256.png">
@ -61,6 +75,10 @@
<samp>这是个测试描述这是个测试描述这是个测试描述这是个测试描述这是个测试描述这是个测试描述
这是个测试描述这是个测试描述这是个测试描述这是个测试描述这是个测试描述这是个测试描述</samp>
</div>
<div class="text-base opacity-70 mt-5">
<samp>这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍
这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍这是个武器介绍</samp>
</div>
</div>
</div>
</div>

View File

@ -6,12 +6,26 @@
<link type="text/css" href="../../styles/tailwind.min.css" rel="stylesheet">
<link type="text/css" href="./weapon.css" rel="stylesheet">
<link type="text/css" href="../../styles/public.css" rel="stylesheet">
<style>
.material-star {
position: relative;
top: -5px;
width: 100%;
display: flex;
align-items: center;
}
</style>
</head>
<body>
<div class="page-container container mx-auto my-6 rounded-xl px-6 py-6 max-w-lg flex flex-col divide-y-2 divide-inherit" id="container">
<div class="base-weapon-info flex py-2">
<div class="base-weapon-info-name flex-grow m-5 ml-2 font-thin text-4xl">
<h1>{{weapon_name}}</h1>
<div class="material-star mt-4" style="height: 40px;width: 20px;">
{% for _ in range(weapon_rarity) %}
<img alt="star" src="../../background/rarity/star.webp"/>
{% endfor %}
</div>
</div>
<div class="base-weapon-info-type-img m-2 mr-8 flex-shrink h-16 w-16">
<img src="{{weapon_info_type_img}}">
@ -57,6 +71,15 @@
<div class="special-ability-info text-base">
<samp>{{special_ability_info}}</samp>
</div>
{% if weapon_rarity > 2 %}
<div class="text-base opacity-70 mt-5">
<samp>{{weapon_description}}</samp>
</div>
{% else %}
<div class="text-base">
<samp>{{weapon_description}}</samp>
</div>
{% endif %}
</div>
</div>
</div>