Advertisement
Gyan1010

Polycraft

Oct 25th, 2013
913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.18 KB | None | 0 0
  1. #include <Array.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #Include <GUIEdit.au3>
  5. #include <Math.au3>
  6. #include <Misc.au3>
  7. #Include <ScrollBarConstants.au3>
  8. #include <WindowsConstants.au3>
  9.  
  10. ; =========== MIGHT NEED TO MODIFY THIS IF VERSION CHANGES ===========
  11.     $path = @UserProfileDir & "\AppData\Local\Google\Chrome\User Data\Default\Extensions\eopfmbpfhhfnklgmjpoehcjaajhpbhbl\1.0.0.11_0\game.canvas.js"
  12.  
  13. ; =========== WEAPON HACKS ===========
  14.     $clipSize = 1000000         ; default = 2
  15.     $reloadDuration = 0.2       ; default = 1.5
  16.     $rechamberDuration = 0.2    ; default = 0.4
  17.     $maxRange = 100             ; default = 10
  18.  
  19. ; =========== BULLET HACKS ===========
  20.     $bDamage = 1000             ; default = 20, 40, 60, 80, 100
  21.     $nearRange = 50             ; default = 3
  22.     $farRange = 100             ; default = 7.5
  23.     $radius = 100               ; default = 10,
  24.     $arcAngle = 180             ; default = 30,
  25.  
  26. ; =========== STRUCTURE HACKS ===========
  27.     $sHealth = 9000000
  28.     $buildTime = 0
  29.     $resourceCost = 0
  30.     $secondaryResourceCost = 0
  31.     $minResourceRepairCost = "[0,0]"
  32.     $maxResourceRepairCost = "[0,0]"
  33.     $sDdamage = 5000
  34.     $friendlyFire = 0       ; Explosions (decimal percentage, ex. 0.2 = 20%)
  35.     $reloadDuration = 1     ; Turrets
  36.     $maxAttackers = 200     ; Decoy
  37.  
  38. ; =========== HERO HACKS ===========
  39.     ; Health
  40.         $hHealth = 5000000          ; default = 50 at lv 1
  41.         $regen = 5000               ; default = 15
  42.         $regenDelay = 1             ; default = 2
  43.     ; Movement
  44.         $normalSpeed = 12           ; default = 5
  45.         $fastSpeed = 20             ; default = 8
  46.  
  47. ; =========== RESOURCE HACKS ===========
  48.     ; Resource Nodes Never Deplete
  49.     ; Add Amber When Spending
  50.     ; Attract Radius
  51.         $attractRadius = 20         ; How far you can pick up resources from
  52.     ; Deposit Radius
  53.         $depositRadius = 200        ; How far you can deposit resources from
  54.     ; Lumber & Stone Multiplier
  55.         $multiplier = 10            ; Not sure this is a perfect multiplier because it seemed like more than 10 in my tests
  56.  
  57. ; ===================================================================================================================================================
  58. ; ===================================================================================================================================================
  59. ; ===================================================================================================================================================
  60. $str = FileRead($path)
  61.  
  62. $hGUI = GUICreate("Hack Log",800,600)
  63. GUISetStyle(BitOR($WS_CAPTION,$WS_DLGFRAME,$WS_SYSMENU))
  64. $hEdit = GUICtrlCreateEdit("",10,10,780,580)
  65. GUISetState(@SW_SHOW)
  66.  
  67. Func AddLine($text)
  68.     $iEnd = StringLen(GUICtrlRead($hEdit))
  69.     _GUICtrlEdit_SetSel($hEdit, $iEnd, $iEnd)
  70.     _GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET)
  71.     GUICtrlSetData($hEdit, $text & @CRLF, 1)
  72. EndFunc
  73.  
  74. AddLine("WEAPON HACKS:")
  75. $str = StringRegExpReplace($str,"(?s)(wp_h_shotgun_cone..=\s*\{[^}]*?clipSize:\s*)[\dE\.]*(,[^}]*?reloadDuration:\s*)[\dE\.]*(,[^}]*?rechamberDuration:\s*)[\dE\.]*(,[^}]*?maxRange:\s*)[\dE\.]*(,.*?})","${1}" & $clipSize & "${2}" & $reloadDuration & "${3}" & $rechamberDuration & "${4}" & $maxRange & "${5}")
  76. AddLine(@TAB & _Iif(@error=0,"Sucessfully changed " & @extended / 5 & " results","Failed"))
  77. AddLine("BULLET HACKS:")
  78. $str = StringRegExpReplace($str,"(?s)(dg_h_shotgun_blast_cone..=[^}]*?damage:\s*)[\dE\.]*(,[^}]*?nearRange:\s*)[\dE\.]*(,[^}]*?farRange:\s*)[\dE\.]*(,[^}]*?radius:\s*)[\dE\.]*(,[^}]*?arcAngle:\s*)[\dE\.]*(,.*?})","${1}" & $bDamage & "${2}" & $nearRange & "${3}" & $farRange & "${4}" & $radius & "${5}" & $arcAngle & "${6}")
  79. AddLine(@TAB & _Iif(@error=0,"Sucessfully changed " & @extended / 6& " results","Failed"))
  80. AddLine("STRUCTURE HACKS:")
  81. $results = StringRegExp($str,'(?s)(a_d_[^\{}"]*?:{)([^}]*})',3)
  82. For $i=0 To UBound($results)-1 Step 2
  83.     $search = $results[$i] & $results[$i+1]
  84.     $replace = $search
  85.     If StringLeft($results[$i],8) <> "a_d_mine" Then $replace = StringRegExpReplace($replace,"(health:\s*)[\dE]*","${1}" & $sHealth)
  86.     $replace = StringRegExpReplace($replace,"(buildTime:\s*)[\dE]*","${1}" & $buildTime)
  87.     $replace = StringRegExpReplace($replace,"(resourceCost:\s*)[\dE]*","${1}" & $resourceCost)
  88.     $replace = StringRegExpReplace($replace,"(secondaryResourceCost:\s*)[\dE]*","${1}" & $secondaryResourceCost)
  89.     $replace = StringRegExpReplace($replace,"(minResourceRepairCost:\s*)\[[\dE]*,[\dE]*]","${1}" & $minResourceRepairCost)
  90.     $replace = StringRegExpReplace($replace,"(maxResourceRepairCost:\s*)\[[\dE]*,[\dE]*]","${1}" & $maxResourceRepairCost)
  91.     $replace = StringRegExpReplace($replace,"(damage:\s*)[\dE]*","${1}" & $sDdamage)
  92.     $replace = StringRegExpReplace($replace,"(friendlyFire:\s*)[\dE\.]*","${1}" & $friendlyFire)
  93.     $replace = StringRegExpReplace($replace,"(reloadDuration:\s*)[\dE\.]*","${1}" & $reloadDuration)
  94.     $str = StringReplace($str,$search,$replace,1,2)
  95.     AddLine(@TAB & StringTrimRight($results[$i],2))
  96. Next
  97. AddLine("HERO HACKS:")
  98. $str = StringRegExpReplace($str,"(?s)(ECHealth:{[^}]*?,health:\s*)50(,[^}]*?regen:\s*)15(,[^}]*?regenDelay:\s*)2(,.*?})","${1}" & $hHealth & "${2}" & $regen & "${3}" & $regenDelay & "${4}")
  99. AddLine(@TAB & "Health: " & _Iif(@error=0,"Sucessfully changed " & @extended / 4 & " results","Failed"))
  100. $str = StringRegExpReplace($str,"(?s)(ECLocomotion:{\s*normalSpeed:\s*)5(,\s*fastSpeed:\s*)8(,.*?})","${1}" & $normalSpeed & "${2}" & $fastSpeed & "${3}")
  101. AddLine(@TAB & "Movement: " & _Iif(@error=0,"Sucessfully changed " & @extended / 3 & " results","Failed"))
  102. AddLine("RESOURCE HACKS:")
  103. $str = StringRegExpReplace($str,"claimResource:function\(a\){this\.claimedResource\+=a","claimResource:function(a){this.claimedResource+=0")
  104. AddLine(@TAB & "Resource Nodes Never Deplete (Part 1): " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  105. $str = StringRegExpReplace($str,"(growFactor|resource)-=d[^;]*;","${1}-=0;")
  106. AddLine(@TAB & "Resource Nodes Never Deplete (Part 2): " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  107. $str = StringRegExpReplace($str,"(adjustSoftCurrency\()-","${1}")
  108. AddLine(@TAB & "Add Amber When Spending: " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  109. $str = StringRegExpReplace($str,"(?s)(attractRadius:\s*(?:[^}]*?defaultValue:\s*)?)\d*,","${1}" & $attractRadius & ",")
  110. AddLine(@TAB & "Attract Radius: " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  111. $str = StringRegExpReplace($str,"applyToEntitiesInGridCellsWithinRadius\(this\.getv3Location\(\),2,c\)","applyToEntitiesInGridCellsWithinRadius(this.getv3Location()," & $depositRadius & ",c)")
  112. AddLine(@TAB & "Deposit Radius (Part 1): " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  113. $str = StringRegExpReplace($str,"4>c\.getDistanceUsingSize\(a\)",$depositRadius & ">c\.getDistanceUsingSize\(a\)")
  114. AddLine(@TAB & "Deposit Radius (Part 2): " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  115. $str = StringRegExpReplace($str,"(adjustResource:function\(a,b,?c?\){)","${1}b=b*" & $multiplier & ";")
  116. AddLine(@TAB & "Lumber & Stone Multiplier: " & _Iif(@error=0,"Sucessfully changed " & @extended & " results","Failed"))
  117. AddLine("___________________________________________________________________________________________________")
  118.  
  119. ;~ ; Create backup then write file
  120. $backup = $path & "." & @YEAR & @MON & @MDAY & "." & @HOUR & @MIN & @SEC & ".bak"
  121. $backupStatus = FileCopy($path,$backup)
  122. If Not $backupStatus Then ClipPut($str)
  123. AddLine("Backup " & _Iif($backupStatus,"Created: " & $backup, "Failed: However, the modified code should now be copied to your clipboard." & @CRLF & @TAB & "Create a new file named game.canvas.js and paste the code in." & @CRLF & @TAB & "Then create your own backup of """ & $path & """, and move your new file into that folder."))
  124. If $backupStatus Then
  125.     FileDelete($path)
  126.     $fileWriteStatus = FileWrite($path,$str)
  127.     If Not $fileWriteStatus Then ClipPut($str)
  128.     AddLine("File modification " & _Iif($fileWriteStatus, "successful!", "Failed: However, the modified code should now be copied to your clipboard." & @CRLF & @TAB & "Open """ & $path & """, delete its contents and paste in the new code."))
  129. EndIf
  130. AddLine("___________________________________________________________________________________________________")
  131. AddLine("DONE!")
  132. Do
  133.     Local $msg = GUIGetMsg()
  134. Until $msg = $GUI_EVENT_CLOSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement