Feat(store): Add marks store monitoring
This commit is contained in:
112
main.py
112
main.py
@@ -53,49 +53,19 @@ def main():
|
|||||||
|
|
||||||
# Print credit store details
|
# Print credit store details
|
||||||
for store_item in credit_store_details_list:
|
for store_item in credit_store_details_list:
|
||||||
item_name_display = STORE_ITEMS_DETAILS[store_item["description"]["id"]]["display_name"]
|
print_str += create_store_item_details(store_item, characters, chosen_char_index, filter_name_list, filter_score_str, "Credit Store (Ordo Dockets)")
|
||||||
item_base_score = store_item["description"]["overrides"]["baseItemLevel"]
|
|
||||||
|
|
||||||
if filter_name_list[0] != "":
|
|
||||||
matched = False
|
|
||||||
for filter_name in filter_name_list:
|
|
||||||
if filter_name in item_name_display:
|
|
||||||
matched = True
|
|
||||||
break
|
|
||||||
if not matched:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if filter_score_str != "" and item_base_score < int(filter_score_str):
|
checked_marks_store = False
|
||||||
continue
|
if datetime.datetime.utcnow().hour == 1 or not checked_marks_store:
|
||||||
|
checked_marks_store = True
|
||||||
|
|
||||||
item_name = STORE_ITEMS_DETAILS[store_item["description"]["id"]]
|
# Get marks store details
|
||||||
print_str += "====================================\n"
|
marks_store_details_list = get_marks_store_details(access_jwt, account_id, characters[chosen_char_index]["id"], characters[chosen_char_index]["archetype"])
|
||||||
print_str += "Item: %s (Base Stats Score: %d)\n" % (item_name["display_name"], item_base_score)
|
|
||||||
# try:
|
# Print marks store details
|
||||||
# print_str += "Description: %s\n" % item_name["description"]
|
for store_item in marks_store_details_list:
|
||||||
# except:
|
print_str += create_store_item_details(store_item, characters, chosen_char_index, filter_name_list, filter_score_str, "Marks Store (Contract)")
|
||||||
# pass
|
|
||||||
# Stats
|
|
||||||
try:
|
|
||||||
for stats in store_item["description"]["overrides"]["base_stats"]:
|
|
||||||
stats_name = STORE_ITEMS_DETAILS[stats["name"]]
|
|
||||||
print_str += "%s: %d%%\n" % (stats_name, stats["value"]*100)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
# Perks
|
|
||||||
try:
|
|
||||||
for perk in store_item["description"]["overrides"]["perks"]:
|
|
||||||
perk_name = STORE_ITEMS_DETAILS[perk["id"]]
|
|
||||||
print_str += "Perk: %s\n" % perk_name["description"]
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
# Traits
|
|
||||||
try:
|
|
||||||
for perk in store_item["description"]["overrides"]["traits"]:
|
|
||||||
perk_name = STORE_ITEMS_DETAILS[perk["id"]]
|
|
||||||
print_str += "Traits: %s\n" % perk_name["description"]
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if webhook_url != "":
|
if webhook_url != "":
|
||||||
splitted = print_str.split("====================================")
|
splitted = print_str.split("====================================")
|
||||||
@@ -122,7 +92,56 @@ def main():
|
|||||||
print("Sleeping for 1 minute")
|
print("Sleeping for 1 minute")
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
|
|
||||||
pass
|
|
||||||
|
def create_store_item_details(store_item: dict, characters: list, chosen_char_index: int, filter_name_list: list, filter_score_str: str, store_name: str) -> str:
|
||||||
|
print_str = ""
|
||||||
|
item_name_display = STORE_ITEMS_DETAILS[store_item["description"]["id"]]["display_name"]
|
||||||
|
item_base_score = store_item["description"]["overrides"]["baseItemLevel"]
|
||||||
|
|
||||||
|
if filter_name_list[0] != "":
|
||||||
|
matched = False
|
||||||
|
for filter_name in filter_name_list:
|
||||||
|
if filter_name in item_name_display:
|
||||||
|
matched = True
|
||||||
|
break
|
||||||
|
if not matched:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if filter_score_str != "" and item_base_score < int(filter_score_str):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
item_name = STORE_ITEMS_DETAILS[store_item["description"]["id"]]
|
||||||
|
|
||||||
|
print_str += "====================================\n"
|
||||||
|
print_str += "User: %s - %s (%s)\n" % (characters[chosen_char_index]["name"], characters[chosen_char_index]["archetype"], store_name)
|
||||||
|
print_str += "Item: %s (Base Stats Score: %d)\n" % (item_name["display_name"], item_base_score)
|
||||||
|
# try:
|
||||||
|
# print_str += "Description: %s\n" % item_name["description"]
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
|
# Stats
|
||||||
|
try:
|
||||||
|
for stats in store_item["description"]["overrides"]["base_stats"]:
|
||||||
|
stats_name = STORE_ITEMS_DETAILS[stats["name"]]
|
||||||
|
print_str += "%s: %d%%\n" % (stats_name, stats["value"]*100)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
# Perks
|
||||||
|
try:
|
||||||
|
for perk in store_item["description"]["overrides"]["perks"]:
|
||||||
|
perk_name = STORE_ITEMS_DETAILS[perk["id"]]
|
||||||
|
print_str += "Perk: %s\n" % perk_name["description"]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
# Traits
|
||||||
|
try:
|
||||||
|
for perk in store_item["description"]["overrides"]["traits"]:
|
||||||
|
perk_name = STORE_ITEMS_DETAILS[perk["id"]]
|
||||||
|
print_str += "Traits: %s\n" % perk_name["description"]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return print_str
|
||||||
|
|
||||||
def update_refresh_jwt(jwt: str) -> (str, str):
|
def update_refresh_jwt(jwt: str) -> (str, str):
|
||||||
url = "https://bsp-auth-prod.atoma.cloud/queue/refresh"
|
url = "https://bsp-auth-prod.atoma.cloud/queue/refresh"
|
||||||
@@ -158,6 +177,15 @@ def get_credit_store_details(access_jwt: str, account_id: str, character_id: str
|
|||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
return res.json()["personal"]
|
return res.json()["personal"]
|
||||||
|
|
||||||
|
def get_marks_store_details(access_jwt: str, account_id: str, character_id: str, archetype: str) -> dict:
|
||||||
|
url = "https://bsp-td-prod.atoma.cloud/store/storefront/marks_store_%s?accountId=%s&personal=true&characterId=%s" % (archetype, account_id, character_id)
|
||||||
|
headers = {
|
||||||
|
"Authorization": "Bearer " + access_jwt
|
||||||
|
}
|
||||||
|
|
||||||
|
res = requests.get(url, headers=headers)
|
||||||
|
if res.status_code == 200:
|
||||||
|
return res.json()["personal"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user