Guest User

concavegames.com boggle greasemonkey cheat script

a guest
Mar 24th, 2012
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // ==UserScript==
  3. // @name       concave games boggle quick cheater
  4. // @namespace  http://concavegames.com/quick_cheater
  5. // @version    0.1
  6. // @description  Cheats on the boggle game on concavegames.com
  7. // @include    http://concavegames.com/*
  8. // ==/UserScript==
  9.  
  10. setTimeout(checkForGame, 100);
  11.  
  12. var originalInitGame = null;
  13. var originalStartTimer = null;
  14. var timeLeft = 0;
  15.  
  16. function checkForGame()
  17. {
  18.     if(typeof unsafeWindow.canvasInitGame==="undefined" || typeof unsafeWindow.startTimer==="undefined")
  19.         return setTimeout(checkForGame, 1000);
  20.    
  21.     originalInitGame = unsafeWindow.canvasInitGame;
  22.     originalStartTimer = unsafeWindow.startTimer;
  23.    
  24.     unsafeWindow.canvasInitGame = myInitGame;
  25.     unsafeWindow.startTimer = myStartTimer;
  26. }
  27.  
  28. function myStartTimer(time)
  29. {
  30.     timeLeft = time;
  31.     originalStartTimer(time);
  32. }
  33.  
  34. var wordsToPlay = null;
  35. var wordToPlay = null;
  36. var startAt = null;
  37.  
  38. function myInitGame(board_c, words)
  39. {
  40.     wordsToPlay = words.sort(function(a, b) { return a.length - b.length; }).map(function(a) { return a + "\n"; });
  41.     startAt = Date.now();
  42.     originalInitGame(board_c, words);
  43.     setTimeout(playNextLetter, 1000);
  44. }
  45.  
  46. function playNextLetter()
  47. {
  48.     if(!wordToPlay)
  49.         wordToPlay = wordsToPlay.pop();
  50.    
  51.     console.log(wordsToPlay.length);
  52.    
  53.     var letter = wordToPlay.substr(0, 1);
  54.     wordToPlay = wordToPlay.substring(1);
  55.    
  56.     // Grabbed from the original source
  57.     unsafeWindow.keysDown[letter.charCodeAt(0)] = true;
  58.     unsafeWindow.keyboardSelected = unsafeWindow.keyboardSelected + letter;
  59.     var positions = unsafeWindow.findWords2(unsafeWindow.keyboardSelected.toLowerCase(), unsafeWindow.board);
  60.     if (positions.length == 0) {
  61.         unsafeWindow.clearSelected();
  62.         unsafeWindow.keyboardSelected = "";
  63.     }
  64.     else {
  65.         unsafeWindow.emptySelected();
  66.         for (i = 0; i < positions.length; i = i + 1) {
  67.             unsafeWindow.selectedTiles.unshift(positions[i]);
  68.             unsafeWindow.tiles[positions[i]].state = 1;
  69.         }
  70.     }
  71.     // End grab
  72.    
  73.     if((Date.now()-startAt)<timeLeft)
  74.         setTimeout(playNextLetter, 50);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment