generated from nhcarrigan/template
feat: add auto-prestige toggle via runestone shop upgrade
Adds a new Utility category to the prestige shop with the "Autonomous Ascension" upgrade (100 runestones). Once purchased, a toggle button appears in the shop that enables automatic prestige — the client RAF loop checks the threshold on each tick and fires the prestige API automatically using the current character name. ✨ This feature was implemented with help from Hikari~ 🌸
This commit is contained in:
@@ -36,10 +36,11 @@ const CATEGORY_ORDER: PrestigeUpgradeCategory[] = [
|
||||
"essence",
|
||||
"crystals",
|
||||
"runestones",
|
||||
"utility",
|
||||
];
|
||||
|
||||
export const PrestigePanel = (): React.JSX.Element => {
|
||||
const { state, reload, formatNumber, buyPrestigeUpgrade } = useGame();
|
||||
const { state, reload, formatNumber, buyPrestigeUpgrade, toggleAutoPrestige } = useGame();
|
||||
const [characterName, setCharacterName] = useState("");
|
||||
const [isPending, setIsPending] = useState(false);
|
||||
const [result, setResult] = useState<{ runestones: number; count: number; milestoneRunestones: number } | null>(null);
|
||||
@@ -205,6 +206,9 @@ export const PrestigePanel = (): React.JSX.Element => {
|
||||
const canAfford = prestigeData.runestones >= upgrade.runestonesCost;
|
||||
const isLoading = buyingId === upgrade.id;
|
||||
|
||||
const isAutoPrestigeToggle = upgrade.id === "auto_prestige" && purchased;
|
||||
const autoPrestigeEnabled = prestigeData.autoPrestigeEnabled ?? false;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={upgrade.id}
|
||||
@@ -217,6 +221,15 @@ export const PrestigePanel = (): React.JSX.Element => {
|
||||
{purchased ? "✅ Purchased" : `🔮 ${formatNumber(upgrade.runestonesCost)} Runestones`}
|
||||
</p>
|
||||
</div>
|
||||
{isAutoPrestigeToggle && (
|
||||
<button
|
||||
className={`auto-prestige-toggle ${autoPrestigeEnabled ? "enabled" : "disabled"}`}
|
||||
onClick={() => { toggleAutoPrestige(); }}
|
||||
type="button"
|
||||
>
|
||||
{autoPrestigeEnabled ? "⚡ Auto ON" : "⏸ Auto OFF"}
|
||||
</button>
|
||||
)}
|
||||
{!purchased && (
|
||||
<button
|
||||
className="buy-upgrade-button"
|
||||
|
||||
Reference in New Issue
Block a user