Forecast line gets its own tooltip
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
91a5263acf
commit
8d6d23261e
2 changed files with 7 additions and 2 deletions
2
game.py
2
game.py
|
|
@ -3849,7 +3849,7 @@ def happenings_view(world: dict, now: float) -> dict:
|
||||||
"season": season(world, now),
|
"season": season(world, now),
|
||||||
"weather": {**{k: v for k, v in WEATHER[weather["kind"]].items()}, "kind": weather["kind"], "until": weather["until"],
|
"weather": {**{k: v for k, v in WEATHER[weather["kind"]].items()}, "kind": weather["kind"], "until": weather["until"],
|
||||||
"next": weather["next"], "next_name": WEATHER[weather["next"]]["name"],
|
"next": weather["next"], "next_name": WEATHER[weather["next"]]["name"],
|
||||||
"next_icon": WEATHER[weather["next"]]["icon"]},
|
"next_icon": WEATHER[weather["next"]]["icon"], "next_text": WEATHER[weather["next"]]["text"]},
|
||||||
"effects": [{k: e[k] for k in ("kind", "name", "icon", "text", "until", "speed", "yield", "xp") if k in e}
|
"effects": [{k: e[k] for k in ("kind", "name", "icon", "text", "until", "speed", "yield", "xp") if k in e}
|
||||||
| {"offer": e.get("offer", False), "cost": e.get("cost")} for e in city["effects"]],
|
| {"offer": e.get("offer", False), "cost": e.get("cost")} for e in city["effects"]],
|
||||||
"problems": problems,
|
"problems": problems,
|
||||||
|
|
|
||||||
|
|
@ -1016,7 +1016,12 @@ function weatherCard() {
|
||||||
const h = S.happenings, w = h.weather;
|
const h = S.happenings, w = h.weather;
|
||||||
return `<div class="stat" title="${esc(weatherTip(w))}"><div class="k">${h.season.icon} ${h.season.name}, day ${h.season.day}</div>
|
return `<div class="stat" title="${esc(weatherTip(w))}"><div class="k">${h.season.icon} ${h.season.name}, day ${h.season.day}</div>
|
||||||
<div class="v">${w.icon} <small>${esc(w.name)}</small></div>
|
<div class="v">${w.icon} <small>${esc(w.name)}</small></div>
|
||||||
<div class="note">${w.next_icon} ${esc(w.next_name)} in ${countdown(w.until)}</div></div>`;
|
<div class="note" title="${esc(forecastTip(w))}">${w.next_icon} ${esc(w.next_name)} in ${countdown(w.until)}</div></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Fog in 3h 20m: scouting 30% and hunting 10% slower."
|
||||||
|
function forecastTip(w) {
|
||||||
|
return `${w.next_name} in ${dur(w.until - serverNow())}: ${w.next_text.charAt(0).toLowerCase()}${w.next_text.slice(1)}.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything going on in the city right now, and what anyone can do about it.
|
// Everything going on in the city right now, and what anyone can do about it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue