beta release fix
This commit is contained in:
@@ -1,16 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
type_text() {
|
||||
local text="$1"
|
||||
local delay="$2"
|
||||
local target_tty="$3"
|
||||
local char
|
||||
|
||||
while IFS= read -r -n1 char; do
|
||||
printf "%b" "$char"
|
||||
if [ -n "$target_tty" ]; then
|
||||
printf "%b" "$char" > "$target_tty" 2>/dev/null
|
||||
else
|
||||
printf "%b" "$char"
|
||||
fi
|
||||
sleep "$delay"
|
||||
done <<< "$text"
|
||||
|
||||
printf "\n"
|
||||
if [ -n "$target_tty" ]; then
|
||||
printf "\n" > "$target_tty" 2>/dev/null
|
||||
else
|
||||
printf "\n"
|
||||
fi
|
||||
}
|
||||
|
||||
type_text "$(echo -e "\033[1;38;2;255;255;0mHerzlichen Glückwunsch! Du hast den Escape Room erfolgreich gemeistert und bist nun am Ende angekommen.\033[0m")" 0.02
|
||||
type_text "$(echo -e "\n\033[1;38;2;255;255;128mVielen Dank fürs Spielen!\033[0m")" 0.04
|
||||
# Win message für crime5 mit Typewriter-Effekt
|
||||
WIN_MSG="$(echo -e "\033[1;38;2;255;255;0mHerzlichen Glückwunsch! Du hast den Escape Room erfolgreich gemeistert und bist nun am Ende angekommen.\033[0m")"
|
||||
WIN_MSG2="$(echo -e "\n\033[1;38;2;255;255;128mVielen Dank fürs Spielen!\033[0m")"
|
||||
|
||||
# TTY von crime5 aus gespeicherter Datei lesen (vom login_wrapper.sh gesetzt)
|
||||
CRIME5_TTY=""
|
||||
if [ -f /home/crime5/.timer/current_tty ]; then
|
||||
CRIME5_TTY=$(cat /home/crime5/.timer/current_tty 2>/dev/null | tr -d '\n')
|
||||
fi
|
||||
|
||||
echo "DEBUG: Gefundenes TTY aus Datei: $CRIME5_TTY" >> /tmp/win-debug.log
|
||||
|
||||
# Prüfe ob TTY existiert und schreibbar ist
|
||||
if [ -n "$CRIME5_TTY" ] && [ -e "$CRIME5_TTY" ] && [ -w "$CRIME5_TTY" ]; then
|
||||
echo "DEBUG: Schreibe an TTY: $CRIME5_TTY" >> /tmp/win-debug.log
|
||||
# Typewriter-Effekt direkt an crime5's Terminal
|
||||
type_text "$WIN_MSG" 0.02 "$CRIME5_TTY"
|
||||
type_text "$WIN_MSG2" 0.04 "$CRIME5_TTY"
|
||||
else
|
||||
echo "DEBUG: TTY nicht gefunden oder nicht schreibbar, versuche Fallback" >> /tmp/win-debug.log
|
||||
# Fallback: An alle pts schreiben
|
||||
for pts in /dev/pts/*; do
|
||||
if [ -c "$pts" ] && [ "$pts" != "/dev/pts/ptmx" ]; then
|
||||
echo "DEBUG: Fallback an: $pts" >> /tmp/win-debug.log
|
||||
type_text "$WIN_MSG" 0.02 "$pts"
|
||||
type_text "$WIN_MSG2" 0.04 "$pts"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Zusätzlich für crime5 in eine Datei schreiben
|
||||
echo "$WIN_MSG" > /home/crime5/gewonnen.txt
|
||||
echo "$WIN_MSG2" >> /home/crime5/gewonnen.txt
|
||||
chown crime5:crime5 /home/crime5/gewonnen.txt 2>/dev/null
|
||||
Reference in New Issue
Block a user