2026-10-28 23:38:54 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
const props = defineProps<{ villageId: number }>()
|
|
|
|
|
|
2026-10-29 00:26:08 +00:00
|
|
|
// One village state for every screen in the world: the village header, the village's
|
|
|
|
|
// own screens, the map and the reports all read it through useVillageContext().
|
2026-10-28 23:38:54 +00:00
|
|
|
const v = useVillage(props.villageId)
|
|
|
|
|
provideVillage(v)
|
|
|
|
|
v.refresh()
|
|
|
|
|
|
|
|
|
|
const { enter } = useCurrentWorld()
|
|
|
|
|
watch(v.village, (state) => {
|
|
|
|
|
if (state) enter(state.world_id, state.id)
|
|
|
|
|
})
|
feat: rally point tabs, map village popups, report filters, beginner protection bar, keyboard shortcuts
Ideas taken from how Die Stämme works, in our own look: the rally point splits into
commands, troops and simulator; hovering a village on the map shows its owner, points
and distance, a click offers send troops and centre; reports filter by attacks,
defence and support; a dismissible bar counts down beginner protection; one key per
screen (V, H, T, P, W, M, R); resources in the village bar lead to the workforce.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:00:13 +00:00
|
|
|
|
2026-10-29 09:15:36 +00:00
|
|
|
// The quest book opens by itself when a quest is newly complete, like Die Stämme's.
|
|
|
|
|
// What the player has already seen is kept per world, so a reload doesn't reopen it.
|
|
|
|
|
const questBook = useQuestBookOpen()
|
|
|
|
|
watch(
|
|
|
|
|
() => v.village.value && { world: v.village.value.world_id, claimable: v.village.value.quests.claimable },
|
|
|
|
|
(now) => {
|
|
|
|
|
if (!now) return
|
|
|
|
|
const key = `vp.quests.${now.world}`
|
|
|
|
|
let seen = 0
|
|
|
|
|
try {
|
|
|
|
|
seen = Number(localStorage.getItem(key) ?? 0)
|
|
|
|
|
localStorage.setItem(key, String(now.claimable))
|
|
|
|
|
} catch {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (now.claimable > seen) questBook.value = true
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
2026-10-29 00:26:08 +00:00
|
|
|
// One key per screen of the world, as the menu and quick bar titles show.
|
feat: rally point tabs, map village popups, report filters, beginner protection bar, keyboard shortcuts
Ideas taken from how Die Stämme works, in our own look: the rally point splits into
commands, troops and simulator; hovering a village on the map shows its owner, points
and distance, a click offers send troops and centre; reports filter by attacks,
defence and support; a dismissible bar counts down beginner protection; one key per
screen (V, H, T, P, W, M, R); resources in the village bar lead to the workforce.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:00:13 +00:00
|
|
|
useShortcuts(() => {
|
|
|
|
|
const base = `/village/${props.villageId}`
|
|
|
|
|
const worldId = v.village.value?.world_id
|
|
|
|
|
return {
|
|
|
|
|
...Object.fromEntries(VILLAGE_SCREENS.map((s) => [s.name, `${base}${s.path}`])),
|
|
|
|
|
...(worldId ? { map: `/map/${worldId}`, reports: `/reports/${worldId}` } : {}),
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-10-28 23:38:54 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-10-29 00:26:08 +00:00
|
|
|
<!-- The centred column: village header, thin notices, then the framed content. -->
|
2026-10-28 23:38:54 +00:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2026-10-29 00:26:08 +00:00
|
|
|
<div class="mx-auto max-w-[1100px] space-y-1 px-1 pt-1.5 sm:px-2">
|
|
|
|
|
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
|
|
|
|
|
<GameProtectionBar
|
|
|
|
|
v-if="v.village.value?.rally.protected_until"
|
|
|
|
|
:until="v.village.value.rally.protected_until"
|
|
|
|
|
:village-id="villageId"
|
|
|
|
|
:seconds-until="v.secondsUntil"
|
|
|
|
|
/>
|
|
|
|
|
<VillageFoodWarning
|
|
|
|
|
v-if="v.village.value"
|
|
|
|
|
:starvation="v.village.value.starvation"
|
|
|
|
|
:levy="v.village.value.levy"
|
|
|
|
|
:seconds-until="v.secondsUntil"
|
|
|
|
|
/>
|
|
|
|
|
<p v-if="v.error.value" class="alert" role="alert">{{ v.error.value }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<main class="mx-auto max-w-[1100px] px-1 pt-1 pb-4 sm:px-2">
|
|
|
|
|
<div class="frame">
|
|
|
|
|
<slot />
|
|
|
|
|
</div>
|
2026-10-28 23:38:54 +00:00
|
|
|
</main>
|
|
|
|
|
<GameTabBar :village-id="villageId" />
|
2026-10-29 09:15:36 +00:00
|
|
|
<QuestBook v-if="v.village.value" />
|
2026-10-28 23:38:54 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|