Initial commit: the FS25 Lua mod (live.json data export), the FS25-WebDashboard project (Node/web dashboard + PySide6 desktop variant), and FarmHUD (standalone PySide6 companion app with Discord Rich Presence, settings, and installer).
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
"""The 'Easter Egg' stat slot: a rotating fun line, mostly playful
|
|
commentary on your current money/time, occasionally a pure surprise line.
|
|
Deterministic-ish per poll (re-picked only when explicitly rolled) so it
|
|
doesn't flicker on every 500ms data refresh.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import random
|
|
from typing import Optional
|
|
|
|
RARE_LINES = [
|
|
"🐄 Irgendwo hat gerade eine Kuh gemuht.",
|
|
"🛰️ Dieses Feld wird seit 1998 nicht mehr gedüngt.",
|
|
"🦆 Eine Ente hat deinen Trecker für ein Boot gehalten.",
|
|
"🌾 Der Weizen träumt von der Ernte.",
|
|
"🚜 Achtung: Traktor-Philosoph erkannt.",
|
|
"🥔 Die Kartoffel des Tages grüßt dich.",
|
|
]
|
|
|
|
MONEY_LINES = [
|
|
(1_000_000, "🤑 Krösus vom Dienst - über 1 Million auf dem Konto!"),
|
|
(100_000, "💰 Solide gewirtschaftet - sechsstellig im Plus."),
|
|
(0, "🌱 Jeder große Hof fängt mal klein an."),
|
|
]
|
|
|
|
NIGHT_HOURS = set(range(22, 24)) | set(range(0, 5))
|
|
|
|
|
|
def pick_easter_egg(money: Optional[float], hour: Optional[int], rng: Optional[random.Random] = None) -> str:
|
|
rng = rng or random
|
|
# ~1 in 6 rolls is a pure surprise line, independent of game state.
|
|
if rng.random() < (1 / 6):
|
|
return rng.choice(RARE_LINES)
|
|
|
|
if hour is not None and hour in NIGHT_HOURS:
|
|
return "🌙 Nachtschicht auf dem Hof - Kaffee nicht vergessen."
|
|
|
|
if money is not None:
|
|
for threshold, line in MONEY_LINES:
|
|
if money >= threshold:
|
|
return line
|
|
|
|
return "🚜 FarmHUD hält dich auf dem Laufenden."
|