Advertisement
Interknet

Untitled

Jan 24th, 2020
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 10.06 KB | None | 0 0
  1. #!/bin/bash
  2. CharacterName=
  3. LoginUsername=
  4. LoginPassword=
  5. PushToken=
  6. RepeatCount=1 #How many pots pretty much. Each repeat is 20 minutes ish
  7. ## shrokrim uses like 9% per relog
  8.  
  9. EquipShrokrim=F1
  10. UseItemUnderneath=F2
  11. UnequipAll=F3
  12. EquipWand=F4
  13. CastUltimaBoost=F5
  14. EatUltimaPot=F6
  15. EatThrowingPot=F7
  16. EatFood=F8
  17.  
  18.  
  19. WindowCoordinates() {
  20. WindowX=$(xwininfo -name "$CharacterName : RPG World Online (2.14)" | grep "Absolute upper-left X" | cut -d' ' -f7)
  21. WindowY=$(xwininfo -name "$CharacterName : RPG World Online (2.14)" | grep "Absolute upper-left Y" | cut -d' ' -f7)
  22. WeaponSlotX=$(($WindowX+715))
  23. WeaponSlotY=$(($WindowY+350))
  24. ChatBoxX=$(($WindowX+5))
  25. ChatBoxY=$(($WindowY+675))
  26. ItemBoxX=$(($WindowX+625))
  27. ItemBoxY=$(($WindowY+692))
  28. PlayerMenuX=$(($WindowX+670))
  29. PlayerMenuY=$(($WindowY+263))
  30. }
  31.  
  32. RestartGame() {
  33.         z=1
  34.        kill $PID
  35.         echo RESTARTING GAME
  36.         sleep 2s
  37.         eval '/home/kai/.wine/drive_c/Program\ Files/RPG\ World\ Online/autoupdater.exe' &
  38.         sleep 5s
  39.         sleep 1s
  40.         xdotool key "Tab" && sleep 0.5s &&  xdotool key "Tab"
  41.         sleep 0.5s
  42.         xdotool key "Return"
  43.         sleep 1s
  44.         Waiting=1
  45.         while [ $Waiting == "1" ]; do
  46.         WindowTitle=$(xdotool getactivewindow getwindowname)
  47.         WindowName=$(echo $WindowTitle)
  48.         if [ "$WindowName" == "Yikes!" ]; then
  49.         Waiting=0
  50.         sleep 0.5s
  51.         xdotool key "Return"
  52.         sleep 0.5s
  53.         fi
  54.         done
  55.         Waiting=1
  56.         while [ $Waiting == "1" ]; do
  57.         WindowTitle=$(xdotool getactivewindow getwindowname)
  58.         WindowName=$(echo $WindowTitle)
  59.         if [ "$WindowName" == "Choose RPG Server IP" ]; then
  60.         Waiting=0
  61.         xdotool key "Tab" && sleep 0.5s &&  xdotool key "Tab"
  62.         sleep 0.5s
  63.         xdotool key "Down" && sleep 0.5s &&  xdotool key "Down"
  64.         sleep 0.5s
  65.         xdotool key "Return"
  66.         fi
  67.         done
  68.         Waiting=1
  69. while [ $Waiting == "1" ]; do
  70.         WindowTitle=$(xdotool getactivewindow getwindowname)
  71.         WindowName=$(echo $WindowTitle)
  72.         if [ "$WindowName" == "Login" ]; then
  73.         Waiting=0
  74.         sleep 1s
  75.         xdotool type "$LoginUsername"
  76.         sleep 1s
  77.         xdotool key "Tab"
  78.         sleep 1s
  79.         xdotool type "$LoginPassword"
  80.         sleep 1s
  81.         xdotool key "Return"
  82.         fi
  83.         done
  84.         sleep 2s
  85.         EnterWorld
  86.         z=0
  87.         x=0
  88. }
  89. ExitWorld() {
  90. xdotool key "ALT+F4"
  91. sleep 0.5s
  92. xdotool key "Return"
  93. echo exit world
  94. }
  95. EnterWorld() {
  96. EnterWorld=1
  97. while [ "$EnterWorld" -eq "1" ]; do
  98.         sleep 0.1s
  99.         WindowTitle=$(xdotool getactivewindow getwindowname)
  100.         WindowName=$(echo $WindowTitle)
  101.         if [ "$WindowName" == "Main Menu" ]; then
  102.             sleep 2s
  103.             xdotool key Return
  104.             echo entering world
  105.             sleep 8s
  106.         fi
  107. if [ "$WindowName" == "RPG World Online (2.14)" ]; then
  108.     EnteringWorld=1
  109.     while [ "$EnteringWorld" -eq "1" ]; do
  110.         sleep 3s
  111.         WindowTitle=$(xdotool getactivewindow getwindowname)
  112.         WindowName=$(echo $WindowTitle)
  113.         if [ "$WindowName" == "Special Message" ]; then
  114.             EnteringWorld=0
  115.             EnterWorld=0
  116.         fi
  117.         if [ "$WindowName" == "Main Menu" ]; then
  118.             sleep 3s
  119.             xdotool key Return
  120.             echo entering world
  121.             sleep 8s
  122.         fi
  123.     done
  124. fi
  125.     if [ "$WindowName" == "Special Message" ]; then
  126.         EnterWorld=0
  127.     fi
  128.        
  129.  
  130. done
  131. }
  132. CloseMOTD() {
  133. CloseMOTD=1
  134. while [ "$CloseMOTD" -eq "1" ]; do                         ## Wait for login to continue
  135.     WindowID=$(xdotool search --name "Special Message")
  136.     sleep 0.01s
  137.   if [ "$WindowName" == "Special Message" ]; then
  138. sleep 1s
  139.         Timeout=0
  140.         xdotool search --name "Special Message" windowactivate --sync %1 key "Return" windowactivate $(xdotool getactivewindow)
  141.         sleep 0.4s && xdotool keyup Return
  142.         CloseMOTD=0
  143.     fi
  144. done
  145. }
  146. CurrentWindow() {
  147. b=1
  148. while [ "$b" -eq "1" ]; do
  149.     WindowID=$(xdotool search --name "Special Message")
  150.     WindowID2=$(xdotool search --name "Main Menu")
  151.     gamenotrunning=1
  152.     echo here3
  153.     sleep 0.1s
  154.     if [ -n "$WindowID" ]; then
  155.         CloseMOTD
  156.         Core
  157.         b=0
  158.     fi
  159.     if [ -n "$WindowID2" ]; then
  160.         EnterWorld
  161.         #DebugCode=17 && Debug
  162.         Timeout=0
  163.         b=0
  164.     fi
  165. done
  166. }
  167.  
  168.  
  169. Core2() {
  170. InfiniteLoop="1"
  171. while [ "$InfiniteLoop" -eq "1" ]; do
  172.     CurrentWindow
  173. done
  174. }
  175.  
  176. Core() {
  177. if [ "$RepeatCount" -ne "$CurrentCount" ]; then
  178.  Reguard
  179.  fi
  180. if [ "$RepeatCount" -eq "$CurrentCount" ]; then
  181.         CheckWeaponPlus
  182.         sleep 1s
  183.        RestartGame
  184.         sleep 1s
  185.         CloseMOTD
  186.         RepairWeapon
  187.         ExitWorld
  188.         RestartGame
  189.         CurrentCount=0
  190.         RepeatCount=9
  191.    else
  192.    ExitWorld
  193.     fi
  194. }
  195. GrabPIDofGame() {
  196. x=1
  197. while [ "$x" -eq "1" ]; do
  198. WindowTitle=$(xdotool getactivewindow getwindowname)
  199. WindowName=$(echo $WindowTitle)
  200. sleep 0.2s
  201. if [ "$WindowName" == "$CharacterName : RPG World Online (2.14)" ]; then
  202.     x=0
  203.     GameWindow=$(xdotool getwindowfocus getwindowpid)
  204.     PID=$GameWindow
  205. fi
  206. done
  207. }
  208.  
  209. Reguard() {
  210. : $((CurrentCount++))
  211. GrabPIDofGame
  212.  
  213. sleep 1s
  214. xdotool key "ALT+G"
  215. sleep 303s
  216. xdotool key "ALT+G"
  217. sleep 303s
  218. xdotool key "ALT+G"
  219. sleep 303s
  220. xdotool key "ALT+G"
  221. sleep 303s
  222. xdotool key "ALT+G"
  223. sleep 151s
  224. sleep 1s
  225.  
  226. }
  227.  
  228. Reguard2() {
  229. : $((CurrentCount++))
  230. xdotool key "ALT+G"
  231. sleep 3s
  232. xdotool key $EquipWand
  233. sleep 3s
  234. xdotool key $EatFood
  235. sleep 3s
  236. xdotool key $CastUltimaBoost
  237. sleep 3s
  238. xdotool key $EquipShrokrim
  239. sleep 3s
  240. xdotool key $EatUltimaPot
  241. sleep 3s
  242. xdotool key $EatThrowingPot
  243. sleep 3s
  244. #xdotool key $RedPot
  245. sleep 3s
  246. #xdotool key $StealthPot
  247. sleep 3s
  248. GrabPIDofGame
  249. sleep 276s
  250. xdotool key "ALT+G"
  251. sleep 303s
  252. xdotool key "ALT+G"
  253. sleep 151.5s
  254. xdotool key $EatFood
  255. sleep 151.5s
  256. xdotool key "ALT+G"
  257. sleep 303s
  258. xdotool key "ALT+G"
  259. sleep 151s
  260. }
  261.  
  262. OCR() {
  263. SCR_IMG="/home/kai/Documents/Scripts/Modules"
  264. escrotum -s $SCR_IMG/OCR.png &> /dev/null &
  265. PictureTaken=$!
  266. sleep 0.2s
  267. xdotool mousemove $ChatBoxX $ChatBoxY
  268. sleep 0.5s
  269. xdotool mousedown 1
  270. sleep 0.5s
  271. xdotool mousemove_relative 390 20
  272. sleep 0.5s
  273. xdotool mouseup 1
  274. wait $PictureTaken
  275. mogrify -modulate 100,0 -resize 400% $SCR_IMG/OCR.png &> /dev/null
  276. tesseract $SCR_IMG/OCR.png $SCR_IMG/OCR -l eng &> /dev/null
  277. Result=$(grep "use left" $SCR_IMG/OCR.txt | rev | awk '{print $3}' | rev)
  278. }
  279.  
  280. OCRPlus() {
  281. SCR_IMG="/home/kai/Documents/Scripts/Modules"
  282. escrotum -s $SCR_IMG/OCR.png &> /dev/null &
  283. PictureTaken=$!
  284. sleep 0.2s
  285. xdotool mousemove $ItemBoxX $ItemBoxY
  286. sleep 0.5s
  287. xdotool mousedown 1
  288. sleep 0.5s
  289. xdotool mousemove_relative 387 30
  290. sleep 0.5s
  291. xdotool mouseup 1
  292. wait $PictureTaken
  293. mogrify -modulate 100,0 -resize 400% $SCR_IMG/OCR.png &> /dev/null
  294. tesseract $SCR_IMG/OCR.png $SCR_IMG/OCR -l eng &> /dev/null
  295. ResultPlus=$(grep "+" $SCR_IMG/OCR.txt | cut -f1 -d' ' | tr -d '\040\011\012\015')
  296. }
  297.  
  298. SendPush() {
  299. 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
  300. }
  301.  
  302. CheckWeaponPlus() {
  303. ResultGrabbed=0
  304. WindowCoordinates
  305. xdotool mousemove $WeaponSlotX $WeaponSlotY
  306. sleep 0.4s
  307. xdotool click 1
  308. sleep 0.4s
  309. while [ $ResultGrabbed == "0" ]; do
  310.     OCRPlus
  311.     sleep 1s
  312.         if [[ "$ResultPlus" = "+5" ]]; then
  313.         echo plussed
  314.         ResultGrabbed=1
  315.         elif [[ "$ResultPlus" = "+4" ]]; then
  316.         echo plussed
  317.         ResultGrabbed=1
  318.         else
  319.         ResultGrabbed=1
  320.         echo weapon not plussed
  321.         SendPush
  322.     fi
  323. done
  324. }
  325.  
  326. RepairWeapon2() {
  327. ResultGrabbed=0
  328. RepeatCount=9
  329. while [ $ResultGrabbed == "0" ]; do
  330. WindowCoordinates
  331. xdotool mousemove $WeaponSlotX $WeaponSlotY
  332. sleep 0.4s
  333. xdotool click 3
  334. sleep 0.4s
  335.     OCR
  336.     sleep 1s
  337.     xdotool mousemove $PlayerMenuX $PlayerMenuY
  338.     sleep 0.4s
  339.     xdotool click 1
  340.     sleep 1s
  341.     UseLeft=$(echo ${Result::-1})
  342. if ! [ "$UseLeft" -eq "$UseLeft" ] 2> /dev/null
  343. then
  344.     echo "Sorry integers only"
  345. else
  346.     echo integer detected
  347.             if [[ "$UseLeft" -lt "100" ]] || [[ "$UseLeft" -gt "1" ]]; then
  348.         ResultGrabbed=1
  349.         RepairAmount=$(echo $((100-$UseLeft)))
  350.         RepairAmount=$(echo $(($RepairAmount+1)))
  351.     fi
  352. fi
  353.  
  354. done
  355. echo $RepairAmount
  356. GrabPIDofGame
  357. sleep 2s
  358. xdotool key $UnequipAll
  359. sleep 2s
  360. xdotool key $EquipWand
  361. sleep 3s
  362. xdotool key $EatFood
  363. sleep 3s
  364. xdotool key $CastUltimaBoost
  365. sleep 3s
  366. xdotool key $EatUltimaPot
  367. sleep 3s
  368. xdotool key $EatThrowingPot
  369. sleep 3s
  370. while [ $RepairAmount -gt "0" ]; do
  371. : $((RepairAmount--))
  372. if [ $RepairAmount == "50" ]; then
  373. ExitWorld
  374. EnterWorld
  375. sleep 10s
  376. CloseMOTD
  377. fi
  378. xdotool key $UseItemUnderneath && sleep 2s
  379. xdotool key $UseItemUnderneath && sleep 2s
  380. xdotool key $UseItemUnderneath && sleep 2s
  381. xdotool key $UseItemUnderneath && sleep 2s
  382. done
  383. sleep 2s
  384. xdotool key $EquipShrokrim
  385. sleep 2s
  386. }
  387.  
  388. RepairWeapon() {
  389. ResultGrabbed=0
  390. while [ $ResultGrabbed == "0" ]; do
  391. WindowCoordinates
  392. xdotool mousemove $WeaponSlotX $WeaponSlotY
  393. sleep 0.4s
  394. xdotool click 3
  395. sleep 0.4s
  396.     OCR
  397.     sleep 1s
  398.     xdotool mousemove $PlayerMenuX $PlayerMenuY
  399.     sleep 0.4s
  400.     xdotool click 1
  401.     sleep 1s
  402.     UseLeft=$(echo ${Result::-1})
  403. if ! [ "$UseLeft" -eq "$UseLeft" ] 2> /dev/null
  404. then
  405.     echo "Sorry integers only"
  406. else
  407.     echo integer detected
  408.             if [[ "$UseLeft" -lt "100" ]] || [[ "$UseLeft" -gt "1" ]]; then
  409.         ResultGrabbed=1
  410.         RepairAmount=$(echo $((100-$UseLeft)))
  411.         RepairAmount=$(echo $(($RepairAmount+1)))
  412.     fi
  413. fi
  414. done
  415. sleep 2s
  416. xdotool key $UnequipAll
  417. sleep 2s
  418. xdotool key $EatFood
  419. sleep 2s
  420. GrabPIDofGame
  421. while [ $RepairAmount -gt "0" ]; do
  422. : $((RepairAmount--))
  423. if [ $RepairAmount == "50" ]; then
  424. ExitWorld
  425. EnterWorld
  426. CloseMOTD
  427. fi
  428. xdotool key $UseItemUnderneath && sleep 2s
  429. xdotool key $UseItemUnderneath && sleep 2s
  430. xdotool key $UseItemUnderneath && sleep 2s
  431. xdotool key $UseItemUnderneath && sleep 2s
  432. done
  433. sleep 2s
  434. xdotool key $EquipShrokrim
  435. sleep 2s
  436. }
  437. CurrentCount=0
  438.  
  439. Core2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement