ba-auto-daily/ba_dailies.sh

59 lines
1007 B
Bash

#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/run/user/1000/gdm/Xauthority
WIN_NAME="BlueArchive"
MAILBOX_ICON="1726 60"
CLAIM_ALL="1691 1128"
get_window() {
xdotool search --name "$WIN_NAME" | head -1
}
click() {
local coords="$1"
xdotool mousemove $coords click 1
sleep 0.5
}
press_enter() {
xdotool key Return
sleep 0.5
}
press_esc() {
xdotool key Escape
sleep 0.5
}
focus_game() {
local win
win=$(get_window)
if [ -z "$win" ]; then
echo "ERROR: Blue Archive window not found. Is the game running?"
exit 1
fi
xdotool windowactivate "$win"
sleep 0.5
}
do_mailbox() {
echo "[mailbox] Opening mailbox..."
click "$MAILBOX_ICON"
sleep 1.5
echo "[mailbox] Claiming all..."
click "$CLAIM_ALL"
sleep 1
echo "[mailbox] Confirming claim..."
press_enter
sleep 1
echo "[mailbox] Closing mailbox..."
press_esc
sleep 1
echo "[mailbox] Done."
}
focus_game
do_mailbox
echo "All done."