hwm_easy_rools

Скрипт ускоряющий игру в рулетку.

目前为 2017-09-13 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name hwm_easy_rools
  3. // @author Kleshnerukij
  4. // @description Скрипт ускоряющий игру в рулетку.
  5. // @version 1.7.2
  6. // @homepage https://greasyfork.org/ru/scripts/11127-hwm-easy-rools
  7. // @namespace https://greasyfork.org/ru/scripts/11127-hwm-easy-rools
  8. // @include http://www.heroeswm.ru/roulette.php
  9. // @include http://www.heroeswm.ru/roulette.php
  10. // @include http://qrator.heroeswm.ru/roulette.php
  11. // @include http://178.248.235.15/roulette.php
  12. // @include http://www.lordswm.com/roulette.php
  13. // @encoding utf-8
  14. // ==/UserScript==
  15.  
  16. // (c) Клешнерукий http://www.heroeswm.ru/pl_info.php?id=7076906
  17.  
  18. var rs_user_gold = new RegExp('gold\\.gif.*?<td>([\\d,]*)','i');
  19. var rs_user_lvl = new RegExp('<td>([\\d,]*)<\\/td><\\/tr><\/tbody><\\/table><\\/td><\\/tr><\/tbody><\\/table>&nbsp','i');
  20. var rs_user_cur = new RegExp('([\\d,]*)<\\/b><\\/td><\\/tr><\/tbody><\\/table>','i');
  21.  
  22. var user_gold = rs_user_gold.exec(document.body.innerHTML);
  23. user_gold = getCorrectNumber(user_gold[1]);
  24.  
  25. var user_lvl = rs_user_lvl.exec(document.body.innerHTML);
  26. user_lvl = getCorrectNumber(user_lvl[1]).slice(0, -3);
  27.  
  28. var user_cur = rs_user_cur.exec(document.body.innerHTML);
  29. user_cur = getCorrectNumber(user_cur[1]);
  30.  
  31. document.getElementsByTagName('table')[34].onclick = function(event) {
  32. if (document.getElementById('cForm') !== null) {
  33. document.getElementById("cForm").remove();
  34. }
  35. var field = event.target;
  36.  
  37. while (field != document.getElementsByTagName('table')[34]) {
  38. if (field.tagName == 'IMG') {
  39. cFormCreate(field, event);
  40. break;
  41. }
  42. field = field.parentNode;
  43. }
  44. };
  45.  
  46. function cFormCreate(field, event) {
  47. var host = window.location.hostname;
  48. var rs_name_img = new RegExp('.*\\/(.*)\\.gif','i');
  49. var name_img = rs_name_img.exec(field.src)[1];
  50. document.getElementsByName('bettype')[0].value = "";
  51. document.getElementsByName('bet')[0].value = "";
  52.  
  53. var c_form = document.createElement('div');
  54. c_form.id = "cForm";
  55. c_form.style.position = "absolute";
  56. c_form.style.width = "200px";
  57. //c_form.style.minHeight = "170px";
  58. c_form.style.margin = "0px";
  59. c_form.style.padding = "0px";
  60. c_form.style.background = "#E4E0D3";
  61.  
  62. c_form.style.WebkitBoxShadow = "0px 0px 15px #000";
  63. c_form.style.MozBoxShadow = "0px 0px 15px #000";
  64. c_form.style.BoxShadow = "0px 0px 15px #000";
  65. c_form.style.top = event.clientY;
  66. c_form.style.left = event.clientX;
  67.  
  68. var author = document.createElement('div');
  69. author.id = "author";
  70. author.style.height = "25px";
  71. author.style.width = "100%";
  72. author.style.margin = "20px 0px -5px 35px";
  73. author.style.cursor = "pointer";
  74. author.style.color = "#000";
  75. author.innerHTML = "<a href=\"http://"+host+"/sms-create.php?mailto=%CA%EB%E5%F8%ED%E5%F0%F3%EA%E8%E9&subject=%CF%EE+%EF%EE%E2%EE%E4%F3+%F1%EA%F0%E8%EF%F2%E0+hwm_easy_rools\">Сообщить об ошибке</a>";
  76.  
  77. var c_form_head = document.createElement('div');
  78. c_form_head.id = "c_form_head";
  79. c_form_head.style.height = "25px";
  80. c_form_head.style.width = "196px";
  81. c_form_head.style.margin = "2px 2px 0px 2px";
  82. c_form_head.style.background = "#2B903D";
  83. c_form_head.style.color = "#000";
  84.  
  85.  
  86. var c_form_head_num = document.createElement('div');
  87. c_form_head_num.id = "c_form_head_num";
  88. c_form_head_num.style.height = "23";
  89. c_form_head_num.style.float = "left";
  90. c_form_head_num.style.fontSize = "15px";
  91. c_form_head_num.innerHTML = field.title;
  92. c_form_head_num.style.color = "#fff";
  93. c_form_head_num.style.padding = "2px 0 0 0";
  94.  
  95.  
  96. var c_form_head_close = document.createElement('div');
  97. c_form_head_close.id = "close_form";
  98. c_form_head_close.innerHTML = "X";
  99. c_form_head_close.style.width = "21px";
  100. c_form_head_close.style.height = "25px";
  101. c_form_head_close.style.float = "right";
  102. c_form_head_close.style.padding = "0px 0px 0px 6px";
  103. c_form_head_close.style.fontSize = "20px";
  104. c_form_head_close.style.color = "#fff";
  105. c_form_head_close.style.background = "#CC3322";
  106. c_form_head_close.style.cursor = "pointer";
  107.  
  108. c_form_head_close.onclick = function() {
  109. var elem = document.getElementById("cForm");
  110. elem.remove();
  111. };
  112.  
  113. var message = document.createElement('text');
  114. message.id = "message";
  115.  
  116. var t = document.createElement('table');
  117.  
  118. var tbody = document.createElement('tbody');
  119.  
  120. var min_cur = 0;
  121. if (user_lvl > 4) {
  122. min_cur = user_lvl*25;
  123. } else min_cur = 100;
  124.  
  125. var residue_rate = user_lvl*1000-user_cur;
  126.  
  127. var first_cur = Math.ceil(min_cur/100);
  128. var last_cur = parseInt(user_lvl)+9;
  129. var cur_step = 0;
  130. var step = 0;
  131. var print_min_cur = false;
  132. var br = false;
  133.  
  134. for (var i = first_cur; i <= last_cur; i++) {
  135. console.log(i);
  136. var td = document.createElement('td');
  137. td.style.width = "42px";
  138. td.style.height = "20px";
  139. td.style.padding = "0px 3px";
  140. td.style.color = "#fff";
  141. td.style.background = "#2B903D";
  142. td.style.fontSize = "13px";
  143. td.style.cursor = "pointer";
  144.  
  145. td.onmouseover = function(){
  146. this.style.background = "#DDD9CD";
  147. this.style.color = "#000";
  148. };
  149. td.onmouseout = function(){
  150. this.style.background = "#2B903D";
  151. this.style.color = "#fff";
  152. };
  153.  
  154. if (step % 4 === 0) {
  155. var tr = document.createElement('tr');
  156. }
  157.  
  158. if (user_gold >= min_cur && residue_rate >= min_cur) {
  159. if (i < (first_cur+1) && user_lvl > 5 && step === 0 && print_min_cur === false && ((user_lvl/4)-Math.floor(user_lvl/4)) !== 0) {
  160.  
  161. td.style.title = min_cur;
  162. td.innerHTML = min_cur;
  163.  
  164. i--;
  165. print_min_cur = true;
  166.  
  167. } else {
  168. if ((i * 100) < 1000) {
  169. cur_step = i * 100;
  170. } else {
  171. cur_step = (i - 9) * 1000;
  172. }
  173.  
  174. if (user_gold <= cur_step) {
  175. cur_step = user_gold;
  176. br = true;
  177. }
  178.  
  179. if (residue_rate <= cur_step) {
  180. cur_step = residue_rate;
  181. br = true;
  182. }
  183.  
  184. td.style.title = cur_step;
  185.  
  186. if (cur_step % 1000 === 0) {
  187. cur_step = String(cur_step);
  188. cur_step = cur_step.slice(0, -3);
  189. cur_step = cur_step + 'к';
  190. }
  191.  
  192. td.innerHTML = cur_step;
  193. }
  194. } else {
  195. if (residue_rate < min_cur) {
  196. message.innerHTML = "Больше ставить нельзя";
  197. } else if(user_gold < min_cur) {
  198. message.innerHTML = "Недостаточно средств";
  199. }
  200. break;
  201. }
  202.  
  203.  
  204. td.ondblclick = function () {
  205. document.getElementsByName('bettype')[0].value = field.title;
  206. document.getElementsByName('bet')[0].value = this.style.title;
  207. document.getElementsByName('rform')[0].submit();
  208. };
  209.  
  210. tr.appendChild(td);
  211.  
  212. if (step % 4 === 0) {
  213. tbody.appendChild(tr);
  214. }
  215. if (br) break;
  216. step++;
  217. }
  218. t.appendChild(tbody);
  219.  
  220. c_form_head.appendChild(c_form_head_num);
  221. c_form_head.appendChild(c_form_head_close);
  222. c_form.appendChild(c_form_head);
  223. c_form.appendChild(t);
  224. c_form.appendChild(message);
  225. c_form.appendChild(author);
  226. document.body.appendChild(c_form);
  227. }
  228.  
  229. function getCorrectNumber (num) {
  230. num = num.replace(/,/i,"");
  231. return num;
  232. }