support new WaccaVersion enum in MYT proto (#1281)

This commit is contained in:
Christopher Cooper
2025-04-24 08:31:09 +01:00
committed by GitHub
parent 1455d759df
commit 454dabd79e
4 changed files with 74 additions and 14 deletions
@@ -1,5 +1,6 @@
import { UnaryRPCAsAsync } from "../../common/api-myt/traverse-api";
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
import { WaccaVersion } from "proto/generated/wacca/common_pb";
import { DataRequest } from "proto/generated/wacca/user_pb";
import { WaccaStageUps } from "tachi-common/config/game-support/wacca";
import type { ClassProvider } from "lib/score-import/framework/calculated-data/types";
@@ -17,22 +18,26 @@ export default async function CreateMytWACCAClassHandler(
const data = dataRes;
return (_gptString, _userID, _ratings, _logger) => {
// versions are 0-indexed, so
// 0 -> WACCA
// 1 -> S
// 2 -> Lily
// 3 -> Lily R
// 4 -> Reverse
// 5 -> Plus
// Currently (Feb. 2025) Reverse and Plus are supported on Myt.
// In Apr/May 2025, the keys for version data are changing from
// 0-indexed (starting at WACCA) to custom enum values.
// TODO: Once MYT transitions over to the new enum, remove the _OLD
// values from the enum proto definition, and remove the compatibility
// code below.
// Currently (Apr. 2025) Reverse and Plus are supported on Myt.
// We look for both Reverse and PLUS version data, PLUS being prioritized if exists.
// If / when custom dans are added, this will need to change.
// Also, these may change to be 1-indexed at some point.
const REVERSE_VERSION = 4;
const PLUS_VERSION = 5;
const versionData = data.getVersionDataMap().has(PLUS_VERSION)
? data.getVersionDataMap().get(PLUS_VERSION)
: data.getVersionDataMap().get(REVERSE_VERSION);
const versionDataMap = data.getVersionDataMap();
let versionData: DataResponse.VersionData | undefined;
if (versionDataMap.has(WaccaVersion.WACCA_VERSION_PLUS)) {
versionData = versionDataMap.get(WaccaVersion.WACCA_VERSION_PLUS);
} else if (versionDataMap.has(WaccaVersion.WACCA_VERSION_PLUS_OLD)) {
versionData = versionDataMap.get(WaccaVersion.WACCA_VERSION_PLUS_OLD);
} else if (versionDataMap.has(WaccaVersion.WACCA_VERSION_REVERSE)) {
versionData = versionDataMap.get(WaccaVersion.WACCA_VERSION_REVERSE);
} else if (versionDataMap.has(WaccaVersion.WACCA_VERSION_REVERSE_OLD)) {
versionData = versionDataMap.get(WaccaVersion.WACCA_VERSION_REVERSE_OLD);
}
// rank:
// 0 -> none
+17
View File
@@ -71,6 +71,23 @@ export namespace WaccaJudge {
}
}
export interface WaccaVersionMap {
WACCA_VERSION_UNSPECIFIED: 0;
WACCA_VERSION_S_OLD: 1;
WACCA_VERSION_LILY_OLD: 2;
WACCA_VERSION_LILY_R_OLD: 3;
WACCA_VERSION_REVERSE_OLD: 4;
WACCA_VERSION_PLUS_OLD: 5;
WACCA_VERSION_WACCA: 100;
WACCA_VERSION_S: 150;
WACCA_VERSION_LILY: 200;
WACCA_VERSION_LILY_R: 250;
WACCA_VERSION_REVERSE: 300;
WACCA_VERSION_PLUS: 400;
}
export const WaccaVersion: WaccaVersionMap;
export interface WaccaMusicDifficultyMap {
WACCA_MUSIC_DIFFICULTY_UNSPECIFIED: 0;
WACCA_MUSIC_DIFFICULTY_NORMAL: 1;
@@ -26,6 +26,7 @@ goog.exportSymbol('proto.mythos.wacca.v0.WaccaJudge', null, global);
goog.exportSymbol('proto.mythos.wacca.v0.WaccaMusicDifficulty', null, global);
goog.exportSymbol('proto.mythos.wacca.v0.WaccaMusicScoreGrade', null, global);
goog.exportSymbol('proto.mythos.wacca.v0.WaccaPlayMode', null, global);
goog.exportSymbol('proto.mythos.wacca.v0.WaccaVersion', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -538,6 +539,24 @@ proto.mythos.wacca.v0.WaccaJudge.prototype.setMiss = function(value) {
};
/**
* @enum {number}
*/
proto.mythos.wacca.v0.WaccaVersion = {
WACCA_VERSION_UNSPECIFIED: 0,
WACCA_VERSION_S_OLD: 1,
WACCA_VERSION_LILY_OLD: 2,
WACCA_VERSION_LILY_R_OLD: 3,
WACCA_VERSION_REVERSE_OLD: 4,
WACCA_VERSION_PLUS_OLD: 5,
WACCA_VERSION_WACCA: 100,
WACCA_VERSION_S: 150,
WACCA_VERSION_LILY: 200,
WACCA_VERSION_LILY_R: 250,
WACCA_VERSION_REVERSE: 300,
WACCA_VERSION_PLUS: 400
};
/**
* @enum {number}
*/
+19
View File
@@ -2,6 +2,25 @@ syntax = "proto3";
package mythos.wacca.v0;
enum WaccaVersion {
WACCA_VERSION_UNSPECIFIED = 0;
// TODO: once MYT transitions over to the new enum, remove the _OLD values
WACCA_VERSION_S_OLD = 1;
WACCA_VERSION_LILY_OLD = 2;
WACCA_VERSION_LILY_R_OLD = 3;
WACCA_VERSION_REVERSE_OLD = 4;
WACCA_VERSION_PLUS_OLD = 5;
WACCA_VERSION_WACCA = 100;
WACCA_VERSION_S = 150;
WACCA_VERSION_LILY = 200;
WACCA_VERSION_LILY_R = 250;
WACCA_VERSION_REVERSE = 300;
WACCA_VERSION_PLUS = 400;
}
enum WaccaMusicDifficulty {
WACCA_MUSIC_DIFFICULTY_UNSPECIFIED = 0;
WACCA_MUSIC_DIFFICULTY_NORMAL = 1;