最近上论坛看到有霸王大陆私服服务器端,下载了一个玩玩,发现都不能创建号,研究了下自己写一个GM工具,记录下。
003-aoaopython-霸王大陆私服GM工具
import pyodbc
from tkinter import Tk, Label, Entry, Button, messagebox
# 连接数据库
server = '192.168.200.130'
database = 'alef'
username = 'alef'
password = 'alef'
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
# 创建游标
cursor = cnxn.cursor()
def submit():
# 获取用户名和密码输入框中的值
account_id = entry_account_id.get()
password = entry_password.get()
try:
# 执行插入命令
insert_query_1 = "INSERT INTO [dbo].[AMT_ACCOUNT]([ACCOUNTID], [PASSWORD]) VALUES (?, ?)"
values_1 = (account_id, password)
cursor.execute(insert_query_1, values_1)
insert_query_2 = "INSERT INTO [dbo].[AMT_MASTER]([ACCOUNTID], [ACCOUNTGUID], [EMAIL], [SOCIALNO], [CREATION_DATE], [LAST_DATE], [MODIFY_DATE], [PHONE], [MOBILE], [ZIPCODE], [ADDR1], [ADDR2], [SMS_YN], [EMAIL_YN], [PENALTY_GBN], [PAUSE_DATE], [IP], [LOGINCNT], [NOMINATOR], [RPG_LEVEL], [LONEY_AGREEYN], [LONEY_CHARGEYN], [SEX]) VALUES (?, '12345', 'test@test.net', '23', '2011-06-14 10:50:39.0000000', '2011-06-15 10:51:34.0000000', '2011-06-15 10:51:38.0000000', '346346', '436346', '436346', '346346', '346346', 'N', 'N', '0', NULL, NULL, NULL, NULL, 92, NULL, NULL, NULL);"
values_2 = (account_id,)
cursor.execute(insert_query_2, values_2)
# 提交事务
cnxn.commit()
# 关闭连接
cursor.close()
cnxn.close()
messagebox.showinfo("成功", "账户创建成功")
except Exception as e:
messagebox.showerror("失败", f"创建失败:{str(e)}")
# 创建窗口
window = Tk()
window.title("aoaoGM工具")
window.geometry("500x300")
# 设置窗口标题
#window.title("数据插入")
# 创建标签和输入框
label_account_id = Label(window, text="用户名:")
label_account_id.pack()
entry_account_id = Entry(window)
entry_account_id.pack()
label_password = Label(window, text="密码:")
label_password.pack()
entry_password = Entry(window, show="*")
entry_password.pack()
# 创建提交按钮
button_submit = Button(window, text="提交", command=submit)
button_submit.pack()
# 运行窗口主循环
window.mainloop()
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 xieaoao@qq.com QQ:1296454177