[Python] 纯文本查看 复制代码
# -*- coding:utf-8 -*-
# @FileName :52pj_xunxianUI.py
# @ author :neteast@52pojie
import base64
import json
import re
import threading
import time
import tkinter as tk
import tkinter.font as tkFont
import tkinter.messagebox
import tkinter.ttk as ttk
import warnings
from tkinter import *
import requests
from lxml import etree
LOG_LINE_NUM = 0
counter_tv = 0
image = None
class App:
def __init__(self, root):
self.initUI()
self.initData()
self.status_test = False
self.test()
def test(self):
if self.status_test:
pass
else:
pass
def initData(self):
self.sex = '1'
self.needDecode = True # 链接加密
self.tag = 'odd'
self.session = requests.Session()
self.session.headers.update({
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36'})
self.url_base = 'http://youxi.kebai.work/'
self.url_game = self.url_base + 'game.php'
self.url_regist = self.url_base + 'reguser.php'
self.NowObject_op1 = None # 功能键
self.NowObject_op2 = None
self.NowObject_op3 = None
self.NowPosition = None # 当前位置
self.url_navW = None # 导航
self.url_navE = None
self.url_navN = None
self.url_navS = None
self.url_op1 = None
self.url_op2 = None
self.url_op3 = None
self.url_pve_useyp1 = None # 吃药1
self.url_pve_useyp2 = None
self.url_pve_useyp3 = None
self.url_pve_usejn1 = None # 技能1
self.url_pve_usejn2 = None
self.url_pve_usejn3 = None
self.status_pve = False # 打怪状态
self.status_autofighting = False # 自动攻击进程
self.status_auto_bybutton = False # 连攻按键
self.status_drugs1 = False
self.url_safyhouse = None # 安全屋链接
self.url_weapon1 = None # 武器
self.url_weapon2 = None # 头饰
self.url_weapon3 = None # 衣服
self.url_weapon4 = None # 腰带
self.url_weapon5 = None # 首饰
self.url_weapon6 = None # 鞋子
self.url_package = None # 包裹链接
self.url_package_weapons = None
self.url_package_drugs = None
self.url_package_items = None
self.url_package_skills = None
self.url_package_market = None
self.url_package_friends = None
pass
def initUI(self):
# setting title
root.title("寻仙记 neteast@52pojie")
# setting window size
width = 1273
height = 696
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
root.geometry(alignstr)
root.resizable(width=False, height=False)
self.GButton_9 = tk.Button(root)
self.GButton_9["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_9["font"] = ft
self.GButton_9["fg"] = "#000000"
self.GButton_9["justify"] = "center"
self.GButton_9["text"] = "当前位置"
self.GButton_9.place(x=1100, y=620, width=69, height=30)
self.GButton_9["command"] = self.GButton_9_command
self.GButton_720 = tk.Button(root)
self.GButton_720["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_720["font"] = ft
self.GButton_720["fg"] = "#000000"
self.GButton_720["justify"] = "center"
self.GButton_720["text"] = "向北"
self.GButton_720.place(x=1090, y=590, width=91, height=30)
self.GButton_720["command"] = self.GButton_720_command
self.GButton_126 = tk.Button(root)
self.GButton_126["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_126["font"] = ft
self.GButton_126["fg"] = "#000000"
self.GButton_126["justify"] = "center"
self.GButton_126["text"] = "向西"
self.GButton_126.place(x=1010, y=620, width=88, height=30)
self.GButton_126["command"] = self.GButton_126_command
self.GButton_750 = tk.Button(root)
self.GButton_750["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_750["font"] = ft
self.GButton_750["fg"] = "#000000"
self.GButton_750["justify"] = "center"
self.GButton_750["text"] = "向东"
self.GButton_750.place(x=1170, y=620, width=94, height=30)
self.GButton_750["command"] = self.GButton_750_command
self.GButton_181 = tk.Button(root)
self.GButton_181["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_181["font"] = ft
self.GButton_181["fg"] = "#000000"
self.GButton_181["justify"] = "center"
self.GButton_181["text"] = "向南"
self.GButton_181.place(x=1090, y=650, width=91, height=30)
self.GButton_181["command"] = self.GButton_181_command
self.GLabel_72 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_72["font"] = ft
self.GLabel_72["fg"] = "#333333"
self.GLabel_72["justify"] = "center"
self.GLabel_72["text"] = "气血"
self.GLabel_72.place(x=10, y=620, width=30, height=30)
self.GLineEdit_556 = tk.Entry(root)
self.GLineEdit_556["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_556["font"] = ft
self.GLineEdit_556["fg"] = "#333333"
self.GLineEdit_556["justify"] = "center"
self.GLineEdit_556["text"] = "45/199"
self.GLineEdit_556.place(x=40, y=620, width=118, height=30)
self.GLabel_795 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_795["font"] = ft
self.GLabel_795["fg"] = "#333333"
self.GLabel_795["justify"] = "center"
self.GLabel_795["text"] = "攻击"
self.GLabel_795.place(x=160, y=620, width=30, height=30)
self.GLineEdit_634 = tk.Entry(root)
self.GLineEdit_634["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_634["font"] = ft
self.GLineEdit_634["fg"] = "#333333"
self.GLineEdit_634["justify"] = "center"
self.GLineEdit_634["text"] = "38"
self.GLineEdit_634.place(x=190, y=620, width=59, height=30)
self.GLabel_228 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_228["font"] = ft
self.GLabel_228["fg"] = "#333333"
self.GLabel_228["justify"] = "center"
self.GLabel_228["text"] = "防御"
self.GLabel_228.place(x=250, y=620, width=35, height=30)
self.GLineEdit_875 = tk.Entry(root)
self.GLineEdit_875["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_875["font"] = ft
self.GLineEdit_875["fg"] = "#333333"
self.GLineEdit_875["justify"] = "center"
self.GLineEdit_875["text"] = "27"
self.GLineEdit_875.place(x=290, y=620, width=70, height=25)
self.GLabel_517 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_517["font"] = ft
self.GLabel_517["fg"] = "#333333"
self.GLabel_517["justify"] = "center"
self.GLabel_517["text"] = "暴击"
self.GLabel_517.place(x=360, y=620, width=36, height=30)
self.GLineEdit_588 = tk.Entry(root)
self.GLineEdit_588["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_588["font"] = ft
self.GLineEdit_588["fg"] = "#333333"
self.GLineEdit_588["justify"] = "center"
self.GLineEdit_588["text"] = "0%"
self.GLineEdit_588.place(x=400, y=620, width=70, height=25)
self.GLabel_19 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_19["font"] = ft
self.GLabel_19["fg"] = "#333333"
self.GLabel_19["justify"] = "center"
self.GLabel_19["text"] = "吸血"
self.GLabel_19.place(x=470, y=620, width=35, height=30)
self.GLineEdit_323 = tk.Entry(root)
self.GLineEdit_323["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_323["font"] = ft
self.GLineEdit_323["fg"] = "#333333"
self.GLineEdit_323["justify"] = "center"
self.GLineEdit_323["text"] = "2%"
self.GLineEdit_323.place(x=510, y=620, width=70, height=25)
self.GLineEdit_129 = tk.Entry(root)
self.GLineEdit_129["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_129["font"] = ft
self.GLineEdit_129["fg"] = "#333333"
self.GLineEdit_129["justify"] = "center"
self.GLineEdit_129["text"] = "百炼青刚剑+7"
self.GLineEdit_129.place(x=1050, y=120, width=167, height=30)
self.GButton_673 = tk.Button(root)
self.GButton_673["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_673["font"] = ft
self.GButton_673["fg"] = "#000000"
self.GButton_673["justify"] = "center"
self.GButton_673["text"] = "卸下"
self.GButton_673["relief"] = "groove"
self.GButton_673.place(x=1220, y=120, width=44, height=30)
self.GButton_673["command"] = self.GButton_673_command
self.GLabel_994 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_994["font"] = ft
self.GLabel_994["fg"] = "#333333"
self.GLabel_994["justify"] = "center"
self.GLabel_994["text"] = "头饰"
self.GLabel_994.place(x=1020, y=150, width=30, height=30)
self.GLineEdit_810 = tk.Entry(root)
self.GLineEdit_810["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_810["font"] = ft
self.GLineEdit_810["fg"] = "#333333"
self.GLineEdit_810["justify"] = "center"
self.GLineEdit_810["text"] = "无"
self.GLineEdit_810.place(x=1050, y=150, width=167, height=30)
self.GButton_928 = tk.Button(root)
self.GButton_928["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_928["font"] = ft
self.GButton_928["fg"] = "#000000"
self.GButton_928["justify"] = "center"
self.GButton_928["text"] = "卸下"
self.GButton_928["relief"] = "groove"
self.GButton_928.place(x=1220, y=150, width=44, height=30)
self.GButton_928["command"] = self.GButton_928_command
self.GLabel_789 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_789["font"] = ft
self.GLabel_789["fg"] = "#333333"
self.GLabel_789["justify"] = "center"
self.GLabel_789["text"] = "衣服"
self.GLabel_789.place(x=1020, y=180, width=31, height=30)
self.GLineEdit_708 = tk.Entry(root)
self.GLineEdit_708["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_708["font"] = ft
self.GLineEdit_708["fg"] = "#333333"
self.GLineEdit_708["justify"] = "center"
self.GLineEdit_708["text"] = "衣服"
self.GLineEdit_708.place(x=1050, y=180, width=167, height=30)
self.GButton_299 = tk.Button(root)
self.GButton_299["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_299["font"] = ft
self.GButton_299["fg"] = "#000000"
self.GButton_299["justify"] = "center"
self.GButton_299["text"] = "卸下"
self.GButton_299["relief"] = "groove"
self.GButton_299.place(x=1220, y=180, width=44, height=30)
self.GButton_299["command"] = self.GButton_299_command
self.GLabel_466 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_466["font"] = ft
self.GLabel_466["fg"] = "#333333"
self.GLabel_466["justify"] = "center"
self.GLabel_466["text"] = "腰带"
self.GLabel_466.place(x=1020, y=210, width=32, height=30)
self.GLineEdit_554 = tk.Entry(root)
self.GLineEdit_554["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_554["font"] = ft
self.GLineEdit_554["fg"] = "#333333"
self.GLineEdit_554["justify"] = "center"
self.GLineEdit_554["text"] = "腰带"
self.GLineEdit_554.place(x=1050, y=210, width=168, height=30)
self.GButton_682 = tk.Button(root)
self.GButton_682["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_682["font"] = ft
self.GButton_682["fg"] = "#000000"
self.GButton_682["justify"] = "center"
self.GButton_682["text"] = "卸下"
self.GButton_682["relief"] = "groove"
self.GButton_682.place(x=1220, y=210, width=44, height=30)
self.GButton_682["command"] = self.GButton_682_command
self.GLineEdit_809 = tk.Entry(root)
self.GLineEdit_809["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_809["font"] = ft
self.GLineEdit_809["fg"] = "#333333"
self.GLineEdit_809["justify"] = "center"
self.GLineEdit_809["text"] = "首饰"
self.GLineEdit_809.place(x=1050, y=240, width=167, height=30)
self.GButton_289 = tk.Button(root)
self.GButton_289["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_289["font"] = ft
self.GButton_289["fg"] = "#000000"
self.GButton_289["justify"] = "center"
self.GButton_289["text"] = "卸下"
self.GButton_289["relief"] = "groove"
self.GButton_289.place(x=1220, y=240, width=44, height=30)
self.GButton_289["command"] = self.GButton_289_command
self.GLabel_474 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_474["font"] = ft
self.GLabel_474["fg"] = "#333333"
self.GLabel_474["justify"] = "center"
self.GLabel_474["text"] = "首饰"
self.GLabel_474.place(x=1020, y=240, width=30, height=31)
self.GLabel_368 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_368["font"] = ft
self.GLabel_368["fg"] = "#333333"
self.GLabel_368["justify"] = "center"
self.GLabel_368["text"] = "鞋子"
self.GLabel_368.place(x=1020, y=270, width=30, height=33)
self.GLineEdit_31 = tk.Entry(root)
self.GLineEdit_31["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_31["font"] = ft
self.GLineEdit_31["fg"] = "#333333"
self.GLineEdit_31["justify"] = "center"
self.GLineEdit_31["text"] = "鞋子"
self.GLineEdit_31.place(x=1050, y=270, width=167, height=30)
self.GButton_503 = tk.Button(root)
self.GButton_503["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_503["font"] = ft
self.GButton_503["fg"] = "#000000"
self.GButton_503["justify"] = "center"
self.GButton_503["text"] = "卸下"
self.GButton_503["relief"] = "groove"
self.GButton_503.place(x=1220, y=270, width=44, height=30)
self.GButton_503["command"] = self.GButton_503_command
self.GLabel_355 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_355["font"] = ft
self.GLabel_355["fg"] = "#333333"
self.GLabel_355["justify"] = "center"
self.GLabel_355["text"] = "境界"
self.GLabel_355.place(x=590, y=620, width=35, height=30)
self.GLineEdit_546 = tk.Entry(root)
self.GLineEdit_546["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_546["font"] = ft
self.GLineEdit_546["fg"] = "#333333"
self.GLineEdit_546["justify"] = "center"
self.GLineEdit_546["text"] = "3"
self.GLineEdit_546.place(x=630, y=620, width=70, height=25)
self.GLabel_786 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_786["font"] = ft
self.GLabel_786["fg"] = "#333333"
self.GLabel_786["justify"] = "center"
self.GLabel_786["text"] = "等级"
self.GLabel_786.place(x=710, y=620, width=32, height=30)
self.GLineEdit_644 = tk.Entry(root)
self.GLineEdit_644["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_644["font"] = ft
self.GLineEdit_644["fg"] = "#333333"
self.GLineEdit_644["justify"] = "center"
self.GLineEdit_644["text"] = "9"
self.GLineEdit_644.place(x=750, y=620, width=70, height=25)
self.GLabel_582 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_582["font"] = ft
self.GLabel_582["fg"] = "#333333"
self.GLabel_582["justify"] = "center"
self.GLabel_582["text"] = "灵石"
self.GLabel_582.place(x=10, y=650, width=31, height=30)
self.GLineEdit_998 = tk.Entry(root)
self.GLineEdit_998["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_998["font"] = ft
self.GLineEdit_998["fg"] = "#333333"
self.GLineEdit_998["justify"] = "center"
self.GLineEdit_998["text"] = "1999"
self.GLineEdit_998.place(x=40, y=650, width=95, height=30)
self.GLabel_925 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_925["font"] = ft
self.GLabel_925["fg"] = "#333333"
self.GLabel_925["justify"] = "center"
self.GLabel_925["text"] = "极品"
self.GLabel_925.place(x=130, y=650, width=54, height=30)
self.GLineEdit_789 = tk.Entry(root)
self.GLineEdit_789["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_789["font"] = ft
self.GLineEdit_789["fg"] = "#333333"
self.GLineEdit_789["justify"] = "center"
self.GLineEdit_789["text"] = "101"
self.GLineEdit_789.place(x=180, y=650, width=82, height=30)
self.GLabel_312 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_312["font"] = ft
self.GLabel_312["fg"] = "#333333"
self.GLabel_312["justify"] = "center"
self.GLabel_312["text"] = "强化石"
self.GLabel_312.place(x=270, y=650, width=39, height=30)
self.GLineEdit_198 = tk.Entry(root)
self.GLineEdit_198["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_198["font"] = ft
self.GLineEdit_198["fg"] = "#333333"
self.GLineEdit_198["justify"] = "center"
self.GLineEdit_198["text"] = "强化石"
self.GLineEdit_198.place(x=310, y=650, width=73, height=30)
self.GLabel_565 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_565["font"] = ft
self.GLabel_565["fg"] = "#333333"
self.GLabel_565["justify"] = "center"
self.GLabel_565["text"] = "修 为"
self.GLabel_565.place(x=420, y=650, width=46, height=30)
self.GLineEdit_268 = tk.Entry(root)
self.GLineEdit_268["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_268["font"] = ft
self.GLineEdit_268["fg"] = "#333333"
self.GLineEdit_268["justify"] = "center"
self.GLineEdit_268["text"] = "1640/1626"
self.GLineEdit_268.place(x=470, y=650, width=171, height=30)
self.GLineEdit_969 = tk.Entry(root)
self.GLineEdit_969["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_969["font"] = ft
self.GLineEdit_969["fg"] = "#333333"
self.GLineEdit_969["justify"] = "center"
self.GLineEdit_969["text"] = "当前npc"
self.GLineEdit_969.place(x=10, y=30, width=143, height=106)
yscroll = Scrollbar(self.GLineEdit_969, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('NPC', '操作', 'url')
self.tvNpc = ttk.Treeview(self.GLineEdit_969, columns=title, style='Treeview', show='headings', height=10,
yscrollcommand=yscroll.set)
yscroll.config(command=self.tvNpc.yview)
self.tvNpc.pack()
self.tvNpc.column(title[0], width=85, anchor=CENTER)
self.tvNpc.heading(title[0], text=title[0])
self.tvNpc.column(title[1], width=40, anchor='w')
self.tvNpc.heading(title[1], text=title[1])
self.tvNpc.heading(title[2], text=title[2])
self.tvNpc.bind('<<TreeviewSelect>>', self.tvNpcSelection)
self.GLineEdit_612 = tk.Entry(root)
self.GLineEdit_612["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_612["font"] = ft
self.GLineEdit_612["fg"] = "#333333"
self.GLineEdit_612["justify"] = "center"
self.GLineEdit_612["text"] = "当前野怪"
self.GLineEdit_612.place(x=10, y=140, width=143, height=221)
yscroll = Scrollbar(self.GLineEdit_612, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('怪物', '操作', 'url')
self.tvMonster = ttk.Treeview(self.GLineEdit_612, columns=title, style='Treeview', show='headings', height=10,
yscrollcommand=yscroll.set)
yscroll.config(command=self.tvMonster.yview)
self.tvMonster.pack()
self.tvMonster.column(title[0], width=85, anchor=CENTER)
self.tvMonster.heading(title[0], text=title[0])
self.tvMonster.column(title[1], width=40, anchor='w')
self.tvMonster.heading(title[1], text=title[1])
self.tvMonster.heading(title[2], text=title[2])
self.tvMonster.bind('<<TreeviewSelect>>', self.tvMonsterSelection)
self.GLineEdit_252 = tk.Text(root) # "公屏聊天内容"
self.GLineEdit_252["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_252["font"] = ft
self.GLineEdit_252["fg"] = "#333333"
self.GLineEdit_252.place(x=160, y=480, width=751, height=87)
self.GLineEdit_10 = tk.Entry(root)
self.GLineEdit_10["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_10["font"] = ft
self.GLineEdit_10["fg"] = "#333333"
self.GLineEdit_10["justify"] = "center"
self.GLineEdit_10["text"] = "输入消息"
self.GLineEdit_10.place(x=180, y=570, width=729, height=30)
self.GButton_728 = tk.Button(root)
self.GButton_728["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_728["font"] = ft
self.GButton_728["fg"] = "#000000"
self.GButton_728["justify"] = "center"
self.GButton_728["text"] = "挂机"
self.GButton_728.place(x=930, y=570, width=68, height=30)
self.GButton_728["command"] = self.GButton_728_command
self.GLineEdit_386 = tk.Entry(root)
self.GLineEdit_386["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_386["font"] = ft
self.GLineEdit_386["fg"] = "#333333"
self.GLineEdit_386["justify"] = "center"
self.GLineEdit_386["text"] = "好友列表"
self.GLineEdit_386.place(x=910, y=340, width=108, height=230)
yscroll = Scrollbar(self.GLineEdit_386, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('玩家排行', '操作', 'url')
self.tvTopPlayer = ttk.Treeview(self.GLineEdit_386, columns=title, style='Treeview', show='headings', height=10,
yscrollcommand=yscroll.set)
yscroll.config(command=self.tvTopPlayer.yview)
self.tvTopPlayer.pack()
self.tvTopPlayer.column(title[0], width=85, anchor=CENTER)
self.tvTopPlayer.heading(title[0], text=title[0])
self.tvTopPlayer.column(title[1], width=40, anchor='w')
self.tvTopPlayer.heading(title[1], text=title[1])
self.tvTopPlayer.heading(title[2], text=title[2])
# self.tvTopPlayer.bind('<<TreeviewSelect>>', self.tvTopPlayerSelection)
self.GCheckBox_967 = tk.Checkbutton(root)
ft = tkFont.Font(family='Times', size=10)
self.GCheckBox_967["font"] = ft
self.GCheckBox_967["fg"] = "#333333"
self.GCheckBox_967["justify"] = "center"
self.GCheckBox_967["text"] = "公屏"
self.GCheckBox_967.place(x=20, y=570, width=44, height=30)
self.GCheckBox_967["offvalue"] = "0"
self.GCheckBox_967["onvalue"] = "1"
self.GCheckBox_967["command"] = self.GCheckBox_967_command
self.GLineEdit_294 = tk.Entry(root)
self.GLineEdit_294["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_294["font"] = ft
self.GLineEdit_294["fg"] = "#333333"
self.GLineEdit_294["justify"] = "center"
self.GLineEdit_294["text"] = "对方昵称"
self.GLineEdit_294.place(x=70, y=570, width=99, height=30)
self.GLineEdit_742 = tk.Text(root)
self.GLineEdit_742["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_742["font"] = ft
self.GLineEdit_742["fg"] = "#333333"
self.GLineEdit_742.place(x=390, y=30, width=520, height=448)
self.GLabel_497 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_497["font"] = ft
self.GLabel_497["fg"] = "#333333"
self.GLabel_497["justify"] = "center"
self.GLabel_497["text"] = "武器"
self.GLabel_497.place(x=1020, y=120, width=30, height=30)
self.GLabel_851 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_851["font"] = ft
self.GLabel_851["fg"] = "#333333"
self.GLabel_851["justify"] = "center"
self.GLabel_851["text"] = "账号"
self.GLabel_851.place(x=10, y=0, width=31, height=30)
self.GButton_107 = tk.Button(root)
self.GButton_107["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_107["font"] = ft
self.GButton_107["fg"] = "#000000"
self.GButton_107["justify"] = "center"
self.GButton_107["text"] = "登陆"
self.GButton_107.place(x=240, y=0, width=70, height=25)
self.GButton_107["command"] = self.GButton_107_command
self.GLabel_35 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_35["font"] = ft
self.GLabel_35["fg"] = "#333333"
self.GLabel_35["justify"] = "center"
self.GLabel_35["text"] = "密码"
self.GLabel_35.place(x=120, y=0, width=42, height=30)
self.GLineEdit_363 = tk.Entry(root)
self.GLineEdit_363["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_363["font"] = ft
self.GLineEdit_363["fg"] = "#333333"
self.GLineEdit_363["justify"] = "center"
self.GLineEdit_363["text"] = "账号"
self.GLineEdit_363.place(x=40, y=0, width=70, height=25)
self.GLineEdit_127 = tk.Entry(root)
self.GLineEdit_127["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_127["font"] = ft
self.GLineEdit_127["fg"] = "#333333"
self.GLineEdit_127["justify"] = "center"
self.GLineEdit_127["text"] = "密码"
self.GLineEdit_127.place(x=160, y=0, width=70, height=25)
self.GLabel_894 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_894["font"] = ft
self.GLabel_894["fg"] = "#333333"
self.GLabel_894["justify"] = "center"
self.GLabel_894["text"] = "玩家昵称"
self.GLabel_894.place(x=320, y=0, width=70, height=25)
self.GLineEdit_458 = tk.Entry(root)
self.GLineEdit_458["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_458["font"] = ft
self.GLineEdit_458["fg"] = "#333333"
self.GLineEdit_458["justify"] = "center"
self.GLineEdit_458["text"] = "玩家"
self.GLineEdit_458.place(x=390, y=0, width=70, height=25)
self.GLabel_129 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_129["font"] = ft
self.GLabel_129["fg"] = "#333333"
self.GLabel_129["justify"] = "center"
self.GLabel_129["text"] = "所属门派"
self.GLabel_129.place(x=470, y=0, width=62, height=30)
self.GLineEdit_456 = tk.Entry(root)
self.GLineEdit_456["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_456["font"] = ft
self.GLineEdit_456["fg"] = "#333333"
self.GLineEdit_456["justify"] = "center"
self.GLineEdit_456["text"] = "门派"
self.GLineEdit_456.place(x=540, y=0, width=70, height=25)
self.GLabel_80 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_80["font"] = ft
self.GLabel_80["fg"] = "#333333"
self.GLabel_80["justify"] = "center"
self.GLabel_80["text"] = "任务"
self.GLabel_80.place(x=1020, y=50, width=30, height=41)
self.GLineEdit_39 = tk.Entry(root)
self.GLineEdit_39["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_39["font"] = ft
self.GLineEdit_39["fg"] = "#333333"
self.GLineEdit_39["justify"] = "center"
self.GLineEdit_39["text"] = "任务"
self.GLineEdit_39.place(x=1050, y=0, width=208, height=116)
yscroll = Scrollbar(self.GLineEdit_39, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('任务名称', '完成度', '任务详情')
self.tvAllJob = ttk.Treeview(self.GLineEdit_39, columns=title, style='Treeview', show='headings', height=10,
yscrollcommand=yscroll.set)
yscroll.config(command=self.tvAllJob.yview)
self.tvAllJob.pack()
self.tvAllJob.column(title[0], width=55, anchor=CENTER)
self.tvAllJob.heading(title[0], text=title[0])
self.tvAllJob.column(title[1], width=50, anchor='w')
self.tvAllJob.heading(title[1], text=title[1])
self.tvAllJob.heading(title[2], text=title[2])
# self.tvAllJob.bind('<<TreeviewSelect>>', self.tvAllMapSelection)
self.GLineEdit_445 = tk.Text(root)
self.GLineEdit_445["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_445["font"] = ft
self.GLineEdit_445["fg"] = "#333333"
self.GLineEdit_445.place(x=1020, y=340, width=243, height=241)
yscroll = Scrollbar(self.GLineEdit_445, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('名称', '操作1', '操作2', 'op1_url', 'op1_ur2', 'zbinfo')
self.tvPackageInfo = ttk.Treeview(self.GLineEdit_445, columns=title, style='Treeview', show='headings',
height=20, yscrollcommand=yscroll.set)
yscroll.config(command=self.tvPackageInfo.yview)
self.tvPackageInfo.pack()
for i in range(0, len(title)):
self.tvPackageInfo.column(title[i], anchor=CENTER)
self.tvPackageInfo.heading(title[i], text=title[i])
self.tvPackageInfo.heading(i, text=title[i],
command=lambda _col=i: self.treeview_sort_column(self.tvPackageInfo, _col,
False))
self.tvPackageInfo.column(title[0], width=120, anchor=CENTER)
# self.tvPackageInfo.heading(title[0],text=title[0])
self.tvPackageInfo.column(title[1], width=50, anchor='w')
# self.tvPackageInfo.heading(title[1],text=title[1])
self.tvPackageInfo.column(title[2], width=50, anchor='w')
# self.tvPackageInfo.heading(title[2],text=title[2])
# self.tvPackageInfo.bind('<<TreeviewSelect>>', self.tvPackageInfoSelection)
self.tvPackageInfo.bind("<ButtonRelease-1>", self.tvPackage_leftButtonRelease)
# self.tvPackageInfo.bind("<MouseWheel>", self.tvPackage_on_MouseWheel)
self.GButton_947 = tk.Button(root)
self.GButton_947["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_947["font"] = ft
self.GButton_947["fg"] = "#000000"
self.GButton_947["justify"] = "center"
self.GButton_947["text"] = "清理包裹"
self.GButton_947["relief"] = "groove"
self.GButton_947.place(x=860, y=610, width=58, height=30)
self.GButton_947["command"] = self.GButton_947_command
self.GLineEdit_714 = tk.Entry(root)
self.GLineEdit_714["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_714["font"] = ft
self.GLineEdit_714["fg"] = "#333333"
self.GLineEdit_714["justify"] = "center"
self.GLineEdit_714["text"] = "30"
self.GLineEdit_714.place(x=650, y=650, width=51, height=30)
self.GLabel_364 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_364["font"] = ft
self.GLabel_364["fg"] = "#333333"
self.GLabel_364["justify"] = "center"
self.GLabel_364["text"] = "分钟"
self.GLabel_364.place(x=710, y=650, width=30, height=30)
self.GLineEdit_563 = tk.Entry(root)
self.GLineEdit_563["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_563["font"] = ft
self.GLineEdit_563["fg"] = "#333333"
self.GLineEdit_563["justify"] = "center"
self.GLineEdit_563["text"] = "920"
self.GLineEdit_563.place(x=740, y=650, width=60, height=30)
self.GLabel_403 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_403["font"] = ft
self.GLabel_403["fg"] = "#333333"
self.GLabel_403["justify"] = "center"
self.GLabel_403["text"] = "修为"
self.GLabel_403.place(x=800, y=650, width=35, height=30)
self.GButton_744 = tk.Button(root)
self.GButton_744["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_744["font"] = ft
self.GButton_744["fg"] = "#000000"
self.GButton_744["justify"] = "center"
self.GButton_744["text"] = "注册"
self.GButton_744["relief"] = "groove"
self.GButton_744.place(x=860, y=650, width=64, height=30)
self.GButton_744["command"] = self.GButton_744_command
self.GButton_32 = tk.Button(root)
self.GButton_32["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_32["font"] = ft
self.GButton_32["fg"] = "#000000"
self.GButton_32["justify"] = "center"
self.GButton_32["text"] = "装备"
self.GButton_32["relief"] = "groove"
self.GButton_32.place(x=1030, y=310, width=35, height=30)
self.GButton_32["command"] = self.GButton_32_command
self.GButton_793 = tk.Button(root)
self.GButton_793["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_793["font"] = ft
self.GButton_793["fg"] = "#000000"
self.GButton_793["justify"] = "center"
self.GButton_793["text"] = "药品"
self.GButton_793["relief"] = "groove"
self.GButton_793.place(x=1070, y=310, width=35, height=30)
self.GButton_793["command"] = self.GButton_793_command
self.GButton_217 = tk.Button(root)
self.GButton_217["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_217["font"] = ft
self.GButton_217["fg"] = "#000000"
self.GButton_217["justify"] = "center"
self.GButton_217["text"] = "道具"
self.GButton_217["relief"] = "groove"
self.GButton_217.place(x=1110, y=310, width=34, height=30)
self.GButton_217["command"] = self.GButton_217_command
self.GButton_889 = tk.Button(root)
self.GButton_889["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_889["font"] = ft
self.GButton_889["fg"] = "#000000"
self.GButton_889["justify"] = "center"
self.GButton_889["text"] = "符箓"
self.GButton_889["relief"] = "groove"
self.GButton_889.place(x=1150, y=310, width=35, height=30)
self.GButton_889["command"] = self.GButton_889_command
self.GButton_724 = tk.Button(root)
self.GButton_724["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_724["font"] = ft
self.GButton_724["fg"] = "#000000"
self.GButton_724["justify"] = "center"
self.GButton_724["text"] = "坊市"
self.GButton_724["relief"] = "groove"
self.GButton_724.place(x=1190, y=310, width=35, height=30)
self.GButton_724["command"] = self.GButton_724_command
self.GButton_210 = tk.Button(root)
self.GButton_210["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_210["font"] = ft
self.GButton_210["fg"] = "#000000"
self.GButton_210["justify"] = "center"
self.GButton_210["text"] = "排行"
self.GButton_210["relief"] = "groove"
self.GButton_210.place(x=1230, y=310, width=35, height=30)
self.GButton_210["command"] = self.GButton_210_command
self.GLabel_380 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_380["font"] = ft
self.GLabel_380["fg"] = "#333333"
self.GLabel_380["justify"] = "center"
self.GLabel_380["text"] = "当前地图"
self.GLabel_380.place(x=610, y=0, width=67, height=30)
self.GLineEdit_300 = tk.Entry(root)
self.GLineEdit_300["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_300["font"] = ft
self.GLineEdit_300["fg"] = "#333333"
self.GLineEdit_300["justify"] = "center"
self.GLineEdit_300["text"] = "当前地图"
self.GLineEdit_300.place(x=690, y=0, width=140, height=30)
self.GLineEdit_179 = tk.Entry(root)
self.GLineEdit_179["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_179["font"] = ft
self.GLineEdit_179["fg"] = "#333333"
self.GLineEdit_179["justify"] = "center"
self.GLineEdit_179["text"] = "当前场景玩家"
self.GLineEdit_179.place(x=10, y=370, width=146, height=195)
yscroll = Scrollbar(self.GLineEdit_179, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('玩家', '操作', 'url')
self.tvPlayerInThisPlace = ttk.Treeview(self.GLineEdit_179, columns=title, style='Treeview', show='headings',
height=10, yscrollcommand=yscroll.set)
yscroll.config(command=self.tvPlayerInThisPlace.yview)
self.tvPlayerInThisPlace.pack()
self.tvPlayerInThisPlace.column(title[0], width=85, anchor=CENTER)
self.tvPlayerInThisPlace.heading(title[0], text=title[0])
self.tvPlayerInThisPlace.column(title[1], width=40, anchor='w')
self.tvPlayerInThisPlace.heading(title[1], text=title[1])
self.tvPlayerInThisPlace.heading(title[2], text=title[2])
self.tvPlayerInThisPlace.bind('<<TreeviewSelect>>', self.tvMonsterSelection)
self.GLabel_953 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_953["font"] = ft
self.GLabel_953["fg"] = "#333333"
self.GLabel_953["justify"] = "center"
self.GLabel_953["text"] = "当前对象"
self.GLabel_953.place(x=170, y=30, width=54, height=30)
self.GLineEdit_824 = tk.Entry(root)
self.GLineEdit_824["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_824["font"] = ft
self.GLineEdit_824["fg"] = "#333333"
self.GLineEdit_824["justify"] = "center"
self.GLineEdit_824["text"] = "对象"
self.GLineEdit_824.place(x=230, y=30, width=152, height=30)
self.GListBox_981 = tk.Text(root)
self.GListBox_981["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GListBox_981["font"] = ft
self.GListBox_981["fg"] = "#333333"
self.GListBox_981.place(x=160, y=190, width=226, height=287)
self.GButton_779 = tk.Button(root)
self.GButton_779["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_779["font"] = ft
self.GButton_779["fg"] = "#000000"
self.GButton_779["justify"] = "center"
self.GButton_779["text"] = "操作1"
self.GButton_779["relief"] = "groove"
self.GButton_779.place(x=170, y=70, width=58, height=30)
self.GButton_779["command"] = self.GButton_779_command
self.GLineEdit_938 = tk.Entry(root)
self.GLineEdit_938["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_938["font"] = ft
self.GLineEdit_938["fg"] = "#333333"
self.GLineEdit_938["justify"] = "center"
self.GLineEdit_938["text"] = "世界地图"
self.GLineEdit_938.place(x=910, y=0, width=108, height=336)
yscroll = Scrollbar(self.GLineEdit_938, orient=VERTICAL)
yscroll.pack(side=RIGHT, fill=Y)
title = ('地图列表', '操作', 'url')
self.tvAllMap = ttk.Treeview(self.GLineEdit_938, columns=title, style='Treeview', show='headings', height=20,
yscrollcommand=yscroll.set)
yscroll.config(command=self.tvAllMap.yview)
self.tvAllMap.pack()
self.tvAllMap.column(title[0], width=85, anchor=CENTER)
self.tvAllMap.heading(title[0], text=title[0])
self.tvAllMap.column(title[1], width=40, anchor='w')
self.tvAllMap.heading(title[1], text=title[1])
self.tvAllMap.heading(title[2], text=title[2])
self.tvAllMap.bind('<<TreeviewSelect>>', self.tvAllMapSelection)
self.GButton_745 = tk.Button(root)
self.GButton_745["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_745["font"] = ft
self.GButton_745["fg"] = "#000000"
self.GButton_745["justify"] = "center"
self.GButton_745["text"] = "操作2"
self.GButton_745["relief"] = "groove"
self.GButton_745.place(x=240, y=70, width=61, height=30)
self.GButton_745["command"] = self.GButton_745_command
self.GButton_152 = tk.Button(root)
self.GButton_152["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=10)
self.GButton_152["font"] = ft
self.GButton_152["fg"] = "#000000"
self.GButton_152["justify"] = "center"
self.GButton_152["text"] = "操作3"
self.GButton_152["relief"] = "groove"
self.GButton_152.place(x=310, y=70, width=61, height=30)
self.GButton_152["command"] = self.GButton_152_command
self.GButton_14 = tk.Button(root)
self.GButton_14["bg"] = "#efefef"
ftGButton_14 = tkFont.Font(family='Times', size=8)
self.GButton_14["font"] = ftGButton_14
self.GButton_14["fg"] = "#000000"
self.GButton_14["justify"] = "center"
self.GButton_14["text"] = "技能1"
self.GButton_14["relief"] = "groove"
self.GButton_14.place(x=170, y=110, width=57, height=30)
self.GButton_14["command"] = self.GButton_14_command
self.GButton_645 = tk.Button(root)
self.GButton_645["bg"] = "#efefef"
ftGButton_645 = tkFont.Font(family='Times', size=8)
self.GButton_645["font"] = ftGButton_645
self.GButton_645["fg"] = "#000000"
self.GButton_645["justify"] = "center"
self.GButton_645["text"] = "技能2"
self.GButton_645["relief"] = "groove"
self.GButton_645.place(x=240, y=110, width=61, height=30)
self.GButton_645["command"] = self.GButton_645_command
self.GButton_141 = tk.Button(root)
self.GButton_141["bg"] = "#efefef"
ftGButton_141 = tkFont.Font(family='Times', size=8)
self.GButton_141["font"] = ftGButton_141
self.GButton_141["fg"] = "#000000"
self.GButton_141["justify"] = "center"
self.GButton_141["text"] = "技能3"
self.GButton_141["relief"] = "groove"
self.GButton_141.place(x=310, y=110, width=61, height=30)
self.GButton_141["command"] = self.GButton_141_command
self.GButton_581 = tk.Button(root)
self.GButton_581["bg"] = "#efefef"
ftGButton_581 = tkFont.Font(family='Times', size=8)
self.GButton_581["font"] = ftGButton_581
self.GButton_581["fg"] = "#000000"
self.GButton_581["justify"] = "center"
self.GButton_581["text"] = "药品1"
self.GButton_581["relief"] = "groove"
self.GButton_581.place(x=170, y=150, width=57, height=30)
self.GButton_581["command"] = self.GButton_581_command
self.GButton_405 = tk.Button(root)
self.GButton_405["bg"] = "#efefef"
ftGButton_405 = tkFont.Font(family='Times', size=8)
self.GButton_405["font"] = ftGButton_405
self.GButton_405["fg"] = "#000000"
self.GButton_405["justify"] = "center"
self.GButton_405["text"] = "药品2"
self.GButton_405["relief"] = "groove"
self.GButton_405.place(x=240, y=150, width=63, height=30)
self.GButton_405["command"] = self.GButton_405_command
self.GButton_125 = tk.Button(root)
self.GButton_125["bg"] = "#efefef"
ftGButton_125 = tkFont.Font(family='Times', size=8)
self.GButton_125["font"] = ftGButton_125
self.GButton_125["fg"] = "#000000"
self.GButton_125["justify"] = "center"
self.GButton_125["text"] = "药品3"
self.GButton_125["relief"] = "groove"
self.GButton_125.place(x=310, y=150, width=60, height=30)
self.GButton_125["command"] = self.GButton_125_command
self.GLabel_185 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
# self.GLabel_185["bg"] = "#cc0000"
self.GLabel_185["font"] = ft
self.GLabel_185["justify"] = "center"
self.GLabel_185["text"] = "hp"
self.GLabel_185.place(x=10, y=680, width=1253, height=15)
s = ttk.Style()
s.theme_use('winnative')
# win10环境下主题:('winnative','clam','alt','default','classic','vista','xpnative')
# 进度条颜色改变测试成功的是:'winnative','clam','alt','default','classic'
s.configure("green.Horizontal.TProgressbar", troughcolor='white', background='green')
self.progressbarHP = tkinter.ttk.Progressbar(self.GLabel_185, style="green.Horizontal.TProgressbar")
# progressbarOne.place(x=10,y=685,width=1253,height=20 )
self.progressbarHP.pack(expand=True, fill='both')
# 进度值最大值
self.progressbarHP['maximum'] = 1253
# 进度值初始值
self.progressbarHP['value'] = 800
self.GLabel_604 = tk.Label(root)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_604["font"] = ft
self.GLabel_604["fg"] = "#333333"
self.GLabel_604["justify"] = "center"
self.GLabel_604["text"] = "label"
self.GLabel_604.place(x=10, y=600, width=810, height=15)
s.configure("lightblue.Horizontal.TProgressbar", troughcolor='white', background='lightblue')
self.progressbarEXP = tkinter.ttk.Progressbar(self.GLabel_604, style="lightblue.Horizontal.TProgressbar")
self.progressbarEXP.pack(expand=True, fill='both')
self.progressbarEXP['maximum'] = 1253
self.progressbarEXP['value'] = 800
def treeview_sort_column(self, tv, col, reverse): # Treeview、列名、排列方式
l = [(tv.set(k, col), k) for k in tv.get_children('')]
l.sort(reverse=reverse) # 排序方式
# rearrange items in sorted positions
for index, (val, k) in enumerate(l): # 根据排序后索引移动
tv.move(k, '', index)
tv.heading(col, command=lambda: self.treeview_sort_column(tv, col, not reverse)) # 重写标题,使之成为再点倒序的标题
def tvPackage_leftButtonRelease(self, event):
# print(event.widget)
if str(event.widget) == ".!text3.!treeview": # 左键释放的是否为表格
if not self.status_auto_bybutton:
self.resetOPButtonName()
self.GListBox_981.delete(0.0, 'end')
items = event.widget.selection()
# title=('名称' , '操作1','操作2','op1_url','op1_ur2','zbinfo' )
try:
item = self.tvPackageInfo.item(items[0])['values']
name = item[0]
url_oprate = self.url_game + item[5]
self.setNowObject(name, url_oprate)
self.GButton_779['state'] = 'active'
except:
pass
for item in self.tvPackageInfo.selection(): # 取消表格选取
self.tvPackageInfo.selection_remove(item)
row = self.tvPackageInfo.identify_row(event.y) # 点击的行
column = self.tvPackageInfo.identify_column(event.x) # 点击的列
col = int(str(column).replace('#', '')) # 列号
item = self.tvPackageInfo.item(row)['values']
if item:
if "已装备" in item[1]:
return
if col == 2:
ttt = item[1]
url = item[3]
self.NowObject_run(url)
elif col == 3:
ttt = item[2]
url = item[4]
self.NowObject_run(url)
def tvPackageInfoSelection1(self, event):
if not self.status_auto_bybutton:
self.resetOPButtonName()
self.GListBox_981.delete(0.0, 'end')
items = event.widget.selection()
# title=('名称' , '操作1','操作2','op1_url','op1_ur2','zbinfo' )
item = self.tvPackageInfo.item(items[0])['values']
name = item[0]
url_oprate = self.url_game + item[5]
self.setNowObject(name, url_oprate)
self.GButton_779['state'] = 'active'
def tvNpcSelection(self, event):
items = event.widget.selection()
item = self.tvNpc.item(items[0])['values']
name = item[0]
url_oprate = self.url_game + item[2]
# self.refreshGame(url_oprate)
self.setNowObject(name, url_oprate)
self.GButton_779['state'] = 'active'
def tvAllMapSelection(self, event):
items = event.widget.selection()
item = self.tvAllMap.item(items[0])['values']
name = item[0]
url_oprate = self.url_game + item[2]
self.refreshGame(url_oprate)
def tvMonsterSelection(self, event):
# self.GLineEdit_companyname.delete(0,'end')
# self.resetOPButtonName()
if not self.status_auto_bybutton:
self.resetOPButtonName()
items = event.widget.selection()
item = self.tvMonster.item(items[0])['values']
name = item[0]
url_oprate = self.url_game + item[2]
# self.GLineEdit_companyname.insert(0,item[1])
self.setNowObject(name, url_oprate)
self.GButton_779['state'] = 'active'
def setNowObject(self, name, href):
self.GLineEdit_824.delete(0, 'end')
self.GLineEdit_824.insert(0, name)
# self._log(href)
# links = self.getHrefLabelLinks(req)
url = href
# self._log(url)
if self.needDecode:
url = self.DecodeParam(href)
types = re.search("cmd=cmd=.*?&", url)
type = None
if types:
type = types.group(0)[8:-1]
if not type:
return
# self._log(type)
req = self._requests('get', href, decode_level=1)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//body/text()")
links = []
self.GListBox_981.delete(0.0, 'end')
self.GButton_779['text'] = '暂无功能'
for row in table_element:
text = row.strip().replace('\n', '').replace('\r\n', '')
if len(text) > 0:
if "掉落" in text or '装备信息' in text:
self.GListBox_981.insert('end', "\n" + text + "\n")
else:
self.GListBox_981.insert('end', text + "\n")
table_element = html_etree.xpath("//body//div/a/text()")
for row in table_element:
text = row.strip().replace('\n', '').replace('\r\n', '')
if len(text) > 0:
self.GListBox_981.insert('end', row.strip() + "\n")
table_element = html_etree.xpath("//a")
for row in table_element:
if row.text == '攻击':
self.GButton_779['text'] = '查看'
self.NowObject_op1 = self.url_game + row.attrib["href"]
# self._log(self.NowObject_op1)
links = []
try:
links = self.getHrefLabelLinks(req)
except Exception as me:
print('1257')
print(me)
# links.append({"text":row.text,"href":href,"type":type,"dhref":dhref})
icount_task = 0
for link in links:
if link['text'] == "返回游戏":
break
if link['type'] == 'npc':
self.GListBox_981.insert('end', f'{"-" * 53}' + "\n")
self.GListBox_981.insert('end', link['text'] + "\n")
if 'canshu=rehp' in link['href']:
self.GButton_779['text'] = '生命恢复'
self.NowObject_op1 = self.url_game + link['dhref']
elif 'canshu=gogoumai' in link['href']:
self.GButton_779['text'] = '购买药品'
self.NowObject_op1 = self.url_game + link['dhref']
else:
self.GButton_779['text'] = '暂无功能'
elif '=task&' in link['href']:
icount_task += 1
if icount_task == 1:
self.GButton_14['text'] = link['text']
self.url_pve_usejn1 = link['dhref']
elif icount_task == 2:
self.GButton_645['text'] = link['text']
self.url_pve_usejn2 = link['dhref']
else:
self.GButton_141['text'] = link['text']
self.url_pve_usejn3 = link['dhref']
elif link['type'] == 'upzb':
if '&upsx=zbgj&' in link['href']:
self.GButton_779['text'] = '强化攻击'
self.NowObject_op1 = self.url_game + link['dhref']
if '&upsx=zbfy&' in link['href']:
self.GButton_745['text'] = '强化防御'
self.NowObject_op2 = link['dhref']
if '&upsx=zbhp&' in link['href']:
self.GButton_152['text'] = '强化气血'
self.NowObject_op3 = link['dhref']
elif link['type'] == 'setzbwz':
if '&zbwz=1&' in link['href']:
self.GButton_14['text'] = '装备武器'
self.url_pve_usejn1 = link['dhref']
elif '&zbwz=2&' in link['href']:
self.GButton_645['text'] = '装备头饰'
self.url_pve_usejn2 = link['dhref']
elif '&zbwz=3&' in link['href']:
self.GButton_141['text'] = '装备衣服'
self.url_pve_usejn3 = link['dhref']
elif '&zbwz=4&' in link['href']:
self.GButton_581['text'] = '装备腰带'
self.url_pve_useyp1 = link['dhref']
elif '&zbwz=5&' in link['href']:
self.GButton_405['text'] = '装备首饰'
self.url_pve_useyp2 = link['dhref']
elif '&zbwz=6&' in link['href']:
self.GButton_125['text'] = '装备鞋子'
self.url_pve_useyp3 = link['dhref']
elif link['type'] == 'ypinfo':
if "&canshu=setyp1" in link['href']:
self.GButton_581['text'] = '装备药品1'
self.url_pve_useyp1 = link['dhref']
elif "&canshu=setyp2" in link['href']:
self.GButton_405['text'] = '装备药品2'
self.url_pve_useyp2 = link['dhref']
elif "&canshu=setyp3" in link['href']:
self.GButton_125['text'] = '装备药品3'
self.url_pve_useyp3 = link['dhref']
elif "&canshu=useyp" in link['href']:
self.GButton_779['text'] = '吃药'
self.NowObject_op1 = self.url_game +link['dhref']
def GButton_779_command(self): # 查看血量 野怪详情 #操作一
if self.NowObject_op1:
req = self._requests('get', self.NowObject_op1, decode_level=1)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//body//text()")
tempstr = ""
links = self.getHrefLabelLinks(req)
self.analysisButtonFight(links)
for row in table_element:
rowstrip = row.strip().replace('\n', '').replace('\r\n', '')
if len(rowstrip) > 0:
if rowstrip == "==战斗==":
self.GListBox_981.insert('end', rowstrip + "\n")
userHP = re.findall("气血.*?<br", req)[1][4:-4] # .group(1)[:-3]
html_etree_hp = etree.HTML(userHP)
table_element_hp = html_etree_hp.xpath("//div//text()")
hp = table_element_hp[0] + "/" + table_element_hp[1]
self._log("当前HP: " + hp)
self.GLineEdit_556.delete(0, 'end')
self.GLineEdit_556.insert(0, hp)
self.status_pve = True
# 监控
nowhp = int(table_element_hp[0]) # 血量监控
allhp = int(table_element_hp[1])
# 进度值最大值
self.progressbarHP['maximum'] = allhp
# 进度值初始值
self.progressbarHP['value'] = nowhp
dorphp = allhp - nowhp
#######################自动吃药判断#########################
self.eatDrugs(dorphp, allhp)
elif rowstrip == "===================":
self.GListBox_981.insert('end', tempstr + "\n")
tempstr = ""
self.GListBox_981.insert('end', rowstrip + "\n")
elif rowstrip == '逃跑':
continue
elif rowstrip == '信息:来来来 便宜':
self.GListBox_981.insert('end', f'{"-" * 53}' + "\n")
break
else:
tempstr = tempstr + " " + rowstrip
self.GListBox_981.insert('end', tempstr + "\n")
def analysisButtonFight(self, links):
i_pve = 0;
i_pvegj = 0
for link in links:
if link['text'] == '攻击':
self.GButton_745['text'] = '攻击'
self.NowObject_op2 = link["dhref"]
self.NowObject_op3 = link["dhref"]
# self._log(self.NowObject_op1)
self.GButton_745['state'] = 'active'
self.GButton_152['text'] = '连续攻击'
if link['type'] == 'pve':
i_pve += 1
if i_pve == 1:
self.GButton_581['text'] = link['text']
self.url_pve_useyp1 = link['dhref']
elif i_pve == 2:
self.GButton_405['text'] = link['text']
self.url_pve_useyp2 = link['dhref']
else:
self.GButton_125['text'] = link['text']
self.url_pve_useyp3 = link['dhref']
if link['type'] == 'pvegj' and 'canshu=usejn' in link['href']:
i_pvegj += 1
if i_pvegj == 1:
self.GButton_14['text'] = link['text']
self.url_pve_usejn1 = link['dhref']
elif i_pvegj == 2:
self.GButton_645['text'] = link['text']
self.url_pve_usejn2 = link['dhref']
else:
self.GButton_141['text'] = link['text']
self.url_pve_usejn3 = link['dhref']
if link['type'] == 'npc':
self.GButton_745['state'] = 'active'
if 'ypid=6' in link['href']: # 还原丹
self.GButton_745['text'] = '还原丹1个'
self.GButton_152['text'] = '还原丹10个'
if 'ypcount=1&' in link['href']:
self.NowObject_op2 = link['dhref']
else:
self.NowObject_op3 = link['dhref']
elif 'ypid=7' in link['href']: # 回血散
self.GButton_14['text'] = '回血散1个'
self.GButton_645['text'] = '回血散10个'
if 'ypcount=1&' in link['href']:
self.url_pve_usejn1 = link['dhref']
else:
self.url_pve_usejn2 = link['dhref']
elif 'ypid=8' in link['href']: # 回春汤
self.GButton_141['text'] = '回春汤1个'
self.GButton_581['text'] = '回春汤10个'
if 'ypcount=1&' in link['href']:
self.url_pve_usejn3 = link['dhref']
else:
self.url_pve_useyp1 = link['dhref']
elif 'ypid=9' in link['href']: # 复伤丹
self.GButton_405['text'] = '复伤丹1个'
self.GButton_125['text'] = '复伤丹10个'
if 'ypcount=1&' in link['href']:
self.url_pve_useyp2 = link['dhref']
else:
self.url_pve_useyp3 = link['dhref']
else:
pass
if link['type'] == 'ypinfo':
self.GListBox_981.insert('end', link['text'] + " ")
url = self.url_game + link['dhref']
req = self._requests('get', url, decode_level=1)
hp = re.search("气血.*?<br", req).group(0)[:-3]
self.GListBox_981.insert('end', hp + "\n")
# self.GButton_9_command()
def GButton_745_command(self): # 发起进攻 #操作2
if self.NowObject_op2:
self.status_auto_bybutton = False
self.NowObject_run(self.NowObject_op2)
def GButton_9_command(self):
self.refreshGame(self.NowPosition)
def GButton_720_command(self): # 向北
url_game = self.url_game + self.url_navN
self.refreshGame(url_game)
def GButton_126_command(self): # 向西
url = self.url_navW
url_game = self.url_game + self.url_navW
self.refreshGame(url_game)
def GButton_750_command(self): # 向东
url_game = self.url_game + self.url_navE
self.refreshGame(url_game)
def GButton_181_command(self): # 向南
url_game = self.url_game + self.url_navS
self.refreshGame(url_game)
def GButton_673_command(self): # 武器
url_game = self.url_weapon1
self.NowObject_run(url_game)
def GButton_928_command(self): # 头饰
url_game = self.url_weapon2
self.NowObject_run(url_game)
def GButton_299_command(self): # 衣服
url_game = self.url_weapon3
self.NowObject_run(url_game)
def GButton_682_command(self): # 腰带
url_game = self.url_weapon4
self.NowObject_run(url_game)
def GButton_289_command(self): # 首饰
url_game = self.url_weapon5
self.NowObject_run(url_game)
def GButton_503_command(self): # 鞋子
url_game = self.url_weapon6
self.NowObject_run(url_game)
def GCheckBox_967_command(self):
print("command")
def GButton_107_command(self):
username = self.GLineEdit_363.get().strip()
userpass = self.GLineEdit_127.get().strip()
url_login = self.url_base
data_login = {"username": username, "userpass": userpass, "submit": "登陆"}
req = self._requests('post', url_login, decode_level=3, data=data_login)
refresh = None
url_refresh = None
try:
refresh = req.headers["refresh"]
except:
self._log(f"账号{username}登陆失败,请检查账号或密码")
return
if not refresh: # 登陆成功
self._log(f"账号{username}登陆失败,请检查账号或密码")
return
url_split = refresh.split("url=")
if len(url_split) != 2:
self._log(f"服务器返回数据出错,退出登陆")
return
self._log(f"账号{username}登陆成功")
url_refresh = url_split[1]
url_game = self.url_base + url_refresh
req = self._requests('get', url_game, decode_level=3)
if 'type="hidden" name="token"' in req.text: # 创建角色
self._log(f"请创建角色后再次进入游戏")
self.createrole(req.text)
return
refresh = None
try:
refresh = req.headers["refresh"] # 取用户信息成功跳转上次玩家地图
except:
self._log(f"服务器返回数据出错,请联系管理员")
return
if not refresh:
self._log(f"服务器返回数据出错,请联系管理员")
return
self._log(f"获取用户信息成功")
url_split = refresh.split("url=")
if len(url_split) != 2:
self._log(f"进入寻仙世界失败,请联系管理员")
return
url_refresh = url_split[1]
url_game = self.url_game + url_refresh
self._log(f"欢迎进入寻仙世界")
self.refreshGame(url_game)
self.NowPosition = url_game
def refreshGame(self, url_game):
self.NowPosition = url_game
if not self.status_auto_bybutton:
self.resetOPButtonName()
req = self._requests('get', url_game, decode_level=1)
if '你已经重伤请治疗' in req:
self._log('你已经重伤请治疗')
return
html_etree = etree.HTML(req)
try:
mapname = re.search("当前地图:.*?<a", req).group(0)[5:-2]
jobs = re.search(">任务.*?</a>", req, re.S).group(0)[1:-4]
self.GLineEdit_300.delete(0, 'end')
self.GLineEdit_300.insert(0, mapname)
self.GButton_9['text'] = mapname
links = self.getHrefLabelLinks(req)
self.analysisStatus(links, jobs)
mission = None
mission = re.search("images/wen.gif.*?</a>", req, re.S)
if mission:
pass
else:
mission = re.search("images/tan.gif.*?</a>", req, re.S)
if mission:
findname = mission.group(0)
findname = re.search("<a href=.*?</a>", findname, re.S).group(0)
findname = re.search(">.*?<", findname, re.S).group(0)[1:-1]
t = self.tvNpc.get_children()
icount = 0;
for i in t:
value1 = self.tvNpc.item(i, 'values')
for v in value1:
if v == findname:
icount += 1
self.tvNpc.set(i, 1, "新任务")
break
if icount > 0:
break
else:
# print("noneeee")
pass
# 公共聊天处理
# table_element = html_etree.xpath('//*[@id="ltmsg"]')
# for row in table_element:
# self.GLineEdit_252.insert('end',row.text+"\n")
except Exception as me:
# print('1612')
# print(me)
pass
table_element = html_etree.xpath("//a")
href = None
for row in table_element:
text = row.text
href = row.attrib["href"]
url = href
if self.needDecode:
url = self.DecodeParam(url)
if text == '突破' and 'canshu=tupo' in url:
break
if href:
req = self._requests('get', self.url_game + href, decode_level=1)
if "灵石不足" in req:
value = re.search(f"突破需要灵石.*?<a", req).group(0)[:-2]
self._log(f"突破失败,灵石不足!{value}")
if "突破成功" in req:
self._log("突破成功!")
self.refreshGame(url_game)
try:
self.tvMonster.selection_set('Item001')
except:
pass
def resetOPButtonName(self):
self.GButton_779['text'] = '操作1'
self.GButton_745['text'] = '操作2'
self.GButton_152['text'] = '操作3'
self.GButton_14['text'] = '技能1'
self.GButton_645['text'] = '技能2'
self.GButton_141['text'] = '技能3'
self.GButton_581['text'] = '药品1'
self.GButton_405['text'] = '药品2'
self.GButton_125['text'] = '药品3'
# self.NowObject_op1 =None
# self.NowObject_op2 =None
# self.NowObject_op3 =None
# self.url_op1 = None
# self.url_op2 = None
# self.url_op3 = None
# self.url_pve_useyp1 =None
# self.url_pve_useyp2 =None
# self.url_pve_useyp3 =None
# self.url_pve_usejn1 =None
# self.url_pve_usejn2 =None
# self.url_pve_usejn3 =None
def TestSched(self):
while self.status_autofighting:
time.sleep(0.1)
# self.tvMonster.selection_set('Item001') #刷新第一个怪物
time.sleep(0.1)
self.GButton_779_command() # 查看
time.sleep(0.1)
self.GButton_152_command() # 连续攻击
def GButton_728_command(self):
self.status_auto_bybutton = not self.status_auto_bybutton
self.status_autofighting = not self.status_autofighting
if self.status_autofighting:
self.GButton_728['text'] = '自动战斗'
else:
self.GButton_728['text'] = '停止战斗'
try:
obj1 = threading.Thread(target=self.TestSched, args=())
obj1.setDaemon(True)
obj1.start()
except Exception as me:
print('1683')
print(me)
def getHrefLabelLinks(self, req):
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
links = []
for row in table_element:
if row.text is None:
continue
href = row.attrib["href"]
dhref = href
if self.needDecode:
href = self.DecodeParam(href)
types = re.search("cmd=cmd=.*?&", href)
type = None
if types is None:
continue
else:
type = types.group(0)[8:-1]
links.append({"text": row.text, "href": href, "type": type, "dhref": dhref})
return links
def analysisStatus(self, links, jobs):
self.reset(self.tvMonster)
url = self.getStatusUrl(links, "符箓")
if url:
self.url_package_skills = url
url = self.getStatusUrl(links, "状态")
if url:
self.setStatusUserInfo(url)
if not self.status_auto_bybutton:
self.reset(self.tvNpc)
self.reset(self.tvPlayerInThisPlace)
self.reset(self.tvPackageInfo)
url = self.getStatusUrl(links, "包裹")
if url:
self.url_package = url
self.url_package_weapons = url
self.setStatusPackageDrugsInfo(url)
self.treeview_sort_column(self.tvPackageInfo, 0, True)
url = self.getStatusUrl(links, "查看地图")
if url:
self.setAllMap(url)
url = self.getStatusUrl(links, "排行")
if url:
self.setTopPlayer(url)
url = self.getStatusUrl(links, jobs)
if url:
self.setJobList(url)
navs = []
for link in links:
if link['type']:
type = link['type']
if type == "npc" and not self.status_auto_bybutton:
self.tvNpc.insert('', 'end', values=(link['text'], "查看", link['dhref']))
elif type == "getginfo": # 野怪
id_tv = self.next_id()
self.tvMonster.insert('', 'end', id=id_tv, values=(link['text'], "查看", link['dhref']))
elif type == "gomid": # 导航
navs.append(link)
elif type == "getplayerinfo" and not self.status_auto_bybutton: # 导航
self.tvPlayerInThisPlace.insert('', 'end', values=(link['text'], "查看", link['dhref']))
self.setNav(navs)
# self.tvMonster.selection_set('I001') #刷新第一个怪物
def next_id(self):
global counter_tv
counter_tv += 1
return "Item%.3d" % counter_tv
def reset(self, o):
global counter_tv
for item in o.get_children():
o.delete(item)
counter_tv = 0
def setAllMap(self, url):
url = self.url_game + url
req = self._requests('get', url, decode_level=1)
self.reset(self.tvAllMap)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
for row in table_element:
href = row.attrib["href"]
if row.text == '返回上一页':
break
self.tvAllMap.insert('', 'end', values=(row.text, "查看", href))
self.url_safyhouse = href
def setTopPlayer(self, url):
url = self.url_game + url
req = self._requests('get', url, decode_level=1)
self.reset(self.tvTopPlayer)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
for row in table_element:
href = row.attrib["href"]
if row.text == '返回游戏':
break
self.tvTopPlayer.insert('', 'end', values=(row.text, "查看", href))
def setJobList(self, url):
url = self.url_game + url
req = self._requests('get', url, decode_level=1)
self.reset(self.tvAllJob)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
for row in table_element:
href = row.attrib["href"]
if row.text == '返回游戏':
break
# self.tvAllJob.insert('', 'end', values=(row.text,"查看",href))
url = self.url_game + href
req = self._requests('get', url, decode_level=1)
try:
content = re.search(":<br/>.*?<br/>", req, re.S).group(0)[6:-5]
content = content.replace("\r\n", "").replace(" ", "")
workdone = re.search("进度.*?<br/>", req, re.S).group(0)[3:-5]
self.tvAllJob.insert('', 'end', values=(row.text, workdone, content))
except:
pass
def setNav(self, navs):
N = False
S = False
W = False
E = False
for link in navs:
if "←" in link['text']:
W = True
self.GButton_126["text"] = link['text']
self.GButton_126["state"] = 'active'
self.url_navW = link['dhref']
if "→" in link['text']:
E = True
self.GButton_750["text"] = link['text']
self.GButton_750["state"] = 'active'
self.url_navE = link['dhref']
if "↓" in link['text']:
S = True
self.GButton_181["text"] = link['text']
self.GButton_181["state"] = 'active'
self.url_navS = link['dhref']
if "↑" in link['text']:
N = True
self.GButton_720["text"] = link['text']
self.GButton_720["state"] = 'active'
self.url_navN = link['dhref']
if not N:
self.GButton_720["state"] = 'disable'
self.GButton_720["text"] = '此路不通'
if not S:
self.GButton_181["state"] = 'disable'
self.GButton_181["text"] = '此路不通'
if not E:
self.GButton_750["state"] = 'disable'
self.GButton_750["text"] = '此路不通'
if not W:
self.GButton_126["state"] = 'disable'
self.GButton_126["text"] = '此路不通'
def getStatusUrl(self, links, callName):
url = ''
for link in links:
if link["text"] == callName:
url = link["dhref"]
return url
def setStatusPackageDrugsInfo(self, url, count=0):
url = self.url_game + url
req = self._requests('get', url, decode_level=1)
# self.reset(self.tvPackageInfo)
# for i in range(1,10):
# str = f'\[{i}\]'
# str_showItem = self.getPackageItem(req,str)
# if str_showItem:
# # self.tvPackageInfo.insert('', 'end', values=(str_show,"workdone","content"))
# self.tvPackageInfo.insert('', 'end', values=str_showItem)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
count += 1
self.searchPackageContent(table_element, count)
def searchPackageContent(self, table_element, count):
l_list = []
for row in table_element:
if row.text == "返回游戏":
break
elif row.text == "上一页":
continue
elif row.text == "下一页":
if count <= 4:
url_next = row.attrib["href"]
self.setStatusPackageDrugsInfo(url_next, count)
break
else:
break
elif row.text == "道具":
self.url_package_items = row.attrib["href"]
elif row.text == "药品":
self.url_package_drugs = row.attrib["href"]
elif row.text == "符箓":
self.url_package_skills = row.attrib["href"]
url = row.attrib["href"]
dhref = url
if self.needDecode:
url = self.DecodeParam(url)
l_list.append(json.loads(
'{\"' + re.sub('(?<!&)&(?!&)', '\",\"', re.sub('(?<!=)=(?!=|&)', '\":\"', url[5:])) + '\",\"url\":\"'
+ url + "\",\"dhref\":\"" + dhref + "\",\"urltext\":\"" + row.text + '\"}'))
if len(l_list) < 1:
return
# print(l_list)
self.analysisPackage(l_list)
def analysisPackage(self, l_list):
for item in l_list:
if item["cmd"] == 'chakanzb':
zbnowid = item["zbnowid"]
zbinfo = item["dhref"]
zb_op1 = None
zb_op1_url = None
zb_op2 = None
zb_op2_url = None
for itemn in l_list:
try:
if itemn["zbnowid"] == zbnowid and itemn["urltext"] == '卖出':
zb_op1 = '卖出'
zb_op1_url = itemn["dhref"]
if itemn["zbnowid"] == zbnowid and itemn["urltext"] == '分解':
zb_op2 = '分解'
zb_op2_url = itemn["dhref"]
except:
pass
if zb_op1:
self.tvPackageInfo.insert('', 'end',
values=(item["urltext"], zb_op1, zb_op2, zb_op1_url, zb_op2_url, zbinfo))
else:
self.tvPackageInfo.insert('', 'end', values=(item["urltext"], '已装备', '', '', '', zbinfo))
def getPackageDrugsInfoReqValue(self, req, text):
l = len(text)
try:
value = re.search(f"{text}\..*?</a>", req).group(0)[l - 1:]
if value.startswith("<a"):
value = re.search(">.*?</a>", value).group(0)[1:-4]
return value
except Exception as me:
print('1949')
print(me)
return None
def setStatusUserInfo(self, url):
url = self.url_game + url
req = self._requests('get', url, decode_level=1)
self.setStatusUserInfo_byreq(req)
def setStatusUserInfo_byreq(self, req):
self.GButton_673['state'] = 'disable' # 武器
self.GButton_928['state'] = 'disable' # 头饰
self.GButton_299['state'] = 'disable' # 衣服
self.GButton_682['state'] = 'disable' # 腰带
self.GButton_289['state'] = 'disable' # 首饰
self.GButton_503['state'] = 'disable' # 鞋子
self.setEditText(self.GLineEdit_458, self.getReqValue(req, '昵称'))
self.setEditText(self.GLineEdit_546, self.getReqValue(req, '境界'))
self.setEditText(self.GLineEdit_644, self.getReqValue(req, '等级'))
self.setEditText(self.GLineEdit_268, self.getReqValue(req, '修为'))
self.setEditText(self.GLineEdit_998, self.getReqValue(req, '灵石'))
self.setEditText(self.GLineEdit_789, self.getReqValue(req, '极品灵石'))
self.setEditText(self.GLineEdit_556, self.getReqValue(req, '气血'))
self.setEditText(self.GLineEdit_634, self.getReqValue(req, '攻击'))
self.setEditText(self.GLineEdit_875, self.getReqValue(req, '防御'))
self.setEditText(self.GLineEdit_588, self.getReqValue(req, '暴击'))
self.setEditText(self.GLineEdit_323, self.getReqValue(req, '吸血'))
self.setEditText(self.GLineEdit_129, self.getReqValue(req, '武器'))
self.setEditText(self.GLineEdit_810, self.getReqValue(req, '头饰'))
self.setEditText(self.GLineEdit_708, self.getReqValue(req, '衣服'))
self.setEditText(self.GLineEdit_554, self.getReqValue(req, '腰带'))
self.setEditText(self.GLineEdit_809, self.getReqValue(req, '首饰'))
self.setEditText(self.GLineEdit_31, self.getReqValue(req, '鞋子'))
exp = self.getReqValue(req, '修为')
hp = self.getReqValue(req, '气血')
exps = exp.split('/')
nowexp = int(exps[0])
allexp = int(exps[1])
self.progressbarEXP['maximum'] = allexp
self.progressbarEXP['value'] = nowexp
hps = hp.split('/') # 血量监控
nowhp = int(hps[0])
allhp = int(hps[1])
# 进度值最大值
self.progressbarHP['maximum'] = allhp
# 进度值初始值
self.progressbarHP['value'] = nowhp
def getReqValue(self, req, text):
l = len(text)
value = re.search(f"{text}:.*?<br/>", req).group(0)[l + 1:-5]
if value and value.startswith("<a"):
html_etree = etree.HTML(value)
table_element = html_etree.xpath("//a")
url = None
dhref = None
for row in table_element:
if row.text == "卸下":
dhref = row.attrib['href']
if self.needDecode:
url = self.DecodeParam(dhref)
else:
url = dhref
else:
value = row.text
if url:
if "&zbwz=1&" in url:
self.url_weapon1 = dhref
self.GButton_673['state'] = 'normal' # 武器
elif "&zbwz=2&" in url:
self.url_weapon2 = dhref
self.GButton_928['state'] = 'active' # 头饰
elif "&zbwz=3&" in url:
self.url_weapon3 = dhref
self.GButton_299['state'] = 'active' # 衣服
elif "&zbwz=4&" in url:
self.url_weapon4 = dhref
self.GButton_682['state'] = 'active' # 腰带
elif "&zbwz=5&" in url:
self.url_weapon5 = dhref
self.GButton_289['state'] = 'active' # 首饰
elif "&zbwz=6&" in url:
self.url_weapon6 = dhref
self.GButton_503['state'] = 'active' # 鞋子
return value
def setEditText(self, _GLineEdit, value):
if not value:
value = "空"
_GLineEdit.delete(0, 'end')
_GLineEdit.insert(0, value)
def GButton_947_command(self): # 清理装备
# print(self.NowPosition)
if self.url_package:
try:
obj1 = threading.Thread(target=self.TestcleanItem, args=())
obj1.setDaemon(True)
obj1.start()
except Exception as me:
print('2063')
print(me)
def TestcleanItem(self):
p_list = []
plist = self.cleanPackage(self.url_package, p_list)
itemData = {}
for row in plist:
if row['cmd'] == 'chakanzb':
name = row['urltext']
zbnowid = row['zbnowid']
itemData.setdefault(name, {"count": 0})
itemData[name]['count'] += 1
for row in itemData:
if int(itemData[row]['count']) > 6: # 装备多于6个
count_needsell = itemData[row]['count']
count_sell = 0
self.GListBox_981.delete(0.0, 'end')
self.GListBox_981.insert('end', f'{row},总数:{count_needsell}')
for row2 in plist:
if row2['cmd'] == 'chakanzb' and row2['urltext'] == row: # 跟据装备名找装备编号
zbnowid = row2['zbnowid']
for row3 in plist: # 跟据装备编号 找卖出URL
if row3['cmd'] == 'getbagzb' and row3['zbnowid'] == zbnowid and row3['canshu'] == 'maichu':
# if row3['cmd'] == 'delezb' and row3['zbnowid'] == zbnowid : 分解
url = row3['dhref']
if count_sell < count_needsell - 6:
count_sell += 1
# 执行URL
self.GLineEdit_10.delete(0, 'end')
self.GLineEdit_10.insert('end', f'{row},总数:{count_needsell} 卖出:{count_sell}')
self._requests("get", self.url_game + url)
def cleanPackage(self, url_package, p_list=[], count=0):
url = self.url_game + url_package
req = self._requests('get', url, decode_level=1)
html_etree = etree.HTML(req)
table_element = html_etree.xpath("//a")
count += 1
self._log(f'装备栏第{count}页')
plist = self.researchPackageContent(table_element, p_list, count)
return plist
def researchPackageContent(self, table_element, p_list, count):
for row in table_element:
if row.text == "返回游戏":
break
if row.text == "下一页":
url_next = row.attrib["href"]
self.cleanPackage(url_next, p_list, count)
break
if row.text == "上一页":
continue
url = row.attrib["href"]
dhref = url
if self.needDecode:
url = self.DecodeParam(url)
p_list.append(json.loads(
'{\"' + re.sub('(?<!&)&(?!&)', '\",\"', re.sub('(?<!=)=(?!=|&)', '\":\"', url[5:])) + '\",\"url\":\"'
+ url + "\",\"dhref\":\"" + dhref + "\",\"urltext\":\"" + row.text + '\"}'))
return p_list
def GButton_744_command(self): # 注册
print("GButton_744_command")
window_sign_up = tk.Toplevel(root)
# setting title
window_sign_up.title("注册")
# setting window size
width = 895
height = 329
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
window_sign_up.geometry(alignstr)
window_sign_up.resizable(width=False, height=False)
self.Frame_634 = tk.Frame(window_sign_up)
self.Frame_634.place(x=10, y=10, width=472, height=310)
self.canvas = tk.Canvas(self.Frame_634, bg='SystemButtonFace', width=472, height=310) # SystemButtonFace
global image
image = PhotoImage(file="xunxian.png")
self.canvas.create_image(232, 155, image=image)
self.canvas.pack()
self.GLabel_831 = tk.Label(window_sign_up)
# self.GLabel_831["bg"] = "#00ced1"
ft = tkFont.Font(family='黑体', size=11)
self.GLabel_831["font"] = ft
self.GLabel_831["fg"] = "#333333"
self.GLabel_831["justify"] = "center"
self.GLabel_831["text"] = "天下风云出我辈,一入江湖岁月催 \n\n皇图霸业谈笑中,不胜人生一场醉 \n\n提剑跨骑挥鬼雨,白骨如山鸟惊飞 \n\n尘事如潮人如水,只叹江湖几人回 \n"
self.GLabel_831.place(x=490, y=10, width=398, height=137)
self.GLineEdit_702 = tk.Entry(window_sign_up)
self.GLineEdit_702["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_702["font"] = ft
self.GLineEdit_702["fg"] = "#333333"
self.GLineEdit_702["justify"] = "center"
self.GLineEdit_702["text"] = "account"
self.GLineEdit_702.place(x=610, y=160, width=239, height=30)
self.GLabel_268 = tk.Label(window_sign_up)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_268["font"] = ft
self.GLabel_268["fg"] = "#333333"
self.GLabel_268["justify"] = "center"
self.GLabel_268["text"] = "账号"
self.GLabel_268.place(x=500, y=160, width=64, height=30)
self.GLabel_500 = tk.Label(window_sign_up)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_500["font"] = ft
self.GLabel_500["fg"] = "#333333"
self.GLabel_500["justify"] = "center"
self.GLabel_500["text"] = "密码"
self.GLabel_500.place(x=500, y=200, width=62, height=30)
self.GLabel_104 = tk.Label(window_sign_up)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_104["font"] = ft
self.GLabel_104["fg"] = "#333333"
self.GLabel_104["justify"] = "center"
self.GLabel_104["text"] = "确认密码"
self.GLabel_104.place(x=500, y=240, width=70, height=30)
self.GLineEdit_703 = tk.Entry(window_sign_up)
self.GLineEdit_703["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_703["font"] = ft
self.GLineEdit_703["fg"] = "#333333"
self.GLineEdit_703["justify"] = "center"
self.GLineEdit_703["text"] = "password"
# self.GLineEdit_703["show"] = "*"
self.GLineEdit_703.place(x=610, y=200, width=240, height=32)
self.GLineEdit_54 = tk.Entry(window_sign_up)
self.GLineEdit_54["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_54["font"] = ft
self.GLineEdit_54["fg"] = "#333333"
self.GLineEdit_54["justify"] = "center"
self.GLineEdit_54["text"] = "password2"
# self.GLineEdit_54["show"] = "*"
self.GLineEdit_54.place(x=610, y=240, width=239, height=30)
self.GButton_916 = tk.Button(window_sign_up)
self.GButton_916["bg"] = "#f0f0f0"
ft = tkFont.Font(family='Times', size=10)
self.GButton_916["font"] = ft
self.GButton_916["fg"] = "#000000"
self.GButton_916["justify"] = "center"
self.GButton_916["text"] = "注册"
self.GButton_916.place(x=730, y=280, width=119, height=30)
self.GButton_916["command"] = self.GButton_916_command
self.GLabel_764 = tk.Label(window_sign_up) # 显示回返
self.GLabel_764["bg"] = "#00ced1"
ft = tkFont.Font(family='Times', size=10)
self.GLabel_764["font"] = ft
self.GLabel_764["fg"] = "#333333"
self.GLabel_764["justify"] = "center"
self.GLabel_764["text"] = ""
self.GLabel_764.place(x=510, y=280, width=190, height=30)
def createrole(self, req):
# setting title
self.window_createrole = tk.Toplevel(root)
self.window_createrole.title("创建角色")
# setting window size
width = 365
height = 320
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
self.window_createrole.geometry(alignstr)
self.window_createrole.resizable(width=False, height=False)
self.GLabel_602 = tk.Label(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_602["font"] = ft
self.GLabel_602["fg"] = "#333333"
self.GLabel_602["justify"] = "center"
self.GLabel_602["text"] = "角色名称"
self.GLabel_602.place(x=30, y=50, width=70, height=25)
self.GLineEdit_937 = tk.Entry(self.window_createrole)
self.GLineEdit_937["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_937["font"] = ft
self.GLineEdit_937["fg"] = "#333333"
self.GLineEdit_937["justify"] = "center"
self.GLineEdit_937["text"] = "Entry"
self.GLineEdit_937.place(x=120, y=50, width=187, height=32)
self.GLabel_643 = tk.Label(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_643["font"] = ft
self.GLabel_643["fg"] = "#333333"
self.GLabel_643["justify"] = "center"
self.GLabel_643["text"] = "性别"
self.GLabel_643.place(x=30, y=100, width=70, height=25)
v = tk.IntVar()
self.GRadio_923 = tk.Radiobutton(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GRadio_923["font"] = ft
self.GRadio_923["fg"] = "#333333"
self.GRadio_923["justify"] = "center"
self.GRadio_923["text"] = "男"
self.GRadio_923["variable"] = v
self.GRadio_923["value"] = '1'
self.GRadio_923.place(x=120, y=100, width=43, height=30)
self.GRadio_923["command"] = self.GRadio_923_command
# self.GRadio_923.setCh
v.set('1')
self.GRadio_618 = tk.Radiobutton(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GRadio_618["font"] = ft
self.GRadio_618["fg"] = "#333333"
self.GRadio_618["justify"] = "center"
self.GRadio_618["text"] = "女"
self.GRadio_618["variable"] = v
self.GRadio_618["value"] = '2'
self.GRadio_618.place(x=190, y=100, width=62, height=30)
self.GRadio_618["command"] = self.GRadio_618_command
self.GButton_264 = tk.Button(self.window_createrole)
self.GButton_264["bg"] = "#f0f0f0"
ft = tkFont.Font(family='Times', size=10)
self.GButton_264["font"] = ft
self.GButton_264["fg"] = "#000000"
self.GButton_264["justify"] = "center"
self.GButton_264["text"] = "创 建"
self.GButton_264.place(x=130, y=240, width=103, height=30)
self.GButton_264["command"] = self.GButton_264_command
self.GLabel_735 = tk.Label(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_735["font"] = ft
self.GLabel_735["fg"] = "#333333"
self.GLabel_735["justify"] = "center"
self.GLabel_735["text"] = "cmd"
self.GLabel_735.place(x=30, y=140, width=70, height=25)
self.GLineEdit_495 = tk.Entry(self.window_createrole)
self.GLineEdit_495["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_495["font"] = ft
self.GLineEdit_495["fg"] = "#333333"
self.GLineEdit_495["justify"] = "center"
self.GLineEdit_495["text"] = "cjplayer"
self.GLineEdit_495.place(x=120, y=140, width=190, height=30)
self.GLabel_318 = tk.Label(self.window_createrole)
ft = tkFont.Font(family='Times', size=10)
self.GLabel_318["font"] = ft
self.GLabel_318["fg"] = "#333333"
self.GLabel_318["justify"] = "center"
self.GLabel_318["text"] = "token"
self.GLabel_318.place(x=30, y=190, width=70, height=25)
self.GLineEdit_630 = tk.Entry(self.window_createrole)
self.GLineEdit_630["borderwidth"] = "1px"
ft = tkFont.Font(family='Times', size=10)
self.GLineEdit_630["font"] = ft
self.GLineEdit_630["fg"] = "#333333"
self.GLineEdit_630["justify"] = "center"
self.GLineEdit_630["text"] = "tokey"
self.GLineEdit_630.place(x=120, y=190, width=191, height=30)
cmd = 'cjplayer'
self.GLineEdit_495.insert(0, cmd)
token = re.search('name="token".*?\'>', req).group(0)
token = re.search('\'.*?\'', token).group(0)[1:-1]
self.GLineEdit_630.insert(0, token)
def GButton_264_command(self): # 创建角色
cmd = self.GLineEdit_495.get()
token = self.GLineEdit_630.get()
username = self.GLineEdit_937.get()
if not username or len(username) < 6 or len(username) > 12:
self._log('用户名不能太短或者太长(小于6位或大于12位)')
return
sex = self.sex
data_role = {"username": username, "cmd": cmd, "token": token, "sex": sex, "submit": "创建"}
params = '?cmd=' + cmd + '&token=' + token + '&sex=' + sex + '&username=' + username
req = self._requests('get', self.url_game + params, decode_level=3)
refresh = None
url_refresh = None
try:
refresh = req.headers["refresh"]
except:
pass
if not refresh: # 登陆成功
self._log(f"角色创建失败,请重试")
return
url_split = refresh.split("url=")
if len(url_split) != 2:
self._log(f"服务器返回数据出错,退出登陆")
return
self._log(f"角色创建成功,等待返回角色信息")
url_refresh = url_split[1]
url_game = self.url_game + url_refresh
req = self._requests('get', url_game, decode_level=3)
welcome = re.search(f'{username}.*?纪', req.text, re.S).group(0)
self._log(welcome)
self.window_createrole.destroy()
self.GButton_107_command()
def GRadio_923_command(self):
self.sex = '1'
def GRadio_618_command(self):
self.sex = '2'
def GButton_32_command(self): #查看装备
if self.url_package_weapons:
self.NowObject_run(self.url_package_weapons)
def GButton_793_command(self):#查看药品
if self.url_package_drugs:
self.NowObject_run(self.url_package_drugs)
def GButton_217_command(self):#查看道具
if self.url_package_items:
self.NowObject_run(self.url_package_items)
def GButton_889_command(self):
print("GButton_889_command")
def GButton_724_command(self):
print("GButton_724_command")
def GButton_210_command(self):
print("GButton_210_command")
def GButton_916_command(self):
username = self.GLineEdit_702.get()
userpass = self.GLineEdit_703.get()
userpass2 = self.GLineEdit_54.get()
if not username or not userpass or not userpass2:
self.GLabel_764["text"] = "提示", " 请输入信息 "
return
if not userpass == userpass2:
self.GLabel_764["text"] = '错误', '密码前后不一致'
return
if len(username) < 6:
self.GLabel_764["text"] = '错误', '用户名不能少于6位'
return
data_regist = {"username": username, "userpass": userpass, "userpass2": userpass2, "submit": "登陆"}
req = self._requests('post', self.url_regist, decode_level=1, data=data_regist)
try:
xt = re.search('注册失败.*?<p>', req).group(0)[:-3]
if xt:
self.GLabel_764["text"] = f'{xt}'
except:
pass
try:
xt = re.search('注册成功.*?<p>', req).group(0)[:-3]
if xt:
self.GLabel_764["text"] = f'{xt}'
self.GButton_916['state'] = 'disable'
except:
pass
# try:
# with open('E:\\usr_info.pickle', 'rb')as usr_file:
# exist_usr_info = pickle.load(usr_file)
# except FileNotFoundError:
# exist_usr_info = {}
# if nn in exist_usr_info:
# tk.messagebox.showerror('错误', '用户名已存在')
# elif np == '' or nn == '':
# tk.messagebox.showerror('错误', '用户名或密码为空')
# elif np != npf:
# tk.messagebox.showerror('错误', '密码前后不一致')
# else:
# exist_usr_info[nn] = np
# with open('E:\\usr_info.pickle', 'wb')as usr_file:
# pickle.dump(exist_usr_info, usr_file)
# tk.messagebox.showinfo('欢迎', '注册成功')
# window_sign_up.destroy()
def GButton_14_command(self): # 技能一
url = self.url_pve_usejn1
self.NowObject_run(url)
def GButton_645_command(self): # 技能二
url = self.url_pve_usejn2
self.NowObject_run(url)
def GButton_141_command(self): # 技能三
url = self.url_pve_usejn3
self.NowObject_run(url)
def GButton_581_command(self): # 药品一按钮
url = self.url_pve_useyp1
self.NowObject_run(url)
def GButton_405_command(self): # 药品二按钮
url = self.url_pve_useyp2
self.NowObject_run(url)
def GButton_125_command(self): # 药品三按钮
url = self.url_pve_useyp3
self.NowObject_run(url)
def GButton_152_command(self): # 操作3 连续进攻
if self.NowObject_op3:
self.status_auto_bybutton = True
self.NowObject_run(self.NowObject_op3)
def NowObject_run(self, url):
if url:
status_fight = False
href = url
if self.needDecode:
href = self.DecodeParam(href)
if "cmd=pvegj&" in href:
status_fight = True
if "canshu=usejn&" in href:
status_fight = False
req = self._requests('get', self.url_game + url, decode_level=1)
html_etree = etree.HTML(req)
if "setzbwz&zbwz=" in href:
self._log("装备成功")
self.setStatusUserInfo_byreq(req)
return
elif "xxzb&zbwz=" in href:
self._log("卸载成功")
self.setStatusUserInfo_byreq(req)
return
if "&canshu=maichu&" in href:
msg = re.search("卖出.*?<br/", req).group(0)[:-4]
self._log(msg)
# self.setStatusUserInfo_byreq(req)
# return
if "cmd=delezb&zbnowid=" in href:
try:
msg = re.search("分解.*?【", req, re.S).group(0)[:-1]
msg = msg.replace("<br/>", " ")("</a>", " ").replace("\r\n", "")
self._log(msg)
except:
pass
# self.setStatusUserInfo_byreq(req)
# return
if "cmd=getbagyp&" in href:
table_element = html_etree.xpath("//a")
self.reset(self.tvPackageInfo)
icount = 0
for row in table_element:
urlyp = row.attrib["href"]
durlyp = urlyp
if self.needDecode:
urlyp = self.DecodeParam(urlyp)
if "cmd=ypinfo&ypid=" in urlyp:
# self.reset(self.tvPackageInfo)
self.tvPackageInfo.insert('', 'end', values=(row.text, '', '', '', '', durlyp))
return
if "cmd=getbagdj&" in href:
table_element = html_etree.xpath("//a")
self.reset(self.tvPackageInfo)
icount = 0
for row in table_element:
urlyp = row.attrib["href"]
durlyp = urlyp
if self.needDecode:
urlyp = self.DecodeParam(urlyp)
if "djinfo" in urlyp:
# self.reset(self.tvPackageInfo)
self.tvPackageInfo.insert('', 'end', values=(row.text, '', '', '', '', durlyp))
return
table_element = html_etree.xpath("//body//text()")
tempstr = ""
hp = None
for row in table_element:
rowstrip = row.strip().replace('\n', '').replace('\r\n', '')
if len(rowstrip) > 0:
if rowstrip == "==战斗==":
self._log(rowstrip)
elif rowstrip == "===================":
self._log(tempstr)
tempstr = ""
userHP = re.findall("气血.*?<br", req)[1][4:-4] # .group(1)[:-3]
html_etree_hp = etree.HTML(userHP)
table_element_hp = html_etree_hp.xpath("//div//text()")
hp = table_element_hp[0] + "/" + table_element_hp[1]
self.GLineEdit_556.delete(0, 'end')
self.GLineEdit_556.insert(0, hp)
nowhp = int(table_element_hp[0]) # 血量监控
allhp = int(table_element_hp[1])
# 进度值最大值
self.progressbarHP['maximum'] = allhp
# 进度值初始值
self.progressbarHP['value'] = nowhp
dorphp = allhp - nowhp
#######################自动吃药判断#########################
self.eatDrugs(dorphp, allhp)
self._log(rowstrip)
elif rowstrip == '逃跑':
break
elif rowstrip == '恭喜强化成功':
self._log('恭喜强化成功')
tempstr = None
# self.refreshGame(url)
break
elif '强化失败' in rowstrip:
self._log('强化失败')
tempstr = None
break
elif '灵石数量不足' in rowstrip or '突破成功' in rowstrip:
msg = re.search("便宜<br/>.*?<br/>", req, re.S).group(0)
msg = msg.replace("\r\n", "").replace(" ", "")
msg = "购买状态:" + msg[7:-5]
self._log(msg)
tempstr = None
break
elif re.search("购买.*?成功", rowstrip):
tempstr = rowstrip
break
elif rowstrip == '返回游戏':
table_element = html_etree.xpath("//a")
self.status_pve = False
for row2 in table_element:
if row2.text == '返回游戏':
url_game = self.url_game + row2.attrib["href"]
self.refreshGame(url_game)
break
else:
tempstr = tempstr + " " + rowstrip
if tempstr:
self._log(tempstr)
if "=task&nid=" in href:
table_element = html_etree.xpath("//a")
# if "&canshu=jieshou&" in href:
for row in table_element:
if row.text == '接受':
self.GButton_779["text"] = "接受任务"
self.NowObject_op1 = self.url_game + row.attrib["href"]
break
elif row.text == '提交':
self.GButton_779["text"] = "提交任务"
self.NowObject_op1 = self.url_game + row.attrib["href"]
break
# elif "&canshu=tijiao&" in href:
# self.GButton_779["text"] = "提交任务"
# for row in table_element:
# if row.text =='提交':
# self.NowObject_op1 = self.url_game+row.attrib["href"]
# self._log(msg)
return
if self.status_pve and status_fight and self.status_auto_bybutton:
self.NowObject_run(url)
def eatDrugs(self, dorphp, allhp):
count_drugs1 = None # 吃药1按键设置数量判断
try:
opjdrug1 = str(self.GButton_581["text"])
count_drugs1 = int(re.search("\(.*?\)", opjdrug1).group(0)[1:-1])
except:
pass
count_drugs2 = None # 吃药2按键设置数量判断
try:
opjdrug2 = str(self.GButton_405["text"])
count_drugs2 = int(re.search("\(.*?\)", opjdrug2).group(0)[1:-1])
except:
pass
count_drugs3 = None # 吃药3按键设置数量判断
try:
opjdrug3 = str(self.GButton_125["text"])
count_drugs3 = int(re.search("\(.*?\)", opjdrug3).group(0)[1:-1])
except:
pass
if dorphp > 100 and count_drugs1 and count_drugs1 > 0: # 吃药一
self.GButton_581_command()
time.sleep(0.1)
elif dorphp > 600 and count_drugs2 and count_drugs2 > 0: # 吃药2
self.GButton_405_command()
time.sleep(0.1)
elif dorphp > 1200 and count_drugs3 and count_drugs3 > 0: # 吃药3
self.GButton_125_command()
time.sleep(0.1)
elif dorphp >= 100 and dorphp / allhp > 0.4: # 无药,飞走,停止挂机
try:
self.refreshGame(self.url_game + self.url_safyhouse)
self.status_autofighting = False
except Exception as e:
print('1257')
print(e)
def DecodeParam(self, str):
if str:
strs = str.split('cmd=')
if len(strs) < 2:
return str
else:
return str
str = strs[1]
str = str.replace('O0O0O', '=').replace('o000o', '+').replace('oo00o', '/')
list_str = re.findall(r'.{2}', str)
skey = 'cxphp'
strCount = len(list_str)
list_skey = re.findall(r'.{1}', skey)
for i in range(0, len(list_skey)):
if i <= strCount and list_str[i] and list_str[i][1] == list_skey[i]:
list_str[i] = list_str[i][0]
strout = "".join(list_str)
if (len(strout) % 3 == 1):
strout += "=="
elif (len(strout) % 3 == 2):
strout += "="
else:
strout += "="
dStr = base64.b64decode(strout)
return '?cmd=' + bytes.decode(dStr)
def _requests(self, method, url, decode_level=1, retry=0, timeout=15, **kwargs):
if method in ["get", "post"]:
for _ in range(retry + 1):
try:
warnings.filterwarnings('ignore')
response = getattr(self.session, method)(url, timeout=timeout, verify=False, **kwargs)
return response.text if decode_level == 1 else response.json() if decode_level == 2 else response
except Exception as e:
self._log(e)
return None
def _log(self, logmsg):
global LOG_LINE_NUM
current_time = self.get_current_time()
logmsg_in = str(current_time) + " " + str(logmsg) + "\n" # 换行
self.GLineEdit_742.tag_config("even", background='#e0e0e0')
self.GLineEdit_742.tag_config("odd", background='#ffffff')
self.tag = 'odd' if self.tag == 'even' else 'even'
if LOG_LINE_NUM <= 25:
self.GLineEdit_742.insert('end', logmsg_in, self.tag)
LOG_LINE_NUM = LOG_LINE_NUM + 1
else:
self.GLineEdit_742.delete(1.0, 2.0)
self.GLineEdit_742.insert('end', logmsg_in, self.tag)
def get_current_time(self):
current_time = time.strftime('%H:%M:%S', time.localtime(time.time()))
return current_time
if __name__ == "__main__":
root = tk.Tk()
app = App(root)
root.mainloop()