Pre-support 4ex dlc

This commit is contained in:
UnitedAirforce
2025-02-03 20:12:09 +08:00
parent db084c44e6
commit 3e3c0ab575

53
7001.py
View File

@@ -600,17 +600,6 @@ def result():
tree = ET.parse(file_path)
root = tree.getroot()
# Increment coin for user
with sqlite3.connect(DATABASE) as connection:
cursor = connection.cursor()
cursor.execute("SELECT coin FROM daily_reward WHERE device_id = ?", (device_id,))
row = cursor.fetchone()
if row:
current_coin = row[0] if row[0] else start_coin
updated_coin = current_coin + coin_reward
cursor.execute("UPDATE daily_reward SET coin = ? WHERE device_id = ?", (updated_coin, device_id))
# Save the record
vid = decrypted_fields[b'vid'][0].decode()
stts = decrypted_fields[b'stts'][0].decode()
@@ -633,6 +622,19 @@ def result():
do_update_vid = False
last_row_id = 0
if (int(id) not in range(616, 1000) or int(mode) not in range(10, 14)):
# Increment coin for user, if track is not 4max dlx pack mobile difficulty.
with sqlite3.connect(DATABASE) as connection:
cursor = connection.cursor()
cursor.execute("SELECT coin FROM daily_reward WHERE device_id = ?", (device_id,))
row = cursor.fetchone()
if row:
current_coin = row[0] if row[0] else start_coin
updated_coin = current_coin + coin_reward
cursor.execute("UPDATE daily_reward SET coin = ? WHERE device_id = ?", (updated_coin, device_id))
#Try to add play record to result table (don't add if playing placeholder songs)
#parse whether or not the device is logged in to taito ID
sid = ""
@@ -800,6 +802,13 @@ def web_shop():
coin = result[2] if result[2] else 0
if (cnt_type == "1"):
if (700 not in my_stage and os.path.isfile('./files/dlc_4max.html')):
buttons_html += """
<a href="wwic://web_shop_detail?&cnt_type=1&cnt_id=-1">
<img src="/files/web/dlc_4max.jpg" style="width: 84%; margin-bottom: 20px; margin-top: -100px;" />
</a><br>
"""
for idx, i in enumerate(range(100, 616)):
if i not in my_stage:
if i not in exclude_stage_exp:
@@ -872,6 +881,7 @@ def web_shop_detail():
html = ""
if (cnt_type == "1"):
if (cnt_id != -1):
song = song_list[cnt_id]
difficulty_levels = "/".join(map(str, song.get("difficulty_levels", [])))
song_stage_price = stage_price
@@ -932,7 +942,10 @@ def web_shop_detail():
else:
html = "<p>Item not found.</p>"
if (cnt_type == "1" and cnt_id == -1):
source_html = f"files/dlc_4max.html"
else:
source_html = f"files/web_shop_detail.html"
html += f"""
<br>
<div class="buttons" style="margin-top: 20px;">
@@ -941,7 +954,7 @@ def web_shop_detail():
</div>
"""
with open(f"files/web_shop_detail.html", "r", encoding="utf-8") as file:
with open(source_html, "r", encoding="utf-8") as file:
html_content = file.read().format(text=html, coin=coin)
return html_content
else:
@@ -976,6 +989,20 @@ def buy_by_coin():
# Process based on cnt_type
if cnt_type == "1":
if cnt_id == -1:
song_stage_price = 300
if coin < song_stage_price:
return fail_url
stages = set(json.loads(my_stage)) if my_stage else set()
for i in range(617, 950):
if i not in stages:
stages.add(i)
coin -= song_stage_price
my_stage = json.dumps(list(stages))
else:
song_stage_price = stage_price
if (len(song_list[cnt_id]["difficulty_levels"]) == 6):
song_stage_price = song_stage_price * 2