Advertisement
Guest User

things

a guest
Mar 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 12.03 KB | None | 0 0
  1. #include <AutoItConstants.au3>
  2. HotKeySet("{f9}", "TogglePause")
  3. ;TODO AT WAKE UP
  4. ;MERGEDRAG each x seconds
  5. ;Equip gold [x]
  6. ;Equip bars
  7. ;Stay in adventuyre mode until highest boss killed [x]
  8. ;Drop down to farm zone [NOT NOW]
  9. ;Inventory 61,2,3,4,5,6,7,8 for equipedItems
  10. ;Tooltip to know which run we are at
  11.  
  12. ;------------ CONSTANTS ---------------------------------;
  13. Local $SLEEP_DELAY = 50
  14. Local $MOUSE_SPEED = 1
  15.  
  16. Local $pause = True
  17.  
  18. ;Items
  19. Local $InventoryPositions[60]
  20. Local $Equipment[20]
  21. Local $EquipmentCount = 0
  22. Local $MAGIC_TYPE = 0
  23. Local $ENERGY_TYPE = 1
  24. Local $PIT_TYPE = 2
  25. Local $BOOST_TYPE = 3
  26. Local $MERGE_TYPE = 4
  27. Local $GOLD_TYPE = 5
  28. Local $LAST_SWAPPED = -1
  29.  
  30. ;Menu Positions
  31. Local $MenuTrainAttack = 0
  32. Local $MenuTrainDefense = 1
  33. Local $MenuFightBoss = 2
  34. Local $MenuMoneyPit = 3
  35. Local $MenuAdventure = 4
  36. Local $MenuInventory = 5
  37. Local $MenuAugmentation = 6
  38. Local $MenuAdvTraining = 7
  39. Local $MenuTimeMachine = 8
  40. Local $MenuBloodMagic = 9
  41. Local $MenuWandoos = 10
  42. Local $MenuNGU = 11
  43. Local $MenuYgg = 12
  44.  
  45. ; Trick to add/remove
  46. Local $Unassign = -1
  47. Local $Assign = 1
  48. ;Run Properties--------
  49. ;-- Timers
  50. Local $FightBossTimer = TimerInit()
  51. Local $ResetTimer = TimerInit()
  52. Local $BoostAndMergeTimer = TimerInit()
  53.  
  54. ;Props
  55. Local $Initialized = 0
  56. Local $RunTime = 50000 ; Time each run will take
  57. Local $FightBossTime = 100000 ; Time between each boss fight
  58. Local $BoostAndMergeTime = 5000 ; time between each merge/boost attempt
  59.  
  60. ;Start features time
  61. Local $GoldMachineTime = 10000
  62. Local $AugmentsTime = 310000
  63. Local $BloodMagicTime = 310000
  64.  
  65. ;End features time
  66. Local $GoldMachineEnd = 30000
  67. Local $AugmentsEnd = 700000
  68. Local $BloodMagicEnd = 700000
  69.  
  70. ;IgnoreFeatures
  71. Local $IgnoreTimeMachine = 0
  72. Local $IgnoreAugments = 0
  73. Local $IgnoreBloodMagic = 0
  74.  
  75.  
  76. ;--------------------------------------------------------;
  77. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
  78. ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<;
  79. ; MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/
  80. Setup()
  81. Rebirth()
  82. while 1
  83.    if $pause == True Then
  84.       Sleep($SLEEP_DELAY*10)
  85.       ContinueLoop
  86.    EndIf
  87.  
  88.    if $Initialized == 0 Then
  89.  
  90.       $ResetTimer = TimerInit()
  91.       $FightBossTimer = TimerInit()
  92.       $BoostAndMergeTimer = TimerInit()
  93.       FightBoss()
  94.       Adventure(7,true)
  95.       $Initialized = 1
  96.    EndIf
  97.  
  98.   ; Things that need to be looped every x second
  99.    if TimerDiff($ResetTimer) >= $runTime Then
  100.       SwapItems($PIT_TYPE)
  101.       MoneyPit()
  102.       Rebirth()
  103.    EndIf
  104.  
  105.    if TimerDiff($FightBossTimer) >= $FightBossTime Then
  106.       FightBoss()
  107.       $FightBossTimer = TimerInit()
  108.    EndIf
  109.  
  110.    if TimerDiff($BoostAndMergeTimer) >= $BoostAndMergeTime Then
  111.       BoostItems()
  112.       MergeItems()
  113.       $BoostAndMergeTimer = TimerInit()
  114.    EndIf
  115.  
  116.    if TimerDiff($ResetTimer) >= $runTime - 30000 Then
  117.       FightBoss()
  118.    EndIf
  119.  
  120.    ; Since i'm not powerful, i'll keep this way for now. Pls change like Anso when we get new gear \o/
  121.    if $IgnoreTimeMachine == 0 Then
  122.       if TimerDiff($ResetTimer) >= $GoldMachineTime then
  123.          GoldMachine($Assign, $Assign)
  124.       EndIf
  125.       if TimerDiff($ResetTimer) >= $GoldMachineEnd then
  126.          GoldMachine($Unassign, $Unassign)
  127.          $IgnoreTimeMachine = 1
  128.       EndIf
  129.    EndIf
  130.  
  131.    if $IgnoreAugments == 0 Then
  132.       if TimerDiff($ResetTimer) >= $AugmentsTime then
  133.          Augments($Assign, 3, 0)
  134.       EndIf
  135.       if TimerDiff($ResetTimer) >= $AugmentsEnd then
  136.          ;Augments($Unassign, 0, 0)
  137.          $IgnoreAugments = 1
  138.       EndIf
  139.    EndIf
  140.  
  141.    if $IgnoreBloodMagic == 0 Then
  142.       if TimerDiff($ResetTimer) >= $BloodMagicTime then
  143.          BloodMagic($Assign, 0)
  144.       EndIf
  145.       if TimerDiff($ResetTimer) >= $BloodMagicEnd then
  146.          ;BloodMagic($Unassign, 0, 0)
  147.          $IgnoreBloodMagic = 1
  148.       EndIf
  149.    EndIf
  150.  
  151.  
  152. WEnd
  153.  
  154. ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
  155. ; MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/ MAINLOOP/
  156. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
  157. ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<;
  158. ;--------------------------------------------------------;
  159.  
  160. Func _goToMenu( $indexMenu )
  161.    if $indexMenu >=0 AND $indexMenu <=12 Then
  162.       ; 500 / 350 / 380 / 410
  163.       Local $incrementY = 30;
  164.       Local $startY = 350;
  165.       Click($MOUSE_CLICK_LEFT,500, $startY + ($indexMenu * $incrementY ), 5 )
  166.    Else
  167.       Return
  168.    EndIf
  169. EndFunc
  170.  
  171.  
  172. ;------------------- INVENTORY -------------------------;
  173.  
  174. Func SetupInventoryPosition()
  175.    ;660 / 660
  176.    $startPosition = 660
  177.    $currentPosition = 0
  178.  
  179.    For $r = 0 To 4 Step 1
  180.       For $c = 0 To 11 Step 1
  181.          local $posToShip = [$startPosition+($c*50), $startPosition+($r*50)]
  182.          $InventoryPositions[$currentPosition] = $posToShip
  183.          $currentPosition+=1
  184.       Next
  185.    Next
  186. EndFunc
  187.  
  188. Func CreateItem($type, $invPosition, $slotPosition)
  189.    dim $item = [$type, $invPosition, $slotPosition]
  190.    $Equipment[$EquipmentCount] = $item
  191.    $EquipmentCount+=1
  192. EndFunc
  193.  
  194. Func SwapItems($type)
  195.    if( $EquipmentCount <1 ) Then
  196.       Return
  197.    EndIf
  198.    if( $LAST_SWAPPED <> -1 ) Then ; SWAP BACK
  199.       _goToMenu($MenuInventory)
  200.       For $i = 0 To $EquipmentCount - 1 Step 1
  201.          $item = $Equipment[$i]
  202.          if ( $item[0] == $LAST_SWAPPED ) Then
  203.             $pos = $item[1]
  204.             $coord = $InventoryPositions[$pos]
  205.             $index = $item[2]
  206.  
  207.             Sleep($SLEEP_DELAY)
  208.             Send("{" & $index & " down}")
  209.             Sleep($SLEEP_DELAY)
  210.  
  211.             MouseClick($MOUSE_CLICK_RIGHT, $coord[0], $coord[1], 1, $MOUSE_SPEED)
  212.  
  213.             Sleep($SLEEP_DELAY)
  214.             Send("{" & $index & " up}")
  215.             Sleep($SLEEP_DELAY)
  216.          EndIf
  217.       Next
  218.    EndIf
  219.    _goToMenu($MenuInventory)
  220.    For $i = 0 To $EquipmentCount - 1 Step 1
  221.       $item = $Equipment[$i]
  222.       if ( $item[0] == $type ) Then
  223.          $pos = $item[1]
  224.          $coord = $InventoryPositions[$pos]
  225.          $index = $item[2]
  226.  
  227.          Sleep($SLEEP_DELAY)
  228.          Send("{" & $index & " down}")
  229.          Sleep($SLEEP_DELAY)
  230.  
  231.          MouseClick($MOUSE_CLICK_RIGHT, $coord[0], $coord[1], 1, $MOUSE_SPEED)
  232.  
  233.          Sleep($SLEEP_DELAY)
  234.          Send("{" & $index & " up}")
  235.          Sleep($SLEEP_DELAY)
  236.          $LAST_SWAPPED = $type
  237.       EndIf
  238.    Next
  239. EndFunc
  240.  
  241. Func BoostItems()
  242.    if( $EquipmentCount <1 ) Then
  243.       Return
  244.    EndIf
  245.    _goToMenu($MenuInventory)
  246.    For $i = 0 To $EquipmentCount - 1 Step 1
  247.       $item = $Equipment[$i]
  248.       if ( $item[0] == $BOOST_TYPE ) Then
  249.          $pos = $item[1]
  250.          $coord = $InventoryPositions[$pos]
  251.          $index = $item[2]
  252.  
  253.          Sleep($SLEEP_DELAY)
  254.          Send("{a down}")
  255.          Sleep($SLEEP_DELAY)
  256.  
  257.          MouseClick($MOUSE_CLICK_LEFT, $coord[0], $coord[1], 1, $MOUSE_SPEED)
  258.  
  259.          Sleep($SLEEP_DELAY)
  260.          Send("{a up}")
  261.          Sleep($SLEEP_DELAY)
  262.       EndIf
  263.    Next
  264. EndFunc
  265.  
  266. Func MergeItems()
  267.    if( $EquipmentCount <1 ) Then
  268.       Return
  269.    EndIf
  270.    For $i = 0 To $EquipmentCount - 1 Step 1
  271.       $item = $Equipment[$i]
  272.       if ( $item[0] == $MERGE_TYPE ) Then
  273.          $pos = $item[1]
  274.          $coord = $InventoryPositions[$pos]
  275.          $index = $item[2]
  276.  
  277.          Sleep($SLEEP_DELAY)
  278.          Send("{d down}")
  279.          Sleep($SLEEP_DELAY)
  280.  
  281.          MouseClick($MOUSE_CLICK_LEFT, $coord[0], $coord[1], 1, $MOUSE_SPEED)
  282.  
  283.          Sleep($SLEEP_DELAY)
  284.          Send("{d up}")
  285.          Sleep($SLEEP_DELAY)
  286.       EndIf
  287.    Next
  288. EndFunc
  289.  
  290.  
  291. ;-------------------- Funcs -----------------------------;
  292. Func MoneyPit()
  293.    Local $MoneyPitClick = [756,629] ; This is the yes button.
  294.    _goToMenu($MenuMoneyPit)
  295.    Sleep($SLEEP_DELAY)
  296.    MouseClick("left",$MoneyPitClick[0]+50,$MoneyPitClick[1]+50,1,2)
  297.    MouseClick("left",$MoneyPitClick[0]+40,$MoneyPitClick[1]+40,1,2)
  298.    MouseClick("left",$MoneyPitClick[0]+30,$MoneyPitClick[1]+30,1,2)
  299.    MouseClick("left",$MoneyPitClick[0]+20,$MoneyPitClick[1]+20,1,2)
  300.    MouseClick("left",$MoneyPitClick[0]+10,$MoneyPitClick[1]+10,1,2)
  301.  
  302. EndFunc
  303.  
  304. Func FightBoss()
  305.    local $Nuke = [950,425]
  306.    local $Fight = [950, 525]
  307.    _goToMenu($MenuFightBoss)
  308.    Sleep($SLEEP_DELAY)
  309.    Click($MOUSE_CLICK_LEFT, $Nuke[0], $Nuke[1], 1)
  310.    Sleep($SLEEP_DELAY)
  311.  
  312.    For $i = 0 To 10 Step 1
  313.       Sleep($SLEEP_DELAY)
  314.       Click($MOUSE_CLICK_LEFT, $Fight[0], $Fight[1], 1)
  315.       Sleep(5*$SLEEP_DELAY)
  316.    Next
  317. EndFunc
  318.  
  319. Func Reset()
  320.  
  321. EndFunc
  322.  
  323. Func Adventure($count, $inc)
  324.    local $bossFound = false
  325.    SwapItems($GOLD_TYPE)
  326.    _goToMenu($MenuAdventure)
  327.    if($inc == false) Then
  328.       for $i = 0 To 10 Step 1
  329.          Sleep($SLEEP_DELAY)
  330.          Send("{left}")
  331.          Sleep($SLEEP_DELAY)
  332.       Next
  333.    EndIf
  334.    for $i = 0 To $count -1 Step 1
  335.       Sleep($SLEEP_DELAY)
  336.       Send("{right}")
  337.       Sleep($SLEEP_DELAY)
  338.    Next
  339.    Sleep(5000)
  340.    for $i = 908 To 984
  341.       if PixelGetColor($i, 560) <> 0xC0C0C0 Then
  342.          ExitLoop 1
  343.       EndIf
  344.    Next
  345.    Sleep($SLEEP_DELAY)
  346.    Send("{left}")
  347.    Sleep($SLEEP_DELAY)
  348.  
  349.    ; Highest boss is here probably, wait for the boss to die
  350.    while $bossFound == False
  351.       If(PixelGetColor(1049,733) == 0xFF0000) Then ; Enemy spawned?
  352.          If (PixelGetColor(1041,617) == 0xF7EF29) Then ; Boss here
  353.             $bossFound = true
  354.          Else
  355.              Sleep(100)
  356.              Send("{LEFT}")
  357.              Sleep(100)
  358.              Send("{RIGHT}")
  359.          EndIf
  360.        EndIf
  361.     WEnd
  362.     SwapItems(-1)
  363. EndFunc
  364.  
  365. Func GoldMachine($energy, $magic)
  366.    _goToMenu($MenuTimeMachine)
  367.    Local $GoldPlus = [855,542]
  368.    Local $GoldMinus = [887,542]
  369.    Local $GoldMagicPlus = [855,642]
  370.    Local $GoldMagicMinus = [887,642]
  371.  
  372.    Switch $energy
  373.       case $Assign
  374.          Click($MOUSE_CLICK_LEFT,$GoldPlus[0],$GoldPlus[1],2)
  375.       case $Unassign
  376.          Click($MOUSE_CLICK_LEFT,$GoldMinus[0],$GoldMinus[1],2)
  377.       EndSwitch
  378.  
  379.    Switch $magic
  380.       case $Assign
  381.          Click($MOUSE_CLICK_LEFT,$GoldMagicPlus[0],$GoldMagicPlus[1],2)
  382.       case $Unassign
  383.          Click($MOUSE_CLICK_LEFT,$GoldMagicMinus[0],$GoldMagicMinus[1],2)
  384.       EndSwitch
  385.  
  386. EndFunc
  387.  
  388. Func Augments($do, $where, $upgrade)
  389.    _goToMenu($MenuAugments)
  390.    $y = 0
  391.    if($do == $Unassign) Then
  392.       $y = 890
  393.    Else
  394.       $y = 855
  395.    EndIf
  396.    if $where == 0 Then ; 0 means everything, mostly for unassign part tho
  397.       for $x = 580 To 860 Step 70
  398.          Click($MOUSE_CLICK_LEFT, $x-10, $y, 2)
  399.          Click($MOUSE_CLICK_LEFT, $x+10, $y, 2)
  400.       Next
  401.    Else
  402.       if $upgrade == 1 Then
  403.          Click($MOUSE_CLICK_LEFT, 580+(70*$where)+10, $y, 2)
  404.       Else
  405.          Click($MOUSE_CLICK_LEFT, 580+(70*$where)-10, $y, 2)
  406.       EndIf
  407.    EndIf
  408. EndFunc
  409.  
  410. Func BloodMagic($do, $where)
  411.    _goToMenu($MenuBloodMagic)
  412.    $y = 0
  413.    if($do == $Unassign) Then
  414.       $y = 850
  415.    Else
  416.       $y = 815
  417.    EndIf
  418.  
  419.    if $where == 0 Then ; 0 means everything, mostly for unassign part tho
  420.       for $x = 535 To 850 Step 45
  421.          Click($MOUSE_CLICK_LEFT, $x, $y, 2)
  422.       Next
  423.    Else
  424.       Click($MOUSE_CLICK_LEFT, 535+(35*$where), $y, 2)
  425.    EndIf
  426. EndFunc
  427.  
  428. Func Rebirth()
  429.    FightBoss()
  430.    Local $RebirthMenu = [413, 719]
  431.    Local $RebirthButton = [815, 830]
  432.    Local $RebirthYes = [756,627]
  433.    SwapItems(-1)
  434.    Click($MOUSE_CLICK_LEFT,$RebirthMenu[0],$RebirthMenu[1],5)
  435.    Click($MOUSE_CLICK_LEFT,$RebirthButton[0],$RebirthButton[1],5)
  436.    Click($MOUSE_CLICK_LEFT,$RebirthYes[0],$RebirthYes[1],5)
  437.  
  438.    $FightBossTimer = TimerInit()
  439.    $ResetTimer = TimerInit()
  440.    $BoostAndMergeTimer = TimerInit()
  441.  
  442.    $IgnoreTimeMachine = 0
  443.    $IgnoreAugments = 0
  444.    $IgnoreBloodMagic = 0
  445.  
  446.    $Initialized = 0
  447. EndFunc
  448.  
  449. Func ColRowToInv($col, $row)
  450.    $x = $col-1
  451.    $y = $row-1
  452.  
  453.    return $x+$y*12
  454. EndFunc
  455.  
  456. Func Setup()
  457.    SetupInventoryPosition()
  458.    ;pit items
  459.    CreateItem($PIT_TYPE, ColRowToInv(6,2), 1)
  460.    CreateItem($PIT_TYPE, ColRowToInv(11,4), 2)
  461.    CreateItem($PIT_TYPE, ColRowToInv(6,1), 3)
  462.    CreateItem($PIT_TYPE, ColRowToInv(8,2), 0)
  463.    CreateItem($PIT_TYPE, ColRowToInv(9,2), 0)
  464.    CreateItem($PIT_TYPE, ColRowToInv(10,2), 0)
  465.    CreateItem($PIT_TYPE, ColRowToInv(12,2), 0)
  466.  
  467.    CreateItem($BOOST_TYPE, 17, 1)
  468.    CreateItem($BOOST_TYPE, 36, 2)
  469.    CreateItem($BOOST_TYPE, ColRowToInv(6,1), 3)
  470.    CreateItem($BOOST_TYPE, ColRowToInv(8,2), 0)
  471.    CreateItem($BOOST_TYPE, ColRowToInv(9,2), 0)
  472.    CreateItem($BOOST_TYPE, ColRowToInv(10,2), 0)
  473.    CreateItem($BOOST_TYPE, ColRowToInv(12,2), 0)
  474. EndFunc
  475. ;------------------- GLOBAL ----------------------------;
  476.  
  477. Func Click($MouseClick, $positionX, $positionY, $amountOfClicks)
  478.    Sleep($SLEEP_DELAY*5)
  479.    MouseClick($MouseClick, $positionX, $positionY, $amountOfClicks, $MOUSE_SPEED)
  480. EndFunc
  481.  
  482. Func TogglePause()
  483.    If($pause == true ) Then
  484.       $pause = False
  485.    Else
  486.       $pause = true
  487.    EndIf
  488. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement