From 7c3d198c7fc37619e37466120f89b7a391f80af4 Mon Sep 17 00:00:00 2001 From: LittleMengBot <79637933+LittleMengBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 21:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Update=20`/weapon`=20result,=20add?= =?UTF-8?q?=20some=20weapon's=20alias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metadata/shortname.py | 3 +++ modules/wiki/weapon.py | 2 +- plugins/genshin/weapon.py | 6 +++++- resources/genshin/weapon/example.html | 18 ++++++++++++++++++ resources/genshin/weapon/weapon.html | 23 +++++++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/metadata/shortname.py b/metadata/shortname.py index cbe529f..18bd222 100644 --- a/metadata/shortname.py +++ b/metadata/shortname.py @@ -641,6 +641,9 @@ weapons = { "护摩之杖": ["护摩", "护摩枪", "护膜", "胡桃专武"], "千岩长枪": ["千岩枪"], "千岩古剑": ["千岩剑", "千岩大剑"], + "西风长枪": ["西风枪"], + "西风猎弓": ["西风弓"], + "西风秘典": ["西风书"], "暗巷闪光": ["暗巷剑", "暗巷小剑", "暗巷"], "暗巷猎手": ["暗巷弓"], "暗巷的酒与诗": ["暗巷法器", "暗巷书"], diff --git a/modules/wiki/weapon.py b/modules/wiki/weapon.py index b48e5b6..1623f6d 100644 --- a/modules/wiki/weapon.py +++ b/modules/wiki/weapon.py @@ -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: diff --git a/plugins/genshin/weapon.py b/plugins/genshin/weapon.py index 70c333d..edfa983 100644 --- a/plugins/genshin/weapon.py +++ b/plugins/genshin/weapon.py @@ -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 diff --git a/resources/genshin/weapon/example.html b/resources/genshin/weapon/example.html index 301e5e4..ec6880b 100644 --- a/resources/genshin/weapon/example.html +++ b/resources/genshin/weapon/example.html @@ -5,12 +5,26 @@