mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-08-22 00:54:00 -05:00
Added some of my tools cause why not
This commit is contained in:
47
Tools/challenge_parser_catalog.py
Normal file
47
Tools/challenge_parser_catalog.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
def extract_challenge_info(data):
|
||||
challenge_info = {}
|
||||
for item in data:
|
||||
if "RequiredChallengesToComplete" in item.get("Properties", {}):
|
||||
challenges = item["Properties"]["RequiredChallengesToComplete"]
|
||||
for challenge in challenges:
|
||||
challenge_id = challenge.get("ChallengeId")
|
||||
if challenge_id:
|
||||
challenge_data = {
|
||||
"challengeBlueprint": challenge["ChallengeAsset"]["AssetPathName"],
|
||||
"ChallengeCompletionValue": challenge["ChallengeCompletionValue"]
|
||||
}
|
||||
challenge_info[challenge_id] = challenge_data
|
||||
return challenge_info
|
||||
|
||||
|
||||
def log_challenge_info(challenge_info, filename):
|
||||
with open(filename, "a") as f:
|
||||
for challenge_id, info in challenge_info.items():
|
||||
f.write(f"{challenge_id}: {info}\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
output_folder = r"X:\tmp\Output\Exports\TheExit\Content\Items"
|
||||
log_folder = os.path.join(output_folder, "Logs")
|
||||
os.makedirs(log_folder, exist_ok=True)
|
||||
|
||||
broken_items_file = os.path.join(log_folder, "broken_items.txt")
|
||||
challenge_log_file = os.path.join(log_folder, "challenge_log.txt")
|
||||
|
||||
for root, _, files in os.walk(output_folder):
|
||||
for file in files:
|
||||
if file.endswith(".json"):
|
||||
json_file = os.path.join(root, file)
|
||||
with open(json_file, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
challenge_info = extract_challenge_info(data)
|
||||
if challenge_info:
|
||||
log_challenge_info(challenge_info, challenge_log_file)
|
||||
else:
|
||||
with open(broken_items_file, "a") as broken_f:
|
||||
broken_f.write(f"{json_file}\n")
|
||||
27
Tools/dupe_finder.py
Normal file
27
Tools/dupe_finder.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import json
|
||||
|
||||
json_file_path = 'catalog.json'
|
||||
new_json_file_path = 'new_catalog.json'
|
||||
|
||||
def remove_duplicates(file_path):
|
||||
with open(file_path, 'r') as file:
|
||||
data = json.load(file)
|
||||
|
||||
result_data = data["Result"]
|
||||
unique_display_names = set()
|
||||
cleaned_data = []
|
||||
|
||||
for item in result_data:
|
||||
display_name = item[0]["DisplayName"]
|
||||
if display_name not in unique_display_names:
|
||||
unique_display_names.add(display_name)
|
||||
cleaned_data.append(item)
|
||||
|
||||
cleaned_json = {"Result": cleaned_data}
|
||||
|
||||
with open(new_json_file_path, 'w') as outfile:
|
||||
json.dump(cleaned_json, outfile, indent=4)
|
||||
|
||||
print("Duplicates removed and new JSON file created.")
|
||||
|
||||
remove_duplicates(json_file_path)
|
||||
45
Tools/score_generator.py
Normal file
45
Tools/score_generator.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
def generate_player_id():
|
||||
letters = string.ascii_lowercase
|
||||
return '-'.join([''.join(random.choice(letters) for _ in range(1)),
|
||||
''.join(random.choice(string.digits) for _ in range(1)),
|
||||
''.join(random.choice(letters) for _ in range(1)),
|
||||
''.join(random.choice(string.digits) for _ in range(1))])
|
||||
|
||||
|
||||
def generate_player_name():
|
||||
names = ["Mark", "John", "Emily", "Sarah", "David", "Michael", "Lisa", "Jennifer", "Chris", "Alex"]
|
||||
return random.choice(names)
|
||||
|
||||
|
||||
def generate_entries(num_entries):
|
||||
entries = []
|
||||
rank = 0
|
||||
for _ in range(num_entries):
|
||||
player_id = generate_player_id()
|
||||
player_name = generate_player_name()
|
||||
rank = rank + 1
|
||||
# rank = random.randint(1, 10) # Scaled from 1 to 10
|
||||
score = random.randint(1, 10) # Scaled from 1 to 10
|
||||
# percentile = random.randint(1, 100) # Scaled from 1 to 100
|
||||
entry = {
|
||||
"Id": player_id,
|
||||
"Score": score,
|
||||
"Rank": rank,
|
||||
"PlayerName": player_name
|
||||
}
|
||||
entries.append(entry)
|
||||
return entries
|
||||
|
||||
|
||||
# Generate 50 entries
|
||||
num_entries = 50
|
||||
entries = generate_entries(num_entries)
|
||||
|
||||
# Print the entries
|
||||
for entry in entries:
|
||||
entry = str(entry).replace("'", "\"")
|
||||
print(f"{entry},")
|
||||
Reference in New Issue
Block a user