1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177 |
- from enum import Enum
- from typing import List
- from pydantic import BaseModel
- import Common
- class SiZhuWeiZhi(Enum):
- extra = -1
- unknown = 0
- niangan = 1
- yuegan = 2
- rigan = 3
- shigan = 4
- nianzhi = 5
- yuezhi = 6
- rizhi = 7
- shizhi = 8
- nianzhu = 11
- yuezhu = 12
- rizhu = 13
- shizhu = 14
- liu_niangan = 21
- liu_yuegan = 22
- liu_rigan = 23
- liu_shigan = 24
- liu_nianzhi = 25
- liu_yuezhi = 26
- liu_rizhi = 27
- liu_shizhi = 28
- class SiZhuInfoRequest(BaseModel):
- mode: int
- texts: List[str]
- datetime: str
- startDate: str
- location: str
- sheng: str
- shi: str
- qu: str
- weidu: float
- jingdu: float
- qiankun: str
- class CustomLogin(BaseModel):
- user: str
- psd: str
- class SaveUser(BaseModel):
- name: str
- beizhu: str
- isMan: bool
- leibie: int
- year: int
- month: int
- day: int
- hour: int
- minute: int
- sheng: str
- shi: str
- qu: str
- niangan: str
- nianzhi: str
- yuegan: str
- yuezhi: str
- rigan: str
- rizhi: str
- shigan: str
- shizhi: str
- customer: str
- def to_db_data(self):
- from datetime import datetime
- tm = datetime.now()
- return {
- "name": self.name,
- "beizhu": self.beizhu,
- "man": self.isMan,
- "leibie": self.leibie,
- "year": self.year,
- "month": self.month,
- "day": self.day,
- "hour": self.hour,
- "minute": self.minute,
- "sheng": self.sheng,
- "shi": self.shi,
- "qu": self.qu,
- "niangan": self.niangan,
- "nianzhi": self.nianzhi,
- "yuegan": self.yuegan,
- "yuezhi": self.yuezhi,
- "rigan": self.rigan,
- "rizhi": self.rizhi,
- "shigan": self.shigan,
- "shizhi": self.shizhi,
- "customer": self.customer,
- "joinTime": tm.strftime("%Y-%m-%d %H:%M:%S"),
- "enabled": 1,
- }
- class QueryUser(BaseModel):
- customer: str
- filter: str
- class DeleteUser(BaseModel):
- customer: str
- id: int
- class LiuZhu():
- text: str
- weizhi: int
- shishen: str
- isTianGan: bool
- gan1: str
- gan2: str
- gan3: str
- gan1ShiShen: str
- gan2ShiShen: str
- gan3ShiShen: str
- class ContentGaoNeng():
- arg1: str
- arg2: str
- arg3: str
- text: str
- zhu1: int
- zhu2: int
- zhu3: int
- key: str
- shishen1: str
- shishen2: str
- shishen3: str
- guanxi: str
- tip: str
- fangxiang: str
- fromCangGan: bool
- fromGongHe: bool
- fromXing: bool
- def __init__(self):
- self.fromCangGan = False
- self.fromGongHe = False
- self.fromXing = False
- class ContentInfo():
- year: int
- month: int
- day: int
- riyuan: str
- text: str
- tip: str
- arg1: str
- arg2: str
- arg3: str
- shishen1: str
- shishen2: str
- shishen3: str
- guanxi: str
- times: int
- jiedu1: str
- jiedu2: str
- jiedu3: str
- jiedu4: str
- jiedu5: str
- fangxiang: str
- fromCangGan: bool
- fromGongHe: bool
- fromXing: bool
- def __init__(self):
- self.jiedu1 = None
- self.jiedu2 = None
- self.jiedu3 = None
- self.jiedu4 = None
- self.jiedu5 = None
- def to_db_data(self):
- return {
- "year": self.year,
- "month": self.month,
- "day": self.day,
- "riyuan": self.riyuan,
- "desc": self.shishen1 + self.shishen2 + self.guanxi,
- "tip": self.tip,
- "jiedu1": self.jiedu1,
- "jiedu2": self.jiedu2,
- "jiedu3": self.jiedu3,
- "jiedu4": self.jiedu4,
- "jiedu5": self.jiedu5,
- }
- class GaoNeng():
- arg1: str
- arg2: str
- arg3: str
- guanxi: str
- text: str
- father: str
- leibie: str
- wuxing1: str
- wuxing2: str
- wuxing3: str
- shishen1: str
- shishen2: str
- shishen3: str
- power1: float
- power2: float
- power3: float
- extraPower1: float
- extraPower2: float
- extraPower3: float
- zhu1: int
- zhu2: int
- zhu3: int
- hehua: str
- fangxiang: str
- fangxiangTip: str
- key: str
- banheZengQiang: str
- banheZengQiangWuXing: str
- banheZengQiangShiShen: str
- banheZengQiangPower: int
- gongheZengQiang: str
- gongheZengQiangWuXing: str
- gongheZengQiangShiShen: str
- gongheZengQiangPower: int
- sanhuiZengQiang: str
- sanhuiZengQiangWuXing: str
- sanhuiZengQiangShiShen: str
- sanhuiZengQiangPower: int
- zixingZengQiang: str
- zixingZengQiangWuXing: str
- zixingZengQiangShiShen: str
- zixingZengQiangPower: int
- xingchu1: str
- xingchu2: str
- xingchu1WuXing: str
- xingchu2WuXing: str
- xingchu1ShiShen: str
- xingchu2ShiShen: str
- xingchu1Power: int
- xingchu2Power: int
- xingchong: str
- xingchongArg1: str
- xingchongArg2: str
- xingchongArg1ShiShen: str
- xingchongArg2ShiShen: str
- xingchongArg1Power: int
- xingchongArg2Power: int
- isFromCangGan: bool
- isFromGongHe: bool
- tip: str
- def __init__(self):
- self.isFromGongHe = False
- self.isFromCangGan = False
- self.extraPower1 = 0
- self.extraPower2 = 0
- self.extraPower3 = 0
- def copySelf(self):
- gn = GaoNeng()
- for key in dir(self):
- if not key.startswith("__"):
- value = getattr(self, key)
- if not callable(value):
- setattr(gn, key, value)
- return gn
- class MuKu():
- text: str
- lock: str
- isLock: bool
- chong: str
- gonghe: str
- zixing: str
- sanhui: str
- anhe: str
- hasChong: bool
- hasGongHe: bool
- hasZiXing: bool
- hasSanHui: bool
- hasAnHe: bool
- state: str
- isOpen: bool
- def __init__(self):
- self.isOpen = False
- class Score():
- key: str
- he: int
- anHe: int
- chong: int
- chuan: int
- po: int
- total: int
- def __init__(self, key: str):
- self.key = key
- self.he = 0
- self.anHe = 0
- self.chong = 0
- self.chuan = 0
- self.po = 0
- self.total = 0
- def calcTotal(self):
- if self.he == 0:
- self.he = 1
- if self.anHe == 0:
- self.anHe = 1
- if self.chong == 0:
- self.chong = 1
- if self.chuan == 0:
- self.chuan = 1
- if self.po == 0:
- self.po = 1
- self.total = self.he * self.anHe * self.chong * self.chuan * self.po
- class PingJia():
- mubiao: [Score]
- genji: [Score]
- zhuli: [Score]
- mubiaoScore: int
- genjiScore: int
- zhuliScore: int
- shouhuScore: int
- lushenScore: int
- totalScore: int
- def __init__(self):
- self.mubiao = []
- self.genji = []
- self.zhuli = []
- self.mubiaoScore = 0
- self.genjiScore = 0
- self.zhuliScore = 0
- self.shouhuScore = 0
- self.lushenScore = 0
- self.totalScore = 0
- def calc_scores(self):
- self.mubiaoScore = 0
- self.genjiScore = 0
- self.genjiScore = 0
- self.totalScore = 0
- for mb in self.mubiao:
- self.mubiaoScore += mb.total
- for gj in self.genji:
- self.genjiScore += gj.total
- for zl in self.zhuli:
- self.zhuliScore += zl.total
- self.totalScore = self.mubiaoScore + self.genjiScore + self.zhuliScore + self.shouhuScore + self.lushenScore
- class SiZhu():
- qiankun: str
- text: str
- wuXing: str
- shiShen: str
- yinYang: str
- isTianGan: bool
- isLuShen: bool
- isBanLu: bool
- weiZhi: int
- cangGan1: str
- cangGan2: str
- cangGan3: str
- gan1WuXing: str
- gan2WuXing: str
- gan3WuXing: str
- gan1ShiShen: str
- gan2ShiShen: str
- gan3ShiShen: str
- tongzhuZhangSheng: str
- riyuanZhangSheng: str
- gaonengs: [GaoNeng]
- power: int # 这个是总力量,用来冲、穿的时候使用
- selfPower: int # 这个是单独自身的力量,用来计算半合三会等力量支援
- muku: MuKu
- # 天干地支共用
- muPower: int
- huoPower: int
- tuPower: int
- jinPower: int
- shuiPower: int
- # 墓库专用
- biKuMuPower: int
- biKuHuoPower: int
- biKuTuPower: int
- biKuJinPower: int
- biKuShuiPower: int
- kaiKuMuPower: int
- kaiKuHuoPower: int
- kaiKuTuPower: int
- kaiKuJinPower: int
- kaiKuShuiPower: int
- extraGaoNengMap: {}
- pingjia: PingJia
- def __init__(self, qiankun: str, isTianGan: bool, text: str, weizhi: SiZhuWeiZhi):
- self.qiankun = qiankun
- self.isTianGan = isTianGan
- self.isLuShen = False
- self.text = text
- self.weiZhi = weizhi.value
- self.selfPower = 0
- self.tuPower = 0
- self.huoPower = 0
- self.tuPower = 0
- self.jinPower = 0
- self.shuiPower = 0
- self.biKuMuPower = 0
- self.biKuHuoPower = 0
- self.biKuTuPower = 0
- self.biKuJinPower = 0
- self.biKuShuiPower = 0
- self.kaiKuMuPower = 0
- self.kaiKuHuoPower = 0
- self.kaiKuTuPower = 0
- self.kaiKuJinPower = 0
- self.kaiKuShuiPower = 0
- self.gaonengs = []
- self.muku = None
- self.isBanLu = False
- if not isTianGan:
- if text == "辰":
- self.muku = MuKu()
- self.muku.text = text
- self.muku.wuxing = "水"
- elif text == "戌":
- self.muku = MuKu()
- self.muku.text = text
- self.muku.wuxing = "火"
- elif text == "丑":
- self.muku = MuKu()
- self.muku.text = text
- self.muku.wuxing = "金"
- elif text == "未":
- self.muku = MuKu()
- self.muku.text = text
- self.muku.wuxing = "木"
- def getCangGanShiShens(self):
- result = []
- if self.cangGan1 is not None:
- result.append(self.gan1ShiShen)
- if self.cangGan2 is not None:
- result.append(self.gan2ShiShen)
- if self.cangGan3 is not None:
- result.append(self.gan3ShiShen)
- return result
- def findGaoNeng(self, guanxi: str):
- result = None
- for gn in self.gaonengs:
- if gn.guanxi == guanxi:
- result = gn
- break
- return result
- def check_lushen(self, riyuan: str):
- self.isLuShen = Common.is_lushen(self.text, riyuan)
- self.isBanLu = Common.is_banlu(self.text, riyuan)
- def get_weizhi_as_zhu(self):
- if self.weiZhi == SiZhuWeiZhi.niangan.value or self.weiZhi == SiZhuWeiZhi.nianzhi.value:
- return SiZhuWeiZhi.nianzhu.value
- if self.weiZhi == SiZhuWeiZhi.yuegan.value or self.weiZhi == SiZhuWeiZhi.yuezhi.value:
- return SiZhuWeiZhi.yuezhu.value
- if self.weiZhi == SiZhuWeiZhi.rigan.value or self.weiZhi == SiZhuWeiZhi.rizhi.value:
- return SiZhuWeiZhi.rizhu.value
- if self.weiZhi == SiZhuWeiZhi.shigan.value or self.weiZhi == SiZhuWeiZhi.shizhi.value:
- return SiZhuWeiZhi.shizhu.value
- return SiZhuWeiZhi.unknown.value
- def update_canggan_powers(self, percentanges: [int]):
- if self.isTianGan is True:
- self.set_wuxing_power(self.wuXing, self.power)
- else:
- # 普通地支
- if self.muku is None:
- self.set_wuxing_power(self.gan1WuXing, self.power * percentanges[0])
- self.set_wuxing_power(self.gan2WuXing, self.power * percentanges[1])
- self.set_wuxing_power(self.gan3WuXing, self.power * percentanges[2])
- else:
- # 墓库地支
- self.set_wuxing_power_of_muku(self.gan1WuXing, self.power * percentanges[0])
- self.set_wuxing_power_of_muku(self.gan2WuXing, self.power * percentanges[1])
- self.set_wuxing_power_of_muku(self.gan3WuXing, self.power * percentanges[2])
- def set_wuxing_power(self, wuxing: str, value: int):
- if wuxing is None:
- return
- value = round(value, 0)
- if wuxing == "木":
- self.muPower = value
- elif wuxing == "火":
- self.huoPower = value
- elif wuxing == "土":
- self.tuPower = value
- elif wuxing == "金":
- self.jinPower = value
- elif wuxing == "水":
- self.shuiPower = value
- def set_wuxing_power_of_muku(self, wuxing: str, value: int):
- if self.muku is None:
- return
- value = round(value, 0)
- if self.muku.isOpen:
- if wuxing == "木":
- self.kaiKuMuPower = value
- elif wuxing == "火":
- self.kaiKuHuoPower = value
- elif wuxing == "土":
- self.kaiKuTuPower = value
- elif wuxing == "金":
- self.kaiKuJinPower = value
- elif wuxing == "水":
- self.kaiKuShuiPower = value
- else:
- if wuxing == "木":
- self.biKuMuPower = value
- elif wuxing == "火":
- self.biKuHuoPower = value
- elif wuxing == "土":
- self.biKuTuPower = value
- elif wuxing == "金":
- self.biKuJinPower = value
- elif wuxing == "水":
- self.biKuShuiPower = value
- def get_canggan_power_by_wuxing(self, wuxing: str):
- result = 0
- state = 0 # 天干地支 = 0, 1:闭库 2:开库
- if self.isTianGan is False:
- if self.muku is not None:
- if self.muku.isOpen is False:
- state = 1
- else:
- state = 2
- if state == 0:
- if wuxing == "木":
- result = self.muPower
- elif wuxing == "火":
- result = self.huoPower
- elif wuxing == "土":
- result = self.tuPower
- elif wuxing == "金":
- result = self.jinPower
- elif wuxing == "水":
- result = self.shuiPower
- elif state == 1:
- if wuxing == "木":
- result = self.biKuMuPower
- elif wuxing == "火":
- result = self.biKuHuoPower
- elif wuxing == "土":
- result = self.biKuTuPower
- elif wuxing == "金":
- result = self.biKuJinPower
- elif wuxing == "水":
- result = self.biKuShuiPower
- elif state == 2:
- if wuxing == "木":
- result = self.kaiKuMuPower
- elif wuxing == "火":
- result = self.kaiKuHuoPower
- elif wuxing == "土":
- result = self.kaiKuTuPower
- elif wuxing == "金":
- result = self.kaiKuJinPower
- elif wuxing == "水":
- result = self.kaiKuShuiPower
- return result
- class ShenShaInfo():
- fenbu: {} # key 是柱的位置
- def __init__(self):
- self.fenbu = {}
- self.fenbu[SiZhuWeiZhi.nianzhu.value] = []
- self.fenbu[SiZhuWeiZhi.yuezhu.value] = []
- self.fenbu[SiZhuWeiZhi.rizhu.value] = []
- self.fenbu[SiZhuWeiZhi.shizhu.value] = []
- class ShenSha():
- name: str
- tip: str
- effect: str
- def __init__(self, name: str, tip: str):
- self.name = name
- self.tip = tip
- class GuanXiInfo():
- shishen: {}
- dizhi: {}
- tiangan: {}
- def __init__(self):
- self.shishen = {}
- self.dizhi = {}
- self.tiangan = {}
- class WangShuaiPower():
- text: str
- wuxing: str
- amount: int
- value: int
- percentage: float
- shishen1: str
- shishenAmount1: int
- shishenValue1: int
- shishenPercentage1: float
- shishenPercentage1InTotal: float
- shishen2: str
- shishenAmount2: int
- shishenValue2: int
- shishenPercentage2: float
- shishenPercentage2InTotal: float
- zengqiang: int
- shishen1ZengQiang: int
- shishen2ZengQiang: int
- shishen1ValueAfterZengQiang: int
- shishen2ValueAfterZengQiang: int
- valueAfterZengQiang: int
- def __init__(self, wuxing: str, tag: str):
- self.wuxing = wuxing
- self.text = self.wuxing + tag
- self.zengqiang = 0
- self.shishen1ZengQiang = 0
- self.shishen2ZengQiang = 0
- def calcPercentage(self, count: float):
- self.percentage = round(self.valueAfterZengQiang / count * 100, 0)
- self.shishenPercentage1InTotal = round(self.shishenPercentage1 * self.percentage / 100, 0)
- self.shishenPercentage2InTotal = round(self.shishenPercentage2 * self.percentage / 100, 0)
- class PowerInfo():
- wangShuaiPowers: [WangShuaiPower]
- tongdang: int
- yidang: int
- def __init__(self):
- self.wangShuaiPowers = []
- class XingGeDesc():
- key: str
- state: str
- low: str
- middle: str
- strong: str
- value: int
- zuozhi: bool
- def __init__(self):
- self.zuozhi = False
- class GeJu():
- key: str
- tip: str
- isChong: bool
- isChuan: bool
- isPo: bool
- isBaoHu: bool
- def __init__(self):
- self.isChong = False
- self.isChuan = False
- self.isPo = False
- self.isBaoHu = False
- class ZhenJia():
- key: str
- zhenValue: int
- jiaValue: int
- zhenTip: str
- jiaTip: str
- class ShiShenXiongJi():
- key: str
- isGood: bool
- eft: str
- solve: str
- tip: str
- class MangPaiGong():
- he: int = 0
- po: int = 0
- total: float = 0
- zihe: float
- tip: str
- def __init__(self):
- self.tip = "1层功,1000万-1亿,科级;2层功,1e-10e,处级;3层功,10e-100e,厅级;4层功,100e-1000e,部级;更高功,国级"
- def calcTotal(self):
- self.total = self.he - self.po * 0.5 + self.zihe
- class GeJuInfo():
- nianlu: GeJu = None
- jianlu: GeJu = None
- zhuanlu: GeJu = None
- guiLu: GeJu = None
- banlu: GeJu = None
- zhenjia: [ZhenJia]
- xushi: bool = False
- shishen: [ShiShenXiongJi]
- gong: MangPaiGong
- zuozhi: str
- def hasKeyInZhenJiaList(self, key: str):
- result = False
- if self.zhenjia is not None:
- for zj in self.zhenjia:
- if zj.key == key:
- result = True
- break
- return result
- class JieGou():
- arg1: str
- arg2: str
- guanxi: str
- level: int
- shishen1: str
- shishen2: str
- isTianGan: bool
- baohu: bool
- def __init__(self, arg1: str, arg2: str, guanxi: str, level: int, shishen1: str, shishen2: str, isTianGan: bool):
- self.arg1 = arg1
- self.arg2 = arg2
- self.guanxi = guanxi
- self.level = level
- self.shishen1 = shishen1
- self.shishen2 = shishen2
- self.isTianGan = isTianGan
- self.baohu = False
- class JieGouInfo():
- guanHe: [JieGou]
- guanAnHe: [JieGou]
- guanChong: [JieGou]
- guanChuan: [JieGou]
- guanPo: [JieGou]
- shaHe: [JieGou]
- shaAnHe: [JieGou]
- shaChong: [JieGou]
- shaChuan: [JieGou]
- shaPo: [JieGou]
- cai1He: [JieGou]
- cai1AnHe: [JieGou]
- cai1Chong: [JieGou]
- cai1Chuan: [JieGou]
- cai1Po: [JieGou]
- cai2He: [JieGou]
- cai2AnHe: [JieGou]
- cai2Chong: [JieGou]
- cai2Chuan: [JieGou]
- cai2Po: [JieGou]
- yinHe: [JieGou]
- yinAnHe: [JieGou]
- yinChong: [JieGou]
- yinChuan: [JieGou]
- yinPo: [JieGou]
- xiaoHe: [JieGou]
- xiaoAnHe: [JieGou]
- xiaoChong: [JieGou]
- xiaoChuan: [JieGou]
- xiaoPo: [JieGou]
- shiHe: [JieGou]
- shiAnHe: [JieGou]
- shiChong: [JieGou]
- shiChuan: [JieGou]
- shiPo: [JieGou]
- shangHe: [JieGou]
- shangAnHe: [JieGou]
- shangChong: [JieGou]
- shangChuan: [JieGou]
- shangPo: [JieGou]
- biHe: [JieGou]
- biAnHe: [JieGou]
- biChong: [JieGou]
- biChuan: [JieGou]
- biPo: [JieGou]
- jieHe: [JieGou]
- jieAnHe: [JieGou]
- jieChong: [JieGou]
- jieChuan: [JieGou]
- jiePo: [JieGou]
- baohu: {}
- def __init__(self):
- self.guanHe = []
- self.guanAnHe = []
- self.guanChong = []
- self.guanChuan = []
- self.guanPo = []
- self.shaHe = []
- self.shaAnHe = []
- self.shaChong = []
- self.shaChuan = []
- self.shaPo = []
- self.cai1He = []
- self.cai1AnHe = []
- self.cai1Chong = []
- self.cai1Chuan = []
- self.cai1Po = []
- self.cai2He = []
- self.cai2AnHe = []
- self.cai2Chong = []
- self.cai2Chuan = []
- self.cai2Po = []
- self.yinHe = []
- self.yinAnHe = []
- self.yinChong = []
- self.yinChuan = []
- self.yinPo = []
- self.xiaoHe = []
- self.xiaoAnHe = []
- self.xiaoChong = []
- self.xiaoChuan = []
- self.xiaoPo = []
- self.shiHe = []
- self.shiAnHe = []
- self.shiChong = []
- self.shiChuan = []
- self.shiPo = []
- self.shangHe = []
- self.shangAnHe = []
- self.shangChong = []
- self.shangChuan = []
- self.shangPo = []
- self.biHe = []
- self.biAnHe = []
- self.biChong = []
- self.biChuan = []
- self.biPo = []
- self.jieHe = []
- self.jieAnHe = []
- self.jieChong = []
- self.jieChuan = []
- self.jiePo = []
- self.baohu = {}
- for key in ["官", "杀", "财", "才", "印", "枭", "食", "伤", "比", "劫"]:
- self.baohu[key] = False
- class GaoNengInfo():
- heList: [GaoNeng]
- chongList: [GaoNeng]
- poList: [GaoNeng]
- chuanList: [GaoNeng]
- banHeList: [GaoNeng]
- gongHeList: [GaoNeng]
- anHeList: [GaoNeng]
- sanHuiList: [GaoNeng]
- ziXingList: [GaoNeng]
- xingList: [GaoNeng]
- def __init__(self):
- self.heList = []
- self.chongList = []
- self.poList = []
- self.chuanList = []
- self.banHeList = []
- self.gongHeList = []
- self.anHeList = []
- self.sanHuiList = []
- self.ziXingList = []
- self.xingList = []
- class LuckyDayInfo():
- year: int
- month: int
- day: int
- niangan: SiZhu
- yuegan: SiZhu
- rigan: SiZhu
- nianzhi: SiZhu
- yuezhi: SiZhu
- rizhi: SiZhu
- def all_gans(self):
- return [self.niangan, self.yuegan, self.rigan]
- def all_zhis(self):
- return [self.nianzhi, self.yuezhi, self.rizhi]
- def all_zhus(self):
- return [self.niangan, self.nianzhi, self.yuegan, self.yuezhi, self.rigan, self.rizhi]
- class BaZi():
- qiankun: str
- taiyangshi: str
- nianGan: SiZhu
- nianZhi: SiZhu
- yueGan: SiZhu
- yueZhi: SiZhu
- riGan: SiZhu
- riZhi: SiZhu
- shiGan: SiZhu
- shiZhi: SiZhu
- powerInfo: PowerInfo
- shenshaInfo: ShenShaInfo
- guanxiInfo: GuanXiInfo
- xinggeInfo: {}
- gejuInfo: GeJuInfo
- fangans: [SiZhu]
- gaonengInfo: GaoNengInfo
- jiankang: {}
- jiegouInfo: JieGouInfo
- luckyDays: [LuckyDayInfo]
- def __has_shensha(self, wz: SiZhuWeiZhi, name: str):
- result = False
- lst = self.shenshaInfo.fenbu[wz.value]
- for dt in lst:
- if dt.name == name:
- result = True
- break
- return result
- # 这里传入的wz要转换成柱位置
- def add_shensha(self, wz: SiZhuWeiZhi, name: str, tip: str, eft: str = None):
- if not self.__has_shensha(wz, name):
- info = ShenSha()
- info.name = name
- info.tip = tip
- info.effect = eft
- self.shenshaInfo.fenbu[wz.value].append(info)
- def sizhu_tiangans(self):
- return [self.nianGan, self.yueGan, self.riGan, self.shiGan]
- def sizhu_dizhis(self):
- return [self.nianZhi, self.yueZhi, self.riZhi, self.shiZhi]
- def sizhu_all(self):
- return [self.nianGan, self.nianZhi, self.yueGan, self.yueZhi, self.riGan, self.riZhi, self.shiGan, self.shiZhi]
- def getTianGanDiZhiByZhu(self, wz: int):
- if wz == SiZhuWeiZhi.nianzhu:
- return [self.nianGan, self.nianZhi]
- if wz == SiZhuWeiZhi.yuezhu:
- return [self.yueGan, self.yueZhi]
- if wz == SiZhuWeiZhi.rizhu:
- return [self.riGan, self.riZhi]
- if wz == SiZhuWeiZhi.shizhu:
- return [self.shiGan, self.shiZhi]
- return None
- def findTianGanDiZhiInZhu(self, tiangan: str, dizhi: str):
- result = []
- if self.nianGan.text == tiangan and self.nianZhi.text == dizhi:
- result.append(SiZhuWeiZhi.nianzhu.value)
- elif self.yueGan.text == tiangan and self.yueZhi.text == dizhi:
- result.append(SiZhuWeiZhi.yuezhu.value)
- elif self.riGan.text == tiangan and self.riZhi.text == dizhi:
- result.append(SiZhuWeiZhi.rizhu.value)
- elif self.shiGan.text == tiangan and self.shiZhi.text == dizhi:
- result.append(SiZhuWeiZhi.shizhu.value)
- return result
- def findGaoNengByShiShen(self, shishen1: str, shishen2: str, guanxi: str):
- lst = []
- temp = self.__get_gaoneng_list_by_guanxi(guanxi)
- for dt in temp:
- if dt.shishen1 == shishen1 and dt.shishen2 == shishen2:
- lst.append(dt)
- elif dt.shishen1 == shishen2 and dt.shishen2 == shishen1:
- lst.append(dt)
- return lst
- def findGaoNengByArgs(self, arg1: str, arg2: str, guanxi: str):
- lst = []
- temp = self.__get_gaoneng_list_by_guanxi(guanxi)
- for dt in temp:
- if dt.arg1 == arg1 and dt.arg2 == arg2:
- lst.append(dt)
- elif dt.arg1 == arg2 and dt.arg2 == arg1:
- lst.append(dt)
- return lst
- def findGaoNengByGuanXis(self, shishen1: str, shishen2: str, guanxis: [str]):
- lst = []
- for guanxi in guanxis:
- temp = self.__get_gaoneng_list_by_guanxi(guanxi)
- for dt in temp:
- if dt.shishen1 == shishen1 and dt.shishen2 == shishen2:
- lst.append(dt)
- elif dt.shishen1 == shishen2 and dt.shishen2 == shishen1:
- lst.append(dt)
- return lst
- def hasGaoNeng(self, gaoneng: str, wz: SiZhuWeiZhi):
- result = False
- zhu = self.getZhuByWeiZhi(wz.value)
- if zhu is not None:
- for gn in zhu.gaonengs:
- if gn.text == gaoneng:
- result = True
- break
- return result
- # 用来检查某位置是否包含合、冲、穿、刑等关键字的高能关系
- def hasGaoNengKey(self, key: str, wz: SiZhuWeiZhi):
- result = False
- zhu = self.getZhuByWeiZhi(wz.value)
- if zhu is not None:
- for gn in zhu.gaonengs:
- if gn.guanxi == key:
- result = True
- break
- return result
- # 这里的位置是以柱为单位的
- def hasShenSha(self, name: str, wz: SiZhuWeiZhi):
- result = False
- lst = self.shenshaInfo.fenbu[wz]
- if lst is not None:
- for info in lst:
- if info.name == name:
- result = True
- break
- return result
- def hasShiShen(self, key: str):
- # dc.has_all_shishen 替代
- result = False
- for sz in self.sizhu_all():
- if sz.shiShen == key:
- result = True
- break
- return result
- # 通过五行查找对应的2个十神
- def getShiShensByWuXing(self, wuxing: str):
- result = []
- if self.guanxiInfo.shishen.keys().__contains__(wuxing):
- result = self.guanxiInfo.shishen.get(wuxing)
- return result
- def getPowerOfShiShen(self, shishen: str):
- # dc.get_shishen_power 替代
- result = 0
- for wsp in self.powerInfo.wangShuaiPowers:
- if wsp.shishen1 == shishen:
- result = wsp.shishenValue1
- break
- elif wsp.shishen2 == shishen:
- result = wsp.shishenValue2
- break
- return round(result)
- def getPowerOfWuXing(self, wuxing: str):
- result = 0
- for wsp in self.powerInfo.wangShuaiPowers:
- if wsp.wuxing == wuxing:
- result = wsp.value
- break
- return round(result)
- # 从xingge info 中查找五行的状态,返回:过旺、旺、衰
- def getWuXingState(self, wuxing: str):
- result = None
- for xg in self.xinggeInfo["wuxing"]:
- if xg.key == wuxing:
- result = xg.state
- break
- return result
- def __get_gaoneng_list_by_guanxi(self, guanxi: str):
- lst = []
- if guanxi == "合":
- lst = self.gaonengInfo.heList
- elif guanxi == "暗合":
- lst = self.gaonengInfo.anHeList
- elif guanxi == "半合":
- lst = self.gaonengInfo.banHeList
- elif guanxi == "拱合":
- lst = self.gaonengInfo.gongHeList
- elif guanxi == "三会":
- lst = self.gaonengInfo.sanHuiList
- elif guanxi == "刑":
- lst = self.gaonengInfo.xingList
- elif guanxi == "自刑":
- lst = self.gaonengInfo.ziXingList
- elif guanxi == "冲":
- lst = self.gaonengInfo.chongList
- elif guanxi == "破":
- lst = self.gaonengInfo.poList
- elif guanxi == "穿":
- lst = self.gaonengInfo.chuanList
- return lst
- def countGaoNeng(self, guanxi: str):
- lst = self.__get_gaoneng_list_by_guanxi(guanxi)
- return len(lst)
- def getZhuByWeiZhi(self, weizhi: int):
- if weizhi == SiZhuWeiZhi.niangan.value:
- return self.nianGan
- if weizhi == SiZhuWeiZhi.nianzhi.value:
- return self.nianZhi
- if weizhi == SiZhuWeiZhi.yuegan.value:
- return self.yueGan
- if weizhi == SiZhuWeiZhi.yuezhi.value:
- return self.yueZhi
- if weizhi == SiZhuWeiZhi.rigan.value:
- return self.riGan
- if weizhi == SiZhuWeiZhi.rizhi.value:
- return self.riZhi
- if weizhi == SiZhuWeiZhi.shigan.value:
- return self.shiGan
- if weizhi == SiZhuWeiZhi.shizhi.value:
- return self.shiZhi
- return None
- def __init__(self, request: SiZhuInfoRequest):
- self.qiankun = request.qiankun
- self.nianGan = SiZhu(request.qiankun, True, request.texts[0], SiZhuWeiZhi.niangan)
- self.yueGan = SiZhu(request.qiankun, True, request.texts[1], SiZhuWeiZhi.yuegan)
- self.riGan = SiZhu(request.qiankun, True, request.texts[2], SiZhuWeiZhi.rigan)
- self.shiGan = SiZhu(request.qiankun, True, request.texts[3], SiZhuWeiZhi.shigan)
- self.nianZhi = SiZhu(request.qiankun, False, request.texts[4], SiZhuWeiZhi.nianzhi)
- self.yueZhi = SiZhu(request.qiankun, False, request.texts[5], SiZhuWeiZhi.yuezhi)
- self.riZhi = SiZhu(request.qiankun, False, request.texts[6], SiZhuWeiZhi.rizhi)
- self.shiZhi = SiZhu(request.qiankun, False, request.texts[7], SiZhuWeiZhi.shizhi)
- self.nianZhi.check_lushen(self.riGan.text)
- self.yueZhi.check_lushen(self.riGan.text)
- self.riZhi.check_lushen(self.riGan.text)
- self.shiZhi.check_lushen(self.riGan.text)
- self.powerInfo = PowerInfo()
- self.guanxiInfo = GuanXiInfo()
- self.shenshaInfo = ShenShaInfo()
- self.xinggeInfo = {}
- self.gejuInfo = GeJuInfo()
- self.fangans = []
- self.gaonengInfo = GaoNengInfo()
- self.jiankang = {}
- self.jiegouInfo = JieGouInfo()
|