-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathEverWingHax.py
executable file
·423 lines (357 loc) · 14.8 KB
/
EverWingHax.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
#! /usr/bin/env python3
from __future__ import print_function
import json
import sys
try:
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
except ImportError:
from urlparse import urlparse
from urllib import urlencode
from urllib2 import urlopen, Request, HTTPError
try:
input = raw_input
except NameError:
pass
def main():
global debug
debug = False
global profile_url
profile_url = None
global query_endpoint
query_endpoint = "http://stormcloud-146919.appspot.com/purchase/listing/?"
debug_url = "http://stormcloud-146919.appspot.com/auth/connect/?uid=1141161145996839&"
print("""
____| \ \ /_) | |
__|\ \ / _ \ __|\ \ \ / | __ \ _` | | | _` |\ \ /
| \ \ / __/ | \ \ \ / | | | ( | ___ | ( | ` <
_____|\_/ \___|_| \_/\_/ _|_| _|\__, | _| _|\__,_| _/\_\\
|___/
by andromeduck""")
for i in range(0, len(sys.argv)):
if "stormcloud-146919.appspot.com/auth" in sys.argv[i]:
profile_url = sys.argv[i]
profile_url = profile_url.replace("https", "http")
elif "debug_url" in sys.argv[i]:
print("DEBUG URL")
profile_url = debug_url
elif "debug" in sys.argv[i]:
print("DEBUG MODE")
debug = True
if profile_url == None and not debug:
print("""INSTRUCTIONS
1. Open Google Chrome (desktop)
2. In Chrome, open a messenger.com tab. Do not start the game yet.
3. In that tab, Open Devloper Tools via Menu > More Tools > Developer Tools.
4. In Developer Tools, click Network then the Filter button in the top left.
5. In Developer Tools, paste the following without quotes into the Filter box
in the top left: "stormcloud-146919.appspot.com/auth/"
6. In the messenger.com tab, start EverWing. You should now should see a new
entry in Developer Tools starting with "?uid=" and followed by numbers.
7. In Developer Tools, right click it and select Copy > Copy Link Address.
8. Paste it in the prompt below, hit return, then wait for it to complete.""")
profile_url = input("\nProfile URL:\n")
profile_url = profile_url.replace("https", "http")
elif profile_url == None:
profile_url = debug_url
print("\nUSING DEBUG URL")
print(profile_url)
print("\n\nSTARTING HAX\n")
update_world()
acquire_characters()
acquire_sidekicks()
exit_tutorial()
print("\nHAX FINISHED\n")
print("Refresh page or play another round to see results reflected in game.")
if sys.platform == "win32":
raw_input("hit return to exit")
return 0
def acquire_characters():
print("\nACQUIRING CHARACTERS\n")
characters = get_item_class("character")
for character in characters:
character_name = character["model"].replace("character:", "")
if not equip_character(character):
print("WARNING: Actions on character " + character_name + " skipped due to active quest status")
continue
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_level_up_character")
event["character"] = character["key"]
levels_to_upgrade = get_stat(character, "level", "maximum") - get_stat(character, "level", "value")
print("Leveling up character " + character_name + " " + str(levels_to_upgrade) + " times", end="")
for i in range(0, levels_to_upgrade):
submit_event(event)
if levels_to_upgrade <= 30:
print(".", end="")
sys.stdout.flush()
elif i % 2:
print(":", end="")
sys.stdout.flush()
print(" DONE")
print("\nCHARACTERS ACQUIRED\n\n")
def equip_character(character):
character_name = character["model"].replace("character:", "")
if "questing" in character["state"]:
return False
if character["state"] == "locked":
complete_games(2)
print("Unlocking Character " + character_name + " ", end="")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_unlock_character_" + character_name)
event["global"] = get_func_key("item_global")
event["character"] = character["key"]
submit_event(event)
characters = get_item_class("character")
character = next(character for character in characters if character["key"] == event["character"])
print("DONE")
if character["state"] == "idle":
print("Equipping Character:" + character_name + " ", end="")
characters = get_item_class("character")
curr_character = next(character for character in characters if character["state"] == "equipped")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_equip_character")
event["equip"] = character["key"]
if curr_character:
event["unequip"] = curr_character["key"]
submit_event(event)
print("DONE")
return True
def acquire_sidekicks():
print("\nACQUIRING SIDEKICKS\n")
sidekicks = get_item_class("sidekick")
if debug:
print("Debug Mode, deleting all dragons and running 8/20 unlock rounds")
delete_extra_sidekicks(delete_all=True)
num_rounds = 8
elif len(sidekicks) > 100:
print("Lots of dragons found, running only 12/20 unlock rounds")
for i in range(0, 4):
level_up_sidekicks()
evolve_sidekicks()
num_rounds = 12
else:
print("Unlocking dragons")
num_rounds = 20
for i in range(0, num_rounds):
print("Round " + str(i+1) + " of " + str(num_rounds) + " ", end="")
complete_games(10)
acquire_eggs("epic", 80)
acquire_dragons("legendary", 8)
print(" DONE")
if i % 4 == 0:
level_up_sidekicks()
evolve_sidekicks()
print("Evolving dragons")
for i in range(0, 4):
level_up_sidekicks()
evolve_sidekicks()
delete_extra_sidekicks()
print("\nSIDEKICKS ACQUIRED\n\n")
def acquire_eggs(rarity, num_eggs):
if debug:
print("acquire " + str(num_eggs) + " " + rarity + " eggs ", end="")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_" + rarity + "_dragon_egg")
for i in range(0, num_eggs):
submit_event(event, update_world=(num_eggs == 1))
print(".", end="")
sys.stdout.flush()
if debug:
print(" DONE")
def acquire_dragons(rarity, num_dragons):
if debug:
print("acquiring " + str(num_dragons) + " " + rarity + " dragons ", end="")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key(rarity + "_dragon")
for j in range(0, num_dragons):
submit_event(event, update_world=(num_dragons == 1))
print(".", end="")
sys.stdout.flush()
update_world()
if debug:
print(" DONE")
def level_up_sidekicks():
sidekicks = get_item_class("sidekick")
sidekicks = [sidekick for sidekick in sidekicks
if get_stat(sidekick, "xp", "value") != get_stat(sidekick, "xp", "maximum")]
print("Leveling up " + str(len(sidekicks)) + " sidekicks")
for i in range(0, int((len(sidekicks) +1)/ 2)):
equip_sidekicks(sidekicks[i], sidekicks[len(sidekicks) - 1 - i])
complete_games(1)
print(" DONE")
def evolve_sidekicks():
sidekicks = get_item_class("sidekick")
evolution_candidates = [sidekick for sidekick in sidekicks
if get_stat(sidekick, "xp", "value") == get_stat(sidekick, "xp", "maximum")
and get_stat(sidekick, "maturity", "value") != get_stat(sidekick, "maturity", "maximum")]
print("Attempting to Evolve " + str(len(evolution_candidates)) + " of " + str(len(sidekicks)) + " sidekicks ", end="")
while (len(evolution_candidates)):
event = {"k": get_func_key("player_key")}
match_target = evolution_candidates[0]
evolution_candidates.remove(match_target)
ideal_match = next((sidekick for sidekick in evolution_candidates
if sidekick["model"] == match_target["model"]
and get_stat(sidekick, "maturity", "value") == get_stat(match_target, "maturity", "value")
and get_stat(sidekick, "zodiac", "value") == get_stat(match_target, "zodiac", "value")), None)
if ideal_match:
evolution_candidates.remove(ideal_match)
event["l"] = get_func_key("listing_fuse_dragon_zodiac_bonus")
event["sidekick1"] = match_target["key"]
event["sidekick2"] = ideal_match["key"]
print(":", end="")
sys.stdout.flush()
else:
print(".", end="")
sys.stdout.flush()
continue
submit_event(event, update_world=False)
update_world()
print(" DONE")
def delete_extra_sidekicks(delete_all=False):
sidekicks = get_item_class("sidekick")
if delete_all:
extra_sidekicks = sidekicks
else:
extra_sidekicks = [sidekick for sidekick in sidekicks
if get_stat(sidekick, "xp", "value") != get_stat(sidekick, "xp", "maximum")
or get_stat(sidekick, "maturity", "value") != get_stat(sidekick, "maturity", "maximum")
or get_stat(sidekick, "zodiac_bonus", "value") != get_stat(sidekick, "zodiac_bonus", "maximum")]
print("Deleting " + str(len(extra_sidekicks)) + " leftover sidekicks ", end="")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_sell_dragon")
for sidekick in extra_sidekicks:
event["sidekick"] = sidekick["key"]
submit_event(event, update_world=False)
print(".", end="")
sys.stdout.flush()
print(" DONE")
update_world()
def equip_sidekicks(new_left, new_right):
sidekicks = get_item_class("sidekick")
curr_left = next((sidekick for sidekick in sidekicks if sidekick["state"] == "equippedLeft"), None)
event = {"k": get_func_key("player_key")}
if curr_left:
event["l"] = get_func_key("listing_equip_dragon_left_swap")
event["sidekick1"] = new_left["key"]
event["sidekick2"] = curr_left["key"]
if new_left["key"] != curr_left["key"]:
submit_event(event)
else:
event["l"] = get_func_key("listing_equip_dragon_left")
event["sidekick1"] = new_left["key"]
submit_event(event)
sidekicks = get_item_class("sidekick")
curr_right = next((sidekick for sidekick in sidekicks if sidekick["state"] == "equippedRight"), None)
event = {"k": get_func_key("player_key")}
if curr_right:
event["l"] = get_func_key("listing_equip_dragon_right_swap")
event["sidekick1"] = new_right["key"]
event["sidekick2"] = curr_right["key"]
if new_right["key"] != curr_right["key"]:
submit_event(event)
else:
event["l"] = get_func_key("listing_equip_dragon_right")
event["sidekick1"] = new_right["key"]
submit_event(event)
if debug:
print("Equipped Sidekicks")
else:
print(".", end="")
sys.stdout.flush()
def complete_games(num_games):
if debug:
print("Farming " + str(num_games) + " Rounds ", end="")
sidekicks = get_item_class("sidekick")
curr_left = next((sidekick for sidekick in sidekicks if sidekick["state"] == "equippedLeft"), None)
curr_right = next((sidekick for sidekick in sidekicks if sidekick["state"] == "equippedRight"), None)
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("game_complete")
event["global"] = get_func_key("item_global")
event["coin"] = 99999
event["xpPlayer"] = 99999
if curr_left:
event["sidekick1"] = curr_left["key"]
event["xpSidekick1"] = 99999
if curr_right:
event["sidekick2"] = curr_right["key"]
event["xpSidekick2"] = 99999
for i in range(0, num_games):
submit_event(event, update_world=False)
print(".", end="")
sys.stdout.flush()
if debug:
print(" DONE")
def get_func_key(key_name):
if key_name == "player_key":
return world["player"]["key"]
elif key_name == "item_global":
return next(item["key"] for item in world["player"]["inventory"] if item["model"] == "item_global")
else:
return next(item["key"] for item in world["schema"]["listings"] if item["name"] == key_name)
def get_item_class(type_name):
return[item for item in world["player"]["inventory"] if type_name in item["model"]]
def get_stat(item, name, field):
return int(next(stat[field] for stat in item["stats"] if stat["name"] == name))
def update_world():
try:
global world
world = json.loads(urlopen(profile_url).read().decode('utf-8'))
return world
except Exception as error:
print("Invalid Profile URL: ", profile_url)
print(str(error))
exit(1)
def submit_event(query_data, update_world=True, retries_left=2):
try:
query_url = query_endpoint + urlencode(query_data)
response = urlopen(query_url, timeout=4).read().decode("utf-8")
except HTTPError as e:
if debug:
print(str(e))
response = e.read().decode("utf-8")
else:
print("!", end ="")
submit_event(query_data, update_world, retries_left-1)
return
except Exception as e:
if debug:
print("ERROR exhausted retries on query:", query_url)
print(str(e))
elif retries_left > 0:
print("!", end ="")
submit_event(query_data, update_world, retries_left-1)
return
if "error" in response:
if debug:
print("ERROR on query: ", query_url)
if type(response) == dict:
print(URL)
print(response["message"])
else:
print(response)
else:
print("!", end ="")
elif update_world:
response = json.loads(response)
if "wallet" in response:
world["player"]["wallet"] = response["wallet"]
if "inventory" in response:
world["player"]["inventory"] = response["inventory"]
def exit_tutorial():
if (get_item_class("token:tutorialComplete")):
return
print("\nEXITING TUTORIAL\n")
characters = get_item_class("character")
curr_character = next(character for character in characters if character["state"] == "equipped")
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_tutorial_lvl5")
event["character"] = curr_character["key"]
submit_event(event)
print("\nTUTORIAL EXITED\n")
def default_inventory():
event = {"k": get_func_key("player_key")}
event["l"] = get_func_key("listing_default_inventory")
submit_event(event)
if __name__ == "__main__":
main()