Release Healer Man 0.1.15
This commit is contained in:
1 parent
7b41b102fa
commit
f49e54f35f
43 files changed
+1478
-112
No files matched your search
+64
-3
@@ -14,6 +14,7 @@ import {
|
||||
updateCharacterManastormProgress,
|
||||
updateCharacterProgression,
|
||||
updateCharacterSettings,
|
||||
updateCharacterSpecialization,
|
||||
updateCombatPresentationSettings as persistCombatPresentationSettings,
|
||||
swapRomClasses,
|
||||
} from "./accountRepository";
|
||||
@@ -55,6 +56,11 @@ import {
|
||||
} from "./onlineAccountClient";
|
||||
import { isGameMasterSession } from "../game/manastormAdminConfig";
|
||||
import { useGameStore } from "../game/store";
|
||||
import {
|
||||
normalizeSpecializationId,
|
||||
specializationById,
|
||||
specializationsForClass,
|
||||
} from "../game/specializationCatalog";
|
||||
|
||||
export interface ShellState {
|
||||
phase: ShellPhase;
|
||||
@@ -82,6 +88,7 @@ export interface ShellState {
|
||||
openManastorms: () => boolean;
|
||||
openGmAdmin: () => boolean;
|
||||
openClassHall: () => boolean;
|
||||
changeSelectedSpecialization: (specializationId: string, resetTalents: boolean) => boolean;
|
||||
chooseRomSecondaryClass: (classId: RomClassId) => boolean;
|
||||
swapSelectedRomClasses: () => boolean;
|
||||
returnToMainMenu: () => void;
|
||||
@@ -110,11 +117,13 @@ export interface ShellState {
|
||||
|
||||
function defaultDraft(categoryId: ContentCategoryId = "wow"): CharacterDraft {
|
||||
const raceId: RaceId = categoryId === "rom" ? "rom-human" : "human";
|
||||
const classId = categoryId === "rom" ? "rom-priest" : categoryId === "coa" ? "barbarian" : "priest";
|
||||
return {
|
||||
name: "",
|
||||
categoryId,
|
||||
raceId,
|
||||
classId: categoryId === "rom" ? "rom-priest" : categoryId === "coa" ? "barbarian" : "priest",
|
||||
classId,
|
||||
specializationId: specializationsForClass(classId)[0]?.id ?? null,
|
||||
gender: "female",
|
||||
appearance: createDefaultAppearance(),
|
||||
rotation: -12,
|
||||
@@ -202,6 +211,11 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
if (!availableClasses.some((definition) => definition.id === next.classId)) {
|
||||
next.classId = availableClasses[0].id;
|
||||
}
|
||||
next.specializationId = next.categoryId === "rom"
|
||||
? null
|
||||
: normalizeSpecializationId(next.classId, next.specializationId)
|
||||
?? specializationsForClass(next.classId)[0]?.id
|
||||
?? null;
|
||||
next.appearance = clampAppearance(next.raceId, next.gender, next.appearance);
|
||||
return { draft: next, notice: "" };
|
||||
}),
|
||||
@@ -233,12 +247,17 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
set({ notice: "That gender model is not available for the selected race." });
|
||||
return false;
|
||||
}
|
||||
if (draft.categoryId !== "rom" && !normalizeSpecializationId(draft.classId, draft.specializationId)) {
|
||||
set({ notice: "Choose a specialization before creating this character." });
|
||||
return false;
|
||||
}
|
||||
const result = persistCharacter({
|
||||
ownerId: session.ownerId,
|
||||
name: normalizeCharacterName(draft.name),
|
||||
categoryId: draft.categoryId,
|
||||
raceId: draft.raceId,
|
||||
classId: draft.classId,
|
||||
specializationId: draft.categoryId === "rom" ? null : draft.specializationId,
|
||||
gender: draft.gender,
|
||||
appearance: clampAppearance(draft.raceId, draft.gender, draft.appearance),
|
||||
});
|
||||
@@ -278,6 +297,11 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
set({ notice: "That character is no longer available." });
|
||||
return false;
|
||||
}
|
||||
const character = characters.find((entry) => entry.id === selectedCharacterId)!;
|
||||
if (character.categoryId !== "rom" && !character.specializationId) {
|
||||
set({ phase: "class-hall", activeCharacter: null, notice: "Choose a specialization before continuing." });
|
||||
return true;
|
||||
}
|
||||
set({ phase: "main-menu", activeCharacter: null, notice: "" });
|
||||
return true;
|
||||
},
|
||||
@@ -287,6 +311,11 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
set({ phase: session ? "characters" : "login", notice: "Select or create a character first." });
|
||||
return false;
|
||||
}
|
||||
const character = characters.find((entry) => entry.id === selectedCharacterId)!;
|
||||
if (character.categoryId !== "rom" && !character.specializationId) {
|
||||
set({ phase: "class-hall", activeCharacter: null, notice: "Choose a specialization before entering activities." });
|
||||
return false;
|
||||
}
|
||||
set({ phase: "dungeons", activeCharacter: null, notice: "" });
|
||||
return true;
|
||||
},
|
||||
@@ -296,6 +325,11 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
set({ phase: session ? "characters" : "login", notice: "Select or create a character first." });
|
||||
return false;
|
||||
}
|
||||
const character = characters.find((entry) => entry.id === selectedCharacterId)!;
|
||||
if (character.categoryId !== "rom" && !character.specializationId) {
|
||||
set({ phase: "class-hall", activeCharacter: null, notice: "Choose a specialization before entering activities." });
|
||||
return false;
|
||||
}
|
||||
set({ phase: "manastorms", activeCharacter: null, notice: "" });
|
||||
return true;
|
||||
},
|
||||
@@ -315,13 +349,40 @@ export const useShellStore = create<ShellState>((set, get) => ({
|
||||
openClassHall: () => {
|
||||
const { session, selectedCharacterId, characters } = get();
|
||||
const character = characters.find((entry) => entry.id === selectedCharacterId);
|
||||
if (!session || !character || character.categoryId !== "rom") {
|
||||
set({ notice: "The Class Hall is available to Runes of Magic characters." });
|
||||
if (!session || !character) {
|
||||
set({ notice: "Select a character before opening the Class Hall." });
|
||||
return false;
|
||||
}
|
||||
set({ phase: "class-hall", activeCharacter: null, notice: "" });
|
||||
return true;
|
||||
},
|
||||
changeSelectedSpecialization: (specializationId, resetTalents) => {
|
||||
const { session, selectedCharacterId, phase } = get();
|
||||
if (!session || !selectedCharacterId || phase !== "class-hall") {
|
||||
set({ notice: "Specializations may only be changed inside the Class Hall." });
|
||||
return false;
|
||||
}
|
||||
const definition = specializationById(specializationId);
|
||||
if (!definition) {
|
||||
set({ notice: "That specialization is unavailable." });
|
||||
return false;
|
||||
}
|
||||
const result = updateCharacterSpecialization(
|
||||
session.ownerId,
|
||||
selectedCharacterId,
|
||||
definition.id,
|
||||
resetTalents,
|
||||
);
|
||||
if (!result.ok || !result.character) {
|
||||
set({ notice: result.error ?? "The specialization could not be changed." });
|
||||
return false;
|
||||
}
|
||||
set((state) => ({
|
||||
characters: state.characters.map((entry) => entry.id === result.character!.id ? result.character! : entry),
|
||||
notice: `${definition.displayName} selected. ${resetTalents ? "Talents reset." : "Talents kept."}`,
|
||||
}));
|
||||
return true;
|
||||
},
|
||||
chooseRomSecondaryClass: (classId) => {
|
||||
const { session, selectedCharacterId } = get();
|
||||
if (!session || !selectedCharacterId) return false;
|
||||
|
||||
Reference in new issue
Block a user