Last active
September 19, 2019 22:53
-
-
Save WardPearce/e8cb8d9db673c28616566698b67d1170 to your computer and use it in GitHub Desktop.
Easily converts SteamID64 or 32 into both 32 & 64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def steamid_convert(given_id): | |
steam64id = 76561197960265728 | |
if "STEAM_0" in given_id or "STEAM_1" in given_id: | |
id_split = given_id.split(":") | |
steam64id += int(id_split[2]) * 2 | |
if id_split[1] == "1": | |
steam64id += 1 | |
return_data = [given_id.replace("STEAM_0", "STEAM_1"), steam64id] | |
elif given_id.isdigit() and len(given_id) == 17: | |
y = int(given_id) - steam64id | |
x = y % 2 | |
return_data = ["STEAM_1:{}:{}".format(x, (y - x) // 2), given_id] | |
else: | |
return_data = False | |
return return_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment