fix bug
This commit is contained in:
@@ -71,7 +71,7 @@ async function handleClearObjective() {
|
||||
<!-- Stats Grid -->
|
||||
<div class="stats-grid">
|
||||
<StatItem label="境界" :value="data.realm" :sub-value="data.level" />
|
||||
<StatItem label="年龄" :value="formatAge(data.age, data.lifespan)" />
|
||||
<StatItem label="年龄" :value="`${data.age} / ${data.lifespan}`" />
|
||||
|
||||
<StatItem label="HP" :value="formatHp(data.hp.cur, data.hp.max)" />
|
||||
<StatItem label="MP" :value="formatHp(data.mp.cur, data.mp.max)" />
|
||||
|
||||
@@ -26,8 +26,8 @@ const title = computed(() => {
|
||||
});
|
||||
|
||||
const subTitle = computed(() => {
|
||||
if (uiStore.detailData && 'nickname' in uiStore.detailData) {
|
||||
return uiStore.detailData.nickname;
|
||||
if (uiStore.detailData && 'nickname' in uiStore.detailData && uiStore.detailData.nickname) {
|
||||
return `「${uiStore.detailData.nickname}」`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
@@ -42,12 +42,10 @@ export const useWorldStore = defineStore('world', () => {
|
||||
if (existing) {
|
||||
// Merge
|
||||
next.set(av.id, { ...existing, ...av } as AvatarSummary);
|
||||
} else {
|
||||
// Insert (ensure required fields exist if possible, otherwise cast)
|
||||
// 在 Tick 中出现的新 Avatar 可能是完整的
|
||||
next.set(av.id, av as AvatarSummary);
|
||||
changed = true;
|
||||
}
|
||||
changed = true;
|
||||
// Else: ignore. Do NOT insert new avatars from tick updates,
|
||||
// as tick data is incomplete (position only) and might be from a stale game state (Race Condition).
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
@@ -66,9 +64,9 @@ export const useWorldStore = defineStore('world', () => {
|
||||
year: e.year ?? year.value,
|
||||
month: e.month ?? month.value,
|
||||
timestamp: (e.year ?? year.value) * 12 + (e.month ?? month.value),
|
||||
relatedAvatarIds: e.relatedAvatarIds || [],
|
||||
isMajor: e.isMajor,
|
||||
isStory: e.isStory
|
||||
relatedAvatarIds: e.related_avatar_ids || [],
|
||||
isMajor: e.is_major,
|
||||
isStory: e.is_story
|
||||
}));
|
||||
|
||||
// 排序并保留最新的 N 条
|
||||
@@ -80,6 +78,8 @@ export const useWorldStore = defineStore('world', () => {
|
||||
}
|
||||
|
||||
function handleTick(payload: TickPayloadDTO) {
|
||||
if (!isLoaded.value) return;
|
||||
|
||||
setTime(payload.year, payload.month);
|
||||
if (payload.avatars) updateAvatars(payload.avatars);
|
||||
if (payload.events) addEvents(payload.events);
|
||||
|
||||
Reference in New Issue
Block a user