1
0
mirror of synced 2025-02-21 20:29:50 +01:00

41 Commits

Author SHA1 Message Date
beerpsi
58a5177a30 use SQL's limit/offset pagination for nextIndex/maxCount requests (#185)
Instead of retrieving the entire list of items/characters/scores/etc. at once (and even store them in memory), use SQL's `LIMIT ... OFFSET ...` pagination so we only take what we need.

Currently only CHUNITHM uses this, but this will also affect maimai DX and O.N.G.E.K.I. once the PR is ready.

Also snuck in a fix for CHUNITHM/maimai DX's `GetUserRivalMusicApi` to respect the `userRivalMusicLevelList` sent by the client.

### How this works

Say we have a `GetUserCharacterApi` request:

```json
{
    "userId": 10000,
    "maxCount": 700,
    "nextIndex": 0
}
```

Instead of getting the entire character list from the database (which can be very large if the user force unlocked everything), add limit/offset to the query:

```python
select(character)
.where(character.c.user == user_id)
.order_by(character.c.id.asc())
.limit(max_count + 1)
.offset(next_index)
```

The query takes `maxCount + 1` items from the database to determine if there is more items than can be returned:

```python
rows = ...

if len(rows) > max_count:
    # return only max_count rows
    next_index += max_count
else:
    # return everything left
    next_index = -1
```

This has the benefit of not needing to load everything into memory (and also having to store server state, as seen in the [`SCORE_BUFFER` list](2274b42358/titles/chuni/base.py (L13)).)

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/185
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-11-16 19:10:29 +00:00
daydensteve
e49c70b738 more enums! 2024-11-03 16:37:27 -05:00
daydensteve
eacd4a2f43 Adding stock_tickets and stock_count chuni mods. Enables specified tickets to be auto-stocked on login 2024-09-02 20:00:59 -04:00
Kevin Trocolli
44fb6037cf chuni: add missing alembic script 2024-06-29 00:08:11 -04:00
Hay1tsme
b2bd73a8f5 Merge branch 'develop' into develop 2024-06-29 04:03:14 +00:00
beerpsi
a1d54efbac add upserts 2024-06-20 20:28:52 +07:00
EmmyHeart
b3c1dceec9 Add team user points 2024-05-13 08:48:01 +00:00
beerpsi
d5c80cfb0f [mai2/chuni/ongeki] Properly ignore guest plays (#132)
For all three games, guest plays are created using:
```python
0x1000000000001 | ((allnet_place_id & 65535) << 32)
```

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/132
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-04-24 17:00:01 +00:00
beerpsi
40a0817009 CHUNITHM & O.N.G.E.K.I.: Handle userRatingBase*List (#113)
These tables are not used by the game, but are useful for anyone wanting to develop a web UI showing what the player's rating consists of. As such, instead of storing them in JSON columns, I've split them out, one row per each entry.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/113
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-03-14 14:44:32 +00:00
Hay1tsme
05586df08a move to async database 2024-01-09 14:42:17 -05:00
Kevin Trocolli
14fa0f5e8e begin move 2024-01-09 03:07:04 -05:00
Kumubou
5f33b2d3e4 Fix issue in handle_get_user_music_api_request where songs would not always return all scores 2024-01-03 22:05:24 +00:00
EmmyHeart
d0f8568e17 Fixed Rival Music API not returning everything due to iteration issues 2023-12-13 23:28:00 +00:00
EmmyHeart
59db7ad44a Fixed a null condition when importing from Aqua 2023-12-13 05:56:40 +00:00
Kevin Trocolli
fe25359e8e chuni: add userRecentPlayerList check in upsertuserall 2023-11-25 01:00:49 -05:00
Kevin Trocolli
6504f120ad chuni: bandaid fixes for air 2023-11-25 00:31:15 -05:00
Midorica
a8f06ee266 Merge pull request 'Aime Locks/Bans and Chunithm Improvements' (#47) from EmmyHeart/artemis:develop into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/47
2023-10-27 17:25:35 +00:00
DSRLIN
3259552c29 update bug 2023-10-26 05:38:33 +00:00
DSRLIN
b5ce13d1f1 fix chuni songlist duplicate songs and missing diff 2023-10-26 05:37:11 +00:00
EmmyHeart
21cb37001b Stubbed Team Course functions as they do not currently do anything 2023-10-20 03:31:36 +00:00
EmmyHeart
3f8c62044c Optimized rival music list, added ranking API, and began work on Team Courses (need help) 2023-10-20 03:26:51 +00:00
EmmyHeart
3ef40fe85e Removed Team Rank Scaling and fixed RIval Music Data. Also cleaned up extraneous functions 2023-10-16 13:15:39 +00:00
EmmyHeart
bad106ceba Fixed typo with game_cfg/game_config
This resulted in an exception on Plost and earlier, leading to games not actually working.
2023-10-09 06:35:14 +00:00
Midorica
bfaadff9f6 pushing news support customization for chunithm 2023-10-07 12:31:08 -04:00
Midorica
1996f3f356 fix for chunithm song loading after 600 scores 2023-10-07 12:11:24 -04:00
Midorica
1f65cfd2eb Merge pull request 'Added Team and Rival support to Chunithm' (#24) from EmmyHeart/artemis:develop into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/24
2023-10-06 01:48:50 +00:00
Hay1tsme
88a1462304 logger: change from warn to warning 2023-08-08 10:17:56 -04:00
Kevin Trocolli
14a315a673 replace except with except Exception 2023-07-16 16:58:34 -04:00
EmmyHeart
75842b5a88 Add team support, implement team upsert, add rivals 2023-07-11 09:12:34 +00:00
Hay1tsme
d60f827000 fix typing across multiple games, fixes #23 2023-07-05 10:47:43 -04:00
Dniel97
b85a65204f
chuni: added SUN support, matchmaking, fixed bugs, added docs
- Added CHUNITHM SUN support
- Added first matchmaking support with CPU spawning and messages
- Fixed wrong `next_idx` calculations
- Added `startDate` to events to spawn the correct items
- Fixed login bonus per version
- Added information to docs
2023-05-10 21:32:35 +02:00
Dniel97
a60d52b742
chuni: fixed missing login boni IndexError 2023-03-30 22:58:45 +02:00
Dniel97
571a691e0e
chuni: added use_login_bonus check to UserLoginBonusApi 2023-03-28 18:54:27 +02:00
Dniel97
1aa92458f4
chuni: added login bonus (+importer), fixed config strings 2023-03-28 18:28:57 +02:00
Dniel97
2a290f2a3d
chuni: added teams and ticket saving, fixed last played song 2023-03-24 18:10:10 +01:00
Kevin Trocolli
6965132e5b chuni: fix hard error caused by not having the db set up 2023-03-17 02:16:49 -04:00
Dniel97
2af7751504 Added support for maimai and Chunithm in Card Maker 1.34/1.35 (#14)
Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/14
Co-authored-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
Co-committed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
2023-03-15 20:03:22 +00:00
Hay1tsme
a76bb94eb1 let black do it's magic 2023-03-09 11:38:58 -05:00
Hay1tsme
c8d4bc6109 add special-case ping handlers to mai2, ongeki and chuni 2023-03-09 10:52:49 -05:00
Dniel97
3acc2dc197
Initial Card Maker ONGEKI support 2023-03-04 00:22:08 +01:00
Hay1tsme
7e3396a7ff add back games, conform them to new title dispatch 2023-02-17 01:02:21 -05:00