Merge branch 'stable' into feature/00_sharedFavorites

# Conflicts:
#	gitadora@asphyxia/README.md
#	gitadora@asphyxia/handlers/profiles.ts
This commit is contained in:
Thome Valentin
2022-05-17 09:21:32 +02:00
17 changed files with 449 additions and 371 deletions

View File

@@ -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: {},
}
}

View File

@@ -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),
}
})
}
}

View File

@@ -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,
}),
}
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -1,3 +1,5 @@
import { PLUGIN_VER } from "../const";
export interface Extra {
collection: 'extra';
@@ -13,4 +15,27 @@ export interface Extra {
list_3: number[];
recommend_musicid_list: number[];
reward_status: number[];
}
}
export function getDefaultExtra(game: 'gf' | 'dm', version: string, id: number) : Extra {
const result : Extra = {
collection: 'extra',
pluginVer: PLUGIN_VER,
game,
version,
id,
playstyle: Array(50).fill(0),
custom: Array(50).fill(0),
list_1: Array(100).fill(-1),
list_2: Array(100).fill(-1),
list_3: Array(100).fill(-1),
recommend_musicid_list: Array(5).fill(-1),
reward_status: Array(50).fill(0),
}
result.playstyle[1] = 1 // Note scroll speed (should default to 1.0x)
result.playstyle[36] = 20 // Unknown
result.playstyle[48] = 20 // Unknown
return result
}

View File

@@ -1,7 +1,9 @@
import { PLUGIN_VER } from "../const";
export interface PlayerInfo {
collection: 'playerinfo',
pluginVer: Number;
pluginVer: number;
id: number;
version: string,
@@ -16,4 +18,15 @@ export interface PlayerInfo {
}[];
// TODO: Add Board things.
}
}
export function getDefaultPlayerInfo(version: string, id: number) : PlayerInfo {
return {
collection: 'playerinfo',
pluginVer: PLUGIN_VER,
id,
version,
name: 'ASPHYXIA-CORE USER',
title: 'Please edit on WebUI',
}
}

View File

@@ -1,8 +0,0 @@
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'>
}

View File

@@ -1,3 +1,4 @@
import { PLUGIN_VER } from "../const";
import { SecretMusicEntry } from "./secretmusicentry";
export interface Profile {
@@ -60,3 +61,66 @@ export interface Profile {
music: SecretMusicEntry[];
}
}
export function getDefaultProfile (game: 'gf' | 'dm', version: string, id: number): Profile {
return {
collection: 'profile',
pluginVer: PLUGIN_VER,
game,
version,
id,
play: 0,
playtime: 0,
playterm: 0,
session_cnt: 0,
extra_stage: 0,
extra_play: 0,
extra_clear: 0,
encore_play: 0,
encore_clear: 0,
pencore_play: 0,
pencore_clear: 0,
max_clear_diff: 0,
max_full_diff: 0,
max_exce_diff: 0,
clear_num: 0,
full_num: 0,
exce_num: 0,
no_num: 0,
e_num: 0,
d_num: 0,
c_num: 0,
b_num: 0,
a_num: 0,
s_num: 0,
ss_num: 0,
last_category: 0,
last_musicid: -1,
last_seq: 0,
disp_level: 0,
progress: 0,
disp_state: 0,
skill: 0,
all_skill: 0,
extra_gauge: 0,
encore_gauge: 0,
encore_cnt: 0,
encore_success: 0,
unlock_point: 0,
max_skill: 0,
max_all_skill: 0,
clear_diff: 0,
full_diff: 0,
exce_diff: 0,
clear_music_num: 0,
full_music_num: 0,
exce_music_num: 0,
clear_seq_num: 0,
classic_all_skill: 0,
secretmusic: {
music: []
}
}
};

View File

@@ -1,3 +1,5 @@
import { PLUGIN_VER } from "../const";
export interface Record {
collection: 'record';
@@ -41,4 +43,50 @@ export interface Record {
diff_850_clear: number[];
diff_900_clear: number[];
diff_950_clear: number[];
}
}
export function getDefaultRecord(game: 'gf' | 'dm', version: string): Record {
return {
collection: 'record',
pluginVer: PLUGIN_VER,
game,
version,
diff_100_nr: 0,
diff_150_nr: 0,
diff_200_nr: 0,
diff_250_nr: 0,
diff_300_nr: 0,
diff_350_nr: 0,
diff_400_nr: 0,
diff_450_nr: 0,
diff_500_nr: 0,
diff_550_nr: 0,
diff_600_nr: 0,
diff_650_nr: 0,
diff_700_nr: 0,
diff_750_nr: 0,
diff_800_nr: 0,
diff_850_nr: 0,
diff_900_nr: 0,
diff_950_nr: 0,
diff_100_clear: [0, 0, 0, 0, 0, 0, 0],
diff_150_clear: [0, 0, 0, 0, 0, 0, 0],
diff_200_clear: [0, 0, 0, 0, 0, 0, 0],
diff_250_clear: [0, 0, 0, 0, 0, 0, 0],
diff_300_clear: [0, 0, 0, 0, 0, 0, 0],
diff_350_clear: [0, 0, 0, 0, 0, 0, 0],
diff_400_clear: [0, 0, 0, 0, 0, 0, 0],
diff_450_clear: [0, 0, 0, 0, 0, 0, 0],
diff_500_clear: [0, 0, 0, 0, 0, 0, 0],
diff_550_clear: [0, 0, 0, 0, 0, 0, 0],
diff_600_clear: [0, 0, 0, 0, 0, 0, 0],
diff_650_clear: [0, 0, 0, 0, 0, 0, 0],
diff_700_clear: [0, 0, 0, 0, 0, 0, 0],
diff_750_clear: [0, 0, 0, 0, 0, 0, 0],
diff_800_clear: [0, 0, 0, 0, 0, 0, 0],
diff_850_clear: [0, 0, 0, 0, 0, 0, 0],
diff_900_clear: [0, 0, 0, 0, 0, 0, 0],
diff_950_clear: [0, 0, 0, 0, 0, 0, 0],
}
}

View File

@@ -1,3 +1,5 @@
import { PLUGIN_VER } from "../const";
export interface Scores {
collection: 'scores';
@@ -22,3 +24,13 @@ export interface Scores {
};
};
}
export function getDefaultScores (game: 'gf' | 'dm', version: string): Scores {
return {
collection: 'scores',
version,
pluginVer: PLUGIN_VER,
game,
scores: {}
}
};

View File

@@ -1,5 +0,0 @@
export interface SecretMusicResponse {
musicid: KITEM<'s32'>;
seq: KITEM<'u16'>;
kind: KITEM<'s32'>;
}