Merge branch 'feature/lobby-interaction-fixes'
@@ -13,7 +13,7 @@ Live (na de eerste deploy): https://projects.timfalken.com/allianties/
13
13
3. De host start het spel zodra er minstens twee spelers zijn. Het spel blijft
14
14
daarna lopen, dagenlang, tot er één overlevende is.
15
15
4. Elke tank begint met 3 levens, bereik 2 (Chebyshev, ook diagonaal) en 1
16
actiepunt. Elke dag op het ingestelde tijdstip (Europe/Amsterdam, standaard 00:00) krijgt elke levende
16
actiepunt. Elke dag op het ingestelde tijdstip (standaard 00:00, in de lokale tijd van de host) krijgt elke levende
17
17
speler 1 actiepunt erbij.
18
18
5. Voor 1 actiepunt kun je: één vakje bewegen (8 richtingen, niet op een bezet
19
19
of onbegaanbaar vakje), een speler binnen bereik beschieten (−1 leven), je
@@ -30,12 +30,16 @@ Optionele regels (in de lobby, vóór de start):
30
30
(standaard 7) wordt de buitenste ring onbegaanbaar. Spelers die erop staan
31
31
verliezen een leven en worden naar binnen geduwd.
32
32
- **Gedwongen staakt-het-vuren** (standaard uit): in door de host gekozen
33
uren (Europe/Amsterdam) mag niemand schieten. De periodes zijn te tekenen
33
uren mag niemand schieten. De periodes zijn te tekenen
34
34
op een 24-uursklok.
35
35
- **Actiepunten plunderen bij een kill** (standaard uit): alleen bij een
36
36
uitschakelend schot krijgt de schutter de resterende AP van het doelwit.
37
- **Dagelijks AP-tijdstip**: per lobby instelbaar (Europe/Amsterdam),
37
- **Dagelijks AP-tijdstip**: per lobby instelbaar,
38
38
standaard 00:00. Jury en krimp vallen samen met dit tijdstip.
39
- **Tijdzones**: iedere speler ziet en voert alle tijden in zijn eigen lokale
40
tijd in (browserzone). De host definieert tijden in zijn zone; de server
41
bewaart ze met die IANA-zone en rekent exact, ook rond zomertijd.
42
- **Alleen de host** mag de spelregels wijzigen (server: 403).
39
43
- **Bordgrootte**: de host kiest de zijde van het vierkante bord (6–24).
40
44
De suggestie is `max(6 + ceil(n / 2), n + 1)` (2 spelers: 7×7; 6: 9×9;
41
45
10: 11×11; 14: 15×15) en wordt bijgewerkt als er mensen joinen, tenzij
@@ -13,7 +13,7 @@ Live (na de eerste deploy): https://projects.timfalken.com/allianties/13
3. De host start het spel zodra er minstens twee spelers zijn. Het spel blijft13
3. De host start het spel zodra er minstens twee spelers zijn. Het spel blijft14
daarna lopen, dagenlang, tot er één overlevende is.14
daarna lopen, dagenlang, tot er één overlevende is.15
4. Elke tank begint met 3 levens, bereik 2 (Chebyshev, ook diagonaal) en 115
4. Elke tank begint met 3 levens, bereik 2 (Chebyshev, ook diagonaal) en 116
actiepunt. Elke dag op het ingestelde tijdstip (Europe/Amsterdam, standaard 00:00) krijgt elke levende16
actiepunt. Elke dag op het ingestelde tijdstip (standaard 00:00, in de lokale tijd van de host) krijgt elke levende17
speler 1 actiepunt erbij.17
speler 1 actiepunt erbij.18
5. Voor 1 actiepunt kun je: één vakje bewegen (8 richtingen, niet op een bezet18
5. Voor 1 actiepunt kun je: één vakje bewegen (8 richtingen, niet op een bezet19
of onbegaanbaar vakje), een speler binnen bereik beschieten (−1 leven), je19
of onbegaanbaar vakje), een speler binnen bereik beschieten (−1 leven), je@@ -30,12 +30,16 @@ Optionele regels (in de lobby, vóór de start):30
(standaard 7) wordt de buitenste ring onbegaanbaar. Spelers die erop staan30
(standaard 7) wordt de buitenste ring onbegaanbaar. Spelers die erop staan31
verliezen een leven en worden naar binnen geduwd.31
verliezen een leven en worden naar binnen geduwd.32
- **Gedwongen staakt-het-vuren** (standaard uit): in door de host gekozen32
- **Gedwongen staakt-het-vuren** (standaard uit): in door de host gekozen33
uren (Europe/Amsterdam) mag niemand schieten. De periodes zijn te tekenen33
uren mag niemand schieten. De periodes zijn te tekenen34
op een 24-uursklok.34
op een 24-uursklok.35
- **Actiepunten plunderen bij een kill** (standaard uit): alleen bij een35
- **Actiepunten plunderen bij een kill** (standaard uit): alleen bij een36
uitschakelend schot krijgt de schutter de resterende AP van het doelwit.36
uitschakelend schot krijgt de schutter de resterende AP van het doelwit.37
- **Dagelijks AP-tijdstip**: per lobby instelbaar (Europe/Amsterdam),37
- **Dagelijks AP-tijdstip**: per lobby instelbaar,38
standaard 00:00. Jury en krimp vallen samen met dit tijdstip.38
standaard 00:00. Jury en krimp vallen samen met dit tijdstip.39
- **Tijdzones**: iedere speler ziet en voert alle tijden in zijn eigen lokale40
tijd in (browserzone). De host definieert tijden in zijn zone; de server41
bewaart ze met die IANA-zone en rekent exact, ook rond zomertijd.42
- **Alleen de host** mag de spelregels wijzigen (server: 403).39
- **Bordgrootte**: de host kiest de zijde van het vierkante bord (6–24).43
- **Bordgrootte**: de host kiest de zijde van het vierkante bord (6–24).40
De suggestie is `max(6 + ceil(n / 2), n + 1)` (2 spelers: 7×7; 6: 9×9;44
De suggestie is `max(6 + ceil(n / 2), n + 1)` (2 spelers: 7×7; 6: 9×9;41
10: 11×11; 14: 15×15) en wordt bijgewerkt als er mensen joinen, tenzij45
10: 11×11; 14: 15×15) en wordt bijgewerkt als er mensen joinen, tenzij@@ -32,7 +32,7 @@
32
32
33
33
<div id="menu" class="screen">
34
34
<h1>Allianties</h1>
35
<p class="tagline" data-i18n="menu.tagline">A game of patience, alliances and well-timed shots.</p>
35
<p class="tagline" data-i18n="menu.tagline">A game of patience, paranoia and well-timed betrayal.</p>
36
36
37
37
<div id="menu-account" class="menu-account">
38
38
<p id="menu-guest">
@@ -92,6 +92,7 @@
92
92
93
93
<section id="lobby-rules" class="rules-panel">
94
94
<h2 data-i18n="lobby.rules">Rules</h2>
95
<p id="rules-host-only" class="notice" hidden data-i18n="lobby.rulesHostOnly">Only the host can change the rules.</p>
95
96
96
97
<label class="toggle">
97
98
<input type="checkbox" id="rule-jury" checked>
@@ -123,6 +124,7 @@
123
124
<div id="ap-time-wrap" class="field ap-time-field">
124
125
<label for="rule-ap-time" data-i18n="lobby.apTime">Daily action points at</label>
125
126
<input type="time" id="rule-ap-time" value="00:00" step="60">
127
<small class="tz-label"></small>
126
128
<small data-i18n="lobby.apTimeHint"></small>
127
129
</div>
128
130
@@ -149,6 +151,7 @@
149
151
<div id="ceasefire-editor" class="ceasefire-editor" hidden>
150
152
<p class="hint" data-i18n="lobby.ceasefireClock"></p>
151
153
<div id="cf-clock" class="cf-clock" aria-label="24-hour clock"></div>
154
<p class="tz-label hint"></p>
152
155
<ul id="cf-ranges" class="cf-ranges"></ul>
153
156
<button type="button" id="cf-add" class="btn-secondary" data-i18n="lobby.ceasefireAdd">Add period</button>
154
157
</div>
@@ -32,7 +32,7 @@32
32
33
<div id="menu" class="screen">33
<div id="menu" class="screen">34
<h1>Allianties</h1>34
<h1>Allianties</h1>35
<p class="tagline" data-i18n="menu.tagline">A game of patience, alliances and well-timed shots.</p>35
<p class="tagline" data-i18n="menu.tagline">A game of patience, paranoia and well-timed betrayal.</p>36
36
37
<div id="menu-account" class="menu-account">37
<div id="menu-account" class="menu-account">38
<p id="menu-guest">38
<p id="menu-guest">@@ -92,6 +92,7 @@92
92
93
<section id="lobby-rules" class="rules-panel">93
<section id="lobby-rules" class="rules-panel">94
<h2 data-i18n="lobby.rules">Rules</h2>94
<h2 data-i18n="lobby.rules">Rules</h2>95
<p id="rules-host-only" class="notice" hidden data-i18n="lobby.rulesHostOnly">Only the host can change the rules.</p>95
96
96
<label class="toggle">97
<label class="toggle">97
<input type="checkbox" id="rule-jury" checked>98
<input type="checkbox" id="rule-jury" checked>@@ -123,6 +124,7 @@123
<div id="ap-time-wrap" class="field ap-time-field">124
<div id="ap-time-wrap" class="field ap-time-field">124
<label for="rule-ap-time" data-i18n="lobby.apTime">Daily action points at</label>125
<label for="rule-ap-time" data-i18n="lobby.apTime">Daily action points at</label>125
<input type="time" id="rule-ap-time" value="00:00" step="60">126
<input type="time" id="rule-ap-time" value="00:00" step="60">127
<small class="tz-label"></small>126
<small data-i18n="lobby.apTimeHint"></small>128
<small data-i18n="lobby.apTimeHint"></small>127
</div>129
</div>128
130
@@ -149,6 +151,7 @@149
<div id="ceasefire-editor" class="ceasefire-editor" hidden>151
<div id="ceasefire-editor" class="ceasefire-editor" hidden>150
<p class="hint" data-i18n="lobby.ceasefireClock"></p>152
<p class="hint" data-i18n="lobby.ceasefireClock"></p>151
<div id="cf-clock" class="cf-clock" aria-label="24-hour clock"></div>153
<div id="cf-clock" class="cf-clock" aria-label="24-hour clock"></div>154
<p class="tz-label hint"></p>152
<ul id="cf-ranges" class="cf-ranges"></ul>155
<ul id="cf-ranges" class="cf-ranges"></ul>153
<button type="button" id="cf-add" class="btn-secondary" data-i18n="lobby.ceasefireAdd">Add period</button>156
<button type="button" id="cf-add" class="btn-secondary" data-i18n="lobby.ceasefireAdd">Add period</button>154
</div>157
</div>@@ -565,3 +565,11 @@ button.cell {
565
565
.grid-size-row input[type="number"] { max-width: 5rem; }
566
566
.grid-times { opacity: 0.7; }
567
567
#grid-use-suggested { margin-top: 6px; }
568
569
#lobby-rules.readonly .toggle, #lobby-rules.readonly .field, #lobby-rules.readonly .vis-opt { opacity: 0.75; cursor: default; }
570
#lobby-rules.readonly input { cursor: default; }
571
#cf-clock svg { touch-action: none; -webkit-user-select: none; user-select: none; }
572
#cf-clock svg.dragging { cursor: grabbing; }
573
#cf-clock svg.readonly { cursor: default; }
574
575
.tz-label { display: block; opacity: 0.65; font-size: 0.8em; }
@@ -565,3 +565,11 @@ button.cell {565
.grid-size-row input[type="number"] { max-width: 5rem; }565
.grid-size-row input[type="number"] { max-width: 5rem; }566
.grid-times { opacity: 0.7; }566
.grid-times { opacity: 0.7; }567
#grid-use-suggested { margin-top: 6px; }567
#grid-use-suggested { margin-top: 6px; }568
569
#lobby-rules.readonly .toggle, #lobby-rules.readonly .field, #lobby-rules.readonly .vis-opt { opacity: 0.75; cursor: default; }570
#lobby-rules.readonly input { cursor: default; }571
#cf-clock svg { touch-action: none; -webkit-user-select: none; user-select: none; }572
#cf-clock svg.dragging { cursor: grabbing; }573
#cf-clock svg.readonly { cursor: default; }574
575
.tz-label { display: block; opacity: 0.65; font-size: 0.8em; }@@ -35,7 +35,7 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.
35
35
- Iedereen begint bij de start met 1 actiepunt, zodat je meteen kunt
36
36
handelen.
37
37
- Daarna krijgt elke levende speler 1 punt bij elke dagelijkse uitdeling
38
(Europe/Amsterdam). Het tijdstip is per lobby instelbaar, standaard
38
(in de tijdzone van de host, zie “Tijdzones”). Het tijdstip is per lobby instelbaar, standaard
39
39
**00:00**, en volgt de wissel naar en van zomertijd. Als de server een
40
40
paar dagen offline was, worden gemiste uitdelingen bij de volgende
41
41
request ingehaald.
@@ -83,7 +83,8 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.
83
83
de klok mee), of vult exacte tijden in. Periodes mogen over middernacht
84
84
lopen. Een periode met gelijke begin- en eindtijd wordt genegeerd.
85
85
Overlappende periodes worden voor de countdown samengevoegd.
86
- Tijden zijn wandkloktijden in **Europe/Amsterdam**. Bij de overgang naar
86
- Tijden zijn wandkloktijden in de **tijdzone van de host** (`rules.tz`, zie
87
“Tijdzones”). Bij de overgang naar
87
88
zomertijd is een periode korter in echte seconden (het overgeslagen uur
88
89
telt niet); bij de terugzetting is hij langer (het herhaalde uur telt
89
90
twee keer). Het einde van een periode is exclusief (06:00 precies is
@@ -126,7 +127,7 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.
126
127
127
128
## Actiepunten-tijdstip en plunderen
128
129
129
- Elke lobby heeft een **dagelijks AP-tijdstip** (Europe/Amsterdam),
130
- Elke lobby heeft een **dagelijks AP-tijdstip** (in de tijdzone van de host),
130
131
standaard 00:00. De host stelt het in met een tijdkiezer. Op dat
131
132
moment gebeuren de AP-uitdeling, de jurybonus en (indien aan) het
132
133
krimpen van het veld. Een “dag” in het spel is één zo’n uitdeling.
@@ -258,3 +259,50 @@ of, als het spel al loopt en je lid bent, het lopende spel.
258
259
`projects.timfalken.com` worden toegevoegd. Het clientgeheim wordt níet
259
260
opnieuw gegenereerd (dat zou de andere sites breken) en komt als
260
261
projectgeheim `auth_client_secret` in de CI.
262
263
## Tijdzones
264
265
- Alle tijden worden getoond en ingevoerd in de **lokale tijdzone van de
266
speler** (de IANA-zone van de browser, `Intl…resolvedOptions().timeZone`).
267
Bij de tijdvelden en de klok staat subtiel “lokale tijd · <zone>”.
268
- De host definieert het AP-tijdstip en de staakt-het-vuren-periodes in
269
zijn eigen lokale tijd. De server bewaart ze als wandkloktijd **plus de
270
IANA-zone van de host** (`rules.tz`, standaard Europe/Amsterdam; onbekende
271
zones of kale offsets zoals `+02:00` vallen terug op Europe/Amsterdam,
272
omdat alleen een benoemde zone zomertijdregels heeft). Alle berekeningen
273
(uitdeling, wel/geen staakt-het-vuren, aftellers) gebeuren op de server
274
in die zone en leveren absolute tijdstempels; zomertijd is dus exact,
275
ook als de zones van host en speler op verschillende dagen wisselen.
276
- Andere spelers zien dezelfde tijden omgerekend naar hun eigen zone. Een
277
wandkloktijd omrekenen hangt af van de datum (zomertijd); de weergave
278
gebruikt de **huidige dag** in de zone van de host. Rond een
279
zomertijdwissel kan de getoonde tijd dus een dag later een uur
280
verschuiven; de echte regel (op de server) verschuift niet.
281
- Na omrekening kan een periode over middernacht lopen (bijv. 14:00–20:00
282
Amsterdam is 22:00–04:00 Tokyo); de klok draait de taartpunten mee.
283
- Bewerkt de host de regels vanuit een andere zone (bijv. op reis), dan
284
worden eerst alle tijden naar die zone omgerekend en met die zone
285
opgeslagen, zodat het formulier altijd in één zone werkt.
286
287
## Lobbyformulier tijdens bewerken
288
289
- Oorzaak van het slechte slepen en typen (t1171): elke 3 s haalde de
290
browser de lobby opnieuw op. Na elke wijziging (ook de eigen opslag van
291
de host, of een speler die joint) kwam er een nieuwe versie binnen en
292
werd het hele regelsformulier opnieuw opgebouwd: de lijst met tijdvelden
293
werd leeggemaakt en opnieuw aangemaakt (focus weg, half getypte waarde
294
weg) en de klok-SVG werd vervangen. Bovendien bouwde de klok zichzelf
295
bij **elke** muis-/vingerbeweging opnieuw op, waardoor de pointer
296
capture verloren ging, en kon een poll met de oude serverwaarden de
297
lokale, nog niet opgeslagen wijziging terugzetten.
298
- Nu: de klok wordt één keer opgebouwd; tijdens het slepen worden alleen de
299
taartpunten en handvatten in dezelfde SVG bijgewerkt (pointer capture,
300
`touch-action: none`, snappen op 15 minuten). Tijdvelden worden ter
301
plekke bijgewerkt en een veld met focus wordt nooit overschreven.
302
Zolang de host typt, sleept of een opslag onderweg is, winnen de lokale
303
waarden van de poll. Opslaan gebeurt gedebounced (600 ms) en wacht tot
304
een sleepbeweging klaar is.
305
- Alleen de host mag de regels wijzigen: de server weigert anderen met
306
HTTP 403 (`not_host`); niet-hosts zien het formulier alleen-lezen met
307
de melding “Alleen de host kan de spelregels aanpassen.”
308
@@ -35,7 +35,7 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.35
- Iedereen begint bij de start met 1 actiepunt, zodat je meteen kunt35
- Iedereen begint bij de start met 1 actiepunt, zodat je meteen kunt36
handelen.36
handelen.37
- Daarna krijgt elke levende speler 1 punt bij elke dagelijkse uitdeling37
- Daarna krijgt elke levende speler 1 punt bij elke dagelijkse uitdeling38
(Europe/Amsterdam). Het tijdstip is per lobby instelbaar, standaard38
(in de tijdzone van de host, zie “Tijdzones”). Het tijdstip is per lobby instelbaar, standaard39
**00:00**, en volgt de wissel naar en van zomertijd. Als de server een39
**00:00**, en volgt de wissel naar en van zomertijd. Als de server een40
paar dagen offline was, worden gemiste uitdelingen bij de volgende40
paar dagen offline was, worden gemiste uitdelingen bij de volgende41
request ingehaald.41
request ingehaald.@@ -83,7 +83,8 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.83
de klok mee), of vult exacte tijden in. Periodes mogen over middernacht83
de klok mee), of vult exacte tijden in. Periodes mogen over middernacht84
lopen. Een periode met gelijke begin- en eindtijd wordt genegeerd.84
lopen. Een periode met gelijke begin- en eindtijd wordt genegeerd.85
Overlappende periodes worden voor de countdown samengevoegd.85
Overlappende periodes worden voor de countdown samengevoegd.86
- Tijden zijn wandkloktijden in **Europe/Amsterdam**. Bij de overgang naar86
- Tijden zijn wandkloktijden in de **tijdzone van de host** (`rules.tz`, zie87
“Tijdzones”). Bij de overgang naar87
zomertijd is een periode korter in echte seconden (het overgeslagen uur88
zomertijd is een periode korter in echte seconden (het overgeslagen uur88
telt niet); bij de terugzetting is hij langer (het herhaalde uur telt89
telt niet); bij de terugzetting is hij langer (het herhaalde uur telt89
twee keer). Het einde van een periode is exclusief (06:00 precies is90
twee keer). Het einde van een periode is exclusief (06:00 precies is@@ -126,7 +127,7 @@ regelmotor (`server/lib/Engine.php`) en de tests vastgelegd.126
127
127
## Actiepunten-tijdstip en plunderen128
## Actiepunten-tijdstip en plunderen128
129
129
- Elke lobby heeft een **dagelijks AP-tijdstip** (Europe/Amsterdam),130
- Elke lobby heeft een **dagelijks AP-tijdstip** (in de tijdzone van de host),130
standaard 00:00. De host stelt het in met een tijdkiezer. Op dat131
standaard 00:00. De host stelt het in met een tijdkiezer. Op dat131
moment gebeuren de AP-uitdeling, de jurybonus en (indien aan) het132
moment gebeuren de AP-uitdeling, de jurybonus en (indien aan) het132
krimpen van het veld. Een “dag” in het spel is één zo’n uitdeling.133
krimpen van het veld. Een “dag” in het spel is één zo’n uitdeling.@@ -258,3 +259,50 @@ of, als het spel al loopt en je lid bent, het lopende spel.258
`projects.timfalken.com` worden toegevoegd. Het clientgeheim wordt níet259
`projects.timfalken.com` worden toegevoegd. Het clientgeheim wordt níet259
opnieuw gegenereerd (dat zou de andere sites breken) en komt als260
opnieuw gegenereerd (dat zou de andere sites breken) en komt als260
projectgeheim `auth_client_secret` in de CI.261
projectgeheim `auth_client_secret` in de CI.262
263
## Tijdzones264
265
- Alle tijden worden getoond en ingevoerd in de **lokale tijdzone van de266
speler** (de IANA-zone van de browser, `Intl…resolvedOptions().timeZone`).267
Bij de tijdvelden en de klok staat subtiel “lokale tijd · <zone>”.268
- De host definieert het AP-tijdstip en de staakt-het-vuren-periodes in269
zijn eigen lokale tijd. De server bewaart ze als wandkloktijd **plus de270
IANA-zone van de host** (`rules.tz`, standaard Europe/Amsterdam; onbekende271
zones of kale offsets zoals `+02:00` vallen terug op Europe/Amsterdam,272
omdat alleen een benoemde zone zomertijdregels heeft). Alle berekeningen273
(uitdeling, wel/geen staakt-het-vuren, aftellers) gebeuren op de server274
in die zone en leveren absolute tijdstempels; zomertijd is dus exact,275
ook als de zones van host en speler op verschillende dagen wisselen.276
- Andere spelers zien dezelfde tijden omgerekend naar hun eigen zone. Een277
wandkloktijd omrekenen hangt af van de datum (zomertijd); de weergave278
gebruikt de **huidige dag** in de zone van de host. Rond een279
zomertijdwissel kan de getoonde tijd dus een dag later een uur280
verschuiven; de echte regel (op de server) verschuift niet.281
- Na omrekening kan een periode over middernacht lopen (bijv. 14:00–20:00282
Amsterdam is 22:00–04:00 Tokyo); de klok draait de taartpunten mee.283
- Bewerkt de host de regels vanuit een andere zone (bijv. op reis), dan284
worden eerst alle tijden naar die zone omgerekend en met die zone285
opgeslagen, zodat het formulier altijd in één zone werkt.286
287
## Lobbyformulier tijdens bewerken288
289
- Oorzaak van het slechte slepen en typen (t1171): elke 3 s haalde de290
browser de lobby opnieuw op. Na elke wijziging (ook de eigen opslag van291
de host, of een speler die joint) kwam er een nieuwe versie binnen en292
werd het hele regelsformulier opnieuw opgebouwd: de lijst met tijdvelden293
werd leeggemaakt en opnieuw aangemaakt (focus weg, half getypte waarde294
weg) en de klok-SVG werd vervangen. Bovendien bouwde de klok zichzelf295
bij **elke** muis-/vingerbeweging opnieuw op, waardoor de pointer296
capture verloren ging, en kon een poll met de oude serverwaarden de297
lokale, nog niet opgeslagen wijziging terugzetten.298
- Nu: de klok wordt één keer opgebouwd; tijdens het slepen worden alleen de299
taartpunten en handvatten in dezelfde SVG bijgewerkt (pointer capture,300
`touch-action: none`, snappen op 15 minuten). Tijdvelden worden ter301
plekke bijgewerkt en een veld met focus wordt nooit overschreven.302
Zolang de host typt, sleept of een opslag onderweg is, winnen de lokale303
waarden van de poll. Opslaan gebeurt gedebounced (600 ms) en wacht tot304
een sleepbeweging klaar is.305
- Alleen de host mag de regels wijzigen: de server weigert anderen met306
HTTP 403 (`not_host`); niet-hosts zien het formulier alleen-lezen met307
de melding “Alleen de host kan de spelregels aanpassen.”308
@@ -175,14 +175,7 @@ try {
175
175
}
176
176
} catch (RuntimeException $e) {
177
177
$code = $e->getMessage();
178
$http = 400;
179
if (in_array($code, ['login', 'not_in_game'], true)) {
180
$http = $code === 'login' ? 401 : 403;
181
}
182
if (in_array($code, ['csrf'], true)) {
183
$http = 403;
184
}
185
jsonFail($code, $http);
178
jsonFail($code, apiHttpStatus($code));
186
179
} catch (Throwable $e) {
187
180
jsonFail('generic', 500);
188
181
}
@@ -175,14 +175,7 @@ try {175
}175
}176
} catch (RuntimeException $e) {176
} catch (RuntimeException $e) {177
$code = $e->getMessage();177
$code = $e->getMessage();178
$http = 400;178
jsonFail($code, apiHttpStatus($code));179
if (in_array($code, ['login', 'not_in_game'], true)) {180
$http = $code === 'login' ? 401 : 403;181
}182
if (in_array($code, ['csrf'], true)) {183
$http = 403;184
}185
jsonFail($code, $http);186
} catch (Throwable $e) {179
} catch (Throwable $e) {187
jsonFail('generic', 500);180
jsonFail('generic', 500);188
}181
}@@ -66,6 +66,7 @@ final class Engine
66
66
'ceasefire_ranges' => [],
67
67
'ap_loot' => false,
68
68
'ap_time' => '00:00',
69
'tz' => self::TZ,
69
70
'vis_shots' => 'public',
70
71
'vis_gifts' => 'public',
71
72
'vis_ap' => 'public',
@@ -94,6 +95,7 @@ final class Engine
94
95
$d['ap_loot'] = self::asBool($raw['ap_loot'] ?? false);
95
96
$hm = self::parseHm($raw['ap_time'] ?? '00:00');
96
97
$d['ap_time'] = $hm ?? '00:00';
98
$d['tz'] = self::validTz($raw['tz'] ?? null);
97
99
$d['vis_shots'] = self::visChoice($raw['vis_shots'] ?? null, self::VIS_SHOTS, 'public');
98
100
$d['vis_gifts'] = self::visChoice($raw['vis_gifts'] ?? null, self::VIS_GIFTS, 'public');
99
101
$d['vis_ap'] = self::visChoice($raw['vis_ap'] ?? null, self::VIS_AP, 'public');
@@ -271,16 +273,44 @@ final class Engine
271
273
}
272
274
273
275
/**
274
* Next occurrence of a Europe/Amsterdam wall-clock time strictly after $from.
276
* The host's IANA time zone for ap_time and cease-fire ranges.
277
* Unknown or missing values fall back to Europe/Amsterdam.
278
*/
279
public static function validTz(mixed $tz): string
280
{
281
if (!is_string($tz) || $tz === '' || strlen($tz) > 64) {
282
return self::TZ;
283
}
284
try {
285
$z = new DateTimeZone($tz);
286
} catch (Throwable $e) {
287
return self::TZ;
288
}
289
$name = $z->getName();
290
// Only named zones (no raw offsets like +02:00): those carry DST rules.
291
if (!in_array($name, DateTimeZone::listIdentifiers(), true) && $name !== 'UTC') {
292
return self::TZ;
293
}
294
return $name;
295
}
296
297
/** Rules' time zone (host's zone at the time of the last rules edit). */
298
public static function rulesTz(array $game): string
299
{
300
return self::validTz(($game['rules'] ?? [])['tz'] ?? null);
301
}
302
303
/**
304
* Next occurrence of a wall-clock time in $tz (default Europe/Amsterdam) strictly after $from.
275
305
* Used for the per-lobby daily AP time (default 00:00).
276
306
* If that clock time is skipped by a spring-forward DST gap, PHP's
277
307
* DateTime::setTime lands on the first valid instant after the gap.
278
308
*/
279
public static function nextDistribution(int $from, ?string $hm = null): int
309
public static function nextDistribution(int $from, ?string $hm = null, ?string $tzName = null): int
280
310
{
281
311
$hm = self::parseHm($hm ?? '00:00') ?? '00:00';
282
312
[$h, $min] = array_map('intval', explode(':', $hm));
283
$tz = new DateTimeZone(self::TZ);
313
$tz = new DateTimeZone(self::validTz($tzName));
284
314
$dt = (new DateTime('@' . $from))->setTimezone($tz);
285
315
$candidate = clone $dt;
286
316
$candidate->setTime($h, $min, 0);
@@ -504,7 +534,7 @@ final class Engine
504
534
$game['started_at'] = $now;
505
535
$game['day'] = 0;
506
536
$game['arena_inset'] = 0;
507
$game['next_distribution_at'] = self::nextDistribution($now, $game['rules']['ap_time'] ?? '00:00');
537
$game['next_distribution_at'] = self::nextDistribution($now, $game['rules']['ap_time'] ?? '00:00', self::rulesTz($game));
508
538
$placed = [];
509
539
foreach ($game['players'] as $i => &$p) {
510
540
$p['x'] = $pos[$i]['x'];
@@ -551,7 +581,7 @@ final class Engine
551
581
) {
552
582
$at = (int) $game['next_distribution_at'];
553
583
$game = self::distributeOneDay($game, $at);
554
$game['next_distribution_at'] = self::nextDistribution($at, $game['rules']['ap_time'] ?? '00:00');
584
$game['next_distribution_at'] = self::nextDistribution($at, $game['rules']['ap_time'] ?? '00:00', self::rulesTz($game));
555
585
$guard++;
556
586
}
557
587
return $game;
@@ -1523,7 +1553,7 @@ final class Engine
1523
1553
'messages' => $messages,
1524
1554
'legal' => $legal,
1525
1555
'you' => $viewerId,
1526
'timezone' => self::TZ,
1556
'timezone' => self::rulesTz($game),
1527
1557
'version' => (int) ($game['version'] ?? $game['event_seq'] ?? 0),
1528
1558
'server_now' => $now,
1529
1559
'ceasefire' => self::ceasefireInfo($game, $now),
@@ -1555,7 +1585,7 @@ final class Engine
1555
1585
&& $game['host_id'] === $viewerId
1556
1586
&& count($game['players']) >= self::MIN_PLAYERS,
1557
1587
'you' => $viewerId,
1558
'timezone' => self::TZ,
1588
'timezone' => self::rulesTz($game),
1559
1589
];
1560
1590
}
1561
1591
@@ -1643,9 +1673,9 @@ final class Engine
1643
1673
* Uses midnight + hours/minutes so DST spring-forward skips and
1644
1674
* fall-back uses PHP's first occurrence, then addition continues correctly.
1645
1675
*/
1646
public static function amsterdamWallclock(string $ymd, string $hm): int
1676
public static function amsterdamWallclock(string $ymd, string $hm, ?string $tzName = null): int
1647
1677
{
1648
$tz = new DateTimeZone(self::TZ);
1678
$tz = new DateTimeZone(self::validTz($tzName));
1649
1679
$dt = new DateTime($ymd . ' 00:00:00', $tz);
1650
1680
$mins = self::hmToMinutes($hm);
1651
1681
if ($mins > 0) {
@@ -1660,12 +1690,13 @@ final class Engine
1660
1690
*
1661
1691
* @return list<array{0:int,1:int}>
1662
1692
*/
1663
public static function ceasefireIntervals(array $ranges, int $now): array
1693
public static function ceasefireIntervals(array $ranges, int $now, ?string $tzName = null): array
1664
1694
{
1665
1695
if ($ranges === []) {
1666
1696
return [];
1667
1697
}
1668
$tz = new DateTimeZone(self::TZ);
1698
$tzName = self::validTz($tzName);
1699
$tz = new DateTimeZone($tzName);
1669
1700
$anchor = (new DateTime('@' . $now))->setTimezone($tz);
1670
1701
$intervals = [];
1671
1702
for ($d = -1; $d <= 3; $d++) {
@@ -1675,12 +1706,12 @@ final class Engine
1675
1706
foreach ($ranges as $r) {
1676
1707
$startM = self::hmToMinutes($r['start']);
1677
1708
$endM = self::hmToMinutes($r['end']);
1678
$startTs = self::amsterdamWallclock($ymd, $r['start']);
1709
$startTs = self::amsterdamWallclock($ymd, $r['start'], $tzName);
1679
1710
if ($endM > $startM) {
1680
$endTs = self::amsterdamWallclock($ymd, $r['end']);
1711
$endTs = self::amsterdamWallclock($ymd, $r['end'], $tzName);
1681
1712
} else {
1682
1713
// Wraps midnight: ends on the next calendar day.
1683
$endTs = self::amsterdamWallclock($next, $r['end']);
1714
$endTs = self::amsterdamWallclock($next, $r['end'], $tzName);
1684
1715
}
1685
1716
if ($endTs > $startTs) {
1686
1717
$intervals[] = [$startTs, $endTs];
@@ -1722,7 +1753,7 @@ final class Engine
1722
1753
if ($ranges === []) {
1723
1754
return null;
1724
1755
}
1725
$intervals = self::ceasefireIntervals($ranges, $now);
1756
$intervals = self::ceasefireIntervals($ranges, $now, self::rulesTz($game));
1726
1757
$active = false;
1727
1758
$until = null;
1728
1759
foreach ($intervals as $iv) {
@@ -66,6 +66,7 @@ final class Engine66
'ceasefire_ranges' => [],66
'ceasefire_ranges' => [],67
'ap_loot' => false,67
'ap_loot' => false,68
'ap_time' => '00:00',68
'ap_time' => '00:00',69
'tz' => self::TZ,69
'vis_shots' => 'public',70
'vis_shots' => 'public',70
'vis_gifts' => 'public',71
'vis_gifts' => 'public',71
'vis_ap' => 'public',72
'vis_ap' => 'public',@@ -94,6 +95,7 @@ final class Engine94
$d['ap_loot'] = self::asBool($raw['ap_loot'] ?? false);95
$d['ap_loot'] = self::asBool($raw['ap_loot'] ?? false);95
$hm = self::parseHm($raw['ap_time'] ?? '00:00');96
$hm = self::parseHm($raw['ap_time'] ?? '00:00');96
$d['ap_time'] = $hm ?? '00:00';97
$d['ap_time'] = $hm ?? '00:00';98
$d['tz'] = self::validTz($raw['tz'] ?? null);97
$d['vis_shots'] = self::visChoice($raw['vis_shots'] ?? null, self::VIS_SHOTS, 'public');99
$d['vis_shots'] = self::visChoice($raw['vis_shots'] ?? null, self::VIS_SHOTS, 'public');98
$d['vis_gifts'] = self::visChoice($raw['vis_gifts'] ?? null, self::VIS_GIFTS, 'public');100
$d['vis_gifts'] = self::visChoice($raw['vis_gifts'] ?? null, self::VIS_GIFTS, 'public');99
$d['vis_ap'] = self::visChoice($raw['vis_ap'] ?? null, self::VIS_AP, 'public');101
$d['vis_ap'] = self::visChoice($raw['vis_ap'] ?? null, self::VIS_AP, 'public');@@ -271,16 +273,44 @@ final class Engine271
}273
}272
274
273
/**275
/**274
* Next occurrence of a Europe/Amsterdam wall-clock time strictly after $from.276
* The host's IANA time zone for ap_time and cease-fire ranges.277
* Unknown or missing values fall back to Europe/Amsterdam.278
*/279
public static function validTz(mixed $tz): string280
{281
if (!is_string($tz) || $tz === '' || strlen($tz) > 64) {282
return self::TZ;283
}284
try {285
$z = new DateTimeZone($tz);286
} catch (Throwable $e) {287
return self::TZ;288
}289
$name = $z->getName();290
// Only named zones (no raw offsets like +02:00): those carry DST rules.291
if (!in_array($name, DateTimeZone::listIdentifiers(), true) && $name !== 'UTC') {292
return self::TZ;293
}294
return $name;295
}296
297
/** Rules' time zone (host's zone at the time of the last rules edit). */298
public static function rulesTz(array $game): string299
{300
return self::validTz(($game['rules'] ?? [])['tz'] ?? null);301
}302
303
/**304
* Next occurrence of a wall-clock time in $tz (default Europe/Amsterdam) strictly after $from.275
* Used for the per-lobby daily AP time (default 00:00).305
* Used for the per-lobby daily AP time (default 00:00).276
* If that clock time is skipped by a spring-forward DST gap, PHP's306
* If that clock time is skipped by a spring-forward DST gap, PHP's277
* DateTime::setTime lands on the first valid instant after the gap.307
* DateTime::setTime lands on the first valid instant after the gap.278
*/308
*/279
public static function nextDistribution(int $from, ?string $hm = null): int309
public static function nextDistribution(int $from, ?string $hm = null, ?string $tzName = null): int280
{310
{281
$hm = self::parseHm($hm ?? '00:00') ?? '00:00';311
$hm = self::parseHm($hm ?? '00:00') ?? '00:00';282
[$h, $min] = array_map('intval', explode(':', $hm));312
[$h, $min] = array_map('intval', explode(':', $hm));283
$tz = new DateTimeZone(self::TZ);313
$tz = new DateTimeZone(self::validTz($tzName));284
$dt = (new DateTime('@' . $from))->setTimezone($tz);314
$dt = (new DateTime('@' . $from))->setTimezone($tz);285
$candidate = clone $dt;315
$candidate = clone $dt;286
$candidate->setTime($h, $min, 0);316
$candidate->setTime($h, $min, 0);@@ -504,7 +534,7 @@ final class Engine504
$game['started_at'] = $now;534
$game['started_at'] = $now;505
$game['day'] = 0;535
$game['day'] = 0;506
$game['arena_inset'] = 0;536
$game['arena_inset'] = 0;507
$game['next_distribution_at'] = self::nextDistribution($now, $game['rules']['ap_time'] ?? '00:00');537
$game['next_distribution_at'] = self::nextDistribution($now, $game['rules']['ap_time'] ?? '00:00', self::rulesTz($game));508
$placed = [];538
$placed = [];509
foreach ($game['players'] as $i => &$p) {539
foreach ($game['players'] as $i => &$p) {510
$p['x'] = $pos[$i]['x'];540
$p['x'] = $pos[$i]['x'];@@ -551,7 +581,7 @@ final class Engine551
) {581
) {552
$at = (int) $game['next_distribution_at'];582
$at = (int) $game['next_distribution_at'];553
$game = self::distributeOneDay($game, $at);583
$game = self::distributeOneDay($game, $at);554
$game['next_distribution_at'] = self::nextDistribution($at, $game['rules']['ap_time'] ?? '00:00');584
$game['next_distribution_at'] = self::nextDistribution($at, $game['rules']['ap_time'] ?? '00:00', self::rulesTz($game));555
$guard++;585
$guard++;556
}586
}557
return $game;587
return $game;@@ -1523,7 +1553,7 @@ final class Engine1523
'messages' => $messages,1553
'messages' => $messages,1524
'legal' => $legal,1554
'legal' => $legal,1525
'you' => $viewerId,1555
'you' => $viewerId,1526
'timezone' => self::TZ,1556
'timezone' => self::rulesTz($game),1527
'version' => (int) ($game['version'] ?? $game['event_seq'] ?? 0),1557
'version' => (int) ($game['version'] ?? $game['event_seq'] ?? 0),1528
'server_now' => $now,1558
'server_now' => $now,1529
'ceasefire' => self::ceasefireInfo($game, $now),1559
'ceasefire' => self::ceasefireInfo($game, $now),@@ -1555,7 +1585,7 @@ final class Engine1555
&& $game['host_id'] === $viewerId1585
&& $game['host_id'] === $viewerId1556
&& count($game['players']) >= self::MIN_PLAYERS,1586
&& count($game['players']) >= self::MIN_PLAYERS,1557
'you' => $viewerId,1587
'you' => $viewerId,1558
'timezone' => self::TZ,1588
'timezone' => self::rulesTz($game),1559
];1589
];1560
}1590
}1561
1591
@@ -1643,9 +1673,9 @@ final class Engine1643
* Uses midnight + hours/minutes so DST spring-forward skips and1673
* Uses midnight + hours/minutes so DST spring-forward skips and1644
* fall-back uses PHP's first occurrence, then addition continues correctly.1674
* fall-back uses PHP's first occurrence, then addition continues correctly.1645
*/1675
*/1646
public static function amsterdamWallclock(string $ymd, string $hm): int1676
public static function amsterdamWallclock(string $ymd, string $hm, ?string $tzName = null): int1647
{1677
{1648
$tz = new DateTimeZone(self::TZ);1678
$tz = new DateTimeZone(self::validTz($tzName));1649
$dt = new DateTime($ymd . ' 00:00:00', $tz);1679
$dt = new DateTime($ymd . ' 00:00:00', $tz);1650
$mins = self::hmToMinutes($hm);1680
$mins = self::hmToMinutes($hm);1651
if ($mins > 0) {1681
if ($mins > 0) {@@ -1660,12 +1690,13 @@ final class Engine1660
*1690
*1661
* @return list<array{0:int,1:int}>1691
* @return list<array{0:int,1:int}>1662
*/1692
*/1663
public static function ceasefireIntervals(array $ranges, int $now): array1693
public static function ceasefireIntervals(array $ranges, int $now, ?string $tzName = null): array1664
{1694
{1665
if ($ranges === []) {1695
if ($ranges === []) {1666
return [];1696
return [];1667
}1697
}1668
$tz = new DateTimeZone(self::TZ);1698
$tzName = self::validTz($tzName);1699
$tz = new DateTimeZone($tzName);1669
$anchor = (new DateTime('@' . $now))->setTimezone($tz);1700
$anchor = (new DateTime('@' . $now))->setTimezone($tz);1670
$intervals = [];1701
$intervals = [];1671
for ($d = -1; $d <= 3; $d++) {1702
for ($d = -1; $d <= 3; $d++) {@@ -1675,12 +1706,12 @@ final class Engine1675
foreach ($ranges as $r) {1706
foreach ($ranges as $r) {1676
$startM = self::hmToMinutes($r['start']);1707
$startM = self::hmToMinutes($r['start']);1677
$endM = self::hmToMinutes($r['end']);1708
$endM = self::hmToMinutes($r['end']);1678
$startTs = self::amsterdamWallclock($ymd, $r['start']);1709
$startTs = self::amsterdamWallclock($ymd, $r['start'], $tzName);1679
if ($endM > $startM) {1710
if ($endM > $startM) {1680
$endTs = self::amsterdamWallclock($ymd, $r['end']);1711
$endTs = self::amsterdamWallclock($ymd, $r['end'], $tzName);1681
} else {1712
} else {1682
// Wraps midnight: ends on the next calendar day.1713
// Wraps midnight: ends on the next calendar day.1683
$endTs = self::amsterdamWallclock($next, $r['end']);1714
$endTs = self::amsterdamWallclock($next, $r['end'], $tzName);1684
}1715
}1685
if ($endTs > $startTs) {1716
if ($endTs > $startTs) {1686
$intervals[] = [$startTs, $endTs];1717
$intervals[] = [$startTs, $endTs];@@ -1722,7 +1753,7 @@ final class Engine1722
if ($ranges === []) {1753
if ($ranges === []) {1723
return null;1754
return null;1724
}1755
}1725
$intervals = self::ceasefireIntervals($ranges, $now);1756
$intervals = self::ceasefireIntervals($ranges, $now, self::rulesTz($game));1726
$active = false;1757
$active = false;1727
$until = null;1758
$until = null;1728
foreach ($intervals as $iv) {1759
foreach ($intervals as $iv) {@@ -359,3 +359,13 @@ function startAlliantiesSession(): void
359
359
if (!defined('ALLIANTIES_NO_SESSION')) {
360
360
startAlliantiesSession();
361
361
}
362
363
/** HTTP status for a stable API error code. not_host → 403 (only the host may change rules or start). */
364
function apiHttpStatus(string $code): int
365
{
366
return match ($code) {
367
'login' => 401,
368
'not_in_game', 'not_host', 'csrf' => 403,
369
default => 400,
370
};
371
}
@@ -359,3 +359,13 @@ function startAlliantiesSession(): void359
if (!defined('ALLIANTIES_NO_SESSION')) {359
if (!defined('ALLIANTIES_NO_SESSION')) {360
startAlliantiesSession();360
startAlliantiesSession();361
}361
}362
363
/** HTTP status for a stable API error code. not_host → 403 (only the host may change rules or start). */364
function apiHttpStatus(string $code): int365
{366
return match ($code) {367
'login' => 401,368
'not_in_game', 'not_host', 'csrf' => 403,369
default => 400,370
};371
}@@ -14,7 +14,7 @@
14
14
"locales": {
15
15
"en": {
16
16
"app.name": "Allianties",
17
"menu.tagline": "A game of patience, alliances and well-timed shots.",
17
"menu.tagline": "A game of patience, paranoia and well-timed betrayal.",
18
18
"menu.login": "Log in",
19
19
"menu.logout": "Log out",
20
20
"menu.loggedInAs": "Logged in as",
@@ -56,17 +56,17 @@
56
56
"lobby.shrinkDays": "Days between shrinks",
57
57
"lobby.shrinkDaysHint": "First shrink after this many midnights, then again each time that many days pass, until the arena reaches its minimum size.",
58
58
"lobby.ceasefire": "Forced cease-fire hours",
59
"lobby.ceasefireHint": "During these hours (Europe/Amsterdam) no one may shoot. Moving, giving action points and upgrading range remain allowed. Periods may wrap around midnight.",
59
"lobby.ceasefireHint": "During these hours (your local time) no one may shoot. Moving, giving action points and upgrading range remain allowed. Periods may wrap around midnight.",
60
60
"lobby.ceasefireAdd": "Add period",
61
61
"lobby.ceasefireRemove": "Remove",
62
62
"lobby.ceasefireStart": "From",
63
63
"lobby.ceasefireEnd": "Until",
64
64
"lobby.ceasefireEmpty": "No periods yet. Add one, or drag a slice on the clock.",
65
"lobby.ceasefireClock": "24-hour clock. Drag the handles or paint a slice; red is cease-fire, gold is open fire. Times are Europe/Amsterdam.",
65
"lobby.ceasefireClock": "24-hour clock. Drag the handles or paint a slice; red is cease-fire, gold is open fire. Times are your local time.",
66
66
"lobby.apLoot": "Loot action points on a kill",
67
67
"lobby.apLootHint": "When you eliminate a player with a shot, you receive their remaining action points. Surrender and the shrinking arena do not transfer points. Off by default.",
68
68
"lobby.apTime": "Daily action points at",
69
"lobby.apTimeHint": "Europe/Amsterdam. Action points, jury awards and arena shrinks all happen at this time each day. Default 00:00.",
69
"lobby.apTimeHint": "Action points, jury awards and arena shrinks all happen at this time each day. Default 00:00.",
70
70
"lobby.visibility": "Visibility",
71
71
"lobby.visibilityHint": "Who can see what. You always see your own lives, action points and range. Movement is always public. The server hides everything else from each viewer; hidden events do not appear on the timeline at all.",
72
72
"lobby.visShots": "Shots",
@@ -212,11 +212,13 @@
212
212
"lobby.grid": "Board size",
213
213
"lobby.gridHint": "Suggested size for {n} players: {size}×{size}. Updates as people join, unless you set a size yourself.",
214
214
"lobby.gridUseSuggested": "Use suggested size",
215
"error.bad_grid": "That board size cannot fit this many players."
215
"error.bad_grid": "That board size cannot fit this many players.",
216
"lobby.rulesHostOnly": "Only the host can change the rules.",
217
"time.local": "local time · {tz}"
216
218
},
217
219
"nl": {
218
220
"app.name": "Allianties",
219
"menu.tagline": "Een spel van geduld, allianties en goed getimede schoten.",
221
"menu.tagline": "Een spel van geduld, paranoia en goed getimed verraad.",
220
222
"menu.login": "Inloggen",
221
223
"menu.logout": "Uitloggen",
222
224
"menu.loggedInAs": "Ingelogd als",
@@ -258,17 +260,17 @@
258
260
"lobby.shrinkDays": "Dagen tussen krimp",
259
261
"lobby.shrinkDaysHint": "De eerste krimp na dit aantal middernachten, daarna opnieuw telkens na evenveel dagen, tot het veld zijn minimumgrootte heeft.",
260
262
"lobby.ceasefire": "Gedwongen staakt-het-vuren",
261
"lobby.ceasefireHint": "In deze uren (Europe/Amsterdam) mag niemand schieten. Verplaatsen, actiepunten geven en bereik upgraden blijft toegestaan. Periodes mogen over middernacht lopen.",
263
"lobby.ceasefireHint": "In deze uren (je lokale tijd) mag niemand schieten. Verplaatsen, actiepunten geven en bereik upgraden blijft toegestaan. Periodes mogen over middernacht lopen.",
262
264
"lobby.ceasefireAdd": "Periode toevoegen",
263
265
"lobby.ceasefireRemove": "Verwijderen",
264
266
"lobby.ceasefireStart": "Van",
265
267
"lobby.ceasefireEnd": "Tot",
266
268
"lobby.ceasefireEmpty": "Nog geen periodes. Voeg er een toe, of sleep een stuk op de klok.",
267
"lobby.ceasefireClock": "24-uursklok. Sleep de handvatten of teken een stuk; rood is staakt-het-vuren, goud is vrij schieten. Tijden zijn Europe/Amsterdam.",
269
"lobby.ceasefireClock": "24-uursklok. Sleep de handvatten of teken een stuk; rood is staakt-het-vuren, goud is vrij schieten. Tijden zijn je lokale tijd.",
268
270
"lobby.apLoot": "Actiepunten plunderen bij een kill",
269
271
"lobby.apLootHint": "Als je een speler uitschakelt met een schot, ontvang je diens resterende actiepunten. Overgave en het krimpende speelveld geven geen punten. Standaard uit.",
270
272
"lobby.apTime": "Dagelijkse actiepunten om",
271
"lobby.apTimeHint": "Europe/Amsterdam. Actiepunten, jurybonussen en het krimpen van het veld gebeuren elke dag op dit tijdstip. Standaard 00:00.",
273
"lobby.apTimeHint": "Actiepunten, jurybonussen en het krimpen van het veld gebeuren elke dag op dit tijdstip. Standaard 00:00.",
272
274
"lobby.visibility": "Zichtbaarheid",
273
275
"lobby.visibilityHint": "Wie wat kan zien. Je ziet altijd je eigen levens, actiepunten en bereik. Verplaatsingen zijn altijd openbaar. De server verbergt de rest per kijker; verborgen gebeurtenissen verschijnen helemaal niet op de tijdlijn.",
274
276
"lobby.visShots": "Schoten",
@@ -414,11 +416,13 @@
414
416
"lobby.grid": "Bordgrootte",
415
417
"lobby.gridHint": "Voorgestelde grootte voor {n} spelers: {size}×{size}. Wordt bijgewerkt als er spelers bijkomen, tenzij je zelf een maat kiest.",
416
418
"lobby.gridUseSuggested": "Gebruik de voorgestelde grootte",
417
"error.bad_grid": "Die bordgrootte past niet bij dit aantal spelers."
419
"error.bad_grid": "Die bordgrootte past niet bij dit aantal spelers.",
420
"lobby.rulesHostOnly": "Alleen de host kan de spelregels aanpassen.",
421
"time.local": "lokale tijd · {tz}"
418
422
},
419
423
"de": {
420
424
"app.name": "Allianties",
421
"menu.tagline": "Ein Spiel aus Geduld, Allianzen und gut getimten Schüssen.",
425
"menu.tagline": "Ein Spiel aus Geduld, Paranoia und gut getimtem Verrat.",
422
426
"menu.login": "Anmelden",
423
427
"menu.logout": "Abmelden",
424
428
"menu.loggedInAs": "Angemeldet als",
@@ -460,17 +464,17 @@
460
464
"lobby.shrinkDays": "Tage zwischen Schrumpfungen",
461
465
"lobby.shrinkDaysHint": "Erste Schrumpfung nach so vielen Mitternächten, danach erneut nach jeweils ebenso vielen Tagen, bis das Feld seine Mindestgröße erreicht.",
462
466
"lobby.ceasefire": "Erzwungene Waffenruhe",
463
"lobby.ceasefireHint": "In diesen Stunden (Europe/Amsterdam) darf niemand schießen. Bewegen, Aktionspunkte abgeben und die Reichweite erhöhen bleiben erlaubt. Zeiträume dürfen über Mitternacht gehen.",
467
"lobby.ceasefireHint": "In diesen Stunden (deine Ortszeit) darf niemand schießen. Bewegen, Aktionspunkte abgeben und die Reichweite erhöhen bleiben erlaubt. Zeiträume dürfen über Mitternacht gehen.",
464
468
"lobby.ceasefireAdd": "Zeitraum hinzufügen",
465
469
"lobby.ceasefireRemove": "Entfernen",
466
470
"lobby.ceasefireStart": "Von",
467
471
"lobby.ceasefireEnd": "Bis",
468
472
"lobby.ceasefireEmpty": "Noch keine Zeiträume. Füge einen hinzu oder ziehe ein Segment auf der Uhr.",
469
"lobby.ceasefireClock": "24-Stunden-Uhr. Ziehe die Griffe oder male ein Segment; rot ist Waffenruhe, gold ist Feuer frei. Zeiten sind Europe/Amsterdam.",
473
"lobby.ceasefireClock": "24-Stunden-Uhr. Ziehe die Griffe oder male ein Segment; rot ist Waffenruhe, gold ist Feuer frei. Zeiten sind deine Ortszeit.",
470
474
"lobby.apLoot": "Aktionspunkte bei einem Kill erbeuten",
471
475
"lobby.apLootHint": "Wenn du einen Spieler mit einem Schuss ausschaltest, erhältst du dessen verbleibende Aktionspunkte. Aufgabe und das schrumpfende Feld übertragen keine Punkte. Standardmäßig aus.",
472
476
"lobby.apTime": "Tägliche Aktionspunkte um",
473
"lobby.apTimeHint": "Europe/Amsterdam. Aktionspunkte, Jury-Boni und das Schrumpfen des Feldes finden jeden Tag zu dieser Uhrzeit statt. Standard 00:00.",
477
"lobby.apTimeHint": "Aktionspunkte, Jury-Boni und das Schrumpfen des Feldes finden jeden Tag zu dieser Uhrzeit statt. Standard 00:00.",
474
478
"lobby.visibility": "Sichtbarkeit",
475
479
"lobby.visibilityHint": "Wer was sehen kann. Du siehst immer deine eigenen Leben, Aktionspunkte und Reichweite. Bewegungen sind immer öffentlich. Der Server blendet alles andere je Betrachter aus; versteckte Ereignisse erscheinen gar nicht auf der Zeitleiste.",
476
480
"lobby.visShots": "Schüsse",
@@ -616,11 +620,13 @@
616
620
"lobby.grid": "Brettgröße",
617
621
"lobby.gridHint": "Vorgeschlagene Größe für {n} Spieler: {size}×{size}. Wird angepasst, wenn Spieler beitreten, es sei denn, du wählst selbst eine Größe.",
618
622
"lobby.gridUseSuggested": "Vorgeschlagene Größe verwenden",
619
"error.bad_grid": "Diese Brettgröße reicht für so viele Spieler nicht aus."
623
"error.bad_grid": "Diese Brettgröße reicht für so viele Spieler nicht aus.",
624
"lobby.rulesHostOnly": "Nur der Host kann die Regeln ändern.",
625
"time.local": "Ortszeit · {tz}"
620
626
},
621
627
"fr": {
622
628
"app.name": "Allianties",
623
"menu.tagline": "Un jeu de patience, d'alliances et de tirs bien calculés.",
629
"menu.tagline": "Un jeu de patience, de paranoïa et de trahisons bien calculées.",
624
630
"menu.login": "Connexion",
625
631
"menu.logout": "Déconnexion",
626
632
"menu.loggedInAs": "Connecté en tant que",
@@ -662,17 +668,17 @@
662
668
"lobby.shrinkDays": "Jours entre les rétrécissements",
663
669
"lobby.shrinkDaysHint": "Premier rétrécissement après autant de minuits, puis de nouveau tous les autant de jours, jusqu'à la taille minimale de l'arène.",
664
670
"lobby.ceasefire": "Heures de cessez-le-feu forcé",
665
"lobby.ceasefireHint": "Pendant ces heures (Europe/Amsterdam), personne ne peut tirer. Se déplacer, donner des points d'action et améliorer la portée restent autorisés. Les plages peuvent chevaucher minuit.",
671
"lobby.ceasefireHint": "Pendant ces heures (votre heure locale), personne ne peut tirer. Se déplacer, donner des points d'action et améliorer la portée restent autorisés. Les plages peuvent chevaucher minuit.",
666
672
"lobby.ceasefireAdd": "Ajouter une plage",
667
673
"lobby.ceasefireRemove": "Supprimer",
668
674
"lobby.ceasefireStart": "De",
669
675
"lobby.ceasefireEnd": "À",
670
676
"lobby.ceasefireEmpty": "Aucune plage pour l'instant. Ajoutez-en une, ou dessinez un secteur sur l'horloge.",
671
"lobby.ceasefireClock": "Horloge 24 heures. Faites glisser les poignées ou dessinez un secteur ; le rouge est le cessez-le-feu, l'or le feu autorisé. Heures en Europe/Amsterdam.",
677
"lobby.ceasefireClock": "Horloge 24 heures. Faites glisser les poignées ou dessinez un secteur ; le rouge est le cessez-le-feu, l'or le feu autorisé. Heures en votre heure locale.",
672
678
"lobby.apLoot": "Prendre les points d’action lors d’une élimination",
673
679
"lobby.apLootHint": "Lorsque vous éliminez un joueur par un tir, vous recevez ses points d’action restants. Abandon et arène qui rétrécit ne transfèrent rien. Désactivé par défaut.",
674
680
"lobby.apTime": "Points d’action quotidiens à",
675
"lobby.apTimeHint": "Europe/Amsterdam. Les points d’action, les bonus du jury et le rétrécissement ont lieu chaque jour à cette heure. 00:00 par défaut.",
681
"lobby.apTimeHint": "Les points d’action, les bonus du jury et le rétrécissement ont lieu chaque jour à cette heure. 00:00 par défaut.",
676
682
"lobby.visibility": "Visibilité",
677
683
"lobby.visibilityHint": "Qui voit quoi. Vous voyez toujours vos propres vies, points d’action et portée. Les déplacements sont toujours publics. Le serveur masque le reste pour chaque spectateur ; les événements cachés n’apparaissent pas du tout sur la timeline.",
678
684
"lobby.visShots": "Tirs",
@@ -818,11 +824,13 @@
818
824
"lobby.grid": "Taille du plateau",
819
825
"lobby.gridHint": "Taille suggérée pour {n} joueurs : {size}×{size}. Elle est mise à jour quand des joueurs rejoignent, sauf si vous choisissez une taille vous-même.",
820
826
"lobby.gridUseSuggested": "Utiliser la taille suggérée",
821
"error.bad_grid": "Cette taille de plateau ne peut pas accueillir autant de joueurs."
827
"error.bad_grid": "Cette taille de plateau ne peut pas accueillir autant de joueurs.",
828
"lobby.rulesHostOnly": "Seul l'hôte peut modifier les règles.",
829
"time.local": "heure locale · {tz}"
822
830
},
823
831
"ja": {
824
832
"app.name": "Allianties",
825
"menu.tagline": "忍耐、同盟、そして時機を逃さない一撃のゲーム。",
833
"menu.tagline": "忍耐と疑心暗鬼、そして絶妙なタイミングの裏切りのゲーム。",
826
834
"menu.login": "ログイン",
827
835
"menu.logout": "ログアウト",
828
836
"menu.loggedInAs": "ログイン中",
@@ -864,17 +872,17 @@
864
872
"lobby.shrinkDays": "縮小の間隔(日)",
865
873
"lobby.shrinkDaysHint": "最初の縮小はこの回数の深夜のあと、その後同じ日数ごとに繰り返し、戦場が最小サイズになるまで続きます。",
866
874
"lobby.ceasefire": "強制停戦時間",
867
"lobby.ceasefireHint": "この時間帯(Europe/Amsterdam)は誰も撃てません。移動、行動力の譲渡、射程の強化は可能です。時間帯は深夜をまたげます。",
875
"lobby.ceasefireHint": "この時間帯(現地時刻)は誰も撃てません。移動、行動力の譲渡、射程の強化は可能です。時間帯は深夜をまたげます。",
868
876
"lobby.ceasefireAdd": "時間帯を追加",
869
877
"lobby.ceasefireRemove": "削除",
870
878
"lobby.ceasefireStart": "開始",
871
879
"lobby.ceasefireEnd": "終了",
872
880
"lobby.ceasefireEmpty": "まだ時間帯がありません。追加するか、時計の上で扇形をドラッグしてください。",
873
"lobby.ceasefireClock": "24時間時計。ハンドルをドラッグするか扇形を描きます。赤は停戦、金は攻撃可能。時刻は Europe/Amsterdam です。",
881
"lobby.ceasefireClock": "24時間時計。ハンドルをドラッグするか扇形を描きます。赤は停戦、金は攻撃可能。時刻は現地時刻です。",
874
882
"lobby.apLoot": "倒した相手のアクションポイントを奪う",
875
883
"lobby.apLootHint": "射撃で相手を倒すと、残っていたアクションポイントを得ます。投降や縮小する戦場では移りません。既定はオフです。",
876
884
"lobby.apTime": "毎日のアクションポイント配布時刻",
877
"lobby.apTimeHint": "Europe/Amsterdam。アクションポイント、陪審のボーナス、戦場の縮小は毎日この時刻に行われます。既定は 00:00 です。",
885
"lobby.apTimeHint": "アクションポイント、陪審のボーナス、戦場の縮小は毎日この時刻に行われます。既定は 00:00 です。",
878
886
"lobby.visibility": "公開範囲",
879
887
"lobby.visibilityHint": "誰が何を見られるか。自分のライフ、アクションポイント、射程は常に見えます。移動は常に公開です。サーバーが閲覧者ごとにそれ以外を隠し、隠された出来事はタイムラインに一切表示されません。",
880
888
"lobby.visShots": "射撃",
@@ -1020,11 +1028,13 @@
1020
1028
"lobby.grid": "盤の大きさ",
1021
1029
"lobby.gridHint": "{n}人での推奨サイズは {size}×{size}。自分でサイズを決めていない限り、参加者が増えると更新されます。",
1022
1030
"lobby.gridUseSuggested": "推奨サイズを使う",
1023
"error.bad_grid": "その盤の大きさではこの人数を置けません。"
1031
"error.bad_grid": "その盤の大きさではこの人数を置けません。",
1032
"lobby.rulesHostOnly": "ルールを変更できるのはホストだけです。",
1033
"time.local": "現地時刻 · {tz}"
1024
1034
},
1025
1035
"zh": {
1026
1036
"app.name": "Allianties",
1027
"menu.tagline": "一场关于耐心、同盟与精准开火的游戏。",
1037
"menu.tagline": "一场关于耐心、猜疑与适时背叛的游戏。",
1028
1038
"menu.login": "登录",
1029
1039
"menu.logout": "退出登录",
1030
1040
"menu.loggedInAs": "已登录为",
@@ -1066,17 +1076,17 @@
1066
1076
"lobby.shrinkDays": "两次缩小间隔天数",
1067
1077
"lobby.shrinkDaysHint": "第一次缩小发生在这么多个午夜之后,之后每隔同样天数再缩小,直到战场达到最小尺寸。",
1068
1078
"lobby.ceasefire": "强制停火时段",
1069
"lobby.ceasefireHint": "在这些时段(Europe/Amsterdam)任何人不得射击。移动、给予行动点和提升射程仍然允许。时段可以跨越午夜。",
1079
"lobby.ceasefireHint": "在这些时段(你的本地时间)任何人不得射击。移动、给予行动点和提升射程仍然允许。时段可以跨越午夜。",
1070
1080
"lobby.ceasefireAdd": "添加时段",
1071
1081
"lobby.ceasefireRemove": "删除",
1072
1082
"lobby.ceasefireStart": "从",
1073
1083
"lobby.ceasefireEnd": "至",
1074
1084
"lobby.ceasefireEmpty": "还没有时段。请添加一个,或在时钟上拖出一段扇形。",
1075
"lobby.ceasefireClock": "24 小时时钟。拖动手柄或画出扇形;红色为停火,金色为可开火。时间为 Europe/Amsterdam。",
1085
"lobby.ceasefireClock": "24 小时时钟。拖动手柄或画出扇形;红色为停火,金色为可开火。时间为你的本地时间。",
1076
1086
"lobby.apLoot": "击杀时夺取行动点",
1077
1087
"lobby.apLootHint": "用射击淘汰玩家时,你会获得其剩余行动点。投降和缩小场地不会转移点数。默认关闭。",
1078
1088
"lobby.apTime": "每日行动点发放时间",
1079
"lobby.apTimeHint": "Europe/Amsterdam。行动点、陪审团奖励和场地缩小每天都在此时发生。默认 00:00。",
1089
"lobby.apTimeHint": "行动点、陪审团奖励和场地缩小每天都在此时发生。默认 00:00。",
1080
1090
"lobby.visibility": "可见性",
1081
1091
"lobby.visibilityHint": "谁能看到什么。你始终能看到自己的生命、行动点和射程。移动始终公开。服务器会按观看者隐藏其余信息;被隐藏的事件完全不会出现在时间轴上。",
1082
1092
"lobby.visShots": "射击",
@@ -1222,11 +1232,13 @@
1222
1232
"lobby.grid": "棋盘大小",
1223
1233
"lobby.gridHint": "{n} 名玩家的建议大小为 {size}×{size}。除非你自己设定了大小,否则会随加入人数更新。",
1224
1234
"lobby.gridUseSuggested": "使用建议大小",
1225
"error.bad_grid": "该棋盘大小无法容纳这么多玩家。"
1235
"error.bad_grid": "该棋盘大小无法容纳这么多玩家。",
1236
"lobby.rulesHostOnly": "只有房主可以修改规则。",
1237
"time.local": "本地时间 · {tz}"
1226
1238
},
1227
1239
"ko": {
1228
1240
"app.name": "Allianties",
1229
"menu.tagline": "인내와 동맹, 그리고 때를 놓치지 않는 사격의 게임.",
1241
"menu.tagline": "인내와 편집증, 그리고 절묘한 타이밍의 배신에 관한 게임.",
1230
1242
"menu.login": "로그인",
1231
1243
"menu.logout": "로그아웃",
1232
1244
"menu.loggedInAs": "로그인됨",
@@ -1268,17 +1280,17 @@
1268
1280
"lobby.shrinkDays": "축소 간격(일)",
1269
1281
"lobby.shrinkDaysHint": "첫 축소는 그 횟수만큼의 자정이 지난 뒤, 이후 같은 일수마다 반복되며 전장이 최소 크기에 이를 때까지 계속됩니다.",
1270
1282
"lobby.ceasefire": "강제 휴전 시간",
1271
"lobby.ceasefireHint": "이 시간대(Europe/Amsterdam)에는 아무도 발사할 수 없습니다. 이동, 행동력 전달, 사거리 강화는 가능합니다. 구간은 자정을 넘길 수 있습니다.",
1283
"lobby.ceasefireHint": "이 시간대(현지 시간)에는 아무도 발사할 수 없습니다. 이동, 행동력 전달, 사거리 강화는 가능합니다. 구간은 자정을 넘길 수 있습니다.",
1272
1284
"lobby.ceasefireAdd": "구간 추가",
1273
1285
"lobby.ceasefireRemove": "삭제",
1274
1286
"lobby.ceasefireStart": "시작",
1275
1287
"lobby.ceasefireEnd": "종료",
1276
1288
"lobby.ceasefireEmpty": "아직 구간이 없습니다. 하나를 추가하거나 시계에서 부채꼴을 드래그하세요.",
1277
"lobby.ceasefireClock": "24시간 시계. 핸들을 드래그하거나 부채꼴을 그리세요. 빨강은 휴전, 금색은 사격 가능. 시각은 Europe/Amsterdam입니다.",
1289
"lobby.ceasefireClock": "24시간 시계. 핸들을 드래그하거나 부채꼴을 그리세요. 빨강은 휴전, 금색은 사격 가능. 시각은 현지 시간입니다.",
1278
1290
"lobby.apLoot": "처치 시 행동력 탈취",
1279
1291
"lobby.apLootHint": "사격으로 플레이어를 처치하면 남은 행동력을 받습니다. 항복과 축소되는 전장에서는 이전되지 않습니다. 기본값은 꺼짐입니다.",
1280
1292
"lobby.apTime": "매일 행동력 지급 시각",
1281
"lobby.apTimeHint": "Europe/Amsterdam. 행동력, 배심 보너스, 전장 축소가 매일 이 시각에 일어납니다. 기본값은 00:00입니다.",
1293
"lobby.apTimeHint": "행동력, 배심 보너스, 전장 축소가 매일 이 시각에 일어납니다. 기본값은 00:00입니다.",
1282
1294
"lobby.visibility": "공개 범위",
1283
1295
"lobby.visibilityHint": "누가 무엇을 볼 수 있는지. 자신의 생명, 행동력, 사거리는 항상 보입니다. 이동은 항상 공개됩니다. 서버가 보는 사람마다 나머지를 숨기며, 숨겨진 사건은 타임라인에 전혀 나타나지 않습니다.",
1284
1296
"lobby.visShots": "사격",
@@ -1424,11 +1436,13 @@
1424
1436
"lobby.grid": "보드 크기",
1425
1437
"lobby.gridHint": "{n}명일 때 권장 크기는 {size}×{size}입니다. 직접 크기를 정하지 않으면 참가자가 늘 때 업데이트됩니다.",
1426
1438
"lobby.gridUseSuggested": "권장 크기 사용",
1427
"error.bad_grid": "그 보드 크기에는 이 인원을 배치할 수 없습니다."
1439
"error.bad_grid": "그 보드 크기에는 이 인원을 배치할 수 없습니다.",
1440
"lobby.rulesHostOnly": "규칙은 호스트만 변경할 수 있습니다.",
1441
"time.local": "현지 시간 · {tz}"
1428
1442
},
1429
1443
"pl": {
1430
1444
"app.name": "Allianties",
1431
"menu.tagline": "Gra cierpliwości, sojuszy i dobrze wycelowanych strzałów.",
1445
"menu.tagline": "Gra cierpliwości, paranoi i dobrze wymierzonej zdrady.",
1432
1446
"menu.login": "Zaloguj się",
1433
1447
"menu.logout": "Wyloguj się",
1434
1448
"menu.loggedInAs": "Zalogowano jako",
@@ -1470,17 +1484,17 @@
1470
1484
"lobby.shrinkDays": "Dni między skurczeniami",
1471
1485
"lobby.shrinkDaysHint": "Pierwsze skurczenie po tylu północach, potem ponownie co tyle samo dni, aż arena osiągnie minimalny rozmiar.",
1472
1486
"lobby.ceasefire": "Wymuszone godziny zawieszenia broni",
1473
"lobby.ceasefireHint": "W tych godzinach (Europe/Amsterdam) nikt nie może strzelać. Ruch, przekazywanie punktów akcji i zwiększanie zasięgu pozostają dozwolone. Zakresy mogą przekraczać północ.",
1487
"lobby.ceasefireHint": "W tych godzinach (twój czas lokalny) nikt nie może strzelać. Ruch, przekazywanie punktów akcji i zwiększanie zasięgu pozostają dozwolone. Zakresy mogą przekraczać północ.",
1474
1488
"lobby.ceasefireAdd": "Dodaj okres",
1475
1489
"lobby.ceasefireRemove": "Usuń",
1476
1490
"lobby.ceasefireStart": "Od",
1477
1491
"lobby.ceasefireEnd": "Do",
1478
1492
"lobby.ceasefireEmpty": "Brak okresów. Dodaj jeden albo narysuj wycinek na zegarze.",
1479
"lobby.ceasefireClock": "Zegar 24-godzinny. Przeciągaj uchwyty lub maluj wycinek; czerwień to zawieszenie broni, złoto to dowolność strzału. Czas: Europe/Amsterdam.",
1493
"lobby.ceasefireClock": "Zegar 24-godzinny. Przeciągaj uchwyty lub maluj wycinek; czerwień to zawieszenie broni, złoto to dowolność strzału. Czas: twój czas lokalny.",
1480
1494
"lobby.apLoot": "Przejmowanie punktów akcji przy eliminacji",
1481
1495
"lobby.apLootHint": "Gdy wyeliminujesz gracza strzałem, otrzymujesz jego pozostałe punkty akcji. Poddanie się i kurczenie areny nie przekazują punktów. Domyślnie wyłączone.",
1482
1496
"lobby.apTime": "Codzienne punkty akcji o",
1483
"lobby.apTimeHint": "Europe/Amsterdam. Punkty akcji, nagrody jury i kurczenie areny odbywają się codziennie o tej godzinie. Domyślnie 00:00.",
1497
"lobby.apTimeHint": "Punkty akcji, nagrody jury i kurczenie areny odbywają się codziennie o tej godzinie. Domyślnie 00:00.",
1484
1498
"lobby.visibility": "Widoczność",
1485
1499
"lobby.visibilityHint": "Kto co widzi. Zawsze widzisz własne życia, punkty akcji i zasięg. Ruchy są zawsze publiczne. Serwer ukrywa resztę przed każdym widzem; ukryte zdarzenia w ogóle nie pojawiają się na osi czasu.",
1486
1500
"lobby.visShots": "Strzały",
@@ -1626,11 +1640,13 @@
1626
1640
"lobby.grid": "Rozmiar planszy",
1627
1641
"lobby.gridHint": "Sugerowany rozmiar dla {n} graczy: {size}×{size}. Aktualizuje się, gdy dołączają gracze, chyba że ustawisz rozmiar samodzielnie.",
1628
1642
"lobby.gridUseSuggested": "Użyj sugerowanego rozmiaru",
1629
"error.bad_grid": "Ten rozmiar planszy nie pomieści tylu graczy."
1643
"error.bad_grid": "Ten rozmiar planszy nie pomieści tylu graczy.",
1644
"lobby.rulesHostOnly": "Tylko gospodarz może zmieniać zasady.",
1645
"time.local": "czas lokalny · {tz}"
1630
1646
},
1631
1647
"ru": {
1632
1648
"app.name": "Allianties",
1633
"menu.tagline": "Игра в терпение, союзы и хорошо рассчитанные выстрелы.",
1649
"menu.tagline": "Игра терпения, паранойи и вовремя совершённого предательства.",
1634
1650
"menu.login": "Войти",
1635
1651
"menu.logout": "Выйти",
1636
1652
"menu.loggedInAs": "Вы вошли как",
@@ -1672,17 +1688,17 @@
1672
1688
"lobby.shrinkDays": "Дней между сжатиями",
1673
1689
"lobby.shrinkDaysHint": "Первое сжатие после стольких полуночей, затем снова через столько же дней, пока арена не достигнет минимального размера.",
1674
1690
"lobby.ceasefire": "Принудительное перемирие",
1675
"lobby.ceasefireHint": "В эти часы (Europe/Amsterdam) стрелять нельзя. Ходить, передавать очки действия и увеличивать дальность по-прежнему можно. Интервалы могут переходить через полночь.",
1691
"lobby.ceasefireHint": "В эти часы (ваше местное время) стрелять нельзя. Ходить, передавать очки действия и увеличивать дальность по-прежнему можно. Интервалы могут переходить через полночь.",
1676
1692
"lobby.ceasefireAdd": "Добавить период",
1677
1693
"lobby.ceasefireRemove": "Удалить",
1678
1694
"lobby.ceasefireStart": "С",
1679
1695
"lobby.ceasefireEnd": "До",
1680
1696
"lobby.ceasefireEmpty": "Периодов пока нет. Добавьте один или нарисуйте сектор на часах.",
1681
"lobby.ceasefireClock": "24-часовые часы. Перетаскивайте ручки или рисуйте сектор; красный — перемирие, золотой — огонь разрешён. Время: Europe/Amsterdam.",
1697
"lobby.ceasefireClock": "24-часовые часы. Перетаскивайте ручки или рисуйте сектор; красный — перемирие, золотой — огонь разрешён. Время: ваше местное время.",
1682
1698
"lobby.apLoot": "Забирать очки действий при убийстве",
1683
1699
"lobby.apLootHint": "Если вы устраняете игрока выстрелом, вы получаете его оставшиеся очки действий. Сдача и сужение арены очки не передают. По умолчанию выключено.",
1684
1700
"lobby.apTime": "Ежедневные очки действий в",
1685
"lobby.apTimeHint": "Europe/Amsterdam. Очки действий, бонусы жюри и сужение арены происходят каждый день в это время. По умолчанию 00:00.",
1701
"lobby.apTimeHint": "Очки действий, бонусы жюри и сужение арены происходят каждый день в это время. По умолчанию 00:00.",
1686
1702
"lobby.visibility": "Видимость",
1687
1703
"lobby.visibilityHint": "Кто что видит. Вы всегда видите свои жизни, очки действий и дальность. Перемещение всегда открыто. Сервер скрывает всё остальное для каждого зрителя; скрытые события вообще не появляются на шкале времени.",
1688
1704
"lobby.visShots": "Выстрелы",
@@ -1828,11 +1844,13 @@
1828
1844
"lobby.grid": "Размер поля",
1829
1845
"lobby.gridHint": "Рекомендуемый размер для {n} игроков: {size}×{size}. Обновляется, когда присоединяются игроки, если вы не задали размер сами.",
1830
1846
"lobby.gridUseSuggested": "Использовать рекомендуемый размер",
1831
"error.bad_grid": "Такой размер поля не вмещает столько игроков."
1847
"error.bad_grid": "Такой размер поля не вмещает столько игроков.",
1848
"lobby.rulesHostOnly": "Менять правила может только хост.",
1849
"time.local": "местное время · {tz}"
1832
1850
},
1833
1851
"es": {
1834
1852
"app.name": "Allianties",
1835
"menu.tagline": "Un juego de paciencia, alianzas y disparos bien calculados.",
1853
"menu.tagline": "Un juego de paciencia, paranoia y traiciones en el momento justo.",
1836
1854
"menu.login": "Iniciar sesión",
1837
1855
"menu.logout": "Cerrar sesión",
1838
1856
"menu.loggedInAs": "Sesión iniciada como",
@@ -1874,17 +1892,17 @@
1874
1892
"lobby.shrinkDays": "Días entre encogimientos",
1875
1893
"lobby.shrinkDaysHint": "El primer encogimiento tras tantas medianoches, y luego cada vez que pasen otros tantos días, hasta el tamaño mínimo de la arena.",
1876
1894
"lobby.ceasefire": "Horas de alto el fuego forzoso",
1877
"lobby.ceasefireHint": "Durante estas horas (Europe/Amsterdam) nadie puede disparar. Moverse, dar puntos de acción y mejorar el alcance siguen permitidos. Los periodos pueden cruzar la medianoche.",
1895
"lobby.ceasefireHint": "Durante estas horas (tu hora local) nadie puede disparar. Moverse, dar puntos de acción y mejorar el alcance siguen permitidos. Los periodos pueden cruzar la medianoche.",
1878
1896
"lobby.ceasefireAdd": "Añadir periodo",
1879
1897
"lobby.ceasefireRemove": "Quitar",
1880
1898
"lobby.ceasefireStart": "Desde",
1881
1899
"lobby.ceasefireEnd": "Hasta",
1882
1900
"lobby.ceasefireEmpty": "Aún no hay periodos. Añade uno o arrastra un sector en el reloj.",
1883
"lobby.ceasefireClock": "Reloj de 24 horas. Arrastra los tiradores o pinta un sector; el rojo es alto el fuego, el oro es fuego libre. Horarios en Europe/Amsterdam.",
1901
"lobby.ceasefireClock": "Reloj de 24 horas. Arrastra los tiradores o pinta un sector; el rojo es alto el fuego, el oro es fuego libre. Horarios en tu hora local.",
1884
1902
"lobby.apLoot": "Saquear puntos de acción al eliminar",
1885
1903
"lobby.apLootHint": "Si eliminas a un jugador de un disparo, recibes sus puntos de acción restantes. Rendirse y la arena que se encoge no transfieren puntos. Desactivado por defecto.",
1886
1904
"lobby.apTime": "Puntos de acción diarios a las",
1887
"lobby.apTimeHint": "Europe/Amsterdam. Los puntos de acción, los bonus del jurado y la reducción de la arena ocurren cada día a esta hora. Por defecto 00:00.",
1905
"lobby.apTimeHint": "Los puntos de acción, los bonus del jurado y la reducción de la arena ocurren cada día a esta hora. Por defecto 00:00.",
1888
1906
"lobby.visibility": "Visibilidad",
1889
1907
"lobby.visibilityHint": "Quién puede ver qué. Siempre ves tus propias vidas, puntos de acción y alcance. El movimiento es siempre público. El servidor oculta el resto a cada espectador; los sucesos ocultos no aparecen en absoluto en la línea de tiempo.",
1890
1908
"lobby.visShots": "Disparos",
@@ -2030,7 +2048,9 @@
2030
2048
"lobby.grid": "Tamaño del tablero",
2031
2049
"lobby.gridHint": "Tamaño sugerido para {n} jugadores: {size}×{size}. Se actualiza cuando se unen jugadores, a menos que elijas un tamaño tú.",
2032
2050
"lobby.gridUseSuggested": "Usar el tamaño sugerido",
2033
"error.bad_grid": "Ese tamaño de tablero no cabe para tantos jugadores."
2051
"error.bad_grid": "Ese tamaño de tablero no cabe para tantos jugadores.",
2052
"lobby.rulesHostOnly": "Solo el anfitrión puede cambiar las reglas.",
2053
"time.local": "hora local · {tz}"
2034
2054
}
2035
2055
},
2036
2056
"errors": {
@@ -14,7 +14,7 @@14
"locales": {14
"locales": {15
"en": {15
"en": {16
"app.name": "Allianties",16
"app.name": "Allianties",17
"menu.tagline": "A game of patience, alliances and well-timed shots.",17
"menu.tagline": "A game of patience, paranoia and well-timed betrayal.",18
"menu.login": "Log in",18
"menu.login": "Log in",19
"menu.logout": "Log out",19
"menu.logout": "Log out",20
"menu.loggedInAs": "Logged in as",20
"menu.loggedInAs": "Logged in as",@@ -56,17 +56,17 @@56
"lobby.shrinkDays": "Days between shrinks",56
"lobby.shrinkDays": "Days between shrinks",57
"lobby.shrinkDaysHint": "First shrink after this many midnights, then again each time that many days pass, until the arena reaches its minimum size.",57
"lobby.shrinkDaysHint": "First shrink after this many midnights, then again each time that many days pass, until the arena reaches its minimum size.",58
"lobby.ceasefire": "Forced cease-fire hours",58
"lobby.ceasefire": "Forced cease-fire hours",59
"lobby.ceasefireHint": "During these hours (Europe/Amsterdam) no one may shoot. Moving, giving action points and upgrading range remain allowed. Periods may wrap around midnight.",59
"lobby.ceasefireHint": "During these hours (your local time) no one may shoot. Moving, giving action points and upgrading range remain allowed. Periods may wrap around midnight.",60
"lobby.ceasefireAdd": "Add period",60
"lobby.ceasefireAdd": "Add period",61
"lobby.ceasefireRemove": "Remove",61
"lobby.ceasefireRemove": "Remove",62
"lobby.ceasefireStart": "From",62
"lobby.ceasefireStart": "From",63
"lobby.ceasefireEnd": "Until",63
"lobby.ceasefireEnd": "Until",64
"lobby.ceasefireEmpty": "No periods yet. Add one, or drag a slice on the clock.",64
"lobby.ceasefireEmpty": "No periods yet. Add one, or drag a slice on the clock.",65
"lobby.ceasefireClock": "24-hour clock. Drag the handles or paint a slice; red is cease-fire, gold is open fire. Times are Europe/Amsterdam.",65
"lobby.ceasefireClock": "24-hour clock. Drag the handles or paint a slice; red is cease-fire, gold is open fire. Times are your local time.",66
"lobby.apLoot": "Loot action points on a kill",66
"lobby.apLoot": "Loot action points on a kill",67
"lobby.apLootHint": "When you eliminate a player with a shot, you receive their remaining action points. Surrender and the shrinking arena do not transfer points. Off by default.",67
"lobby.apLootHint": "When you eliminate a player with a shot, you receive their remaining action points. Surrender and the shrinking arena do not transfer points. Off by default.",68
"lobby.apTime": "Daily action points at",68
"lobby.apTime": "Daily action points at",69
"lobby.apTimeHint": "Europe/Amsterdam. Action points, jury awards and arena shrinks all happen at this time each day. Default 00:00.",69
"lobby.apTimeHint": "Action points, jury awards and arena shrinks all happen at this time each day. Default 00:00.",70
"lobby.visibility": "Visibility",70
"lobby.visibility": "Visibility",71
"lobby.visibilityHint": "Who can see what. You always see your own lives, action points and range. Movement is always public. The server hides everything else from each viewer; hidden events do not appear on the timeline at all.",71
"lobby.visibilityHint": "Who can see what. You always see your own lives, action points and range. Movement is always public. The server hides everything else from each viewer; hidden events do not appear on the timeline at all.",72
"lobby.visShots": "Shots",72
"lobby.visShots": "Shots",@@ -212,11 +212,13 @@212
"lobby.grid": "Board size",212
"lobby.grid": "Board size",213
"lobby.gridHint": "Suggested size for {n} players: {size}×{size}. Updates as people join, unless you set a size yourself.",213
"lobby.gridHint": "Suggested size for {n} players: {size}×{size}. Updates as people join, unless you set a size yourself.",214
"lobby.gridUseSuggested": "Use suggested size",214
"lobby.gridUseSuggested": "Use suggested size",215
"error.bad_grid": "That board size cannot fit this many players."215
"error.bad_grid": "That board size cannot fit this many players.",216
"lobby.rulesHostOnly": "Only the host can change the rules.",217
"time.local": "local time · {tz}"216
},218
},217
"nl": {219
"nl": {218
"app.name": "Allianties",220
"app.name": "Allianties",219
"menu.tagline": "Een spel van geduld, allianties en goed getimede schoten.",221
"menu.tagline": "Een spel van geduld, paranoia en goed getimed verraad.",220
"menu.login": "Inloggen",222
"menu.login": "Inloggen",221
"menu.logout": "Uitloggen",223
"menu.logout": "Uitloggen",222
"menu.loggedInAs": "Ingelogd als",224
"menu.loggedInAs": "Ingelogd als",@@ -258,17 +260,17 @@258
"lobby.shrinkDays": "Dagen tussen krimp",260
"lobby.shrinkDays": "Dagen tussen krimp",259
"lobby.shrinkDaysHint": "De eerste krimp na dit aantal middernachten, daarna opnieuw telkens na evenveel dagen, tot het veld zijn minimumgrootte heeft.",261
"lobby.shrinkDaysHint": "De eerste krimp na dit aantal middernachten, daarna opnieuw telkens na evenveel dagen, tot het veld zijn minimumgrootte heeft.",260
"lobby.ceasefire": "Gedwongen staakt-het-vuren",262
"lobby.ceasefire": "Gedwongen staakt-het-vuren",261
"lobby.ceasefireHint": "In deze uren (Europe/Amsterdam) mag niemand schieten. Verplaatsen, actiepunten geven en bereik upgraden blijft toegestaan. Periodes mogen over middernacht lopen.",263
"lobby.ceasefireHint": "In deze uren (je lokale tijd) mag niemand schieten. Verplaatsen, actiepunten geven en bereik upgraden blijft toegestaan. Periodes mogen over middernacht lopen.",262
"lobby.ceasefireAdd": "Periode toevoegen",264
"lobby.ceasefireAdd": "Periode toevoegen",263
"lobby.ceasefireRemove": "Verwijderen",265
"lobby.ceasefireRemove": "Verwijderen",264
"lobby.ceasefireStart": "Van",266
"lobby.ceasefireStart": "Van",265
"lobby.ceasefireEnd": "Tot",267
"lobby.ceasefireEnd": "Tot",266
"lobby.ceasefireEmpty": "Nog geen periodes. Voeg er een toe, of sleep een stuk op de klok.",268
"lobby.ceasefireEmpty": "Nog geen periodes. Voeg er een toe, of sleep een stuk op de klok.",267
"lobby.ceasefireClock": "24-uursklok. Sleep de handvatten of teken een stuk; rood is staakt-het-vuren, goud is vrij schieten. Tijden zijn Europe/Amsterdam.",269
"lobby.ceasefireClock": "24-uursklok. Sleep de handvatten of teken een stuk; rood is staakt-het-vuren, goud is vrij schieten. Tijden zijn je lokale tijd.",268
"lobby.apLoot": "Actiepunten plunderen bij een kill",270
"lobby.apLoot": "Actiepunten plunderen bij een kill",269
"lobby.apLootHint": "Als je een speler uitschakelt met een schot, ontvang je diens resterende actiepunten. Overgave en het krimpende speelveld geven geen punten. Standaard uit.",271
"lobby.apLootHint": "Als je een speler uitschakelt met een schot, ontvang je diens resterende actiepunten. Overgave en het krimpende speelveld geven geen punten. Standaard uit.",270
"lobby.apTime": "Dagelijkse actiepunten om",272
"lobby.apTime": "Dagelijkse actiepunten om",271
"lobby.apTimeHint": "Europe/Amsterdam. Actiepunten, jurybonussen en het krimpen van het veld gebeuren elke dag op dit tijdstip. Standaard 00:00.",273
"lobby.apTimeHint": "Actiepunten, jurybonussen en het krimpen van het veld gebeuren elke dag op dit tijdstip. Standaard 00:00.",272
"lobby.visibility": "Zichtbaarheid",274
"lobby.visibility": "Zichtbaarheid",273
"lobby.visibilityHint": "Wie wat kan zien. Je ziet altijd je eigen levens, actiepunten en bereik. Verplaatsingen zijn altijd openbaar. De server verbergt de rest per kijker; verborgen gebeurtenissen verschijnen helemaal niet op de tijdlijn.",275
"lobby.visibilityHint": "Wie wat kan zien. Je ziet altijd je eigen levens, actiepunten en bereik. Verplaatsingen zijn altijd openbaar. De server verbergt de rest per kijker; verborgen gebeurtenissen verschijnen helemaal niet op de tijdlijn.",274
"lobby.visShots": "Schoten",276
"lobby.visShots": "Schoten",@@ -414,11 +416,13 @@414
"lobby.grid": "Bordgrootte",416
"lobby.grid": "Bordgrootte",415
"lobby.gridHint": "Voorgestelde grootte voor {n} spelers: {size}×{size}. Wordt bijgewerkt als er spelers bijkomen, tenzij je zelf een maat kiest.",417
"lobby.gridHint": "Voorgestelde grootte voor {n} spelers: {size}×{size}. Wordt bijgewerkt als er spelers bijkomen, tenzij je zelf een maat kiest.",416
"lobby.gridUseSuggested": "Gebruik de voorgestelde grootte",418
"lobby.gridUseSuggested": "Gebruik de voorgestelde grootte",417
"error.bad_grid": "Die bordgrootte past niet bij dit aantal spelers."419
"error.bad_grid": "Die bordgrootte past niet bij dit aantal spelers.",420
"lobby.rulesHostOnly": "Alleen de host kan de spelregels aanpassen.",421
"time.local": "lokale tijd · {tz}"418
},422
},419
"de": {423
"de": {420
"app.name": "Allianties",424
"app.name": "Allianties",421
"menu.tagline": "Ein Spiel aus Geduld, Allianzen und gut getimten Schüssen.",425
"menu.tagline": "Ein Spiel aus Geduld, Paranoia und gut getimtem Verrat.",422
"menu.login": "Anmelden",426
"menu.login": "Anmelden",423
"menu.logout": "Abmelden",427
"menu.logout": "Abmelden",424
"menu.loggedInAs": "Angemeldet als",428
"menu.loggedInAs": "Angemeldet als",@@ -460,17 +464,17 @@460
"lobby.shrinkDays": "Tage zwischen Schrumpfungen",464
"lobby.shrinkDays": "Tage zwischen Schrumpfungen",461
"lobby.shrinkDaysHint": "Erste Schrumpfung nach so vielen Mitternächten, danach erneut nach jeweils ebenso vielen Tagen, bis das Feld seine Mindestgröße erreicht.",465
"lobby.shrinkDaysHint": "Erste Schrumpfung nach so vielen Mitternächten, danach erneut nach jeweils ebenso vielen Tagen, bis das Feld seine Mindestgröße erreicht.",462
"lobby.ceasefire": "Erzwungene Waffenruhe",466
"lobby.ceasefire": "Erzwungene Waffenruhe",463
"lobby.ceasefireHint": "In diesen Stunden (Europe/Amsterdam) darf niemand schießen. Bewegen, Aktionspunkte abgeben und die Reichweite erhöhen bleiben erlaubt. Zeiträume dürfen über Mitternacht gehen.",467
"lobby.ceasefireHint": "In diesen Stunden (deine Ortszeit) darf niemand schießen. Bewegen, Aktionspunkte abgeben und die Reichweite erhöhen bleiben erlaubt. Zeiträume dürfen über Mitternacht gehen.",464
"lobby.ceasefireAdd": "Zeitraum hinzufügen",468
"lobby.ceasefireAdd": "Zeitraum hinzufügen",465
"lobby.ceasefireRemove": "Entfernen",469
"lobby.ceasefireRemove": "Entfernen",466
"lobby.ceasefireStart": "Von",470
"lobby.ceasefireStart": "Von",467
"lobby.ceasefireEnd": "Bis",471
"lobby.ceasefireEnd": "Bis",468
"lobby.ceasefireEmpty": "Noch keine Zeiträume. Füge einen hinzu oder ziehe ein Segment auf der Uhr.",472
"lobby.ceasefireEmpty": "Noch keine Zeiträume. Füge einen hinzu oder ziehe ein Segment auf der Uhr.",469
"lobby.ceasefireClock": "24-Stunden-Uhr. Ziehe die Griffe oder male ein Segment; rot ist Waffenruhe, gold ist Feuer frei. Zeiten sind Europe/Amsterdam.",473
"lobby.ceasefireClock": "24-Stunden-Uhr. Ziehe die Griffe oder male ein Segment; rot ist Waffenruhe, gold ist Feuer frei. Zeiten sind deine Ortszeit.",470
"lobby.apLoot": "Aktionspunkte bei einem Kill erbeuten",474
"lobby.apLoot": "Aktionspunkte bei einem Kill erbeuten",471
"lobby.apLootHint": "Wenn du einen Spieler mit einem Schuss ausschaltest, erhältst du dessen verbleibende Aktionspunkte. Aufgabe und das schrumpfende Feld übertragen keine Punkte. Standardmäßig aus.",475
"lobby.apLootHint": "Wenn du einen Spieler mit einem Schuss ausschaltest, erhältst du dessen verbleibende Aktionspunkte. Aufgabe und das schrumpfende Feld übertragen keine Punkte. Standardmäßig aus.",472
"lobby.apTime": "Tägliche Aktionspunkte um",476
"lobby.apTime": "Tägliche Aktionspunkte um",473
"lobby.apTimeHint": "Europe/Amsterdam. Aktionspunkte, Jury-Boni und das Schrumpfen des Feldes finden jeden Tag zu dieser Uhrzeit statt. Standard 00:00.",477
"lobby.apTimeHint": "Aktionspunkte, Jury-Boni und das Schrumpfen des Feldes finden jeden Tag zu dieser Uhrzeit statt. Standard 00:00.",474
"lobby.visibility": "Sichtbarkeit",478
"lobby.visibility": "Sichtbarkeit",475
"lobby.visibilityHint": "Wer was sehen kann. Du siehst immer deine eigenen Leben, Aktionspunkte und Reichweite. Bewegungen sind immer öffentlich. Der Server blendet alles andere je Betrachter aus; versteckte Ereignisse erscheinen gar nicht auf der Zeitleiste.",479
"lobby.visibilityHint": "Wer was sehen kann. Du siehst immer deine eigenen Leben, Aktionspunkte und Reichweite. Bewegungen sind immer öffentlich. Der Server blendet alles andere je Betrachter aus; versteckte Ereignisse erscheinen gar nicht auf der Zeitleiste.",476
"lobby.visShots": "Schüsse",480
"lobby.visShots": "Schüsse",@@ -616,11 +620,13 @@616
"lobby.grid": "Brettgröße",620
"lobby.grid": "Brettgröße",617
"lobby.gridHint": "Vorgeschlagene Größe für {n} Spieler: {size}×{size}. Wird angepasst, wenn Spieler beitreten, es sei denn, du wählst selbst eine Größe.",621
"lobby.gridHint": "Vorgeschlagene Größe für {n} Spieler: {size}×{size}. Wird angepasst, wenn Spieler beitreten, es sei denn, du wählst selbst eine Größe.",618
"lobby.gridUseSuggested": "Vorgeschlagene Größe verwenden",622
"lobby.gridUseSuggested": "Vorgeschlagene Größe verwenden",619
"error.bad_grid": "Diese Brettgröße reicht für so viele Spieler nicht aus."623
"error.bad_grid": "Diese Brettgröße reicht für so viele Spieler nicht aus.",624
"lobby.rulesHostOnly": "Nur der Host kann die Regeln ändern.",625
"time.local": "Ortszeit · {tz}"620
},626
},621
"fr": {627
"fr": {622
"app.name": "Allianties",628
"app.name": "Allianties",623
"menu.tagline": "Un jeu de patience, d'alliances et de tirs bien calculés.",629
"menu.tagline": "Un jeu de patience, de paranoïa et de trahisons bien calculées.",624
"menu.login": "Connexion",630
"menu.login": "Connexion",625
"menu.logout": "Déconnexion",631
"menu.logout": "Déconnexion",626
"menu.loggedInAs": "Connecté en tant que",632
"menu.loggedInAs": "Connecté en tant que",@@ -662,17 +668,17 @@662
"lobby.shrinkDays": "Jours entre les rétrécissements",668
"lobby.shrinkDays": "Jours entre les rétrécissements",663
"lobby.shrinkDaysHint": "Premier rétrécissement après autant de minuits, puis de nouveau tous les autant de jours, jusqu'à la taille minimale de l'arène.",669
"lobby.shrinkDaysHint": "Premier rétrécissement après autant de minuits, puis de nouveau tous les autant de jours, jusqu'à la taille minimale de l'arène.",664
"lobby.ceasefire": "Heures de cessez-le-feu forcé",670
"lobby.ceasefire": "Heures de cessez-le-feu forcé",665
"lobby.ceasefireHint": "Pendant ces heures (Europe/Amsterdam), personne ne peut tirer. Se déplacer, donner des points d'action et améliorer la portée restent autorisés. Les plages peuvent chevaucher minuit.",671
"lobby.ceasefireHint": "Pendant ces heures (votre heure locale), personne ne peut tirer. Se déplacer, donner des points d'action et améliorer la portée restent autorisés. Les plages peuvent chevaucher minuit.",666
"lobby.ceasefireAdd": "Ajouter une plage",672
"lobby.ceasefireAdd": "Ajouter une plage",667
"lobby.ceasefireRemove": "Supprimer",673
"lobby.ceasefireRemove": "Supprimer",668
"lobby.ceasefireStart": "De",674
"lobby.ceasefireStart": "De",669
"lobby.ceasefireEnd": "À",675
"lobby.ceasefireEnd": "À",670
"lobby.ceasefireEmpty": "Aucune plage pour l'instant. Ajoutez-en une, ou dessinez un secteur sur l'horloge.",676
"lobby.ceasefireEmpty": "Aucune plage pour l'instant. Ajoutez-en une, ou dessinez un secteur sur l'horloge.",671
"lobby.ceasefireClock": "Horloge 24 heures. Faites glisser les poignées ou dessinez un secteur ; le rouge est le cessez-le-feu, l'or le feu autorisé. Heures en Europe/Amsterdam.",677
"lobby.ceasefireClock": "Horloge 24 heures. Faites glisser les poignées ou dessinez un secteur ; le rouge est le cessez-le-feu, l'or le feu autorisé. Heures en votre heure locale.",672
"lobby.apLoot": "Prendre les points d’action lors d’une élimination",678
"lobby.apLoot": "Prendre les points d’action lors d’une élimination",673
"lobby.apLootHint": "Lorsque vous éliminez un joueur par un tir, vous recevez ses points d’action restants. Abandon et arène qui rétrécit ne transfèrent rien. Désactivé par défaut.",679
"lobby.apLootHint": "Lorsque vous éliminez un joueur par un tir, vous recevez ses points d’action restants. Abandon et arène qui rétrécit ne transfèrent rien. Désactivé par défaut.",674
"lobby.apTime": "Points d’action quotidiens à",680
"lobby.apTime": "Points d’action quotidiens à",675
"lobby.apTimeHint": "Europe/Amsterdam. Les points d’action, les bonus du jury et le rétrécissement ont lieu chaque jour à cette heure. 00:00 par défaut.",681
"lobby.apTimeHint": "Les points d’action, les bonus du jury et le rétrécissement ont lieu chaque jour à cette heure. 00:00 par défaut.",676
"lobby.visibility": "Visibilité",682
"lobby.visibility": "Visibilité",677
"lobby.visibilityHint": "Qui voit quoi. Vous voyez toujours vos propres vies, points d’action et portée. Les déplacements sont toujours publics. Le serveur masque le reste pour chaque spectateur ; les événements cachés n’apparaissent pas du tout sur la timeline.",683
"lobby.visibilityHint": "Qui voit quoi. Vous voyez toujours vos propres vies, points d’action et portée. Les déplacements sont toujours publics. Le serveur masque le reste pour chaque spectateur ; les événements cachés n’apparaissent pas du tout sur la timeline.",678
"lobby.visShots": "Tirs",684
"lobby.visShots": "Tirs",@@ -818,11 +824,13 @@818
"lobby.grid": "Taille du plateau",824
"lobby.grid": "Taille du plateau",819
"lobby.gridHint": "Taille suggérée pour {n} joueurs : {size}×{size}. Elle est mise à jour quand des joueurs rejoignent, sauf si vous choisissez une taille vous-même.",825
"lobby.gridHint": "Taille suggérée pour {n} joueurs : {size}×{size}. Elle est mise à jour quand des joueurs rejoignent, sauf si vous choisissez une taille vous-même.",820
"lobby.gridUseSuggested": "Utiliser la taille suggérée",826
"lobby.gridUseSuggested": "Utiliser la taille suggérée",821
"error.bad_grid": "Cette taille de plateau ne peut pas accueillir autant de joueurs."827
"error.bad_grid": "Cette taille de plateau ne peut pas accueillir autant de joueurs.",828
"lobby.rulesHostOnly": "Seul l'hôte peut modifier les règles.",829
"time.local": "heure locale · {tz}"822
},830
},823
"ja": {831
"ja": {824
"app.name": "Allianties",832
"app.name": "Allianties",825
"menu.tagline": "忍耐、同盟、そして時機を逃さない一撃のゲーム。",833
"menu.tagline": "忍耐と疑心暗鬼、そして絶妙なタイミングの裏切りのゲーム。",826
"menu.login": "ログイン",834
"menu.login": "ログイン",827
"menu.logout": "ログアウト",835
"menu.logout": "ログアウト",828
"menu.loggedInAs": "ログイン中",836
"menu.loggedInAs": "ログイン中",@@ -864,17 +872,17 @@864
"lobby.shrinkDays": "縮小の間隔(日)",872
"lobby.shrinkDays": "縮小の間隔(日)",865
"lobby.shrinkDaysHint": "最初の縮小はこの回数の深夜のあと、その後同じ日数ごとに繰り返し、戦場が最小サイズになるまで続きます。",873
"lobby.shrinkDaysHint": "最初の縮小はこの回数の深夜のあと、その後同じ日数ごとに繰り返し、戦場が最小サイズになるまで続きます。",866
"lobby.ceasefire": "強制停戦時間",874
"lobby.ceasefire": "強制停戦時間",867
"lobby.ceasefireHint": "この時間帯(Europe/Amsterdam)は誰も撃てません。移動、行動力の譲渡、射程の強化は可能です。時間帯は深夜をまたげます。",875
"lobby.ceasefireHint": "この時間帯(現地時刻)は誰も撃てません。移動、行動力の譲渡、射程の強化は可能です。時間帯は深夜をまたげます。",868
"lobby.ceasefireAdd": "時間帯を追加",876
"lobby.ceasefireAdd": "時間帯を追加",869
"lobby.ceasefireRemove": "削除",877
"lobby.ceasefireRemove": "削除",870
"lobby.ceasefireStart": "開始",878
"lobby.ceasefireStart": "開始",871
"lobby.ceasefireEnd": "終了",879
"lobby.ceasefireEnd": "終了",872
"lobby.ceasefireEmpty": "まだ時間帯がありません。追加するか、時計の上で扇形をドラッグしてください。",880
"lobby.ceasefireEmpty": "まだ時間帯がありません。追加するか、時計の上で扇形をドラッグしてください。",873
"lobby.ceasefireClock": "24時間時計。ハンドルをドラッグするか扇形を描きます。赤は停戦、金は攻撃可能。時刻は Europe/Amsterdam です。",881
"lobby.ceasefireClock": "24時間時計。ハンドルをドラッグするか扇形を描きます。赤は停戦、金は攻撃可能。時刻は現地時刻です。",874
"lobby.apLoot": "倒した相手のアクションポイントを奪う",882
"lobby.apLoot": "倒した相手のアクションポイントを奪う",875
"lobby.apLootHint": "射撃で相手を倒すと、残っていたアクションポイントを得ます。投降や縮小する戦場では移りません。既定はオフです。",883
"lobby.apLootHint": "射撃で相手を倒すと、残っていたアクションポイントを得ます。投降や縮小する戦場では移りません。既定はオフです。",876
"lobby.apTime": "毎日のアクションポイント配布時刻",884
"lobby.apTime": "毎日のアクションポイント配布時刻",877
"lobby.apTimeHint": "Europe/Amsterdam。アクションポイント、陪審のボーナス、戦場の縮小は毎日この時刻に行われます。既定は 00:00 です。",885
"lobby.apTimeHint": "アクションポイント、陪審のボーナス、戦場の縮小は毎日この時刻に行われます。既定は 00:00 です。",878
"lobby.visibility": "公開範囲",886
"lobby.visibility": "公開範囲",879
"lobby.visibilityHint": "誰が何を見られるか。自分のライフ、アクションポイント、射程は常に見えます。移動は常に公開です。サーバーが閲覧者ごとにそれ以外を隠し、隠された出来事はタイムラインに一切表示されません。",887
"lobby.visibilityHint": "誰が何を見られるか。自分のライフ、アクションポイント、射程は常に見えます。移動は常に公開です。サーバーが閲覧者ごとにそれ以外を隠し、隠された出来事はタイムラインに一切表示されません。",880
"lobby.visShots": "射撃",888
"lobby.visShots": "射撃",@@ -1020,11 +1028,13 @@1020
"lobby.grid": "盤の大きさ",1028
"lobby.grid": "盤の大きさ",1021
"lobby.gridHint": "{n}人での推奨サイズは {size}×{size}。自分でサイズを決めていない限り、参加者が増えると更新されます。",1029
"lobby.gridHint": "{n}人での推奨サイズは {size}×{size}。自分でサイズを決めていない限り、参加者が増えると更新されます。",1022
"lobby.gridUseSuggested": "推奨サイズを使う",1030
"lobby.gridUseSuggested": "推奨サイズを使う",1023
"error.bad_grid": "その盤の大きさではこの人数を置けません。"1031
"error.bad_grid": "その盤の大きさではこの人数を置けません。",1032
"lobby.rulesHostOnly": "ルールを変更できるのはホストだけです。",1033
"time.local": "現地時刻 · {tz}"1024
},1034
},1025
"zh": {1035
"zh": {1026
"app.name": "Allianties",1036
"app.name": "Allianties",1027
"menu.tagline": "一场关于耐心、同盟与精准开火的游戏。",1037
"menu.tagline": "一场关于耐心、猜疑与适时背叛的游戏。",1028
"menu.login": "登录",1038
"menu.login": "登录",1029
"menu.logout": "退出登录",1039
"menu.logout": "退出登录",1030
"menu.loggedInAs": "已登录为",1040
"menu.loggedInAs": "已登录为",@@ -1066,17 +1076,17 @@1066
"lobby.shrinkDays": "两次缩小间隔天数",1076
"lobby.shrinkDays": "两次缩小间隔天数",1067
"lobby.shrinkDaysHint": "第一次缩小发生在这么多个午夜之后,之后每隔同样天数再缩小,直到战场达到最小尺寸。",1077
"lobby.shrinkDaysHint": "第一次缩小发生在这么多个午夜之后,之后每隔同样天数再缩小,直到战场达到最小尺寸。",1068
"lobby.ceasefire": "强制停火时段",1078
"lobby.ceasefire": "强制停火时段",1069
"lobby.ceasefireHint": "在这些时段(Europe/Amsterdam)任何人不得射击。移动、给予行动点和提升射程仍然允许。时段可以跨越午夜。",1079
"lobby.ceasefireHint": "在这些时段(你的本地时间)任何人不得射击。移动、给予行动点和提升射程仍然允许。时段可以跨越午夜。",1070
"lobby.ceasefireAdd": "添加时段",1080
"lobby.ceasefireAdd": "添加时段",1071
"lobby.ceasefireRemove": "删除",1081
"lobby.ceasefireRemove": "删除",1072
"lobby.ceasefireStart": "从",1082
"lobby.ceasefireStart": "从",1073
"lobby.ceasefireEnd": "至",1083
"lobby.ceasefireEnd": "至",1074
"lobby.ceasefireEmpty": "还没有时段。请添加一个,或在时钟上拖出一段扇形。",1084
"lobby.ceasefireEmpty": "还没有时段。请添加一个,或在时钟上拖出一段扇形。",1075
"lobby.ceasefireClock": "24 小时时钟。拖动手柄或画出扇形;红色为停火,金色为可开火。时间为 Europe/Amsterdam。",1085
"lobby.ceasefireClock": "24 小时时钟。拖动手柄或画出扇形;红色为停火,金色为可开火。时间为你的本地时间。",1076
"lobby.apLoot": "击杀时夺取行动点",1086
"lobby.apLoot": "击杀时夺取行动点",1077
"lobby.apLootHint": "用射击淘汰玩家时,你会获得其剩余行动点。投降和缩小场地不会转移点数。默认关闭。",1087
"lobby.apLootHint": "用射击淘汰玩家时,你会获得其剩余行动点。投降和缩小场地不会转移点数。默认关闭。",1078
"lobby.apTime": "每日行动点发放时间",1088
"lobby.apTime": "每日行动点发放时间",1079
"lobby.apTimeHint": "Europe/Amsterdam。行动点、陪审团奖励和场地缩小每天都在此时发生。默认 00:00。",1089
"lobby.apTimeHint": "行动点、陪审团奖励和场地缩小每天都在此时发生。默认 00:00。",1080
"lobby.visibility": "可见性",1090
"lobby.visibility": "可见性",1081
"lobby.visibilityHint": "谁能看到什么。你始终能看到自己的生命、行动点和射程。移动始终公开。服务器会按观看者隐藏其余信息;被隐藏的事件完全不会出现在时间轴上。",1091
"lobby.visibilityHint": "谁能看到什么。你始终能看到自己的生命、行动点和射程。移动始终公开。服务器会按观看者隐藏其余信息;被隐藏的事件完全不会出现在时间轴上。",1082
"lobby.visShots": "射击",1092
"lobby.visShots": "射击",@@ -1222,11 +1232,13 @@1222
"lobby.grid": "棋盘大小",1232
"lobby.grid": "棋盘大小",1223
"lobby.gridHint": "{n} 名玩家的建议大小为 {size}×{size}。除非你自己设定了大小,否则会随加入人数更新。",1233
"lobby.gridHint": "{n} 名玩家的建议大小为 {size}×{size}。除非你自己设定了大小,否则会随加入人数更新。",1224
"lobby.gridUseSuggested": "使用建议大小",1234
"lobby.gridUseSuggested": "使用建议大小",1225
"error.bad_grid": "该棋盘大小无法容纳这么多玩家。"1235
"error.bad_grid": "该棋盘大小无法容纳这么多玩家。",1236
"lobby.rulesHostOnly": "只有房主可以修改规则。",1237
"time.local": "本地时间 · {tz}"1226
},1238
},1227
"ko": {1239
"ko": {1228
"app.name": "Allianties",1240
"app.name": "Allianties",1229
"menu.tagline": "인내와 동맹, 그리고 때를 놓치지 않는 사격의 게임.",1241
"menu.tagline": "인내와 편집증, 그리고 절묘한 타이밍의 배신에 관한 게임.",1230
"menu.login": "로그인",1242
"menu.login": "로그인",1231
"menu.logout": "로그아웃",1243
"menu.logout": "로그아웃",1232
"menu.loggedInAs": "로그인됨",1244
"menu.loggedInAs": "로그인됨",@@ -1268,17 +1280,17 @@1268
"lobby.shrinkDays": "축소 간격(일)",1280
"lobby.shrinkDays": "축소 간격(일)",1269
"lobby.shrinkDaysHint": "첫 축소는 그 횟수만큼의 자정이 지난 뒤, 이후 같은 일수마다 반복되며 전장이 최소 크기에 이를 때까지 계속됩니다.",1281
"lobby.shrinkDaysHint": "첫 축소는 그 횟수만큼의 자정이 지난 뒤, 이후 같은 일수마다 반복되며 전장이 최소 크기에 이를 때까지 계속됩니다.",1270
"lobby.ceasefire": "강제 휴전 시간",1282
"lobby.ceasefire": "강제 휴전 시간",1271
"lobby.ceasefireHint": "이 시간대(Europe/Amsterdam)에는 아무도 발사할 수 없습니다. 이동, 행동력 전달, 사거리 강화는 가능합니다. 구간은 자정을 넘길 수 있습니다.",1283
"lobby.ceasefireHint": "이 시간대(현지 시간)에는 아무도 발사할 수 없습니다. 이동, 행동력 전달, 사거리 강화는 가능합니다. 구간은 자정을 넘길 수 있습니다.",1272
"lobby.ceasefireAdd": "구간 추가",1284
"lobby.ceasefireAdd": "구간 추가",1273
"lobby.ceasefireRemove": "삭제",1285
"lobby.ceasefireRemove": "삭제",1274
"lobby.ceasefireStart": "시작",1286
"lobby.ceasefireStart": "시작",1275
"lobby.ceasefireEnd": "종료",1287
"lobby.ceasefireEnd": "종료",1276
"lobby.ceasefireEmpty": "아직 구간이 없습니다. 하나를 추가하거나 시계에서 부채꼴을 드래그하세요.",1288
"lobby.ceasefireEmpty": "아직 구간이 없습니다. 하나를 추가하거나 시계에서 부채꼴을 드래그하세요.",1277
"lobby.ceasefireClock": "24시간 시계. 핸들을 드래그하거나 부채꼴을 그리세요. 빨강은 휴전, 금색은 사격 가능. 시각은 Europe/Amsterdam입니다.",1289
"lobby.ceasefireClock": "24시간 시계. 핸들을 드래그하거나 부채꼴을 그리세요. 빨강은 휴전, 금색은 사격 가능. 시각은 현지 시간입니다.",1278
"lobby.apLoot": "처치 시 행동력 탈취",1290
"lobby.apLoot": "처치 시 행동력 탈취",1279
"lobby.apLootHint": "사격으로 플레이어를 처치하면 남은 행동력을 받습니다. 항복과 축소되는 전장에서는 이전되지 않습니다. 기본값은 꺼짐입니다.",1291
"lobby.apLootHint": "사격으로 플레이어를 처치하면 남은 행동력을 받습니다. 항복과 축소되는 전장에서는 이전되지 않습니다. 기본값은 꺼짐입니다.",1280
"lobby.apTime": "매일 행동력 지급 시각",1292
"lobby.apTime": "매일 행동력 지급 시각",1281
"lobby.apTimeHint": "Europe/Amsterdam. 행동력, 배심 보너스, 전장 축소가 매일 이 시각에 일어납니다. 기본값은 00:00입니다.",1293
"lobby.apTimeHint": "행동력, 배심 보너스, 전장 축소가 매일 이 시각에 일어납니다. 기본값은 00:00입니다.",1282
"lobby.visibility": "공개 범위",1294
"lobby.visibility": "공개 범위",1283
"lobby.visibilityHint": "누가 무엇을 볼 수 있는지. 자신의 생명, 행동력, 사거리는 항상 보입니다. 이동은 항상 공개됩니다. 서버가 보는 사람마다 나머지를 숨기며, 숨겨진 사건은 타임라인에 전혀 나타나지 않습니다.",1295
"lobby.visibilityHint": "누가 무엇을 볼 수 있는지. 자신의 생명, 행동력, 사거리는 항상 보입니다. 이동은 항상 공개됩니다. 서버가 보는 사람마다 나머지를 숨기며, 숨겨진 사건은 타임라인에 전혀 나타나지 않습니다.",1284
"lobby.visShots": "사격",1296
"lobby.visShots": "사격",@@ -1424,11 +1436,13 @@1424
"lobby.grid": "보드 크기",1436
"lobby.grid": "보드 크기",1425
"lobby.gridHint": "{n}명일 때 권장 크기는 {size}×{size}입니다. 직접 크기를 정하지 않으면 참가자가 늘 때 업데이트됩니다.",1437
"lobby.gridHint": "{n}명일 때 권장 크기는 {size}×{size}입니다. 직접 크기를 정하지 않으면 참가자가 늘 때 업데이트됩니다.",1426
"lobby.gridUseSuggested": "권장 크기 사용",1438
"lobby.gridUseSuggested": "권장 크기 사용",1427
"error.bad_grid": "그 보드 크기에는 이 인원을 배치할 수 없습니다."1439
"error.bad_grid": "그 보드 크기에는 이 인원을 배치할 수 없습니다.",1440
"lobby.rulesHostOnly": "규칙은 호스트만 변경할 수 있습니다.",1441
"time.local": "현지 시간 · {tz}"1428
},1442
},1429
"pl": {1443
"pl": {1430
"app.name": "Allianties",1444
"app.name": "Allianties",1431
"menu.tagline": "Gra cierpliwości, sojuszy i dobrze wycelowanych strzałów.",1445
"menu.tagline": "Gra cierpliwości, paranoi i dobrze wymierzonej zdrady.",1432
"menu.login": "Zaloguj się",1446
"menu.login": "Zaloguj się",1433
"menu.logout": "Wyloguj się",1447
"menu.logout": "Wyloguj się",1434
"menu.loggedInAs": "Zalogowano jako",1448
"menu.loggedInAs": "Zalogowano jako",@@ -1470,17 +1484,17 @@1470
"lobby.shrinkDays": "Dni między skurczeniami",1484
"lobby.shrinkDays": "Dni między skurczeniami",1471
"lobby.shrinkDaysHint": "Pierwsze skurczenie po tylu północach, potem ponownie co tyle samo dni, aż arena osiągnie minimalny rozmiar.",1485
"lobby.shrinkDaysHint": "Pierwsze skurczenie po tylu północach, potem ponownie co tyle samo dni, aż arena osiągnie minimalny rozmiar.",1472
"lobby.ceasefire": "Wymuszone godziny zawieszenia broni",1486
"lobby.ceasefire": "Wymuszone godziny zawieszenia broni",1473
"lobby.ceasefireHint": "W tych godzinach (Europe/Amsterdam) nikt nie może strzelać. Ruch, przekazywanie punktów akcji i zwiększanie zasięgu pozostają dozwolone. Zakresy mogą przekraczać północ.",1487
"lobby.ceasefireHint": "W tych godzinach (twój czas lokalny) nikt nie może strzelać. Ruch, przekazywanie punktów akcji i zwiększanie zasięgu pozostają dozwolone. Zakresy mogą przekraczać północ.",1474
"lobby.ceasefireAdd": "Dodaj okres",1488
"lobby.ceasefireAdd": "Dodaj okres",1475
"lobby.ceasefireRemove": "Usuń",1489
"lobby.ceasefireRemove": "Usuń",1476
"lobby.ceasefireStart": "Od",1490
"lobby.ceasefireStart": "Od",1477
"lobby.ceasefireEnd": "Do",1491
"lobby.ceasefireEnd": "Do",1478
"lobby.ceasefireEmpty": "Brak okresów. Dodaj jeden albo narysuj wycinek na zegarze.",1492
"lobby.ceasefireEmpty": "Brak okresów. Dodaj jeden albo narysuj wycinek na zegarze.",1479
"lobby.ceasefireClock": "Zegar 24-godzinny. Przeciągaj uchwyty lub maluj wycinek; czerwień to zawieszenie broni, złoto to dowolność strzału. Czas: Europe/Amsterdam.",1493
"lobby.ceasefireClock": "Zegar 24-godzinny. Przeciągaj uchwyty lub maluj wycinek; czerwień to zawieszenie broni, złoto to dowolność strzału. Czas: twój czas lokalny.",1480
"lobby.apLoot": "Przejmowanie punktów akcji przy eliminacji",1494
"lobby.apLoot": "Przejmowanie punktów akcji przy eliminacji",1481
"lobby.apLootHint": "Gdy wyeliminujesz gracza strzałem, otrzymujesz jego pozostałe punkty akcji. Poddanie się i kurczenie areny nie przekazują punktów. Domyślnie wyłączone.",1495
"lobby.apLootHint": "Gdy wyeliminujesz gracza strzałem, otrzymujesz jego pozostałe punkty akcji. Poddanie się i kurczenie areny nie przekazują punktów. Domyślnie wyłączone.",1482
"lobby.apTime": "Codzienne punkty akcji o",1496
"lobby.apTime": "Codzienne punkty akcji o",1483
"lobby.apTimeHint": "Europe/Amsterdam. Punkty akcji, nagrody jury i kurczenie areny odbywają się codziennie o tej godzinie. Domyślnie 00:00.",1497
"lobby.apTimeHint": "Punkty akcji, nagrody jury i kurczenie areny odbywają się codziennie o tej godzinie. Domyślnie 00:00.",1484
"lobby.visibility": "Widoczność",1498
"lobby.visibility": "Widoczność",1485
"lobby.visibilityHint": "Kto co widzi. Zawsze widzisz własne życia, punkty akcji i zasięg. Ruchy są zawsze publiczne. Serwer ukrywa resztę przed każdym widzem; ukryte zdarzenia w ogóle nie pojawiają się na osi czasu.",1499
"lobby.visibilityHint": "Kto co widzi. Zawsze widzisz własne życia, punkty akcji i zasięg. Ruchy są zawsze publiczne. Serwer ukrywa resztę przed każdym widzem; ukryte zdarzenia w ogóle nie pojawiają się na osi czasu.",1486
"lobby.visShots": "Strzały",1500
"lobby.visShots": "Strzały",@@ -1626,11 +1640,13 @@1626
"lobby.grid": "Rozmiar planszy",1640
"lobby.grid": "Rozmiar planszy",1627
"lobby.gridHint": "Sugerowany rozmiar dla {n} graczy: {size}×{size}. Aktualizuje się, gdy dołączają gracze, chyba że ustawisz rozmiar samodzielnie.",1641
"lobby.gridHint": "Sugerowany rozmiar dla {n} graczy: {size}×{size}. Aktualizuje się, gdy dołączają gracze, chyba że ustawisz rozmiar samodzielnie.",1628
"lobby.gridUseSuggested": "Użyj sugerowanego rozmiaru",1642
"lobby.gridUseSuggested": "Użyj sugerowanego rozmiaru",1629
"error.bad_grid": "Ten rozmiar planszy nie pomieści tylu graczy."1643
"error.bad_grid": "Ten rozmiar planszy nie pomieści tylu graczy.",1644
"lobby.rulesHostOnly": "Tylko gospodarz może zmieniać zasady.",1645
"time.local": "czas lokalny · {tz}"1630
},1646
},1631
"ru": {1647
"ru": {1632
"app.name": "Allianties",1648
"app.name": "Allianties",1633
"menu.tagline": "Игра в терпение, союзы и хорошо рассчитанные выстрелы.",1649
"menu.tagline": "Игра терпения, паранойи и вовремя совершённого предательства.",1634
"menu.login": "Войти",1650
"menu.login": "Войти",1635
"menu.logout": "Выйти",1651
"menu.logout": "Выйти",1636
"menu.loggedInAs": "Вы вошли как",1652
"menu.loggedInAs": "Вы вошли как",@@ -1672,17 +1688,17 @@1672
"lobby.shrinkDays": "Дней между сжатиями",1688
"lobby.shrinkDays": "Дней между сжатиями",1673
"lobby.shrinkDaysHint": "Первое сжатие после стольких полуночей, затем снова через столько же дней, пока арена не достигнет минимального размера.",1689
"lobby.shrinkDaysHint": "Первое сжатие после стольких полуночей, затем снова через столько же дней, пока арена не достигнет минимального размера.",1674
"lobby.ceasefire": "Принудительное перемирие",1690
"lobby.ceasefire": "Принудительное перемирие",1675
"lobby.ceasefireHint": "В эти часы (Europe/Amsterdam) стрелять нельзя. Ходить, передавать очки действия и увеличивать дальность по-прежнему можно. Интервалы могут переходить через полночь.",1691
"lobby.ceasefireHint": "В эти часы (ваше местное время) стрелять нельзя. Ходить, передавать очки действия и увеличивать дальность по-прежнему можно. Интервалы могут переходить через полночь.",1676
"lobby.ceasefireAdd": "Добавить период",1692
"lobby.ceasefireAdd": "Добавить период",1677
"lobby.ceasefireRemove": "Удалить",1693
"lobby.ceasefireRemove": "Удалить",1678
"lobby.ceasefireStart": "С",1694
"lobby.ceasefireStart": "С",1679
"lobby.ceasefireEnd": "До",1695
"lobby.ceasefireEnd": "До",1680
"lobby.ceasefireEmpty": "Периодов пока нет. Добавьте один или нарисуйте сектор на часах.",1696
"lobby.ceasefireEmpty": "Периодов пока нет. Добавьте один или нарисуйте сектор на часах.",1681
"lobby.ceasefireClock": "24-часовые часы. Перетаскивайте ручки или рисуйте сектор; красный — перемирие, золотой — огонь разрешён. Время: Europe/Amsterdam.",1697
"lobby.ceasefireClock": "24-часовые часы. Перетаскивайте ручки или рисуйте сектор; красный — перемирие, золотой — огонь разрешён. Время: ваше местное время.",1682
"lobby.apLoot": "Забирать очки действий при убийстве",1698
"lobby.apLoot": "Забирать очки действий при убийстве",1683
"lobby.apLootHint": "Если вы устраняете игрока выстрелом, вы получаете его оставшиеся очки действий. Сдача и сужение арены очки не передают. По умолчанию выключено.",1699
"lobby.apLootHint": "Если вы устраняете игрока выстрелом, вы получаете его оставшиеся очки действий. Сдача и сужение арены очки не передают. По умолчанию выключено.",1684
"lobby.apTime": "Ежедневные очки действий в",1700
"lobby.apTime": "Ежедневные очки действий в",1685
"lobby.apTimeHint": "Europe/Amsterdam. Очки действий, бонусы жюри и сужение арены происходят каждый день в это время. По умолчанию 00:00.",1701
"lobby.apTimeHint": "Очки действий, бонусы жюри и сужение арены происходят каждый день в это время. По умолчанию 00:00.",1686
"lobby.visibility": "Видимость",1702
"lobby.visibility": "Видимость",1687
"lobby.visibilityHint": "Кто что видит. Вы всегда видите свои жизни, очки действий и дальность. Перемещение всегда открыто. Сервер скрывает всё остальное для каждого зрителя; скрытые события вообще не появляются на шкале времени.",1703
"lobby.visibilityHint": "Кто что видит. Вы всегда видите свои жизни, очки действий и дальность. Перемещение всегда открыто. Сервер скрывает всё остальное для каждого зрителя; скрытые события вообще не появляются на шкале времени.",1688
"lobby.visShots": "Выстрелы",1704
"lobby.visShots": "Выстрелы",@@ -1828,11 +1844,13 @@1828
"lobby.grid": "Размер поля",1844
"lobby.grid": "Размер поля",1829
"lobby.gridHint": "Рекомендуемый размер для {n} игроков: {size}×{size}. Обновляется, когда присоединяются игроки, если вы не задали размер сами.",1845
"lobby.gridHint": "Рекомендуемый размер для {n} игроков: {size}×{size}. Обновляется, когда присоединяются игроки, если вы не задали размер сами.",1830
"lobby.gridUseSuggested": "Использовать рекомендуемый размер",1846
"lobby.gridUseSuggested": "Использовать рекомендуемый размер",1831
"error.bad_grid": "Такой размер поля не вмещает столько игроков."1847
"error.bad_grid": "Такой размер поля не вмещает столько игроков.",1848
"lobby.rulesHostOnly": "Менять правила может только хост.",1849
"time.local": "местное время · {tz}"1832
},1850
},1833
"es": {1851
"es": {1834
"app.name": "Allianties",1852
"app.name": "Allianties",1835
"menu.tagline": "Un juego de paciencia, alianzas y disparos bien calculados.",1853
"menu.tagline": "Un juego de paciencia, paranoia y traiciones en el momento justo.",1836
"menu.login": "Iniciar sesión",1854
"menu.login": "Iniciar sesión",1837
"menu.logout": "Cerrar sesión",1855
"menu.logout": "Cerrar sesión",1838
"menu.loggedInAs": "Sesión iniciada como",1856
"menu.loggedInAs": "Sesión iniciada como",@@ -1874,17 +1892,17 @@1874
"lobby.shrinkDays": "Días entre encogimientos",1892
"lobby.shrinkDays": "Días entre encogimientos",1875
"lobby.shrinkDaysHint": "El primer encogimiento tras tantas medianoches, y luego cada vez que pasen otros tantos días, hasta el tamaño mínimo de la arena.",1893
"lobby.shrinkDaysHint": "El primer encogimiento tras tantas medianoches, y luego cada vez que pasen otros tantos días, hasta el tamaño mínimo de la arena.",1876
"lobby.ceasefire": "Horas de alto el fuego forzoso",1894
"lobby.ceasefire": "Horas de alto el fuego forzoso",1877
"lobby.ceasefireHint": "Durante estas horas (Europe/Amsterdam) nadie puede disparar. Moverse, dar puntos de acción y mejorar el alcance siguen permitidos. Los periodos pueden cruzar la medianoche.",1895
"lobby.ceasefireHint": "Durante estas horas (tu hora local) nadie puede disparar. Moverse, dar puntos de acción y mejorar el alcance siguen permitidos. Los periodos pueden cruzar la medianoche.",1878
"lobby.ceasefireAdd": "Añadir periodo",1896
"lobby.ceasefireAdd": "Añadir periodo",1879
"lobby.ceasefireRemove": "Quitar",1897
"lobby.ceasefireRemove": "Quitar",1880
"lobby.ceasefireStart": "Desde",1898
"lobby.ceasefireStart": "Desde",1881
"lobby.ceasefireEnd": "Hasta",1899
"lobby.ceasefireEnd": "Hasta",1882
"lobby.ceasefireEmpty": "Aún no hay periodos. Añade uno o arrastra un sector en el reloj.",1900
"lobby.ceasefireEmpty": "Aún no hay periodos. Añade uno o arrastra un sector en el reloj.",1883
"lobby.ceasefireClock": "Reloj de 24 horas. Arrastra los tiradores o pinta un sector; el rojo es alto el fuego, el oro es fuego libre. Horarios en Europe/Amsterdam.",1901
"lobby.ceasefireClock": "Reloj de 24 horas. Arrastra los tiradores o pinta un sector; el rojo es alto el fuego, el oro es fuego libre. Horarios en tu hora local.",1884
"lobby.apLoot": "Saquear puntos de acción al eliminar",1902
"lobby.apLoot": "Saquear puntos de acción al eliminar",1885
"lobby.apLootHint": "Si eliminas a un jugador de un disparo, recibes sus puntos de acción restantes. Rendirse y la arena que se encoge no transfieren puntos. Desactivado por defecto.",1903
"lobby.apLootHint": "Si eliminas a un jugador de un disparo, recibes sus puntos de acción restantes. Rendirse y la arena que se encoge no transfieren puntos. Desactivado por defecto.",1886
"lobby.apTime": "Puntos de acción diarios a las",1904
"lobby.apTime": "Puntos de acción diarios a las",1887
"lobby.apTimeHint": "Europe/Amsterdam. Los puntos de acción, los bonus del jurado y la reducción de la arena ocurren cada día a esta hora. Por defecto 00:00.",1905
"lobby.apTimeHint": "Los puntos de acción, los bonus del jurado y la reducción de la arena ocurren cada día a esta hora. Por defecto 00:00.",1888
"lobby.visibility": "Visibilidad",1906
"lobby.visibility": "Visibilidad",1889
"lobby.visibilityHint": "Quién puede ver qué. Siempre ves tus propias vidas, puntos de acción y alcance. El movimiento es siempre público. El servidor oculta el resto a cada espectador; los sucesos ocultos no aparecen en absoluto en la línea de tiempo.",1907
"lobby.visibilityHint": "Quién puede ver qué. Siempre ves tus propias vidas, puntos de acción y alcance. El movimiento es siempre público. El servidor oculta el resto a cada espectador; los sucesos ocultos no aparecen en absoluto en la línea de tiempo.",1890
"lobby.visShots": "Disparos",1908
"lobby.visShots": "Disparos",@@ -2030,7 +2048,9 @@2030
"lobby.grid": "Tamaño del tablero",2048
"lobby.grid": "Tamaño del tablero",2031
"lobby.gridHint": "Tamaño sugerido para {n} jugadores: {size}×{size}. Se actualiza cuando se unen jugadores, a menos que elijas un tamaño tú.",2049
"lobby.gridHint": "Tamaño sugerido para {n} jugadores: {size}×{size}. Se actualiza cuando se unen jugadores, a menos que elijas un tamaño tú.",2032
"lobby.gridUseSuggested": "Usar el tamaño sugerido",2050
"lobby.gridUseSuggested": "Usar el tamaño sugerido",2033
"error.bad_grid": "Ese tamaño de tablero no cabe para tantos jugadores."2051
"error.bad_grid": "Ese tamaño de tablero no cabe para tantos jugadores.",2052
"lobby.rulesHostOnly": "Solo el anfitrión puede cambiar las reglas.",2053
"time.local": "hora local · {tz}"2034
}2054
}2035
},2055
},2036
"errors": {2056
"errors": {@@ -1123,6 +1123,36 @@ $g['rules']['grid_auto'] = true;
1123
1123
$g = Engine::start($g, 'a', $nowG);
1124
1124
expect($g['grid'] === 7, 'auto start uses suggested 7 for 2 players');
1125
1125
1126
echo "Engine: rules time zone (host's IANA zone)\n";
1127
expect(Engine::normalizeRules([])['tz'] === 'Europe/Amsterdam', 'tz default Europe/Amsterdam');
1128
expect(Engine::normalizeRules(['tz' => 'America/New_York'])['tz'] === 'America/New_York', 'accepts America/New_York');
1129
expect(Engine::normalizeRules(['tz' => 'Mars/Olympus'])['tz'] === 'Europe/Amsterdam', 'unknown zone → Amsterdam');
1130
expect(Engine::normalizeRules(['tz' => '+02:00'])['tz'] === 'Europe/Amsterdam', 'raw offset rejected (no DST rules)');
1131
expect(Engine::normalizeRules(['tz' => 'UTC'])['tz'] === 'UTC', 'UTC accepted');
1132
// AP time 09:00 in New York → 14:00 UTC in November (EST), 13:00 UTC in July (EDT).
1133
$nov = (new DateTime('2026-11-14 12:00:00', new DateTimeZone('UTC')))->getTimestamp();
1134
$nx = Engine::nextDistribution($nov, '09:00', 'America/New_York');
1135
expect(gmdate('Y-m-d H:i', $nx) === '2026-11-14 14:00', 'NY 09:00 in winter = 14:00 UTC: ' . gmdate('Y-m-d H:i', $nx));
1136
$jul = (new DateTime('2026-07-14 12:00:00', new DateTimeZone('UTC')))->getTimestamp();
1137
$nx = Engine::nextDistribution($jul, '09:00', 'America/New_York');
1138
expect(gmdate('Y-m-d H:i', $nx) === '2026-07-14 13:00', 'NY 09:00 in summer (DST) = 13:00 UTC: ' . gmdate('Y-m-d H:i', $nx));
1139
// US DST starts 2026-03-08: day before vs after differ by one hour in UTC.
1140
$a1 = Engine::nextDistribution((new DateTime('2026-03-07 00:00', new DateTimeZone('UTC')))->getTimestamp(), '09:00', 'America/New_York');
1141
$a2 = Engine::nextDistribution($a1, '09:00', 'America/New_York');
1142
expect($a2 - $a1 === 23 * 3600, 'NY spring-forward: 09:00→09:00 is 23 real hours');
1143
// A game uses its rules tz for distribution and cease-fire.
1144
$gT = game(['a', 'b'], ['tz' => 'Asia/Tokyo', 'ap_time' => '08:00', 'jury' => false,
1145
'ceasefire' => true, 'ceasefire_ranges' => [['start' => '22:00', 'end' => '06:00']]], $nov);
1146
expect(gmdate('H:i', (int) $gT['next_distribution_at']) === '23:00', 'Tokyo 08:00 = 23:00 UTC');
1147
$tokyo2330 = (new DateTime('2026-11-14 23:30', new DateTimeZone('Asia/Tokyo')))->getTimestamp();
1148
$ams2330 = (new DateTime('2026-11-14 23:30', new DateTimeZone('Europe/Amsterdam')))->getTimestamp();
1149
expect(Engine::ceasefireActive($gT, $tokyo2330), 'cease-fire active at 23:30 Tokyo');
1150
expect(!Engine::ceasefireActive($gT, $ams2330), 'not active at 23:30 Amsterdam (07:30 Tokyo)');
1151
$info = Engine::ceasefireInfo($gT, $tokyo2330);
1152
expect((new DateTime('@' . $info['until']))->setTimezone(new DateTimeZone('Asia/Tokyo'))->format('Y-m-d H:i') === '2026-11-15 06:00',
1153
'Tokyo cease-fire ends 06:00 next day (midnight wrap)');
1154
expect(Engine::present($gT, 'a', $nov)['timezone'] === 'Asia/Tokyo', 'present() reports the rules zone');
1155
1126
1156
echo "Engine: no hearts, no buying lives (options do not exist)\n";
1127
1157
$n = Engine::normalizeRules(['hearts' => true, 'buy_lives' => true, 'buyLives' => true]);
1128
1158
expect(!array_key_exists('hearts', $n) && !array_key_exists('buy_lives', $n) && !array_key_exists('buyLives', $n),
@@ -1123,6 +1123,36 @@ $g['rules']['grid_auto'] = true;1123
$g = Engine::start($g, 'a', $nowG);1123
$g = Engine::start($g, 'a', $nowG);1124
expect($g['grid'] === 7, 'auto start uses suggested 7 for 2 players');1124
expect($g['grid'] === 7, 'auto start uses suggested 7 for 2 players');1125
1125
1126
echo "Engine: rules time zone (host's IANA zone)\n";1127
expect(Engine::normalizeRules([])['tz'] === 'Europe/Amsterdam', 'tz default Europe/Amsterdam');1128
expect(Engine::normalizeRules(['tz' => 'America/New_York'])['tz'] === 'America/New_York', 'accepts America/New_York');1129
expect(Engine::normalizeRules(['tz' => 'Mars/Olympus'])['tz'] === 'Europe/Amsterdam', 'unknown zone → Amsterdam');1130
expect(Engine::normalizeRules(['tz' => '+02:00'])['tz'] === 'Europe/Amsterdam', 'raw offset rejected (no DST rules)');1131
expect(Engine::normalizeRules(['tz' => 'UTC'])['tz'] === 'UTC', 'UTC accepted');1132
// AP time 09:00 in New York → 14:00 UTC in November (EST), 13:00 UTC in July (EDT).1133
$nov = (new DateTime('2026-11-14 12:00:00', new DateTimeZone('UTC')))->getTimestamp();1134
$nx = Engine::nextDistribution($nov, '09:00', 'America/New_York');1135
expect(gmdate('Y-m-d H:i', $nx) === '2026-11-14 14:00', 'NY 09:00 in winter = 14:00 UTC: ' . gmdate('Y-m-d H:i', $nx));1136
$jul = (new DateTime('2026-07-14 12:00:00', new DateTimeZone('UTC')))->getTimestamp();1137
$nx = Engine::nextDistribution($jul, '09:00', 'America/New_York');1138
expect(gmdate('Y-m-d H:i', $nx) === '2026-07-14 13:00', 'NY 09:00 in summer (DST) = 13:00 UTC: ' . gmdate('Y-m-d H:i', $nx));1139
// US DST starts 2026-03-08: day before vs after differ by one hour in UTC.1140
$a1 = Engine::nextDistribution((new DateTime('2026-03-07 00:00', new DateTimeZone('UTC')))->getTimestamp(), '09:00', 'America/New_York');1141
$a2 = Engine::nextDistribution($a1, '09:00', 'America/New_York');1142
expect($a2 - $a1 === 23 * 3600, 'NY spring-forward: 09:00→09:00 is 23 real hours');1143
// A game uses its rules tz for distribution and cease-fire.1144
$gT = game(['a', 'b'], ['tz' => 'Asia/Tokyo', 'ap_time' => '08:00', 'jury' => false,1145
'ceasefire' => true, 'ceasefire_ranges' => [['start' => '22:00', 'end' => '06:00']]], $nov);1146
expect(gmdate('H:i', (int) $gT['next_distribution_at']) === '23:00', 'Tokyo 08:00 = 23:00 UTC');1147
$tokyo2330 = (new DateTime('2026-11-14 23:30', new DateTimeZone('Asia/Tokyo')))->getTimestamp();1148
$ams2330 = (new DateTime('2026-11-14 23:30', new DateTimeZone('Europe/Amsterdam')))->getTimestamp();1149
expect(Engine::ceasefireActive($gT, $tokyo2330), 'cease-fire active at 23:30 Tokyo');1150
expect(!Engine::ceasefireActive($gT, $ams2330), 'not active at 23:30 Amsterdam (07:30 Tokyo)');1151
$info = Engine::ceasefireInfo($gT, $tokyo2330);1152
expect((new DateTime('@' . $info['until']))->setTimezone(new DateTimeZone('Asia/Tokyo'))->format('Y-m-d H:i') === '2026-11-15 06:00',1153
'Tokyo cease-fire ends 06:00 next day (midnight wrap)');1154
expect(Engine::present($gT, 'a', $nov)['timezone'] === 'Asia/Tokyo', 'present() reports the rules zone');1155
1126
echo "Engine: no hearts, no buying lives (options do not exist)\n";1156
echo "Engine: no hearts, no buying lives (options do not exist)\n";1127
$n = Engine::normalizeRules(['hearts' => true, 'buy_lives' => true, 'buyLives' => true]);1157
$n = Engine::normalizeRules(['hearts' => true, 'buy_lives' => true, 'buyLives' => true]);1128
expect(!array_key_exists('hearts', $n) && !array_key_exists('buy_lives', $n) && !array_key_exists('buyLives', $n),1158
expect(!array_key_exists('hearts', $n) && !array_key_exists('buy_lives', $n) && !array_key_exists('buyLives', $n),@@ -63,6 +63,18 @@ try {
63
63
expect2($e->getMessage() === 'not_host', 'non-host refused');
64
64
}
65
65
66
// Only the host may change the rules (server-side, 403).
67
$before = $store->load($a['id'])['rules'];
68
try {
69
$store->setRules('local:test_user_2', $a['id'], ['jury' => false, 'ap_loot' => true]);
70
expect2(false, 'non-host setRules must throw');
71
} catch (RuntimeException $e) {
72
expect2($e->getMessage() === 'not_host', 'non-host setRules refused: not_host');
73
expect2(apiHttpStatus($e->getMessage()) === 403, 'not_host maps to HTTP 403');
74
}
75
expect2($store->load($a['id'])['rules'] === $before, 'rules unchanged after refused non-host update');
76
expect2(apiHttpStatus('login') === 401 && apiHttpStatus('csrf') === 403 && apiHttpStatus('no_ap') === 400, 'other status codes unchanged');
77
66
78
$g = $store->setRules('local:test_user_1', $a['id'], [
67
79
'jury' => true,
68
80
'shrinking_arena' => true,
@@ -63,6 +63,18 @@ try {63
expect2($e->getMessage() === 'not_host', 'non-host refused');63
expect2($e->getMessage() === 'not_host', 'non-host refused');64
}64
}65
65
66
// Only the host may change the rules (server-side, 403).67
$before = $store->load($a['id'])['rules'];68
try {69
$store->setRules('local:test_user_2', $a['id'], ['jury' => false, 'ap_loot' => true]);70
expect2(false, 'non-host setRules must throw');71
} catch (RuntimeException $e) {72
expect2($e->getMessage() === 'not_host', 'non-host setRules refused: not_host');73
expect2(apiHttpStatus($e->getMessage()) === 403, 'not_host maps to HTTP 403');74
}75
expect2($store->load($a['id'])['rules'] === $before, 'rules unchanged after refused non-host update');76
expect2(apiHttpStatus('login') === 401 && apiHttpStatus('csrf') === 403 && apiHttpStatus('no_ap') === 400, 'other status codes unchanged');77
66
$g = $store->setRules('local:test_user_1', $a['id'], [78
$g = $store->setRules('local:test_user_1', $a['id'], [67
'jury' => true,79
'jury' => true,68
'shrinking_arena' => true,80
'shrinking_arena' => true,@@ -460,7 +460,9 @@ App.toMenu = function ()
460
460
App.createLobby = function ()
461
461
{
462
462
showError('menu-error');
463
Api.createLobby(Rules.defaultRules()).then(function (data)
463
var initial = Rules.defaultRules();
464
initial.tz = App.viewTz(); // the host defines times in their own local zone
465
Api.createLobby(initial).then(function (data)
464
466
{
465
467
App.enter(data.game);
466
468
}).catch(function (err) { showError('menu-error', err); });
@@ -554,36 +556,40 @@ App.renderLobby = function ()
554
556
$('btn-start').hidden = !isHost;
555
557
$('btn-start').disabled = n < 2;
556
558
$('lobby-waiting').hidden = isHost;
557
// Rules
558
var r = g.rules || Rules.defaultRules();
559
$('rule-jury').checked = !!r.jury;
560
if ($('rule-ap-loot')) { $('rule-ap-loot').checked = !!r.ap_loot; }
561
if ($('rule-ap-time')) { $('rule-ap-time').value = r.ap_time || '00:00'; }
562
if (!isHost)
563
{
564
App.gridAuto = r.grid_auto !== false;
559
// Rules — patched in place. A focused field is never overwritten, and
560
// while the host has unsaved edits the local values win over the poll.
561
// Times are stored in the host's zone (rules.tz) and shown in ours.
562
var r = Rules.rulesInTz(g.rules || Rules.defaultRules(), App.viewTz(), Api.now());
563
var panel = $('lobby-rules');
564
panel.classList.toggle('readonly', !isHost);
565
$('rules-host-only').hidden = isHost;
566
var hold = isHost && App.lobbyRulesPending();
567
function setChecked(id, v) { var x = $(id); if (x && x !== document.activeElement && x.checked !== v) { x.checked = v; } }
568
function setValue(id, v) { var x = $(id); if (x && x !== document.activeElement && x.value !== v) { x.value = v; } }
569
if (!isHost) { App.gridAuto = r.grid_auto !== false; }
570
if (!hold)
571
{
572
setChecked('rule-jury', !!r.jury);
573
setChecked('rule-ap-loot', !!r.ap_loot);
574
setValue('rule-ap-time', r.ap_time || '00:00');
575
setChecked('rule-shrink', !!r.shrinking_arena);
576
setValue('rule-shrink-days', String(r.shrink_interval_days || 7));
577
setChecked('rule-ceasefire', !!r.ceasefire);
578
$('shrink-days-wrap').hidden = !r.shrinking_arena;
579
$('ceasefire-editor').hidden = !r.ceasefire;
580
App.renderCfEditor(r.ceasefire_ranges || [], isHost);
581
App.syncVisRadios(r, isHost);
565
582
}
566
583
var suggested = Rules.suggestedGrid(n);
567
if (App.gridAuto)
568
{
569
$('rule-grid').value = String(suggested);
570
}
571
else
572
{
573
$('rule-grid').value = String(Rules.clampGrid(r.grid || suggested));
574
}
584
setValue('rule-grid', String(App.gridAuto ? suggested : Rules.clampGrid(r.grid || suggested)));
575
585
App.echoGridSide();
576
$('rule-shrink').checked = !!r.shrinking_arena;
577
$('rule-shrink-days').value = r.shrink_interval_days || 7;
578
$('rule-ceasefire').checked = !!r.ceasefire;
579
$('shrink-days-wrap').hidden = !r.shrinking_arena;
580
$('ceasefire-editor').hidden = !r.ceasefire;
581
586
['rule-jury', 'rule-shrink', 'rule-ceasefire', 'rule-shrink-days', 'cf-add', 'rule-ap-loot', 'rule-ap-time', 'rule-grid', 'grid-use-suggested'].forEach(function (id)
582
587
{
583
588
if ($(id)) { $(id).disabled = !isHost; }
584
589
});
585
App.renderCfEditor(r.ceasefire_ranges || [], isHost);
586
App.syncVisRadios(r, isHost);
590
document.querySelectorAll('#lobby-visibility input').forEach(function (inp) { inp.disabled = !isHost; });
591
if (!isHost && App._cfClock) { App._cfClock.set(r.ceasefire_ranges || [], false); }
592
document.querySelectorAll('.tz-label').forEach(function (n) { n.textContent = App.tzLabel(); });
587
593
I18n.apply($('lobby'));
588
594
App.updateGridHint();
589
595
};
@@ -613,81 +619,185 @@ App.updateGridHint = function ()
613
619
614
620
App.currentCfRanges = function ()
615
621
{
622
App.localizeRules();
616
623
return (App.game && App.game.rules && App.game.rules.ceasefire_ranges) || [];
617
624
};
618
625
619
App.setCfRanges = function (ranges)
626
App.setCfRanges = function (ranges, opts)
620
627
{
621
628
if (!App.game.rules) { App.game.rules = Rules.defaultRules(); }
622
App.game.rules.ceasefire_ranges = Rules.normalizeRanges(ranges);
623
App.renderCfEditor(App.game.rules.ceasefire_ranges, App.game.host_id === App.game.you);
629
App.localizeRules();
630
App.game.rules.ceasefire_ranges = (ranges || []).map(function (r) { return { start: r.start, end: r.end }; });
631
App.renderCfEditor(App.game.rules.ceasefire_ranges, App.game.host_id === App.game.you, opts);
624
632
};
625
633
626
App.renderCfEditor = function (ranges, editable)
634
/** Mount the clock once; later calls patch it in place. */
635
App.cfClockCtl = function ()
627
636
{
628
CeasefireClock.render($('cf-clock'), ranges, {
629
editable: editable,
630
onChange: function (next)
631
{
632
App.setCfRanges(next);
633
App.onRulesChange();
634
}
635
});
637
var box = $('cf-clock');
638
if (!App._cfClock || App._cfClock.svg.parentNode !== box)
639
{
640
App._cfClock = CeasefireClock.mount(box, {
641
onChange: function (next)
642
{
643
App.setCfRanges(next);
644
App.onRulesChange();
645
}
646
});
647
}
648
return App._cfClock;
649
};
650
651
App.cfRowIndex = function (li)
652
{
653
return Array.prototype.indexOf.call($('cf-ranges').children, li);
654
};
655
656
/**
657
* Patch the range list in place. Rows are only added or removed at the end;
658
* a focused input is never overwritten, so typing is never interrupted.
659
*/
660
App.renderCfEditor = function (ranges, editable, opts)
661
{
662
opts = opts || {};
663
if (!opts.skipClock) { App.cfClockCtl().set(ranges, editable); }
636
664
var ul = $('cf-ranges');
637
ul.innerHTML = '';
665
var emptyLi = ul.querySelector('li.cf-empty');
638
666
if (!ranges.length)
639
667
{
640
var empty = document.createElement('li');
641
empty.className = 'hint';
642
empty.setAttribute('data-i18n', 'lobby.ceasefireEmpty');
643
empty.textContent = I18n.t('lobby.ceasefireEmpty');
644
ul.appendChild(empty);
668
Array.prototype.slice.call(ul.querySelectorAll('li.cf-row')).forEach(function (li)
669
{
670
if (!li.contains(document.activeElement)) { ul.removeChild(li); }
671
});
672
if (!ul.querySelector('li.cf-row') && !emptyLi)
673
{
674
var empty = document.createElement('li');
675
empty.className = 'hint cf-empty';
676
empty.setAttribute('data-i18n', 'lobby.ceasefireEmpty');
677
empty.textContent = I18n.t('lobby.ceasefireEmpty');
678
ul.appendChild(empty);
679
}
645
680
return;
646
681
}
647
ranges.forEach(function (r, i)
682
if (emptyLi) { ul.removeChild(emptyLi); }
683
var rows = ul.querySelectorAll('li.cf-row');
684
for (var i = rows.length; i < ranges.length; i++) { ul.appendChild(App.makeCfRow()); }
685
rows = ul.querySelectorAll('li.cf-row');
686
for (var j = rows.length - 1; j >= ranges.length; j--)
648
687
{
649
var li = document.createElement('li');
650
var a = document.createElement('input');
651
a.type = 'time';
652
a.value = r.start;
653
a.setAttribute('aria-label', I18n.t('lobby.ceasefireStart'));
654
a.disabled = !editable;
655
var b = document.createElement('input');
656
b.type = 'time';
657
b.value = r.end;
658
b.setAttribute('aria-label', I18n.t('lobby.ceasefireEnd'));
659
b.disabled = !editable;
660
function commit()
661
{
662
var next = App.currentCfRanges().slice();
663
next[i] = { start: a.value, end: b.value };
664
App.setCfRanges(next);
665
App.onRulesChange();
666
}
667
a.addEventListener('change', commit);
668
b.addEventListener('change', commit);
669
var rm = document.createElement('button');
670
rm.type = 'button';
671
rm.className = 'btn-secondary';
672
rm.textContent = I18n.t('lobby.ceasefireRemove');
673
rm.disabled = !editable;
674
rm.addEventListener('click', function ()
688
if (!rows[j].contains(document.activeElement)) { ul.removeChild(rows[j]); }
689
}
690
rows = ul.querySelectorAll('li.cf-row');
691
ranges.forEach(function (r, k)
692
{
693
var li = rows[k];
694
if (!li) { return; }
695
var ins = li.querySelectorAll('input');
696
[r.start, r.end].forEach(function (v, n)
675
697
{
676
var next = App.currentCfRanges().slice();
677
next.splice(i, 1);
678
App.setCfRanges(next);
679
App.onRulesChange();
698
if (ins[n] !== document.activeElement && ins[n].value !== v) { ins[n].value = v; }
699
ins[n].disabled = !editable;
680
700
});
681
li.appendChild(a);
682
li.appendChild(document.createTextNode('–'));
683
li.appendChild(b);
684
li.appendChild(rm);
685
ul.appendChild(li);
701
li.querySelector('button').disabled = !editable;
686
702
});
687
703
};
688
704
705
App.makeCfRow = function ()
706
{
707
var li = document.createElement('li');
708
li.className = 'cf-row';
709
var a = document.createElement('input');
710
a.type = 'time';
711
a.step = '60';
712
a.setAttribute('aria-label', I18n.t('lobby.ceasefireStart'));
713
a.className = 'cf-start';
714
var b = document.createElement('input');
715
b.type = 'time';
716
b.step = '60';
717
b.setAttribute('aria-label', I18n.t('lobby.ceasefireEnd'));
718
b.className = 'cf-end';
719
function commit()
720
{
721
var i = App.cfRowIndex(li);
722
if (i < 0 || !Rules.parseHm(a.value) || !Rules.parseHm(b.value)) { return; }
723
var next = App.currentCfRanges().map(function (r) { return { start: r.start, end: r.end }; });
724
next[i] = { start: a.value, end: b.value };
725
// Do not touch the list rows while typing; only redraw the clock.
726
App.game.rules.ceasefire_ranges = next;
727
App.cfClockCtl().set(Rules.normalizeRanges(next), true);
728
App.onRulesChange();
729
}
730
a.addEventListener('input', commit);
731
b.addEventListener('input', commit);
732
a.addEventListener('change', commit);
733
b.addEventListener('change', commit);
734
var rm = document.createElement('button');
735
rm.type = 'button';
736
rm.className = 'btn-secondary';
737
rm.setAttribute('data-i18n', 'lobby.ceasefireRemove');
738
rm.textContent = I18n.t('lobby.ceasefireRemove');
739
rm.addEventListener('click', function ()
740
{
741
var i = App.cfRowIndex(li);
742
if (i < 0) { return; }
743
var next = App.currentCfRanges().slice();
744
next.splice(i, 1);
745
ul_remove(li);
746
App.setCfRanges(next);
747
App.onRulesChange();
748
});
749
function ul_remove(node) { if (node.parentNode) { node.parentNode.removeChild(node); } }
750
li.appendChild(a);
751
li.appendChild(document.createTextNode('–'));
752
li.appendChild(b);
753
li.appendChild(rm);
754
return li;
755
};
756
757
/** The player's own IANA zone; all times are shown and entered in it. */
758
App.viewTz = function ()
759
{
760
if (!App._viewTz) { App._viewTz = Rules.localTz(); }
761
return App._viewTz;
762
};
763
764
/** Subtle zone label, e.g. "local time · Europe/Amsterdam". */
765
App.tzLabel = function ()
766
{
767
return I18n.t('time.local', { tz: App.viewTz() });
768
};
769
770
/**
771
* Before the host edits, express the stored rules in the host's current
772
* local zone, so every field the form shows and sends is in one zone.
773
*/
774
App.localizeRules = function ()
775
{
776
if (!App.game || !App.game.rules) { return; }
777
if (App.game.host_id !== App.game.you) { return; }
778
if (Rules.validTz(App.game.rules.tz) === App.viewTz()) { return; }
779
App.game.rules = Rules.rulesInTz(App.game.rules, App.viewTz(), Api.now());
780
};
781
782
/** True while the host is editing the rules form (focus or clock drag). */
783
App.lobbyInteracting = function ()
784
{
785
var panel = $('lobby-rules');
786
var a = document.activeElement;
787
var focused = !!(panel && a && a !== document.body && panel.contains(a)
788
&& /^(INPUT|SELECT|TEXTAREA)$/.test(a.tagName) && a.type !== 'checkbox' && a.type !== 'radio');
789
return focused || !!(App._cfClock && App._cfClock.active());
790
};
791
792
/** Local edits not yet confirmed by the server win over polled state. */
793
App.lobbyRulesPending = function ()
794
{
795
return !!(App.rulesDirty || App._rulesSaving || App.lobbyInteracting());
796
};
797
689
798
App.onRulesChange = function ()
690
799
{
800
App.localizeRules();
691
801
if (!App.game || App.game.status !== 'lobby') { return; }
692
802
if (App.game.host_id !== App.game.you) { return; }
693
803
$('shrink-days-wrap').hidden = !$('rule-shrink').checked;
@@ -700,27 +810,51 @@ App.onRulesChange = function ()
700
810
ceasefire_ranges: App.currentCfRanges(),
701
811
ap_loot: $('rule-ap-loot') ? $('rule-ap-loot').checked : false,
702
812
ap_time: ($('rule-ap-time') && $('rule-ap-time').value) ? $('rule-ap-time').value : '00:00',
813
tz: App.viewTz(),
703
814
grid: Rules.clampGrid($('rule-grid') ? $('rule-grid').value : Rules.suggestedGrid(1)),
704
815
grid_auto: App.gridAuto !== false
705
816
};
706
817
Object.assign(rules, App.readVisRules());
707
818
App.game.rules = Object.assign({}, App.game.rules, rules);
708
819
App.rulesDirty = true;
820
App.scheduleRulesSave();
821
};
822
823
/** Debounced save. Waits while the clock is being dragged. */
824
App.scheduleRulesSave = function ()
825
{
709
826
if (App._rulesTimer) { clearTimeout(App._rulesTimer); }
710
827
App._rulesTimer = setTimeout(function ()
711
828
{
712
if (!App.rulesDirty) { return; }
829
App._rulesTimer = null;
830
if (!App.rulesDirty || !App.game) { return; }
831
if (App._cfClock && App._cfClock.active()) { App.scheduleRulesSave(); return; }
832
if (App._rulesSaving) { App.scheduleRulesSave(); return; }
713
833
App.rulesDirty = false;
834
App._rulesSaving = true;
835
var sent = JSON.stringify(App.game.rules);
714
836
Api.setRules(App.game.id, App.game.rules).then(function (data)
715
837
{
838
App._rulesSaving = false;
839
if (!App.game || !data.game || data.game.id !== App.game.id) { return; }
840
var local = App.game.rules;
716
841
App.game = data.game;
717
if (data.game && data.game.rules)
842
if (App.rulesDirty || App.lobbyInteracting() || JSON.stringify(local) !== sent)
843
{
844
// Newer local edits are on the way; keep them.
845
App.game.rules = local;
846
}
847
else if (data.game.rules)
718
848
{
719
849
App.gridAuto = data.game.rules.grid_auto !== false;
720
850
}
721
851
App.renderLobby();
722
}).catch(function (err) { showError('lobby-error', err); });
723
}, 350);
852
}).catch(function (err)
853
{
854
App._rulesSaving = false;
855
showError('lobby-error', err);
856
});
857
}, 600);
724
858
};
725
859
726
860
App.copyInvite = function ()
@@ -1272,6 +1406,11 @@ App.poll = function ()
1272
1406
if (data.changed && data.game)
1273
1407
{
1274
1408
var stayOn = App._openChat && App._openChat.id;
1409
if (data.game.status === 'lobby' && App.game.status === 'lobby'
1410
&& App.game.host_id === App.game.you && App.lobbyRulesPending())
1411
{
1412
data.game.rules = App.game.rules;
1413
}
1275
1414
App.game = data.game;
1276
1415
if (App.screen === 'lobby' && data.game.status === 'lobby')
1277
1416
{ App.renderLobby(); }
@@ -1894,7 +2033,8 @@ var CeasefireClock = {
1894
2033
size: 320,
1895
2034
cx: 160,
1896
2035
cy: 160,
1897
r: 128
2036
r: 128,
2037
SNAP: 15
1898
2038
};
1899
2039
1900
2040
CeasefireClock.minsToAngle = function (mins)
@@ -1903,15 +2043,9 @@ CeasefireClock.minsToAngle = function (mins)
1903
2043
return (mins / 1440) * 2 * Math.PI - Math.PI / 2;
1904
2044
};
1905
2045
1906
CeasefireClock.angleToMins = function (ang)
2046
CeasefireClock.angleToMins = function (ang, step)
1907
2047
{
1908
// atan2: 0 at 3 o'clock, CCW. Convert to clockwise from top.
1909
var a = ang + Math.PI / 2;
1910
if (a < 0) { a += 2 * Math.PI; }
1911
var mins = Math.round((a / (2 * Math.PI)) * 1440 / 5) * 5;
1912
if (mins >= 1440) { mins = 0; }
1913
if (mins < 0) { mins = 0; }
1914
return mins;
2048
return Rules.angleToMinutes(ang, step || this.SNAP);
1915
2049
};
1916
2050
1917
2051
CeasefireClock.arcPath = function (r, startMin, endMin)
@@ -1933,237 +2067,193 @@ CeasefireClock.handlePos = function (mins)
1933
2067
return { x: this.cx + this.r * Math.cos(a), y: this.cy + this.r * Math.sin(a) };
1934
2068
};
1935
2069
1936
CeasefireClock.render = function (container, ranges, opts)
2070
/**
2071
* Mount a persistent clock in `container`. The SVG is built once; only the
2072
* slice and handle layers are redrawn, so pointer capture survives a drag
2073
* and outside re-renders never interrupt it. Returns a controller:
2074
* set(ranges, editable) — update in place (ignored while dragging)
2075
* active() — true while a pointer drag is in progress
2076
* opts.onChange(ranges) fires once on pointerup with the committed ranges.
2077
*/
2078
CeasefireClock.mount = function (container, opts)
1937
2079
{
1938
opts = opts || {};
1939
2080
var self = this;
1940
ranges = Rules.normalizeRanges(ranges || []);
1941
2081
var size = this.size;
1942
2082
var svgNS = 'http://www.w3.org/2000/svg';
1943
container.innerHTML = '';
1944
var svg = document.createElementNS(svgNS, 'svg');
1945
svg.setAttribute('viewBox', '0 0 ' + size + ' ' + size);
1946
svg.setAttribute('width', String(size));
1947
svg.setAttribute('height', String(size));
1948
svg.setAttribute('role', 'img');
1949
1950
2083
function el(name, attrs)
1951
2084
{
1952
2085
var n = document.createElementNS(svgNS, name);
1953
2086
Object.keys(attrs).forEach(function (k) { n.setAttribute(k, attrs[k]); });
1954
2087
return n;
1955
2088
}
1956
1957
// Allowed (gold) background disc
1958
svg.appendChild(el('circle', {
1959
cx: this.cx, cy: this.cy, r: this.r,
1960
fill: '#3a3420', stroke: '#e8c547', 'stroke-width': '3'
1961
}));
1962
1963
// Cease-fire slices (red)
1964
ranges.forEach(function (r, i)
1965
{
1966
var s = Rules.hmToMinutes(r.start);
1967
var e = Rules.hmToMinutes(r.end);
1968
var slices = e > s ? [[s, e]] : [[s, 1440], [0, e]];
1969
slices.forEach(function (sl)
1970
{
1971
if (sl[1] === sl[0]) { return; }
1972
svg.appendChild(el('path', {
1973
d: self.arcPath(self.r - 1, sl[0], sl[1]),
1974
fill: '#8a2a2a',
1975
'fill-opacity': '0.92',
1976
'data-range': String(i)
1977
}));
1978
});
1979
});
1980
1981
// Ticks and labels (0 at top, then 3, 6, 12, 18…)
2089
container.innerHTML = '';
2090
var svg = el('svg', { viewBox: '0 0 ' + size + ' ' + size, width: String(size), height: String(size), role: 'img' });
2091
svg.style.touchAction = 'none';
2092
svg.style.userSelect = 'none';
2093
svg.appendChild(el('circle', { cx: this.cx, cy: this.cy, r: this.r, fill: '#3a3420', stroke: '#e8c547', 'stroke-width': '3' }));
2094
var slices = el('g', { 'class': 'cf-slices' });
2095
svg.appendChild(slices);
1982
2096
for (var h = 0; h < 24; h++)
1983
2097
{
1984
var mins = h * 60;
1985
var a = this.minsToAngle(mins);
2098
var a = this.minsToAngle(h * 60);
1986
2099
var inner = this.r - (h % 3 === 0 ? 14 : 7);
1987
var outer = this.r;
1988
2100
svg.appendChild(el('line', {
1989
x1: this.cx + inner * Math.cos(a),
1990
y1: this.cy + inner * Math.sin(a),
1991
x2: this.cx + outer * Math.cos(a),
1992
y2: this.cy + outer * Math.sin(a),
1993
stroke: '#e8eaf2',
1994
'stroke-width': h % 6 === 0 ? '2.2' : '1',
1995
'stroke-opacity': '0.7'
2101
x1: this.cx + inner * Math.cos(a), y1: this.cy + inner * Math.sin(a),
2102
x2: this.cx + this.r * Math.cos(a), y2: this.cy + this.r * Math.sin(a),
2103
stroke: '#e8eaf2', 'stroke-width': h % 6 === 0 ? '2.2' : '1', 'stroke-opacity': '0.7',
2104
'pointer-events': 'none'
1996
2105
}));
1997
2106
if (h % 3 === 0)
1998
2107
{
1999
var tx = this.cx + (this.r + 22) * Math.cos(a);
2000
var ty = this.cy + (this.r + 22) * Math.sin(a);
2001
2108
var lab = el('text', {
2002
x: tx, y: ty,
2003
fill: '#e8c547',
2004
'font-size': '13',
2005
'font-weight': '700',
2006
'text-anchor': 'middle',
2007
'dominant-baseline': 'middle',
2008
'pointer-events': 'none'
2109
x: this.cx + (this.r + 22) * Math.cos(a), y: this.cy + (this.r + 22) * Math.sin(a),
2110
fill: '#e8c547', 'font-size': '13', 'font-weight': '700',
2111
'text-anchor': 'middle', 'dominant-baseline': 'middle', 'pointer-events': 'none'
2009
2112
});
2010
2113
lab.textContent = String(h);
2011
2114
svg.appendChild(lab);
2012
2115
}
2013
2116
}
2014
2015
// Inner hole so it looks like a ring-pie (keep a smaller gold disc for “now” later)
2016
svg.appendChild(el('circle', {
2017
cx: this.cx, cy: this.cy, r: 36,
2018
fill: '#0c1020', stroke: '#e8c54755', 'stroke-width': '1.5'
2019
}));
2020
var mid = el('text', {
2021
x: this.cx, y: this.cy + 1,
2022
fill: '#e8eaf2',
2023
'font-size': '11',
2024
'text-anchor': 'middle',
2025
'dominant-baseline': 'middle',
2026
'pointer-events': 'none'
2027
});
2117
svg.appendChild(el('circle', { cx: this.cx, cy: this.cy, r: 36, fill: '#0c1020', stroke: '#e8c54755', 'stroke-width': '1.5', 'pointer-events': 'none' }));
2118
var mid = el('text', { x: this.cx, y: this.cy + 1, fill: '#e8eaf2', 'font-size': '11', 'text-anchor': 'middle', 'dominant-baseline': 'middle', 'pointer-events': 'none' });
2028
2119
mid.textContent = '24h';
2029
2120
svg.appendChild(mid);
2121
var handles = el('g', { 'class': 'cf-handles' });
2122
svg.appendChild(handles);
2123
container.appendChild(svg);
2124
2125
var state = { ranges: [], editable: false, drag: null };
2030
2126
2031
// Handles
2032
if (opts.editable)
2127
function draw(ranges)
2033
2128
{
2129
while (slices.firstChild) { slices.removeChild(slices.firstChild); }
2130
while (handles.firstChild) { handles.removeChild(handles.firstChild); }
2034
2131
ranges.forEach(function (r, i)
2035
2132
{
2133
var s = Rules.hmToMinutes(r.start), e = Rules.hmToMinutes(r.end);
2134
var parts = e > s ? [[s, e]] : [[s, 1440], [0, e]];
2135
parts.forEach(function (sl)
2136
{
2137
if (sl[1] === sl[0]) { return; }
2138
slices.appendChild(el('path', { d: self.arcPath(self.r - 1, sl[0], sl[1]), fill: '#8a2a2a', 'fill-opacity': '0.92', 'data-range': String(i) }));
2139
});
2140
if (!state.editable) { return; }
2036
2141
['start', 'end'].forEach(function (which)
2037
2142
{
2038
2143
var pos = self.handlePos(Rules.hmToMinutes(r[which]));
2039
var c = el('circle', {
2040
cx: pos.x, cy: pos.y, r: 14,
2041
fill: '#e8c547',
2042
stroke: '#1a1404',
2043
'stroke-width': '2',
2044
'data-range': String(i),
2045
'data-which': which,
2046
style: 'cursor:grab; touch-action:none'
2047
});
2048
// invisible larger hit target
2049
var hit = el('circle', {
2050
cx: pos.x, cy: pos.y, r: 22,
2051
fill: 'transparent',
2052
'data-range': String(i),
2053
'data-which': which,
2054
style: 'cursor:grab; touch-action:none'
2055
});
2056
svg.appendChild(hit);
2057
svg.appendChild(c);
2144
handles.appendChild(el('circle', { cx: pos.x, cy: pos.y, r: 22, fill: 'transparent', 'data-range': String(i), 'data-which': which, style: 'cursor:grab' }));
2145
handles.appendChild(el('circle', { cx: pos.x, cy: pos.y, r: 14, fill: '#e8c547', stroke: '#1a1404', 'stroke-width': '2', 'data-range': String(i), 'data-which': which, 'class': 'cf-handle', style: 'cursor:grab' }));
2058
2146
});
2059
2147
});
2060
2148
}
2061
2149
2062
container.appendChild(svg);
2063
if (!opts.editable) { return; }
2064
2065
var drag = null;
2066
var painting = null;
2067
2068
function localMins(ev)
2150
function pointerMins(ev, step)
2069
2151
{
2070
2152
var rect = svg.getBoundingClientRect();
2071
var cx = ev.clientX != null ? ev.clientX : ev.touches[0].clientX;
2072
var cy = ev.clientY != null ? ev.clientY : ev.touches[0].clientY;
2073
var x = (cx - rect.left) / rect.width * size;
2074
var y = (cy - rect.top) / rect.height * size;
2075
return self.angleToMins(Math.atan2(y - self.cy, x - self.cx));
2153
var x = (ev.clientX - rect.left) / rect.width * size;
2154
var y = (ev.clientY - rect.top) / rect.height * size;
2155
return Rules.angleToMinutes(Math.atan2(y - self.cy, x - self.cx), step || self.SNAP);
2076
2156
}
2077
2157
2078
function commit(next)
2079
{
2080
if (opts.onChange) { opts.onChange(next); }
2081
}
2158
function copyRanges(rs) { return rs.map(function (r) { return { start: r.start, end: r.end }; }); }
2082
2159
2083
2160
svg.addEventListener('pointerdown', function (e)
2084
2161
{
2162
if (!state.editable) { return; }
2163
if (e.button != null && e.button > 0) { return; }
2085
2164
e.preventDefault();
2086
svg.setPointerCapture(e.pointerId);
2165
try { svg.setPointerCapture(e.pointerId); } catch (err) { /* old browsers */ }
2087
2166
var t = e.target;
2088
2167
var ri = t.getAttribute && t.getAttribute('data-range');
2089
2168
var which = t.getAttribute && t.getAttribute('data-which');
2169
var m = pointerMins(e);
2090
2170
if (ri != null && which)
2091
2171
{
2092
drag = { i: parseInt(ri, 10), which: which };
2093
return;
2172
state.drag = { kind: 'handle', id: e.pointerId, i: parseInt(ri, 10), which: which, work: copyRanges(state.ranges), moved: false };
2094
2173
}
2095
// Start a new range from this angle, drag to set the end.
2096
var m = localMins(e);
2097
painting = { start: m, end: (m + 60) % 1440 };
2174
else
2175
{
2176
// Paint a new range from here; direction follows the drag.
2177
state.drag = { kind: 'paint', id: e.pointerId, origin: m, last: m, sweep: 0, work: null, moved: false };
2178
}
2179
svg.classList.add('dragging');
2098
2180
});
2181
2099
2182
svg.addEventListener('pointermove', function (e)
2100
2183
{
2101
if (!drag && !painting) { return; }
2184
var d = state.drag;
2185
if (!d || e.pointerId !== d.id) { return; }
2102
2186
e.preventDefault();
2103
var m = localMins(e);
2104
if (drag)
2187
var m = pointerMins(e);
2188
if (d.kind === 'handle')
2105
2189
{
2106
var next = ranges.map(function (r) { return { start: r.start, end: r.end }; });
2107
if (!next[drag.i]) { return; }
2108
next[drag.i][drag.which] = Rules.minutesToHm(m);
2109
// Live preview
2110
self.render(container, next, opts);
2111
// re-bind happens via render → we need to keep dragging. Store on object.
2112
CeasefireClock._pending = { drag: drag, ranges: next, opts: opts, container: container };
2190
if (!d.work[d.i]) { return; }
2191
if (d.work[d.i][d.which] === Rules.minutesToHm(m)) { return; }
2192
d.work[d.i][d.which] = Rules.minutesToHm(m);
2193
d.moved = true;
2194
draw(d.work);
2113
2195
}
2114
else if (painting)
2196
else
2115
2197
{
2116
painting.end = m;
2117
var preview = ranges.concat([{
2118
start: Rules.minutesToHm(painting.start),
2119
end: Rules.minutesToHm(painting.end === painting.start ? (painting.start + 5) % 1440 : painting.end)
2120
}]);
2121
self.render(container, preview, opts);
2122
CeasefireClock._pending = { painting: painting, ranges: ranges, opts: opts, container: container };
2198
var step = m - d.last;
2199
if (step > 720) { step -= 1440; }
2200
if (step < -720) { step += 1440; }
2201
if (step === 0) { return; }
2202
d.sweep = Math.max(-1425, Math.min(1425, d.sweep + step));
2203
d.last = m;
2204
d.moved = d.sweep !== 0;
2205
var a = d.origin, b = m;
2206
var range = d.sweep >= 0 ? { start: Rules.minutesToHm(a), end: Rules.minutesToHm(b) } : { start: Rules.minutesToHm(b), end: Rules.minutesToHm(a) };
2207
d.work = d.moved && range.start !== range.end ? state.ranges.concat([range]) : null;
2208
draw(d.work || state.ranges);
2123
2209
}
2124
2210
});
2125
function endDrag(e)
2211
2212
function finish(e)
2126
2213
{
2127
var pending = CeasefireClock._pending;
2128
CeasefireClock._pending = null;
2129
if (drag && pending && pending.ranges)
2214
var d = state.drag;
2215
if (!d || (e && e.pointerId !== d.id)) { return; }
2216
state.drag = null;
2217
svg.classList.remove('dragging');
2218
try { svg.releasePointerCapture(d.id); } catch (err) { /* ignore */ }
2219
var cancelled = e && e.type === 'pointercancel';
2220
var next = (!cancelled && d.moved && d.work) ? Rules.normalizeRanges(d.work) : null;
2221
if (next)
2130
2222
{
2131
var d = drag;
2132
drag = null;
2133
commit(pending.ranges);
2134
return;
2223
state.ranges = next;
2224
draw(next);
2225
if (opts && opts.onChange) { opts.onChange(copyRanges(next)); }
2135
2226
}
2136
if (painting)
2227
else
2137
2228
{
2138
var p = painting;
2139
painting = null;
2140
if (p.start === p.end) { self.render(container, ranges, opts); return; }
2141
commit(ranges.concat([{
2142
start: Rules.minutesToHm(p.start),
2143
end: Rules.minutesToHm(p.end)
2144
}]));
2229
draw(state.ranges);
2145
2230
}
2146
drag = null;
2147
2231
}
2148
svg.addEventListener('pointerup', endDrag);
2149
svg.addEventListener('pointercancel', endDrag);
2232
svg.addEventListener('pointerup', finish);
2233
svg.addEventListener('pointercancel', finish);
2234
svg.addEventListener('lostpointercapture', function (e) { if (state.drag && e.pointerId === state.drag.id) { finish(e); } });
2235
2236
return {
2237
svg: svg,
2238
active: function () { return !!state.drag; },
2239
set: function (ranges, editable)
2240
{
2241
if (state.drag) { return; }
2242
state.editable = !!editable;
2243
state.ranges = Rules.normalizeRanges(ranges || []);
2244
svg.classList.toggle('readonly', !state.editable);
2245
draw(state.ranges);
2246
}
2247
};
2150
2248
};
2151
2249
2152
// Re-attach pointer handlers after a live-preview re-render by using
2153
// event delegation on the container (already on svg after each render).
2154
// The _pending flag lets pointermove after re-render continue: we also
2155
// bind at the document level during a drag.
2156
(function ()
2250
/** Back-compat: one-shot render (used by read-only previews). */
2251
CeasefireClock.render = function (container, ranges, opts)
2157
2252
{
2158
var active = false;
2159
document.addEventListener('pointermove', function (e)
2160
{
2161
var p = CeasefireClock._pending;
2162
if (!p || !p.opts) { return; }
2163
if (!p.drag && !p.painting) { return; }
2164
// The new svg already has handlers; this is a safety net no-op if they fire.
2165
});
2166
})();
2253
if (!container._cfClock) { container._cfClock = CeasefireClock.mount(container, opts || {}); }
2254
container._cfClock.set(ranges, !!(opts && opts.editable));
2255
return container._cfClock;
2256
};
2167
2257
2168
2258
/* boot */
2169
2259
if (typeof document !== 'undefined')
@@ -460,7 +460,9 @@ App.toMenu = function ()460
App.createLobby = function ()460
App.createLobby = function ()461
{461
{462
showError('menu-error');462
showError('menu-error');463
Api.createLobby(Rules.defaultRules()).then(function (data)463
var initial = Rules.defaultRules();464
initial.tz = App.viewTz(); // the host defines times in their own local zone465
Api.createLobby(initial).then(function (data)464
{466
{465
App.enter(data.game);467
App.enter(data.game);466
}).catch(function (err) { showError('menu-error', err); });468
}).catch(function (err) { showError('menu-error', err); });@@ -554,36 +556,40 @@ App.renderLobby = function ()554
$('btn-start').hidden = !isHost;556
$('btn-start').hidden = !isHost;555
$('btn-start').disabled = n < 2;557
$('btn-start').disabled = n < 2;556
$('lobby-waiting').hidden = isHost;558
$('lobby-waiting').hidden = isHost;557
// Rules559
// Rules — patched in place. A focused field is never overwritten, and558
var r = g.rules || Rules.defaultRules();560
// while the host has unsaved edits the local values win over the poll.559
$('rule-jury').checked = !!r.jury;561
// Times are stored in the host's zone (rules.tz) and shown in ours.560
if ($('rule-ap-loot')) { $('rule-ap-loot').checked = !!r.ap_loot; }562
var r = Rules.rulesInTz(g.rules || Rules.defaultRules(), App.viewTz(), Api.now());561
if ($('rule-ap-time')) { $('rule-ap-time').value = r.ap_time || '00:00'; }563
var panel = $('lobby-rules');562
if (!isHost)564
panel.classList.toggle('readonly', !isHost);563
{565
$('rules-host-only').hidden = isHost;564
App.gridAuto = r.grid_auto !== false;566
var hold = isHost && App.lobbyRulesPending();567
function setChecked(id, v) { var x = $(id); if (x && x !== document.activeElement && x.checked !== v) { x.checked = v; } }568
function setValue(id, v) { var x = $(id); if (x && x !== document.activeElement && x.value !== v) { x.value = v; } }569
if (!isHost) { App.gridAuto = r.grid_auto !== false; }570
if (!hold)571
{572
setChecked('rule-jury', !!r.jury);573
setChecked('rule-ap-loot', !!r.ap_loot);574
setValue('rule-ap-time', r.ap_time || '00:00');575
setChecked('rule-shrink', !!r.shrinking_arena);576
setValue('rule-shrink-days', String(r.shrink_interval_days || 7));577
setChecked('rule-ceasefire', !!r.ceasefire);578
$('shrink-days-wrap').hidden = !r.shrinking_arena;579
$('ceasefire-editor').hidden = !r.ceasefire;580
App.renderCfEditor(r.ceasefire_ranges || [], isHost);581
App.syncVisRadios(r, isHost);565
}582
}566
var suggested = Rules.suggestedGrid(n);583
var suggested = Rules.suggestedGrid(n);567
if (App.gridAuto)584
setValue('rule-grid', String(App.gridAuto ? suggested : Rules.clampGrid(r.grid || suggested)));568
{569
$('rule-grid').value = String(suggested);570
}571
else572
{573
$('rule-grid').value = String(Rules.clampGrid(r.grid || suggested));574
}575
App.echoGridSide();585
App.echoGridSide();576
$('rule-shrink').checked = !!r.shrinking_arena;577
$('rule-shrink-days').value = r.shrink_interval_days || 7;578
$('rule-ceasefire').checked = !!r.ceasefire;579
$('shrink-days-wrap').hidden = !r.shrinking_arena;580
$('ceasefire-editor').hidden = !r.ceasefire;581
['rule-jury', 'rule-shrink', 'rule-ceasefire', 'rule-shrink-days', 'cf-add', 'rule-ap-loot', 'rule-ap-time', 'rule-grid', 'grid-use-suggested'].forEach(function (id)586
['rule-jury', 'rule-shrink', 'rule-ceasefire', 'rule-shrink-days', 'cf-add', 'rule-ap-loot', 'rule-ap-time', 'rule-grid', 'grid-use-suggested'].forEach(function (id)582
{587
{583
if ($(id)) { $(id).disabled = !isHost; }588
if ($(id)) { $(id).disabled = !isHost; }584
});589
});585
App.renderCfEditor(r.ceasefire_ranges || [], isHost);590
document.querySelectorAll('#lobby-visibility input').forEach(function (inp) { inp.disabled = !isHost; });586
App.syncVisRadios(r, isHost);591
if (!isHost && App._cfClock) { App._cfClock.set(r.ceasefire_ranges || [], false); }592
document.querySelectorAll('.tz-label').forEach(function (n) { n.textContent = App.tzLabel(); });587
I18n.apply($('lobby'));593
I18n.apply($('lobby'));588
App.updateGridHint();594
App.updateGridHint();589
};595
};@@ -613,81 +619,185 @@ App.updateGridHint = function ()613
619
614
App.currentCfRanges = function ()620
App.currentCfRanges = function ()615
{621
{622
App.localizeRules();616
return (App.game && App.game.rules && App.game.rules.ceasefire_ranges) || [];623
return (App.game && App.game.rules && App.game.rules.ceasefire_ranges) || [];617
};624
};618
625
619
App.setCfRanges = function (ranges)626
App.setCfRanges = function (ranges, opts)620
{627
{621
if (!App.game.rules) { App.game.rules = Rules.defaultRules(); }628
if (!App.game.rules) { App.game.rules = Rules.defaultRules(); }622
App.game.rules.ceasefire_ranges = Rules.normalizeRanges(ranges);629
App.localizeRules();623
App.renderCfEditor(App.game.rules.ceasefire_ranges, App.game.host_id === App.game.you);630
App.game.rules.ceasefire_ranges = (ranges || []).map(function (r) { return { start: r.start, end: r.end }; });631
App.renderCfEditor(App.game.rules.ceasefire_ranges, App.game.host_id === App.game.you, opts);624
};632
};625
633
626
App.renderCfEditor = function (ranges, editable)634
/** Mount the clock once; later calls patch it in place. */635
App.cfClockCtl = function ()627
{636
{628
CeasefireClock.render($('cf-clock'), ranges, {637
var box = $('cf-clock');629
editable: editable,638
if (!App._cfClock || App._cfClock.svg.parentNode !== box)630
onChange: function (next)639
{631
{640
App._cfClock = CeasefireClock.mount(box, {632
App.setCfRanges(next);641
onChange: function (next)633
App.onRulesChange();642
{634
}643
App.setCfRanges(next);635
});644
App.onRulesChange();645
}646
});647
}648
return App._cfClock;649
};650
651
App.cfRowIndex = function (li)652
{653
return Array.prototype.indexOf.call($('cf-ranges').children, li);654
};655
656
/**657
* Patch the range list in place. Rows are only added or removed at the end;658
* a focused input is never overwritten, so typing is never interrupted.659
*/660
App.renderCfEditor = function (ranges, editable, opts)661
{662
opts = opts || {};663
if (!opts.skipClock) { App.cfClockCtl().set(ranges, editable); }636
var ul = $('cf-ranges');664
var ul = $('cf-ranges');637
ul.innerHTML = '';665
var emptyLi = ul.querySelector('li.cf-empty');638
if (!ranges.length)666
if (!ranges.length)639
{667
{640
var empty = document.createElement('li');668
Array.prototype.slice.call(ul.querySelectorAll('li.cf-row')).forEach(function (li)641
empty.className = 'hint';669
{642
empty.setAttribute('data-i18n', 'lobby.ceasefireEmpty');670
if (!li.contains(document.activeElement)) { ul.removeChild(li); }643
empty.textContent = I18n.t('lobby.ceasefireEmpty');671
});644
ul.appendChild(empty);672
if (!ul.querySelector('li.cf-row') && !emptyLi)673
{674
var empty = document.createElement('li');675
empty.className = 'hint cf-empty';676
empty.setAttribute('data-i18n', 'lobby.ceasefireEmpty');677
empty.textContent = I18n.t('lobby.ceasefireEmpty');678
ul.appendChild(empty);679
}645
return;680
return;646
}681
}647
ranges.forEach(function (r, i)682
if (emptyLi) { ul.removeChild(emptyLi); }683
var rows = ul.querySelectorAll('li.cf-row');684
for (var i = rows.length; i < ranges.length; i++) { ul.appendChild(App.makeCfRow()); }685
rows = ul.querySelectorAll('li.cf-row');686
for (var j = rows.length - 1; j >= ranges.length; j--)648
{687
{649
var li = document.createElement('li');688
if (!rows[j].contains(document.activeElement)) { ul.removeChild(rows[j]); }650
var a = document.createElement('input');689
}651
a.type = 'time';690
rows = ul.querySelectorAll('li.cf-row');652
a.value = r.start;691
ranges.forEach(function (r, k)653
a.setAttribute('aria-label', I18n.t('lobby.ceasefireStart'));692
{654
a.disabled = !editable;693
var li = rows[k];655
var b = document.createElement('input');694
if (!li) { return; }656
b.type = 'time';695
var ins = li.querySelectorAll('input');657
b.value = r.end;696
[r.start, r.end].forEach(function (v, n)658
b.setAttribute('aria-label', I18n.t('lobby.ceasefireEnd'));659
b.disabled = !editable;660
function commit()661
{662
var next = App.currentCfRanges().slice();663
next[i] = { start: a.value, end: b.value };664
App.setCfRanges(next);665
App.onRulesChange();666
}667
a.addEventListener('change', commit);668
b.addEventListener('change', commit);669
var rm = document.createElement('button');670
rm.type = 'button';671
rm.className = 'btn-secondary';672
rm.textContent = I18n.t('lobby.ceasefireRemove');673
rm.disabled = !editable;674
rm.addEventListener('click', function ()675
{697
{676
var next = App.currentCfRanges().slice();698
if (ins[n] !== document.activeElement && ins[n].value !== v) { ins[n].value = v; }677
next.splice(i, 1);699
ins[n].disabled = !editable;678
App.setCfRanges(next);679
App.onRulesChange();680
});700
});681
li.appendChild(a);701
li.querySelector('button').disabled = !editable;682
li.appendChild(document.createTextNode('–'));683
li.appendChild(b);684
li.appendChild(rm);685
ul.appendChild(li);686
});702
});687
};703
};688
704
705
App.makeCfRow = function ()706
{707
var li = document.createElement('li');708
li.className = 'cf-row';709
var a = document.createElement('input');710
a.type = 'time';711
a.step = '60';712
a.setAttribute('aria-label', I18n.t('lobby.ceasefireStart'));713
a.className = 'cf-start';714
var b = document.createElement('input');715
b.type = 'time';716
b.step = '60';717
b.setAttribute('aria-label', I18n.t('lobby.ceasefireEnd'));718
b.className = 'cf-end';719
function commit()720
{721
var i = App.cfRowIndex(li);722
if (i < 0 || !Rules.parseHm(a.value) || !Rules.parseHm(b.value)) { return; }723
var next = App.currentCfRanges().map(function (r) { return { start: r.start, end: r.end }; });724
next[i] = { start: a.value, end: b.value };725
// Do not touch the list rows while typing; only redraw the clock.726
App.game.rules.ceasefire_ranges = next;727
App.cfClockCtl().set(Rules.normalizeRanges(next), true);728
App.onRulesChange();729
}730
a.addEventListener('input', commit);731
b.addEventListener('input', commit);732
a.addEventListener('change', commit);733
b.addEventListener('change', commit);734
var rm = document.createElement('button');735
rm.type = 'button';736
rm.className = 'btn-secondary';737
rm.setAttribute('data-i18n', 'lobby.ceasefireRemove');738
rm.textContent = I18n.t('lobby.ceasefireRemove');739
rm.addEventListener('click', function ()740
{741
var i = App.cfRowIndex(li);742
if (i < 0) { return; }743
var next = App.currentCfRanges().slice();744
next.splice(i, 1);745
ul_remove(li);746
App.setCfRanges(next);747
App.onRulesChange();748
});749
function ul_remove(node) { if (node.parentNode) { node.parentNode.removeChild(node); } }750
li.appendChild(a);751
li.appendChild(document.createTextNode('–'));752
li.appendChild(b);753
li.appendChild(rm);754
return li;755
};756
757
/** The player's own IANA zone; all times are shown and entered in it. */758
App.viewTz = function ()759
{760
if (!App._viewTz) { App._viewTz = Rules.localTz(); }761
return App._viewTz;762
};763
764
/** Subtle zone label, e.g. "local time · Europe/Amsterdam". */765
App.tzLabel = function ()766
{767
return I18n.t('time.local', { tz: App.viewTz() });768
};769
770
/**771
* Before the host edits, express the stored rules in the host's current772
* local zone, so every field the form shows and sends is in one zone.773
*/774
App.localizeRules = function ()775
{776
if (!App.game || !App.game.rules) { return; }777
if (App.game.host_id !== App.game.you) { return; }778
if (Rules.validTz(App.game.rules.tz) === App.viewTz()) { return; }779
App.game.rules = Rules.rulesInTz(App.game.rules, App.viewTz(), Api.now());780
};781
782
/** True while the host is editing the rules form (focus or clock drag). */783
App.lobbyInteracting = function ()784
{785
var panel = $('lobby-rules');786
var a = document.activeElement;787
var focused = !!(panel && a && a !== document.body && panel.contains(a)788
&& /^(INPUT|SELECT|TEXTAREA)$/.test(a.tagName) && a.type !== 'checkbox' && a.type !== 'radio');789
return focused || !!(App._cfClock && App._cfClock.active());790
};791
792
/** Local edits not yet confirmed by the server win over polled state. */793
App.lobbyRulesPending = function ()794
{795
return !!(App.rulesDirty || App._rulesSaving || App.lobbyInteracting());796
};797
689
App.onRulesChange = function ()798
App.onRulesChange = function ()690
{799
{800
App.localizeRules();691
if (!App.game || App.game.status !== 'lobby') { return; }801
if (!App.game || App.game.status !== 'lobby') { return; }692
if (App.game.host_id !== App.game.you) { return; }802
if (App.game.host_id !== App.game.you) { return; }693
$('shrink-days-wrap').hidden = !$('rule-shrink').checked;803
$('shrink-days-wrap').hidden = !$('rule-shrink').checked;@@ -700,27 +810,51 @@ App.onRulesChange = function ()700
ceasefire_ranges: App.currentCfRanges(),810
ceasefire_ranges: App.currentCfRanges(),701
ap_loot: $('rule-ap-loot') ? $('rule-ap-loot').checked : false,811
ap_loot: $('rule-ap-loot') ? $('rule-ap-loot').checked : false,702
ap_time: ($('rule-ap-time') && $('rule-ap-time').value) ? $('rule-ap-time').value : '00:00',812
ap_time: ($('rule-ap-time') && $('rule-ap-time').value) ? $('rule-ap-time').value : '00:00',813
tz: App.viewTz(),703
grid: Rules.clampGrid($('rule-grid') ? $('rule-grid').value : Rules.suggestedGrid(1)),814
grid: Rules.clampGrid($('rule-grid') ? $('rule-grid').value : Rules.suggestedGrid(1)),704
grid_auto: App.gridAuto !== false815
grid_auto: App.gridAuto !== false705
};816
};706
Object.assign(rules, App.readVisRules());817
Object.assign(rules, App.readVisRules());707
App.game.rules = Object.assign({}, App.game.rules, rules);818
App.game.rules = Object.assign({}, App.game.rules, rules);708
App.rulesDirty = true;819
App.rulesDirty = true;820
App.scheduleRulesSave();821
};822
823
/** Debounced save. Waits while the clock is being dragged. */824
App.scheduleRulesSave = function ()825
{709
if (App._rulesTimer) { clearTimeout(App._rulesTimer); }826
if (App._rulesTimer) { clearTimeout(App._rulesTimer); }710
App._rulesTimer = setTimeout(function ()827
App._rulesTimer = setTimeout(function ()711
{828
{712
if (!App.rulesDirty) { return; }829
App._rulesTimer = null;830
if (!App.rulesDirty || !App.game) { return; }831
if (App._cfClock && App._cfClock.active()) { App.scheduleRulesSave(); return; }832
if (App._rulesSaving) { App.scheduleRulesSave(); return; }713
App.rulesDirty = false;833
App.rulesDirty = false;834
App._rulesSaving = true;835
var sent = JSON.stringify(App.game.rules);714
Api.setRules(App.game.id, App.game.rules).then(function (data)836
Api.setRules(App.game.id, App.game.rules).then(function (data)715
{837
{838
App._rulesSaving = false;839
if (!App.game || !data.game || data.game.id !== App.game.id) { return; }840
var local = App.game.rules;716
App.game = data.game;841
App.game = data.game;717
if (data.game && data.game.rules)842
if (App.rulesDirty || App.lobbyInteracting() || JSON.stringify(local) !== sent)843
{844
// Newer local edits are on the way; keep them.845
App.game.rules = local;846
}847
else if (data.game.rules)718
{848
{719
App.gridAuto = data.game.rules.grid_auto !== false;849
App.gridAuto = data.game.rules.grid_auto !== false;720
}850
}721
App.renderLobby();851
App.renderLobby();722
}).catch(function (err) { showError('lobby-error', err); });852
}).catch(function (err)723
}, 350);853
{854
App._rulesSaving = false;855
showError('lobby-error', err);856
});857
}, 600);724
};858
};725
859
726
App.copyInvite = function ()860
App.copyInvite = function ()@@ -1272,6 +1406,11 @@ App.poll = function ()1272
if (data.changed && data.game)1406
if (data.changed && data.game)1273
{1407
{1274
var stayOn = App._openChat && App._openChat.id;1408
var stayOn = App._openChat && App._openChat.id;1409
if (data.game.status === 'lobby' && App.game.status === 'lobby'1410
&& App.game.host_id === App.game.you && App.lobbyRulesPending())1411
{1412
data.game.rules = App.game.rules;1413
}1275
App.game = data.game;1414
App.game = data.game;1276
if (App.screen === 'lobby' && data.game.status === 'lobby')1415
if (App.screen === 'lobby' && data.game.status === 'lobby')1277
{ App.renderLobby(); }1416
{ App.renderLobby(); }@@ -1894,7 +2033,8 @@ var CeasefireClock = {1894
size: 320,2033
size: 320,1895
cx: 160,2034
cx: 160,1896
cy: 160,2035
cy: 160,1897
r: 1282036
r: 128,2037
SNAP: 151898
};2038
};1899
2039
1900
CeasefireClock.minsToAngle = function (mins)2040
CeasefireClock.minsToAngle = function (mins)@@ -1903,15 +2043,9 @@ CeasefireClock.minsToAngle = function (mins)1903
return (mins / 1440) * 2 * Math.PI - Math.PI / 2;2043
return (mins / 1440) * 2 * Math.PI - Math.PI / 2;1904
};2044
};1905
2045
1906
CeasefireClock.angleToMins = function (ang)2046
CeasefireClock.angleToMins = function (ang, step)1907
{2047
{1908
// atan2: 0 at 3 o'clock, CCW. Convert to clockwise from top.2048
return Rules.angleToMinutes(ang, step || this.SNAP);1909
var a = ang + Math.PI / 2;1910
if (a < 0) { a += 2 * Math.PI; }1911
var mins = Math.round((a / (2 * Math.PI)) * 1440 / 5) * 5;1912
if (mins >= 1440) { mins = 0; }1913
if (mins < 0) { mins = 0; }1914
return mins;1915
};2049
};1916
2050
1917
CeasefireClock.arcPath = function (r, startMin, endMin)2051
CeasefireClock.arcPath = function (r, startMin, endMin)@@ -1933,237 +2067,193 @@ CeasefireClock.handlePos = function (mins)1933
return { x: this.cx + this.r * Math.cos(a), y: this.cy + this.r * Math.sin(a) };2067
return { x: this.cx + this.r * Math.cos(a), y: this.cy + this.r * Math.sin(a) };1934
};2068
};1935
2069
1936
CeasefireClock.render = function (container, ranges, opts)2070
/**2071
* Mount a persistent clock in `container`. The SVG is built once; only the2072
* slice and handle layers are redrawn, so pointer capture survives a drag2073
* and outside re-renders never interrupt it. Returns a controller:2074
* set(ranges, editable) — update in place (ignored while dragging)2075
* active() — true while a pointer drag is in progress2076
* opts.onChange(ranges) fires once on pointerup with the committed ranges.2077
*/2078
CeasefireClock.mount = function (container, opts)1937
{2079
{1938
opts = opts || {};1939
var self = this;2080
var self = this;1940
ranges = Rules.normalizeRanges(ranges || []);1941
var size = this.size;2081
var size = this.size;1942
var svgNS = 'http://www.w3.org/2000/svg';2082
var svgNS = 'http://www.w3.org/2000/svg';1943
container.innerHTML = '';1944
var svg = document.createElementNS(svgNS, 'svg');1945
svg.setAttribute('viewBox', '0 0 ' + size + ' ' + size);1946
svg.setAttribute('width', String(size));1947
svg.setAttribute('height', String(size));1948
svg.setAttribute('role', 'img');1949
1950
function el(name, attrs)2083
function el(name, attrs)1951
{2084
{1952
var n = document.createElementNS(svgNS, name);2085
var n = document.createElementNS(svgNS, name);1953
Object.keys(attrs).forEach(function (k) { n.setAttribute(k, attrs[k]); });2086
Object.keys(attrs).forEach(function (k) { n.setAttribute(k, attrs[k]); });1954
return n;2087
return n;1955
}2088
}1956
2089
container.innerHTML = '';1957
// Allowed (gold) background disc2090
var svg = el('svg', { viewBox: '0 0 ' + size + ' ' + size, width: String(size), height: String(size), role: 'img' });1958
svg.appendChild(el('circle', {2091
svg.style.touchAction = 'none';1959
cx: this.cx, cy: this.cy, r: this.r,2092
svg.style.userSelect = 'none';1960
fill: '#3a3420', stroke: '#e8c547', 'stroke-width': '3'2093
svg.appendChild(el('circle', { cx: this.cx, cy: this.cy, r: this.r, fill: '#3a3420', stroke: '#e8c547', 'stroke-width': '3' }));1961
}));2094
var slices = el('g', { 'class': 'cf-slices' });1962
2095
svg.appendChild(slices);1963
// Cease-fire slices (red)1964
ranges.forEach(function (r, i)1965
{1966
var s = Rules.hmToMinutes(r.start);1967
var e = Rules.hmToMinutes(r.end);1968
var slices = e > s ? [[s, e]] : [[s, 1440], [0, e]];1969
slices.forEach(function (sl)1970
{1971
if (sl[1] === sl[0]) { return; }1972
svg.appendChild(el('path', {1973
d: self.arcPath(self.r - 1, sl[0], sl[1]),1974
fill: '#8a2a2a',1975
'fill-opacity': '0.92',1976
'data-range': String(i)1977
}));1978
});1979
});1980
1981
// Ticks and labels (0 at top, then 3, 6, 12, 18…)1982
for (var h = 0; h < 24; h++)2096
for (var h = 0; h < 24; h++)1983
{2097
{1984
var mins = h * 60;2098
var a = this.minsToAngle(h * 60);1985
var a = this.minsToAngle(mins);1986
var inner = this.r - (h % 3 === 0 ? 14 : 7);2099
var inner = this.r - (h % 3 === 0 ? 14 : 7);1987
var outer = this.r;1988
svg.appendChild(el('line', {2100
svg.appendChild(el('line', {1989
x1: this.cx + inner * Math.cos(a),2101
x1: this.cx + inner * Math.cos(a), y1: this.cy + inner * Math.sin(a),1990
y1: this.cy + inner * Math.sin(a),2102
x2: this.cx + this.r * Math.cos(a), y2: this.cy + this.r * Math.sin(a),1991
x2: this.cx + outer * Math.cos(a),2103
stroke: '#e8eaf2', 'stroke-width': h % 6 === 0 ? '2.2' : '1', 'stroke-opacity': '0.7',1992
y2: this.cy + outer * Math.sin(a),2104
'pointer-events': 'none'1993
stroke: '#e8eaf2',1994
'stroke-width': h % 6 === 0 ? '2.2' : '1',1995
'stroke-opacity': '0.7'1996
}));2105
}));1997
if (h % 3 === 0)2106
if (h % 3 === 0)1998
{2107
{1999
var tx = this.cx + (this.r + 22) * Math.cos(a);2000
var ty = this.cy + (this.r + 22) * Math.sin(a);2001
var lab = el('text', {2108
var lab = el('text', {2002
x: tx, y: ty,2109
x: this.cx + (this.r + 22) * Math.cos(a), y: this.cy + (this.r + 22) * Math.sin(a),2003
fill: '#e8c547',2110
fill: '#e8c547', 'font-size': '13', 'font-weight': '700',2004
'font-size': '13',2111
'text-anchor': 'middle', 'dominant-baseline': 'middle', 'pointer-events': 'none'2005
'font-weight': '700',2006
'text-anchor': 'middle',2007
'dominant-baseline': 'middle',2008
'pointer-events': 'none'2009
});2112
});2010
lab.textContent = String(h);2113
lab.textContent = String(h);2011
svg.appendChild(lab);2114
svg.appendChild(lab);2012
}2115
}2013
}2116
}2014
2117
svg.appendChild(el('circle', { cx: this.cx, cy: this.cy, r: 36, fill: '#0c1020', stroke: '#e8c54755', 'stroke-width': '1.5', 'pointer-events': 'none' }));2015
// Inner hole so it looks like a ring-pie (keep a smaller gold disc for “now” later)2118
var mid = el('text', { x: this.cx, y: this.cy + 1, fill: '#e8eaf2', 'font-size': '11', 'text-anchor': 'middle', 'dominant-baseline': 'middle', 'pointer-events': 'none' });2016
svg.appendChild(el('circle', {2017
cx: this.cx, cy: this.cy, r: 36,2018
fill: '#0c1020', stroke: '#e8c54755', 'stroke-width': '1.5'2019
}));2020
var mid = el('text', {2021
x: this.cx, y: this.cy + 1,2022
fill: '#e8eaf2',2023
'font-size': '11',2024
'text-anchor': 'middle',2025
'dominant-baseline': 'middle',2026
'pointer-events': 'none'2027
});2028
mid.textContent = '24h';2119
mid.textContent = '24h';2029
svg.appendChild(mid);2120
svg.appendChild(mid);2121
var handles = el('g', { 'class': 'cf-handles' });2122
svg.appendChild(handles);2123
container.appendChild(svg);2124
2125
var state = { ranges: [], editable: false, drag: null };2030
2126
2031
// Handles2127
function draw(ranges)2032
if (opts.editable)2033
{2128
{2129
while (slices.firstChild) { slices.removeChild(slices.firstChild); }2130
while (handles.firstChild) { handles.removeChild(handles.firstChild); }2034
ranges.forEach(function (r, i)2131
ranges.forEach(function (r, i)2035
{2132
{2133
var s = Rules.hmToMinutes(r.start), e = Rules.hmToMinutes(r.end);2134
var parts = e > s ? [[s, e]] : [[s, 1440], [0, e]];2135
parts.forEach(function (sl)2136
{2137
if (sl[1] === sl[0]) { return; }2138
slices.appendChild(el('path', { d: self.arcPath(self.r - 1, sl[0], sl[1]), fill: '#8a2a2a', 'fill-opacity': '0.92', 'data-range': String(i) }));2139
});2140
if (!state.editable) { return; }2036
['start', 'end'].forEach(function (which)2141
['start', 'end'].forEach(function (which)2037
{2142
{2038
var pos = self.handlePos(Rules.hmToMinutes(r[which]));2143
var pos = self.handlePos(Rules.hmToMinutes(r[which]));2039
var c = el('circle', {2144
handles.appendChild(el('circle', { cx: pos.x, cy: pos.y, r: 22, fill: 'transparent', 'data-range': String(i), 'data-which': which, style: 'cursor:grab' }));2040
cx: pos.x, cy: pos.y, r: 14,2145
handles.appendChild(el('circle', { cx: pos.x, cy: pos.y, r: 14, fill: '#e8c547', stroke: '#1a1404', 'stroke-width': '2', 'data-range': String(i), 'data-which': which, 'class': 'cf-handle', style: 'cursor:grab' }));2041
fill: '#e8c547',2042
stroke: '#1a1404',2043
'stroke-width': '2',2044
'data-range': String(i),2045
'data-which': which,2046
style: 'cursor:grab; touch-action:none'2047
});2048
// invisible larger hit target2049
var hit = el('circle', {2050
cx: pos.x, cy: pos.y, r: 22,2051
fill: 'transparent',2052
'data-range': String(i),2053
'data-which': which,2054
style: 'cursor:grab; touch-action:none'2055
});2056
svg.appendChild(hit);2057
svg.appendChild(c);2058
});2146
});2059
});2147
});2060
}2148
}2061
2149
2062
container.appendChild(svg);2150
function pointerMins(ev, step)2063
if (!opts.editable) { return; }2064
2065
var drag = null;2066
var painting = null;2067
2068
function localMins(ev)2069
{2151
{2070
var rect = svg.getBoundingClientRect();2152
var rect = svg.getBoundingClientRect();2071
var cx = ev.clientX != null ? ev.clientX : ev.touches[0].clientX;2153
var x = (ev.clientX - rect.left) / rect.width * size;2072
var cy = ev.clientY != null ? ev.clientY : ev.touches[0].clientY;2154
var y = (ev.clientY - rect.top) / rect.height * size;2073
var x = (cx - rect.left) / rect.width * size;2155
return Rules.angleToMinutes(Math.atan2(y - self.cy, x - self.cx), step || self.SNAP);2074
var y = (cy - rect.top) / rect.height * size;2075
return self.angleToMins(Math.atan2(y - self.cy, x - self.cx));2076
}2156
}2077
2157
2078
function commit(next)2158
function copyRanges(rs) { return rs.map(function (r) { return { start: r.start, end: r.end }; }); }2079
{2080
if (opts.onChange) { opts.onChange(next); }2081
}2082
2159
2083
svg.addEventListener('pointerdown', function (e)2160
svg.addEventListener('pointerdown', function (e)2084
{2161
{2162
if (!state.editable) { return; }2163
if (e.button != null && e.button > 0) { return; }2085
e.preventDefault();2164
e.preventDefault();2086
svg.setPointerCapture(e.pointerId);2165
try { svg.setPointerCapture(e.pointerId); } catch (err) { /* old browsers */ }2087
var t = e.target;2166
var t = e.target;2088
var ri = t.getAttribute && t.getAttribute('data-range');2167
var ri = t.getAttribute && t.getAttribute('data-range');2089
var which = t.getAttribute && t.getAttribute('data-which');2168
var which = t.getAttribute && t.getAttribute('data-which');2169
var m = pointerMins(e);2090
if (ri != null && which)2170
if (ri != null && which)2091
{2171
{2092
drag = { i: parseInt(ri, 10), which: which };2172
state.drag = { kind: 'handle', id: e.pointerId, i: parseInt(ri, 10), which: which, work: copyRanges(state.ranges), moved: false };2093
return;2094
}2173
}2095
// Start a new range from this angle, drag to set the end.2174
else2096
var m = localMins(e);2175
{2097
painting = { start: m, end: (m + 60) % 1440 };2176
// Paint a new range from here; direction follows the drag.2177
state.drag = { kind: 'paint', id: e.pointerId, origin: m, last: m, sweep: 0, work: null, moved: false };2178
}2179
svg.classList.add('dragging');2098
});2180
});2181
2099
svg.addEventListener('pointermove', function (e)2182
svg.addEventListener('pointermove', function (e)2100
{2183
{2101
if (!drag && !painting) { return; }2184
var d = state.drag;2185
if (!d || e.pointerId !== d.id) { return; }2102
e.preventDefault();2186
e.preventDefault();2103
var m = localMins(e);2187
var m = pointerMins(e);2104
if (drag)2188
if (d.kind === 'handle')2105
{2189
{2106
var next = ranges.map(function (r) { return { start: r.start, end: r.end }; });2190
if (!d.work[d.i]) { return; }2107
if (!next[drag.i]) { return; }2191
if (d.work[d.i][d.which] === Rules.minutesToHm(m)) { return; }2108
next[drag.i][drag.which] = Rules.minutesToHm(m);2192
d.work[d.i][d.which] = Rules.minutesToHm(m);2109
// Live preview2193
d.moved = true;2110
self.render(container, next, opts);2194
draw(d.work);2111
// re-bind happens via render → we need to keep dragging. Store on object.2112
CeasefireClock._pending = { drag: drag, ranges: next, opts: opts, container: container };2113
}2195
}2114
else if (painting)2196
else2115
{2197
{2116
painting.end = m;2198
var step = m - d.last;2117
var preview = ranges.concat([{2199
if (step > 720) { step -= 1440; }2118
start: Rules.minutesToHm(painting.start),2200
if (step < -720) { step += 1440; }2119
end: Rules.minutesToHm(painting.end === painting.start ? (painting.start + 5) % 1440 : painting.end)2201
if (step === 0) { return; }2120
}]);2202
d.sweep = Math.max(-1425, Math.min(1425, d.sweep + step));2121
self.render(container, preview, opts);2203
d.last = m;2122
CeasefireClock._pending = { painting: painting, ranges: ranges, opts: opts, container: container };2204
d.moved = d.sweep !== 0;2205
var a = d.origin, b = m;2206
var range = d.sweep >= 0 ? { start: Rules.minutesToHm(a), end: Rules.minutesToHm(b) } : { start: Rules.minutesToHm(b), end: Rules.minutesToHm(a) };2207
d.work = d.moved && range.start !== range.end ? state.ranges.concat([range]) : null;2208
draw(d.work || state.ranges);2123
}2209
}2124
});2210
});2125
function endDrag(e)2211
2212
function finish(e)2126
{2213
{2127
var pending = CeasefireClock._pending;2214
var d = state.drag;2128
CeasefireClock._pending = null;2215
if (!d || (e && e.pointerId !== d.id)) { return; }2129
if (drag && pending && pending.ranges)2216
state.drag = null;2217
svg.classList.remove('dragging');2218
try { svg.releasePointerCapture(d.id); } catch (err) { /* ignore */ }2219
var cancelled = e && e.type === 'pointercancel';2220
var next = (!cancelled && d.moved && d.work) ? Rules.normalizeRanges(d.work) : null;2221
if (next)2130
{2222
{2131
var d = drag;2223
state.ranges = next;2132
drag = null;2224
draw(next);2133
commit(pending.ranges);2225
if (opts && opts.onChange) { opts.onChange(copyRanges(next)); }2134
return;2135
}2226
}2136
if (painting)2227
else2137
{2228
{2138
var p = painting;2229
draw(state.ranges);2139
painting = null;2140
if (p.start === p.end) { self.render(container, ranges, opts); return; }2141
commit(ranges.concat([{2142
start: Rules.minutesToHm(p.start),2143
end: Rules.minutesToHm(p.end)2144
}]));2145
}2230
}2146
drag = null;2147
}2231
}2148
svg.addEventListener('pointerup', endDrag);2232
svg.addEventListener('pointerup', finish);2149
svg.addEventListener('pointercancel', endDrag);2233
svg.addEventListener('pointercancel', finish);2234
svg.addEventListener('lostpointercapture', function (e) { if (state.drag && e.pointerId === state.drag.id) { finish(e); } });2235
2236
return {2237
svg: svg,2238
active: function () { return !!state.drag; },2239
set: function (ranges, editable)2240
{2241
if (state.drag) { return; }2242
state.editable = !!editable;2243
state.ranges = Rules.normalizeRanges(ranges || []);2244
svg.classList.toggle('readonly', !state.editable);2245
draw(state.ranges);2246
}2247
};2150
};2248
};2151
2249
2152
// Re-attach pointer handlers after a live-preview re-render by using2250
/** Back-compat: one-shot render (used by read-only previews). */2153
// event delegation on the container (already on svg after each render).2251
CeasefireClock.render = function (container, ranges, opts)2154
// The _pending flag lets pointermove after re-render continue: we also2155
// bind at the document level during a drag.2156
(function ()2157
{2252
{2158
var active = false;2253
if (!container._cfClock) { container._cfClock = CeasefireClock.mount(container, opts || {}); }2159
document.addEventListener('pointermove', function (e)2254
container._cfClock.set(ranges, !!(opts && opts.editable));2160
{2255
return container._cfClock;2161
var p = CeasefireClock._pending;2256
};2162
if (!p || !p.opts) { return; }2163
if (!p.drag && !p.painting) { return; }2164
// The new svg already has handlers; this is a safety net no-op if they fire.2165
});2166
})();2167
2257
2168
/* boot */2258
/* boot */2169
if (typeof document !== 'undefined')2259
if (typeof document !== 'undefined')@@ -34,6 +34,7 @@ Rules.defaultRules = function ()
34
34
ceasefire_ranges: [],
35
35
ap_loot: false,
36
36
ap_time: '00:00',
37
tz: this.TZ,
37
38
vis_shots: 'public',
38
39
vis_gifts: 'public',
39
40
vis_ap: 'public',
@@ -86,6 +87,20 @@ Rules.isPassable = function (size, inset, x, y)
86
87
&& x >= inset && y >= inset && x < size - inset && y < size - inset;
87
88
};
88
89
90
/**
91
* Clock angle (atan2 radians: 0 at 3 o'clock) → minutes after midnight on a
92
* 24-hour dial with 0 at the top, clockwise, snapped to `step` minutes.
93
*/
94
Rules.angleToMinutes = function (ang, step)
95
{
96
step = step || 15;
97
var a = ang + Math.PI / 2;
98
while (a < 0) { a += 2 * Math.PI; }
99
while (a >= 2 * Math.PI) { a -= 2 * Math.PI; }
100
var mins = Math.round((a / (2 * Math.PI)) * 1440 / step) * step;
101
return mins >= 1440 ? 0 : mins;
102
};
103
89
104
Rules.parseHm = function (v)
90
105
{
91
106
if (typeof v !== 'string') { return null; }
@@ -129,8 +144,8 @@ Rules.normalizeRanges = function (raw)
129
144
return out.slice(0, 12);
130
145
};
131
146
132
/** Unix timestamp of ymd 00:00 in Europe/Amsterdam. */
133
Rules.amsterdamMidnight = function (ymd)
147
/** Unix timestamp of ymd 00:00 in `tz` (default Europe/Amsterdam). */
148
Rules.amsterdamMidnight = function (ymd, tz)
134
149
{
135
150
var parts = ymd.split('-').map(Number);
136
151
var Y = parts[0], M = parts[1], D = parts[2];
@@ -138,7 +153,7 @@ Rules.amsterdamMidnight = function (ymd)
138
153
var utc = Date.UTC(Y, M - 1, D, 0, 0, 0) - 3600 * 1000;
139
154
for (var i = 0; i < 5; i++)
140
155
{
141
var p = this._amsterdamParts(utc);
156
var p = this._amsterdamParts(utc, tz);
142
157
var got = Date.UTC(+p.year, +p.month - 1, +p.day, +p.hour, +p.minute, +(p.second || 0));
143
158
var want = Date.UTC(Y, M - 1, D, 0, 0, 0);
144
159
utc += (want - got);
@@ -146,14 +161,20 @@ Rules.amsterdamMidnight = function (ymd)
146
161
return Math.floor(utc / 1000);
147
162
};
148
163
149
Rules._amsterdamParts = function (unixMs)
164
Rules._fmtCache = {};
165
Rules._amsterdamParts = function (unixMs, tz)
150
166
{
151
var fmt = new Intl.DateTimeFormat('en-US', {
152
timeZone: 'Europe/Amsterdam',
153
year: 'numeric', month: '2-digit', day: '2-digit',
154
hour: '2-digit', minute: '2-digit', second: '2-digit',
155
hourCycle: 'h23'
156
});
167
tz = this.validTz(tz);
168
var fmt = this._fmtCache[tz];
169
if (!fmt)
170
{
171
fmt = this._fmtCache[tz] = new Intl.DateTimeFormat('en-US', {
172
timeZone: tz,
173
year: 'numeric', month: '2-digit', day: '2-digit',
174
hour: '2-digit', minute: '2-digit', second: '2-digit',
175
hourCycle: 'h23'
176
});
177
}
157
178
var p = {};
158
179
fmt.formatToParts(new Date(unixMs)).forEach(function (x)
159
180
{
@@ -162,9 +183,9 @@ Rules._amsterdamParts = function (unixMs)
162
183
return p;
163
184
};
164
185
165
Rules.amsterdamYmd = function (unix)
186
Rules.amsterdamYmd = function (unix, tz)
166
187
{
167
var p = this._amsterdamParts(unix * 1000);
188
var p = this._amsterdamParts(unix * 1000, tz);
168
189
return p.year + '-' + p.month + '-' + p.day;
169
190
};
170
191
@@ -174,15 +195,15 @@ Rules.amsterdamYmd = function (unix)
174
195
* walk through DST (spring-forward shortens, fall-back lengthens).
175
196
* Non-existent times (e.g. 02:30 on a spring-forward day) land after the gap.
176
197
*/
177
Rules.amsterdamWallclock = function (ymd, hm)
198
Rules.amsterdamWallclock = function (ymd, hm, tz)
178
199
{
179
var t = this.amsterdamMidnight(ymd);
200
var t = this.amsterdamMidnight(ymd, tz);
180
201
var target = this.hmToMinutes(hm);
181
202
if (target === 0)
182
203
{ return t; }
183
204
for (var i = 0; i < 8; i++)
184
205
{
185
var p = this._amsterdamParts(t * 1000);
206
var p = this._amsterdamParts(t * 1000, tz);
186
207
var day = p.year + '-' + p.month + '-' + p.day;
187
208
var got = (+p.hour) * 60 + (+p.minute);
188
209
if (day !== ymd)
@@ -211,11 +232,11 @@ Rules.addDaysYmd = function (ymd, days)
211
232
return d.getUTCFullYear() + '-' + (mm < 10 ? '0' : '') + mm + '-' + (dd < 10 ? '0' : '') + dd;
212
233
};
213
234
214
Rules.ceasefireIntervals = function (ranges, now)
235
Rules.ceasefireIntervals = function (ranges, now, tz)
215
236
{
216
237
ranges = this.normalizeRanges(ranges);
217
238
if (!ranges.length) { return []; }
218
var anchor = this.amsterdamYmd(now);
239
var anchor = this.amsterdamYmd(now, tz);
219
240
var intervals = [];
220
241
for (var d = -1; d <= 3; d++)
221
242
{
@@ -226,10 +247,10 @@ Rules.ceasefireIntervals = function (ranges, now)
226
247
var r = ranges[i];
227
248
var startM = this.hmToMinutes(r.start);
228
249
var endM = this.hmToMinutes(r.end);
229
var startTs = this.amsterdamWallclock(ymd, r.start);
250
var startTs = this.amsterdamWallclock(ymd, r.start, tz);
230
251
var endTs = endM > startM
231
? this.amsterdamWallclock(ymd, r.end)
232
: this.amsterdamWallclock(next, r.end);
252
? this.amsterdamWallclock(ymd, r.end, tz)
253
: this.amsterdamWallclock(next, r.end, tz);
233
254
if (endTs > startTs) { intervals.push([startTs, endTs]); }
234
255
}
235
256
}
@@ -251,7 +272,7 @@ Rules.ceasefireInfo = function (rules, now)
251
272
if (!rules || !rules.ceasefire) { return null; }
252
273
var ranges = this.normalizeRanges(rules.ceasefire_ranges);
253
274
if (!ranges.length) { return null; }
254
var intervals = this.ceasefireIntervals(ranges, now);
275
var intervals = this.ceasefireIntervals(ranges, now, rules.tz);
255
276
var active = false, until = null;
256
277
for (var i = 0; i < intervals.length; i++)
257
278
{
@@ -284,6 +305,74 @@ Rules.formatHms = function (seconds)
284
305
return pad(h) + ':' + pad(m) + ':' + pad(s);
285
306
};
286
307
308
309
/* ---------- time zones: host zone ↔ viewer's local zone ---------- */
310
311
Rules._tzOk = {};
312
/** A usable IANA zone name, or Europe/Amsterdam. */
313
Rules.validTz = function (tz)
314
{
315
if (!tz || typeof tz !== 'string') { return this.TZ; }
316
if (this._tzOk[tz] === undefined)
317
{
318
try { new Intl.DateTimeFormat('en-US', { timeZone: tz }); this._tzOk[tz] = true; }
319
catch (e) { this._tzOk[tz] = false; }
320
}
321
return this._tzOk[tz] ? tz : this.TZ;
322
};
323
324
/** The browser's IANA zone (the player's local time). */
325
Rules.localTz = function ()
326
{
327
try
328
{
329
var z = Intl.DateTimeFormat().resolvedOptions().timeZone;
330
return this.validTz(z || 'UTC');
331
}
332
catch (e) { return 'UTC'; }
333
};
334
335
/** HH:MM of a unix instant in `tz`. */
336
Rules.hmAt = function (unix, tz)
337
{
338
var p = this._amsterdamParts(unix * 1000, tz);
339
return p.hour + ':' + p.minute;
340
};
341
342
/**
343
* Convert a wall-clock HH:MM in `fromTz` to `toTz`, on the civil date of
344
* `refUnix` in `fromTz` (DST-aware: the offset of that day is used).
345
*/
346
Rules.convertHm = function (hm, fromTz, toTz, refUnix)
347
{
348
fromTz = this.validTz(fromTz);
349
toTz = this.validTz(toTz);
350
var v = this.parseHm(hm);
351
if (!v) { return hm; }
352
if (fromTz === toTz) { return v; }
353
var ymd = this.amsterdamYmd(refUnix, fromTz);
354
return this.hmAt(this.amsterdamWallclock(ymd, v, fromTz), toTz);
355
};
356
357
/**
358
* Copy of `rules` with ap_time and cease-fire ranges expressed in `toTz`
359
* (tz set to `toTz`). Ranges may wrap midnight after conversion.
360
*/
361
Rules.rulesInTz = function (rules, toTz, refUnix)
362
{
363
var r = Object.assign({}, rules || {});
364
var from = this.validTz(r.tz);
365
toTz = this.validTz(toTz);
366
var self = this;
367
r.ap_time = this.convertHm(r.ap_time || '00:00', from, toTz, refUnix);
368
r.ceasefire_ranges = (r.ceasefire_ranges || []).map(function (x)
369
{
370
return { start: self.convertHm(x.start, from, toTz, refUnix), end: self.convertHm(x.end, from, toTz, refUnix) };
371
}).filter(function (x) { return x.start !== x.end; });
372
r.tz = toTz;
373
return r;
374
};
375
287
376
if (typeof module !== 'undefined' && module.exports)
288
377
{ module.exports = Rules; }
289
378
else if (typeof globalThis !== 'undefined')
@@ -34,6 +34,7 @@ Rules.defaultRules = function ()34
ceasefire_ranges: [],34
ceasefire_ranges: [],35
ap_loot: false,35
ap_loot: false,36
ap_time: '00:00',36
ap_time: '00:00',37
tz: this.TZ,37
vis_shots: 'public',38
vis_shots: 'public',38
vis_gifts: 'public',39
vis_gifts: 'public',39
vis_ap: 'public',40
vis_ap: 'public',@@ -86,6 +87,20 @@ Rules.isPassable = function (size, inset, x, y)86
&& x >= inset && y >= inset && x < size - inset && y < size - inset;87
&& x >= inset && y >= inset && x < size - inset && y < size - inset;87
};88
};88
89
90
/**91
* Clock angle (atan2 radians: 0 at 3 o'clock) → minutes after midnight on a92
* 24-hour dial with 0 at the top, clockwise, snapped to `step` minutes.93
*/94
Rules.angleToMinutes = function (ang, step)95
{96
step = step || 15;97
var a = ang + Math.PI / 2;98
while (a < 0) { a += 2 * Math.PI; }99
while (a >= 2 * Math.PI) { a -= 2 * Math.PI; }100
var mins = Math.round((a / (2 * Math.PI)) * 1440 / step) * step;101
return mins >= 1440 ? 0 : mins;102
};103
89
Rules.parseHm = function (v)104
Rules.parseHm = function (v)90
{105
{91
if (typeof v !== 'string') { return null; }106
if (typeof v !== 'string') { return null; }@@ -129,8 +144,8 @@ Rules.normalizeRanges = function (raw)129
return out.slice(0, 12);144
return out.slice(0, 12);130
};145
};131
146
132
/** Unix timestamp of ymd 00:00 in Europe/Amsterdam. */147
/** Unix timestamp of ymd 00:00 in `tz` (default Europe/Amsterdam). */133
Rules.amsterdamMidnight = function (ymd)148
Rules.amsterdamMidnight = function (ymd, tz)134
{149
{135
var parts = ymd.split('-').map(Number);150
var parts = ymd.split('-').map(Number);136
var Y = parts[0], M = parts[1], D = parts[2];151
var Y = parts[0], M = parts[1], D = parts[2];@@ -138,7 +153,7 @@ Rules.amsterdamMidnight = function (ymd)138
var utc = Date.UTC(Y, M - 1, D, 0, 0, 0) - 3600 * 1000;153
var utc = Date.UTC(Y, M - 1, D, 0, 0, 0) - 3600 * 1000;139
for (var i = 0; i < 5; i++)154
for (var i = 0; i < 5; i++)140
{155
{141
var p = this._amsterdamParts(utc);156
var p = this._amsterdamParts(utc, tz);142
var got = Date.UTC(+p.year, +p.month - 1, +p.day, +p.hour, +p.minute, +(p.second || 0));157
var got = Date.UTC(+p.year, +p.month - 1, +p.day, +p.hour, +p.minute, +(p.second || 0));143
var want = Date.UTC(Y, M - 1, D, 0, 0, 0);158
var want = Date.UTC(Y, M - 1, D, 0, 0, 0);144
utc += (want - got);159
utc += (want - got);@@ -146,14 +161,20 @@ Rules.amsterdamMidnight = function (ymd)146
return Math.floor(utc / 1000);161
return Math.floor(utc / 1000);147
};162
};148
163
149
Rules._amsterdamParts = function (unixMs)164
Rules._fmtCache = {};165
Rules._amsterdamParts = function (unixMs, tz)150
{166
{151
var fmt = new Intl.DateTimeFormat('en-US', {167
tz = this.validTz(tz);152
timeZone: 'Europe/Amsterdam',168
var fmt = this._fmtCache[tz];153
year: 'numeric', month: '2-digit', day: '2-digit',169
if (!fmt)154
hour: '2-digit', minute: '2-digit', second: '2-digit',170
{155
hourCycle: 'h23'171
fmt = this._fmtCache[tz] = new Intl.DateTimeFormat('en-US', {156
});172
timeZone: tz,173
year: 'numeric', month: '2-digit', day: '2-digit',174
hour: '2-digit', minute: '2-digit', second: '2-digit',175
hourCycle: 'h23'176
});177
}157
var p = {};178
var p = {};158
fmt.formatToParts(new Date(unixMs)).forEach(function (x)179
fmt.formatToParts(new Date(unixMs)).forEach(function (x)159
{180
{@@ -162,9 +183,9 @@ Rules._amsterdamParts = function (unixMs)162
return p;183
return p;163
};184
};164
185
165
Rules.amsterdamYmd = function (unix)186
Rules.amsterdamYmd = function (unix, tz)166
{187
{167
var p = this._amsterdamParts(unix * 1000);188
var p = this._amsterdamParts(unix * 1000, tz);168
return p.year + '-' + p.month + '-' + p.day;189
return p.year + '-' + p.month + '-' + p.day;169
};190
};170
191
@@ -174,15 +195,15 @@ Rules.amsterdamYmd = function (unix)174
* walk through DST (spring-forward shortens, fall-back lengthens).195
* walk through DST (spring-forward shortens, fall-back lengthens).175
* Non-existent times (e.g. 02:30 on a spring-forward day) land after the gap.196
* Non-existent times (e.g. 02:30 on a spring-forward day) land after the gap.176
*/197
*/177
Rules.amsterdamWallclock = function (ymd, hm)198
Rules.amsterdamWallclock = function (ymd, hm, tz)178
{199
{179
var t = this.amsterdamMidnight(ymd);200
var t = this.amsterdamMidnight(ymd, tz);180
var target = this.hmToMinutes(hm);201
var target = this.hmToMinutes(hm);181
if (target === 0)202
if (target === 0)182
{ return t; }203
{ return t; }183
for (var i = 0; i < 8; i++)204
for (var i = 0; i < 8; i++)184
{205
{185
var p = this._amsterdamParts(t * 1000);206
var p = this._amsterdamParts(t * 1000, tz);186
var day = p.year + '-' + p.month + '-' + p.day;207
var day = p.year + '-' + p.month + '-' + p.day;187
var got = (+p.hour) * 60 + (+p.minute);208
var got = (+p.hour) * 60 + (+p.minute);188
if (day !== ymd)209
if (day !== ymd)@@ -211,11 +232,11 @@ Rules.addDaysYmd = function (ymd, days)211
return d.getUTCFullYear() + '-' + (mm < 10 ? '0' : '') + mm + '-' + (dd < 10 ? '0' : '') + dd;232
return d.getUTCFullYear() + '-' + (mm < 10 ? '0' : '') + mm + '-' + (dd < 10 ? '0' : '') + dd;212
};233
};213
234
214
Rules.ceasefireIntervals = function (ranges, now)235
Rules.ceasefireIntervals = function (ranges, now, tz)215
{236
{216
ranges = this.normalizeRanges(ranges);237
ranges = this.normalizeRanges(ranges);217
if (!ranges.length) { return []; }238
if (!ranges.length) { return []; }218
var anchor = this.amsterdamYmd(now);239
var anchor = this.amsterdamYmd(now, tz);219
var intervals = [];240
var intervals = [];220
for (var d = -1; d <= 3; d++)241
for (var d = -1; d <= 3; d++)221
{242
{@@ -226,10 +247,10 @@ Rules.ceasefireIntervals = function (ranges, now)226
var r = ranges[i];247
var r = ranges[i];227
var startM = this.hmToMinutes(r.start);248
var startM = this.hmToMinutes(r.start);228
var endM = this.hmToMinutes(r.end);249
var endM = this.hmToMinutes(r.end);229
var startTs = this.amsterdamWallclock(ymd, r.start);250
var startTs = this.amsterdamWallclock(ymd, r.start, tz);230
var endTs = endM > startM251
var endTs = endM > startM231
? this.amsterdamWallclock(ymd, r.end)252
? this.amsterdamWallclock(ymd, r.end, tz)232
: this.amsterdamWallclock(next, r.end);253
: this.amsterdamWallclock(next, r.end, tz);233
if (endTs > startTs) { intervals.push([startTs, endTs]); }254
if (endTs > startTs) { intervals.push([startTs, endTs]); }234
}255
}235
}256
}@@ -251,7 +272,7 @@ Rules.ceasefireInfo = function (rules, now)251
if (!rules || !rules.ceasefire) { return null; }272
if (!rules || !rules.ceasefire) { return null; }252
var ranges = this.normalizeRanges(rules.ceasefire_ranges);273
var ranges = this.normalizeRanges(rules.ceasefire_ranges);253
if (!ranges.length) { return null; }274
if (!ranges.length) { return null; }254
var intervals = this.ceasefireIntervals(ranges, now);275
var intervals = this.ceasefireIntervals(ranges, now, rules.tz);255
var active = false, until = null;276
var active = false, until = null;256
for (var i = 0; i < intervals.length; i++)277
for (var i = 0; i < intervals.length; i++)257
{278
{@@ -284,6 +305,74 @@ Rules.formatHms = function (seconds)284
return pad(h) + ':' + pad(m) + ':' + pad(s);305
return pad(h) + ':' + pad(m) + ':' + pad(s);285
};306
};286
307
308
309
/* ---------- time zones: host zone ↔ viewer's local zone ---------- */310
311
Rules._tzOk = {};312
/** A usable IANA zone name, or Europe/Amsterdam. */313
Rules.validTz = function (tz)314
{315
if (!tz || typeof tz !== 'string') { return this.TZ; }316
if (this._tzOk[tz] === undefined)317
{318
try { new Intl.DateTimeFormat('en-US', { timeZone: tz }); this._tzOk[tz] = true; }319
catch (e) { this._tzOk[tz] = false; }320
}321
return this._tzOk[tz] ? tz : this.TZ;322
};323
324
/** The browser's IANA zone (the player's local time). */325
Rules.localTz = function ()326
{327
try328
{329
var z = Intl.DateTimeFormat().resolvedOptions().timeZone;330
return this.validTz(z || 'UTC');331
}332
catch (e) { return 'UTC'; }333
};334
335
/** HH:MM of a unix instant in `tz`. */336
Rules.hmAt = function (unix, tz)337
{338
var p = this._amsterdamParts(unix * 1000, tz);339
return p.hour + ':' + p.minute;340
};341
342
/**343
* Convert a wall-clock HH:MM in `fromTz` to `toTz`, on the civil date of344
* `refUnix` in `fromTz` (DST-aware: the offset of that day is used).345
*/346
Rules.convertHm = function (hm, fromTz, toTz, refUnix)347
{348
fromTz = this.validTz(fromTz);349
toTz = this.validTz(toTz);350
var v = this.parseHm(hm);351
if (!v) { return hm; }352
if (fromTz === toTz) { return v; }353
var ymd = this.amsterdamYmd(refUnix, fromTz);354
return this.hmAt(this.amsterdamWallclock(ymd, v, fromTz), toTz);355
};356
357
/**358
* Copy of `rules` with ap_time and cease-fire ranges expressed in `toTz`359
* (tz set to `toTz`). Ranges may wrap midnight after conversion.360
*/361
Rules.rulesInTz = function (rules, toTz, refUnix)362
{363
var r = Object.assign({}, rules || {});364
var from = this.validTz(r.tz);365
toTz = this.validTz(toTz);366
var self = this;367
r.ap_time = this.convertHm(r.ap_time || '00:00', from, toTz, refUnix);368
r.ceasefire_ranges = (r.ceasefire_ranges || []).map(function (x)369
{370
return { start: self.convertHm(x.start, from, toTz, refUnix), end: self.convertHm(x.end, from, toTz, refUnix) };371
}).filter(function (x) { return x.start !== x.end; });372
r.tz = toTz;373
return r;374
};375
287
if (typeof module !== 'undefined' && module.exports)376
if (typeof module !== 'undefined' && module.exports)288
{ module.exports = Rules; }377
{ module.exports = Rules; }289
else if (typeof globalThis !== 'undefined')378
else if (typeof globalThis !== 'undefined')@@ -0,0 +1,240 @@
1
#!/usr/bin/env python3
2
"""Real-browser checks for the lobby rules form (t1171/t1172).
3
4
- Dragging on the cease-fire clock paints and adjusts ranges smoothly (same
5
SVG node throughout the drag; pointer capture survives polls).
6
- Typing in time / number inputs keeps focus across several poll cycles
7
while other players join and leave (lobby version bumps).
8
- Non-hosts get a read-only form; the API refuses their rule edits (403).
9
- Times are shown in each player's local zone (host Amsterdam, guest Tokyo).
10
Desktop (mouse) and mobile (touch). Usage: python3 test/lobby-interaction-playwright.py [BASE]
11
"""
12
import math
13
import sys
14
from pathlib import Path
15
from urllib.parse import quote
16
17
from playwright.sync_api import sync_playwright
18
19
BASE = sys.argv[1] if len(sys.argv) > 1 else 'http://127.0.0.1:8080'
20
OUT = Path('/workspace/allianties-shots')
21
OUT.mkdir(parents=True, exist_ok=True)
22
FAILS = []
23
24
25
def check(cond, msg):
26
print((' ok ' if cond else ' FAIL ') + msg)
27
if not cond:
28
FAILS.append(msg)
29
30
31
def shot(page, name):
32
page.screenshot(path=str(OUT / (name + '.png')), full_page=False)
33
print(' shot', OUT / (name + '.png'))
34
35
36
def clock_point(page, minutes, radius_frac):
37
box = page.locator('#cf-clock svg').bounding_box()
38
scale = box['width'] / 320.0
39
ang = minutes / 1440.0 * 2 * math.pi - math.pi / 2
40
r = 128 * radius_frac * scale
41
return (box['x'] + 160 * scale + r * math.cos(ang), box['y'] + 160 * scale + r * math.sin(ang))
42
43
44
def ranges(page):
45
return page.evaluate("() => (App.game.rules.ceasefire_ranges || []).map(r => r.start + '-' + r.end)")
46
47
48
def mark_svg(page):
49
page.evaluate("() => { window.__cfSvg = document.querySelector('#cf-clock svg'); }")
50
51
52
def same_svg(page):
53
return page.evaluate("() => document.querySelector('#cf-clock svg') === window.__cfSvg")
54
55
56
def wait_saved(page):
57
page.wait_for_function("() => !App.rulesDirty && !App._rulesSaving", timeout=10000)
58
59
60
def mouse_drag(page, m_from, m_to, frac, steps=16, poll_pause=False):
61
x, y = clock_point(page, m_from, frac)
62
page.mouse.move(x, y)
63
page.mouse.down()
64
ok = True
65
span = (m_to - m_from) % 1440
66
for i in range(1, steps + 1):
67
m = (m_from + span * i / steps) % 1440
68
px, py = clock_point(page, m, frac)
69
page.mouse.move(px, py)
70
page.wait_for_timeout(250 if poll_pause else 30)
71
ok = ok and same_svg(page) and page.evaluate("() => App._cfClock.active()")
72
page.mouse.up()
73
return ok
74
75
76
def touch_drag(page, cdp, m_from, m_to, frac, steps=16, poll_pause=False):
77
def tp(m):
78
x, y = clock_point(page, m, frac)
79
return [{'x': x, 'y': y, 'id': 1}]
80
cdp.send('Input.dispatchTouchEvent', {'type': 'touchStart', 'touchPoints': tp(m_from)})
81
ok = True
82
span = (m_to - m_from) % 1440
83
for i in range(1, steps + 1):
84
m = (m_from + span * i / steps) % 1440
85
cdp.send('Input.dispatchTouchEvent', {'type': 'touchMove', 'touchPoints': tp(m)})
86
page.wait_for_timeout(250 if poll_pause else 30)
87
ok = ok and same_svg(page) and page.evaluate("() => App._cfClock.active()")
88
cdp.send('Input.dispatchTouchEvent', {'type': 'touchEnd', 'touchPoints': []})
89
return ok
90
91
92
def churn(page3, code, times=1):
93
"""Another player joins and leaves: bumps the lobby version → host polls see a change."""
94
for _ in range(times):
95
page3.goto(BASE + '/index.html?join=' + code, wait_until='domcontentloaded')
96
page3.wait_for_selector('#lobby:not([hidden])', timeout=10000)
97
page3.locator('#btn-leave').click()
98
page3.wait_for_timeout(300)
99
100
101
def type_slowly(page, sel, keys, churn_fn, label):
102
page.locator(sel).focus()
103
page.keyboard.press('Control+A') # number input: replace; time input: first segment
104
page.wait_for_timeout(100)
105
kept = True
106
for k in keys:
107
if ':' in k:
108
# Mobile browsers set a time input through the native picker,
109
# not keystrokes: emulate that (value + input/change events).
110
page.locator(sel).evaluate(
111
"(el, v) => { el.value = v; el.dispatchEvent(new Event('input', {bubbles: true}));"
112
" el.dispatchEvent(new Event('change', {bubbles: true})); }", k)
113
else:
114
page.keyboard.type(k)
115
churn_fn()
116
page.wait_for_timeout(1600) # > one 3 s poll every two keys
117
active = page.evaluate("(s) => document.activeElement === document.querySelector(s)", sel)
118
kept = kept and active
119
check(kept, label + ': focus kept across polls while others join/leave')
120
print(' value after typing:', page.locator(sel).input_value())
121
return kept
122
123
124
def run(p, mobile):
125
tag = 'mobile' if mobile else 'desktop'
126
print('== ' + tag)
127
browser = p.chromium.launch()
128
if mobile:
129
ctx_opts = dict(viewport={'width': 390, 'height': 844}, device_scale_factor=2, is_mobile=True, has_touch=True)
130
else:
131
ctx_opts = dict(viewport={'width': 1280, 'height': 900})
132
host_ctx = browser.new_context(locale='en-GB', timezone_id='Europe/Amsterdam', **ctx_opts)
133
guest_ctx = browser.new_context(locale='en-GB', timezone_id='Asia/Tokyo', **ctx_opts)
134
churn_ctx = browser.new_context(locale='en-GB', timezone_id='UTC')
135
page = host_ctx.new_page()
136
page.goto(BASE + '/auth.php?test=1', wait_until='networkidle')
137
page.wait_for_selector('#btn-create')
138
check('paranoia' in page.locator('.tagline').first.inner_text(), 'new tagline shown')
139
page.locator('#btn-create').click()
140
page.wait_for_selector('#lobby:not([hidden])')
141
code = page.locator('#lobby-code').inner_text().strip()
142
check(page.evaluate("() => App.game.rules.tz") == 'Europe/Amsterdam', 'lobby created with host zone')
143
144
guest = guest_ctx.new_page()
145
guest.goto(BASE + '/auth.php?test=2&next=' + quote('index.html?join=' + code, safe=''), wait_until='networkidle')
146
guest.wait_for_selector('#lobby:not([hidden])')
147
page3 = churn_ctx.new_page()
148
page3.goto(BASE + '/auth.php?test=3', wait_until='networkidle')
149
150
page.locator('#rule-ceasefire').check()
151
page.wait_for_selector('#ceasefire-editor:not([hidden])')
152
page.locator('#cf-clock').scroll_into_view_if_needed()
153
wait_saved(page)
154
mark_svg(page)
155
156
# 1. Paint 10:00 → 14:00 on the ring, slowly (so polls happen mid-drag).
157
cdp = host_ctx.new_cdp_session(page) if mobile else None
158
if mobile:
159
smooth = touch_drag(page, cdp, 600, 840, 0.8, steps=16, poll_pause=True)
160
else:
161
churn(page3, code)
162
smooth = mouse_drag(page, 600, 840, 0.8, steps=16, poll_pause=True)
163
check(smooth, 'paint drag: same SVG node and active drag on every move (%s)' % tag)
164
wait_saved(page)
165
check('10:00-14:00' in ranges(page), 'painted 10:00-14:00: %s' % ranges(page))
166
shot(page, tag + '-clock-painted')
167
168
# 2. Drag the end handle 14:00 → 16:00.
169
if mobile:
170
smooth = touch_drag(page, cdp, 840, 960, 1.0, steps=8)
171
else:
172
smooth = mouse_drag(page, 840, 960, 1.0, steps=8)
173
check(smooth, 'handle drag smooth (%s)' % tag)
174
wait_saved(page)
175
check(ranges(page) == ['10:00-16:00'], 'handle moved end to 16:00: %s' % ranges(page))
176
rows = page.evaluate("() => [...document.querySelectorAll('#cf-ranges li.cf-row input')].map(i => i.value)")
177
check(rows == ['10:00', '16:00'], 'time inputs follow the clock: %s' % rows)
178
# Snap: a drag that ends near 16:07 lands on 16:00 (15-minute grid).
179
page.wait_for_timeout(3500)
180
check(same_svg(page), 'clock SVG survives polls (patched in place)')
181
182
# 3. Typing keeps focus across polls (others join/leave meanwhile).
183
page.locator('#rule-ap-time').scroll_into_view_if_needed()
184
type_slowly(page, '#rule-ap-time', ['07:00', '07:15', '07:30'] if mobile else ['0', '7', '3', '0'],
185
lambda: churn(page3, code), 'AP time input')
186
page.locator('#lobby h1').click()
187
wait_saved(page)
188
page.wait_for_timeout(500)
189
check(page.evaluate("() => App.game.rules.ap_time") == '07:30', 'AP time saved 07:30')
190
shot(page, tag + '-lobby-host-edit')
191
192
page.locator('#cf-ranges li.cf-row input').first.scroll_into_view_if_needed()
193
type_slowly(page, '#cf-ranges li.cf-row input.cf-start', ['09:00', '09:30', '09:45'] if mobile else ['0', '9', '4', '5'],
194
lambda: churn(page3, code), 'cease-fire start input')
195
page.locator('#lobby h1').click()
196
wait_saved(page)
197
page.wait_for_timeout(500)
198
check(ranges(page) == ['09:45-16:00'], 'typed start saved: %s' % ranges(page))
199
200
type_slowly(page, '#rule-grid', ['1', '2'], lambda: churn(page3, code), 'grid size input')
201
page.locator('#lobby h1').click()
202
wait_saved(page)
203
check(page.evaluate("() => App.game.rules.grid") == 12, 'grid 12 saved')
204
205
# 4. Guest (Tokyo): read-only, converted to local time, API refuses (403).
206
guest.wait_for_timeout(3500)
207
guest.locator('#lobby-rules').scroll_into_view_if_needed()
208
check(guest.locator('#rules-host-only').is_visible(), 'guest sees "Only the host can change the rules."')
209
disabled = guest.evaluate("() => [...document.querySelectorAll('#lobby-rules input, #lobby-rules button')].every(e => e.disabled)")
210
check(disabled, 'guest: every rules input/button disabled')
211
g_ap = guest.locator('#rule-ap-time').input_value()
212
check(g_ap == '15:30', 'guest in Tokyo sees AP time 07:30 Amsterdam as 15:30: %s' % g_ap)
213
g_rows = guest.evaluate("() => [...document.querySelectorAll('#cf-ranges li.cf-row input')].map(i => i.value)")
214
check(g_rows == ['17:45', '00:00'], 'guest sees 09:45–16:00 Amsterdam as 17:45–00:00 Tokyo: %s' % g_rows)
215
check('Asia/Tokyo' in guest.locator('.tz-label').first.inner_text(), 'guest zone label: ' + guest.locator('.tz-label').first.inner_text())
216
status = guest.evaluate("""async () => {
217
const r = await fetch('api.php?action=lobby_rules', { method: 'POST', credentials: 'same-origin',
218
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': Api.csrf },
219
body: JSON.stringify({ action: 'lobby_rules', game: App.game.id, rules: { jury: false } }) });
220
const d = await r.json();
221
return [r.status, d.error];
222
}""")
223
check(status == [403, 'not_host'], 'guest rule update refused with 403 not_host: %s' % status)
224
page.wait_for_timeout(3500)
225
check(page.evaluate("() => App.game.rules.jury") is True, 'rules unchanged after refused guest edit')
226
guest.locator('#ceasefire-editor').scroll_into_view_if_needed()
227
shot(guest, tag + '-lobby-guest-readonly-tokyo')
228
page.locator('#ceasefire-editor').scroll_into_view_if_needed()
229
shot(page, tag + '-lobby-host-clock')
230
browser.close()
231
232
233
with sync_playwright() as p:
234
run(p, mobile=False)
235
run(p, mobile=True)
236
237
print('\nFAILED: %d' % len(FAILS))
238
for f in FAILS:
239
print(' - ' + f)
240
sys.exit(1 if FAILS else 0)
@@ -0,0 +1,240 @@1
#!/usr/bin/env python32
"""Real-browser checks for the lobby rules form (t1171/t1172).3
4
- Dragging on the cease-fire clock paints and adjusts ranges smoothly (same5
SVG node throughout the drag; pointer capture survives polls).6
- Typing in time / number inputs keeps focus across several poll cycles7
while other players join and leave (lobby version bumps).8
- Non-hosts get a read-only form; the API refuses their rule edits (403).9
- Times are shown in each player's local zone (host Amsterdam, guest Tokyo).10
Desktop (mouse) and mobile (touch). Usage: python3 test/lobby-interaction-playwright.py [BASE]11
"""12
import math13
import sys14
from pathlib import Path15
from urllib.parse import quote16
17
from playwright.sync_api import sync_playwright18
19
BASE = sys.argv[1] if len(sys.argv) > 1 else 'http://127.0.0.1:8080'20
OUT = Path('/workspace/allianties-shots')21
OUT.mkdir(parents=True, exist_ok=True)22
FAILS = []23
24
25
def check(cond, msg):26
print((' ok ' if cond else ' FAIL ') + msg)27
if not cond:28
FAILS.append(msg)29
30
31
def shot(page, name):32
page.screenshot(path=str(OUT / (name + '.png')), full_page=False)33
print(' shot', OUT / (name + '.png'))34
35
36
def clock_point(page, minutes, radius_frac):37
box = page.locator('#cf-clock svg').bounding_box()38
scale = box['width'] / 320.039
ang = minutes / 1440.0 * 2 * math.pi - math.pi / 240
r = 128 * radius_frac * scale41
return (box['x'] + 160 * scale + r * math.cos(ang), box['y'] + 160 * scale + r * math.sin(ang))42
43
44
def ranges(page):45
return page.evaluate("() => (App.game.rules.ceasefire_ranges || []).map(r => r.start + '-' + r.end)")46
47
48
def mark_svg(page):49
page.evaluate("() => { window.__cfSvg = document.querySelector('#cf-clock svg'); }")50
51
52
def same_svg(page):53
return page.evaluate("() => document.querySelector('#cf-clock svg') === window.__cfSvg")54
55
56
def wait_saved(page):57
page.wait_for_function("() => !App.rulesDirty && !App._rulesSaving", timeout=10000)58
59
60
def mouse_drag(page, m_from, m_to, frac, steps=16, poll_pause=False):61
x, y = clock_point(page, m_from, frac)62
page.mouse.move(x, y)63
page.mouse.down()64
ok = True65
span = (m_to - m_from) % 144066
for i in range(1, steps + 1):67
m = (m_from + span * i / steps) % 144068
px, py = clock_point(page, m, frac)69
page.mouse.move(px, py)70
page.wait_for_timeout(250 if poll_pause else 30)71
ok = ok and same_svg(page) and page.evaluate("() => App._cfClock.active()")72
page.mouse.up()73
return ok74
75
76
def touch_drag(page, cdp, m_from, m_to, frac, steps=16, poll_pause=False):77
def tp(m):78
x, y = clock_point(page, m, frac)79
return [{'x': x, 'y': y, 'id': 1}]80
cdp.send('Input.dispatchTouchEvent', {'type': 'touchStart', 'touchPoints': tp(m_from)})81
ok = True82
span = (m_to - m_from) % 144083
for i in range(1, steps + 1):84
m = (m_from + span * i / steps) % 144085
cdp.send('Input.dispatchTouchEvent', {'type': 'touchMove', 'touchPoints': tp(m)})86
page.wait_for_timeout(250 if poll_pause else 30)87
ok = ok and same_svg(page) and page.evaluate("() => App._cfClock.active()")88
cdp.send('Input.dispatchTouchEvent', {'type': 'touchEnd', 'touchPoints': []})89
return ok90
91
92
def churn(page3, code, times=1):93
"""Another player joins and leaves: bumps the lobby version → host polls see a change."""94
for _ in range(times):95
page3.goto(BASE + '/index.html?join=' + code, wait_until='domcontentloaded')96
page3.wait_for_selector('#lobby:not([hidden])', timeout=10000)97
page3.locator('#btn-leave').click()98
page3.wait_for_timeout(300)99
100
101
def type_slowly(page, sel, keys, churn_fn, label):102
page.locator(sel).focus()103
page.keyboard.press('Control+A') # number input: replace; time input: first segment104
page.wait_for_timeout(100)105
kept = True106
for k in keys:107
if ':' in k:108
# Mobile browsers set a time input through the native picker,109
# not keystrokes: emulate that (value + input/change events).110
page.locator(sel).evaluate(111
"(el, v) => { el.value = v; el.dispatchEvent(new Event('input', {bubbles: true}));"112
" el.dispatchEvent(new Event('change', {bubbles: true})); }", k)113
else:114
page.keyboard.type(k)115
churn_fn()116
page.wait_for_timeout(1600) # > one 3 s poll every two keys117
active = page.evaluate("(s) => document.activeElement === document.querySelector(s)", sel)118
kept = kept and active119
check(kept, label + ': focus kept across polls while others join/leave')120
print(' value after typing:', page.locator(sel).input_value())121
return kept122
123
124
def run(p, mobile):125
tag = 'mobile' if mobile else 'desktop'126
print('== ' + tag)127
browser = p.chromium.launch()128
if mobile:129
ctx_opts = dict(viewport={'width': 390, 'height': 844}, device_scale_factor=2, is_mobile=True, has_touch=True)130
else:131
ctx_opts = dict(viewport={'width': 1280, 'height': 900})132
host_ctx = browser.new_context(locale='en-GB', timezone_id='Europe/Amsterdam', **ctx_opts)133
guest_ctx = browser.new_context(locale='en-GB', timezone_id='Asia/Tokyo', **ctx_opts)134
churn_ctx = browser.new_context(locale='en-GB', timezone_id='UTC')135
page = host_ctx.new_page()136
page.goto(BASE + '/auth.php?test=1', wait_until='networkidle')137
page.wait_for_selector('#btn-create')138
check('paranoia' in page.locator('.tagline').first.inner_text(), 'new tagline shown')139
page.locator('#btn-create').click()140
page.wait_for_selector('#lobby:not([hidden])')141
code = page.locator('#lobby-code').inner_text().strip()142
check(page.evaluate("() => App.game.rules.tz") == 'Europe/Amsterdam', 'lobby created with host zone')143
144
guest = guest_ctx.new_page()145
guest.goto(BASE + '/auth.php?test=2&next=' + quote('index.html?join=' + code, safe=''), wait_until='networkidle')146
guest.wait_for_selector('#lobby:not([hidden])')147
page3 = churn_ctx.new_page()148
page3.goto(BASE + '/auth.php?test=3', wait_until='networkidle')149
150
page.locator('#rule-ceasefire').check()151
page.wait_for_selector('#ceasefire-editor:not([hidden])')152
page.locator('#cf-clock').scroll_into_view_if_needed()153
wait_saved(page)154
mark_svg(page)155
156
# 1. Paint 10:00 → 14:00 on the ring, slowly (so polls happen mid-drag).157
cdp = host_ctx.new_cdp_session(page) if mobile else None158
if mobile:159
smooth = touch_drag(page, cdp, 600, 840, 0.8, steps=16, poll_pause=True)160
else:161
churn(page3, code)162
smooth = mouse_drag(page, 600, 840, 0.8, steps=16, poll_pause=True)163
check(smooth, 'paint drag: same SVG node and active drag on every move (%s)' % tag)164
wait_saved(page)165
check('10:00-14:00' in ranges(page), 'painted 10:00-14:00: %s' % ranges(page))166
shot(page, tag + '-clock-painted')167
168
# 2. Drag the end handle 14:00 → 16:00.169
if mobile:170
smooth = touch_drag(page, cdp, 840, 960, 1.0, steps=8)171
else:172
smooth = mouse_drag(page, 840, 960, 1.0, steps=8)173
check(smooth, 'handle drag smooth (%s)' % tag)174
wait_saved(page)175
check(ranges(page) == ['10:00-16:00'], 'handle moved end to 16:00: %s' % ranges(page))176
rows = page.evaluate("() => [...document.querySelectorAll('#cf-ranges li.cf-row input')].map(i => i.value)")177
check(rows == ['10:00', '16:00'], 'time inputs follow the clock: %s' % rows)178
# Snap: a drag that ends near 16:07 lands on 16:00 (15-minute grid).179
page.wait_for_timeout(3500)180
check(same_svg(page), 'clock SVG survives polls (patched in place)')181
182
# 3. Typing keeps focus across polls (others join/leave meanwhile).183
page.locator('#rule-ap-time').scroll_into_view_if_needed()184
type_slowly(page, '#rule-ap-time', ['07:00', '07:15', '07:30'] if mobile else ['0', '7', '3', '0'],185
lambda: churn(page3, code), 'AP time input')186
page.locator('#lobby h1').click()187
wait_saved(page)188
page.wait_for_timeout(500)189
check(page.evaluate("() => App.game.rules.ap_time") == '07:30', 'AP time saved 07:30')190
shot(page, tag + '-lobby-host-edit')191
192
page.locator('#cf-ranges li.cf-row input').first.scroll_into_view_if_needed()193
type_slowly(page, '#cf-ranges li.cf-row input.cf-start', ['09:00', '09:30', '09:45'] if mobile else ['0', '9', '4', '5'],194
lambda: churn(page3, code), 'cease-fire start input')195
page.locator('#lobby h1').click()196
wait_saved(page)197
page.wait_for_timeout(500)198
check(ranges(page) == ['09:45-16:00'], 'typed start saved: %s' % ranges(page))199
200
type_slowly(page, '#rule-grid', ['1', '2'], lambda: churn(page3, code), 'grid size input')201
page.locator('#lobby h1').click()202
wait_saved(page)203
check(page.evaluate("() => App.game.rules.grid") == 12, 'grid 12 saved')204
205
# 4. Guest (Tokyo): read-only, converted to local time, API refuses (403).206
guest.wait_for_timeout(3500)207
guest.locator('#lobby-rules').scroll_into_view_if_needed()208
check(guest.locator('#rules-host-only').is_visible(), 'guest sees "Only the host can change the rules."')209
disabled = guest.evaluate("() => [...document.querySelectorAll('#lobby-rules input, #lobby-rules button')].every(e => e.disabled)")210
check(disabled, 'guest: every rules input/button disabled')211
g_ap = guest.locator('#rule-ap-time').input_value()212
check(g_ap == '15:30', 'guest in Tokyo sees AP time 07:30 Amsterdam as 15:30: %s' % g_ap)213
g_rows = guest.evaluate("() => [...document.querySelectorAll('#cf-ranges li.cf-row input')].map(i => i.value)")214
check(g_rows == ['17:45', '00:00'], 'guest sees 09:45–16:00 Amsterdam as 17:45–00:00 Tokyo: %s' % g_rows)215
check('Asia/Tokyo' in guest.locator('.tz-label').first.inner_text(), 'guest zone label: ' + guest.locator('.tz-label').first.inner_text())216
status = guest.evaluate("""async () => {217
const r = await fetch('api.php?action=lobby_rules', { method: 'POST', credentials: 'same-origin',218
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': Api.csrf },219
body: JSON.stringify({ action: 'lobby_rules', game: App.game.id, rules: { jury: false } }) });220
const d = await r.json();221
return [r.status, d.error];222
}""")223
check(status == [403, 'not_host'], 'guest rule update refused with 403 not_host: %s' % status)224
page.wait_for_timeout(3500)225
check(page.evaluate("() => App.game.rules.jury") is True, 'rules unchanged after refused guest edit')226
guest.locator('#ceasefire-editor').scroll_into_view_if_needed()227
shot(guest, tag + '-lobby-guest-readonly-tokyo')228
page.locator('#ceasefire-editor').scroll_into_view_if_needed()229
shot(page, tag + '-lobby-host-clock')230
browser.close()231
232
233
with sync_playwright() as p:234
run(p, mobile=False)235
run(p, mobile=True)236
237
print('\nFAILED: %d' % len(FAILS))238
for f in FAILS:239
print(' - ' + f)240
sys.exit(1 if FAILS else 0)@@ -149,3 +149,61 @@ describe('Rules timelineIndex (nearest event)', () =>
149
149
assert.equal(Rules.timelineIndex(-0.2, 4), 0);
150
150
});
151
151
});
152
153
describe('Rules.angleToMinutes (cease-fire clock)', () => {
154
it('maps the dial with 0 at the top, clockwise, snapped to 15 min', () => {
155
const top = -Math.PI / 2, right = 0, bottom = Math.PI / 2, left = Math.PI;
156
assert.equal(Rules.angleToMinutes(top, 15), 0);
157
assert.equal(Rules.angleToMinutes(right, 15), 360);
158
assert.equal(Rules.angleToMinutes(bottom, 15), 720);
159
assert.equal(Rules.angleToMinutes(left, 15), 1080);
160
assert.equal(Rules.angleToMinutes(-Math.PI, 15), 1080);
161
// 7 minutes past 6:00 snaps to 6:00; 8 minutes snaps to 6:15
162
const perMin = 2 * Math.PI / 1440;
163
assert.equal(Rules.angleToMinutes(right + 7 * perMin, 15), 360);
164
assert.equal(Rules.angleToMinutes(right + 8 * perMin, 15), 375);
165
// just before midnight wraps to 0
166
assert.equal(Rules.angleToMinutes(top - 3 * perMin, 15), 0);
167
assert.equal(Rules.angleToMinutes(top - 3 * perMin, 1), 1437);
168
});
169
});
170
171
describe('Rules time zones (host zone → viewer local)', () => {
172
const nov = Date.UTC(2026, 10, 14, 12) / 1000;
173
const jul = Date.UTC(2026, 6, 14, 12) / 1000;
174
it('converts wall-clock times between zones, DST-aware', () => {
175
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'America/New_York', nov), '16:00');
176
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'America/New_York', jul), '16:00');
177
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'Asia/Tokyo', nov), '06:00'); // CET+8
178
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'Asia/Tokyo', jul), '05:00'); // CEST+7
179
assert.equal(Rules.convertHm('09:30', 'Asia/Kolkata', 'UTC', nov), '04:00');
180
assert.equal(Rules.convertHm('12:00', 'Europe/Amsterdam', 'Europe/Amsterdam', nov), '12:00');
181
});
182
it('uses the offset of the reference day around a DST switch', () => {
183
// 2026-03-08 US spring-forward; Europe still on CET until 03-29.
184
const before = Date.UTC(2026, 2, 7, 12) / 1000;
185
const after = Date.UTC(2026, 2, 9, 12) / 1000;
186
assert.equal(Rules.convertHm('09:00', 'America/New_York', 'Europe/Amsterdam', before), '15:00');
187
assert.equal(Rules.convertHm('09:00', 'America/New_York', 'Europe/Amsterdam', after), '14:00');
188
});
189
it('converts rules for a viewer; ranges may wrap midnight after conversion', () => {
190
const r = Rules.rulesInTz({ tz: 'Europe/Amsterdam', ap_time: '00:00',
191
ceasefire_ranges: [{ start: '10:00', end: '14:00' }] }, 'Asia/Tokyo', nov);
192
assert.equal(r.tz, 'Asia/Tokyo');
193
assert.equal(r.ap_time, '08:00');
194
assert.deepEqual(r.ceasefire_ranges, [{ start: '18:00', end: '22:00' }]);
195
const w = Rules.rulesInTz({ tz: 'Europe/Amsterdam', ap_time: '12:00',
196
ceasefire_ranges: [{ start: '14:00', end: '20:00' }] }, 'Asia/Tokyo', nov);
197
assert.deepEqual(w.ceasefire_ranges, [{ start: '22:00', end: '04:00' }], 'wraps after conversion');
198
});
199
it('computes the cease-fire in the rules zone', () => {
200
const rules = { ceasefire: true, tz: 'Asia/Tokyo', ceasefire_ranges: [{ start: '22:00', end: '06:00' }] };
201
const t2330tokyo = Date.UTC(2026, 10, 14, 14, 30) / 1000; // 23:30 JST
202
const info = Rules.ceasefireInfo(rules, t2330tokyo);
203
assert.equal(info.active, true);
204
assert.equal(info.until, Date.UTC(2026, 10, 14, 21, 0) / 1000); // 06:00 JST
205
assert.equal(Rules.validTz('Mars/Olympus'), 'Europe/Amsterdam');
206
assert.equal(Rules.validTz('Asia/Tokyo'), 'Asia/Tokyo');
207
});
208
});
209
@@ -149,3 +149,61 @@ describe('Rules timelineIndex (nearest event)', () =>149
assert.equal(Rules.timelineIndex(-0.2, 4), 0);149
assert.equal(Rules.timelineIndex(-0.2, 4), 0);150
});150
});151
});151
});152
153
describe('Rules.angleToMinutes (cease-fire clock)', () => {154
it('maps the dial with 0 at the top, clockwise, snapped to 15 min', () => {155
const top = -Math.PI / 2, right = 0, bottom = Math.PI / 2, left = Math.PI;156
assert.equal(Rules.angleToMinutes(top, 15), 0);157
assert.equal(Rules.angleToMinutes(right, 15), 360);158
assert.equal(Rules.angleToMinutes(bottom, 15), 720);159
assert.equal(Rules.angleToMinutes(left, 15), 1080);160
assert.equal(Rules.angleToMinutes(-Math.PI, 15), 1080);161
// 7 minutes past 6:00 snaps to 6:00; 8 minutes snaps to 6:15162
const perMin = 2 * Math.PI / 1440;163
assert.equal(Rules.angleToMinutes(right + 7 * perMin, 15), 360);164
assert.equal(Rules.angleToMinutes(right + 8 * perMin, 15), 375);165
// just before midnight wraps to 0166
assert.equal(Rules.angleToMinutes(top - 3 * perMin, 15), 0);167
assert.equal(Rules.angleToMinutes(top - 3 * perMin, 1), 1437);168
});169
});170
171
describe('Rules time zones (host zone → viewer local)', () => {172
const nov = Date.UTC(2026, 10, 14, 12) / 1000;173
const jul = Date.UTC(2026, 6, 14, 12) / 1000;174
it('converts wall-clock times between zones, DST-aware', () => {175
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'America/New_York', nov), '16:00');176
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'America/New_York', jul), '16:00');177
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'Asia/Tokyo', nov), '06:00'); // CET+8178
assert.equal(Rules.convertHm('22:00', 'Europe/Amsterdam', 'Asia/Tokyo', jul), '05:00'); // CEST+7179
assert.equal(Rules.convertHm('09:30', 'Asia/Kolkata', 'UTC', nov), '04:00');180
assert.equal(Rules.convertHm('12:00', 'Europe/Amsterdam', 'Europe/Amsterdam', nov), '12:00');181
});182
it('uses the offset of the reference day around a DST switch', () => {183
// 2026-03-08 US spring-forward; Europe still on CET until 03-29.184
const before = Date.UTC(2026, 2, 7, 12) / 1000;185
const after = Date.UTC(2026, 2, 9, 12) / 1000;186
assert.equal(Rules.convertHm('09:00', 'America/New_York', 'Europe/Amsterdam', before), '15:00');187
assert.equal(Rules.convertHm('09:00', 'America/New_York', 'Europe/Amsterdam', after), '14:00');188
});189
it('converts rules for a viewer; ranges may wrap midnight after conversion', () => {190
const r = Rules.rulesInTz({ tz: 'Europe/Amsterdam', ap_time: '00:00',191
ceasefire_ranges: [{ start: '10:00', end: '14:00' }] }, 'Asia/Tokyo', nov);192
assert.equal(r.tz, 'Asia/Tokyo');193
assert.equal(r.ap_time, '08:00');194
assert.deepEqual(r.ceasefire_ranges, [{ start: '18:00', end: '22:00' }]);195
const w = Rules.rulesInTz({ tz: 'Europe/Amsterdam', ap_time: '12:00',196
ceasefire_ranges: [{ start: '14:00', end: '20:00' }] }, 'Asia/Tokyo', nov);197
assert.deepEqual(w.ceasefire_ranges, [{ start: '22:00', end: '04:00' }], 'wraps after conversion');198
});199
it('computes the cease-fire in the rules zone', () => {200
const rules = { ceasefire: true, tz: 'Asia/Tokyo', ceasefire_ranges: [{ start: '22:00', end: '06:00' }] };201
const t2330tokyo = Date.UTC(2026, 10, 14, 14, 30) / 1000; // 23:30 JST202
const info = Rules.ceasefireInfo(rules, t2330tokyo);203
assert.equal(info.active, true);204
assert.equal(info.until, Date.UTC(2026, 10, 14, 21, 0) / 1000); // 06:00 JST205
assert.equal(Rules.validTz('Mars/Olympus'), 'Europe/Amsterdam');206
assert.equal(Rules.validTz('Asia/Tokyo'), 'Asia/Tokyo');207
});208
});209
@@ -168,6 +168,12 @@ def main():
168
168
break
169
169
if give is None and btns.count() >= 3:
170
170
give = btns.nth(2)
171
if give is not None and give.is_disabled():
172
# Opponent out of range (random spawn): giving is legitimately disabled.
173
print('give disabled (out of range), skipping')
174
page2.locator('#sheet-close').click()
175
page2.wait_for_timeout(150)
176
give = None
171
177
if give is not None:
172
178
give.click()
173
179
page2.wait_for_selector('#modal:not([hidden])')
@@ -231,6 +237,11 @@ def main():
231
237
page.wait_for_timeout(500)
232
238
shot(page, 'desktop-game-after-shot')
233
239
240
# Close any sheet left open (e.g. attack disabled when out of range)
241
if page.locator('#sheet:not([hidden])').count():
242
page.locator('#sheet-close').click()
243
page.wait_for_timeout(150)
244
234
245
# Playback arrows: rewind and play
235
246
if page.locator('#tl-back').count():
236
247
# Jump to start via stepping back many times, then play
@@ -168,6 +168,12 @@ def main():168
break168
break169
if give is None and btns.count() >= 3:169
if give is None and btns.count() >= 3:170
give = btns.nth(2)170
give = btns.nth(2)171
if give is not None and give.is_disabled():172
# Opponent out of range (random spawn): giving is legitimately disabled.173
print('give disabled (out of range), skipping')174
page2.locator('#sheet-close').click()175
page2.wait_for_timeout(150)176
give = None171
if give is not None:177
if give is not None:172
give.click()178
give.click()173
page2.wait_for_selector('#modal:not([hidden])')179
page2.wait_for_selector('#modal:not([hidden])')@@ -231,6 +237,11 @@ def main():231
page.wait_for_timeout(500)237
page.wait_for_timeout(500)232
shot(page, 'desktop-game-after-shot')238
shot(page, 'desktop-game-after-shot')233
239
240
# Close any sheet left open (e.g. attack disabled when out of range)241
if page.locator('#sheet:not([hidden])').count():242
page.locator('#sheet-close').click()243
page.wait_for_timeout(150)244
234
# Playback arrows: rewind and play245
# Playback arrows: rewind and play235
if page.locator('#tl-back').count():246
if page.locator('#tl-back').count():236
# Jump to start via stepping back many times, then play247
# Jump to start via stepping back many times, then play