generated from nhcarrigan/template
fix: remove early prestige gates and improve quest unlock hints
- Remove prestigeRequirement from all original zone bosses (Shattered Ruins through Astral Void) — prestige gates now only apply to new endgame zones (Celestial Reaches onward) - Show zone unlock hint on locked quests when the quest's zone is still locked, so players know what to do - Switch quest reward numbers to use formatNumber instead of toLocaleString, fixing raw integer display for endgame values
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Quest } from "@elysium/types";
|
||||
import { useState } from "react";
|
||||
import { useGame } from "../../context/GameContext.js";
|
||||
import { formatNumber } from "../../utils/format.js";
|
||||
import { LockToggle } from "../ui/LockToggle.js";
|
||||
import { ZoneSelector } from "./ZoneSelector.js";
|
||||
|
||||
@@ -19,9 +20,10 @@ const questTimeRemaining = (quest: Quest): number => {
|
||||
interface QuestCardProps {
|
||||
quest: Quest;
|
||||
unlockHint?: string | undefined;
|
||||
zoneHint?: string | undefined;
|
||||
}
|
||||
|
||||
const QuestCard = ({ quest, unlockHint }: QuestCardProps): React.JSX.Element => {
|
||||
const QuestCard = ({ quest, unlockHint, zoneHint }: QuestCardProps): React.JSX.Element => {
|
||||
const { startQuest } = useGame();
|
||||
|
||||
return (
|
||||
@@ -33,9 +35,9 @@ const QuestCard = ({ quest, unlockHint }: QuestCardProps): React.JSX.Element =>
|
||||
{quest.rewards.map((reward, index) => (
|
||||
// eslint-disable-next-line react/no-array-index-key -- rewards have no unique id
|
||||
<span key={index} className="reward-tag">
|
||||
{reward.type === "gold" && `🪙 ${reward.amount?.toLocaleString()}`}
|
||||
{reward.type === "essence" && `✨ ${reward.amount?.toLocaleString()}`}
|
||||
{reward.type === "crystals" && `💎 ${reward.amount?.toLocaleString()}`}
|
||||
{reward.type === "gold" && `🪙 ${formatNumber(reward.amount ?? 0)}`}
|
||||
{reward.type === "essence" && `✨ ${formatNumber(reward.amount ?? 0)}`}
|
||||
{reward.type === "crystals" && `💎 ${formatNumber(reward.amount ?? 0)}`}
|
||||
{reward.type === "upgrade" && "🔓 Upgrade"}
|
||||
{reward.type === "adventurer" && "👥 New Adventurer"}
|
||||
</span>
|
||||
@@ -46,7 +48,8 @@ const QuestCard = ({ quest, unlockHint }: QuestCardProps): React.JSX.Element =>
|
||||
{quest.status === "locked" && (
|
||||
<>
|
||||
<span className="quest-badge locked">🔒 Locked</span>
|
||||
{unlockHint && <p className="unlock-hint">📜 Complete: {unlockHint}</p>}
|
||||
{zoneHint && <p className="unlock-hint">🗺️ Unlock zone: {zoneHint}</p>}
|
||||
{!zoneHint && unlockHint && <p className="unlock-hint">📜 Complete: {unlockHint}</p>}
|
||||
</>
|
||||
)}
|
||||
{quest.status === "available" && (
|
||||
@@ -84,9 +87,15 @@ export const QuestPanel = (): React.JSX.Element => {
|
||||
: zoneQuests.filter((q) => q.status !== "locked");
|
||||
|
||||
const questNameById = new Map(state.quests.map((q) => [q.id, q.name]));
|
||||
const zoneById = new Map(zones.map((z) => [z.id, z]));
|
||||
const questUnlockHints = new Map<string, string>();
|
||||
const questZoneHints = new Map<string, string>();
|
||||
for (const quest of state.quests) {
|
||||
if (quest.status === "locked" && quest.prerequisiteIds.length > 0) {
|
||||
if (quest.status !== "locked") continue;
|
||||
const zone = zoneById.get(quest.zoneId);
|
||||
if (zone?.status === "locked") {
|
||||
questZoneHints.set(quest.id, zone.name);
|
||||
} else if (quest.prerequisiteIds.length > 0) {
|
||||
const prereqId = quest.prerequisiteIds[0];
|
||||
if (prereqId) {
|
||||
const prereqName = questNameById.get(prereqId);
|
||||
@@ -116,7 +125,7 @@ export const QuestPanel = (): React.JSX.Element => {
|
||||
|
||||
<div className="quest-list">
|
||||
{visibleQuests.map((quest) => (
|
||||
<QuestCard key={quest.id} quest={quest} unlockHint={questUnlockHints.get(quest.id)} />
|
||||
<QuestCard key={quest.id} quest={quest} unlockHint={questUnlockHints.get(quest.id)} zoneHint={questZoneHints.get(quest.id)} />
|
||||
))}
|
||||
{visibleQuests.length === 0 && (
|
||||
<p className="empty-zone">No quests to show in this zone.</p>
|
||||
|
||||
Reference in New Issue
Block a user