· 6 years ago · Jan 09, 2020, 08:02 PM
1// ==UserScript==
2// @name GD_TOTAL
3// @namespace http://tampermonkey.net/
4// @version 12
5// @description try to take over the world!
6// @author void
7// @include *
8// @grant unsafeWindow
9// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
10// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js
11// @require https://openuserjs.org/src/libs/sizzle/GM_config.js
12// @require https://cdnjs.cloudflare.com/ajax/libs/howler/2.0.4/howler.min.js
13// @require https://raw.githubusercontent.com/AdminAnticaptcha/anticaptcha-nodejs/master/anticaptcha.js
14// @grant unsafeWindow
15// @grant GM_getValue
16// @grant GM_setValue
17// @grant GM_log
18// @grant GM_xmlhttpRequest
19// @grant GM.xmlHttpRequest
20// @connect budgetsms.net
21// @connect 2captcha.com
22// @connect anti-captcha.com
23// @connect pastebin.com
24// @connect self
25// @connect *
26// ==/UserScript==
27//SETTINGS MENU ---- INIT
28var apiFields = {
29 'captcha_api_key': {
30 'label': 'Insert your deacaptcher API key', // Appears next to field
31 'section': ['CAPTCHA Options'], // Appears above the field
32 'type': 'text', // Makes this setting a text field
33 'title': 'Your deacaptcher api key here', // Add a tooltip (hover over text)
34 'default': '' // Default value if user doesn't change it
35 },
36 'proxy_use': {
37 'label': 'Use proxy for captcha ?', // Appears next to field
38 'section': ['Proxy Options'], // Appears above the field
39 'type': 'checkbox', // Makes this setting a text input
40 'title': 'Use proxy for captcha ?', // Add a tooltip (hover over text)
41 'default': false // Default value if user doesn't change it
42 },
43 'proxy_ip': {
44 'label': 'Insert proxy IP (use 0 for your IP)', // Appears next to field
45 'type': 'text', // Makes this setting a text field
46 'title': 'Insert proxy IP (use 0 for your IP)', // Add a tooltip (hover over text)
47 'default': '0' // Default value if user doesn't change it
48 },
49 'proxy_port': {
50 'label': 'Insert proxy port', // Appears next to field
51 'type': 'text', // Makes this setting a text field
52 'title': 'Insert proxy port', // Add a tooltip (hover over text)
53 'default': '' // Default value if user doesn't change it
54 },
55 'proxy_login': {
56 'label': 'Insert proxy login', // Appears next to field
57 'type': 'text', // Makes this setting a text field
58 'title': 'Insert proxy login', // Add a tooltip (hover over text)
59 'default': '' // Default value if user doesn't change it
60 },
61 'proxy_pw': {
62 'label': 'Insert proxy password', // Appears next to field
63 'type': 'text', // Makes this setting a text field
64 'title': 'Insert proxy password', // Add a tooltip (hover over text)
65 'default': '' // Default value if user doesn't change it
66 },
67 'sms_username': {
68 'label': 'Insert your budgetSMS Username - Create free test account they give 60cents !', // Appears next to field
69 'section': ['SMS Options'], // Appears above the field
70 'type': 'text', // Makes this setting a text field
71 'title': 'Your budgetSMS username here', // Add a tooltip (hover over text)
72 'default': '' // Default value if user doesn't change it
73 },
74 'sms_userid': {
75 'label': 'Insert your budgetSMS userID', // Appears next to field
76 'type': 'text', // Makes this setting a text field
77 'title': 'Your budgetSMS userID here', // Add a tooltip (hover over text)
78 'default': '' // Default value if user doesn't change it
79 },
80 'sms_api_key': {
81 'label': 'Insert your budgetSMS HANDLE key', // Appears next to field
82 'type': 'text', // Makes this setting a text field
83 'title': 'Your budgetSMS HANDLE key here', // Add a tooltip (hover over text)
84 'default': '' // Default value if user doesn't change it
85 },
86 'sms_number': {
87 'label': 'Insert your number here! (format: Countrycode+number Ex: 351958845699)', // Appears next to field
88 'type': 'text', // Makes this setting a text field
89 'title': 'Inser your number here!', // Add a tooltip (hover over text)
90 'default': '' // Default value if user doesn't change it
91 }
92};
93var setFields = {
94 'crimes_carros': {
95 'label': 'Enable Crimes and Cars', // Appears next to field
96 'section': ['Ranking Options'], // Appears above the field
97 'type': 'checkbox', // Makes this setting a text input
98 'default': false // Default value if user doesn't change it
99 },
100 'booze_narcs': {
101 'label': 'Enable Booze & Narcs Mode', // Appears next to field
102 'type': 'radio', // Makes this setting a series of radio elements
103 'options': ['Money', 'RP', 'BOOST', 'Disable'], // Possible choices
104 'default': 'Disable' // Default value if user doesn't change it
105 },
106 'scratch': {
107 'label': 'Enable Scratcher', // Appears next to field
108 'section': ['Scratcher Options'], // Appears above the field
109 'type': 'checkbox', // Makes this setting a text input
110 'default': false // Default value if user doesn't change it
111 },
112 'scratch_on_cooldown': {
113 'label': 'Enable Scratcher while on cooldown for other crimes !', // Appears next to field
114 'type': 'checkbox', // Makes this setting a text input
115 'default': false // Default value if user doesn't change it
116 },
117 'min_sc': {
118 'label': 'Min Money on pocket to scratch', // Appears next to field
119 'type': 'int', // Makes this setting a text input
120 'min': 0, // Optional lower range limit
121 'max': 9999999, // Optional upper range limit
122 'default': 500000 // Default value if user doesn't change it
123 },
124 'send_message_scratch': {
125 'label': 'Send message if out of Scratch Money ?', // Appears next to field
126 'type': 'checkbox', // Makes this setting a text input
127 'default': false // Default value if user doesn't change it
128 },
129 'bo': {
130 'label': 'Enable Bust-Outs', // Appears next to field
131 'section': ['Bust-Outs Options'], // Appears above the field
132 'type': 'checkbox', // Makes this setting a text input
133 'default': false // Default value if user doesn't change it
134 },
135 'bo_on_cooldown': {
136 'label': 'Enable Bust-Outs while on cooldown for other crimes!', // Appears next to field
137 'type': 'checkbox', // Makes this setting a text input
138 'default': false // Default value if user doesn't change it
139 },
140 'bo_cooldown_time': {
141 'label': 'Timeout when jail is empty!', // Appears next to field
142 'type': 'int', // Makes this setting a text input
143 'min': 0, // Optional lower range limit
144 'max': 9999999, // Optional upper range limit
145 'default': 10 // Default value if user doesn't change it
146 },
147 'fianca': {
148 'label': 'Pay Out of jail ?', // Appears next to field
149 'section': ['Jail Options'], // Appears above the field
150 'type': 'checkbox', // Makes this setting a text input
151 'default': false // Default value if user doesn't change it
152 },
153 'min_bo': {
154 'label': 'Min Money on pocket to pay out of jail', // Appears next to field
155 'type': 'int', // Makes this setting a text input
156 'min': 0, // Optional lower range limit
157 'max': 9999999, // Optional upper range limit
158 'default': 50000 // Default value if user doesn't change it
159 },
160 'warning_captcha': {
161 'label': 'Only warn when captcha appears? IMPORTANT! IF SELECTED CAPTCHA WONT BE DONE AUTOMATICALLY', // Appears next to field
162 'section': ['Captcha Options'], // Appears above the field
163 'type': 'checkbox', // Makes this setting a text input
164 'default': false // Default value if user doesn't change it
165 },
166 'warning_captcha_sound': {
167 'label': 'Play sound when warning captcha ?', // Appears next to field
168 'type': 'checkbox', // Makes this setting a text input
169 'default': false // Default value if user doesn't change it
170 },
171 'check_message': {
172 'label': 'Check for being shoot while online?', // Appears next to field
173 'section': ['SMS / Misc Options'], // Appears above the field
174 'type': 'checkbox', // Makes this setting a text input
175 'default': false // Default value if user doesn't change it
176 },
177 'do_races': {
178 'label': 'Do races?', // Appears next to field
179 'section': ['Group Crimes / Races Options'], // Appears above the field
180 'type': 'checkbox', // Makes this setting a text input
181 'default': false // Default value if user doesn't change it
182 },
183 'race_friend': {
184 'label': 'Friend to invite for race', // Appears next to field
185 'type': 'text', // Makes this setting a text field
186 'title': 'Type your racer friend ingame', // Add a tooltip (hover over text)
187 'default': '' // Default value if user doesn't change it
188 },
189 'race_ask_chat': {
190 'label': 'Ask for race on chat? (This will take priority over inviting a friend!)', // Appears next to field
191 'type': 'checkbox', // Makes this setting a text input
192 'default': false // Default value if user doesn't change it
193 },
194 'race_msg': {
195 'label': 'Message to send asking race', // Appears next to field
196 'type': 'text', // Makes this setting a text field
197 'title': 'Message to send asking race', // Add a tooltip (hover over text)
198 'default': '' // Default value if user doesn't change it
199 },
200 'do_heists': {
201 'label': 'Do Heists?', // Appears next to field
202 'type': 'checkbox', // Makes this setting a text input
203 'default': false // Default value if user doesn't change it
204 },
205 'heists_friend': {
206 'label': 'Friend to invite for heist', // Appears next to field
207 'type': 'text', // Makes this setting a text field
208 'title': 'Type your heist friend ingame', // Add a tooltip (hover over text)
209 'default': '' // Default value if user doesn't change it
210 },
211 'heists_ask_chat': {
212 'label': 'Ask for heist on chat? (This will take priority over inviting a friend! so only select if you really want!)', // Appears next to field
213 'type': 'checkbox', // Makes this setting a text input
214 'default': false // Default value if user doesn't change it
215 },
216 'heist_msg': {
217 'label': 'Message to send asking heist', // Appears next to field
218 'type': 'text', // Makes this setting a text field
219 'title': 'Message to send asking heist', // Add a tooltip (hover over text)
220 'default': '' // Default value if user doesn't change it
221 },
222 'do_raids': {
223 'label': 'Do Raids?', // Appears next to field
224 'type': 'checkbox', // Makes this setting a text input
225 'default': false // Default value if user doesn't change it
226 },
227 'raids_friend': {
228 'label': 'Friend to invite for raid', // Appears next to field
229 'type': 'text', // Makes this setting a text field
230 'title': 'Type your raid friend ingame', // Add a tooltip (hover over text)
231 'default': '' // Default value if user doesn't change it
232 },
233 'raids_ask_chat': {
234 'label': 'Ask for Raids on chat? (This will take priority over inviting a friend! so only select if you really want!)', // Appears next to field
235 'type': 'checkbox', // Makes this setting a text input
236 'default': false // Default value if user doesn't change it
237 },
238 'raids_msg': {
239 'label': 'Message to send asking raid', // Appears next to field
240 'type': 'text', // Makes this setting a text field
241 'title': 'Message to send asking raid', // Add a tooltip (hover over text)
242 'default': '' // Default value if user doesn't change it
243 },
244 'do_ocs': {
245 'label': 'Do Organised Crimes?', // Appears next to field
246 'type': 'checkbox', // Makes this setting a text input
247 'default': false // Default value if user doesn't change it
248 },
249 'ocs_ask_chat': {
250 'label': 'Ask for Organised Crimes on chat?', // Appears next to field
251 'type': 'checkbox', // Makes this setting a text input
252 'default': false // Default value if user doesn't change it
253 },
254 'ocs_msg': {
255 'label': 'Message to send asking oc', // Appears next to field
256 'type': 'text', // Makes this setting a text field
257 'title': 'Message to send asking oc', // Add a tooltip (hover over text)
258 'default': '' // Default value if user doesn't change it
259 },
260 'GC_city': {
261 'label': 'Choose which city (or all) to do Group Crimes !', // Appears next to field
262 'type': 'select', // Makes this setting a text input
263 'options': ['Any', 'Detroit', 'Chicago', 'Palermo', 'New York', 'Las Vegas', 'Philadelphia', 'Baltimore', 'Corleone'],
264 },
265 'milestone_check': {
266 'label': 'Check for milestones and accept them ?)', // Appears next to field
267 'section': ['Milestones Options'], // Appears above the field
268 'type': 'checkbox', // Makes this setting a text input
269 'default': false // Default value if user doesn't change it
270 },
271 'milestone_send_sms': {
272 'label': 'Send sms when milestone redeemed ? (Need sms credentials!)', // Appears next to field
273 'type': 'checkbox', // Makes this setting a text input
274 'default': false // Default value if user doesn't change it
275 }
276};
277
278function whatV(hostname) {
279 hostname = hostname || window.location.hostname;
280 if (/(.*).omerta.land$/.test(hostname)) {
281 return 'dev';
282 }
283 switch (hostname) {
284 case 'www.omerta3.com':
285 case 'omerta3.com':
286 case 'www.barafranca.com':
287 case 'barafranca.com':
288 case 'www.barafranca.us':
289 case 'barafranca.us':
290 return 'com';
291 case 'omerta.dm':
292 case 'www.omerta.dm':
293 return 'dm';
294 case 'www.barafranca.nl':
295 case 'barafranca.nl':
296 return 'nl';
297 case 'www.omerta.com.tr':
298 case 'omerta.com.tr':
299 return 'tr';
300 case 'omerta.pt':
301 case 'www.omerta.pt':
302 return 'pt';
303 default:
304 return undefined;
305 }
306}
307var version = whatV();
308console.log("Version: " + version);
309var infoPage = (version == 'dm') ? '/?module=UserInformation' : '/information.php';
310if (version != undefined) {
311 GM_config.init({
312 'id': version, // The id used for this instance of GM_config
313 'title': 'Configuration for version: ' + version,
314 'fields': setFields, // Fields object
315 'events': // Callback functions object
316 {
317 'save': function() {
318 onSave();
319 }
320 }
321 });
322 var gmAPI = new GM_configStruct({
323 'id': 'APIoptions', // The id used for this instance of GM_config
324 'title': 'Configuration of Captcha/SMS API',
325 'fields': apiFields, // Fields object
326 'events': // Callback functions object
327 {
328 'save': function() {
329 onSaveAPI();
330 }
331 }
332 });
333} else {
334 console.log("Version is undefined - Not loading GM");
335}
336// TIMEOUTS
337var infoTimeOut, scratch10, scratchGo, dAsync, gApiTO, doCaptchaTO, captchaErroTO1, captchaErroTO2, doCrimeTO, doCarTO, doBN1, doBN2, doBN3, loopTO3, loopTO2, loopTO4;
338// CONFIG VARS
339var doingCaptcha = false;
340// First Time Check
341var lcArrayStorage = ["Enable", "heistChatMsg", "heistWaitTime", "raceChatMsg", "raceWaitTime", "raidChatMsg", "raidWaitTime", "ocWaitTime", "ocChatMsg"];
342lcArrayStorage.forEach(function(elem) {
343 if (localStorage.getItem(elem) === null) {
344 console.log(elem + ' = Null'); // first time runner
345 localStorage.setItem(elem, 0);
346 }
347});
348
349
350// Help Stacks
351var ranks = ['Empty-suit', 'Delivery Boy', 'Delivery Girl', 'Picciotto', 'Shoplifter', 'Pickpocket', 'Thief', 'Associate', 'Mobster', 'Soldier', 'Swindler', 'Assassin', 'Local Chief', 'Chief', 'Bruglione', 'Capodecina', 'Godfather', 'First Lady'];
352var cities = ['Detroit', 'Chicago', 'Palermo', 'New York', 'Las Vegas', 'Philadelphia', 'Baltimore', 'Corleone'];
353var maxBooze = [1, 2, 2, 5, 7, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 70, 70];
354var maxNarcs = [0, 0, 0, 1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 20, 20, 20];
355var boozenames = ['NO BOOZE', 'Wine', 'Beer', 'Rum', 'Cognac', 'Whiskey', 'Amaretto', 'Port'];
356var narcnames = ['NO NARCS', 'Morphine', 'Marijuana', 'Glue', 'Heroin', 'Opium', 'Cocaine', 'Tabacco'];
357var prevPrices = [];
358
359//CONTROL VARS
360var action;
361var SmuggleDone = false;
362var CanTravel = true;
363//Actualizar na hora as settings
364function onSave() {
365 console.log('Settings saved');
366 Enable = localStorage.getItem("Enable");
367 booze_narcs = GM_config.get('booze_narcs');
368 crimes_carros = GM_config.get('crimes_carros');
369 scratch = GM_config.get('scratch');
370 scratch_on_cooldown = GM_config.get('scratch_on_cooldown');
371 min_sc = GM_config.get('min_sc');
372 bos = GM_config.get('bo');
373 bo_on_cooldown = GM_config.get('bo_on_cooldown');
374 bo_cooldown_time = GM_config.get('bo_cooldown_time');
375 pagar_fianca = GM_config.get('fianca');
376 min_fianca = GM_config.get('min_bo');
377 do_races = GM_config.get('do_races');
378 do_heists = GM_config.get('do_heists');
379 do_raids = GM_config.get('do_raids');
380 heists_chat = GM_config.get('heists_ask_chat');
381 heists_friend = GM_config.get('heists_friend');
382 race_friend = GM_config.get('race_friend');
383 race_chat = GM_config.get('race_ask_chat');
384 raids_chat = GM_config.get('raids_ask_chat');
385 raids_friend = GM_config.get('raids_friend');
386 do_ocs = GM_config.get('do_ocs');
387 ocs_chat = GM_config.get('ocs_ask_chat');
388 GC_city = GM_config.get('GC_city');
389 race_msg = GM_config.get('race_msg');
390 heist_msg = GM_config.get('heist_msg');
391 raids_msg = GM_config.get('raids_msg');
392 ocs_msg = GM_config.get('ocs_msg');
393 send_message_scratch = GM_config.get('send_message_scratch');
394 warning_captcha = GM_config.get('warning_captcha');
395 warning_captcha_sound = GM_config.get('warning_captcha_sound');
396 milestone_check = GM_config.get('milestone_check');
397 milestone_send_sms = GM_config.get('milestone_send_sms');
398 $('#GODbody').html('Enable:<font style="float:right;"><b>' + Enable + '</b></font><br />Car/Crimes:<font style="float:right;"><b>' + crimes_carros + '</b></font><br />Booze/Narcs:<font style="float:right;"><b>' + booze_narcs + '</b></font><br />Scratch:<font style="float:right;"><b>' + scratch + '</b></font><br />BustOuts:<font style="float:right;"><b>' + bos);
399}
400
401function onSaveAPI() {
402 console.log('API Settings saved');
403 captcha_api_key = gmAPI.get('captcha_api_key');
404 proxy_use = gmAPI.get('proxy_use');
405 proxy_login = gmAPI.get('proxy_login');
406 proxy_pw = gmAPI.get('proxy_pw');
407 proxy_ip = gmAPI.get('proxy_ip');
408 proxy_port = gmAPI.get('proxy_port');
409 sms_api_key = gmAPI.get('sms_api_key');
410 sms_username = gmAPI.get('sms_username');
411 sms_userid = gmAPI.get('sms_userid');
412 sms_number = gmAPI.get('sms_number');
413}
414if (version != undefined) {
415 onSave();
416 onSaveAPI();
417} else {
418 console.log("Version Undefined - GM not loaded!");
419}
420// HORA
421function getOmertaTime() {
422 if (typeof unsafeWindow.omerta.server.clock !== 'undefined') {
423 return unsafeWindow.omerta.server.clock.getTime();
424 }
425 if (typeof unsafeWindow.omerta.Clock !== 'undefined') {
426 return unsafeWindow.omerta.Clock.getTime();
427 }
428 return Date.now();
429}
430//Send notifications
431function notifyGOD(title, text, tag, URLicon) {
432 var notification = new Notification(title, {
433 dir: 'auto',
434 body: text,
435 icon: URLicon,
436 tag: tag
437 });
438 notification.onclick = function() {
439 parent.focus();
440 notification.close();
441 };
442 setTimeout(notification.close.bind(notification), 6800);
443}
444
445function playSound() {
446 var sound = new Howl({
447 src: ['https://d1oi19aitxwcck.cloudfront.net' + '/sounds/beep.mp3']
448 });
449 sound.play();
450}
451//Funcao get pageurl
452function getUrl() {
453 return (pageUrl = "https://" + (location.host) + "/");
454}
455//Funcao clearTimeouts
456function clearTO(id) {
457 if (typeof id !== 'undefined') {
458 clearTimeout(id);
459 }
460}
461//Função detectar pagina
462function on_page(str) {
463 if (window.location.hash.indexOf(str) != -1) {
464 return true;
465 }
466 return false;
467}
468
469function check_title(title) {
470 var pTitle = omerta.GUI.container.title();
471 if (pTitle.indexOf(title) !== -1) {
472 return true;
473 } else {
474 return false;
475 }
476}
477//Função nr random entre (min) (max)
478function rnd(min, max) {
479 return Math.floor(Math.random() * (max - min + 1) + min);
480}
481
482function array_sum(array) {
483 return array.reduce(function(a, b) {
484 return (a + b);
485 });
486}
487// LOGOUT
488function logout() {
489 window.location = '/logout.php';
490}
491
492// Func detectar captcha
493function deCaptcha() {
494 if ((document.documentElement.textContent || document.documentElement.innerText).indexOf('Security Check') > -1 && warning_captcha === true) {
495 console.log('Got Captcha - Sending warn notification! - check if done in 7 seconds');
496 doingCaptcha = true;
497 notifyGOD('Got Captcha', 'Have captcha on ' + version + ' !', 'captcha', 'https://www.google.com/recaptcha/intro/images/hero-recaptcha-invisible.gif');
498 if (warning_captcha_sound === true) {
499 playSound();
500 }
501 warnCaptcha = setTimeout(loop, 7000);
502 } else if ((document.documentElement.textContent || document.documentElement.innerText).indexOf('Security Check') > -1) {
503 console.log("Temos Captcha");
504 if (doingCaptcha === false) {
505 console.log("Doing Captcha");
506 doingCaptcha = true;
507 var anticaptcha = new Anticaptcha(captcha_api_key);
508 anticaptcha.setWebsiteURL(window.location.href);
509 anticaptcha.setWebsiteKey("6Ldvw_4SAAAAALAn52hITD-mzh10oyGaef6-A3bf");
510
511 //proxy access parameters
512 anticaptcha.setProxyType("http");
513 if (proxy_ip === '0') {
514 anticaptcha.setProxyAddress(myip);
515 } else {
516 anticaptcha.setProxyAddress(proxy_ip);
517 }
518 anticaptcha.setProxyPort(proxy_port);
519 anticaptcha.setProxyLogin(proxy_login);
520 anticaptcha.setProxyPassword(proxy_pw);
521
522 anticaptcha.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
523
524 //Do Captcha
525 anticaptcha.createTask(function(err, taskId) {
526 if (err) {
527 console.error(err);
528 return;
529 }
530
531 console.log("taskId: " + taskId);
532
533 anticaptcha.getTaskSolution(taskId, function(err, taskSolution) {
534 if (err) {
535 doCaptchaTO3 = setTimeout(function() {
536 console.error(err);
537 window.location.href = window.location.origin;
538 },1500);
539 }
540 console.log("taskSolution: " + taskSolution);
541
542 $(".g-recaptcha-response").innerHTML = taskSolution;
543 //$('span#recaptcha-anchor').click();
544 omerta.services.security.check(taskSolution);
545 doCaptchaTO = setTimeout(function() {
546 doingCaptcha = false;
547 loop();
548 }, 3000);
549
550 });
551 });
552 } else {
553 console.log("Temos captcha - Ja estamos a fazer!");
554 }
555 } else {
556 doingCaptcha = false;
557 return false;
558 }
559}
560//Reload DIV quando fica stuck em mensagens de merda !
561function clks() {
562 var page = window.location.hash.substring(1);
563 $('#game_container').load(page);
564}
565function gotClicks(){
566 if ($('#game_container:contains("You reached your click limit.")').length) { // CLICKS WAIT 10 SECS AND RELOAD DIV
567 console.log("Clicks - 10secs tentar de novo");
568 gotclicksTO1 = setTimeout(function() {
569 clks();
570 loop();
571 }, 10000);
572 return true;
573 }
574 else{
575 return false;
576 }
577}
578function startStop() {
579 var Enable = localStorage.getItem('Enable');
580 if (Enable != "true") {
581 localStorage.setItem('Enable', "true");
582 onSave();
583 Enable = localStorage.getItem('Enable');
584 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
585 loop();
586 } else if (Enable === "true") {
587 clearTO(infoTimeOut);
588 clearTO(scratch10);
589 clearTO(scratchGo);
590 clearTO(loopTO3);
591 clearTO(loopTO2);
592 clearTO(loopTO4);
593 localStorage.setItem('Enable', "false");
594 onSave();
595 Enable = localStorage.getItem('Enable');
596 loop();
597 }
598}
599
600function start() {
601 var Enable = localStorage.getItem('Enable');
602 localStorage.setItem('Enable', "true");
603 onSave();
604 Enable = localStorage.getItem('Enable');
605 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
606 loop();
607}
608
609function stop() {
610 clearTO(infoTimeOut);
611 clearTO(scratch10);
612 clearTO(scratchGo);
613 clearTO(loopTO3);
614 clearTO(loopTO2);
615 clearTO(loopTO4);
616 localStorage.setItem('Enable', "false");
617 onSave();
618 Enable = localStorage.getItem('Enable');
619 loop();
620}
621
622function chkMessage() {
623 var check_message = GM_config.get('check_message');
624 if (check_message === true) {
625 msgSI = setInterval(function() {
626 console.log('Checking if got shoot!');
627 var serviceData = unsafeWindow.omerta.services.account.data;
628 var lastShootID = localStorage.getItem('lastShootID');
629 if (serviceData.messages.inbox.length > 0) {
630 var totalMessages = 0;
631 $.each(serviceData.messages.inbox, function(i, val) {
632 var id = parseInt(val.id, 10);
633 msgText = serviceData.messages.inbox[i].msg;
634 msgTitle = /*'New message from ' + serviceData.messages.inbox[i].frm + ': ' +*/ serviceData.messages.inbox[i].sbj;
635 console.log(msgTitle);
636 console.log(msgText);
637 if (lastShootID != id && (msgTitle == "You've been shot!" || msgTitle == "Foste atacado!")) {
638 GM_xmlhttpRequest({
639 method: "GET",
640 url: "http://api.budgetsms.net/sendsms/?username=" + sms_username + "&userid=" + sms_userid + "&handle=" + sms_api_key + "&msg=" + msgText + "&from=GODSCRIPT&to=" + sms_number,
641 onload: function(response) {
642 console.log(response.responseText);
643 }
644 });
645 localStorage.setItem('lastShootID', id);
646 }
647 totalMessages += 1;
648 });
649 }
650 }, 30000);
651 }
652}
653
654// NEW priceS
655function newPrices() {
656 setTimeout(function() {
657 console.log("BN Price Fetcher ON!");
658 $.get('//' + document.location.hostname + '/BeO/webroot/index.php?module=API&action=smuggling_prices', function(dom) {
659 function getPrice(drug, city) {
660 return dom.getElementsByTagName(drug)[city].textContent;
661 }
662
663 function refreshMarquee(h, m) {
664 h = (m >= 31 ? h + 1 : h);
665 m = (m >= 31 ? 1 : 31);
666 var marQd = new Date();
667 marQd.setHours(h);
668 marQd.setMinutes(m);
669 marQd.setSeconds(0);
670 marQd.setMilliseconds(0);
671 return (marQd.getTime() - getOmertaTime());
672 }
673
674 var p = [];
675 var q = [];
676 var pricesChanged = false;
677
678 for (var i = 0; i <= 7; i++) {
679 p[i] = getPrice('cocaine', i);
680 q[i] = p[i];
681 if ((prevPrices === undefined || prevPrices[i] === undefined) || prevPrices[i] != p[i]) {
682 pricesChanged = true;
683 }
684 }
685
686 if (pricesChanged) {
687 prevPrices = JSON.parse(JSON.stringify(q));
688 } else {
689 console.log("Waiting new prices!");
690 setTimeout(newPrices, 30000);
691 return;
692 }
693
694 // NEW PRICES
695 highPriceNarcs = 0;
696 lowPriceNarcs = 99999;
697 highPriceBooze = 0;
698 lowPriceBooze = 99999;
699 highCity = -1;
700 lowCity = -1;
701
702 /*var possessions = unsafeWindow.omerta.modules.UserInformation.data.possessions;
703 if (possessions) {
704 $.each(possessions, function(i) {
705 if (possessions[i].type == 'plane') {
706 ride = possessions[i].name_owned;
707 }
708 });
709 }
710 var rides = ['none', 'geen', 'Fokker DR-1', 'Havilland DH 82A', 'Fleet 7', 'Douglas DC-3'];
711 for (var plane = 0, i = 0; i <= 5; i++) {
712 if (rides[i] == ride) {
713 plane = i;
714 break;
715 }
716 }*/
717
718 for (i = 0; i <= 7; i++) {
719 var tempPriceNarc = parseInt(dom.getElementsByTagName('cocaine')[i].textContent, 10);
720 var tempPriceBooze = parseInt(dom.getElementsByTagName('rum')[i].textContent, 10);
721 //if( plane != 0 && (i != 2 || i != 7 )){
722 //high
723 highPriceNarcs = Math.max(highPriceNarcs, tempPriceNarc);
724 if (highPriceNarcs == tempPriceNarc) {
725 highCity = i;
726 highPriceBooze = tempPriceBooze;
727 }
728 //low
729 lowPriceNarcs = Math.min(lowPriceNarcs, tempPriceNarc);
730 if (lowPriceNarcs == tempPriceNarc) {
731 lowCity = i;
732 lowPriceBooze = tempPriceBooze;
733 }
734 //}
735 }
736 console.log("High City is: " + cities[highCity] + " - Coke: " + highPriceNarcs + " - Rum: " + highPriceBooze);
737 console.log("Low City is: " + cities[lowCity] + " - Coke: " + lowPriceNarcs + " - Rum: " + lowPriceBooze);
738
739 //SET FOR NEXT 30MINS !
740 setTimeout(newPrices, refreshMarquee(new Date().getHours(), new Date().getMinutes()));
741 });
742 });
743}
744function travel(id, callback) {
745 unsafeWindow.omerta.GUI.container.loadPage('/?module=Travel&action=FetchInfo&CityId=' + id);
746 travelGOTO = setTimeout(function() {
747 if ($('#game_container:contains("You will be able to travel again")').length) { // We cant travel!
748 CanTravel = false;
749 callback();
750 } else {
751 travelTO = setTimeout(function() {
752 $('input[type=submit]').removeAttr("data-confirm");
753 $('input[type=submit]').focus().click();
754 canTravel = false;
755 travelTO1 = setTimeout(function() {
756 callback();
757 }, 2000);
758 }, 2000);
759 }
760 }, 2000);
761}
762//Press Funcs
763function pressSCRT() {
764 if ($('#game_container:contains("You can buy")').length) {
765 if ($('input[name="codescratch"]').length) { // focus on unclaimed prices
766 $('input[type="submit"]:eq(1)').focus().click(); // clikar unclaimed prizes
767 } else { // focus on scratch
768 $('input[name="scratch"]').focus().click();
769 }
770 } else if ($('#game_container:contains("Congratulations!")').length) { // won something
771 $('input[name="scratch"]').focus().click();
772 } else if ($('#game_container:contains("Sorry mate")').length) { // no prize
773 $('input[name="scratch"]').focus().click();
774 } else if ($('#game_container:contains("Start scratching")').length) { // Pagina inicio
775 if ($('input[name="Check"]').length) {
776 $('input[name="Check"]').focus().click();
777 } else {
778 $('input[type="submit"]').focus().click();
779 }
780 } else if ($('#game_container:contains("here to try again")').length) {
781 console.log("Demos reload ou click com captcha! SHIT");
782 if ((document.documentElement.textContent || document.documentElement.innerText).indexOf('Security Check') > -1) {
783 console.log("Ainda tem captcha");
784 return;
785 } else {
786 console.log("Shit page - go to scratch again !");
787 unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
788 }
789 } else if ($('#game_container:contains("You tramp! Trying to steal our scratch cards!")').length) { // no money go logout
790 console.log("Tamos sem $, dammm :( - Fazer logout");
791 if (send_message_scratch === true) {
792 GM_xmlhttpRequest({
793 method: "GET",
794 url: "http://api.budgetsms.net/sendsms/?username=" + sms_username + "&userid=" + sms_userid + "&handle=" + sms_api_key + "&msg=Out_of_scratch_money&from=GODSCRIPT&to=" + sms_number,
795 onload: function(response) {
796 console.log(response.responseText);
797 }
798 });
799 }
800 logout();
801 }
802}
803//JAIL
804function inJail() {
805 var pocketMoney = omerta.services.account.data.money;
806 if ($('#game_container:contains("You are in jail for the next")').length) {
807 console.log("preso");
808 if ($('#game_container:contains("Try to bust yourself out.")').length) {
809 console.log("tirar-me da prisa");
810 $('input[type=submit]:eq(1)').focus().click();
811 } else if (pagar_fianca === true && pocketMoney > min_fianca) {
812 console.log("pagar fiança");
813 $('input[name="buymeout"]').focus().click();
814 clks();
815 return false;
816 } else if ($('#game_container:contains("Now")').length) {
817 console.log("Nao pagar fiança. tempo acabou");
818 clks();
819 return false;
820 } else {
821 return true;
822 }
823 } else {
824 return false;
825 }
826}
827//BOBOS - money left
828function bobos() {
829 var pocketMoney = omerta.services.account.data.money;
830 if (deCaptcha() === false) {
831 if ($('#game_container:contains("GO FOR IT")').length) {
832 console.log("do bo");
833 $('input[type="submit"]').focus().click();
834 } else if ($('#game_container:contains("You are in jail for the next")').length) {
835 console.log("preso");
836 if ($('#game_container:contains("Try to bust yourself out.")').length) {
837 console.log("tirar-me da prisa");
838 $('input[type=submit]:eq(1)').focus().click();
839 } else if (pagar_fianca === true && pocketMoney > min_fianca) {
840 console.log("pagar fiança");
841 $('input[name="buymeout"]').focus().click();
842 } else if ($('#game_container:contains("Now")').length) {
843 console.log("Nao pagar fiança. tempo acabou");
844 clks();
845 }
846 } else if ($('#game_container:contains("You have been released from jail")').length) {
847 console.log("Deram bo ou pagaram fiança");
848 clks();
849 } else if ($('#game_container:contains("You bought yourself out")').length) {
850 console.log("falhei tirarme 3x paguei fiança");
851 clks();
852 }
853 }
854}
855//-------------------------------------------------------------------------
856// ------------------------ Funções de ranking ----------------------------
857function crimeAtpt() {
858 unsafeWindow.omerta.GUI.container.loadPage('/?module=Crimes');
859 if (deCaptcha() === false) {
860 doCrimeTO = setTimeout(function() {
861 console.log('Doing Crime!');
862 $("#crime-chance5").click();
863 doCrimeTO2 = setTimeout(loop, 2000);
864 }, 2000);
865 }
866}
867
868function carN() {
869 unsafeWindow.omerta.GUI.container.loadPage('/?module=Cars');
870 if (deCaptcha() === false) {
871 doCarTO = setTimeout(function() {
872 var bestChance = 0;
873 var choice = 3;
874 $('#nick-car-choices .head h4').each(function(i) {
875 if (parseInt($(this).text().replace('%', ''), 10) > bestChance) {
876 bestChance = parseInt($(this).text().replace('%', ''), 10);
877 choice = i;
878 }
879 });
880 $('#nick-car-choices .popup-place-wrapper:eq(' + choice + ')').addClass('active');
881 $('#nick-car-choices button:eq(' + choice + ')').focus().click();
882 console.log('Doing Car Nick! Option: ' + choice + " With Chance of: " + bestChance);
883 doCarTO2 = setTimeout(loop, 2000);
884 }, 2000);
885 }
886}
887
888function bnRP() { // TO MAKE IT BETTER !
889 if (Enable == "true") {
890 if (!on_page('/smuggling.php')) {
891 unsafeWindow.omerta.GUI.container.loadPage('/smuggling.php');
892 }
893 doRP0 = setTimeout(function() {
894 if (check_title("Smuggling") === true) {
895 if (deCaptcha() === false) {
896 if (inJail() === false ) {
897 if (!gotClicks()){
898 doRP1 = setTimeout(function() {
899 //Check if lackeys on
900 if ($('#game_container').html().match('/orourke.jpg') !== null || $('#game_container').html().match('/freekowski.jpg') !== null) {
901 console.log("BN Lackeys on!");
902 GM_config.set('booze_narcs', "Disabled");
903 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
904 loop();
905 }
906 console.log('Doing RP Booze/Narc Buy!');
907 var MyCity = unsafeWindow.omerta.character.game.city();
908 for (i = 0; i < 8; i++) {
909 if (MyCity == cities[i]) {
910 MyCity = i;
911 break;
912 }
913 }
914 //Check what we carry!
915 var inputs = $('input');
916 var bn_xp = '.smuggling-header';
917 if( $(bn_xp).html() != undefined ){
918 var bn_text = $(bn_xp).html().split('|');
919 }
920 else{
921 console.log("cant get bn_xp - try again");
922 bnRPTO01 = setTimeout(function() {
923 bnRP();
924 }, 2000);
925 }
926
927 var cash = parseInt(bn_text[0].replace(/[^0-9.]/g, ''), 10);
928 var booze = parseInt(bn_text[1].replace(/[^0-9.]/g, ''), 10); // max amount user can carry
929 var narcs = parseInt(bn_text[2].replace(/[^0-9.]/g, ''), 10);
930
931 var b_amount = [0, 0, 0, 0, 0, 0];
932 var n_amount = [0, 0, 0, 0, 0, 0];
933
934 var xpb = 'table.thinline > tbody > tr:eq(';
935 var xpn = 'table.thinline:eq(1) > tbody > tr:eq(';
936
937 for (var i = 0; i <= 13; i++) {
938 if (i < 7) { // booze
939 var x = i + 3;
940 b_amount[i] = parseInt($(xpb + x + ') > td:eq(2)').html(), 10);
941 }
942
943 if (i > 6) {
944 var x = i - 4;
945 n_amount[(i - 7)] = parseInt($(xpn + x + ') > td:eq(2)').html(), 10); // define how much of this item is being carried
946 }
947
948 }
949 var totalB = array_sum(b_amount);
950 var totalN = array_sum(n_amount);
951 var missingB = booze - totalB;
952 var missingN = narcs - totalN;
953
954 //Need to sell whatever i'm holding!
955 if (parseInt(totalB, 10) !== 0 || parseInt(totalN, 10) !== 0) {
956 var sorts = ['wine', 'cognac', 'whiskey', 'amaretto', 'beer', 'port', 'rum', 'morphine', 'heroin', 'opium', 'cocaine', 'marihuana', 'tabacco', 'glue'];
957 for (i = 0; i <= 13; i++) {
958 var box = $('input[name="' + sorts[i] + '"]');
959 if (i < 7) {
960 box.val(b_amount[i]);
961 } else {
962 box.val(n_amount[i - 7]);
963 }
964 }
965 $('input[name="typebooze"]:eq(0)').prop('checked', true); // sell
966 $('input[name="typedrugs"]:eq(0)').prop('checked', true); // sell
967 var rpTO1 = setTimeout(function() {
968 $('input[type=submit]').focus().click();
969 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
970 loop();
971 }, 2000);
972 } else if ($('.smuggling-table-info:eq(0)').text().match(/NOW|booze is(\s+)$/m) || $('.smuggling-table-info:eq(1)').text().match(/NOW|narcotics is(\s+)$/m)) { // have BN to buy for RP !
973 if ($('.smuggling-table-info:eq(0)').text().match(/NOW|booze is(\s+)$/m)) // booze RP
974 {
975 $('input[name="beer"]').val(booze);
976 $('input[name="typebooze"]:eq(1)').prop('checked', true); // buy
977 }
978 if ($('.smuggling-table-info:eq(1)').text().match(/NOW|narcotics is(\s+)$/m)) // narcs RP
979 {
980 $('input[name="glue"]').val(narcs);
981 $('input[name="typedrugs"]:eq(1)').prop('checked', true); // buy
982 }
983 var rpTO2 = setTimeout(function() {
984 $('input[type=submit]').focus().click();
985 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
986 loop();
987 }, 2000);
988 } else { // Means we have no RP to gain!
989 rpTO3 = setTimeout(function() {
990 if (deCaptcha() === false) {
991 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
992 loop();
993 }
994 }, 2000);
995 }
996 }, 2000);
997 }
998 }else if (inJail() === true){
999 var bnRPTO02 = setTimeout(function(){
1000 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1001 loop();
1002 },5000);
1003 }
1004 }
1005 } else {
1006 clks();
1007 bnRP();
1008 }
1009 }, 2000);
1010 }
1011}
1012
1013function BoozeNarcRun() {
1014 if (Enable == "true") {
1015 if (!on_page('/smuggling.php')) {
1016 unsafeWindow.omerta.GUI.container.loadPage('/smuggling.php');
1017 }
1018 doSmug1 = setTimeout(function() {
1019 if (check_title("Smuggling") === true) {
1020 if (deCaptcha() === false) {
1021 if (inJail() === false) {
1022 doSmug2 = setTimeout(function() {
1023 //Check if lackeys on
1024 if ($('#game_container').html().match('/orourke.jpg') !== null || $('#game_container').html().match('/freekowski.jpg') !== null) {
1025 console.log("BN Lackeys on!");
1026 GM_config.set('booze_narcs', "Disabled");
1027 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1028 loop();
1029 }
1030 SmuggleDone = false;
1031 console.log('Doing booze or narc money run!');
1032 var MyCity = unsafeWindow.omerta.character.game.city();
1033 for (i = 0; i < 8; i++) {
1034 if (MyCity == cities[i]) {
1035 MyCity = i;
1036 break;
1037 }
1038 }
1039
1040 //Check what we carry!
1041 var inputs = $('input');
1042 var bn_xp = '.smuggling-header';
1043 var bn_text = $(bn_xp).html().split('|');
1044
1045 var cash = parseInt(bn_text[0].replace(/[^0-9.]/g, ''), 10);
1046 var booze = parseInt(bn_text[1].replace(/[^0-9.]/g, ''), 10); // max amount user can carry
1047 var narcs = parseInt(bn_text[2].replace(/[^0-9.]/g, ''), 10);
1048 var b_amount = [0, 0, 0, 0, 0, 0];
1049 var n_amount = [0, 0, 0, 0, 0, 0];
1050
1051 var xpb = 'table.thinline > tbody > tr:eq(';
1052 var xpn = 'table.thinline:eq(1) > tbody > tr:eq(';
1053
1054 for (var i = 0; i <= 13; i++) {
1055 if (i < 7) { // booze
1056 var x = i + 3;
1057 b_amount[i] = parseInt($(xpb + x + ') > td:eq(2)').html(), 10);
1058 }
1059
1060 if (i > 6) {
1061 var x = i - 4;
1062 n_amount[(i - 7)] = parseInt($(xpn + x + ') > td:eq(2)').html(), 10); // define how much of this item is being carried
1063 }
1064
1065 }
1066 var totalB = array_sum(b_amount);
1067 var totalN = array_sum(n_amount);
1068 var missingB = booze - totalB;
1069 var missingN = narcs - totalN;
1070
1071 console.log("I'm in city: " + cities[MyCity] + " | Booze: " + totalB + " Narcs: " + totalN);
1072
1073 if (parseInt(missingB, 10) === parseInt(booze, 10) || parseInt(missingN, 10) === parseInt(narcs, 10)) { //I'm EMPTY
1074 if (parseInt(MyCity, 10) === parseInt(lowCity, 10)) { //We are in low city, go buy
1075 console.log("Buying in " + cities[MyCity]);
1076 if (missingB === booze) {
1077 $('input[name="rum"]').val(booze);
1078 }
1079 if (missingN === narcs) {
1080 $('input[name="cocaine"]').val(narcs);
1081 }
1082 $('input[name="typebooze"]:eq(1)').prop('checked', true); // buy
1083 $('input[name="typedrugs"]:eq(1)').prop('checked', true); // buy
1084 var bnTO1 = setTimeout(function() {
1085 $('input[type=submit]').focus().click();
1086 BoozeNarcRun();
1087 }, 2000);
1088 } else if (parseInt(MyCity, 10) === parseInt(highCity, 10) && CanTravel === false && missingB === booze && missingN === narcs) { // We are in high city without BN and cant travel to buy! DONE!
1089 console.log("We are in high city without BN, cant travel. We are done!");
1090 SmuggleDone = true;
1091 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1092 loop();
1093 } else if (CanTravel === true) { // need to travel
1094 console.log("We need to buy, traveling to " + cities[lowCity]);
1095 travel(lowCity, BoozeNarcRun);
1096 }
1097 }
1098 if (missingB === 0 || missingN === 0) { // I'm full
1099 if (parseInt(MyCity, 10) === parseInt(highCity, 10)) { // Need to sell
1100 console.log("Selling in " + cities[MyCity]);
1101 var sorts = ['wine', 'cognac', 'whiskey', 'amaretto', 'beer', 'port', 'rum', 'morphine', 'heroin', 'opium', 'cocaine', 'marihuana', 'tabacco', 'glue'];
1102 for (i = 0; i <= 13; i++) {
1103 var box = $('input[name="' + sorts[i] + '"]');
1104 if (i < 7) {
1105 box.val(b_amount[i]);
1106 } else {
1107 box.val(n_amount[i - 7]);
1108 }
1109 }
1110 $('input[name="typebooze"]:eq(0)').prop('checked', true); // sell
1111 $('input[name="typedrugs"]:eq(0)').prop('checked', true); // sell
1112 var bnTO2 = setTimeout(function() {
1113 $('input[type=submit]').focus().click();
1114 BoozeNarcRun();
1115 }, 2000);
1116 } else if (parseInt(MyCity, 10) === parseInt(lowCity, 10) && CanTravel === false && missingB === 0 && missingN === 0) { // We are in low city with BN and we cant travel to sell ! DONE
1117 console.log("We are in low city with BN and cant travel, we already bought!");
1118 SmuggleDone = true;
1119 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1120 loop();
1121 } else if (CanTravel === true) { // need to travel to high city
1122 console.log("We need to sell, traveling to " + cities[highCity]);
1123 travel(highCity, BoozeNarcRun);
1124 }
1125 }
1126 if ((missingB < booze && missingB != 0) || (missingN < narcs && missingN != 0)) { // Good heist or incomplete amounts. just sell all and rebuy !
1127 console.log("Good heist or incomplete amounts. just sell all and rebuy !");
1128 var sorts = ['wine', 'cognac', 'whiskey', 'amaretto', 'beer', 'port', 'rum', 'morphine', 'heroin', 'opium', 'cocaine', 'marihuana', 'tabacco', 'glue'];
1129 for (i = 0; i <= 13; i++) {
1130 var box = $('input[name="' + sorts[i] + '"]');
1131 if (i < 7) {
1132 box.val(b_amount[i]);
1133 } else {
1134 box.val(n_amount[i - 7]);
1135 }
1136 }
1137 $('input[name="typebooze"]:eq(0)').prop('checked', true); // sell
1138 $('input[name="typedrugs"]:eq(0)').prop('checked', true); // sell
1139 var bnTO1 = setTimeout(function() {
1140 $('input[type=submit]').focus().click();
1141 BoozeNarcRun();
1142 }, 2000);
1143 }
1144 if (CanTravel === false && (MyCity != highCity && MyCity != lowCity)) { // We cant travel and our city is good for nothing
1145 console.log("We cant travel and our city is good for nothing");
1146 SmuggleDone = true;
1147 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1148 loop();
1149 }
1150 }, 2000);
1151 }
1152 }
1153 } else {
1154 clks();
1155 BoozeNarcRun();
1156 }
1157 }, 2000);
1158 }
1159}
1160
1161function bnBOOST() { //TO MAKE NEW !
1162 if (deCaptcha() === false) {
1163 unsafeWindow.omerta.GUI.container.loadPage('/smuggling.php');
1164 console.log('Doing booze or narc non stop!!!');
1165 doBN1 = setTimeout(function() {
1166 $("#brc1").prop("checked", true);
1167 }, 2000);
1168 doBN2 = setTimeout(function() {
1169 if (inJail() === false) {
1170 $('input[type=submit]').focus().click();
1171 }
1172 }, 4000);
1173 doBN3 = setTimeout(function() {
1174 loop();
1175 }, 6000);
1176 }
1177}
1178
1179function doRace() {
1180 unsafeWindow.omerta.GUI.container.loadPage('/races.php');
1181 if (deCaptcha() === false) {
1182 console.log('Race page');
1183 raceTO1 = setTimeout(function() {
1184 if ($('#game_container:contains("You reached your click limit.")').length) { // CLICKS WAIT 10 SECS AND RELOAD DIV
1185 console.log("Clicks - 10secs tentar de novo");
1186 loopTO1 = setTimeout(function() {
1187 unsafeWindow.omerta.GUI.container.loadPage('/races.php');
1188 loop();
1189 }, 10000);
1190 } else if ($('#game_container:contains("You can start a race with your car against someone else here!")').length && race_chat === true) { // Not invited for race! - Ask for race in chat mode
1191 if (parseInt(localStorage.getItem("raceChatMsg")) + (30 * 1) < Math.round(new Date().getTime() / 1000)) {
1192 if ($('#omerta_sidepanel_toggle').attr('class') == 'open') {
1193 omerta_sidepanel_toggle.click();
1194 console.log('chat open');
1195 }
1196 console.log('asking for race in chat');
1197 $.post(getUrl() + "?module=Chat&action=send", {
1198 room: "omerta.general",
1199 message: race_msg
1200 });
1201 localStorage.setItem("raceChatMsg", Math.round(new Date().getTime() / 1000)); // Set time of last Message
1202 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1203 } else {
1204 console.log("Race message sent less than 30secs ago");
1205 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1206 }
1207 raceTO2 = setTimeout(function() {
1208 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1209 loop();
1210 }, 2500);
1211 } else if ($('#game_container:contains("You can start a race with your car against someone else here!")').length && race_friend !== "") { // Not invited for race! - Invite friend mode
1212 console.log('Will invite for race');
1213 $('input[name="option"][value="3"]').prop('checked', true);
1214 $("select[name=num_racers] option[value=2]").prop('selected', true);
1215 $('select:eq(1)>option:eq(1)').prop('selected', true);
1216 raceTO3 = setTimeout(function() {
1217 $('input[type="submit"]').focus().click();
1218 raceTO4 = setTimeout(function() {
1219 console.log('Inviting: ' + race_friend + ' for race');
1220 $('input[type=text]').val(race_friend);
1221 raceTO5 = setTimeout(function() {
1222 $('input[type=submit]:eq(0)').focus().click();
1223 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1224 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1225 loop();
1226 }, 1000);
1227 }, 2000);
1228 }, 2000);
1229 } else if ($('#game_container:contains("Your race invitations")').length) { // Invited for race just accept!
1230 console.log('Have invites for race!');
1231 $("a:contains('Accept')")[0].click();
1232 console.log('Accepted first race');
1233 raceTO6 = setTimeout(function() {
1234 if ($('#game_container:contains("Car: ")').length) { // Select car for race
1235 $('select>option:eq(1)').prop('selected', true); // random car
1236 console.log('Selected random car');
1237 $('input[type="submit"]').focus().click();
1238 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1239 raceTO13 = setTimeout(function() {
1240 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1241 loop();
1242 }, 2500);
1243 }
1244 }, 2000);
1245 } else if ($('#game_container:contains("Car: ")').length) { // Select car for race
1246 $('select>option:eq(1)').prop('selected', true); // random car
1247 console.log('Selected random car');
1248 $('input[type="submit"]').focus().click();
1249 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1250 raceTO13 = setTimeout(function() {
1251 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1252 loop();
1253 }, 2500);
1254 } else if ($('#game_container:contains("Invited")').length) {
1255 console.log('Friend invited - lets wait 10seconds');
1256 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1257 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1258 raceTO7 = setTimeout(function() {
1259 loop();
1260 }, 2500);
1261 } else if ($('#game_container:contains("Accepted")').length) {
1262 console.log('Accepted lets go');
1263 $('input[type="submit"]').focus().click();
1264 raceTO8 = setTimeout(function() {
1265 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1266 loop();
1267 }, 2000);
1268 } else if ($('#game_container:contains("All racers are ready for the race")').length) {
1269 console.log('Race done - Lets get info');
1270 $('input[type=submit]:eq(0)').focus().click();
1271 raceTO9 = setTimeout(function() {
1272 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1273 loop();
1274 }, 2000);
1275 } else if ($('#game_container:contains("still tired from your last race")').length) {
1276 console.log('Race done - Lets get info');
1277 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1278 raceTO10 = setTimeout(function() {
1279 loop();
1280 }, 2000);
1281 } else if ($('#game_container:contains("ready for the race")').length) {
1282 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 30));
1283 console.log('Ready for race - Dont need to check much - 30 sec');
1284 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1285 raceTO11 = setTimeout(function() {
1286 loop();
1287 }, 2500);
1288 } else {
1289 localStorage.setItem("raceWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1290 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1291 raceTO12 = setTimeout(function() {
1292 console.log('Race Page : Nothing / 10 Seconds time out');
1293 loop();
1294 }, 2000);
1295 }
1296 }, 2500);
1297 }
1298}
1299
1300function doHeist() {
1301 unsafeWindow.omerta.GUI.container.loadPage('/?module=Heist&action=');
1302 if (deCaptcha() === false) {
1303 console.log('Heist page');
1304 heistTO1 = setTimeout(function() {
1305 if ($('#game_container:contains("You reached your click limit.")').length) { // CLICKS WAIT 10 SECS AND RELOAD DIV
1306 console.log("Clicks - 10secs tentar de novo");
1307 loopTO1 = setTimeout(function() {
1308 unsafeWindow.omerta.GUI.container.loadPage('/?module=Heist&action=');
1309 loop();
1310 }, 10000);
1311 } else if ($('#game_container:contains("Desperate for some cash")').length && heists_friend !== "") { // Do Heist with Friend!
1312 heistTO2 = setTimeout(function() {
1313 console.log("Inviting " + heists_friend + " to Heist!");
1314 $('input[name=driver]').val(heists_friend);
1315 heistInviteTO = setTimeout(function() {
1316 $('input[type=submit]:eq(0)').focus().click();
1317 heistInviteTO2 = setTimeout(function() {
1318 if ($('#game_container:contains("Your buddy is still tired from his last heist")').length) // partner HOT try again in 30secs
1319 {
1320 console.log("Partner is hot for heist !");
1321 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 60));
1322 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1323 heistTO6 = setTimeout(function() {
1324 loop();
1325 }, 2000);
1326 } else {
1327 loop();
1328 }
1329 }, 2000);
1330 }, 1500);
1331 }, 3000);
1332 } else if ($('#game_container:contains("Invite is sent to your buddy, if he accepts you guys are ready to roll!")').length || $('#game_container:contains("Wanna kick him out for his lazy behaviour?")').length) {
1333 console.log('Heist not accepted yet - wait 10seconds');
1334 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1335 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1336 heistTO3 = setTimeout(function() {
1337 loop();
1338 }, 2000);
1339 } else if ($('#game_container:contains("Your buddy is still tired from his last heist")').length) // partner HOT try again in 30secs
1340 {
1341 console.log("Partner is hot for heist !");
1342 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 60));
1343 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1344 heistTO6 = setTimeout(function() {
1345 loop();
1346 }, 2000);
1347 } else if ($('#game_container:contains("Desperate for some cash")').length && heists_chat === true) { // Do Heist on Chat!
1348 if (parseInt(localStorage.getItem("heistChatMsg")) + (60 * 1) < Math.round(new Date().getTime() / 1000)) {
1349 if ($('#omerta_sidepanel_toggle').attr('class') == 'open') {
1350 omerta_sidepanel_toggle.click();
1351 }
1352 console.log('asking for heist in chat');
1353 $.post(getUrl() + "?module=Chat&action=send", {
1354 room: "omerta.general",
1355 message: heist_msg
1356 });
1357 localStorage.setItem("heistChatMsg", Math.round(new Date().getTime() / 1000)); // Set time of last Message
1358 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1359 } else {
1360 console.log("Heist Message sent less than 1minute ago!");
1361 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1362 }
1363 heistTO4 = setTimeout(function() {
1364 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1365 loop();
1366 }, 2500);
1367 } else if ($('#game_container:contains("wait for your leader to give the green signal")').length) {
1368 console.log('Accepted heist - Waiting for leader - Checking if done in 1min');
1369 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 60));
1370 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1371 heistTO5 = setTimeout(function() {
1372 loop();
1373 }, 3000);
1374 } else if ($('#game_container:contains("Take some rest and hit the road again")').length) {
1375 console.log('Heist done - Lets get info');
1376 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1377 heistTO6 = setTimeout(function() {
1378 loop();
1379 }, 2000);
1380 } else if ($('#game_container:contains("Fill in the ID of your car below and hit Ready!")').length) { // NEED TO PUT CAR
1381 console.log('Accepted heist - Gotta put car');
1382 heistTO7 = setTimeout(function() {
1383 $('input[type=submit]').focus().click();
1384 heistTO8 = setTimeout(function() {
1385 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1386 loop();
1387 }, 4000);
1388 }, 2000);
1389 } else if ($('#game_container:contains("Your partner in crime")').length) { // Partner accepted heist. GOGO !
1390 console.log('Partner accepted heist! ');
1391 heistT13 = setTimeout(function() {
1392 console.log('Heist GO!');
1393 $('input[type=submit]').focus().click();
1394 heistTO15 = setTimeout(function() {
1395 console.log('Sending heist money!');
1396 $('input[type=submit]').focus().click();
1397 }, 2000);
1398 heistTO14 = setTimeout(function() {
1399 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1400 loop();
1401 }, 5000);
1402 }, 2000);
1403 } else if (heists_friend === "" && heists_chat === false) { //Only waiting for invites
1404 heistTO9 = setTimeout(function() {
1405 if ($('#game_container:contains("You have been invited to a heist")').length) { // Got invite
1406 console.log('Got invite');
1407 $("a:contains('Accept')")[0].click();
1408 heistTO10 = setTimeout(function() {
1409 $('input[type=submit]').focus().click();
1410 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1411 heistTO16 = setTimeout(function() {
1412 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1413 loop();
1414 }, 2000);
1415 }, 1500);
1416 } else if ($('#game_container:contains("Desperate for some cash")').length) { // dont have invite - waiting 30seconds
1417 console.log('Dont have invite - Checking again in 15 seconds');
1418 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1419 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1420 heistTO11 = setTimeout(function() {
1421 loop();
1422 }, 3000);
1423 } else {
1424 console.log('Waiting for Heist invite but did shit!');
1425 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1426 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1427 heistTO13 = setTimeout(function() {
1428 loop();
1429 }, 3000);
1430 }
1431 }, 3000);
1432 } else {
1433 localStorage.setItem("heistWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1434 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1435 heistTO12 = setTimeout(function() {
1436 console.log('Heist Page : Nothing / 15 Seconds time out');
1437 loop();
1438 }, 2000);
1439 }
1440 }, 2500);
1441 }
1442}
1443
1444function doRaid() {
1445 unsafeWindow.omerta.GUI.container.loadPage('/?module=Spots&action=');
1446 if (deCaptcha() === false) {
1447 var raidID;
1448 console.log('Raid page');
1449 raidTO1 = setTimeout(function() {
1450 if ($('#game_container:contains("You reached your click limit.")').length) { // CLICKS WAIT 10 SECS AND RELOAD DIV
1451 console.log("Clicks - 10secs tentar de novo");
1452 loopTO1 = setTimeout(function() {
1453 unsafeWindow.omerta.GUI.container.loadPage('/?module=Spots&action=');
1454 loop();
1455 }, 10000);
1456 } else if ($('#game_container:contains("Start raiding")').length && raids_friend !== "") { // Do Raid with Friend!
1457 raidTO2 = setTimeout(function() {
1458 $('table.thinline:eq(1) button').each(function() {
1459 if ($(this).text() === "Go" && !$(this).is(":disabled")) {
1460 raidID = $(this).attr('data-raidid');
1461 console.log(raidID);
1462 return false;
1463 }
1464 });
1465 console.log("Inviting " + raids_friend + " to Raid on Spot " + raidID + " !");
1466 $.post(getUrl() + "?module=Spots&action=start_raid", {
1467 spotId: raidID,
1468 bullets: "0",
1469 driver: raids_friend
1470 });
1471 doRaid();
1472 }, 3000);
1473 } else if ($('#game_container:contains("Start raiding")').length && raids_chat === true) { // Do Raid on Chat!
1474 if (parseInt(localStorage.getItem("raidChatMsg")) + (60 * 1) < Math.round(new Date().getTime() / 1000)) {
1475 if ($('#omerta_sidepanel_toggle').attr('class') == 'open') {
1476 omerta_sidepanel_toggle.click();
1477 console.log('chat open');
1478 }
1479 console.log('asking for raid in chat');
1480 $.post(getUrl() + "?module=Chat&action=send", {
1481 room: "omerta.general",
1482 message: raids_msg
1483 });
1484 localStorage.setItem("raidChatMsg", Math.round(new Date().getTime() / 1000)); // Set time of last Message
1485 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1486 } else {
1487 console.log("Raid Message sent less than 1minute ago!");
1488 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1489 }
1490 heistTO4 = setTimeout(function() {
1491 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1492 loop();
1493 }, 2500);
1494 } else if ($('#game_container:contains("Start raiding")').length && raids_friend === "" && raids_chat === false) { // Waiting for friend to invite !
1495 console.log("Partner didnt invite yet - wait 15 seconds!");
1496 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1497 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1498 raidTO03 = setTimeout(function() {
1499 loop();
1500 }, 2000);
1501 } else if ($('#game_container:contains("Your driver hasnt accepted the invitation yet, be patient.")').length) // Waiting to put car before go !
1502 {
1503 console.log("Partner didnt put car for raid yet !");
1504 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1505 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1506 raidTO03 = setTimeout(function() {
1507 loop();
1508 }, 2000);
1509 } else if ($('#game_container:contains("Your Driver has accepted the invited")').length) // GOGOGO!
1510 {
1511 console.log("Go Raid !");
1512 raidTO04 = setTimeout(function() {
1513 $('a:contains("Start/Update Raid")').click();
1514 raidTO041 = setTimeout(function() {
1515 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1516 raidTO042 = setTimeout(function() {
1517 loop();
1518 }, 2000);
1519 }, 2000);
1520 }, 2000);
1521 } else if ($('#game_container:contains("Accept Invite")').length) //Need to accept invite
1522 {
1523 console.log("Have invite for raid lets accept !");
1524 raidTO04 = setTimeout(function() {
1525 $('a:contains("Accept Invite")').click();
1526 raidTO042 = setTimeout(function() {
1527 loop();
1528 }, 2000);
1529 }, 2000);
1530 } else if ($('#game_container:contains("The raid failed")').length) // Failed - Its done
1531 {
1532 console.log("Raid done!");
1533 raidTO05 = setTimeout(function() {
1534 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1535 raidTO051 = setTimeout(function() {
1536 loop();
1537 }, 2000);
1538 }, 2000);
1539 } else if ($('#game_container:contains("You have now joined this raid, make sure you stay in this city while your leader gets ready to start.")').length) //Accepted waiting start
1540 {
1541 console.log("Accepted Waiting start");
1542 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1543 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1544 raidTO042 = setTimeout(function() {
1545 loop();
1546 }, 2000);
1547 } else if ($('#game_container:contains("You have accepted this raid invite, and are waiting on the raid leader to start.")').length) //Accepted waiting start
1548 {
1549 console.log("Accepted Waiting start");
1550 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1551 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1552 raidTO042 = setTimeout(function() {
1553 loop();
1554 }, 2000);
1555 } else if ($('#game_container:contains("LEM")').length) //ERRO NA RAID
1556 {
1557 console.log("LEM ERROR");
1558 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1559 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1560 raidTO042 = setTimeout(function() {
1561 loop();
1562 }, 2000);
1563 } else {
1564 localStorage.setItem("raidWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1565 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1566 raidTO6 = setTimeout(function() {
1567 console.log('Raid Page : Nothing / 15 Seconds time out');
1568 loop();
1569 }, 2000);
1570 }
1571 }, 2500);
1572 }
1573}
1574
1575function doOC() {
1576 unsafeWindow.omerta.GUI.container.loadPage('/orgcrime2.php');
1577 if (deCaptcha() === false) {
1578 console.log('OC page');
1579 ocTO1 = setTimeout(function() {
1580 if ($('#game_container:contains("You reached your click limit.")').length) { // CLICKS WAIT 10 SECS AND RELOAD DIV
1581 console.log("Clicks - 10secs tentar de novo");
1582 ocTO1 = setTimeout(function() {
1583 unsafeWindow.omerta.GUI.container.loadPage('/orgcrime2.php');
1584 loop();
1585 }, 10000);
1586 } else if ($('#game_container:contains("Start an Organised Crime")').length && ocs_chat === true) {
1587 if (parseInt(localStorage.getItem("ocChatMsg")) + (rnd(120, 240) * 1) < Math.round(new Date().getTime() / 1000)) {
1588 if ($('#omerta_sidepanel_toggle').attr('class') == 'open') {
1589 omerta_sidepanel_toggle.click();
1590 }
1591 console.log('asking for oc in chat');
1592 $.post(getUrl() + "?module=Chat&action=send", {
1593 room: "omerta.general",
1594 message: ocs_msg
1595 });
1596 localStorage.setItem("ocChatMsg", Math.round(new Date().getTime() / 1000)); // Set time of last Message
1597 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1598 } else {
1599 console.log("OC Message sent less than 2 minutes ago!");
1600 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1601 }
1602 ocTO4 = setTimeout(function() {
1603 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1604 loop();
1605 }, 2500);
1606 } else if ($('#game_container:contains("Start an Organised Crime")').length) {
1607 console.log("Still waiting for oc invite!");
1608 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 12));
1609 ocTO4 = setTimeout(function() {
1610 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1611 loop();
1612 }, 2500);
1613 } else if ($('#game_container:contains("Do you really want to be a part of the Organised Crime")').length) {
1614 console.log("Got invited for oc!");
1615 unsafeWindow.omerta.GUI.container.loadPage('/orgcrime2.php?takepart=yes');
1616 ocTO5 = setTimeout(function() {
1617 // WE
1618 $('input[name="bulletz"]').val('100');
1619 $('select[name="guns"]').val('2');
1620 // EE
1621 $('input:radio[name="exploz"]').prop('checked', true);
1622 // GO
1623 $('input[type=submit]').focus().click();
1624 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1625 ocTO6 = setTimeout(function() {
1626 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1627 loop();
1628 }, 2000);
1629 }, 2000);
1630 } else if ($('#game_container:contains("Put in")').length) {
1631 console.log("Already in for oc gotta accept!");
1632 ocTO5 = setTimeout(function() {
1633 // WE
1634 $('input[name="bulletz"]').val('100');
1635 $('select[name="guns"]').val('2');
1636 // EE
1637 $('input:radio[name="exploz"]').prop('checked', true);
1638 // GO
1639 $('input[type=submit]').focus().click();
1640 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 10));
1641 ocTO6 = setTimeout(function() {
1642 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1643 loop();
1644 }, 2000);
1645 }, 2000);
1646 } else if ($('#game_container:contains("You are now ready for the job")').length) {
1647 console.log("Already in for oc, checking for completion!");
1648 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1649 ocTO6 = setTimeout(function() {
1650 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1651 loop();
1652 }, 1000);
1653 } else if ($('#game_container:contains("You are still hot from your last Organised Crime")').length) {
1654 console.log("Oc DONE!");
1655 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1656 ocTO6 = setTimeout(function() {
1657 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1658 loop();
1659 }, 1000);
1660 } else if ($('#game_container:contains("loose your stuff!")').length) {
1661 console.log("Already in for oc, checking for completion 2!");
1662 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 25));
1663 ocTO6 = setTimeout(function() {
1664 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1665 loop();
1666 }, 1000);
1667 } else {
1668 localStorage.setItem("ocWaitTime", (Math.round(new Date().getTime() / 1000) + 15));
1669 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1670 ocTO6 = setTimeout(function() {
1671 console.log('OC PAGE : Nothing / 15 Seconds time out');
1672 loop();
1673 }, 2000);
1674 }
1675 }, 2500);
1676 }
1677}
1678//------Milestone Checker-----------//
1679function mileChecker() {
1680 if (deCaptcha() === false) {
1681 console.log("Milestones to redeem!");
1682 unsafeWindow.omerta.GUI.container.loadPage('/?module=Milestone');
1683 mileTO1 = setTimeout(function() {
1684 if ($('.box-buttons:contains("COLLECT")').length) {
1685 var mileType = ("Redeeming Milestone of: " + $('.box-buttons:contains("COLLECT")').parents(".box-inner").find("h2").text() + " !");
1686 console.log(mileType);
1687 var mile = $('.box-buttons:contains("COLLECT"):eq(0)').children().attr('href');
1688 $.post((pageUrl = "https://" + (location.host)) + mile);
1689 if (milestone_send_sms === true) {
1690 GM_xmlhttpRequest({
1691 method: "GET",
1692 url: "http://api.budgetsms.net/sendsms/?username=" + sms_username + "&userid=" + sms_userid + "&handle=" + sms_api_key + "&msg=" + mileType + "&from=GODSCRIPT&to=" + sms_number,
1693 onload: function(response) {
1694 console.log(response.responseText);
1695 }
1696 });
1697 }
1698 mileTO2 = setTimeout(function() {
1699 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1700 loop();
1701 }, 2500);
1702 } else {
1703 console.log("No Milestone to redeem!");
1704 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1705 mileTO3 = setTimeout(function() {
1706 loop();
1707 }, 3500);
1708 }
1709 }, 5000);
1710 }
1711}
1712//----------------------------MENU------------------------------
1713function menu() {
1714 var STtop = 225;
1715 var STleft = 300;
1716 if ($('#GODMenu').length === 0) {
1717 $('#wrapper').append(
1718 $('<div>').addClass('gdlay').attr({
1719 id: 'GODMenu'
1720 }).css({
1721 top: STtop,
1722 left: STleft
1723 }).append(
1724 $('<div>').attr({
1725 id: 'GODhead'
1726 }).append(
1727 $('<center>').text('God Menu').css({
1728 fontWeight: 'bold'
1729 })
1730 ).click(function() {
1731 $('#GODMenu').draggable();
1732 }),
1733 $('<hr>').css({
1734 color: 'gray'
1735 }),
1736 $('<div>').attr({
1737 id: 'GODdiv'
1738 }).append(
1739 $('<div>').attr({
1740 id: 'GODbody'
1741 }).html('Enable:<font style="float:right;"><b>' + Enable + '</b></font><br />Car/Crimes:<font style="float:right;"><b>' + crimes_carros + '</b></font><br />Booze/Narcs:<font style="float:right;"><b>' + booze_narcs + '</b></font><br />Scratch:<font style="float:right;"><b>' + scratch + '</b></font><br />BustOuts:<font style="float:right;"><b>' + bos),
1742 $('<hr>').css({
1743 color: 'gray'
1744 }),
1745 $('<div>').attr({
1746 id: 'GODconfig'
1747 }).addClass('reset').text('Configuration').click(function() {
1748 GM_config.open();
1749 }),
1750 $('<div>').attr({
1751 id: 'GODconfigAPI'
1752 }).addClass('reset').text('API/Keys Configuration').click(function() {
1753 gmAPI.open();
1754 }),
1755 $('<hr>').css({
1756 color: 'gray'
1757 }),
1758 $('<div>').attr({
1759 id: 'GODhideshow'
1760 }).addClass('reset').text('Hide/Show Menu').click(function() {
1761 $("#GODdiv").toggle();
1762 $("#GODhideshow2").toggle();
1763 }),
1764 $('<hr>').css({
1765 color: 'gray'
1766 }),
1767 $('<div>').attr({
1768 id: 'GODstartstop'
1769 }).addClass('reset').text('Start/Stop').click(function() {
1770 startStop();
1771 })
1772 ),
1773 $('<div>').attr({
1774 id: 'GODhideshow2'
1775 }).addClass('reset').text('Hide/Show Menu').css({
1776 display: "none"
1777 }).click(function() {
1778 $("#GODhideshow2").toggle();
1779 $("#GODdiv").toggle();
1780 })
1781 )
1782 );
1783 }
1784 $('#GODMenu').mouseup(function() {
1785 var divOffset = $('#GODMenu').offset();
1786 var left = divOffset.left;
1787 var top = divOffset.top;
1788 STleft = left;
1789 STtop = top;
1790 });
1791}
1792//--------------------------------------------------------------
1793//----------------------------MAIN LOOPER-----------------------
1794//--------------------------------------------------------------
1795
1796var css = "@charset 'UTF-8'; .gdlay {color: #FFFFFF;box-shadow: 2px 2px 2px 2px #1B1B1B;background-image: -moz-linear-gradient(center top, #3F505F, #1B1B1B);background-image: -webkit-linear-gradient(center top ,#3F505F, #1B1B1B);background-image: -o-linear-gradient(top, #3F505F, #1B1B1B);background: linear-gradient(to bottom, #3F505F, #1B1B1B);opacity: 0.90;border-radius: 5px;}.gdlay {position: fixed;width: 200px;border: 2px double gray;padding: 5px;} .reset { border: 2px solid #BEBEBE; } .reset:hover { border: 2px solid #960011; cursor: pointer; } .reset, .reset:hover { padding: 2px; border-radius: 7px; text-align: center; }";
1797$('head').append('<style type="text/css">' + css + '</style>');
1798var myip;
1799$(document).ready(function() {
1800 $.getJSON("https://jsonip.com/?callback=", function(data) {
1801 console.log(data.ip);
1802 myip = data.ip;
1803 });
1804 menuTO = setTimeout(function() {
1805 if (version != undefined) {
1806 console.log('Menu | Message Checker | Price Checker - launcher');
1807 menu();
1808 chkMessage();
1809 newPrices();
1810 }
1811 }, 2000);
1812});
1813$(document).ready(function() {
1814 window.loop = function() {
1815 if (version != undefined) {
1816 if (Enable === "true") {
1817 if (deCaptcha() === false) {
1818 if (gotClicks()) { // CLICKS WAIT 10 SECS AND RELOAD DIV
1819
1820 } else if ($('body:contains("milestones to redeem")').length && milestone_check === true) { //Have Milestones!
1821 loopMILE01 = setTimeout(function() {
1822 mileChecker();
1823 }, rnd(1500, 2500));
1824 } else if ((on_page('/jail.php') || on_page('jail.php')) && (bos === true || bo_on_cooldown === true)) { // For busting !
1825 console.log("Jail page detected");
1826 if ($('#game_container:contains("GO FOR IT")').length) {
1827 console.log('Pagina BO');
1828 if ($('tr[bgcolor]').length >= 1) {
1829 loopTO2 = setTimeout(function() {
1830 bobos();
1831 loop();
1832 }, rnd(300, 675));
1833 } else {
1834 console.log('Prisao vazia, timeout de ' + bo_cooldown_time + 's');
1835 loopTO3 = setTimeout(function() {
1836 unsafeWindow.omerta.GUI.container.loadPage('/jail.php');
1837 loop();
1838 }, (bo_cooldown_time * 1000));
1839 }
1840 } else {
1841 console.log('Jail mas não pode BO | preso ou pior!');
1842 loopTO4 = setTimeout(function() {
1843 bobos();
1844 loop();
1845 }, rnd(300, 675));
1846 }
1847 } else if (inJail() === true) { // IF we get here means no busting !
1848 console.log('Loop - In Jail');
1849 loopTO5 = setTimeout(function() {
1850 loop();
1851 }, 5000);
1852 } else if (on_page('/?module=Heist&action=') || on_page('?module=Heist&action=')) { // HEIST PAGE
1853 console.log('Heist page - 7sec CD');
1854 loopTO6 = setTimeout(function() {
1855 doHeist();
1856 }, rnd(5000, 10000));
1857 } else if (on_page('?module=Spots&action=')) { // RAID PAGE
1858 console.log('Raid page - 7sec CD');
1859 loopTO7 = setTimeout(function() {
1860 doRaid();
1861 }, rnd(5000, 10000));
1862 } else if (on_page('/?module=Crimes')) {
1863 console.log('Crime page - loop');
1864 if (crimes_carros === true) {
1865 loopTO8 = setTimeout(function() {
1866 if ($('#game_container:contains("WELL DONE!")').length) {
1867 var profit = $('#game_container').text().trim();
1868 if (profit.match(/\$ ([,\d]+)/) !== null) {
1869 var plimplim = parseInt(profit.match(/\$ ([,\d]+)/)[1].replace(',', ''), 10);
1870 console.log('Crime with sucess! We Stole: ' + plimplim + "$");
1871 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1872 loop();
1873 }
1874 } else if ($('#game_container:contains("ATTEMPT FAILED!")').length) {
1875 console.log('Crime Failed!');
1876 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1877 loop();
1878 } else if ($('#game_container:contains("Too tired")').length) {
1879 console.log('Crime already Done!');
1880 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1881 loop();
1882 } else if (on_page('/?module=Crimes')) {
1883 crimeAtpt();
1884 } else {
1885 loopTO9 = setTimeout(function() {
1886 loop();
1887 }, 2000);
1888 }
1889 }, 1000);
1890 }
1891 } else if (on_page('/?module=Cars')) {
1892 console.log('Car page - loop');
1893 if (crimes_carros === true) {
1894 loopTO8 = setTimeout(function() {
1895 if ($('#game_container:contains("WELL DONE!")').length) {
1896 var profit = $('#game_container').text().trim();
1897 if (profit.match(/\$ ([,\d]+)/) !== null) {
1898 var popoplim = parseInt(profit.match(/\$ ([,\d]+)/)[1].replace(',', ''), 10);
1899 }
1900 console.log('Car Nick with success ! Car Value: ' + popoplim + "$");
1901 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1902 loop();
1903 } else if ($('#game_container:contains("ATTEMPT FAILED!")').length) {
1904 console.log('Car Nick Failed!');
1905 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1906 loop();
1907 } else if ($('#game_container:contains("Too tired")').length) {
1908 console.log('Car Nick Already Done!');
1909 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1910 loop();
1911 } else if (on_page('/?module=Cars')) {
1912 carN();
1913 } else {
1914 loopTO9 = setTimeout(function() {
1915 loop();
1916 }, 2000);
1917 }
1918 }, 1000);
1919 }
1920 } else if (on_page('/races.php') || on_page('/races.php') || on_page('/#races.php') || on_page('#races.php')) {
1921 doRace();
1922 } else if (on_page('/scratch.php') || on_page('scratch.php')) {
1923 console.log("Scratch page detected");
1924 if (scratch === true || scratch_on_cooldown === true) {
1925 var pocketMoney = omerta.services.account.data.money;
1926 if (pocketMoney < min_sc) // We are out of money
1927 {
1928 console.log("Money on pocket is below specified Money to scratch!");
1929 GM_config.set('scratch', false);
1930 GM_config.set('scratch_on_cooldown', false);
1931 onSave();
1932 if (send_message_scratch === true) {
1933 GM_xmlhttpRequest({
1934 method: "GET",
1935 url: "http://api.budgetsms.net/sendsms/?username=" + sms_username + "&userid=" + sms_userid + "&handle=" + sms_api_key + "&msg=Out_of_scratch_money&from=GODSCRIPT&to=" + sms_number,
1936 onload: function(response) {
1937 console.log(response.responseText);
1938 }
1939 });
1940 }
1941 if (crimes_carros === true || booze_narcs != 'Disabled' || do_races === true || do_heists === true || do_raids === true) {
1942 console.log("Have other actions to do - Go back to info!");
1943 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
1944 scratchSMS = setTimeout(function() {
1945 loop();
1946 }, 2000);
1947 } else {
1948 console.log("Doing nothing else - Logout!");
1949 logout();
1950 }
1951 } else if ($('#game_container:contains("Sorry, but 10 per minute is enough.")').length) {
1952 console.log('10 por minuto - 10seg cooldown');
1953 scratch10 = setTimeout(function() {
1954 unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
1955 loop();
1956 }, 10000);
1957 } else {
1958 scratchGo = setTimeout(function() {
1959 pressSCRT();
1960 loop();
1961 }, rnd(1000, 1550));
1962 }
1963 }
1964 } else if (on_page('/smuggling.php') || on_page('smuggling.php')) {
1965 console.log("BN page! - loop");
1966 if (booze_narcs == 'RP') {
1967 loopTO10 = setTimeout(function() {
1968 bnRP();
1969 }, rnd(2000, 3000));
1970 } else if (booze_narcs == 'Money') {
1971 loopTO10 = setTimeout(function() {
1972 BoozeNarcRun();
1973 }, rnd(1000, 2000));
1974 } else if (booze_narcs == 'BOOST') {
1975 loopTO10 = setTimeout(function() {
1976 bnBOOST();
1977 }, rnd(2000, 3000));
1978 }
1979 }else if (on_page('/orgcrime2.php') ){
1980 console.log('Doing oc!');
1981 var doingOC = setTimeout(function(){
1982 doOC();
1983 },2500);
1984 } else if (on_page(infoPage)) {
1985 console.log("Info Page");
1986 var rankGD = omerta.services.account.data.rankname;
1987 var rankNum = 0;
1988 for (var i = 0; i <= 17; i++) {
1989 if (ranks[i] == rankGD) {
1990 rankNum = i;
1991 break;
1992 }
1993 }
1994 console.log("My rank is:" + rankGD + rankNum + " !");
1995 timerTimeOut = setTimeout(function() {
1996 //-------TIMERS-----------------------------------------------------
1997 if (crimes_carros === true || booze_narcs != 'Disable' || do_races === true || do_heists === true || do_raids === true) {
1998 var timeWait = 99999999; // DEFAULT
1999 if (crimes_carros === true) {
2000 if (version == 'dm') {
2001 var t1 = (parseInt($('.action-wrapper:eq(0) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2002 var t2 = (parseInt($('.action-wrapper:eq(1) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2003 } else {
2004 var t1 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(1) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2005 var t2 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(2) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2006 }
2007 if (isNaN(t1) || t1 < 0) {
2008 t1 = 0;
2009 }
2010 if (isNaN(t2) || t2 < 0) {
2011 t2 = 0;
2012 }
2013 localStorage.setItem('Crime Time',parseInt(t1/1000));
2014 localStorage.setItem('Car Time',parseInt(t2/1000));
2015 timeWait = Math.min(t1, t2);
2016 console.log('Next Crime in:' + t1 / 1000);
2017 console.log('Next Car Attempt in:' + t2 / 1000);
2018 }
2019 if (booze_narcs == "Money") {
2020 if (rankNum == 0) {
2021 console.log("I'm empty-suit i cant do BN!");
2022 t4 = 300000;
2023 } else if (version == 'dm') {
2024 var t4 = (parseInt($('.action-wrapper:eq(2) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2025 } else {
2026 var t4 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(6) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2027 }
2028 if (isNaN(t4) || t4 < 0) {
2029 t4 = 0;
2030 CanTravel = true;
2031 } else {
2032 CanTravel = false;
2033 }
2034 if (SmuggleDone === false) {
2035 t4 = 0;
2036 }
2037 localStorage.setItem('Booze Narc Time',parseInt(t4/1000));
2038 timeWait = Math.min(timeWait, t4);
2039 console.log('Next BN Money (Flight) in:' + t4 / 1000);
2040 } else if (booze_narcs == 'RP') {
2041 if (rankNum == 0) {
2042 console.log("I'm empty-suit i cant do BN!");
2043 t4 = 300000;
2044 } else if (version == 'dm') {
2045 var booze = (parseInt($('.action-wrapper:eq(3) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2046 var narcs = (parseInt($('.action-wrapper:eq(4) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2047 if (rankNum <= 2) {
2048 console.log('Im just Delivery Boy/Girl, cant do narcs !');
2049 var t4 = booze;
2050 } else {
2051 var t4 = Math.min(booze, narcs);
2052 }
2053 } else {
2054 var booze = (parseInt($('.thinline:eq(1)>tbody>tr:eq(12) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2055 var narcs = (parseInt($('.thinline:eq(1)>tbody>tr:eq(13) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2056 if (rankNum <= 2) {
2057 console.log('Im just Delivery Boy/Girl, cant do narcs !');
2058 var t4 = booze;
2059 } else {
2060 var t4 = Math.min(booze, narcs);
2061 }
2062 }
2063 if (isNaN(t4) || t4 < 0) {
2064 t4 = 0;
2065 }
2066 localStorage.setItem('Booze Narc Time',parseInt(t4/1000));
2067 timeWait = Math.min(timeWait, t4);
2068 console.log('Next BN in:' + t4 / 1000);
2069 } else if (booze_narcs == 'BOOST') {
2070 var t4 = 3000;
2071 localStorage.setItem('Booze Narc Time',parseInt(t4/1000));
2072 timeWait = Math.min(timeWait, t4);
2073 console.log('Doing BN Boost!');
2074 }
2075 if (do_races === true && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2076 if (Math.round(new Date().getTime() / 1000) > localStorage.getItem("raceWaitTime")) {
2077 if (version == 'dm') {
2078 var t5 = (parseInt($('.action-wrapper:eq(12) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2079 } else {
2080 var t5 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(9) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2081 }
2082 if (isNaN(t5) || t5 < 0) {
2083 t5 = 0;
2084 }
2085 localStorage.setItem('Race Time',parseInt(t5/1000));
2086 timeWait = Math.min(timeWait, t5);
2087 console.log('Next Race in:' + t5 / 1000);
2088 } else {
2089 var t5 = (parseInt(localStorage.getItem("raceWaitTime"), 10) - Math.round(new Date().getTime() / 1000)) * 1000;
2090 if (isNaN(t5)) {
2091 console.log("t5 is NaN");
2092 t5 = 0;
2093 }
2094 localStorage.setItem('Race Time',parseInt(t5/1000));
2095 timeWait = Math.min(timeWait, t5);
2096 console.log("Race checks on Cooldown for: " + t5 / 1000 + " !");
2097 }
2098 }
2099 if (do_heists === true && (rankNum > 3) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2100 if (Math.round(new Date().getTime() / 1000) > localStorage.getItem("heistWaitTime")) {
2101 if (version == 'dm') {
2102 var t6 = (parseInt($('.action-wrapper:eq(6) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2103 } else {
2104 var t6 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(3) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2105 }
2106 if (isNaN(t6) || t6 < 0) {
2107 t6 = 0;
2108 }
2109 localStorage.setItem('Heist Time',parseInt(t6/1000));
2110 timeWait = Math.min(timeWait, t6);
2111 console.log('Next Heist in:' + t6 / 1000);
2112 } else {
2113 var t6 = (parseInt(localStorage.getItem("heistWaitTime"), 10) - Math.round(new Date().getTime() / 1000)) * 1000;
2114 if (isNaN(t6)) {
2115 console.log("t6 is Nan!");
2116 t6 = 0;
2117 }
2118 localStorage.setItem('Heist Time',parseInt(t6/1000));
2119 timeWait = Math.min(timeWait, t6);
2120 console.log("Heist checks on Cooldown for: " + t6 / 1000 + " !");
2121 }
2122 }
2123 if (do_raids === true && (rankNum > 8) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2124 if (Math.round(new Date().getTime() / 1000) > localStorage.getItem("raidWaitTime")) {
2125 if (version == 'dm') {
2126 var t7 = (parseInt($('.action-wrapper:eq(8) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2127 } else {
2128 var t7 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(11) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2129 }
2130 if (isNaN(t7) || t7 < 0) {
2131 t7 = 0;
2132 }
2133 localStorage.setItem('Raid Time',parseInt(t7/1000));
2134 timeWait = Math.min(timeWait, t7);
2135 console.log('Next Raid in:' + t7 / 1000);
2136 } else {
2137 var t7 = (parseInt(localStorage.getItem("raidWaitTime"), 10) - Math.round(new Date().getTime() / 1000)) * 1000;
2138 if (isNaN(t7)) {
2139 console.log("t7 is Nan!");
2140 t7 = 0;
2141 }
2142 localStorage.setItem('Raid Time',parseInt(t7/1000));
2143 timeWait = Math.min(timeWait, t7);
2144 console.log("Raid checks on Cooldown for: " + t7 / 1000 + " !");
2145 }
2146 }
2147 if (do_ocs === true && (rankNum > 5) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2148 if (Math.round(new Date().getTime() / 1000) > localStorage.getItem("ocWaitTime")) {
2149 if (version == 'dm') {
2150 var t8 = (parseInt($('.action-wrapper:eq(7) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2151 } else {
2152 var t8 = (parseInt($('.thinline:eq(1)>tbody>tr:eq(4) [data-time-end]').attr('data-time-end'), 10) - parseInt(omerta.Clock.getTime(), 10) / 1000) * 1000;
2153 }
2154 if (isNaN(t8) || t8 < 0) {
2155 t8 = 0;
2156 }
2157 localStorage.setItem('OC Time',parseInt(t8/1000));
2158 timeWait = Math.min(timeWait, t8);
2159 console.log('Next OC in:' + t8 / 1000);
2160 } else {
2161 var t8 = (parseInt(localStorage.getItem("ocWaitTime"), 10) - Math.round(new Date().getTime() / 1000)) * 1000;
2162 if (isNaN(t8)) {
2163 console.log("t8 (oc) is Nan!");
2164 t8 = 0;
2165 }
2166 localStorage.setItem('OC Time',parseInt(t8/1000));
2167 timeWait = Math.min(timeWait, t8);
2168 console.log("OC checks on Cooldown for: " + t8 / 1000 + " !");
2169 }
2170 }
2171 timeWait = timeWait + rnd(850, 1500);
2172 if (isNaN(timeWait)) {
2173 console.log('TimeWait is NaN!');
2174 timeWait = rnd(5000, 10000);
2175 }
2176 localStorage.setItem('TimeWait', parseInt(timeWait/1000) );
2177 console.log('Next action in: ' + timeWait / 1000 + ' seconds');
2178 //------------------------------------------------------------------
2179 infoTimeOut = setTimeout(function() {
2180 if (version == 'dm') {
2181 if (doingCaptcha === false) {
2182 clearTO(scratch10);
2183 clearTO(scratchGo);
2184 if (!on_page(infoPage)) {
2185 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
2186 }
2187 if (isNaN(parseInt($('.action-wrapper:eq(3) [data-time-end]').attr('data-time-end'), 10)) || (isNaN(parseInt($('.action-wrapper:eq(4) [data-time-end]').attr('data-time-end'), 10)) && rankNum > 2)) {
2188 var goBN = 1;
2189 } else {
2190 var goBN = 0;
2191 }
2192 if (isNaN(parseInt($('.action-wrapper:eq(0) [data-time-end]').attr('data-time-end'), 10)) && crimes_carros === true) {
2193 crimeAtpt();
2194 } else if (isNaN(parseInt($('.action-wrapper:eq(1) [data-time-end]').attr('data-time-end'), 10)) && crimes_carros === true) {
2195 carN();
2196 } else if (isNaN(parseInt($('.action-wrapper:eq(2) [data-time-end]').attr('data-time-end'), 10)) && booze_narcs == 'Money' && rankNum > 0) {
2197 BoozeNarcRun();
2198 } else if (booze_narcs == 'RP' && (rankNum > 0) && goBN == 1) {
2199 bnRP();
2200 } else if (isNaN(parseInt($('.action-wrapper:eq(12) [data-time-end]').attr('data-time-end'), 10)) && do_races === true && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2201 doRace();
2202 } else if (isNaN(parseInt($('.action-wrapper:eq(6) [data-time-end]').attr('data-time-end'), 10)) && do_heists === true && (rankNum > 3) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2203 console.log("Gona do heist!");
2204 doHeist();
2205 } else if (isNaN(parseInt($('.action-wrapper:eq(8) [data-time-end]').attr('data-time-end'), 10)) && do_raids === true && (rankNum > 8) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2206 doRaid();
2207 } else if (isNaN(parseInt($('.action-wrapper:eq(7) [data-time-end]').attr('data-time-end'), 10)) && do_ocs === true && (rankNum > 5) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2208 doOC();
2209 } else if (booze_narcs == 'BOOST') {
2210 unsafeWindow.omerta.GUI.container.loadPage('/smuggling.php');
2211 bnBOOST();
2212 } else {
2213 loop();
2214 }
2215 } else {
2216 console.log("Temos rank a fazer mas há captcha acabar! Tentar de novo em 5s");
2217 setTimeout(loop, 5000);
2218 }
2219 } else {
2220 if (doingCaptcha === false) {
2221 clearTO(scratch10);
2222 clearTO(scratchGo);
2223 unsafeWindow.omerta.GUI.container.loadPage(infoPage);
2224 if ($('.thinline:eq(1)>tbody>tr:eq(12)>td:eq(1)').text() == "Now" || ($('.thinline:eq(1)>tbody>tr:eq(13)>td:eq(1)').text() == "Now" && rankNum > 2)) {
2225 var goBN = 1;
2226 } else {
2227 var goBN = 0;
2228 }
2229 if ($('.thinline:eq(1)>tbody>tr:eq(1)>td:eq(1)').text() == "Now" && crimes_carros === true) {
2230 crimeAtpt();
2231 } else if ($('.thinline:eq(1)>tbody>tr:eq(2)>td:eq(1)').text() == "Now" && crimes_carros === true) {
2232 carN();
2233 } else if (($('.thinline:eq(1)>tbody>tr:eq(6)>td:eq(1)').text() == "Now" || SmuggleDone === false) && booze_narcs == 'Money' && rankNum > 0) {
2234 BoozeNarcRun();
2235 } else if (booze_narcs == 'RP' && (rankNum > 0) && goBN == 1) {
2236 bnRP();
2237 } else if ($('.thinline:eq(1)>tbody>tr:eq(9)>td:eq(1)').text() == "Now" && do_races === true && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2238 doRace();
2239 } else if ($('.thinline:eq(1)>tbody>tr:eq(3)>td:eq(1)').text() == "Now" && do_heists === true && (rankNum > 3) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2240 doHeist();
2241 } else if ($('.thinline:eq(1)>tbody>tr:eq(11)>td:eq(1)').text() == "Now" && do_raids === true && (rankNum > 8) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2242 doRaid();
2243 } else if ($('.thinline:eq(1)>tbody>tr:eq(4)>td:eq(1)').text() == "Now" && do_ocs === true && (rankNum > 5) && (omerta.services.account.data.city.name == GC_city || GC_city == 'Any')) {
2244 doOC();
2245 } else if (booze_narcs == 'BOOST') {
2246 unsafeWindow.omerta.GUI.container.loadPage('/smuggling.php');
2247 bnBOOST();
2248 } else {
2249 loop();
2250 }
2251 } else {
2252 console.log("Temos rank a fazer mas há captcha acabar! Tentar de novo em 5s");
2253 setTimeout(loop, 5000);
2254 }
2255 }
2256 }, timeWait);
2257 if (scratch_on_cooldown === true && timeWait > 30000) {
2258 console.log('No action for 30seconds - Go Scratch !');
2259 unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
2260 loopTO7 = setTimeout(function() {
2261 loop();
2262 }, 2500);
2263 } else if (bo_on_cooldown === true && timeWait > 30000) {
2264 console.log('No action for 30seconds - Go Bust !');
2265 unsafeWindow.omerta.GUI.container.loadPage('/jail.php');
2266 loopTO7 = setTimeout(function() {
2267 loop();
2268 }, 2500);
2269 }
2270 } else if (scratch === true) { //Only scratching!
2271 console.log("Only Scratch");
2272 unsafeWindow.omerta.GUI.container.loadPage('/scratch.php');
2273 loopTO7 = setTimeout(function() {
2274 loop();
2275 }, 2500);
2276 } else if (bos === true) // Only Bo's
2277 {
2278 console.log('Only BustOut');
2279 unsafeWindow.omerta.GUI.container.loadPage('/jail.php');
2280 loopTO7 = setTimeout(function() {
2281 loop();
2282 }, 2500);
2283 } else {
2284 console.log('Nothing to check for!');
2285 stop();
2286 }
2287 }, 1500);
2288 } else {
2289 console.log("Espera de pagina para funcionar");
2290 loopTO11 = setTimeout(function() {
2291 loop();
2292 }, 5000);
2293 }
2294 }
2295 }
2296 }
2297 };
2298 loop();
2299});