Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- CharacterName=
- LoginUsername=
- LoginPassword=
- PushToken=
- RepeatCount=1 #How many pots pretty much. Each repeat is 20 minutes ish
- ## shrokrim uses like 9% per relog
- EquipShrokrim=F1
- UseItemUnderneath=F2
- UnequipAll=F3
- EquipWand=F4
- CastUltimaBoost=F5
- EatUltimaPot=F6
- EatThrowingPot=F7
- EatFood=F8
- WindowCoordinates() {
- WindowX=$(xwininfo -name "$CharacterName : RPG World Online (2.14)" | grep "Absolute upper-left X" | cut -d' ' -f7)
- WindowY=$(xwininfo -name "$CharacterName : RPG World Online (2.14)" | grep "Absolute upper-left Y" | cut -d' ' -f7)
- WeaponSlotX=$(($WindowX+715))
- WeaponSlotY=$(($WindowY+350))
- ChatBoxX=$(($WindowX+5))
- ChatBoxY=$(($WindowY+675))
- ItemBoxX=$(($WindowX+625))
- ItemBoxY=$(($WindowY+692))
- PlayerMenuX=$(($WindowX+670))
- PlayerMenuY=$(($WindowY+263))
- }
- RestartGame() {
- z=1
- kill $PID
- echo RESTARTING GAME
- sleep 2s
- eval '/home/kai/.wine/drive_c/Program\ Files/RPG\ World\ Online/autoupdater.exe' &
- sleep 5s
- sleep 1s
- xdotool key "Tab" && sleep 0.5s && xdotool key "Tab"
- sleep 0.5s
- xdotool key "Return"
- sleep 1s
- Waiting=1
- while [ $Waiting == "1" ]; do
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- if [ "$WindowName" == "Yikes!" ]; then
- Waiting=0
- sleep 0.5s
- xdotool key "Return"
- sleep 0.5s
- fi
- done
- Waiting=1
- while [ $Waiting == "1" ]; do
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- if [ "$WindowName" == "Choose RPG Server IP" ]; then
- Waiting=0
- xdotool key "Tab" && sleep 0.5s && xdotool key "Tab"
- sleep 0.5s
- xdotool key "Down" && sleep 0.5s && xdotool key "Down"
- sleep 0.5s
- xdotool key "Return"
- fi
- done
- Waiting=1
- while [ $Waiting == "1" ]; do
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- if [ "$WindowName" == "Login" ]; then
- Waiting=0
- sleep 1s
- xdotool type "$LoginUsername"
- sleep 1s
- xdotool key "Tab"
- sleep 1s
- xdotool type "$LoginPassword"
- sleep 1s
- xdotool key "Return"
- fi
- done
- sleep 2s
- EnterWorld
- z=0
- x=0
- }
- ExitWorld() {
- xdotool key "ALT+F4"
- sleep 0.5s
- xdotool key "Return"
- echo exit world
- }
- EnterWorld() {
- EnterWorld=1
- while [ "$EnterWorld" -eq "1" ]; do
- sleep 0.1s
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- if [ "$WindowName" == "Main Menu" ]; then
- sleep 2s
- xdotool key Return
- echo entering world
- sleep 8s
- fi
- if [ "$WindowName" == "RPG World Online (2.14)" ]; then
- EnteringWorld=1
- while [ "$EnteringWorld" -eq "1" ]; do
- sleep 3s
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- if [ "$WindowName" == "Special Message" ]; then
- EnteringWorld=0
- EnterWorld=0
- fi
- if [ "$WindowName" == "Main Menu" ]; then
- sleep 3s
- xdotool key Return
- echo entering world
- sleep 8s
- fi
- done
- fi
- if [ "$WindowName" == "Special Message" ]; then
- EnterWorld=0
- fi
- done
- }
- CloseMOTD() {
- CloseMOTD=1
- while [ "$CloseMOTD" -eq "1" ]; do ## Wait for login to continue
- WindowID=$(xdotool search --name "Special Message")
- sleep 0.01s
- if [ "$WindowName" == "Special Message" ]; then
- sleep 1s
- Timeout=0
- xdotool search --name "Special Message" windowactivate --sync %1 key "Return" windowactivate $(xdotool getactivewindow)
- sleep 0.4s && xdotool keyup Return
- CloseMOTD=0
- fi
- done
- }
- CurrentWindow() {
- b=1
- while [ "$b" -eq "1" ]; do
- WindowID=$(xdotool search --name "Special Message")
- WindowID2=$(xdotool search --name "Main Menu")
- gamenotrunning=1
- echo here3
- sleep 0.1s
- if [ -n "$WindowID" ]; then
- CloseMOTD
- Core
- b=0
- fi
- if [ -n "$WindowID2" ]; then
- EnterWorld
- #DebugCode=17 && Debug
- Timeout=0
- b=0
- fi
- done
- }
- Core2() {
- InfiniteLoop="1"
- while [ "$InfiniteLoop" -eq "1" ]; do
- CurrentWindow
- done
- }
- Core() {
- if [ "$RepeatCount" -ne "$CurrentCount" ]; then
- Reguard
- fi
- if [ "$RepeatCount" -eq "$CurrentCount" ]; then
- CheckWeaponPlus
- sleep 1s
- RestartGame
- sleep 1s
- CloseMOTD
- RepairWeapon
- ExitWorld
- RestartGame
- CurrentCount=0
- RepeatCount=9
- else
- ExitWorld
- fi
- }
- GrabPIDofGame() {
- x=1
- while [ "$x" -eq "1" ]; do
- WindowTitle=$(xdotool getactivewindow getwindowname)
- WindowName=$(echo $WindowTitle)
- sleep 0.2s
- if [ "$WindowName" == "$CharacterName : RPG World Online (2.14)" ]; then
- x=0
- GameWindow=$(xdotool getwindowfocus getwindowpid)
- PID=$GameWindow
- fi
- done
- }
- Reguard() {
- : $((CurrentCount++))
- GrabPIDofGame
- sleep 1s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 151s
- sleep 1s
- }
- Reguard2() {
- : $((CurrentCount++))
- xdotool key "ALT+G"
- sleep 3s
- xdotool key $EquipWand
- sleep 3s
- xdotool key $EatFood
- sleep 3s
- xdotool key $CastUltimaBoost
- sleep 3s
- xdotool key $EquipShrokrim
- sleep 3s
- xdotool key $EatUltimaPot
- sleep 3s
- xdotool key $EatThrowingPot
- sleep 3s
- #xdotool key $RedPot
- sleep 3s
- #xdotool key $StealthPot
- sleep 3s
- GrabPIDofGame
- sleep 276s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 151.5s
- xdotool key $EatFood
- sleep 151.5s
- xdotool key "ALT+G"
- sleep 303s
- xdotool key "ALT+G"
- sleep 151s
- }
- OCR() {
- SCR_IMG="/home/kai/Documents/Scripts/Modules"
- escrotum -s $SCR_IMG/OCR.png &> /dev/null &
- PictureTaken=$!
- sleep 0.2s
- xdotool mousemove $ChatBoxX $ChatBoxY
- sleep 0.5s
- xdotool mousedown 1
- sleep 0.5s
- xdotool mousemove_relative 390 20
- sleep 0.5s
- xdotool mouseup 1
- wait $PictureTaken
- mogrify -modulate 100,0 -resize 400% $SCR_IMG/OCR.png &> /dev/null
- tesseract $SCR_IMG/OCR.png $SCR_IMG/OCR -l eng &> /dev/null
- Result=$(grep "use left" $SCR_IMG/OCR.txt | rev | awk '{print $3}' | rev)
- }
- OCRPlus() {
- SCR_IMG="/home/kai/Documents/Scripts/Modules"
- escrotum -s $SCR_IMG/OCR.png &> /dev/null &
- PictureTaken=$!
- sleep 0.2s
- xdotool mousemove $ItemBoxX $ItemBoxY
- sleep 0.5s
- xdotool mousedown 1
- sleep 0.5s
- xdotool mousemove_relative 387 30
- sleep 0.5s
- xdotool mouseup 1
- wait $PictureTaken
- mogrify -modulate 100,0 -resize 400% $SCR_IMG/OCR.png &> /dev/null
- tesseract $SCR_IMG/OCR.png $SCR_IMG/OCR -l eng &> /dev/null
- ResultPlus=$(grep "+" $SCR_IMG/OCR.txt | cut -f1 -d' ' | tr -d '\040\011\012\015')
- }
- SendPush() {
- curl --header "Authorization: Bearer $PushToken" -X POST https://api.pushbullet.com/v2/pushes -d type=note -d title="RPGWO Script" -d body="Weapon needs to be plussed" > /dev/null
- }
- CheckWeaponPlus() {
- ResultGrabbed=0
- WindowCoordinates
- xdotool mousemove $WeaponSlotX $WeaponSlotY
- sleep 0.4s
- xdotool click 1
- sleep 0.4s
- while [ $ResultGrabbed == "0" ]; do
- OCRPlus
- sleep 1s
- if [[ "$ResultPlus" = "+5" ]]; then
- echo plussed
- ResultGrabbed=1
- elif [[ "$ResultPlus" = "+4" ]]; then
- echo plussed
- ResultGrabbed=1
- else
- ResultGrabbed=1
- echo weapon not plussed
- SendPush
- fi
- done
- }
- RepairWeapon2() {
- ResultGrabbed=0
- RepeatCount=9
- while [ $ResultGrabbed == "0" ]; do
- WindowCoordinates
- xdotool mousemove $WeaponSlotX $WeaponSlotY
- sleep 0.4s
- xdotool click 3
- sleep 0.4s
- OCR
- sleep 1s
- xdotool mousemove $PlayerMenuX $PlayerMenuY
- sleep 0.4s
- xdotool click 1
- sleep 1s
- UseLeft=$(echo ${Result::-1})
- if ! [ "$UseLeft" -eq "$UseLeft" ] 2> /dev/null
- then
- echo "Sorry integers only"
- else
- echo integer detected
- if [[ "$UseLeft" -lt "100" ]] || [[ "$UseLeft" -gt "1" ]]; then
- ResultGrabbed=1
- RepairAmount=$(echo $((100-$UseLeft)))
- RepairAmount=$(echo $(($RepairAmount+1)))
- fi
- fi
- done
- echo $RepairAmount
- GrabPIDofGame
- sleep 2s
- xdotool key $UnequipAll
- sleep 2s
- xdotool key $EquipWand
- sleep 3s
- xdotool key $EatFood
- sleep 3s
- xdotool key $CastUltimaBoost
- sleep 3s
- xdotool key $EatUltimaPot
- sleep 3s
- xdotool key $EatThrowingPot
- sleep 3s
- while [ $RepairAmount -gt "0" ]; do
- : $((RepairAmount--))
- if [ $RepairAmount == "50" ]; then
- ExitWorld
- EnterWorld
- sleep 10s
- CloseMOTD
- fi
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- done
- sleep 2s
- xdotool key $EquipShrokrim
- sleep 2s
- }
- RepairWeapon() {
- ResultGrabbed=0
- while [ $ResultGrabbed == "0" ]; do
- WindowCoordinates
- xdotool mousemove $WeaponSlotX $WeaponSlotY
- sleep 0.4s
- xdotool click 3
- sleep 0.4s
- OCR
- sleep 1s
- xdotool mousemove $PlayerMenuX $PlayerMenuY
- sleep 0.4s
- xdotool click 1
- sleep 1s
- UseLeft=$(echo ${Result::-1})
- if ! [ "$UseLeft" -eq "$UseLeft" ] 2> /dev/null
- then
- echo "Sorry integers only"
- else
- echo integer detected
- if [[ "$UseLeft" -lt "100" ]] || [[ "$UseLeft" -gt "1" ]]; then
- ResultGrabbed=1
- RepairAmount=$(echo $((100-$UseLeft)))
- RepairAmount=$(echo $(($RepairAmount+1)))
- fi
- fi
- done
- sleep 2s
- xdotool key $UnequipAll
- sleep 2s
- xdotool key $EatFood
- sleep 2s
- GrabPIDofGame
- while [ $RepairAmount -gt "0" ]; do
- : $((RepairAmount--))
- if [ $RepairAmount == "50" ]; then
- ExitWorld
- EnterWorld
- CloseMOTD
- fi
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- xdotool key $UseItemUnderneath && sleep 2s
- done
- sleep 2s
- xdotool key $EquipShrokrim
- sleep 2s
- }
- CurrentCount=0
- Core2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement