rougetask.py 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. from game import control
  2. from game.algo import rougeGen
  3. from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
  4. import json
  5. import os
  6. import tkinter as tk
  7. from game.const import rouge as R
  8. from datetime import datetime
  9. import roguetest
  10. current_folder_path = os.getcwd()
  11. class Task:
  12. def __init__(self, master):
  13. self.master = master
  14. master.geometry("1000x700")
  15. master.configure(bg='#7E587E')
  16. master.title("QQTRogue二测β1.0(底层逻辑:永恒; 地牢设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!")
  17. now = datetime.now()
  18. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  19. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  20. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  21. rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata") # 构建任务文件路径
  22. # 第一次打开
  23. if not os.path.exists(rouge_task_file_path):
  24. rougeOB_task_data = {"1": {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  25. "2": {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  26. "3": {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  27. "4": {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  28. "5": {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  29. "6": {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  30. "7": {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  31. "8": {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  32. "9": {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  33. "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  34. "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  35. "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  36. "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1, "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}}
  37. save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
  38. # 正常打开
  39. else:
  40. rougeOB_task_data = load_rouge_data(rouge_task_file_path)
  41. # 格式化年月日
  42. year = now.strftime("%Y")
  43. month = now.strftime("%m")
  44. day = now.strftime("%d")
  45. # 移除月份和日期的前导零(如果有)
  46. month = month.lstrip("0")
  47. day = day.lstrip("0")
  48. if int(rougeOB_task_data[str(month)]["last_finish"]) < int(year):
  49. rougeOB_task_data[str(month)]["process"] = 0
  50. rougeOB_task_data[str(month)]["last_finish"] = year
  51. rougeOB_task_data[str(month)]["rewarded"] = False
  52. if rougeOB_task_data["today"]["last_finish"] != year + "-" + month + "-" + day:
  53. rougeOB_task_data["today"]["process"] = 0
  54. rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
  55. rougeOB_task_data["today"]["rewarded"] = False
  56. save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
  57. # 月常任务
  58. self.button0 = tk.Button(master, text= "本月任务: " + rougeOB_task_data[str(month)]["task"] + " \n (" + "奖励:" + rougeOB_task_data[str(month)]["reward"] + ")", bg="#C47451", font=("Microsoft YaHei", 20))
  59. self.button0.place(relx=0.1, rely=0.25, anchor='w')
  60. if rougeOB_task_data[str(month)]["process"] < rougeOB_task_data[str(month)]["finish"]:
  61. self.button1 = tk.Button(master, text= "进度: " + str(rougeOB_task_data[str(month)]["process"]) + "/" + str(rougeOB_task_data[str(month)]["finish"]) + " (未完成)", bg="#C47451", font=("Microsoft YaHei", 20))
  62. self.button1.place(relx=0.6, rely=0.25, anchor='w')
  63. else:
  64. self.button1 = tk.Button(master, text= "进度: " + str(rougeOB_task_data[str(month)]["process"]) + "/" + str(rougeOB_task_data[str(month)]["finish"]) + " \n (已使用" + R.hero_name[rougeOB_task_data["today"]["hero"]] + "领取奖励)", bg="#C47451", font=("Microsoft YaHei", 20))
  65. self.button1.place(relx=0.6, rely=0.25, anchor='w')
  66. # 日常任务
  67. self.button2 = tk.Button(master, text= "每日任务: " + rougeOB_task_data["today"]["task"] + " \n (" + "奖励:" + rougeOB_task_data["today"]["reward"] + ")", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  68. self.button2.place(relx=0.1, rely=0.5, anchor='w')
  69. if rougeOB_task_data["today"]["process"] < rougeOB_task_data["today"]["finish"]:
  70. self.button3 = tk.Button(master, text= "进度: " + str(rougeOB_task_data["today"]["process"]) + "/" + str(rougeOB_task_data["today"]["finish"]) + " (未完成)", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  71. self.button3.place(relx=0.6, rely=0.5, anchor='w')
  72. else:
  73. self.button3 = tk.Button(master, text= "进度: " + str(rougeOB_task_data["today"]["process"]) + "/" + str(rougeOB_task_data["today"]["finish"]) + " \n (已使用" + R.hero_name[rougeOB_task_data["today"]["hero"]] + "领取奖励)", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  74. self.button3.place(relx=0.6, rely=0.5, anchor='w')
  75. # 返回主界面
  76. self.button0 = tk.Button(master, text= "返回主界面", command=lambda: self.button_return(), bg="#C68E17", font=("Microsoft YaHei", 24))
  77. self.button0.place(relx=0.5, rely=0.7, anchor='center')
  78. # 通用开局
  79. def button_return(self):
  80. self.master.destroy()
  81. app_task = tk.Tk()
  82. roguetest.App(app_task)
  83. if __name__ == "__main__":
  84. root = tk.Tk()
  85. app = Task(root)
  86. root.mainloop()