diff --git a/messages/en.json b/messages/en.json index 86c1cc5..bba291a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -278,6 +278,7 @@ "detailMultipathCharacter": "Allows changing the Path of certain characters.", "trailblazer": "Trailblazer", "listExtraEffect": "List Extra Effect", - "extra": "Extra" + "extra": "Extra", + "customLineup": "Custom Lineup" } } \ No newline at end of file diff --git a/messages/ja.json b/messages/ja.json index 8b89ffd..de6ef5c 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -277,6 +277,7 @@ "detailMultipathCharacter": "一部キャラクターの運命を変更できます。", "trailblazer": "開拓者", "listExtraEffect": "追加効果一覧", - "extra": "追加" + "extra": "追加", + "customLineup": "カスタム編成" } } \ No newline at end of file diff --git a/messages/ko.json b/messages/ko.json index 96528dd..5868708 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -277,6 +277,7 @@ "detailMultipathCharacter": "일부 캐릭터의 운명을 변경할 수 있습니다.", "trailblazer": "개척자", "listExtraEffect": "추가 효과 목록", - "extra": "추가" + "extra": "추가", + "customLineup": "커스텀 편성" } } \ No newline at end of file diff --git a/messages/vi.json b/messages/vi.json index a74733c..42f0ddf 100644 --- a/messages/vi.json +++ b/messages/vi.json @@ -277,6 +277,7 @@ "detailMultipathCharacter": "Cho phép thay đổi Vận Mệnh của một vài nhân vật.", "trailblazer": "Nhà khai phá", "listExtraEffect": "Danh sách hiệu ứng bổ sung", - "extra": "Bổ sung" + "extra": "Bổ sung", + "customLineup": "Đội hình tùy chỉnh" } } \ No newline at end of file diff --git a/messages/zh.json b/messages/zh.json index cae775c..9f4c314 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -277,6 +277,7 @@ "detailMultipathCharacter": "允许更改部分角色的命途。", "trailblazer": "开拓者", "listExtraEffect": "额外效果列表", - "extra": "额外" + "extra": "额外", + "customLineup": "自定义阵容" } } \ No newline at end of file diff --git a/src/components/card/characterCard.tsx b/src/components/card/characterCard.tsx index 0efb28d..bfb816c 100644 --- a/src/components/card/characterCard.tsx +++ b/src/components/card/characterCard.tsx @@ -1,5 +1,4 @@ "use client"; - import { getNameChar } from '@/helper'; import useLocaleStore from '@/stores/localeStore'; import { AvatarDetail } from '@/types'; diff --git a/src/components/card/simpleCharacterCard.tsx b/src/components/card/simpleCharacterCard.tsx new file mode 100644 index 0000000..8b61921 --- /dev/null +++ b/src/components/card/simpleCharacterCard.tsx @@ -0,0 +1,69 @@ +"use client"; +import Image from 'next/image'; +import { AvatarDetail } from '@/types'; +import useDetailDataStore from '@/stores/detailDataStore'; + + +interface SimpleAvatarCardProps { + data: AvatarDetail; + isSelected?: boolean; + onClick?: () => void; + showRemoveHover?: boolean; +} + +export const SimpleAvatarCard = ({ data, isSelected, onClick, showRemoveHover }: SimpleAvatarCardProps) => { +const { baseType, damageType } = useDetailDataStore() + + return ( +
+ Avatar +
+ Element +
+
+ Path +
+ + {showRemoveHover && ( +
+ + + +
+ )} +
+ ); +}; \ No newline at end of file diff --git a/src/components/extraSettingBar/index.tsx b/src/components/extraSettingBar/index.tsx index 8873ab4..f455d65 100644 --- a/src/components/extraSettingBar/index.tsx +++ b/src/components/extraSettingBar/index.tsx @@ -1,6 +1,6 @@ 'use client' import { motion } from "framer-motion" -import { EyeOff, Eye, Hammer, RefreshCw, ShieldBan, User, Swords, SkipForward, BowArrow, Info, RouteIcon, Search, CupSoda } from "lucide-react" +import { EyeOff, Eye, Hammer, RefreshCw, ShieldBan, User, Swords, SkipForward, BowArrow, Info, RouteIcon, Search, CupSoda, UsersIcon } from "lucide-react" import useGlobalStore from '@/stores/globalStore' import { useTranslations } from "next-intl" import { getLocaleName, getNameChar } from "@/helper" @@ -12,6 +12,7 @@ import Editor from "react-simple-code-editor" import Prism from "prismjs" import "prismjs/components/prism-lua" import "prismjs/themes/prism-tomorrow.css" +import { SimpleAvatarCard } from "../card/simpleCharacterCard" export default function ExtraSettingBar() { const { extraData, setExtraData, isEnableChangePath, setIsEnableChangePath, isEnableLua, setIsEnableLua } = useGlobalStore() @@ -19,6 +20,7 @@ export default function ExtraSettingBar() { const { mapAvatar, mapPeak, stage, baseType } = useDetailDataStore() const { locale } = useLocaleStore() const [showSearchStage, setShowSearchStage] = useState(false) + const [showSearchLineup, setShowSearchLineup] = useState(false) const [isChildClick, setIsChildClick] = useState(false) const [stageSearchTerm, setStageSearchTerm] = useState("") const [stagePage, setStagePage] = useState(1) @@ -106,6 +108,7 @@ export default function ExtraSettingBar() { /> + + +
+ +
+ {(extraData?.theory_craft?.custom_lineup || []).length > 0 && ( + (extraData?.theory_craft?.custom_lineup || []).map((avatarId) => { + const avatarData = mapAvatar[avatarId]; + if (!avatarData) return null; + return ( + { + const newLineup = (extraData?.theory_craft?.custom_lineup || []).filter(id => id !== avatarId); + setExtraData({ + ...extraData, + theory_craft: { + stage_id: extraData?.theory_craft?.stage_id ?? 30118121, + cycle_count: extraData?.theory_craft?.cycle_count ?? 1, + mode: extraData?.theory_craft?.mode ?? false, + hp: extraData?.theory_craft?.hp ?? {}, + custom_lineup: newLineup + } + }); + }} + /> + ); + }) + )} + + +
+ + {showSearchLineup && ( +
e.stopPropagation()} + className="absolute top-full left-0 mt-2 w-full z-50 border bg-base-200 border-slate-600 rounded-lg p-4 shadow-2xl" + > +
+ {transI18n("selectedCharacters")} + +
+ +
+ {Object.values(mapAvatar).map((avatar) => { + const currentLineup = extraData?.theory_craft?.custom_lineup || []; + const isSelected = currentLineup.includes(avatar.ID.toString()); + + return ( + { + const idStr = avatar.ID.toString(); + let newLineup = [...currentLineup]; + + if (isSelected) { + newLineup = newLineup.filter(id => id !== idStr); + } else { + newLineup.push(idStr); + } + + setExtraData({ + ...extraData, + theory_craft: { + stage_id: extraData?.theory_craft?.stage_id ?? 30118121, + cycle_count: extraData?.theory_craft?.cycle_count ?? 1, + mode: extraData?.theory_craft?.mode ?? false, + hp: extraData?.theory_craft?.hp ?? {}, + custom_lineup: newLineup + } + }); + }} + /> + ); + })} +
+
+ )} +
+
)} diff --git a/src/stores/enkaStore.ts b/src/stores/enkaStore.ts index 17a7ddd..28b3211 100644 --- a/src/stores/enkaStore.ts +++ b/src/stores/enkaStore.ts @@ -10,7 +10,7 @@ interface EnkaState { setUidInput: (newUidInput: string) => void; } -const useEnkaStore = create((set, get) => ({ +const useEnkaStore = create((set) => ({ selectedCharacters: [], enkaData: null, uidInput: "", diff --git a/src/types/extraData.ts b/src/types/extraData.ts index 91bc4e3..ef042f8 100644 --- a/src/types/extraData.ts +++ b/src/types/extraData.ts @@ -4,6 +4,7 @@ export interface ExtraData { cycle_count: number mode: boolean stage_id: number + custom_lineup?: string[] } setting?: { censorship: boolean @@ -22,5 +23,5 @@ export interface ExtraData { multi_path_main: number[] multi_path_march_7: number[] }, - lua: string | null + lua?: string | null }