mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2025-12-14 08:06:23 +08:00
[Enhance] Link Play Unlock for ETR
- Add support for the new client with ETR difficulty in Link Play #160
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from .config_manager import Config
|
||||
from .error import DataExist, InputError, ItemNotEnough, ItemUnavailable, NoData
|
||||
from .error import (DataExist, InputError, ItemNotEnough, ItemUnavailable,
|
||||
NoData)
|
||||
|
||||
|
||||
class Item:
|
||||
|
||||
@@ -11,33 +11,17 @@ from .util import aes_gcm_128_decrypt, aes_gcm_128_encrypt
|
||||
socket.setdefaulttimeout(Constant.LINKPLAY_TIMEOUT)
|
||||
|
||||
|
||||
def get_song_unlock(client_song_map: dict) -> bytes:
|
||||
def get_song_unlock(client_song_map: 'dict[str, list]') -> bytes:
|
||||
'''处理可用歌曲bit,返回bytes'''
|
||||
|
||||
user_song_unlock = [0] * Constant.LINKPLAY_UNLOCK_LENGTH
|
||||
for i in range(0, Constant.LINKPLAY_UNLOCK_LENGTH*2, 2):
|
||||
x = 0
|
||||
y = 0
|
||||
if str(i) in client_song_map:
|
||||
if client_song_map[str(i)][0]:
|
||||
x += 1
|
||||
if client_song_map[str(i)][1]:
|
||||
x += 2
|
||||
if client_song_map[str(i)][2]:
|
||||
x += 4
|
||||
if client_song_map[str(i)][3]:
|
||||
x += 8
|
||||
if str(i+1) in client_song_map:
|
||||
if client_song_map[str(i+1)][0]:
|
||||
y += 1
|
||||
if client_song_map[str(i+1)][1]:
|
||||
y += 2
|
||||
if client_song_map[str(i+1)][2]:
|
||||
y += 4
|
||||
if client_song_map[str(i+1)][3]:
|
||||
y += 8
|
||||
|
||||
user_song_unlock[i // 2] = y*16 + x
|
||||
for k, v in client_song_map.items():
|
||||
for i in range(5):
|
||||
if not v[i]:
|
||||
continue
|
||||
index = int(k) * 5 + i
|
||||
user_song_unlock[index // 8] |= 1 << (index % 8)
|
||||
|
||||
return bytes(user_song_unlock)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from .item import ItemCore
|
||||
from .song import Chart
|
||||
from .sql import Connect, Query, Sql
|
||||
from .util import get_today_timestamp, md5
|
||||
from .world import WorldPlay, BeyondWorldPlay, BreachedWorldPlay
|
||||
from .world import BeyondWorldPlay, BreachedWorldPlay, WorldPlay
|
||||
|
||||
|
||||
class Score:
|
||||
|
||||
Reference in New Issue
Block a user