Kour KP Script

Unlimited 200 KP Daily Rewards

  1. // ==UserScript==
  2. // @name Kour KP Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Unlimited 200 KP Daily Rewards
  6. // @author Johnny-The
  7. // @match *://kour.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=kour.io
  9. // @grant none
  10. // @license ISC <3
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. const _fetch = window.fetch;
  15. window.fetch = function () {
  16. if (arguments[0].includes('/api/track')) {
  17. return Promise.reject();
  18. }
  19.  
  20. return _fetch.apply(this, arguments);
  21. }
  22.  
  23. function fixDailyRewards() {
  24. try {
  25. if (!window.firebase.auth()?.currentUser) return;
  26.  
  27. let shouldSet = false;
  28.  
  29. const rewardObj = { lastDailyReward: '5' };
  30. const refKey = 'users/' + window.firebase.auth().currentUser.uid;
  31.  
  32. window.firebase.database().ref(refKey).once('value', e => {
  33. const obj = e.val();
  34.  
  35. Object.keys(obj).forEach(key => {
  36. if (key.startsWith('dailyReward_')) {
  37. rewardObj[key] = null;
  38. shouldSet = true;
  39. }
  40.  
  41. if (key === 'lastDailyReward' && obj[key] !== '5') {
  42. shouldSet = true;
  43. }
  44. });
  45.  
  46. if (shouldSet) {
  47. window.firebase.database().ref(refKey).update(rewardObj);
  48. window.showUserDetails('', window.firebase.auth().currentUser);
  49. }
  50. });
  51.  
  52. } catch { }
  53. }
  54.  
  55.  
  56. function fakeSetDataNew(a) {
  57. window.unityInstance.SendMessage('FirebasePlayerPrefs2023', 'OnSetData', '{"err":null}&' + [...a].pop());
  58. }
  59.  
  60. Object.defineProperty(window, 'unityInstance', {
  61. get() {
  62. return this._unityInstance;
  63. },
  64. set(v) {
  65. const _setDataNew = window.setDataNew;
  66. window.setDataNew = function () {
  67. if (arguments[1] === 'banned') {
  68. fakeSetDataNew(arguments);
  69. return;
  70. }
  71.  
  72. if (arguments[1].includes("dailyReward_")) {
  73. fakeSetDataNew(arguments);
  74. window.showUserDetails('', window.firebase.auth().currentUser);
  75. return;
  76. }
  77.  
  78. if (arguments[1] === 'lastDailyReward') {
  79. arguments[2] = '5';
  80. }
  81.  
  82. return _setDataNew.apply(this, arguments);
  83. }
  84.  
  85. this._unityInstance = v;
  86.  
  87. const _SendMessage = this._unityInstance.SendMessage;
  88. this._unityInstance.SendMessage = function () {
  89. if (arguments[1] === 'OnLoggedInGoogle') fixDailyRewards();
  90. return _SendMessage.apply(this, arguments);
  91. }
  92. },
  93. });