Fixed note scroll speed defaulting to 0.5x for newly registered profiles.
Introduced several new interfaces, and refactored code to cleanup profiles.ts
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
export interface BattleDataResponse
|
||||
{
|
||||
info: {
|
||||
orb: KITEM<'s32'>,
|
||||
get_gb_point: KITEM<'s32'>,
|
||||
send_gb_point: KITEM<'s32'>,
|
||||
}
|
||||
greeting: {
|
||||
greeting_1: KITEM<'str'>,
|
||||
greeting_2: KITEM<'str'>,
|
||||
greeting_3: KITEM<'str'>,
|
||||
greeting_4: KITEM<'str'>,
|
||||
greeting_5: KITEM<'str'>,
|
||||
greeting_6: KITEM<'str'>,
|
||||
greeting_7: KITEM<'str'>,
|
||||
greeting_8: KITEM<'str'>,
|
||||
greeting_9: KITEM<'str'>,
|
||||
|
||||
}
|
||||
setting: {
|
||||
matching: KITEM<'s32'>,
|
||||
info_level: KITEM<'s32'>,
|
||||
}
|
||||
|
||||
score: {
|
||||
battle_class: KITEM<'s32'>,
|
||||
max_battle_class: KITEM<'s32'>,
|
||||
battle_point: KITEM<'s32'>,
|
||||
win: KITEM<'s32'>,
|
||||
lose: KITEM<'s32'>,
|
||||
draw: KITEM<'s32'>,
|
||||
consecutive_win: KITEM<'s32'>,
|
||||
max_consecutive_win: KITEM<'s32'>,
|
||||
glorious_win: KITEM<'s32'>,
|
||||
max_defeat_skill: KITEM<'s32'>,
|
||||
latest_result: KITEM<'s32'>,
|
||||
|
||||
}
|
||||
history: {}
|
||||
}
|
||||
|
||||
export function getDefaultBattleDataResponse() : BattleDataResponse {
|
||||
return {
|
||||
info: {
|
||||
orb: K.ITEM('s32', 0),
|
||||
get_gb_point: K.ITEM('s32', 0),
|
||||
send_gb_point: K.ITEM('s32', 0),
|
||||
},
|
||||
greeting: {
|
||||
greeting_1: K.ITEM('str', ''),
|
||||
greeting_2: K.ITEM('str', ''),
|
||||
greeting_3: K.ITEM('str', ''),
|
||||
greeting_4: K.ITEM('str', ''),
|
||||
greeting_5: K.ITEM('str', ''),
|
||||
greeting_6: K.ITEM('str', ''),
|
||||
greeting_7: K.ITEM('str', ''),
|
||||
greeting_8: K.ITEM('str', ''),
|
||||
greeting_9: K.ITEM('str', ''),
|
||||
},
|
||||
setting: {
|
||||
matching: K.ITEM('s32', 0),
|
||||
info_level: K.ITEM('s32', 0),
|
||||
},
|
||||
score: {
|
||||
battle_class: K.ITEM('s32', 0),
|
||||
max_battle_class: K.ITEM('s32', 0),
|
||||
battle_point: K.ITEM('s32', 0),
|
||||
win: K.ITEM('s32', 0),
|
||||
lose: K.ITEM('s32', 0),
|
||||
draw: K.ITEM('s32', 0),
|
||||
consecutive_win: K.ITEM('s32', 0),
|
||||
max_consecutive_win: K.ITEM('s32', 0),
|
||||
glorious_win: K.ITEM('s32', 0),
|
||||
max_defeat_skill: K.ITEM('s32', 0),
|
||||
latest_result: K.ITEM('s32', 0),
|
||||
},
|
||||
history: {},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export interface CheckPlayerResponse {
|
||||
player: {
|
||||
name: KITEM<'str'>,
|
||||
charaid: KITEM<'s32'>,
|
||||
did: KITEM<'s32'>,
|
||||
skilldata: {
|
||||
skill: KITEM<'s32'>
|
||||
all_skill: KITEM<'s32'>
|
||||
old_skill: KITEM<'s32'>
|
||||
old_all_skill: KITEM<'s32'>
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function getCheckPlayerResponse(playerNo : number, name: string, id: number) : CheckPlayerResponse
|
||||
{
|
||||
return {
|
||||
player: K.ATTR({ no: `${playerNo}`, state: '2' }, {
|
||||
name: K.ITEM('str', name),
|
||||
charaid: K.ITEM('s32', 0),
|
||||
did: K.ITEM('s32', id),
|
||||
skilldata: {
|
||||
skill: K.ITEM('s32', 0),
|
||||
all_skill: K.ITEM('s32', 0),
|
||||
old_skill: K.ITEM('s32', 0),
|
||||
old_all_skill: K.ITEM('s32', 0),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { CommonMusicDataField } from "../commonmusicdata"
|
||||
|
||||
export interface PlayableMusicResponse
|
||||
{
|
||||
hot: {
|
||||
major: KITEM<'s32'>,
|
||||
minor: KITEM<'s32'>
|
||||
}
|
||||
musicinfo: KATTR<any>
|
||||
}
|
||||
|
||||
export function getPlayableMusicResponse(music : CommonMusicDataField[]) : PlayableMusicResponse {
|
||||
return {
|
||||
hot: {
|
||||
major: K.ITEM('s32', 1),
|
||||
minor: K.ITEM('s32', 1),
|
||||
},
|
||||
musicinfo: K.ATTR({ nr: `${music.length}` }, {
|
||||
music,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
export interface PlayerStickerResponse {
|
||||
id: KITEM<'s32'>,
|
||||
pos_x: KITEM<'float'> ,
|
||||
pos_y: KITEM<'float'>,
|
||||
scale_x: KITEM<'float'> ,
|
||||
scale_y: KITEM<'float'>,
|
||||
rotate: KITEM<'float'>
|
||||
}
|
||||
|
||||
export function getPlayerStickerResponse(playerCard : any[]) : PlayerStickerResponse[] {
|
||||
let stickers : PlayerStickerResponse[] = []
|
||||
if (!_.isArray(playerCard)) {
|
||||
return stickers
|
||||
}
|
||||
|
||||
for (const item of playerCard) {
|
||||
const id = _.get(item, 'id');
|
||||
const posX = _.get(item, 'position.0');
|
||||
const posY = _.get(item, 'position.1');
|
||||
const scaleX = _.get(item, 'scale.0');
|
||||
const scaleY = _.get(item, 'scale.1');
|
||||
const rotation = _.get(item, 'rotation');
|
||||
|
||||
if (
|
||||
!isFinite(id) ||
|
||||
!isFinite(posX) ||
|
||||
!isFinite(posY) ||
|
||||
!isFinite(scaleX) ||
|
||||
!isFinite(scaleY) ||
|
||||
!isFinite(rotation)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stickers.push({
|
||||
id: K.ITEM('s32', id),
|
||||
pos_x: K.ITEM('float', posX),
|
||||
pos_y: K.ITEM('float', posY),
|
||||
scale_x: K.ITEM('float', scaleX),
|
||||
scale_y: K.ITEM('float', scaleY),
|
||||
rotate: K.ITEM('float', rotation),
|
||||
});
|
||||
}
|
||||
|
||||
return stickers
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { PlayerRanking } from "../playerranking"
|
||||
|
||||
export interface SaveProfileResponse
|
||||
{
|
||||
skill: {
|
||||
rank: KITEM<'s32'>,
|
||||
total_nr: KITEM<'s32'>
|
||||
}
|
||||
all_skill: {
|
||||
rank: KITEM<'s32'>,
|
||||
total_nr: KITEM<'s32'>
|
||||
}
|
||||
kac2018: {
|
||||
data: {
|
||||
term: KITEM<'s32'>,
|
||||
total_score: KITEM<'s32'>,
|
||||
score: KARRAY<'s32'>,
|
||||
music_type: KARRAY<'s32'>,
|
||||
play_count: KARRAY<'s32'>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getSaveProfileResponse(playerNo: number, ranking : PlayerRanking)
|
||||
{
|
||||
const result : SaveProfileResponse = K.ATTR({ no: `${playerNo}` }, {
|
||||
skill: { rank: K.ITEM('s32', ranking.skill), total_nr: K.ITEM('s32', ranking.totalPlayers) },
|
||||
all_skill: { rank: K.ITEM('s32', ranking.all_skill), total_nr: K.ITEM('s32', ranking.totalPlayers) },
|
||||
kac2018: {
|
||||
data: {
|
||||
term: K.ITEM('s32', 0),
|
||||
total_score: K.ITEM('s32', 0),
|
||||
score: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||
music_type: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||
play_count: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Profile } from "../profile";
|
||||
|
||||
export interface SecretMusicResponse {
|
||||
musicid: KITEM<'s32'>;
|
||||
seq: KITEM<'u16'>;
|
||||
kind: KITEM<'s32'>;
|
||||
}
|
||||
|
||||
export function getSecretMusicResponse(profile: Profile) : SecretMusicResponse[] {
|
||||
let response : SecretMusicResponse[] = []
|
||||
|
||||
if (!profile.secretmusic?.music ) {
|
||||
return response
|
||||
}
|
||||
|
||||
for (let music of profile.secretmusic.music) {
|
||||
response.push({
|
||||
musicid: K.ITEM('s32', music.musicid),
|
||||
seq: K.ITEM('u16', music.seq),
|
||||
kind: K.ITEM('s32', music.kind)
|
||||
})
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
Reference in New Issue
Block a user