hwm_easy_rools

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

  1. // ==UserScript==
  2. // @name hwm_easy_rools
  3. // @author Kleshnerukij
  4. // @description Скрипт ускоряющий игру в рулетку.
  5. // @version 1.8.1
  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://qrator.heroeswm.ru/roulette.php
  10. // @include http://178.248.235.15/roulette.php
  11. // @include http://www.lordswm.com/roulette.php
  12. // @include https://www.heroeswm.ru/roulette.php
  13. // @include https://qrator.heroeswm.ru/roulette.php
  14. // @include https://178.248.235.15/roulette.php
  15. // @include https://www.lordswm.com/roulette.php
  16. // @encoding utf-8
  17. // ==/UserScript==
  18.  
  19. // (c) Клешнерукий http://www.heroeswm.ru/pl_info.php?id=7076906
  20.  
  21. window.onload = function() {
  22.  
  23. var rs_user_gold = new RegExp('gold\\.png.*?class="rs".*?<\\/td><td>([\\d,]*)<\\/td>','i');
  24. var rs_min_cur = new RegExp('Минимальная ставка:.*?Золото.*?<td>(.*?)<\\/td>','i');
  25. var rs_max_cur = new RegExp('Максимальная сумма ставок:.*?Золото.*?<td>(.*?)<\\/td>','i');
  26. var rs_all = new RegExp('<input type=\\"hidden\\" name=\\"cur_pl_bet\\".*?(\\d+)','i');
  27.  
  28. var user_gold = rs_user_gold.exec(document.body.innerHTML);
  29. user_gold = getCorrectNumber(user_gold[1]);
  30.  
  31. var min_cur = rs_min_cur.exec(document.body.innerHTML);
  32. min_cur = getCorrectNumber(min_cur[1]);
  33.  
  34. var max_cur = rs_max_cur.exec(document.body.innerHTML);
  35. max_cur = getCorrectNumber(max_cur[1]);
  36.  
  37. var all = rs_all.exec(document.body.innerHTML);
  38. all = getCorrectNumber(all[1]);
  39.  
  40. var remainder = max_cur-all; // остаток для ставок
  41. remainder = (user_gold < remainder) ? user_gold : remainder;
  42.  
  43. document.getElementsByTagName('table')[34].onclick = function(event) {
  44. if (document.getElementById('cForm') !== null) {
  45. document.getElementById("cForm").remove();
  46. }
  47. var field = event.target;
  48.  
  49. while (field != document.getElementsByTagName('table')[34]) {
  50. if (field.tagName == 'IMG') {
  51. cFormCreate(field, event);
  52. break;
  53. }
  54. field = field.parentNode;
  55. }
  56. document.getElementsByName('bettype')[0].value = field.title;
  57. };
  58.  
  59. function cFormCreate(field, event) {
  60. var host = window.location.hostname;
  61. var rs_name_img = new RegExp('.*\\/(.*)\\.gif','i');
  62. var name_img = rs_name_img.exec(field.src)[1];
  63. document.getElementsByName('bettype')[0].value = "";
  64. document.getElementsByName('bet')[0].value = "";
  65.  
  66. var c_form = document.createElement('div');
  67. c_form.id = "cForm";
  68. c_form.style.position = "absolute";
  69. c_form.style.width = "200px";
  70. //c_form.style.minHeight = "170px";
  71. c_form.style.margin = "0px";
  72. c_form.style.padding = "0px";
  73. c_form.style.background = "#E4E0D3";
  74.  
  75. c_form.style.WebkitBoxShadow = "0px 0px 15px #000";
  76. c_form.style.MozBoxShadow = "0px 0px 15px #000";
  77. c_form.style.BoxShadow = "0px 0px 15px #000";
  78. c_form.style.top = event.clientY;
  79. c_form.style.left = event.clientX;
  80.  
  81. var author = document.createElement('div');
  82. author.id = "author";
  83. author.style.height = "25px";
  84. author.style.width = "100%";
  85. author.style.margin = "20px 0px -5px 35px";
  86. author.style.cursor = "pointer";
  87. author.style.color = "#000";
  88. 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>";
  89.  
  90. var c_form_head = document.createElement('div');
  91. c_form_head.id = "c_form_head";
  92. c_form_head.style.height = "25px";
  93. c_form_head.style.width = "196px";
  94. c_form_head.style.margin = "2px 2px 0px 2px";
  95. c_form_head.style.background = "#2B903D";
  96. c_form_head.style.color = "#000";
  97.  
  98. var c_form_head_num = document.createElement('div');
  99. c_form_head_num.id = "c_form_head_num";
  100. c_form_head_num.style.height = "23";
  101. c_form_head_num.style.float = "left";
  102. c_form_head_num.style.fontSize = "15px";
  103. c_form_head_num.innerHTML = field.title;
  104. c_form_head_num.style.color = "#fff";
  105. c_form_head_num.style.padding = "2px 0 0 0";
  106.  
  107. var c_form_head_close = document.createElement('div');
  108. c_form_head_close.id = "close_form";
  109. c_form_head_close.innerHTML = "X";
  110. c_form_head_close.style.width = "21px";
  111. c_form_head_close.style.height = "25px";
  112. c_form_head_close.style.float = "right";
  113. c_form_head_close.style.padding = "0px 0px 0px 6px";
  114. c_form_head_close.style.fontSize = "20px";
  115. c_form_head_close.style.color = "#fff";
  116. c_form_head_close.style.background = "#CC3322";
  117. c_form_head_close.style.cursor = "pointer";
  118.  
  119. c_form_head_close.onclick = function() {
  120. var elem = document.getElementById("cForm");
  121. elem.remove();
  122. };
  123.  
  124. // Объявление второстепенных переменных
  125.  
  126. var message = document.createElement('text');
  127. message.id = "message";
  128.  
  129. var t = document.createElement('table');
  130. var tbody = document.createElement('tbody');
  131.  
  132. var step = 2;
  133. var td;
  134.  
  135. var end = false;
  136. var last_print = 0;
  137. var tr = document.createElement('tr');
  138.  
  139. var last = Math.floor((Number(min_cur)+100)/100)*100;
  140.  
  141. if (min_cur > user_gold) {
  142. message.innerHTML = "Недостаточно средств";
  143. } else if (min_cur > remainder) {
  144. message.innerHTML = "Вы уже поставили максимум";
  145. } else {
  146.  
  147. // Переделать обязательно!
  148. td = createTd(field, min_cur, min_cur);
  149. tr.appendChild(td);
  150. last_print = min_cur;
  151.  
  152. if (last > 1000) {
  153. last = Math.floor((Number(last)+1000)/1000)*1000;
  154. }
  155.  
  156. if (last <= user_gold && last <= remainder) {
  157. while (!end) {
  158. for (last; last <= 900; last += 100) {
  159.  
  160. if (last <= user_gold && last <= remainder && last <= max_cur) {
  161. td = createTd(field, last, last);
  162. tr.appendChild(td);
  163. last_print = last;
  164.  
  165. if (step % 4 === 0) {
  166. tbody.appendChild(tr);
  167. tr = document.createElement('tr');
  168. }
  169. step++;
  170.  
  171. } else {
  172. end = true;
  173. break;
  174. }
  175. }
  176.  
  177. for (last; last <= 9000; last += 1000) {
  178. if (last <= user_gold && last <= remainder && last <= max_cur) {
  179. td = createTd(field, last, (last/1000)+'к');
  180. tr.appendChild(td);
  181. last_print = last;
  182.  
  183. if (step % 4 === 0) {
  184. tbody.appendChild(tr);
  185. tr = document.createElement('tr');
  186. }
  187. step++;
  188.  
  189. } else {
  190. end = true;
  191. break;
  192. }
  193. }
  194.  
  195. for (last; last <= 18000; last += 2000) {
  196. if (last <= user_gold && last <= remainder && last <= max_cur) {
  197. td = createTd(field, last, (last/1000)+'к');
  198. tr.appendChild(td);
  199. last_print = last;
  200.  
  201. if (step % 4 === 0) {
  202. tbody.appendChild(tr);
  203. tr = document.createElement('tr');
  204. }
  205. step++;
  206.  
  207. } else {
  208. end = true;
  209. break;
  210. }
  211. }
  212.  
  213. for (last; last <= 35000; last += 5000) {
  214. if (last <= user_gold && last <= remainder && last <= max_cur) {
  215. td = createTd(field, last, (last/1000)+'к');
  216. tr.appendChild(td);
  217. last_print = last;
  218.  
  219. if (step % 4 === 0) {
  220. tbody.appendChild(tr);
  221. tr = document.createElement('tr');
  222. }
  223. step++;
  224.  
  225. } else {
  226. end = true;
  227. break;
  228. }
  229. }
  230.  
  231. for (last; last <= 100000; last += 10000) {
  232. if (last <= user_gold && last <= remainder && last <= max_cur) {
  233. td = createTd(field, last, (last/1000)+'к');
  234. tr.appendChild(td);
  235. last_print = last;
  236.  
  237. if (step % 4 === 0) {
  238. tbody.appendChild(tr);
  239. tr = document.createElement('tr');
  240. }
  241. step++;
  242.  
  243. } else {
  244. end = true;
  245. break;
  246. }
  247. }
  248.  
  249. end = true;
  250. }
  251. }
  252. }
  253.  
  254. if (last_print < remainder && remainder >= min_cur) {
  255. td = createTd(field, remainder, remainder);
  256. tr.appendChild(td);
  257. }
  258. tbody.appendChild(tr);
  259.  
  260. t.appendChild(tbody);
  261.  
  262. c_form_head.appendChild(c_form_head_num);
  263. c_form_head.appendChild(c_form_head_close);
  264. c_form.appendChild(c_form_head);
  265. c_form.appendChild(t);
  266. c_form.appendChild(message);
  267. c_form.appendChild(author);
  268. document.body.appendChild(c_form);
  269. }
  270.  
  271. function createTd(field, bet_num, text_field) {
  272. var td = document.createElement('td');
  273. td.style.width = "42px";
  274. td.style.height = "20px";
  275. td.style.padding = "0px 3px";
  276. td.style.color = "#fff";
  277. td.style.background = "#2B903D";
  278. td.style.fontSize = "13px";
  279. td.style.cursor = "pointer";
  280.  
  281. td.onmouseover = function(){
  282. this.style.background = "#DDD9CD";
  283. this.style.color = "#000";
  284. };
  285. td.onmouseout = function(){
  286. this.style.background = "#2B903D";
  287. this.style.color = "#fff";
  288. };
  289.  
  290. td.style.title = bet_num;
  291. td.innerHTML = text_field;
  292.  
  293. td.ondblclick = function () {
  294. document.getElementsByName('bettype')[0].value = field.title;
  295. document.getElementsByName('bet')[0].value = this.style.title;
  296. document.getElementsByName('rform')[0].submit();
  297. };
  298.  
  299. return td;
  300. }
  301.  
  302. function getCorrectNumber (num) {
  303. num = Number(num.replace(/,/i,""));
  304. return num;
  305. }
  306.  
  307. }();