This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathps3d_api.py
273 lines (244 loc) · 11.1 KB
/
ps3d_api.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
from urllib.parse import urlencode
from requests import get, post
class PS3D:
def __init__(
self,
url="http://pixelstrike3daws.com/",
platform=11,
version="8.9.0",
X_Unity_Version="2020.3.11f1",
playFabId="XXXXXXXXXXXXXXXX",
token="XXXXXXXXXXXXXXXX-XXXXX-XXXXXXXXXXXXXXX-H4LgPw5gQp51hLqxNOX05Z5if5mHfXa6tlwTonic8Ms=",
season=6,
device_id="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
mobile=1,
server="na1"
):
self.url = url
self.platform = platform
self.version = version
self.X_Unity_Version = X_Unity_Version
self.playFabId = playFabId.upper()
self.token = token
self.season = season
self.device_id = device_id.upper()
self.mobile = mobile
self.server = server
self.account = self.get_account()
def get_version_info(self):
return get(self.url + "new/version-info2.php?platform=" + str(self.platform) + "&ver=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version}).json()
def get_account(self):
return post(self.url + "new/load-account.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"season": self.season,
"hash": self.device_id
})).json()
def get_servers(self):
return post(self.url + "get-servers.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"version": self.version,
"mobile": self.mobile
})).json()
def set_status(self, status=1, game=''):
return post(self.url + "social/set-status.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"status": status,
"game": game,
"server": self.server
})).text
def get_news(self):
return post(self.url + "new/get-news.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token
})).json()
def get_online_friends(self):
return post(self.url + "new/get-online-friends.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token
})).json()["online"]
def buy_item(self, item_id=1965):
return post(self.url + "new/buy-item.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"itemId": item_id
})).json()["code"]
def validate_purchase(self):
return post(self.url + "new/validate-purchase.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token
})).json()["code"]
def get_invites(self):
return post(self.url + "clans/get-invites.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"]
})).json()["invites"]
def search_clans(self, clan="clan"):
return post(self.url + "clans/search-clans.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"search": clan
})).json()["clans"]
def get_leaderboards(self, clanID=-1):
return post(self.url + "clans/get-leaderboards.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"clanID": clanID
})).json()
def get_clan(self, clanID=1):
return post(self.url + "clans/get-clan.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"clanID": clanID
})).json()
def get_profile(self, otherID=1):
return post(self.url + "social/get-profile.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"otherID": otherID
})).json()
def follow(self, otherID=1):
return post(self.url + "social/follow.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"otherID": otherID
}))
def unfollow(self, otherID=1):
return post(self.url + "social/unfollow.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"otherID": otherID
}))
def load_stats(self, playerId=1):
return post(self.url + "new/load-stats.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"playerId": playerId
})).json()
def load_following(self):
return post(self.url + "new/load-following.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"userId": self.account["userId"]
})).json()
def update_display_name(self, displayName="TonicBoomerKewl"):
return post(self.url + "new/update-display-name.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"displayName": displayName
})).json()["code"]
def sync_data(
self,
rank=1,
prestige=0,
display_name="TonicBoomerKewl",
hat=-1,
hatSkin=-1,
trail=-1,
gear=-1,
gearSkin=-1,
boots=-1,
bootsSkin=-1,
coins=0,
credits_=0,
pic='',
skin=699,
custom_skin=0,
skin_type=0
):
return post(self.url + "social/sync-data-5-5-0.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"rank": rank,
"prestige": prestige,
"display_name": display_name,
"hat": hat,
"hatSkin": hatSkin,
"trail": trail,
"gear": gear,
"gearSkin": gearSkin,
"boots": boots,
"bootsSkin": bootsSkin,
"coins": coins,
"credits": credits_,
"pic": pic,
"skin": skin,
"custom_skin": custom_skin,
"skin_type": skin_type
}))
def get_daily(self, gameMode="freeforall"):
return post(self.url + "leaderboards/get-daily.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"gameMode": gameMode
})).json()
def get_currency(self):
return post(self.url + "new/get-currency.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token
})).json()
def open_case(self, parts=0):
return post(self.url + "new/open-case.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token,
"parts": parts
})).json()
def claim_free_case(self):
return post(self.url + "new/claim-free-case.php?v=" + self.version,
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"playFabId": self.playFabId,
"sessionTicket": self.playFabId + '--' + self.token
})).json()
def get_roster(self, clanID=1):
return post(self.url + "clans/get-roster.php",
headers={"X-Unity-Version": self.X_Unity_Version},
data=urlencode({
"userID": self.account["userId"],
"userHash": self.account["userHash"],
"clanID": clanID
})).json()
# BONUS API:
@staticmethod
def get_gameguardian_info(ver="101.1", lang="en_US"):
return get("https://gameguardian.net/GG_logs/version.php?v=" + ver + "&l=" + lang + "&t=~~~" + lang + "~~~") \
.text