dmm mission

dmm mission!

  1. // ==UserScript==
  2. // @name dmm mission
  3. // @namespace http://tampermonkey.net/
  4. // @version 2023.12.8
  5. // @description dmm mission!
  6. // @author cunhan
  7. // @match *://mission.games.dmm.com/
  8. // @match *://library.games.dmm.com/
  9. // @match *://mission.games.dmm.co.jp/
  10. // @match *://library.games.dmm.co.jp/
  11. // @match *://sp-play.games.dmm.com/*
  12. // @match *://sp-play.games.dmm.co.jp/*
  13. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  14. // @grant GM_openInTab
  15. // ==/UserScript==
  16.  
  17. /*
  18. 1、先手动签到dmm客户端的两个游戏
  19. 2、手动开启浏览器手机模式,然后打开https://library.games.dmm.co.jp/
  20. 2.1 脚本按顺序执行以下操作,打开https://library.games.dmm.com/
  21. 2.2 接着打开https://mission.games.dmm.co.jp/,并重复4次“打开页游,返回mission页面”,完成任务并领取代币。最后在新标签页打开https://mission.games.dmm.co.jp/(PC版)
  22. 2.3 接着打开https://mission.games.dmm.com/,同上。最后也是在新标签里打开https://mission.games.dmm.com/(PC版)
  23. 2.4 由于没有方法“以手机模式打开某个网页”,所以手机版的签到流程全都在同一个页面里顺序执行。
  24. 3、上述2.2和2.3打开的PC版mission页面,会同时在新标签页打开3个页游、library页面以及pachinko页面。等待10s后mission标签页自动刷新,领取代币。
  25. 4、上面打开的标签页都可以配置TabAutoClose(30s)来自动关闭
  26.  
  27. 总结,手动签到2个客户端游戏,然后手机模式打开https://library.games.dmm.co.jp/,剩下的事情脚本会全部搞定。
  28. */
  29.  
  30. (function() {
  31. 'use strict';
  32. var a = setTimeout(function() { myFunction(); },3000);//增加等待时间,让sp-play可以加载完成
  33. function myFunction(){ // 声明一个函数
  34. console.log("正在运行中...");
  35. var platform = document.getElementById("i3_vwtp");
  36. if (platform.value == "pc")
  37. {
  38. console.log("pc html");
  39. //处理PC版:
  40. //找到daliy challenge,如果有新的期间限定任务,让手机版的脚本去点
  41. var daily = document.getElementsByClassName("p-captStandard");
  42. for (i = 0; i < daily.length; i++) {
  43. console.log(daily[i].innerText)
  44. if (daily[i].innerText == "毎日チャレンジできる、デイリーミッション")
  45. {
  46. console.log(daily[i].nextSibling.nextSibling)
  47. var mission_status = daily[i].nextSibling.nextSibling.getElementsByClassName("listMission_gauge_flame");;
  48. if (mission_status.length > 0)
  49. {
  50. //还没有领取状态的文字,把几个页游点一遍
  51. var missionitems_pc = daily[i].nextSibling.nextSibling.getElementsByClassName("listMission_targetGameItem_inner");
  52. var i;
  53. for (i = 0; i < 3; i++) {
  54. console.log(missionitems_pc[i].href);
  55. var playstatus = missionitems_pc[i].getElementsByClassName("listMission_targetGameItem_isPlayed");
  56. if (playstatus.length == 0)
  57. {
  58.  
  59. GM_openInTab(missionitems_pc[i].href);
  60. }
  61. }
  62. GM_openInTab("https://www.dmm.com/netgame/pachinko/-/game/");
  63. GM_openInTab("https://library.games.dmm.co.jp/");
  64. GM_openInTab("https://library.games.dmm.com/");
  65. setTimeout(function() { uselessFunction(); },10000);
  66. }
  67. else
  68. {
  69. var adddiv = document.getElementsByClassName("receiveAll_btn");
  70. if (adddiv.length > 0)
  71. {
  72. console.log("PC:找到按钮"+adddiv.length);
  73. adddiv[0].click();
  74. console.log("PC:已点击接受所有报酬");
  75. }
  76. }
  77. }
  78.  
  79. }
  80. }
  81. //处理手机版
  82. //手动开启手机模式,按以下顺序依次跳转library.games.dmm.co.jp -> library.games.dmm.com -> mission.games.dmm.com -> mission.games.dmm.co.jp
  83. if (platform.value == "sp")
  84. {
  85. console.log("sp html")
  86. //从页游跳回mission
  87. if (document.domain == "sp-play.games.dmm.co.jp")
  88. {
  89. window.location.replace("https://mission.games.dmm.co.jp/");
  90. return;
  91. }
  92. if (document.domain == "sp-play.games.dmm.com")
  93. {
  94. window.location.replace("https://mission.games.dmm.com/");
  95. return;
  96. }
  97.  
  98. if (document.domain == "library.games.dmm.co.jp")//#1
  99. {
  100. window.location.replace("https://library.games.dmm.com/");
  101. return;
  102. }
  103. if (document.domain == "library.games.dmm.com")//#2
  104. {
  105. window.location.replace("https://mission.games.dmm.co.jp/");
  106. return;
  107. }
  108. //未play的逐个点
  109. var missionitems_mobile = document.getElementsByClassName("target-item-inner");
  110. var ij;
  111. for (ij = 0; ij < missionitems_mobile.length; ij++) {
  112. console.log(missionitems_mobile[ij].href);
  113. var playstatusm = missionitems_mobile[ij].getElementsByClassName("target-item-text-played");
  114. if (playstatusm.length == 0)
  115. {
  116. console.log("redirect.")
  117. window.location.replace(missionitems_mobile[ij].href);
  118. return;
  119. }
  120. else
  121. {
  122. console.log(playstatusm[0]);
  123. }
  124. }
  125. //访问mission页面时,先收菜后跳转
  126. adddiv = document.getElementsByClassName("receive-all-button");
  127. if (adddiv.length > 0)
  128. {
  129. console.log("手机版:找到按钮"+adddiv.length);
  130. adddiv[0].click();
  131. console.log("手机版:已点击接受所有报酬");
  132. }
  133. //同时在新标签页打开PC版
  134. if (document.domain == "mission.games.dmm.co.jp")//#3
  135. {
  136. console.log("mobile mission.jp -> mobile mission com, new pc mission.jp")
  137. GM_openInTab("https://mission.games.dmm.co.jp/");
  138. window.location.replace("https://mission.games.dmm.com/");
  139. return;
  140. }
  141. if (document.domain == "mission.games.dmm.com")//#4 end
  142. {
  143. console.log("mobile mission.com -> new pc misson.com")
  144. GM_openInTab("https://mission.games.dmm.com/");
  145. return;
  146. }
  147. }
  148.  
  149. }
  150.  
  151.  
  152. function uselessFunction(){
  153. console.log("最后刷新页面")
  154. location.reload();
  155. }
  156.  
  157.  
  158.  
  159.  
  160. })();
  161.