import re
import os
import json
import time
import tkinter as tk
#将要比对的账号列表
account_detail=[]
#读取配置文件
with open(os.path.join(os.getcwd(),"rules","stzbrule.txt")) as config1:
config_1=config1.read()
info_1=json.loads(config_1)
config1.close()
#读取基本属性
army_facade=info_1["army_facade"]#行军外观
combo=info_1["combo"]#武将官方组合
dian_cang=info_1["dian_cang"]#典藏
dian_ji=info_1["dian_ji"]#典籍
display_skill=info_1["display_skill"]#普通技能
gear=info_1["gear"]#武器
gear_feature=info_1["gear_feature"]#武器属性
hero=info_1["hero"]#武将
hero_combo_combination=info_1["hero_combo_combination"]#武将组合,鸡肋
search_gear=info_1["search_gear"]#顶级武器
search_gear_feature=info_1["search_gear_feature"]#顶级武器技能
skill=info_1["skill"]#特殊技能,S级以上战法
special_hero=info_1["special_hero"]#绝版武将
#处理绝版武将
juebanwujiang_quanju={}
for _special in special_hero:
juebanwujiang_quanju.update({"%s"%_special["hero_id"]:"%s"%_special["name"]})
#处理技能,68-45=23geS级,152-109=43geA级,201-145=56个B级战法。
jineng_item={}
jineng_S=[]
jineng_A=[]
jineng_B=[]
for _display_skill in display_skill:
jineng_item.update({_display_skill["name"]:_display_skill["skill_quality_level"]})
for _skill in skill:
jineng_item.update({_skill["name"]:_skill["skill_quality_level"]})
for key,value in jineng_item.items():
if value=="S" :
jineng_S.append(key)
if value=="A":
jineng_A.append(key)
if value=="B":
jineng_B.append(key)
#处理宝物
wuqi=[]
wuqi_jineng=[]
for _search_gear in search_gear:
wuqi.append(_search_gear["name"])
for _search_gear_feature in search_gear_feature:
wuqi_jineng.append(_search_gear_feature["label"])
#处理武将
hero_quanju={'99999': '技能分析:','88888':''}
for _hero in hero:
if _hero["star"]==5:
if _hero["country"]=="1":
_hero["name"]="汉"+_hero["name"]
if _hero["country"]=="2":
_hero["name"]="魏"+_hero["name"]
if _hero["country"]=="3":
_hero["name"]="蜀"+_hero["name"]
if _hero["country"]=="4":
_hero["name"]="吴"+_hero["name"]
if _hero["country"]=="5":
_hero["name"]="群"+_hero["name"]
hero_quanju.update({"%s"%_hero["hero_id"]:_hero["name"]})
#典藏数据库
diancang=[
"桃园结义",
"枭雄",
"凤仪亭",
"汜水关",
"人中吕布",
"鼎足江东",
"单骑救主",
"当阳桥",
"威震逍遥",
]
#典籍数据库
dianji=[
"孙子兵法·作战",
"孙子兵法·军形",
"孙子兵法·兵势",
"孙子兵法·虚实",
"孙子兵法·行军",
"孙子兵法·九地",
"孙子兵法·火攻",
"孙子兵法·用间",
"六韬·文韬",
"六韬·龙韬",
"六韬·犬韬",
"六韬·豹韬",
"六韬·虎韬",
"吴子·论将",
"传记·司马八达",
]
#读取私人配将
with open(os.path.join(os.getcwd(),"rules","duiwu.txt")) as config2:
config_2=config2.read()
duiwu=json.loads(config_2)
config2.close()
class Account:
def __init__(self):
self.eid=""#购买网址
self.status_desc=""#当前状态
self.desc_sumup_short=""#账号综述
self.highlight=""#账号靓点总结
self.dian_ji_count=0#典籍数
self.card_dian_ji={}#典籍具体是什么
self.available_dian_cang_count=0#典藏数
self.card_dian_cang={}#典藏具体是什么
self.area_name=""#账号服务器:备战区
self.server_name=""#账号不属于备战区则在征服某区
self.create_time_desc=''#2023-04-13 16:07:23
self.price=''#500
self.card={}#五星及4星卡
self.skill={}#技能
self.dynamic_icon={}#英雄皮肤
self.material={}#宝物材料
self.tenure={}#元宝、月卡、将令、虎符、荣耀等
self.gear={}#武器
self.build_facade={}#主城建筑外观
self.army_facade={}#行军外观
def yufu_fenxi(self):
#赤珠山铁和小叶紫檀按官方售价是350玉一个
yufu_1=self.material["chi_zhu_shan_tie"]["value"]+self.material["xiao_ye_zi_tan"]["value"]
#存量元宝、虎符、将令,按1:1计算,实际上元宝和将令很便宜,月卡1天按150玉
yufu_2=self.tenure["bind_yuan_bao"]+self.tenure["hufu"]+self.tenure["jiang_ling"]
yufu_3=self.tenure["yue_ka_endtime"]
#一个皮肤按1688将令算
yufu_4=len([ele for ele in self.dynamic_icon if isinstance(ele,dict)])
#一般的材料5星,按3个5连一个材料计算,1个五星1000玉,实际上材料5星并不值钱,
#材料五星包括:100033吴孙坚、100101汉灵帝、100003汉吕布、100009群董卓、100435魏夏侯渊(sp)、100024魏荀彧、100017蜀诸葛亮、100031吴周瑜、100034吴甘宁、100006汉袁绍
#102004汉卢植、晋卫灌、100008群张角、100025魏曹丕、100083魏张郃、100020蜀黄月英、100090吴太史慈、100037汉何太后、100015群甄洛、100004汉蔡文姬、侍卫(忽略不计)
list_4=[100033,100101,100003,100009,100435,100024,100017,100031,100034,100006,102004,100008,100025,100083,100020,100090,100037,100015,100004]
i=0
for item in self.card:
if item["icon_hero_id"] in list_4:
i+=1
if item["awake_state"] != 0:
i+=2
if item["advance_num"] !=0:
i+=item["advance_num"]
yufu_5=i
#典藏 按桃园(刘备)、枭雄(曹操)、鼎足江东(孙权)算5000玉,其余的和材料卡一样算1500玉
yufu_6_1=0
yufu_6_2=0
yufu_7=0
diancang_dianji=[]
for _diancang in self.card_dian_cang:
if _diancang["name"] in ["桃园结义","枭雄","鼎足江东"]:
yufu_6_1+=1
diancang_dianji.append(_diancang["name"])
if _diancang["name"] in ["威震逍遥","凤仪亭","当阳桥","汜水关","人中吕布","单骑救主"]:
yufu_6_2+=1
diancang_dianji.append(_diancang["name"])
for _dianji in self.card_dian_ji:
if _dianji["name"] in dianji:
yufu_7+=1
diancang_dianji.append(_dianji["name"])
yufu_6=5000*yufu_6_1+1000*yufu_6_2
skill=[]
skill_m=0#账号一共多少技能
for _skill in self.skill:
if _skill["name"] not in ["桃园结义","枭雄","鼎足江东","威震逍遥","凤仪亭","当阳桥","汜水关","人中吕布","单骑救主"]:
skill.append(_skill["name"])
skill_m+=1
skill_S=0#S级技能多少个?
skill_S_dict=[]
skill_S_out_dict=[]
skill_A=0#A级技能多少个?
skill_A_dict=[]
skill_A_out_dict=[]
skill_B=0#B级技能多少个?
skill_B_dict=[]
skill_B_out_dict=[]
for _item in jineng_S:
if _item in skill:
skill_S+=1
skill_S_dict.append(_item)
elif _item not in ['桃园结义', '当阳桥', '金吾飞将', '天下无双', '血溅黄砂', '洛水佳人', '皇裔流离', '银龙冲阵', '魏武之世', '驱虎吞狼', '其疾如风', '九锡黄龙', '巾帼战阵', '白楼独舞', '白衣渡江', '奇佐鬼谋', '密谋定蜀', '火势风威', '酒池肉林', '辕门射戟', '明其虚实', '樊渊泅囚', '金匮要略', '迟智难酬', '西陵克晋', '难知如阴', '谋谟帷幄', '巧音唤蝶', '愚守善言', '京观垒冢', '断首何怒', '统军畏慎', '暴戾恣睢', '抚民励德', '动如雷震', '五兵之烈', '奋疾先登', '鸾凤和鸣', '尽言直谏', '运筹决胜', '怀德畏威', '谋议宏图', '盛气横凌', '三军夺帅', '潜谋远计']:
skill_S_out_dict.append(_item)
for _item in jineng_A:
if _item in skill:
skill_A+=1
skill_A_dict.append(_item)
elif _item not in ['凤仪亭', '汜水关', '人中吕布', '鼎足江东', '单骑救主', '威震逍遥', '望风而降', '乱政', '闭月', '黄天当立', '算无遗策', '忍而不发', '红颜铁骑', '匠心不竭', '长坂之吼', '世仇', '强势', '玄武洰流', '侵掠如火', '焚城劫焰', '沙场破阵', '列营守险', '素衣伶姬', '鬼谋', '破凰', '八门金锁', '方阵突击', '火烧连营', '蝶舞红莲', '帝临回光', '逆反毒杀', '锦马慑敌', '轻侠妄为', '黄须虎子', '双艳', '洞察之策', '险途暗渡', '定军扬威', '黄天余音', '不动如山', '方天余烈', '银龙孤胆', '方阵掩杀', '幽兰洛神', '智取仁守', '火兽冲锋', '虎豹督军', '计定山越', '落首箭', '盲侯奋勇', '霸王渡江', '夔吼象踏', '破阵强袭', '青丘媚祸', '西乡武功', '自误', '平壑拒吴', '令明负榇', '猎敌之锋', '陷敌之谋', '疮痍累身', '剑关叛立', '兵行巧变', '俭仪蹈和', '六守精兵', '计谕废立', '铁马撼岳', '威震江左', '弃憾破合', '国士无双', '奉令护蜀', '惊雷破阵', '僭越', '面和心阋', '宣威再战', '肃清荆襄', '熊兵火刃', '粳稻丰积', '掠敌数顾', '国难难靖', '骑卒猛战', '月偃蛮平', '云垂', '鸟翔', '将出关西', '奇兵拒北', '将门有将', '全主诿异', '登锋陷阵', '赍粮藉寇', '鸷击狼噬', '威震河朔', '怒浪伐敌', '七步释嫌', '虎步陷阵', '鏖兵卫主', '赐剑长驱', '绮阁飘香', '持刀从武', '连环计', '三让徐州', '游议定益', '登坛相仪', '忧勤王事', '持节镇西', '广陵绝唱', '幕天席地', '青白分明', '赏顺伐逆']:
skill_A_out_dict.append(_item)
for _item in jineng_B:
if _item in skill:
skill_B+=1
skill_B_dict.append(_item)
elif _item not in ['枭雄', '胡笳离愁', '四世三公', '将倾之柱', '逆谋', '诸葛锦囊', '魏武之泽', '千里单骑', '复誓业火', '遗志', '枭姬', '辅王抑寇', '母仪浮梦', '猛火', '节镇关东', '藏玉在怀', '义勇军', '修罗姬返', '神速奔袭', '太平异道', '劫掠', '坚盾阵', '固军备战', '铁骑突击', '昭烈神思', '锐矛贯体', '索命连环', '六宫无怨', '以逸待劳', '战伤无畏', '炬石', '小霸王', '幻花乱影', '将门虎女', '星耀箭雨', '北地枪王', '陷阵营', '老骥伏枥', '强弓连射', '王佐之才', '高级远攻', '吴之副督', '斧钺之利', '国士', '拔剑护主', '十二奇策', '悍将', '以主制客', '水泽伏击', '借刀斩叛', '存嗣流愿', '南中平蛮', '虎步关右', '虎痴嗔怒', '符医术毒', '神威将女', '定军绝战', '中郎尽粹', '恶来当道', '众叛亲离', '南蛮强袭', '行樵偶遇', '二夫之勇', '陈王求隐', '奇士薄寿', '固陵杀将', '拒战言和', '藤甲突击', '花中秀', '疑兵避战', '虎贲牙将', '传檄荆襄', '北狄互伐', '明妃', '覆舟不弃', '预识', '衡众', '土垒督战', '明法御狄', '肆掠', '持绢履险', '人公将军', '地公将军', '却羌破奴', '困龙尤争', '唇枪舌剑', '千里疾行', '前军冲锋', '乱其军形', '训练有素', '领兵有方', '文启', '古之恶来', '奇袭兵法', '六守兵法', '诡谋兵法', '谋主', '焚舟叩营', '形兵列阵', '冢虎', '未笄难言', '陷储立齐', '投殳驱前', '形兵险战', '焚粮避祸', '革甲众行', '速战迎击', '断铁倾旗', '铁骑冲锋', '伺机而动', '避实击虚', '安营固军', '乱矢蓄川', '千里奔袭', '烽火覆周', '群策群力', '缚父临危', '寇略四州', '去缚犒军', '叛羌急袭', '羌帅衅敌', '岁贡固疆', '疫箭拦江', '名震敌国', '勇而无算', '万夫之勇', '治众刑咒', '天覆', '地载', '风扬', '龙飞', '虎翼', '蛇蟠', '竭忠尽智', '挟主行令', '坐山观虎', '言出必克', '酩酊不休', '犹疑', '纵兵劫掠', '汉韵旷野', '赈穷救急', '勇追穷寇', '名士在朝', '明慧通透']:
skill_B_out_dict.append(_item)
#行军外观,2000玉符一个
yufu_11=len([ele for ele in self.army_facade if isinstance(ele,dict)])
return yufu_1,yufu_2,yufu_3,yufu_4,yufu_5,yufu_6,yufu_7,skill_m,skill_S,skill_A,skill_B,yufu_11
def rmb_fenxi(self):
#垃圾武将排除
list_1=[100033,100101,100003,100009,100435,100024,100017,100031,100034,100006,102004,100008,100025,100083,100020,100090,100037,100015,100004]
#绝版武将,按100人民币
list_2=[100476,100477,100478,100479,100480,100495,100496,100497,100498]
i=0
juebanwujiang={}
for item in self.card:
if item["icon_hero_id"] in list_2:
i+=1
juebanwujiang["%s"%item["icon_hero_id"]]="%s"%item["advance_num"]
if item["advance_num"] !=0:
i+=item["advance_num"]
#其他5星按10人民币
j=0
for item in self.card:
if item["quality"]==5 and item["icon_hero_id"] not in list_1 and item["icon_hero_id"] not in list_2:
j+=1
if item["advance_num"] !=0:
j+=item["advance_num"]
#武器估值
k=0
k_1=0
wuqi_xiangqing={}
for _gear in self.gear:
if _gear["phase"]==3:
k+=1
if _gear["level_type"]==2:
k_1+=1
wuqi_xiangqing.update({_gear["name"]+str(k_1):_gear["feature"]})
return i,j,k,k_1,wuqi_xiangqing,juebanwujiang
def team_fenxi(self):
hero_list={}#这个号有的英雄
for item in self.card:
a="%s"%(item["icon_hero_id"])
b="%s"%(item["advance_num"])
hero_list.update({a:b})
skill=[]
for _skill in self.skill:
skill.append(_skill["name"])
wuqi_xiangqing={}
for _gear in self.gear:
wuqi_xiangqing.update({_gear["name"]:_gear["skillInfo"]})
team_return={}
rmb_team_count=0
for key,value in duiwu.items():
if value["heros"][0] in hero_list and value["heros"][1] in hero_list and value["heros"][2] in hero_list:
rmb_team_count+=1
i=list(set(value["skill"]) & set(skill))
j=list(set(value["skill"])-set(i))
#print(value["skill"])
team_return[key]={
value["heros"][0]:hero_list[value["heros"][0]],
value["heros"][1]:hero_list[value["heros"][1]],
value["heros"][2]:hero_list[value["heros"][2]],
"110":value["skill"],
"120":"%s"%j,
"119":value["search_gear"]
}
i.clear()
j.clear()
return team_return,rmb_team_count
def manhong_fenxi(self):
manhong_5=[]
manhong_4=[]
manhong_3=[]
for item in self.card:
#print(item)
if item["quality"]==5:
if item["icon_hero_id"] not in [100033,100101,100003,100009,100435,100024,100017,100031,100034,100006,102004,100008,100025,100083,100020,100090,100037,100015,100004]:
if item["advance_num"]==5:
manhong_5.append(item["name"])
if item["advance_num"]==4:
manhong_4.append(item["name"])
if item["advance_num"]==3:
manhong_3.append(item["name"])
return manhong_5,manhong_4,manhong_3
#形成报告
def word(self):
from docx import Document
from docx.shared import RGBColor,Pt,Inches,Cm
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.oxml.ns import qn
doc=Document()
#print(self.desc_sumup_short,type(self.desc_sumup_short))
#全局设置
doc.styles['Normal'].font.name=u'宋体'
doc.styles['Normal']._element.rPr.rFonts.set(qn('w:eastAsia'),u'宋体')
doc.styles['Normal'].font.size = Pt(12.5)
doc.styles['Normal'].font.color.rgb = RGBColor(0,0,0)
yufu_1,yufu_2,yufu_3,yufu_4,yufu_5,yufu_6,yufu_7,skill_m,skill_S,skill_A,skill_B,yufu_11=Account.yufu_fenxi(self)
yufu=350*yufu_1+yufu_2+150*yufu_3+1688*yufu_4+1000*yufu_5+500*yufu_7+1000*skill_S+500*skill_A+50*skill_B+2000*yufu_11
i,j,k,k_1,wuqi_xiangqing,juebanwujiang=Account.rmb_fenxi(self)
rmb=i*100+j*10+k*20+k_1*200
a,b=Account.team_fenxi(self)
huansuan=int(rmb+yufu/160+b*100)#总价格计算公式
manhong_5,manhong_4,manhong_3=Account.manhong_fenxi(self)
#标题
heading=doc.add_heading('', level=0)
heading.alignment=WD_PARAGRAPH_ALIGNMENT.CENTER
run=heading.add_run("藏宝阁率土之滨账号价值分析报告")
run.font.name=u'宋体'
run.font.color.rgb = RGBColor(0,0,0)
run._element.rPr.rFonts.set(qn('w:eastAsia'), u'宋体')
print("1.挂牌价格为:"+str(self.price)+"元。分析此号价值为:"+str(huansuan)+"元")
heading=doc.add_heading("一、账号价值分析",level=1)
doc.add_heading("(一)价格分析说明",level=2)
if huansuan>=self.price:
doc.add_paragraph("1.挂牌价格为:"+str(self.price)+"元。分析此号价值为:"+str(huansuan)+"元,这个号性价比非常高!!! ")
else:
doc.add_paragraph("1.挂牌价格为:"+str(self.price)+"元。分析此号价值为:"+str(huansuan)+"元,这个号性价比很低!!! ")
doc.add_paragraph(
"2.购买的网址为: "+self.eid+"\n"+
"当前订单状态:"+self.status_desc+"。\n"+
"账号现在位于:"+self.area_name+",具体服务器为"+self.server_name+
"。\n账号上架时间:"+self.create_time_desc
)
doc.add_heading("(二)靓点说明",level=2)
juebanwujiang_return={}
for key,value in juebanwujiang.items():
juebanwujiang_return[juebanwujiang_quanju[key]]=value
text_1="①绝版武将是:"
text_2="②5红武将(非材料)是:"
text_3="③4红武将(非材料)是:"
text_4="④3红武将(非材料)是:"
for key,value in juebanwujiang_return.items():
text_1=text_1+key+value+"红 ; "
for item in manhong_5:
text_2=text_2+item+";"
for item in manhong_4:
text_3=text_3+item+";"
for item in manhong_3:
text_4=text_4+item+";"
if not self.highlight:
self.highlight=["无"]
doc.add_paragraph(
"1.该账号有 "+self.desc_sumup_short+
"。其中"+self.highlight[0]+"。\n"+
text_1+
"\n"+text_2+
"\n"+text_3+
"\n"+text_4
)
doc.add_paragraph(
"2.S级战法"+str(skill_S)+
"个(总23个),获得率:"+str(int(skill_S/23*100))+
"%;A级战法"+str(skill_A)+"个(总43个),获得率:"+str(int(skill_A/43*100))+
"%;B级战法"+str(skill_B)+"个(总56个),获得率:"+str(int(skill_B/56*100))+"%。"+
"\n典籍:"+str(self.dian_ji_count)+"个(总15个),获得率:"+str(int(self.dian_ji_count/15*100))+"%;典藏有"+str(self.available_dian_cang_count)+"个(总9个),获得率:"+str(int(int(self.available_dian_cang_count)/9*100))+"%。")
doc.add_paragraph(
"3.宝物:3阶武器"+str(k)+"个,其中稀世珍品"+str(k_1)+"个。"
)
for key,value in wuqi_xiangqing.items():
doc.add_paragraph(str(key)+":"+value[0][0]+value[0][1])
doc.add_heading("(三)可玩性",level=2)
doc.add_paragraph(
"征服赛季开局共需170荣誉,1900玉符,"
)
if self.tenure["honor"]>170 and (self.tenure["bind_yuan_bao"]+self.tenure["hufu"])>1900:
doc.add_paragraph(
"此号荣誉"+str(self.tenure["honor"])+
",初始玉符"+str(self.tenure["bind_yuan_bao"]+self.tenure["hufu"])
+"本号满足最基础开荒条件"
)
else:
doc.add_paragraph(
"此号荣誉"+str(self.tenure["honor"])+
",初始玉符"+str(self.tenure["bind_yuan_bao"]+self.tenure["hufu"])+
"本号有所欠缺,需要攒玉来弥补。"
)
doc.add_heading("二、价值计算详情",level=1)
doc.add_paragraph(
"按以下运算规则得出价值为:"+str(huansuan)+"元。"
)
table_1=doc.add_table(17,6,style="Table Grid")
table_1.cell(0,0).text="序号"
table_1.cell(0,1).text="物品"
table_1.cell(0,2).text="数量"
table_1.cell(0,3).text="价格"
table_1.cell(0,4).text="单计"
table_1.cell(0,5).text="换算成人民币(160:1)"
table_1.cell(1,0).text="1"
table_1.cell(2,0).text="2"
table_1.cell(3,0).text="3"
table_1.cell(4,0).text="4"
table_1.cell(5,0).text="5"
table_1.cell(6,0).text="6"
table_1.cell(7,0).text="7"
table_1.cell(8,0).text="8"
table_1.cell(9,0).text="9"
table_1.cell(10,0).text="10"
table_1.cell(11,0).text="11"
table_1.cell(12,0).text="12"
table_1.cell(13,0).text="13"
table_1.cell(14,0).text="14"
table_1.cell(15,0).text="15"
table_1.cell(16,0).text="16"
table_1.cell(1,1).text="赤珠山铁+小叶紫檀"
table_1.cell(2,1).text="玉符+虎符+将令"
table_1.cell(3,1).text="月卡剩余天数"
table_1.cell(4,1).text="武将皮肤"
table_1.cell(5,1).text="材料5星"
table_1.cell(6,1).text="典藏"
table_1.cell(7,1).text="典籍"
table_1.cell(8,1).text="S级技能"
table_1.cell(9,1).text="A级技能"
table_1.cell(10,1).text="B级技能"
table_1.cell(11,1).text="行军外观"
table_1.cell(12,1).text="绝版武将(已考虑升阶)"
table_1.cell(13,1).text="其他武将(不含材料5星)"
table_1.cell(14,1).text="宝物3阶"
table_1.cell(15,1).text="T0队伍数量"
table_1.cell(16,1).text="宝物粉"
table_1.cell(1,3).text="350/个"
table_1.cell(2,3).text="1/个"
table_1.cell(3,3).text="150/天"
table_1.cell(4,3).text="1688/个"
table_1.cell(5,3).text="1000/个"
table_1.cell(6,3).text=""
table_1.cell(7,3).text="500/个"
table_1.cell(8,3).text="1000/个"
table_1.cell(9,3).text="500/个"
table_1.cell(10,3).text="50/个"
table_1.cell(11,3).text="2000/个"
table_1.cell(12,3).text="100元/个"
table_1.cell(13,3).text="10元/个"
table_1.cell(14,3).text="20元/个"
table_1.cell(15,3).text="100元/队"
table_1.cell(16,3).text="200元/个"
table_1.cell(1,2).text=str(yufu_1)
table_1.cell(2,2).text=str(yufu_2)
table_1.cell(3,2).text=str(yufu_3)
table_1.cell(4,2).text=str(yufu_4)
table_1.cell(5,2).text=str(yufu_5)
table_1.cell(6,2).text=""
table_1.cell(7,2).text=str(yufu_7)
table_1.cell(8,2).text=str(skill_S)
table_1.cell(9,2).text=str(skill_A)
table_1.cell(10,2).text=str(skill_B)
table_1.cell(11,2).text=str(yufu_11)
table_1.cell(12,2).text=str(i)
table_1.cell(13,2).text=str(j)
table_1.cell(14,2).text=str(k)
table_1.cell(15,2).text=str(b)
table_1.cell(16,2).text=str(k_1)
table_1.cell(1,4).text=str(yufu_1*350)
table_1.cell(2,4).text=str(yufu_2)
table_1.cell(3,4).text=str(yufu_3*150)
table_1.cell(4,4).text=str(yufu_4*1688)
table_1.cell(5,4).text=str(yufu_5*1000)
table_1.cell(6,4).text=''
table_1.cell(7,4).text=str(yufu_7*500)
table_1.cell(8,4).text=str(skill_S*1000)
table_1.cell(9,4).text=str(skill_A*500)
table_1.cell(10,4).text=str(skill_B*50)
table_1.cell(11,4).text=str(yufu_11*2000)
table_1.cell(1,5).text=str(int(yufu_1*350/160))
table_1.cell(2,5).text=str(int(yufu_2/160))
table_1.cell(3,5).text=str(int(yufu_3*150/160))
table_1.cell(4,5).text=str(int(yufu_4*1688/160))
table_1.cell(5,5).text=str(int(yufu_5*1000/160))
table_1.cell(6,5).text=''
table_1.cell(7,5).text=str(int(yufu_7*500/160))
table_1.cell(8,5).text=str(int(skill_S*1000/160))
table_1.cell(9,5).text=str(int(skill_A*500/160))
table_1.cell(10,5).text=str(int(skill_B*50/160))
table_1.cell(11,5).text=str(int(yufu_11*2000/160))
table_1.cell(12,5).text=str(i*100)
table_1.cell(13,5).text=str(j*10)
table_1.cell(14,5).text=str(k*20)
table_1.cell(15,5).text=str(b*100)
table_1.cell(16,5).text=str(k_1*200)
table_1.style.paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.CENTER
for row in table_1.rows:
if row._index > 0:
row.height=Pt(30)
doc.add_paragraph(
"表格备注:\n①玉符按照30元=4800玉(300+150*30天)比例换算成人民币,即1:160\n"+
"②材料五星(已考虑升阶)包括:吴孙坚、汉灵帝、汉吕布、群董卓、魏夏侯渊、魏荀彧、步诸葛亮、吴周瑜、吴甘宁、汉袁绍、汉卢植、晋卫灌、群张角、魏曹丕、魏张郃、蜀黄月英、吴太史慈、汉何太后、群甄洛、汉蔡文姬、侍卫(未纳入计算)"
"\n③典藏 按桃园、枭雄、鼎足江东算5000玉,其余算1000玉"
)
doc.add_heading("三、主流队伍分析",level=2)
doc.add_heading("(一)T0队分析",level=2)
text_xianyu=""
for item in a.keys():
text_xianyu+=item+" ; "
doc.add_paragraph("共有一线、二线队伍总计"+str(b)+"队,分别是:"+text_xianyu)
for key,value in a.items():
doc.add_paragraph("队伍名称:"+key)
table=doc.add_table(4,5,style="Table Grid")
table.cell(0,0).text="武将"
table.cell(0,1).text="第二战法"
table.cell(0,2).text="第三战法"
table.cell(0,3).text="宝物"
table.cell(0,4).text="词条"
table.style.paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.CENTER
for row in table.rows:
if row._index > 0:
row.height=Pt(50)
i=1
text={
"骁锐":"攻击属性提高5%-15%",
"破敌":"造成的攻击伤害无视10%-20%的防御属性",
"英勇":"造成攻击伤害的武将主战法发动几率提升5%-15%",
"善谋":"第4,6回合,造成攻击伤害的武将主战法发动几率提升10%-30%",
"坚忍":"受到主战法伤害降低10%-20%",
"至策":"主动战法伤害提升10%-20%",
"陷阵":"普通攻击伤害提升10%-30%",
"强击":"前1~5回合普通攻击不会触发反击",
"坚毅":"前2~6回合免疫混乱和暴走",
"无畏":"追击战法伤害提升10%-30%",
"奔袭":"追击战法发动率提升3%-9%",
"灵动":"速度属性提高10-30",
"仁心":"恢复效果提升5%-15%",
"机敏":"主动战法发动率提升3%-9%",
"清毅":"第5~8回合武将行动时获得洞察",
"艮止":"无法攻击,谋略提升10~30",
"惑言":"正式回合后武将主战法成功施加的的前1~4个控制效果(混乱暴走怯战犹豫)增加一回合",
"识破":"前1~4回合,主动及追击武将主战法造成的伤害无视规避",
"筹算":"造成策略伤害的武将主战法发动率提升5~15%",
"颖悟":"造成策略伤害无视10%~20%的谋略属性",
"驱火":"燃烧及火攻伤害提升10%-30%",
"炫惑":"恐慌及妖术伤害提升10%-30%",
"熟虑":"需要准备的主动武将主战法发动几率提升6%-20%",
"天资":"谋略属性提升5%-15%",
"击虚":"正式回合开始后,目标每存在一种持续性伤害或控制效果,自身对其造成的伤害提升3%-9%,最多5种",
"稳固":"防御属性提高10%-20%",
"沉稳":"受到的指挥战法降低10%-20%",
"济世":"主战法每次造成一定恢复效果,效果目标下一次受到的伤害减少5%-15%,该效果可叠加",
"威势":"受到初始统帅值低于自身武将的所有伤害降低10%-20%",
"不屈":"每次受到伤害后,本回合受到所有伤害降低3%-9%,效果可叠加",
"亢厉":"主动及追击武将主战法伤害提高10^30%",
"强韧":"受到普通攻击伤害降低10%-20%"
}
table.cell(1,3).text=value["119"][0]
table.cell(1,4).text=value["119"][1]+"\n"+text[value["119"][1]]
table.cell(2,3).text=value["119"][2]
table.cell(2,4).text=value["119"][3]+"\n"+text[value["119"][3]]
table.cell(3,3).text=value["119"][4]
table.cell(3,4).text=value["119"][5]+"\n"+text[value["119"][5]]
run_3=table.cell(1,1).paragraphs[0].add_run()
picture=run_3.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
run_4=table.cell(1,2).paragraphs[0].add_run()
picture=run_4.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
run_5=table.cell(2,1).paragraphs[0].add_run()
picture=run_5.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
run_6=table.cell(2,2).paragraphs[0].add_run()
picture=run_6.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
run_7=table.cell(3,1).paragraphs[0].add_run()
picture=run_7.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
run_8=table.cell(3,2).paragraphs[0].add_run()
picture=run_8.add_picture(os.path.join(os.getcwd(),"image","skill.png"),width=Cm(1))
table.cell(1,1).paragraphs[0].add_run("\n"+value["110"][0])
table.cell(1,2).paragraphs[0].add_run("\n"+value["110"][1])
table.cell(2,1).paragraphs[0].add_run("\n"+value["110"][2])
table.cell(2,2).paragraphs[0].add_run("\n"+value["110"][3])
table.cell(3,1).paragraphs[0].add_run("\n"+value["110"][4])
table.cell(3,2).paragraphs[0].add_run("\n"+value["110"][5])
for key1,value1 in value.items():
if key1=="100731":
key1="100591"
elif key1=="102001":
key1="100021"
elif key1=="102002":
key1="100435"
elif key1=="102003":
key1="100090"
elif key1=="102004":
key1="100007"
elif key1=="102005":
key1="100015"
elif key1=="102011":
key1="100004"
elif key1=="102012":
key1="100074"
elif key1=="102013":
key1="100083"
elif key1=="102014":
key1="100008"
elif key1=="102015":
key1="100036"
elif key1=="102016":
key1="100494"
elif key1=="102017":
key1="100032"
if key1 !="110" and key1 !="119" and key1 !="120":
run_1=table.cell(i,0).paragraphs[0].add_run()
picture=run_1.add_picture(os.path.join(os.getcwd(),"image",key1+".jpg"),width=Cm(2))
run_2=table.cell(i,0).paragraphs[0].add_run('\n')
count=int(value1)
while count !=0:
run_2=table.cell(i,0).paragraphs[0].add_run()
picture=run_2.add_picture(os.path.join(os.getcwd(),"image","hong.png"),width=Cm(0.3))
count-=1
i+=1
if key1 =="120":#缺少的战法
doc.add_paragraph("注意:当前队伍匹配缺少战法:"+value1)
doc.add_heading(
"(二)开荒队分析\n"+"没有市场需求,暂未开发,此处略去1000字",
level=3
)
doc.add_heading(
"(三)机器学习动态分析价值因子\n"+"功能逐步完善中,此处略去1000字",
level=3
)
doc.add_picture(os.path.join(os.getcwd(),"image","erweima.png"),width=Cm(5))
print(r"率土之滨/官服/藏宝阁/性价比高/账号"+time.strftime('%Y.%m.%d-%H:%M',time.localtime(time.time()))+"推荐")
doc.save(os.path.join(os.getcwd(),"zuihoudejieguo",str(self.price)+"--"+self.eid[-32:]+".docx"))
def general_value(file_name,account_info):
#读入数据到类中
info=json.loads(account_info)
info=info["equip"]#掐头去尾,提取关键
account=Account()#实例化 并赋值
account.eid=info['equip_detail_url']
account.status_desc=info["status_desc"]
account.area_name=info['area_name']
account.server_name=info['server_name']
account.highlight=info['highlights']
account.price=int(info['price'])/100
account.desc_sumup_short=info['desc_sumup_short']
account.create_time_desc=info['create_time_desc']
account.available_dian_cang_count=info['other_info']['available_dian_cang_count']
account.dian_ji_count=info['other_info']['available_dian_ji_count']
info = json.loads(info["equip_desc"])#再次提取关键
account.dynamic_icon=info["dynamic_icon"]
account.material=info["material"]
account.card_dian_cang=info['card_dian_cang']
account.gear=info["gear"]
account.skill=info["skill"]
account.card_dian_ji=info["card_dian_ji"]
account.build_facade=info["build_facade"]
account.card=info["card"]
account.tenure=info["tenure"]
account.army_facade=info["army_facade"]
account.word()
def postAccount(target):
import requests
url='https://stzb.cbg.163.com/cgi/api/get_equip_detail?client_type=h5'
headers = {
'referer': 'https://stzb.cbg.163.com/cgi/mweb/equip/1/202303020702116-1-ZN5H0VST2GSYBQ?view_loc=equip_list%7Ctag_key%3A%7B%22is_from_ad_reco%22%3A%200,%20%22tag%22%3A%20%22general_rec_din_tfs%22%7D&reco_request_id=1681352262526DOVjo&tag=general_rec_din_tfs',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
}
cookies = {}
params = {
'client_type': 'h5',
}
data = {
'serverid': '1',
'ordersn': target,
'view_loc': 'equip_list|tag_key:{"is_from_ad_reco": 0, "tag": "general_rec_din_tfs"}',
'exter': 'direct',
'page_session_id': '0187798D-3FD1-FF17-D9E6-4781E55C8BF7',
}
try:
response = requests.post(
'https://stzb.cbg.163.com/cgi/api/get_equip_detail',
params=params,
#cookies=cookies,
headers=headers,
data=data,
)
time.sleep(3)
print(response)
if response.status_code == 200:
path='account_data/'+target+'.txt'
f=open(path,'w')
f.write(response.text)
f.close()
except ValueError as reason:
print("网络连接出错")
def main():
import tkinter.messagebox as msg
if entry.get()=="":
msg.showinfo("","请别空着呀")
return None
else:
val=entry.get()
account_detail=re.findall("/1/(.*?)\\?",val)
print(account_detail)
for sigle in account_detail:
postAccount(sigle)
for root,dirs,files in os.walk('account_data'):
for f in files:
with open(os.path.join(root,f),'r', encoding='UTF-8') as fp:
content=fp.read()
general_value(f[:-4],content)
fp.close()
os.remove(os.path.join(root,f))
msg.showinfo("","搞完了\n结果在zuihoudejiguo文件夹里查看")
account_detail.clear()
root=tk.Tk()
root.geometry("200x100+630+300")
lable_1=tk.Label(root,text="输入报备的详情页网址")
lable_1.pack()
timeVar=tk.StringVar()
entry=tk.Entry(root,textvariable=timeVar)
entry.pack()
button=tk.Button(root,text="运行",command=main)
button.pack()
root.mainloop()