mirror of
https://github.com/drmext/MonkeyBusiness.git
synced 2024-12-02 19:17:17 +01:00
Fix slow loading DDR records again
This commit is contained in:
parent
449826e4e7
commit
381b26b152
@ -472,26 +472,20 @@ async def usergamedata_advanced(request: Request):
|
|||||||
|
|
||||||
load = []
|
load = []
|
||||||
names = {}
|
names = {}
|
||||||
for r in scores:
|
|
||||||
if r["ddr_id"] not in names:
|
profiles = get_db().table("ddr_profile")
|
||||||
names[r["ddr_id"]] = {}
|
for p in profiles:
|
||||||
names[r["ddr_id"]]["name"] = get_common(r["ddr_id"], game_version, 27)
|
names[p["ddr_id"]] = {}
|
||||||
names[r["ddr_id"]]["area"] = int(
|
try:
|
||||||
str(get_common(r["ddr_id"], game_version, 3)), 16
|
names[p["ddr_id"]]["name"] = p["version"][str(game_version)][
|
||||||
)
|
"common"
|
||||||
load.append(
|
].split(",")[27]
|
||||||
{
|
names[p["ddr_id"]]["area"] = int(
|
||||||
"mcode": r["mcode"],
|
str(p["version"][str(game_version)]["common"].split(",")[3]), 16
|
||||||
"difficulty": r["difficulty"],
|
|
||||||
"rank": r["rank"],
|
|
||||||
"lamp": r["lamp"],
|
|
||||||
"name": names[r["ddr_id"]]["name"],
|
|
||||||
"area": names[r["ddr_id"]]["area"],
|
|
||||||
"ddr_id": r["ddr_id"],
|
|
||||||
"score": r["score"],
|
|
||||||
"ghostid": r["ghostid"],
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
except KeyError:
|
||||||
|
names[p["ddr_id"]]["name"] = "UNKNOWN"
|
||||||
|
names[p["ddr_id"]]["area"] = 13
|
||||||
|
|
||||||
response = E.response(
|
response = E.response(
|
||||||
E.playerdata(
|
E.playerdata(
|
||||||
@ -500,18 +494,28 @@ async def usergamedata_advanced(request: Request):
|
|||||||
E.recordtype(loadflag, __type="s32"),
|
E.recordtype(loadflag, __type="s32"),
|
||||||
*[
|
*[
|
||||||
E.record(
|
E.record(
|
||||||
E.mcode(s["mcode"], __type="u32"),
|
E.mcode(r["mcode"], __type="u32"),
|
||||||
E.notetype(s["difficulty"], __type="u8"),
|
E.notetype(r["difficulty"], __type="u8"),
|
||||||
E.rank(s["rank"], __type="u8"),
|
E.rank(r["rank"], __type="u8"),
|
||||||
E.clearkind(s["lamp"], __type="u8"),
|
E.clearkind(r["lamp"], __type="u8"),
|
||||||
E.flagdata(0, __type="u8"),
|
E.flagdata(0, __type="u8"),
|
||||||
E.name(s["name"], __type="str"),
|
E.name(
|
||||||
E.area(s["area"], __type="s32"),
|
names[r["ddr_id"]]["name"]
|
||||||
E.code(s["ddr_id"], __type="s32"),
|
if r["ddr_id"] in names
|
||||||
E.score(s["score"], __type="s32"),
|
else "UNKNOWN",
|
||||||
E.ghostid(s["ghostid"], __type="s32"),
|
__type="str",
|
||||||
|
),
|
||||||
|
E.area(
|
||||||
|
names[r["ddr_id"]]["area"]
|
||||||
|
if r["ddr_id"] in names
|
||||||
|
else 13,
|
||||||
|
__type="s32",
|
||||||
|
),
|
||||||
|
E.code(r["ddr_id"], __type="s32"),
|
||||||
|
E.score(r["score"], __type="s32"),
|
||||||
|
E.ghostid(r["ghostid"], __type="s32"),
|
||||||
)
|
)
|
||||||
for s in load
|
for r in scores
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -472,20 +472,29 @@ async def usergamedata_advanced(request: Request):
|
|||||||
|
|
||||||
load = []
|
load = []
|
||||||
names = {}
|
names = {}
|
||||||
for r in scores:
|
|
||||||
if r["ddr_id"] not in names:
|
profiles = get_db().table("ddr_profile")
|
||||||
names[r["ddr_id"]] = {}
|
for p in profiles:
|
||||||
names[r["ddr_id"]]["name"] = get_common(r["ddr_id"], game_version, 27)
|
names[p["ddr_id"]] = {}
|
||||||
names[r["ddr_id"]]["area"] = int(
|
try:
|
||||||
str(get_common(r["ddr_id"], game_version, 3)), 16
|
names[p["ddr_id"]]["name"] = p["version"][str(game_version)][
|
||||||
|
"common"
|
||||||
|
].split(",")[27]
|
||||||
|
names[p["ddr_id"]]["area"] = int(
|
||||||
|
str(p["version"][str(game_version)]["common"].split(",")[3]), 16
|
||||||
)
|
)
|
||||||
|
except KeyError:
|
||||||
|
names[p["ddr_id"]]["name"] = "UNKNOWN"
|
||||||
|
names[p["ddr_id"]]["area"] = 13
|
||||||
|
|
||||||
|
for r in scores:
|
||||||
s = [
|
s = [
|
||||||
r["mcode"],
|
r["mcode"],
|
||||||
r["difficulty"],
|
r["difficulty"],
|
||||||
r["rank"],
|
r["rank"],
|
||||||
r["lamp"],
|
r["lamp"],
|
||||||
names[r["ddr_id"]]["name"],
|
names[r["ddr_id"]]["name"] if r["ddr_id"] in names else "UNKNOWN",
|
||||||
names[r["ddr_id"]]["area"],
|
names[r["ddr_id"]]["area"] if r["ddr_id"] in names else 13,
|
||||||
r["ddr_id"],
|
r["ddr_id"],
|
||||||
r["score"],
|
r["score"],
|
||||||
r["ghostid"],
|
r["ghostid"],
|
||||||
|
Loading…
Reference in New Issue
Block a user