Files

21 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# whisp.sh: LOCAL whisper single-name / one-tab check (task 23)
cd "$(dirname "$0")"
if [ -f cc.pid ] && kill -0 $(cat cc.pid) 2>/dev/null; then echo quit > p-click; for i in $(seq 60); do kill -0 $(cat cc.pid) 2>/dev/null || break; sleep 1; done; fi
for p in $(pgrep -x WowB.exe); do [ "$(readlink /proc/$p/cwd)" = /mnt/Games/OctoWoW-LOCAL-Client/_classic_beta_ ] && kill $p; done; sleep 3; rm -f p-click p-wait
for try in 1 2; do
rm -f p-wait; timeout 3600 python3 -u cc.py > cc.out 2>&1 & cc=$!; echo $cc > cc.pid; sleep 3
until [ -e p-wait ] || ! kill -0 $cc 2>/dev/null; do sleep 2; done
[ -e p-wait ] && break
grep -q "reason=14" cc.out && [ $try = 1 ] && { echo "reason=14: waiting, retry once"; sleep 45; continue; }
echo "launch failed: $(tail -1 cc.out)"; exit 1
done
[ -e p-wait ] || exit 1
./cmds.sh x.png '960 1000' >/dev/null 2>&1; sleep 25
P='W=W or CreateFrame("Frame") W:RegisterEvent("CHAT_MSG_WHISPER") W:RegisterEvent("CHAT_MSG_WHISPER_INFORM") W:SetScript("OnEvent",function(_,e,m,a2) print(e,"["..tostring(a2).."]") end)'
./cmds.sh w0.png "chat /run $P" 'chat /run print("ME",UnitName("player"),GetCVar("whisperMode"),RegionalUniqueNamesEnabled())' | tail -3
me=$(echo gatewaypal)
./cmds.sh w1.png "chat /w $me hello one" >/dev/null 2>&1; sleep 3
./cmds.sh w2.png "chat /w Gatewaypal hello two" >/dev/null 2>&1; sleep 3
./cmds.sh w3.png 'chat /run local n=0 for i=1,NUM_CHAT_WINDOWS do local f=_G["ChatFrame"..i] if f and f.isTemporary and f.chatType=="WHISPER" then n=n+1 print("TAB",i,"["..tostring(f.chatTarget).."]") end end print("WTABS",n)' | tail -3