From 58133d3245850a8bb8989fe734c66033e8dc3723 Mon Sep 17 00:00:00 2001 From: Nik Afiq Date: Sun, 5 Jul 2026 00:20:23 +0900 Subject: [PATCH] Add script for automating mailbox actions in Blue Archive --- ba_dailies.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 ba_dailies.sh diff --git a/ba_dailies.sh b/ba_dailies.sh new file mode 100644 index 0000000..79ceb72 --- /dev/null +++ b/ba_dailies.sh @@ -0,0 +1,58 @@ +#!/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."