Donderhiroba Total Played Counting Script byYiZhong

Counts how many time you've played taiko AC.

  1. // ==UserScript==
  2. // @name Donderhiroba Total Played Counting Script byYiZhong
  3. // @namespace https://donderhiroba.jp/
  4. // @grant GM_setValue
  5. // @grant GM_getValue
  6. // @include https://donderhiroba.jp/*
  7. // @version 1.0.2
  8. // @author YiZhong https://facebook.com/TaikoZhong
  9. // @description Counts how many time you've played taiko AC.
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. //GM_setValue('YiZhong.id', null); //If you want to force restart, please remove // and refresh hiroba, and then put these // back.
  35. //document.write('Your total play count (one song per number): '+ GM_getValue('YiZhong.playedcount', null)); //Force show total play count, normally it won't be used, please remove // and refresh hiroba, and then put these // back.
  36. //////////////////////////////Variable
  37. var DefaultLevel = 4; //Start counting from level...,1 easy, 2 normal, 3 hard, 4 oni, 5 ura
  38. var DefaultHighestLevel = 5; //End counting on level...,1 easy, 2 normal, 3 hard, 4 oni, 5 ura
  39. var songamount = 1150; //Starts from ID 1 to ID songamount, please change to largest taiko song id (it's okay to be higher).
  40. //////////////////////////////Variable
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. 'use strict';
  65. if(GM_getValue('YiZhong.id') == null){
  66. if(confirm('Start counting now? If no, please pause the script.')){
  67. GM_setValue('YiZhong.level', null);
  68. GM_setValue('YiZhong.id', null);
  69. GM_setValue('YiZhong.playedcount', null);
  70. }
  71. else{
  72. GM_setValue('YiZhong.id', songamount);
  73. }
  74. }
  75.  
  76. if(GM_getValue('YiZhong.id') > songamount){
  77. window.alert('Your total play count (one song per number): ' + GM_getValue('YiZhong.playedcount'));
  78. if(confirm('Start recounting now? If no, please pause the script.')==true){
  79. GM_setValue('YiZhong.level', null);
  80. GM_setValue('YiZhong.id', null);
  81. GM_setValue('YiZhong.playedcount', null);
  82. location.reload();
  83. }
  84. }
  85.  
  86. if(GM_getValue('YiZhong.id') <= songamount){ //太鼓達人ID目前不超過1150
  87. //初始化
  88. if(GM_getValue('YiZhong.level')==null || GM_getValue('YiZhong.level')==undefined ){
  89. GM_setValue('YiZhong.level', DefaultLevel - 1); //更改起始 變更defaultlevel
  90. }
  91. if(GM_getValue('YiZhong.id')==null || GM_getValue('YiZhong.id')==undefined ){
  92. GM_setValue('YiZhong.id', 1);
  93. }
  94. if(GM_getValue('YiZhong.playedcount')==null || GM_getValue('YiZhong.playedcount')==undefined ){
  95. GM_setValue('YiZhong.playedcount', 0);
  96. }
  97. //初始化結束
  98.  
  99.  
  100. GM_setValue('YiZhong.level', GM_getValue('YiZhong.level') + 1);
  101.  
  102. if(GM_getValue('YiZhong.level') == DefaultHighestLevel + 1){ //更改最高 變更defaulthighestlevel
  103. GM_setValue('YiZhong.id', GM_getValue('YiZhong.id') + 1);
  104. GM_setValue('YiZhong.level', DefaultLevel); //更改起始 變更defaultlevel
  105. }
  106.  
  107. if(document.getElementsByClassName('stage_cnt').length){
  108. var temp=parseInt(document.getElementsByClassName("stage_cnt").item(0).childNodes[3].innerHTML); //總遊玩次數
  109. GM_setValue('YiZhong.playedcount', GM_getValue('YiZhong.playedcount') + temp);
  110. }
  111.  
  112. console.log('Played Count: '+ GM_getValue('YiZhong.playedcount'));
  113. console.log('Song ID: ' + GM_getValue('YiZhong.id'));
  114. console.log('Level : ' + GM_getValue('YiZhong.level'));
  115. window.location.href = "https://donderhiroba.jp/score_detail.php?song_no=" + GM_getValue('YiZhong.id') + "&level=" + GM_getValue('YiZhong.level')
  116. }
  117.  
  118. })();