Fork me on GitHub

等排位的时候写的LOL召唤师技能计时器

  1 import keyboard
  2 import win32clipboard
  3 import win32con
  4 import win32api
  5 import time
  6 import datetime
  7 def trans(n):
  8     a = str(datetime.timedelta(seconds=n))
  9     b = a[-2:]
 10     c = a[2:4]
 11     corrent_time = c + 'min' + b + 's'
 12     return corrent_time
 13 def clipboard_set(data):
 14     """设置剪贴板数据"""
 15     win32clipboard.OpenClipboard()
 16     win32clipboard.EmptyClipboard()
 17     win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, data)
 18     win32clipboard.CloseClipboard()
 19 def top_0():
 20     global start_time
 21     now_time = int(time.time()) - start_time
 22     next_time = now_time+cd[0]
 23     correct_time = trans(next_time)
 24     payload = '对面'+hero[0]+''+skill[0]+'将在'+correct_time+'时结束冷却'
 25     clipboard_set(payload)
 26     # print(payload)
 27 def top_1():
 28     global start_time
 29     now_time = int(time.time()) - start_time
 30     next_time = now_time+cd[0]
 31     correct_time = trans(next_time)
 32     payload = '对面'+hero[0]+''+skill[4]+'将在'+correct_time+'时结束冷却'
 33     clipboard_set(payload)
 34 
 35 def top_2():
 36     global start_time
 37     now_time = int(time.time()) - start_time
 38     next_time = now_time+cd[0]
 39     correct_time = trans(next_time)
 40     payload = '对面'+hero[0]+''+skill[1]+'将在'+correct_time+'时结束冷却'
 41     clipboard_set(payload)
 42 def mid_0():
 43     global start_time
 44     now_time = int(time.time()) - start_time
 45     next_time = now_time+cd[0]
 46     correct_time = trans(next_time)
 47     payload = '对面'+hero[1]+''+skill[0]+'将在'+correct_time+'时结束冷却'
 48     clipboard_set(payload)
 49 def mid_1():
 50     global start_time
 51     now_time = int(time.time()) - start_time
 52     next_time = now_time+cd[0]
 53     correct_time = trans(next_time)
 54     payload = '对面'+hero[1]+''+skill[4]+'将在'+correct_time+'时结束冷却'
 55     clipboard_set(payload)
 56 def mid_2():
 57     global start_time
 58     now_time = int(time.time()) - start_time
 59     next_time = now_time+cd[0]
 60     correct_time = trans(next_time)
 61     payload = '对面'+hero[1]+''+skill[1]+'将在'+correct_time+'时结束冷却'
 62     clipboard_set(payload)
 63 def bot_0():
 64     global start_time
 65     now_time = int(time.time()) - start_time
 66     next_time = now_time+cd[0]
 67     correct_time = trans(next_time)
 68     payload = '对面'+hero[2]+''+skill[0]+'将在'+correct_time+'时结束冷却'
 69     clipboard_set(payload)
 70 def bot_1():
 71     global start_time
 72     now_time = int(time.time()) - start_time
 73     next_time = now_time+cd[0]
 74     correct_time = trans(next_time)
 75     payload = '对面'+hero[2]+''+skill[2]+'将在'+correct_time+'时结束冷却'
 76     clipboard_set(payload)
 77 def bot_2():
 78     global start_time
 79     now_time = int(time.time()) - start_time
 80     next_time = now_time+cd[0]
 81     correct_time = trans(next_time)
 82     payload = '对面'+hero[2]+''+skill[3]+'将在'+correct_time+'时结束冷却'
 83     clipboard_set(payload)
 84 def ye_0():
 85     global start_time
 86     now_time = int(time.time()) - start_time
 87     next_time = now_time+cd[0]
 88     correct_time = trans(next_time)
 89     payload = '对面'+hero[3]+''+skill[0]+'将在'+correct_time+'时结束冷却'
 90     clipboard_set(payload)
 91 def fu_0():
 92     global start_time
 93     now_time = int(time.time()) - start_time
 94     next_time = now_time+cd[0]
 95     correct_time = trans(next_time)
 96     payload = '对面'+hero[4]+''+skill[0]+'将在'+correct_time+'时结束冷却'
 97     clipboard_set(payload)
 98 def fu_1():
 99     global start_time
100     now_time = int(time.time()) - start_time
101     next_time = now_time+cd[0]
102     correct_time = trans(next_time)
103     payload = '对面'+hero[4]+''+skill[1]+'将在'+correct_time+'时结束冷却'
104     clipboard_set(payload)
105 def fu_2():
106     global start_time
107     now_time = int(time.time()) - start_time
108     next_time = now_time+cd[0]
109     correct_time = trans(next_time)
110     payload = '对面'+hero[4]+''+skill[2]+'将在'+correct_time+'时结束冷却'
111     clipboard_set(payload)
112 def gg():
113     global start_time
114     start_time = int(time.time())
115     print('gg')
116 def get_key():
117     keyboard.wait()
118 
119 
120 keyboard.add_hotkey('8+0',top_0)
121 keyboard.add_hotkey('8+1',top_1)
122 keyboard.add_hotkey('8+3',top_2)
123 keyboard.add_hotkey('5+0',mid_0)
124 keyboard.add_hotkey('5+1',mid_1)
125 keyboard.add_hotkey('5+3',mid_2)
126 keyboard.add_hotkey('2+0',bot_0)
127 keyboard.add_hotkey('2+7',bot_1)
128 keyboard.add_hotkey('2+9',bot_2)
129 keyboard.add_hotkey('4+0',ye_0)
130 keyboard.add_hotkey('6+0',fu_0)
131 keyboard.add_hotkey('6+3',fu_1)
132 keyboard.add_hotkey('6+7',fu_2)
133 keyboard.add_hotkey('+',gg)
134 global start_time
135 start_time = int(time.time())
136 hero = ['上单','中单','AD','打野','辅助']
137 skill = ['闪现','引燃','治疗','净化','传送']
138 cd = [300,240,210,360]
139 get_key()
140 #0:闪现 1:传送 3:引燃 7:治疗 9:净化

 

posted @ 2021-02-08 18:06  M1saka_L1gh73r  阅读(130)  评论(0编辑  收藏  举报