Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import base64
- import sys
- password = str(input("Please type in a Phoenotopia 1 password:\n"))
- def UsedPassCode(param1):
- global decoded_passcode
- decoded_passcode = None
- global new_game_data
- new_game_data = [None]
- pass_code = param1
- stripped_pass_code = _StripPassCode(pass_code)
- try:
- decoded_passcode = str(base64.b64decode(stripped_pass_code)).strip("b''")
- new_game_data = _StringToGameDataArray(decoded_passcode)
- except ValueError as e:
- return "Bad Password! Details: " + str(e)
- return "SUCCESS!"
- def _StripPassCode(param1):
- _loc2_ = param1.split("_")
- global fileName
- fileName = _loc2_[0]
- _loc3_ = int(0)
- while _loc3_ < len(_loc2_):
- if len(str(_loc2_[_loc3_])) > 200:
- return str(_loc2_[_loc3_])
- _loc3_ = _loc3_ + 1
- raise ValueError("Bad Password!")
- def _StringToGameDataArray(param1):
- _loc2_ = []
- _loc3_ = str(param1).split(",")
- _loc2_.append(_loc3_[0])
- _loc2_.append(int(_loc3_[1]))
- _loc2_.append(int(_loc3_[2]))
- _loc2_.append(int(_loc3_[3]))
- _loc2_.append(int(_loc3_[4]))
- _loc2_.append(int(_loc3_[5]))
- _loc2_.append(int(_loc3_[6]))
- _loc2_.append(int(_loc3_[7]))
- _loc2_.append(_ParseItemString(_loc3_[8]))
- _loc2_.append(_ParseSaveIndexString(_loc3_[9]))
- _loc2_.append(_ParseKeyString(_loc3_[10]))
- _loc2_.append(int(_loc3_[11]))
- _loc4_ = int(_loc3_[12])
- if _loc4_ < 3840:
- _loc4_ = 3840
- _loc2_.append(_loc4_)
- _loc2_.append(int(_loc3_[13]))
- _loc2_.append(int(_loc3_[14]))
- _loc2_.append(int(_loc3_[15]))
- _loc2_.append(int(_loc3_[16]))
- _loc2_.append(int(_loc3_[17]))
- _loc2_.append(int(_loc3_[18]))
- _loc2_.append(int(_loc3_[19]))
- _loc2_.append(int(_loc3_[20]))
- _loc2_.append(int(_loc3_[21]))
- _loc2_.append(int(_loc3_[22]))
- _loc2_.append(int(_loc3_[23]))
- _loc2_.append(int(_loc3_[24]))
- _loc2_.append(int(_loc3_[25]))
- _loc2_.append(int(_loc3_[26]))
- _loc2_.append(int(_loc3_[27]))
- _loc2_.append(int(_loc3_[28]))
- _loc2_.append(int(_loc3_[29]))
- _loc2_.append(int(_loc3_[30]))
- _loc2_.append(int(_loc3_[31]))
- _loc2_.append(int(_loc3_[32]))
- _loc2_.append(int(_loc3_[33]))
- _loc2_.append(int(_loc3_[34]))
- return _loc2_
- def _ParseKeyString(param1):
- _loc2_ = param1.split("_")
- _loc3_ = []
- _loc7_ = int(0)
- while _loc7_ < len(_loc2_):
- if _loc2_[_loc7_] == "-1":
- _loc3_.append(False)
- elif _loc2_[_loc7_] != "":
- _loc3_.append(_loc2_[_loc7_])
- _loc7_ = _loc7_ + 1
- return _loc3_
- def _ParseSaveIndexString(param1):
- _loc2_ = []
- _loc5_ = int(0)
- _loc6_ = int(0)
- _loc7_ = int(0)
- while _loc7_ < len(param1):
- if param1[_loc7_] == "ABCDEFGHIJKLM01234"[_loc5_]:
- _loc2_.append(True)
- _loc5_ = (_loc5_ + 1) % len("ABCDEFGHIJKLM01234")
- elif param1[_loc7_] == "NOPQRSTUVWXYZ56789"[_loc6_]:
- _loc2_.append(False)
- _loc6_ = (_loc6_ + 1) % len("NOPQRSTUVWXYZ56789")
- else:
- raise ValueError("Bad Password")
- _loc7_ = _loc7_ + 1
- return _loc2_
- def _ParseItemString(param1):
- _loc2_ = param1.split("_")
- _loc3_ = []
- _loc4_ = []
- _loc5_ = []
- _loc6_ = int(0)
- while _loc6_ < len(_loc2_):
- if _loc6_ < 9:
- _loc3_.append(int(_loc2_[_loc6_]))
- elif _loc6_ < 18:
- _loc4_.append(int(_loc2_[_loc6_]))
- elif _loc6_ < 27:
- _loc5_.append(int(_loc2_[_loc6_]))
- _loc6_ = _loc6_ + 1
- return [_loc3_,_loc4_,_loc5_]
- returnValue = UsedPassCode(password)
- print(returnValue)
- if returnValue != "SUCCESS!":
- sys.exit()
- section_array = new_game_data
- section_names = ["game_room","game_time","player_maxhp","player_hp","player_x","player_y","coins","equipped_club","inventory","general","keys","times_died","accumulated_time_played","space_rocks","tool_equipped","coins_collected_total","boxes_broken_count","good_food_consumed","bad_food_consumed","Key.JUMP","Key.ACTION","Key.TOOL","Key.MENU"]
- print("---------------------\nDecoded, split password:\n---------------------")
- output = ""
- for i in range(len(section_names)):
- if i in range(19, 23):
- output = output + section_names[i] + ": " + chr(section_array[i]) + "\n"
- print(section_names[i] + ":", chr(section_array[i]))
- else:
- print(section_names[i] + ":", section_array[i])
- output = output + section_names[i] + ": " + str(section_array[i]) + "\n"
- print("---------------------\nFormatted decoded password:\n---------------------")
- print(new_game_data)
- print("---------------------\nRaw decoded password:\n---------------------")
- print(decoded_passcode)
- with open(fileName.replace(":", ".").rstrip("-") + ".pts", "w") as f:
- f.write(password + "\n---------------------\nDecoded, split password:\n---------------------\n" + output + "---------------------\nFormatted decoded password:\n---------------------\n" + str(new_game_data) + "\n---------------------\nRaw decoded password:\n---------------------\n" + decoded_passcode)
- f.close()
- input("Press enter to exit...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement