Skip to content

Commit

Permalink
change stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrErde committed Dec 30, 2023
1 parent 918858d commit 1f24d3a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
python script/generate_characters.py
python script/generate_boards.py
python script/collections.py
python script/collection.py
python script/calender.py
- name: Increse version
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ Other [docs/info](docs/info.md)

---

| Id | Name | Default Value | File |
| ----------------- | ------------------ | ------------------- | -------------------------------------------------------- |
| `highscore` | Highscore | 2147483647 | [Android/.../user_stats.json](src/profile/user_stats.json) |
| `currentScore` | CurrentScore | 9223372036854775807 | [Android/.../top_run.json](src/profile/top_run.json) |
| 1 | Coins | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 2 | Keys | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 3 | Shop Boards | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 4 | Shop Headstart | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 5 | Shop Score Booster | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 6 | Event Coins | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| `collectedTokens` | Season Tokens | 2 | [Android/.../season_hunt.json](src/profile/season_hunt.json) |
| `currencyPickupModifiers.doubleCoins` | Double Coins | 2 | [Android/.../upgrades.json](src/profile/upgrades.json) |
| `currencyPickupModifiers.permanent_score_multiplier.expirationValue` | Token Boost Time | 99999999999999 | [Android/.../upgrades.json](src/profile/upgrades.json) |
| Id | Name | Default Value | File |
| -------------------------------------------- | ------------------ | ------------------- | ------------------------------------------------------------ |
| `highscore` | Highscore | 2147483647 | [Android/.../user_stats.json](src/profile/user_stats.json) |
| `currentScore` | CurrentScore | 9223372036854775807 | [Android/.../top_run.json](src/profile/top_run.json) |
| 1 | Coins | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 2 | Keys | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 3 | Shop Boards | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 4 | Shop Headstart | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 5 | Shop Score Booster | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| 6 | Event Coins | 2100000000 | [Android/.../wallet.json](src/profile/wallet.json) |
| `collectedTokens` | Season Tokens | 2 | [Android/.../season_hunt.json](src/profile/season_hunt.json) |
| `doubleCoins` | Double Coins | 2 | [Android/.../upgrades.json](src/profile/upgrades.json) |
| `permanent_score_multiplier.expirationValue` | Token Boost Time | 99999999999999 | [Android/.../upgrades.json](src/profile/upgrades.json) |
File renamed without changes.
9 changes: 6 additions & 3 deletions script/generate_boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
item2s = item.get("upgrades", "none")

item2_data = {}
if item2s != "none":
if item2s != "none" and item2s is not None:
for item2 in item2s:
item2_id = item2["id"]
item2_data[item2_id] = {"value": True}
Expand All @@ -23,14 +23,17 @@
"ownedUpgrades": {
"default": {"value": True},
**item2_data,
}
},
}
}

item_data_list[item_id] = list_data

# Generate the output
inventory_data = {"version": 3, "data": {"selected": "default", "owned": item_data_list}}
inventory_data = {
"version": 3,
"data": {"selected": "default", "owned": item_data_list},
}

# Write the output file
with open("src/profile/boards_inventory.json", "w", encoding="utf-8") as f:
Expand Down
8 changes: 7 additions & 1 deletion script/generate_characters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
item_data_list[item_id] = {"value": {"id": item_id, "ownedOutfits": item2_data}}

# Generate the output
inventory_data = {"version": 3, "data": {"selected": {"character": "jake", "outfit": "default"}, "owned": item_data_list}}
inventory_data = {
"version": 3,
"data": {
"selected": {"character": "jake", "outfit": "default"},
"owned": item_data_list,
},
}

# Write the output file
with open("src/profile/characters_inventory.json", "w", encoding="utf-8") as f:
Expand Down
31 changes: 16 additions & 15 deletions script/setup.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
import requests
import os
import concurrent.futures
from concurrent.futures import ThreadPoolExecutor

org_name = "HerrErde"
repo_name = "subway-source"


def get_release_assets():
def get_release():
base_url = f"https://api.github.com/repos/{org_name}/{repo_name}/releases/latest"
response = requests.get(base_url).json()
return response.get("assets", [])


def download_asset(asset):
def download_asset(session, asset):
asset_url = asset["browser_download_url"]
asset_name = os.path.basename(asset_url)

try:
with open(asset_name, "wb") as file:
file.write(requests.get(asset_url).content)
print(f"Downloaded {asset_name}")
except requests.RequestException as e:
print(f"Failed to download {asset_name}: {str(e)}")
# Only download files that contain "_data.json"
if "_data.json" in asset_name:
try:
with session.get(asset_url) as response:
response.raise_for_status()
with open(asset_name, "wb") as file:
file.write(response.content)
print(f"Downloaded {asset_name}")
except requests.RequestException as e:
print(f"Failed to download {asset_name}: {str(e)}")


def download_assets(assets):
with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(download_asset, assets)
with ThreadPoolExecutor() as executor, requests.Session() as session:
executor.map(download_asset, [session] * len(assets), assets)


if __name__ == "__main__":
release_assets = get_release_assets()
if release_assets:
download_assets(release_assets)
download_assets(get_release())

0 comments on commit 1f24d3a

Please sign in to comment.