2026-10-29 00:57:00 +00:00
|
|
|
|
// `map.view` payloads. Coordinates are map fields around 0|0, negative included;
|
|
|
|
|
|
// continents are 100 × 100, named from the top-left (0|0 is the corner of K44, K45, K54, K55).
|
2026-10-28 18:58:42 +00:00
|
|
|
|
|
|
|
|
|
|
export interface MapVillage {
|
|
|
|
|
|
id: number
|
|
|
|
|
|
x: number
|
|
|
|
|
|
y: number
|
|
|
|
|
|
name: string
|
|
|
|
|
|
points: number
|
|
|
|
|
|
continent: string
|
|
|
|
|
|
/** null for barbarian villages. */
|
2026-10-30 10:07:31 +00:00
|
|
|
|
player: { id: number; name: string; tribe: { id: number; tag: string } | null } | null
|
2026-10-28 18:58:42 +00:00
|
|
|
|
own: boolean
|
2026-10-29 15:34:42 +00:00
|
|
|
|
/** A crown fort of the season. */
|
|
|
|
|
|
crown: boolean
|
2026-10-30 10:07:31 +00:00
|
|
|
|
/** What the owner is to the viewer: the village's colour. */
|
|
|
|
|
|
relation: MapRelationKind
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export type MapRelationKind = 'own' | 'tribe' | 'ally' | 'nap' | 'enemy' | 'none' | 'barbarian'
|
|
|
|
|
|
|
|
|
|
|
|
/** A group on the map the player knows of; positions run straight from sent_at to arrives_at. */
|
|
|
|
|
|
export interface MapMovement {
|
|
|
|
|
|
id: number
|
|
|
|
|
|
type: 'attack' | 'support' | 'return'
|
|
|
|
|
|
/** The player's own group; strangers' show their size only. */
|
|
|
|
|
|
own: boolean
|
|
|
|
|
|
/** Raiders from a barbarian camp: they wait there until sent_at. */
|
|
|
|
|
|
raid: boolean
|
|
|
|
|
|
from: { id: number; name: string; x: number; y: number }
|
|
|
|
|
|
to: { id: number; name: string; x: number; y: number }
|
|
|
|
|
|
sent_at: string
|
|
|
|
|
|
arrives_at: string
|
|
|
|
|
|
size: 'tiny' | 'small' | 'medium' | 'large' | 'huge'
|
|
|
|
|
|
units: Record<string, number> | null
|
2026-10-30 10:17:34 +00:00
|
|
|
|
/** Until when an own attack or support can be called back; null once it can't. */
|
|
|
|
|
|
cancel_until?: string | null
|
2026-10-28 18:58:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** `map.view {world_id, x?, y?, w, h}`: the w × h window around center, kept inside the map. */
|
|
|
|
|
|
export interface MapView {
|
|
|
|
|
|
world_id: number
|
|
|
|
|
|
/** The map is size × size fields. */
|
|
|
|
|
|
size: number
|
2026-10-29 00:57:00 +00:00
|
|
|
|
/** Lowest coordinate on both axes (−size/2); the highest is min + size − 1. */
|
|
|
|
|
|
min: number
|
2026-10-28 18:58:42 +00:00
|
|
|
|
center: { x: number; y: number }
|
|
|
|
|
|
/** Top-left field of the window. */
|
|
|
|
|
|
x: number
|
|
|
|
|
|
y: number
|
|
|
|
|
|
w: number
|
|
|
|
|
|
h: number
|
|
|
|
|
|
villages: MapVillage[]
|
2026-10-30 10:07:31 +00:00
|
|
|
|
movements: MapMovement[]
|
2026-10-28 18:58:42 +00:00
|
|
|
|
}
|