mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 22:59:52 +03:00
checkpoint: insanity ascends (35)
127 errors to go
This commit is contained in:
@@ -4,11 +4,11 @@ import useLUGPTSettings from "./useLUGPTSettings";
|
||||
export function useBucket(game: Game, playtype: Playtype) {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
if (!settings?.preferences.scoreBucket) {
|
||||
if (!settings?.preferences.preferredDefaultEnum) {
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
return gptConfig.scoreBucket;
|
||||
return gptConfig.preferredDefaultEnum;
|
||||
}
|
||||
|
||||
return settings.preferences.scoreBucket;
|
||||
return settings.preferences.preferredDefaultEnum;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { UGPTContext } from "context/UGPTContext";
|
||||
import { useContext } from "react";
|
||||
import { IDStrings, UGPTSettings } from "tachi-common";
|
||||
import { GPTString, UGPTSettingsDocument } from "tachi-common";
|
||||
|
||||
export default function useLUGPTSettings<I extends IDStrings>() {
|
||||
export default function useLUGPTSettings<GPT extends GPTString>() {
|
||||
const { loggedInData, setLoggedInData } = useContext(UGPTContext);
|
||||
|
||||
const settings = (loggedInData?.settings ?? null) as UGPTSettings<I> | null;
|
||||
const settings = (loggedInData?.settings ?? null) as UGPTSettingsDocument<GPT> | null;
|
||||
|
||||
const setSettings = (newSettings: UGPTSettings<I>) => {
|
||||
const setSettings = (newSettings: UGPTSettingsDocument<GPT>) => {
|
||||
if (!loggedInData) {
|
||||
throw new Error(`Tried to set settings while nobody was logged in?`);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { UGPTSettings } from "tachi-common";
|
||||
import { UGPTSettingsDocument } from "tachi-common";
|
||||
import useLUGPTSettings from "./useLUGPTSettings";
|
||||
|
||||
export default function usePreferredRanking():
|
||||
| UGPTSettings["preferences"]["preferredRanking"]
|
||||
| UGPTSettingsDocument["preferences"]["preferredRanking"]
|
||||
| null {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
import {
|
||||
Game,
|
||||
GetGamePTConfig,
|
||||
IDStrings,
|
||||
ScoreCalculatedDataLookup,
|
||||
SessionCalculatedDataLookup,
|
||||
ProfileRatingLookup,
|
||||
GPTString,
|
||||
Playtype,
|
||||
ProfileRatingAlgorithms,
|
||||
ScoreRatingAlgorithms,
|
||||
SessionRatingAlgorithms,
|
||||
} from "tachi-common";
|
||||
import useLUGPTSettings from "./useLUGPTSettings";
|
||||
|
||||
export default function useScoreRatingAlg<I extends IDStrings = IDStrings>(
|
||||
export default function useScoreRatingAlg<GPT extends GPTString = GPTString>(
|
||||
game: Game,
|
||||
playtype: Playtype
|
||||
): ScoreCalculatedDataLookup[I] {
|
||||
): ScoreRatingAlgorithms[GPT] {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
if (!settings?.preferences.preferredScoreAlg) {
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
return gptConfig.defaultScoreRatingAlg as ScoreCalculatedDataLookup[I];
|
||||
return gptConfig.defaultScoreRatingAlg as ScoreRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
return settings.preferences.preferredScoreAlg as ScoreCalculatedDataLookup[I];
|
||||
return settings.preferences.preferredScoreAlg as ScoreRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
export function useSessionRatingAlg<I extends IDStrings = IDStrings>(
|
||||
export function useSessionRatingAlg<GPT extends GPTString = GPTString>(
|
||||
game: Game,
|
||||
playtype: Playtype
|
||||
): SessionCalculatedDataLookup[I] {
|
||||
): SessionRatingAlgorithms[GPT] {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
if (!settings?.preferences.preferredSessionAlg) {
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
return gptConfig.defaultSessionRatingAlg as SessionCalculatedDataLookup[I];
|
||||
return gptConfig.defaultSessionRatingAlg as SessionRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
return settings.preferences.preferredSessionAlg as SessionCalculatedDataLookup[I];
|
||||
return settings.preferences.preferredSessionAlg as SessionRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
export function useProfileRatingAlg<I extends IDStrings = IDStrings>(
|
||||
export function useProfileRatingAlg<GPT extends GPTString = GPTString>(
|
||||
game: Game,
|
||||
playtype: Playtype
|
||||
): ProfileRatingLookup[I] {
|
||||
): ProfileRatingAlgorithms[GPT] {
|
||||
const { settings } = useLUGPTSettings();
|
||||
|
||||
if (!settings?.preferences.preferredProfileAlg) {
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
return gptConfig.defaultProfileRatingAlg as ProfileRatingLookup[I];
|
||||
return gptConfig.defaultProfileRatingAlg as ProfileRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
return settings.preferences.preferredProfileAlg as ProfileRatingLookup[I];
|
||||
return settings.preferences.preferredProfileAlg as ProfileRatingAlgorithms[GPT];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user