Created
April 30, 2023 23:26
-
-
Save itsJlot/a789639cc62abdb5bab491666860ce06 to your computer and use it in GitHub Desktop.
This file contains 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
try: | |
from steamworks import STEAMWORKS | |
from requests import * | |
# Declare the steamworks variable and create a new instance of the Steamworks class | |
steamworks = STEAMWORKS() | |
# Initialize Steam | |
steamworks.initialize() | |
print("Initialized") | |
# raise Exception("Failed!") | |
auth_sess_ticket = steamworks.Users.GetAuthSessionTicket() | |
auth_sess_ticket = auth_sess_ticket.lower() | |
body = {"TitleId":"C284C","SteamTicket":auth_sess_ticket} | |
res = post("https://C284C.playfabapi.com/Client/LoginWithSteam",data=None,json=body) | |
sessTicket = res.json()["data"]["SessionTicket"] | |
id = res.json()["data"]["PlayFabId"] | |
headers = {"X-Authorization":sessTicket} | |
#print(sessTicket) | |
body = {"IfChangedFromDataVersion":None,"Keys":["CurrentGear","CurrentColour","OwnedStockData"],"PlayFabId":"83B8EFFA8DD58AB","AuthenticationContext":None} | |
statsUrl = "https://C284C.playfabapi.com/Client/GetPlayerStatistics" | |
stats = post(statsUrl,headers=headers,json=body) | |
name = str(steamworks.Friends.GetPlayerName(),"UTF-8") | |
print("TABG stats for player " + name,":") | |
s = stats.json()["data"]["Statistics"] | |
intermediateDict = {} | |
for i in s: | |
print(i["StatisticName"]+":",i["Value"]) | |
intermediateDict[i["StatisticName"]] = i["Value"] | |
try: | |
deaths = intermediateDict["PlayerDeaths"]+1 | |
kills = intermediateDict["PlayerKills"] | |
losses = intermediateDict["PlayerMatchLosses"] | |
xp = intermediateDict["PlayerXP"] | |
wins = intermediateDict["PlayerMatchWins"] | |
level = intermediateDict["PlayerLevel"] | |
deaths = min((wins+losses*2),deaths) | |
matches = losses+wins+1 | |
kpm = kills/matches | |
wlr = wins/(matches) | |
print("\n\n\n\nYour k/d is: ", kills/deaths) | |
print("Your win/loss ratio is: ", wins/(losses)) | |
saltigue_metric = wlr * 100 * kpm + level | |
print("Your Jlot metric power level is: ",int(kills/deaths*wins**3/(wins+losses+1)+level)) | |
print("Your Saltigue metric power level is: ", int(saltigue_metric)) | |
print("Please note that these are extremely arbitrary and just meant for fun :)") | |
except Exception: | |
print("Could not calculate powerlevel. Must be too high!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment