NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name vault lols // @namespace torn.com // @version 0.10 // @author Ahab [1735214] // @include *torn.com/* // @updateURL https://openuserjs.org/meta/Ahab/vault_lols.meta.js // @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012 // @license MIT // ==/UserScript== // Updated version now with a UI and some more options is for sale, shoot a pm. // DELETE vaultlols entry via F12>application>localstorage or localStorage.removeItem("vaultlols") in console if updating from version with no fac/company var sub = 0 var audioPlayer = document.createElement('audio'); audioPlayer.src = '/casino/craps/audio/win.ogg'; audioPlayer.preload = 'auto'; var observerTarget = $('span[id^="user-money"]')[0]; var observerConfig = { attributes: true, childList: true, characterData: false, subtree: true }; var observer = new MutationObserver(function(mutations) { money() }) observer.observe(observerTarget, observerConfig); if(localStorage.moneyOn === undefined || localStorage.moneyOn === "null" || localStorage.moneyOn === ""){ localStorage.moneyOn = 0 } if(localStorage.vaultlols === undefined || localStorage.vaultlols === "null" || localStorage.vaultlols === ""){ var options = {'personal':0,'faction':0,'vault':0} if(Number.isInteger(parseInt(alert = prompt("$ Amount to alert on for personal")))){ options['personal'] = parseInt(alert.replace(/,/g, '')) } else{ options['personal'] = 10000000 } if(Number.isInteger(parseInt(facalert = prompt("$ Amount to alert on for faction")))){ options['faction'] = parseInt(facalert.replace(/,/g, '')) } else{ options['faction'] = 1000000000 } if(Number.isInteger(parseInt(vaultalert = prompt("Deposit to 1 = Faction or 2 = Company, input 1 or 2")))){ options['vault'] = parseInt(vaultalert.replace(/,/g, '')) } else{ options['vault'] = 1 } localStorage.vaultlols = JSON.stringify(options) } function vault(){ console.log('run') if(window.location.href.split("/")[3] == "properties.php#"){ $('li[class*="empty"]:not(.empty.last)').replaceWith('<li class="vaultlols"><span class="p-icon"><i class="property-option-view"></i></span><span class="desc">Set Vaultlols Alert</span></li>') } $('li[class^="vaultlols"]').on('mouseup', function(e) { e.stopImmediatePropagation() var options = JSON.parse(localStorage.vaultlols) var oldalert = parseInt(options['personal']) var oldfacalert = parseInt(options['faction']) if(Number.isInteger(parseInt(alert = prompt("$ Amount to alert on for personal")))){ options['personal'] = parseInt(alert.replace(/,/g, '')) } else{ options['personal'] = oldalert } if(Number.isInteger(parseInt(facalert = prompt("$ Amount to alert on for faction")))){ options['faction'] = parseInt(facalert.replace(/,/g, '')) } else{ options['faction'] = oldfacalert } if(Number.isInteger(parseInt(vaultalert = prompt("Deposit to 1 = Faction or 2 = Company, input 1 or 2")))){ options['vault'] = parseInt(vaultalert.replace(/,/g, '')) } else{ options['vault'] = 1 } localStorage.vaultlols = JSON.stringify(options) }); if($('span[id*="user-money"]').attr('data-money') > 0){ if(window.location.href.split('=')[2] == 'vault'){ $('form[class*="deposit-box"] div[class^="input-money-group"] input:not([name="deposit"])').val($('span[id*="user-money"]').attr('data-money')).focus() $('form[class*="deposit-box"] input[type^="hidden"]')[0].setAttribute('value',$('span[id*="user-money"]').attr('data-money')) $('span[class*="btn"] input[value*="DEPOSIT"]').removeClass("torn-btn disabled").addClass("torn-btn").removeAttr("disabled") $('div[class*="input-money-group"] input[name*="deposit"]').parent().addClass("success") } if(window.location.href.split('=')[2] == 'armoury'){ $('div[class*="cash left"] div[class^="input-money-group"] input:not([name="deposit"])').val($('span[id*="user-money"]').attr('data-money')).focus() $('span[class*="btn"]')[1].children[0].removeAttribute("disabled") $('span[class*="btn"]')[1].children[0].classList.remove("disabled") $('div[class*="cash left"] div[class^="input-money-group"] input:not([name="deposit"])').addClass("success") } if(window.location.href.split('=')[1] == 'funds'){ $('div[class^="input-money-group"] input[aria-labelledby="deposit-label"]').val($('span[id*="user-money"]').attr('data-money')).focus() $('input[name*="deposit"]').attr('value',$('span[id*="user-money"]').attr('data-money')) $('span[class*="btn"]')[3].children[0].removeAttribute("disabled") $('span[class*="btn"]')[3].children[0].classList.remove("disabled") $('div[class*="deposit"]')[0].classList.remove("disabled") $('div[class*="input-money-group"] input[name*="deposit"]').parent().addClass("success") } } } function money(){ var options = JSON.parse(localStorage.vaultlols) if($('span[id*="user-money"]').attr('data-money') >= parseInt(options['personal']) && $('span[id*="user-money"]').attr('data-money') < parseInt(options['faction']) && window.location.href.split('=')[2] != 'vault' && sub == 0){ if($('span[id*="user-money"]').attr('data-money') > localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') audioPlayer.play() audioPlayer.onended = function(){ if(confirm("Do you want to deposit? $"+$('span[id*="user-money"]').attr('data-money'))) document.location = 'https://www.torn.com/properties.php#/p=options&tab=vault'; }; } else if($('span[id*="user-money"]').attr('data-money') < localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') } } else if($('span[id*="user-money"]').attr('data-money') >= parseInt(options['faction']) && parseInt(options['vault']) == 1 && window.location.href.split('=')[2] != 'armoury' && sub == 0){ if($('span[id*="user-money"]').attr('data-money') > localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') audioPlayer.play() audioPlayer.onended = function(){ if(confirm("Do you want to deposit? $"+$('span[id*="user-money"]').attr('data-money'))) document.location = 'https://www.torn.com/factions.php?step=your#/tab=armoury'; }; } else if($('span[id*="user-money"]').attr('data-money') < localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') } } else if($('span[id*="user-money"]').attr('data-money') >= parseInt(options['faction']) && parseInt(options['vault']) == 2 && window.location.href.split('=')[2] != 'funds' && sub == 0){ if($('span[id*="user-money"]').attr('data-money') > localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') audioPlayer.play() audioPlayer.onended = function(){ if(confirm("Do you want to deposit? $"+$('span[id*="user-money"]').attr('data-money'))) document.location = 'https://www.torn.com/companies.php#/option=funds'; }; } else if($('span[id*="user-money"]').attr('data-money') < localStorage.moneyOn){ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') } } else{ localStorage.moneyOn = $('span[id*="user-money"]').attr('data-money') vault() } } document.addEventListener('visibilitychange', function (event) { if (document.hidden) { sub = 1 } else { sub = 0 } }); waitForKeyElements(".input-money-group", vault); waitForKeyElements("#user-money", money);