mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-04-26 16:26:46 -05:00
Added BASE inventory, DLC unlocks and DG1 unlocks via DB
This commit is contained in:
parent
bd5ba12d88
commit
087e50341b
|
|
@ -421,7 +421,8 @@ def moderation_check_username():
|
|||
request_var = request.get_json()
|
||||
userid = sanitize_input(request_var["userId"])
|
||||
username = sanitize_input(request_var["username"])
|
||||
# temp test
|
||||
if userid == "d7662a88-72f4-4279-a985-c2c6ac0a8404":
|
||||
return jsonify({"List": [{"UserId": userid, "PlayerName": "DEV: HEX: Dino Nuggies"}]})
|
||||
return jsonify({
|
||||
"PlayerName": username,
|
||||
"UserId": userid
|
||||
|
|
@ -659,21 +660,7 @@ def inventories():
|
|||
session_cookie = sanitize_input(request.cookies.get("bhvrSession"))
|
||||
userid = session_manager.get_user_id(session_cookie)
|
||||
|
||||
try:
|
||||
page = request.args.get('page', default=0, type=int)
|
||||
limit = request.args.get('limit', default=500, type=int)
|
||||
items = mongo.get_data_with_list(login=userid, login_steam=False, items={"inventory"})
|
||||
inventory = []
|
||||
for item in items["inventory"]:
|
||||
inventory.append({"quantity": 1, "objectId": item, "lastUpdateAt": 1574612664})
|
||||
|
||||
if page == 0:
|
||||
return jsonify({
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"playerId": "userid",
|
||||
"inventory": [
|
||||
base_inventory = [
|
||||
{'quantity': 1, 'objectId': '69055D534DF27180C4B36CAB4B651054', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '5A2DD3F6433AB83A725513B868D240CF', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '5D230967452FEEE13F1CA780F580E889', 'lastUpdateAt': 1574612664},
|
||||
|
|
@ -865,13 +852,70 @@ def inventories():
|
|||
{'quantity': 1, 'objectId': '0E262D7A47567BE03A49ABA756FC1482', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '8EFCD5CC464EBFE1B7B03A984563710A', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '336D01F84D412B0D0D38F39311CA8D64', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '487DEBE247818A01797AF5B3FD04C2B2', 'lastUpdateAt': 1574612664}]
|
||||
}
|
||||
})
|
||||
{'quantity': 1, 'objectId': '487DEBE247818A01797AF5B3FD04C2B2', 'lastUpdateAt': 1574612664}
|
||||
]
|
||||
deathgarden_1_inventory = [
|
||||
{'quantity': 1, 'objectId': 'FD93572C4CF2DFD134E6D9A90252F665', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'C645C7AC405B3D8AF8E73B946875F0AE', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'DADB36D34727AD788367D58873AB2106', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '428EE16F4F00056E576CC29ED83B8DAB', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '996863814494FF8C7B9531A7478FE762', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'BEF2872E4B3188B43B77EA9DCDFDE0AE', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'C0F44BF0417ACA353D0B8E8A26B1B1AB', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '0EB2781D45D950C6525B8CA308811AA3', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '0FDDDD6A45C0856D0B3EA785B1F508BC', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'D60E21A84EADE0E910DF2FAD7D382699', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'E59F6A1E4513039087919CA078090BFB', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'EF96A20249884D437B87A6A4BDE81B7F', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '2B011E8F46C37F900F8D40A9A73782EB', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '6A7E87AC403EF62B151C27A051B2E373', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'F4B0185D41460D68A0CF7D9A00ACB6E7', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '7474DFFE4A04B58BA12954B430637120', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '29447D464334997ECF872F8B08FDC442', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '2837D67046DAE1E3BE4E749A51BB555B', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'EF8E713B41CA7626D83D39BF05600FA4', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '34918BAF4507ECE322853D8D6DFE81D4', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '755D4DFE40DA1512B01E3D8CFF3C8D4D', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'B35F363447360EC17BE1BD92D827E08B', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '0ADDB41F4216A32D8F1853BAB25D20F2', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'DF5E3FD049902AB5DC1B3C8E22625AAF', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'E501095545F87E64AAFC74A04F1CFF5B', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'F9D4700D47DC559C7CCE11800F3A318A', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '6FF69DEE4FBC9CE82CC2818EE7864EAB', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '03175A2941AB8800F4CAF39ADCDDC663', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '7E2AB46D4BA6F40F03BA768A6F31DB17', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '8968BDBD4AB5F7017A446BB78416EB29', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '97CD4AEA444D6BD2CD218E92B7B12A33', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '098612FC4A3C827849BB55A59C2BC258', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '40E89D554CD74E398E5BAF86369E7C81', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '4302DF13418EC9BE3C8E119F390AACE2', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '865A380D485284B3C5A9409E04C22551', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '3EF7ED3449B8EA4E19BEDFBD100B1DFA', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': '0600201B48B6E1F0B583039E01F8E909', 'lastUpdateAt': 1574612664},
|
||||
{'quantity': 1, 'objectId': 'C300E3A84E571D549E014B9051A18BE8', 'lastUpdateAt': 1574612664}
|
||||
|
||||
]
|
||||
|
||||
try:
|
||||
page = request.args.get('page', default=0, type=int)
|
||||
limit = request.args.get('limit', default=500, type=int)
|
||||
items = mongo.get_data_with_list(login=userid, login_steam=False, items={"inventory"})
|
||||
for item in items["inventory"]:
|
||||
base_inventory.append({"quantity": 1, "objectId": item, "lastUpdateAt": 1574612664})
|
||||
|
||||
hasPlayedDeathGarden1 = mongo.get_data_with_list(login=userid, login_steam=False, items={"hasPlayedDeathGarden1"})["hasPlayedDeathGarden1"]
|
||||
if hasPlayedDeathGarden1:
|
||||
for item in deathgarden_1_inventory:
|
||||
base_inventory.append(item)
|
||||
|
||||
if page == 0:
|
||||
return jsonify({
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"data": inventory
|
||||
"data": {
|
||||
"playerId": "userid",
|
||||
"inventory": base_inventory,
|
||||
}
|
||||
})
|
||||
elif page == 1:
|
||||
return jsonify({"Code": 200, "Message": "OK", "Data": {"PlayerId": userid, "Inventory": [
|
||||
|
|
@ -1279,13 +1323,15 @@ def update_metadata_group():
|
|||
|
||||
mongo.write_data_with_list(login=userid, login_steam=False, items_dict=database_dict)
|
||||
|
||||
elif reason == "OnRequestCharacterOverrideEvent":
|
||||
# todo Find out what this does and who triggerd it how
|
||||
logger.graylog_logger(level="info",
|
||||
handler="updateMetadataGroup",
|
||||
message=f"REASON: OnRequestCharacterOverrideEvent, DATA: {data}")
|
||||
|
||||
else:
|
||||
logger.graylog_logger(level="error", handler="updateMetadataGroup", message=f"New reason: {reason}")
|
||||
|
||||
# data = get_init_or_get_groups(userid, fake_request)
|
||||
# return jsonify(data)
|
||||
|
||||
return jsonify({"userId": userid,
|
||||
"stateName": "MetadataGroups",
|
||||
"objectId": "PlayerMetadata",
|
||||
|
|
@ -1301,24 +1347,63 @@ def update_metadata_group():
|
|||
logger.graylog_logger(level="error", handler="logging_updateMetadataGroup", message=e)
|
||||
|
||||
|
||||
# Should be correct se PDB 0.8.0
|
||||
# Should be correct see PDB 0.8.0
|
||||
@app.route("/api/v1/extensions/inventory/unlockSpecialItems", methods=["POST"])
|
||||
def inventory_unlock_special_items():
|
||||
check_for_game_client("strict")
|
||||
session_cookie = sanitize_input(request.cookies.get("bhvrSession"))
|
||||
userid = session_manager.get_user_id(session_cookie)
|
||||
data = request.get_json()["data"]["additionalSteamAppIds"]
|
||||
|
||||
unlocked_items = []
|
||||
|
||||
origin_sets_artbook_items = ["34918BAF4507ECE322853D8D6DFE81D4", "4302DF13418EC9BE3C8E119F390AACE2",
|
||||
"3EF7ED3449B8EA4E19BEDFBD100B1DFA", "40E89D554CD74E398E5BAF86369E7C81",
|
||||
"C645C7AC405B3D8AF8E73B946875F0AE", "6A7E87AC403EF62B151C27A051B2E373",
|
||||
"29447D464334997ECF872F8B08FDC442", "F4B0185D41460D68A0CF7D9A00ACB6E7"]
|
||||
dbd_items = ["4EDACCF844B8025FD89C7BAB6B0005A2", "9F54DE7A4E15935B503850A127B0A2A4"]
|
||||
terminator_set_items = ["EADE3240481E7372624FF2B186ADE4D8", "ED13D15E4439C1C19281D2AFDD4C5B96",
|
||||
"5AC2450640153C86DF57FA84500DA45C", "361D68284314B8A0A9432D913C93C9C0",
|
||||
"B42F8BA04A4294BAF95A4090E62F66BC", "1B00252A45A9206224ECE5816C99A2A3"]
|
||||
alienware_outfit_items = ["ADC2570E4BD4D9AD5FAB21B974B807EC", "D4D6E33D42EE0DDDA24DA983C70209EC",
|
||||
"EAF477EC4CE75EACAE8E4ABE22AD8E4D", "996F45A64E6E2E7B2B72B9BABA86F86D"]
|
||||
hearts_and_minds_items = ["70A09B4348F9DA5B1EEF0786DB1911AC", "221B6B19499A30944F8F4A969EB2B83D"]
|
||||
|
||||
user_inventory = mongo.get_data_with_list(login=userid, login_steam=False, items={"inventory"})
|
||||
|
||||
writen_sets = mongo.get_data_with_list(login=userid, login_steam=False, items={"unlocked_special_item_ids"})["unlocked_special_item_ids"]
|
||||
if 872770 in data and 872770 not in writen_sets:
|
||||
unlocked_items.extend(origin_sets_artbook_items)
|
||||
writen_sets.append(872770)
|
||||
if 381210 in data and 381210 not in writen_sets:
|
||||
unlocked_items.extend(dbd_items)
|
||||
writen_sets.append(381210)
|
||||
if 1024660 in data and 1024660 not in writen_sets:
|
||||
unlocked_items.extend(terminator_set_items)
|
||||
writen_sets.append(1024660)
|
||||
if 1083130 in data and 1083130 not in writen_sets:
|
||||
unlocked_items.extend(alienware_outfit_items)
|
||||
writen_sets.append(1083130)
|
||||
if 920440 in data and 920440 not in writen_sets:
|
||||
unlocked_items.extend(hearts_and_minds_items)
|
||||
writen_sets.append(920440)
|
||||
|
||||
for item in unlocked_items:
|
||||
if item not in user_inventory["inventory"]:
|
||||
user_inventory["inventory"].append(item)
|
||||
|
||||
mongo.write_data_with_list(login=userid, login_steam=False, items_dict=user_inventory)
|
||||
if len(writen_sets) != 0:
|
||||
mongo.write_data_with_list(login=userid, login_steam=False, items_dict={"unlocked_special_item_ids": writen_sets})
|
||||
|
||||
try:
|
||||
logger.graylog_logger(level="info", handler="unknown_unlockSpecialItems", message=request.get_json())
|
||||
return jsonify({"UnlockedItems": []})
|
||||
return jsonify({"unlockedItems": unlocked_items})
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
logger.graylog_logger(level="error", handler="unknown_unlockSpecialItems", message=e)
|
||||
|
||||
|
||||
# POST https://api.zkwolf.com//api/v1/extensions/progression/resetCharacterProgressionForPrestige HTTP/1.1
|
||||
# {"data":{"characterId":"755D4DFE40DA1512B01E3D8CFF3C8D4D"}}
|
||||
@app.route("/api/v1/extensions/progression/resetCharacterProgressionForPrestige", methods=["POST"])
|
||||
def reset_prestige():
|
||||
check_for_game_client("strict")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class Mongo:
|
|||
'special_unlocks': [],
|
||||
'challenges': [],
|
||||
'unread_msg_ids': [],
|
||||
'unlocked_special_item_ids': [],
|
||||
'daily_challenges': [
|
||||
{
|
||||
'challenge_id': "",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user