From 0e47fc92971481cb6e73a864dbf909c04375ce0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=89=E5=B9=BF?= Date: Sun, 23 Jul 2023 18:05:13 +0800 Subject: [PATCH] feat[user-property]v3 init --- src/plugins/jx3/user_property/Equip.py | 31 ++++ src/plugins/jx3/user_property/UserProperty.py | 137 ++++++++++++++++++ src/plugins/jx3/user_property/__init__.py | 8 + src/plugins/jx3/user_property/api.py | 5 + 4 files changed, 181 insertions(+) create mode 100644 src/plugins/jx3/user_property/Equip.py create mode 100644 src/plugins/jx3/user_property/UserProperty.py create mode 100644 src/plugins/jx3/user_property/__init__.py create mode 100644 src/plugins/jx3/user_property/api.py diff --git a/src/plugins/jx3/user_property/Equip.py b/src/plugins/jx3/user_property/Equip.py new file mode 100644 index 000000000..77a3f6fb8 --- /dev/null +++ b/src/plugins/jx3/user_property/Equip.py @@ -0,0 +1,31 @@ +class WCommonEnchant: + ''' + 大附魔属性 + ''' + + def __init__(self, id: str) -> None: + self.id = id + + +class Equip: + def __init__(self, data: dict) -> None: + self.name = data.get('Name') + self.icon = data.get('Icon') # 图标url + self.set = { # 套装列表 + 'total': data.get('SetList'), + 'current': data.get('SetListMap') + } + self.color_index = int(data.get('Color') or 0) + self.stone = data.get('FiveStone') # 五行石 [{Level,Name}] + self.level = data.get('Level') # 游戏等级 + self.quality = data.get('Quality') # 品质 + + t = data.get('WCommonEnchant') or {} # 大附魔 {Desc:'',Id:'11111'} + self.wCommonEnchant = WCommonEnchant(t.get('ID')) if t.get('ID') else None # 判断是否有大附魔 + self.wPermanentEnchant = data.get( + 'WPermanentEnchant') # 小附魔 {Attributes,Name} + + self.belongs = { # 所属心法 + 'kungfu':data.get('BelongKungfu'), # 心法(按,分割)列表 + 'school':data.get('BelongSchool'), # 门派/精简/通用 + } \ No newline at end of file diff --git a/src/plugins/jx3/user_property/UserProperty.py b/src/plugins/jx3/user_property/UserProperty.py new file mode 100644 index 000000000..f62400d52 --- /dev/null +++ b/src/plugins/jx3/user_property/UserProperty.py @@ -0,0 +1,137 @@ +from .Equip import * +from typing import overload + + +class UserPanel: + @overload + def __init__(self, data: dict) -> None: + ... + + @overload + def __init__(self, name: str, percent: bool, value: float) -> None: + ... + + def __init__(self, name: str, percent: bool, value: float) -> None: + if isinstance(name, dict): + percent = name.get('percent') or False + value = name.get('value') or 0 + name = name.get('name') + self.name: str = name # 属性名称 + self.percent: bool = percent # 是否是百分比 + self.value: float = value # 数值 + + +class Kungfu: + mapper = { + 'mowen': '莫问' + } + + def __init__(self, name: str) -> None: + self.name = name + + @property + def alias(self): + return Kungfu.mapper.get(self.name) or f'u:{self.name}' + + +class Qixue: + def __init__(self, data: dict) -> None: + self.name = data.get('name') + # {FileName:https://...,Kind:技能,SubKind:长歌} + self.icon = data.get('icon') + self.skill_id = data.get('skill_id') + + +class MatchDetail: + # "Level": 0, + # "atAgilityBase": 0, + # "atAgilityBasePercentAdd": 0, + # "atAllTypeCriticalDamagePowerBase": 0, + # "atAllTypeCriticalStrike": 0, + # "atAllTypeHitValue": 0, + # "atBasePotentialAdd": 0, + # "atCriticalDamagePowerBaseLevel": 175.45, + # "atCriticalStrikeLevel": 31.43, + # "atDecriticalDamagePowerBase": 0, + # "atDecriticalDamagePowerBaseLevel": 10, + # "atDodge": 0, + # "atHasteBase": 0, + # "atHasteBaseLevel": 2473, + # "atLifeAdditional": 0, + # "atLunarAttackPowerBase": 0, + # "atLunarCriticalDamagePowerBase": 0, + # "atLunarCriticalStrike": 0, + # "atLunarHitValue": 0, + # "atLunarOvercomeBase": 0, + # "atMagicAttackPowerBase": 0, + # "atMagicCriticalDamagePowerBase": 0, + # "atMagicCriticalStrike": 0, + # "atMagicHitValue": 0, + # "atMagicOvercome": 0, + # "atMagicShield": 0, + # "atMagicShieldLevel": 8.74, + # "atMaxLifeAdditional": 0, + # "atNeutralAttackPowerBase": 0, + # "atNeutralCriticalDamagePowerBase": 0, + # "atNeutralCriticalStrike": 0, + # "atNeutralHitValue": 0, + # "atNeutralOvercomeBase": 0, + # "atOvercomeBaseLevel": 20.95, + # "atParryBase": 0, + # "atParryValueBase": 0, + # "atPhysicsAttackPowerBase": 0, + # "atPhysicsCriticalDamagePowerBase": 0, + # "atPhysicsCriticalStrike": 0, + # "atPhysicsHitValue": 0, + # "atPhysicsOvercomeBase": 0, + # "atPhysicsShieldAdditional": 0, + # "atPhysicsShieldBase": 0, + # "atPhysicsShieldBaseLevel": 5.82, + # "atPoisonAttackPowerBase": 0, + # "atPoisonCriticalDamagePowerBase": 0, + # "atPoisonCriticalStrike": 0, + # "atPoisonHitValue": 0, + # "atPoisonOvercomeBase": 0, + # "atSolarAndLunarAttackPowerBase": 0, + # "atSolarAndLunarCriticalDamagePowerBase": 0, + # "atSolarAndLunarCriticalStrike": 0, + # "atSolarAndLunarHitValue": 0, + # "atSolarAndLunarOvercomeBase": 0, + # "atSolarAttackPowerBase": 0, + # "atSolarCriticalDamagePowerBase": 0, + # "atSolarCriticalStrike": 0, + # "atSolarHitValue": 0, + # "atSolarOvercomeBase": 0, + # "atSpiritBase": 6700, + # "atSpiritBasePercentAdd": 0, + # "atSpunkBase": 0, + # "atSpunkBasePercentAdd": 0, + # "atStrainBase": 0, + # "atStrainBaseLevel": 31.04, + # "atStrengthBase": 0, + # "atStrengthBasePercentAdd": 0, + # "atSurplusValueBase": 15132, + # "atTherapyPowerBase": 0, + # "atToughnessBase": 0, + # "atToughnessBaseLevel": 0, + # "atVitalityBase": 0, + # "atVitalityBasePercentAdd": 0, + # "baseAttack": 22383, + # "name": "mowen", + # "score": 200739, + # "totalAttack": 34781, + # "totalLift": 527310, + # "type": "spirit" + def __init__(self, data: dict) -> None: + for x in data: + setattr(self, x, data.get(x)) + + +class UserProperty: + def __init__(self, data: dict = None) -> None: + self.equips = [Equip(x) for x in data.get('Equips')] + self.kungfu = Kungfu(data.get('Kungfu').get('Name')) + self.matchDetail = MatchDetail(data.get('MatchDetail')) + self.qixue = [Qixue(x) for x in data.get('Person').get('qixueList')] + self.panel = [UserPanel(x) for x in data.get('PeronalPanel')] + self.score = data.get('TotalEquipsScore') diff --git a/src/plugins/jx3/user_property/__init__.py b/src/plugins/jx3/user_property/__init__.py new file mode 100644 index 000000000..dbccee55e --- /dev/null +++ b/src/plugins/jx3/user_property/__init__.py @@ -0,0 +1,8 @@ +from .api import * + +# jx3_cmd_property = on_command("jx3_property", aliases={"属性v2"}, priority=5) + + +#@jx3_cmd_property.handle() +#async def jx3_property(): +# pass diff --git a/src/plugins/jx3/user_property/api.py b/src/plugins/jx3/user_property/api.py new file mode 100644 index 000000000..67fcb8e4b --- /dev/null +++ b/src/plugins/jx3/user_property/api.py @@ -0,0 +1,5 @@ +from src.tools.dep import * + + +async def get_user_property_by_name(username: str) -> dict: + pass