'use client'; import { useState, useEffect, useMemo } from 'react'; import { useInventoryStore } from '@/store/useInventoryStore'; import styles from '../styles/Home.module.css'; import { isNamedDLC } from '@/lib/utils'; import { fetchCharacters, fetchItems, fetchOfferings, fetchCustomizations, fetchDLCs, fetchAddons, fetchPerks } from '@/lib/db'; export default function Home() { const store = useInventoryStore(); const [charCount, setCharCount] = useState(0); const [custCount, setCustCount] = useState(0); const [itemsCount, setItemsCount] = useState(0); const [offeringsCount, setOfferingsCount] = useState(0); const [dlcsCount, setDlcsCount] = useState(0); const [addonsCount, setAddonsCount] = useState(0); const [perksCount, setPerksCount] = useState(0); const [importText, setImportText] = useState(''); useEffect(() => { Promise.all([ fetchCharacters(), fetchItems(), fetchOfferings(), fetchCustomizations(), fetchDLCs(), fetchAddons(), fetchPerks() ]).then( ([chars, items, offerings, customizations, dlcs, addons, perks]) => { setCharCount(chars.length); setItemsCount(items.length); setOfferingsCount(offerings.length); setCustCount(customizations.length); setDlcsCount(dlcs.filter(isNamedDLC).length); setAddonsCount(addons.length); setPerksCount(perks.length); } ); }, []); /* profile handling */ const handleDownload = () => { const blob = new Blob([importText], { type: 'application/json' }); const url = URL.createObjectURL(blob); const link = document.createElement('a'); link.href = url; link.download = 'profile.json'; link.click(); URL.revokeObjectURL(url); }; const handleCopy = () => { navigator.clipboard.writeText(importText); }; const getExportText = () => { return JSON.stringify( { profile: { unlockedCharacters: store.unlockedCharacters, unlockedCustomizations: store.unlockedCustomizations, unlockedDLCs: store.unlockedDLCs, unlockedPerks: store.unlockedPerks, items: store.items, offerings: store.offerings, addons: store.addons }, toggles: { spoofItems: store.spoofItems, spoofPerks: store.spoofPerks, spoofCatalog: store.spoofCatalog, spoofDLCs: store.spoofDLCs } }, null, 2 ); }; const handleImport = async () => { try { const parsed = JSON.parse(importText); if (parsed.profile) store.importProfile(parsed.profile); else store.importProfile(parsed); if (parsed.toggles) store.importToggles(parsed.toggles); } catch (e) { console.error('Invalid JSON', e); } }; useEffect(() => { setImportText(getExportText()); }, [ store.unlockedCharacters, store.unlockedCustomizations, store.unlockedDLCs, store.unlockedPerks, store.items, store.offerings, store.addons, store.spoofItems, store.spoofPerks, store.spoofCatalog, store.spoofDLCs ]); /* stats */ const unlockedItems = useMemo( () => Object.values(store.items).filter((qty) => qty > 0).length, [store.items] ); const unlockedOfferings = useMemo( () => Object.values(store.offerings).filter((qty) => qty > 0).length, [store.offerings] ); const unlockedAddons = useMemo( () => Object.values(store.addons).filter((qty) => qty > 0).length, [store.addons] ); const unlockedPerks = store.unlockedPerks.length; return (

Dashboard

Status overview and profile management

{/* stats cards */}
Characters
{store.unlockedCharacters.length}{' '} / {charCount || '-'}
Customizations
{store.unlockedCustomizations.length}{' '} / {custCount || '-'}
DLCs
{store.unlockedDLCs.length}{' '} / {dlcsCount || '-'}
Items
{unlockedItems}{' '} / {itemsCount || '-'}
Offerings
{unlockedOfferings}{' '} / {offeringsCount || '-'}
Addons
{unlockedAddons}{' '} / {addonsCount || '-'}
Perks
{unlockedPerks}{' '} / {perksCount || '-'}
{/* toggles */}

Spoofer Toggles

Item Spoofing Spoof inventory items, addons, and offerings
Perk Spoofing Unlock all perk slots and custom builds
Catalog Spoofing Unlock cosmetics, characters, and outfits
DLC Spoofing Bypass Steam, Epic, and Xbox DLC ownership
{/* profile */}

Profile Import / Export