diff --git a/messages/cn.json b/messages/cn.json index 9f04851..6ed6b4e 100644 --- a/messages/cn.json +++ b/messages/cn.json @@ -274,6 +274,8 @@ "detailHiddenUi": "开启后将隐藏游戏界面。", "detailDisableCensorship": "开启后将关闭游戏内的审查。", "detailMultipathCharacter": "允许更改部分角色的命途。", - "trailblazer": "开拓者" + "trailblazer": "开拓者", + "listExtraEffect": "额外效果列表", + "extra": "额外" } } \ No newline at end of file diff --git a/messages/en.json b/messages/en.json index 3997879..6da8817 100644 --- a/messages/en.json +++ b/messages/en.json @@ -275,6 +275,8 @@ "detailHiddenUi": "Enabling this feature will hide the game UI.", "detailDisableCensorship": "Enabling this feature will disable in-game censorship.", "detailMultipathCharacter": "Allows changing the Path of certain characters.", - "trailblazer": "Trailblazer" + "trailblazer": "Trailblazer", + "listExtraEffect": "List Extra Effect", + "extra": "Extra" } } \ No newline at end of file diff --git a/messages/ja.json b/messages/ja.json index 094b368..8f12774 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -274,6 +274,8 @@ "detailHiddenUi": "この機能を有効にすると、ゲームのUIを非表示にします。", "detailDisableCensorship": "この機能を有効にすると、ゲーム内の検閲を無効にします。", "detailMultipathCharacter": "一部キャラクターの運命を変更できます。", - "trailblazer": "開拓者" + "trailblazer": "開拓者", + "listExtraEffect": "追加効果一覧", + "extra": "追加" } } \ No newline at end of file diff --git a/messages/ko.json b/messages/ko.json index d3efead..89e73d2 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -274,6 +274,8 @@ "detailHiddenUi": "이 기능을 활성화하면 게임 UI가 숨겨집니다.", "detailDisableCensorship": "이 기능을 활성화하면 게임 내 검열이 비활성화됩니다.", "detailMultipathCharacter": "일부 캐릭터의 운명을 변경할 수 있습니다.", - "trailblazer": "개척자" + "trailblazer": "개척자", + "listExtraEffect": "추가 효과 목록", + "extra": "추가" } } \ No newline at end of file diff --git a/messages/vi.json b/messages/vi.json index 0ba0262..84ae001 100644 --- a/messages/vi.json +++ b/messages/vi.json @@ -274,6 +274,8 @@ "detailHiddenUi": "Khi bật tính năng này sẽ ẩn giao diện của game.", "detailDisableCensorship": "Khi bật tính năng này sẽ tắt kiểm duyệt của game.", "detailMultipathCharacter": "Cho phép thay đổi Vận Mệnh của một vài nhân vật.", - "trailblazer": "Nhà khai phá" + "trailblazer": "Nhà khai phá", + "listExtraEffect": "Danh sách hiệu ứng bổ sung", + "extra": "Bổ sung" } } \ No newline at end of file diff --git a/messages/zh.json b/messages/zh.json index 7b5aadd..d5f62ab 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -274,6 +274,8 @@ "detailHiddenUi": "开启后将隐藏游戏界面。", "detailDisableCensorship": "开启后将关闭游戏内的审查。", "detailMultipathCharacter": "允许更改部分角色的命途。", - "trailblazer": "开拓者" + "trailblazer": "开拓者", + "listExtraEffect": "额外效果列表", + "extra": "额外" } } \ No newline at end of file diff --git a/src/components/extraInfo/index.tsx b/src/components/extraInfo/index.tsx index f6527b3..d1f16a9 100644 --- a/src/components/extraInfo/index.tsx +++ b/src/components/extraInfo/index.tsx @@ -3,6 +3,7 @@ import { useState } from "react" import { replaceByParam, getLocaleName } from "@/helper" import { ExtraEffect } from "@/types" +import { useTranslations } from "next-intl" type Props = { extras: Record | undefined @@ -12,7 +13,7 @@ type Props = { export default function ExtraEffectList({ extras, locale }: Props) { const [openList, setOpenList] = useState(false) const [openId, setOpenId] = useState(null) - + const transI18n = useTranslations("DataPage") if (!extras || Object.keys(extras).length === 0) return null return ( @@ -22,7 +23,7 @@ export default function ExtraEffectList({ extras, locale }: Props) { onClick={() => setOpenList(!openList)} > - List Extra Effect ({Object.keys(extras).length}) + {transI18n("listExtraEffect")} ({Object.keys(extras).length})
@@ -56,7 +57,7 @@ export default function ExtraEffectList({ extras, locale }: Props) { >
- Extra + {transI18n("extra")} diff --git a/src/components/extraSettingBar/index.tsx b/src/components/extraSettingBar/index.tsx index 2d4310c..f9d4657 100644 --- a/src/components/extraSettingBar/index.tsx +++ b/src/components/extraSettingBar/index.tsx @@ -10,7 +10,7 @@ import { useMemo, useState } from "react" import useDetailDataStore from "@/stores/detailDataStore" export default function ExtraSettingBar() { - const { extraData, setExtraData } = useGlobalStore() + const { extraData, setExtraData, isEnableChangePath, setIsEnableChangePath } = useGlobalStore() const transI18n = useTranslations("DataPage") const { mapAvatar, mapPeak, stage, baseType } = useDetailDataStore() const { locale } = useLocaleStore() @@ -160,7 +160,7 @@ export default function ExtraSettingBar() { onClick={(e) => { e.stopPropagation() setIsChildClick(true) - + if (extraData?.theory_craft?.stage_id !== Number(stage.ID)) { setExtraData({ ...extraData, @@ -228,66 +228,75 @@ export default function ExtraSettingBar() {
+ setIsEnableChangePath(e.target.checked)} + /> + {isEnableChangePath && ( + <> + + - - - - - + + + + + )}
{/* CHALLENGE */} diff --git a/src/helper/connect.ts b/src/helper/connect.ts index f85eb90..9550318 100644 --- a/src/helper/connect.ts +++ b/src/helper/connect.ts @@ -14,7 +14,7 @@ export const connectToPS = async (): Promise<{ success: boolean, message: string username, password } = useConnectStore.getState() - const {setExtraData, setIsConnectPS} = useGlobalStore.getState() + const { setExtraData, setIsConnectPS } = useGlobalStore.getState() let urlQuery = serverUrl if (!urlQuery.startsWith("http://") && !urlQuery.startsWith("https://")) { @@ -59,7 +59,7 @@ export const syncDataToPS = async (): Promise<{ success: boolean, message: strin password } = useConnectStore.getState() - const {extraData, setIsConnectPS, setExtraData} = useGlobalStore.getState() + const {extraData, setIsConnectPS, setExtraData, isEnableChangePath} = useGlobalStore.getState() const {avatars, battle_type, moc_config, pf_config, as_config, ce_config, peak_config} = useUserDataStore.getState() @@ -85,7 +85,13 @@ export const syncDataToPS = async (): Promise<{ success: boolean, message: strin return { success: true, message: "" } } } - const response = await SendDataToServer(username, password, urlQuery, data, extraData) + const newExtra = structuredClone(extraData) + + if (newExtra && !isEnableChangePath) { + newExtra.multi_path = undefined + } + + const response = await SendDataToServer(username, password, urlQuery, data, newExtra) if (typeof response === "string") { setIsConnectPS(false) return { success: false, message: response } diff --git a/src/stores/globalStore.ts b/src/stores/globalStore.ts index 85c977e..dff6961 100644 --- a/src/stores/globalStore.ts +++ b/src/stores/globalStore.ts @@ -4,6 +4,8 @@ import { ExtraData } from '@/types' interface GlobalState { isConnectPS: boolean; extraData?: ExtraData; + isEnableChangePath: boolean + setIsEnableChangePath: (newIsEnableChangePath: boolean) => void; setExtraData: (newExtraData: ExtraData | undefined) => void; setIsConnectPS: (newIsConnectPS: boolean) => void; } @@ -11,6 +13,8 @@ interface GlobalState { const useGlobalStore = create((set) => ({ isConnectPS: false, extraData: undefined, + isEnableChangePath: false, + setIsEnableChangePath: (newIsEnableChangePath: boolean) => set({ isEnableChangePath: newIsEnableChangePath }), setExtraData: (newExtraData: ExtraData | undefined) => set({ extraData: newExtraData }), setIsConnectPS: (newIsConnectPS: boolean) => set({ isConnectPS: newIsConnectPS }), }));