forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
4fb7a0b9c8
commit
4c768fbec6
24 files changed
+654
-22
No files matched your search
@@ -21,6 +21,8 @@ export default function TalentGameplayPanel({ readOnly = false, open, onClose }:
|
||||
const classId = useCombatStore((state) => state.classId);
|
||||
const level = useCombatStore((state) => state.level);
|
||||
const talentRanks = useCombatStore((state) => state.talentRanks);
|
||||
const glyphIds = useCombatStore((state) => state.glyphIds);
|
||||
const setGlyphActive = useCombatStore((state) => state.setGlyphActive);
|
||||
const classDefinition = classById(classId);
|
||||
const catalog = loadedTalentUiCatalog(classId) ?? use(loadTalentUiCatalog(classId));
|
||||
const talentTrees = useMemo(() => catalog.trees.map((tree) => ({
|
||||
@@ -41,6 +43,8 @@ export default function TalentGameplayPanel({ readOnly = false, open, onClose }:
|
||||
return <TalentsPanel
|
||||
trees={talentTrees}
|
||||
ranks={talentRanks}
|
||||
glyphIds={glyphIds}
|
||||
onGlyphActiveChange={setGlyphActive}
|
||||
classId={classId}
|
||||
playerLevel={level}
|
||||
availablePoints={runtimeUnspentTalentPoints(level, talentRanks, classId)}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { WOW335_GLYPH_OF_SWIFTMEND_ID } from "../game/wow335GlyphCatalog";
|
||||
import { TalentsPanel } from "./TalentsPanel";
|
||||
|
||||
function render(classId: "druid" | "mage", glyphIds: readonly string[] = []) {
|
||||
return renderToStaticMarkup(createElement(TalentsPanel, {
|
||||
open: true,
|
||||
trees: [{
|
||||
id: `${classId}-tree`,
|
||||
name: "Restoration",
|
||||
description: "Heal allies.",
|
||||
points: 0,
|
||||
color: "#83aa65",
|
||||
sigil: "R",
|
||||
backgroundUrl: "/talents.png",
|
||||
nodes: [],
|
||||
}],
|
||||
ranks: {},
|
||||
glyphIds,
|
||||
classId,
|
||||
playerLevel: 80,
|
||||
availablePoints: 0,
|
||||
onInvest: () => undefined,
|
||||
onReset: () => undefined,
|
||||
onGlyphActiveChange: () => undefined,
|
||||
onClose: () => undefined,
|
||||
}));
|
||||
}
|
||||
|
||||
describe("Glyph of Swiftmend build control", () => {
|
||||
it("shows the glyph unchecked by default for Druids", () => {
|
||||
const markup = render("druid");
|
||||
expect(markup).toContain("Glyph of Swiftmend");
|
||||
expect(markup).not.toContain('type="checkbox" checked=""');
|
||||
});
|
||||
|
||||
it("reflects a persisted active glyph and hides the option for other classes", () => {
|
||||
expect(render("druid", [WOW335_GLYPH_OF_SWIFTMEND_ID])).toContain('type="checkbox" checked=""');
|
||||
expect(render("mage", [WOW335_GLYPH_OF_SWIFTMEND_ID])).not.toContain("Glyph of Swiftmend");
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
TalentAllocationFailure,
|
||||
TalentRanks,
|
||||
} from "../game/talentCatalog";
|
||||
import { WOW335_GLYPH_OF_SWIFTMEND_ID } from "../game/wow335GlyphCatalog";
|
||||
import { useGameStore } from "../game/store";
|
||||
import { useMenuController, type MenuAction, type MenuDirection } from "../input/useMenuController";
|
||||
import { ControllerButton } from "./ControllerButton";
|
||||
@@ -29,6 +30,8 @@ export interface TalentsPanelProps {
|
||||
readOnly?: boolean;
|
||||
trees: readonly TalentTreeView[];
|
||||
ranks: TalentRanks;
|
||||
glyphIds?: readonly string[];
|
||||
onGlyphActiveChange?: (glyphId: string, active: boolean) => void;
|
||||
classId: ClassId;
|
||||
playerLevel: number;
|
||||
availablePoints: number;
|
||||
@@ -102,6 +105,8 @@ function failureText(
|
||||
function TalentsDialog({
|
||||
trees,
|
||||
ranks,
|
||||
glyphIds = [],
|
||||
onGlyphActiveChange,
|
||||
classId,
|
||||
playerLevel,
|
||||
availablePoints,
|
||||
@@ -251,6 +256,26 @@ function TalentsDialog({
|
||||
: "Your first talent point arrives at level 10. Every five points spent in a tree unlocks its next row."}
|
||||
</p>
|
||||
|
||||
{classId === "druid" && !isCoa && (
|
||||
<section className="talents-panel__glyphs" aria-label="Glyphs">
|
||||
<label className="talents-panel__glyph-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={glyphIds.includes(WOW335_GLYPH_OF_SWIFTMEND_ID)}
|
||||
disabled={readOnly || !onGlyphActiveChange}
|
||||
onChange={(event) => onGlyphActiveChange?.(
|
||||
WOW335_GLYPH_OF_SWIFTMEND_ID,
|
||||
event.currentTarget.checked,
|
||||
)}
|
||||
/>
|
||||
<span>
|
||||
<strong>Glyph of Swiftmend</strong>
|
||||
<small>Swiftmend no longer consumes your Rejuvenation or Regrowth effect.</small>
|
||||
</span>
|
||||
</label>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<nav className="talents-panel__tabs" aria-label="Talent trees">
|
||||
{trees.map((tree) => (
|
||||
<ControllerButton
|
||||
|
||||
Reference in new issue
Block a user