Advertisement
Guest User

Cory's Modified Script

a guest
Jun 22nd, 2018
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.43 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Saliens Hack
  3. // @description Saliens Hack for Steam Summer Sale 2018 Game - AutoSelect Planet, Invincibility, InstaKill
  4. //
  5. // @author Cory "mbsurfer" Shaw
  6. // @namespace http://github.com/coryshaw1
  7. // @downloadURL https://github.com/coryshaw1/saliens-hack/raw/master/saliensHack.user.js
  8. //
  9. // @license MIT License
  10. // @copyright Copyright (C) 2018, by Cory Shaw
  11. //
  12. // @include https://steamcommunity.com/saliengame/play
  13. // @include https://steamcommunity.com/saliengame/play/
  14. //
  15. // @version 1.1.1
  16. // @updateURL https://github.com/coryshaw1/saliens-hack/raw/master/saliensHack.user.js
  17. //
  18. // @run-at document-start|document-end
  19. //
  20. // @grant unsafeWindow
  21. //
  22. // @unwrap
  23. // ==/UserScript==
  24.  
  25. /**
  26. * This program is free software: you can redistribute it and/or modify
  27. * it under the terms of the GNU General Public License as published by
  28. * the Free Software Foundation, either version 3 of the License, or
  29. * (at your option) any later version.
  30. *
  31. * This program is distributed in the hope that it will be useful,
  32. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. * GNU General Public License for more details.
  35. *
  36. * You should have received a copy of the GNU General Public License
  37. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  38. */
  39.  
  40. /**
  41. * SCRIPT DESCRIPTION.
  42. *
  43. * @see http://wiki.greasespot.net/API_reference
  44. * @see http://wiki.greasespot.net/Metadata_Block
  45. */
  46. (function() {
  47. if (typeof unsafeWindow !== "undefined")
  48. unsafeWindow.requestAnimationFrame = c => { setTimeout(c, 1000 / 60); };
  49.  
  50. CEnemy.prototype.Walk = function(){this.Die(true);};
  51. CCooldownHandler.prototype.BAttack = function(){return true;};
  52. var joiningZone = false;
  53. var joiningPlanet = false;
  54. var gameCheck = function(){
  55. // Game broke reload and try again
  56. if ($J('.newmodal .newmodal_header .ellipsis') && $J('.newmodal .newmodal_header .ellipsis').length > 0 && $J('.newmodal .newmodal_header .ellipsis').text() == "Game Error") {
  57. clearInterval(intervalFunc);
  58. setTimeout(function() {
  59. window.location.reload();
  60. }, 750);
  61. }
  62.  
  63. if (!gGame || !gGame.m_State) return;
  64.  
  65. if (gGame.m_State instanceof CBootState && gGame.m_State.button) {
  66. startGame();
  67. return;
  68. }
  69.  
  70. if (gGame.m_State instanceof CPlanetSelectionState && gGame.m_State.m_rgPlanets) {
  71. // Go to uncaptured zone with the higheset difficulty
  72. var uncapturedPlanets = gGame.m_State.m_rgPlanets
  73. .filter(function(p){ return p.state && !p.state.captured })
  74. .sort(function(p1, p2){return p2.state.difficulty - p1.state.difficulty});
  75.  
  76. if (uncapturedPlanets.length == 0) {
  77. console.log("ALL PLANETS ARE DONE. GG.");
  78. return;
  79. }
  80.  
  81. joinPlanet(uncapturedPlanets[0].id);
  82. return;
  83. }
  84.  
  85. if (gGame.m_State.m_VictoryScreen || gGame.m_State.m_LevelUpScreen) {
  86. gGame.ChangeState( new CBattleSelectionState( gGame.m_State.m_PlanetData.id ) );
  87. console.log('round done');
  88. return;
  89. }
  90.  
  91. //if (gGame.m_State.m_ScoreIncrements && gGame.m_State.m_ScoreIncrements != 0 && gGame.m_State.m_rtBattleStart && gGame.m_State.m_rtBattleEnd) {
  92. //var ptPerSec = (k_MatchLengthSec);
  93. //gGame.m_State.m_Score = gGame.m_State.m_ScoreIncrements * ptPerSec;
  94. //gGame.m_State.m_ScoreIncrements = 0;
  95.  
  96. //}
  97.  
  98. if (gGame.m_State.m_EnemyManager) {
  99. joiningZone = false;
  100. return;
  101. }
  102.  
  103. if (gGame.m_State.m_PlanetData && gGame.m_State.m_PlanetData.zones) {
  104. joiningPlanet = false;
  105. // Go to boss in uncaptured zone if there is one
  106. var bossZone = gGame.m_State.m_PlanetData.zones
  107. .find(function(z){ return !z.captured && z.boss });
  108.  
  109. if (bossZone && bossZone.zone_position) {
  110. console.log('Boss battle at zone:', bossZone.zone_position);
  111. joinZone(bossZone.zone_position);
  112. return;
  113. }
  114.  
  115. // Go to uncaptured zone with the higheset difficulty
  116. var uncapturedZones = gGame.m_State.m_PlanetData.zones
  117. .filter(function(z){ return !z.captured })
  118. .sort(function(z1, z2){return z2.difficulty - z1.difficulty});
  119.  
  120. if (uncapturedZones.length == 0 && gGame.m_State.m_PlanetData) {
  121. console.log("Planet is completely captured.");
  122. leavePlanet(gGame.m_State.m_PlanetData.id);
  123. return;
  124. }
  125.  
  126. joinZone(uncapturedZones[0].zone_position);
  127. return;
  128. }
  129. };
  130.  
  131.  
  132. var intervalFunc = setInterval(gameCheck, 100);
  133.  
  134. var joinZone = function(zoneId) {
  135. if (joiningZone) return;
  136. console.log('Joining zone:', zoneId);
  137. console.log('Current LVL:', gPlayerInfo.level);
  138. console.log('XP needed to LVL UP:', gPlayerInfo.next_level_score - gPlayerInfo.score);
  139. console.log('Current planet progress:', gGame.m_State.m_PlanetData.state.capture_progress * 100, '%');
  140.  
  141. joiningZone = true;
  142.  
  143. clearInterval(intervalFunc);
  144.  
  145. gServer.JoinZone(
  146. zoneId,
  147. function ( results ) {
  148. gGame.ChangeState( new CBattleState( gGame.m_State.m_PlanetData, zoneId ) );
  149. },
  150. GameLoadError
  151. );
  152.  
  153. setTimeout(function() {
  154. intervalFunc = setInterval(gameCheck, 100);
  155. }, 10000);
  156. };
  157.  
  158. var joinPlanet = function(planetId) {
  159. if (joiningPlanet) return;
  160. console.log('Joining planet:', planetId);
  161.  
  162. joiningPlanet = true;
  163.  
  164. clearInterval(intervalFunc);
  165.  
  166. gServer.JoinPlanet(
  167. planetId,
  168. function ( response ) {
  169. gGame.ChangeState( new CBattleSelectionState( planetId ) );
  170. },
  171. function ( response ) {
  172. ShowAlertDialog( 'Join Planet Error', 'Failed to join planet. Please reload your game or try again shortly.' );
  173. }
  174. );
  175.  
  176. setTimeout(function() {
  177. intervalFunc = setInterval(gameCheck, 100);
  178. }, 10000);
  179. };
  180.  
  181. var leavePlanet = function(planetDataId) {
  182.  
  183. if (joiningPlanet) return;
  184. console.log('Leaving planet:', planetDataId);
  185.  
  186. joiningPlanet = true;
  187.  
  188. clearInterval(intervalFunc);
  189.  
  190. gServer.LeaveGameInstance(
  191. planetDataId,
  192. function() {
  193. gGame.ChangeState( new CPlanetSelectionState() );
  194. }
  195. );
  196.  
  197. setTimeout(function() {
  198. intervalFunc = setInterval(gameCheck, 100);
  199. }, 10000);
  200. };
  201.  
  202. var startGame = function() {
  203. console.log('Pressing Play in 2 seconds');
  204.  
  205. clearInterval(intervalFunc);
  206.  
  207. // wait 2 seconds for game to load
  208. // TODO: find a way to do this programmatically
  209. setTimeout(function() {
  210. gGame.m_State.button.click();
  211.  
  212. setTimeout(function() {
  213. intervalFunc = setInterval(gameCheck, 100);
  214. }, 5000);
  215. }, 2000);
  216. };
  217. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement