Skip to content

Instantly share code, notes, and snippets.

@itsJlot
Created April 30, 2023 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsJlot/a789639cc62abdb5bab491666860ce06 to your computer and use it in GitHub Desktop.
Save itsJlot/a789639cc62abdb5bab491666860ce06 to your computer and use it in GitHub Desktop.
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