-
Notifications
You must be signed in to change notification settings - Fork 3
/
funstuff.py
296 lines (245 loc) · 9.94 KB
/
funstuff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
import minqlx
import threading
import time
class funstuff(minqlx.Plugin):
def __init__(self):
self.game_ended = False
self.add_command("gay", self.cmd_gay, 2)
self.add_command("gayall", self.cmd_gayall, 2)
self.add_command("straight", self.cmd_straight, 2)
self.add_command("straightall", self.cmd_straightall, 2)
self.add_command("kill", self.cmd_kill, 2)
self.add_command("killall", self.cmd_killall, 2)
self.add_command("slaphappy", self.cmd_slapvote, 2, usage="<id> <number of slaps> <frequency in seconds> [damage]")
self.add_command("slaptrigger", self.cmd_slaphappy, 2)
self.add_command("purgatory", self.cmd_purgatory, 2)
self.add_command("purgatorytrigger", self.cmd_purgatory_trigger, 2)
self.add_command("rename", self.cmd_rename, 2)
self.add_command("renametrigger", self.cmd_rename_trigger, 2)
self.add_command("hulk", self.cmd_hulk, 2)
self.add_command("hulktrigger", self.cmd_hulk_trigger, 2)
self.add_hook("new_game", self.handle_new_game)
self.add_hook("game_end", self.handle_game_end)
def handle_new_game(self, *args, **kwargs):
self.game_ended = False
def handle_game_end(self, *args, **kwargs):
self.game_ended = True
def cmd_hulk(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
if msg[1] == "everyone":
first_arg = target_player_string = "everyone"
else:
target_player_string = target_player.name
first_arg = int(msg[1])
self.callvote('qlx !hulktrigger {}'.format(first_arg), "^2Hulkify ^7{}".format(target_player_string))
def cmd_hulk_trigger(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
target_name = target_player.name
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
else:
target_name = "EVERYONE"
if msg[1] != "everyone":
self.player(i).health = 32767
self.player(i).armor = 32767
self.player(i).powerups(quad=10000, regeneration=1000, battlesuit=1000, haste=1000)
else:
for p in self.players():
self.player(p.id).health = 32767
self.player(p.id).armor = 32767
self.player(p.id).powerups(quad=10000, regeneration=1000, battlesuit=1000, haste=1000)
def cmd_rename(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
try:
msg[2]
except:
player.tell("Missing name to rename to.")
return minqlx.RET_STOP_ALL
if msg[1] == "everyone":
first_arg = target_player_string = "everyone"
else:
target_player_string = target_player.name
first_arg = int(msg[1])
self.callvote('qlx !renametrigger {} {}'.format(first_arg, msg[2]), "Rename {} ^7to {}".format(target_player_string, msg[2]))
def cmd_rename_trigger(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
target_name = target_player.name
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
else:
target_name = "EVERYONE"
if msg[1] != "everyone":
self.player(i).name = msg[2]
else:
for p in self.players():
self.player(p.id).name = msg[2]
def cmd_purgatory(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
if msg[1] == "everyone":
first_arg = target_player_string = "everyone"
else:
target_player_string = target_player.name
first_arg = int(msg[1])
self.callvote('qlx !purgatorytrigger {}'.format(first_arg), "Send {} to ^1PURGATORY".format(target_player_string))
def cmd_purgatory_trigger(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
target_name = target_player.name
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
else:
target_name = "EVERYONE"
self.center_print("^2SENDING {}^2 TO ^1PURGATORY IN...".format(target_name))
# Countdown timer
@minqlx.delay(2)
@minqlx.thread
def countdown():
for index in range(5, 0, -1):
self.center_print("^1" + str(index) + "..")
time.sleep(1)
if msg[1] != "everyone":
self.player(i).position(x=-10000, y=-10000, z=-10000)
else:
for p in self.players():
self.player(p.id).position(x=-10000, y=-10000, z=-10000)
countdown()
def cmd_gay(self, player, msg, channel):
self.callvote('qlx !gayall', "make everyone gay")
def cmd_gayall(self, player, msg, channel):
for p in self.players():
p.clan = "^6*GAY*"
def cmd_straight(self, player, msg, channel):
self.callvote('qlx !straightall', "make everyone straight")
def cmd_straightall(self, player, msg, channel):
for p in self.players():
p.clan = ""
def cmd_kill(self, player, msg, channel):
self.callvote('qlx !killall', "kill everyone")
def cmd_killall(self, player, msg, channel):
for p in self.players():
self.slay(p)
def cmd_slapvote(self, player, msg, channel):
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
try:
msg[2]
except:
#default values
msg.append(100) #number of slaps
msg.append(0.25) #slap frequency
if msg[1] == "everyone":
first_arg = target_player_string = "everyone"
else:
target_player_string = target_player.name
first_arg = int(msg[1])
self.callvote('qlx !slaptrigger {} {} {}'.format(first_arg, int(msg[2]), float(msg[3])), "Slaphappy {}".format(target_player_string))
def cmd_slaphappy(self, player, msg, channel):
if len(msg) < 4:
return minqlx.RET_USAGE
if msg[1] != "everyone":
try:
i = int(msg[1])
target_player = self.player(i)
target_name = target_player.name
if not (0 <= i < 64) or not target_player:
raise ValueError
except ValueError:
player.tell("Invalid ID.")
return minqlx.RET_STOP_ALL
else:
target_name = "EVERYONE"
try:
slap_amount = int(msg[2])
if not slap_amount or slap_amount < 1:
raise ValueError
except ValueError:
player.tell("Invalid number of slaps.")
return minqlx.RET_STOP_ALL
try:
slap_frequency = float(msg[3])
if not slap_frequency or slap_frequency <= 0:
raise ValueError
except ValueError:
player.tell("Invalid slap frequency.")
return minqlx.RET_STOP_ALL
if len(msg) > 4:
try:
dmg = int(msg[4])
except ValueError:
player.tell("Invalid damage value.")
return minqlx.RET_STOP_ALL
else:
dmg = 0
def do_every(interval, worker_func, iterations=0):
if not self.game_ended:
if iterations != 1:
threading.Timer(
interval,
do_every, [interval, worker_func, 0 if iterations == 0 else iterations - 1]
).start()
worker_func()
def slapper():
if target_name != "EVERYONE":
self.slap(target_player, dmg)
else:
for p in self.players():
self.slap(p, dmg)
self.center_print("^2SLAPHAPPY ACTIVATED ON: ^6{}^7 !!! IN...".format(target_name))
# Countdown timer
@minqlx.delay(2)
@minqlx.thread
def countdown():
for i in range(5, 0, -1):
self.center_print("^1" + str(i) + "..")
time.sleep(1)
do_every(slap_frequency, slapper, slap_amount)
countdown()
return minqlx.RET_STOP_ALL