|
|
|
HV Script Thread, Discuss your creations. Includes guidelines and infos for script creation (2020-02-28 upd) |
|
Jul 1 2017, 01:28
|
Slobber
Group: Gold Star Club
Posts: 7,794
Joined: 4-February 11
|
@sickentide if i set most of the initial variables to false, would that increase the speed of the script? ie would it essentially "skip" all the involved parts of the scripts if i were to set most of the settings to false?
|
|
|
Jul 1 2017, 01:54
|
Scremaz
Group: Gold Star Club
Posts: 24,304
Joined: 18-January 07
|
QUOTE(lololo16 @ Jul 1 2017, 00:34) why did you get rid of stopOnBuffsExpiring? :c (IMG:[ invalid] style_emoticons/default/anime_cry.gif) because there was no legit way to implehement it, with the guidelines tenboro gave us. feel free to use it at your own risk. what's currently left should be a stop when 4 turns are left, earned by using a safe function - at least as far as i understood
|
|
|
|
|
|
Jul 1 2017, 02:15
|
sickentide
Group: Catgirl Camarilla
Posts: 1,355
Joined: 31-August 10
|
QUOTE(Slobber @ Jul 1 2017, 01:28) @sickentide if i set most of the initial variables to false, would that increase the speed of the script? ie would it essentially "skip" all the involved parts of the scripts if i were to set most of the settings to false?
if you have speed issues, most functions will abort if you turn off all settings they are used for, except for the background alert function which also handles the stop conditions QUOTE(sigo8 @ Jun 30 2017, 21:24) One of my favorite features from CracklingCast was Hover Area that let you choose a smaller area to trigger the hover action, but nether I or anyone else mention it, so it wasn't included in Monsterbation. Thankfully I can code, and the change is really small.
this seems useful, i'd like to add it to the next version if you don't mind QUOTE(Scremaz @ Jul 1 2017, 01:54) because there was no legit way to implehement it, with the guidelines tenboro gave us. feel free to use it at your own risk.
what's currently left should be a stop when 4 turns are left, earned by using a safe function - at least as far as i understood
a manual stop that is. i still think that ruling should be reconsidered This post has been edited by sickentide: Jul 1 2017, 05:05
|
|
|
|
|
|
Jul 1 2017, 02:54
|
Usagi =
Group: Gold Star Club
Posts: 2,923
Joined: 29-October 13
|
CODE // ==UserScript== // @name Credits and Character Link // @namespace Credits and Character Link // @version 2 // @match *://*.hentaiverse.org/* // @grant none // ==/UserScript==
//Set What to Open Here var character = "/?s=Character&ss=ch"; var bazaar = "/?s=Bazaar&ss=ss"; var battle = "/?s=Battle&ss=ar"; var forge = "/?s=Forge&ss=re";
//Choose credits bar position top or bottom var position = "bottom";
//All //Done
var navbar = document.querySelectorAll("#navbar > div > div:first-child"); if (navbar.length === 0) { return; }
var base = window.location.protocol + "//" + window.location.hostname;
var queryStrings = []; queryStrings.push(character, bazaar, battle, forge);
for (var i = 0; i < 4; i++) { navbar[i].style.cursor = "pointer"; navbar[i].onclick = (function(i) { return function() { window.location.href = queryStrings[i]; }; })(i); }
var networth = document.getElementById("networth"); if (networth) { if (position == "top") { top(networth.textContent); }
return; }
var gx = new XMLHttpRequest(); gx.open("GET", base + "/?s=Bazaar&ss=ib", true); gx.onreadystatechange = (function() { if (gx.readyState == 4) { if (gx.status == 200) { var doc = (new DOMParser()).parseFromString(gx.responseText, "text/html");
if (position == "bottom") { var div = document.createElement("div"); div.id = "networth"; div.style.width = "165px"; div.innerHTML = doc.getElementById("networth").innerHTML; document.getElementById("mainpane").appendChild(div); }
if (position == "top") { top(doc.getElementById("networth").textContent); } } else { console.log("Error sending AJAX request for credits!"); } } }); gx.send();
function top(readout) { var div = document.createElement("div"); div.style.width = "135px"; div.style.padding = "5px 2px 0 0"; div.innerHTML = "<div class='fc4 far fcb'><div>" + readout + "</div></div>"; document.getElementById("navbar").appendChild(div);
var bigbar = document.querySelectorAll("#navbar > div"); for (var i = 0; i < bigbar.length; i++) { bigbar[i].style.width = "135px"; } document.querySelector("#stamina_readout img").parentElement.style.position = "absolute"; }
Here is a more flexible version. At the top, you can configure what the 4 big buttons link to in HV and also the position of the credits readout. Edit: Changed (!navbar) to (navbar.length === 0) This post has been edited by LOL50015: Jul 1 2017, 03:20
|
|
|
|
|
|
Jul 1 2017, 03:04
|
lololo16
Group: Gold Star Club
Posts: 2,836
Joined: 5-March 12
|
QUOTE(Scremaz @ Jun 30 2017, 20:54) because there was no legit way to implehement it, with the guidelines tenboro gave us. feel free to use it at your own risk.
what's currently left should be a stop when 4 turns are left, earned by using a safe function - at least as far as i understood
Oh, I didn't know :c Thank you
|
|
|
|
|
|
Jul 1 2017, 03:45
|
SidZBear
Group: Gold Star Club
Posts: 560
Joined: 31-May 16
|
I beg y'alls forgiveness for me being a lazy SOB, but in my defense I've sent 18 hours over the last 2 days working in 115F heat and clocked over 22 miles carting TVs and trash around whilst doing it, so I really am not feeling up to searching.
If you want to call mew names for being lazy, thats fine too. You won't hurt my feelings.
But it looks like super got his inventory management script working again,; if someone could point me to that, and whatever monster lab scripts we have working? I would be very happy and content and such. ph, and the drop tracker thingy
Feck I need a beer >.<
|
|
|
|
|
|
Jul 1 2017, 03:49
|
Juggernaut Santa
Group: Gold Star Club
Posts: 11,129
Joined: 26-April 12
|
QUOTE(gianfrix94 @ Jan 22 2017, 01:36) Hi guys, i fixed up the Countdown Timer for REs, now it works on the news page, and while i was at it i changed some colors, here is it:
CountdownTimerRE.user.js.txt ( 8.63k )
Number of downloads: 761This worked perfectly even with 0.85. Though, 3 or 4 days ago, at least for me, it stopped tracking past REs. It still work perfectly, alert, refresh and such, but always shows "re_cnt=0" and pressing L obviously doesn't show any completed RE Small issue, but a little annoying since I don't really want to keep count to know when I get close to 24/to 24. Has something changed, or is it the new Chrome and Firefox's updates? (IMG:[ invalid] style_emoticons/default/ph34r.gif) QUOTE(LOL50015 @ Jul 1 2017, 02:54) snip
You're a hero and a savior but you should check the code. I don't really care since I keep them on the bottom, but setting Credits on "top" doesn't actually show them. The bar is compressed a bit but nothing shows up. This post has been edited by End Of All Hope: Jul 1 2017, 03:52
|
|
|
|
|
|
Jul 1 2017, 04:19
|
hc br
Group: Catgirl Camarilla
Posts: 3,681
Joined: 18-October 15
|
QUOTE(End Of All Hope @ Jul 1 2017, 09:49) This worked perfectly even with 0.85. Though, 3 or 4 days ago, at least for me, it stopped tracking past REs. It still work perfectly, alert, refresh and such, but always shows "re_cnt=0" and pressing L obviously doesn't show any completed RE Small issue, but a little annoying since I don't really want to keep count to know when I get close to 24/to 24. Has something changed, or is it the new Chrome and Firefox's updates? (IMG:[ invalid] style_emoticons/default/ph34r.gif) You're a hero and a savior but you should check the code. I don't really care since I keep them on the bottom, but setting Credits on "top" doesn't actually show them. The bar is compressed a bit but nothing shows up. CODE // ==UserScript== // @name Countdown Timer for the Random Encounter Event on E-Hentai // @description Adds a countdown timer for the Random Encounter event on E-Hentai.org and its subdomains. // @grant none // @include https://e-hentai.org/* // @include https://*.e-hentai.org/* // ==/UserScript==
var wnd = window; var doc = wnd.document; var loc = location; var href = loc.href;
if(!doc.querySelector('*[name="ipb_login_submit"]') && /(\.e-hentai\.org\/)|(^e-hentai.org\/)/.test(loc.hostname+'/') && !/\/palette\.html?\b/.test(href) && !doc.getElementById('countdown_timer')) { var set_cookie = function(k, v, t) { var expires = '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; if(t) { var d = new Date(); d.setTime(d.getTime() + (t * 24 * 60 * 60 * 1000)); expires = '; expires=' + d.toGMTString(); } doc.cookie = k + '=' + escape(v) + expires + '; domain=.' + /[^\.]+\.[^\.]+$/.exec(loc.hostname)[0] + '; path=/'; //doc.cookie = k + '=' + escape(v) + expires + '; path=/'; }; var get_cookie = function(k) { var n = k + '='; var ca = doc.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(n) == 0) { return unescape(c.substring(n.length, c.length)); } } return undefined; };
if(!get_cookie('event')) { console.log('The "event" cookie does not exist or is invalid.'); throw 'exit'; } if(!get_cookie('re_cnt')) { set_cookie('re_cnt', 0); } if(!get_cookie('re_lst')) { set_cookie('re_lst', '[]'); }
var timer_box = doc.createElement('DIV'); timer_box.id = 'countdown_timer'; timer_box.onclick = function() { if(/\bReady\b/i.test(this.textContent)) { wnd.open('https://e-hentai.org/news.php', href=='https://e-hentai.org/news.php'?'_self':'_blank'); } };
var toggle_re_lst = function() { //alert(get_cookie('re_lst')); var re_lst_box = doc.getElementById('re_lst_box'); if(re_lst_box) { re_lst_box.parentNode.removeChild(re_lst_box); return; } re_lst_box = doc.createElement('DIV'); re_lst_box.id = 're_lst_box'; re_lst_box.style.cssText = 'top:30px; right:0px; position:fixed; z-index:2147483647; background:rgba(0,255,0,1); color:#ff0000;'; setTimeout(function() { re_lst_box.style.cssText = 'top:30px; right:0px; position:fixed; z-index:2147483647; background:rgba(0,255,0,0.2); color:#ff0000;'; }, 3000); re_lst_box.innerHTML = '[ List of Today ]<BR>'; re_lst_box.onmouseover = function () { this.style.cssText = 'top:30px; right:0px; position:fixed; z-index:2147483647; background:rgba(0,255,0,1); color:#ff0000;'; }; re_lst_box.onmouseout = function () { this.style.cssText = 'top:30px; right:0px; position:fixed; z-index:2147483647; background:rgba(0,255,0,0.2); color:#ff0000;'; }; var decode_hv_b64 = function(i, e) { var a = doc.createElement('A'); a.href = 'https://hentaiverse.org/?s=Battle&ss=ba&encounter=' + e; a.target = '_blank'; a.textContent = (i+1) + '. '; a.style.cssText = 'color:#ff0000'; var d = atob(e); var m = /([^-]+?)-([^-]+?)-([^-]+)/.exec(d); if(m == null) { return a; } var uid = m[1]; var epoch = m[2]; var hash = m[3]; var da = new Date(); da.setTime(parseInt(epoch)*1000); da = da.toLocaleTimeString(); a.textContent += da; return a; }; var re_lst = JSON.parse(get_cookie('re_lst')); if(re_lst) { for(var i=0, len=re_lst.length; i<len; i++) { var a = decode_hv_b64(i, re_lst[i]); if(i != 0) { re_lst_box.appendChild(doc.createElement('BR')); } re_lst_box.appendChild(a); } doc.body.appendChild(re_lst_box); } }; addEventListener('keydown', function(evt) { if((evt.target.tagName!='INPUT') && (evt.target.tagName!='TEXTAREA') && (evt.keyCode == 76)) { toggle_re_lst(); } }, false); if(href == 'https://e-hentai.org/news.php') { toggle_re_lst(); }
var newshead = doc.getElementById('newshead') if(newshead && /\/e-hentai\./.test(href)) { timer_box.style.color = '#ff0000' newshead.appendChild(timer_box) } else { timer_box.style.cssText = 'line-height:30px; top:0px; right:0px;font-size:16px; position:fixed; z-index:2147483647; background:rgba(0,255,0,0.2); color:#ff0000;' doc.body.appendChild(timer_box) }
var update_timer = function() { if(href == 'https://e-hentai.org/news.php') { var da = new Date(); if((da.getUTCHours()==0) && (da.getUTCMinutes()==0) && (da.getUTCSeconds()<=10)) { if(!/^Your IP.*banned/i.test(doc.body.textContent)) { setTimeout(function() {loc.reload();}, 10000); } } } var now = Math.floor(new Date().getTime()/1000); var diff = parseInt(get_cookie('event')) + 1800 - now; if(isNaN(diff)) { setTimeout(function() {loc.reload();}, 60000); return; }; if(diff <= 0) { timer_box.textContent = 'Ready! re_cnt=' + get_cookie('re_cnt'); if(href == 'https://e-hentai.org/news.php') { if(/^Your IP.*banned/i.test(doc.body.textContent)) {} else if(/The site is currently in Read Only\/Failover Mode/i.test(doc.documentElement.innerHTML)) { setTimeout(function() {loc.reload();}, 60000); } else { loc.reload(); } return; } } else { var mm = Math.floor(diff / 60) + ''; mm = (mm.length >= 2 ? mm : '0' + mm); var ss = Math.floor(diff % 60) + ''; ss = (ss.length >= 2 ? ss : '0' + ss); timer_box.textContent = mm + ':' + ss + ', re_cnt=' + get_cookie('re_cnt'); if( (mm == '00') || ((mm == '01') && (ss == '00')) ) { try { if(doc.getElementById('eventpane').getElementsByTagName('div')[1].getElementsByTagName('a')[0].textContent != 'HentaiVerse') { if(!doc.getElementById('re_snd')) { var audio = new Audio('http://www.freesound.org/data/previews/234/234524_4019029-lq.mp3'); audio.id = 're_snd'; audio.volume = 1; audio.loop = true; audio.play(); doc.body.appendChild(audio); } if(/55|25|05|00/.test(ss)) { alert('Random Encounter'); } } else { if(doc.getElementById('re_snd')) { doc.getElementById('re_snd').parentNode.removeChild(doc.getElementById('re_snd')); } } } catch(e) {} } } setTimeout(update_timer, 1000); }; update_timer();
var eventpane = doc.getElementById('eventpane'); if(eventpane != null) { var re_evt = eventpane.querySelector('a[onclick*="https://hentaiverse.org/"]'); //var re_evt = eventpane.getElementsByTagName('div')[1].getElementsByTagName('a')[0]; if(re_evt) { var hv_lnk = ''; if((/^https:\/\//.test(re_evt.href)) && (!/#/.test(re_evt.href))) { hv_lnk = re_evt.href; } else { hv_lnk = /.*window\.open\(['"]?([^'"]+)['"]?/.exec(re_evt.onclick.toString().split('\n').join('')); if(hv_lnk) { hv_lnk = hv_lnk[1]; } } if(hv_lnk) { hv_b64 = hv_lnk.replace(/.+?&encounter=([^&]*).*/, '$1'); // the base64 encoded part var re_lst = JSON.parse(get_cookie('re_lst')); if((!re_lst) || (re_lst.length == 0)) { re_lst = []; } if(re_lst.indexOf(hv_b64) == -1) { re_lst.push(hv_b64); } re_lst = JSON.stringify(re_lst, null, ' '); set_cookie('re_lst', re_lst); if(doc.getElementById('re_lst_box')) { toggle_re_lst(); toggle_re_lst(); } } else { console.log('Error: There is a random encounter event but the HentaiVerse link cannot be found.'); throw 'exit'; } re_evt.addEventListener('click', function() { if(re_evt.text != 'HentaiVerse') { set_cookie('re_cnt', parseInt(get_cookie('re_cnt'))+1); re_evt.text = 'HentaiVerse'; if(doc.getElementById('re_lst_box')) { toggle_re_lst(); toggle_re_lst(); } } eventpane.style.display = 'block'; }, false); } else if(/\bdawn\b/i.test(eventpane.textContent)) { set_cookie('re_cnt', 0); set_cookie('re_lst', '[]'); if(doc.getElementById('re_lst_box')) { toggle_re_lst(); toggle_re_lst(); } } } }
Countdown_Timer_for_the_Random_Encounter_Event_on_E_Hentai.user.js.txt ( 9.04k )
Number of downloads: 86
|
|
|
|
|
|
Jul 1 2017, 04:35
|
Juggernaut Santa
Group: Gold Star Club
Posts: 11,129
Joined: 26-April 12
|
That does absolutely nothing :\
|
|
|
Jul 1 2017, 04:43
|
hc br
Group: Catgirl Camarilla
Posts: 3,681
Joined: 18-October 15
|
QUOTE(End Of All Hope @ Jul 1 2017, 10:35) That does absolutely nothing :\
You have to go through the "Dawn of a New Day" or clean cookie
|
|
|
Jul 1 2017, 05:00
|
Usagi =
Group: Gold Star Club
Posts: 2,923
Joined: 29-October 13
|
QUOTE(End Of All Hope @ Jul 1 2017, 09:49) You're a hero and a savior but you should check the code. I don't really care since I keep them on the bottom, but setting Credits on "top" doesn't actually show them. The bar is compressed a bit but nothing shows up.
Works fine for me. I'm using Chromium 55. I've also tested it on alt, https HV and http HV. Is the console showing any errors?
|
|
|
|
|
|
Jul 1 2017, 05:09
|
Maharid
Group: Catgirl Camarilla
Posts: 2,373
Joined: 27-April 10
|
QUOTE(SidZBear @ Jul 1 2017, 03:45) I beg y'alls forgiveness for me being a lazy SOB, but in my defense I've sent 18 hours over the last 2 days working in 115F heat and clocked over 22 miles carting TVs and trash around whilst doing it, so I really am not feeling up to searching.
If you want to call mew names for being lazy, thats fine too. You won't hurt my feelings.
But it looks like super got his inventory management script working again,; if someone could point me to that, and whatever monster lab scripts we have working? I would be very happy and content and such. ph, and the drop tracker thingy
Feck I need a beer >.<
Here: QUOTE(Superlatanium @ Jun 28 2017, 09:49) HV Item Manager, fixed up for 0.85
HV_Item_Manager_1.6.0.user.js.txt ( 41.64k )
Number of downloads: 494Not every function may work, but most of them do, including setting equip/item prices, MMing, and making customized equip lists. See holy_demon's post for features and usage details. Fixed for Iron as well as Chrome/Firefox. The credits pane has been added to many pages. I'll try to fix any critical problems if anyone sees any, but I'm not going to bother with anything minor, now that most of the functionality has been restored, since this isn't my script. Look at page 221 of the thread for a pair of tweaks that can be made on the interface (you can change those as you like). Monster Lab: CODE // ==UserScript== // @name HV Monster Lab Numbers // @namespace hvlabnumbers // @version 1.0 // @description Displays morale and hunger values in HV Monster Lab // @match *://*.hentaiverse.org/?s=Bazaar&ss=ml* // @grant none // ==/UserScript==
var barFontSize = 75, // set to match font
spent, style = document.createElement('style'), bars = document.querySelectorAll('img[src*="bar_"]'); style.innerHTML = '.spent { width: 0px; display: inline-block; position: relative; left: -36px; top: 2px; }' + '.spent > div { background: #EDEBDF; border: 1px solid black; padding: 0 2px;' + 'display: inline-block; font-size: ' + barFontSize + '%; font-weight: bold; }' + '.gain { max-width: 0px; padding: 0 2px; position: relative; font-weight: bold; }'; document.head.appendChild(style);
for ( var i = 0; i < bars.length; i++ ) { spent = 24000 - bars[i].clientWidth * 200; var div = bars[i].parentNode.insertBefore(document.createElement('div'), bars[i].nextSibling); div.appendChild(document.createElement('div')).innerHTML = spent; div.className = 'spent'; }
var mcr = document.getElementsByClassName('mcr'); if ( mcr[0] ) { var upgrade = mcr[0].querySelectorAll('img[onmouseover*="Upgrade With"]'); for ( var i = 0; i < upgrade.length; i++ ) { var gain = 1000 * Math.round( 3 + upgrade[i].parentNode.nextSibling.innerHTML.match(/\+(\d+)/)[1] * 0.5 ), td = upgrade[i].parentNode.parentNode.insertBefore(document.createElement('td'), upgrade[i].parentNode.nextSibling); td.innerHTML = gain; td.className = 'gain'; td.style.color = gain > spent ? 'grey' : 'black'; }} if ( mcr[1] ) { upgrade = mcr[1].querySelectorAll('img[onmouseover*="Upgrade With"]'); for ( var i = 0; i < upgrade.length; i++ ) { var gain = 2000 * Math.floor( 1 + upgrade[i].parentNode.nextSibling.innerHTML.match(/\+(\d+)/)[1] * 0.1 ), td = upgrade[i].parentNode.parentNode.insertBefore(document.createElement('td'), upgrade[i].parentNode.nextSibling); td.innerHTML = gain; td.className = 'gain'; td.style.color = gain > spent ? 'grey' : 'black'; }} This one is for add numbers to the Morale and hunger Bars. Thanks to sickentide. QUOTE(Superlatanium @ Jun 28 2017, 13:47) I know someone who might might hate me for this, but:
Monster_Helper_1.1.user.js.txt ( 1.86k )
Number of downloads: 98Press "f" to drug all monsters that can use a pill (bar length < 90px / 120px), better than "Drug All Monsters" (only drugs monsters less than 30px / 120px). [The more time your monsters spend with yellow morale, the fewer gifts you'll receive, in the long-term average] (wasteful if you're going to increase morale with crystals) Not much more at the moment.
|
|
|
|
|
|
Jul 1 2017, 05:31
|
SidZBear
Group: Gold Star Club
Posts: 560
Joined: 31-May 16
|
QUOTE(Maharid @ Jun 30 2017, 20:09) snip
You are a good person. I toast my beer to you!
|
|
|
Jul 1 2017, 07:19
|
sigo8
Group: Gold Star Club
Posts: 3,450
Joined: 9-November 11
|
QUOTE(sickentide @ Jun 30 2017, 18:15) this seems useful, i'd like to add it to the next version if you don't mind
Go ahead.
|
|
|
Jul 1 2017, 11:41
|
KitsuneAbby
Group: Catgirl Camarilla
Posts: 7,566
Joined: 12-July 14
|
QUOTE(sickentide @ Jun 30 2017, 01:10) i added an option to change the font size, try setting gainFontSize to something less than 100 and see if that helps Nope. Neither of settings helped. The issue I see here is not the font, but the CSS that gives too big of a box. Here I used 25 and 25 as settings: (IMG:[ i.imgur.com] http://i.imgur.com/ShYFMMf.jpg) QUOTE(Scremaz @ Jun 30 2017, 13:55) ah, sure. line 66 or so, yep. i had right in front of my glasses, yet i couldn't see it. my bad (IMG:[ invalid] style_emoticons/default/heh.gif) good, very good. (IMG:[ i.imgur.com] http://i.imgur.com/TMtpuAY.jpg) This post has been edited by decondelite: Jul 1 2017, 11:55
|
|
|
|
|
|
Jul 1 2017, 12:51
|
Maximum_Carnage
Group: Gold Star Club
Posts: 792
Joined: 27-October 09
|
QUOTE(sickentide @ Jun 30 2017, 12:24) drop tracker and round/turn/speed counter
HentaiverseMonsterbation.1.1.0.user.js.zip ( 7.86k )
Number of downloads: 229I'm using your script and it's great. But I have a little problem: I tried to assign Orbital Friendship Cannon to right click, but when I press it I still attacks with my weapon. Where do I need to press it? On the monsters' pane? Or anywhere? BTW, is this correct: clickRight = Cast('Orbital Friendship Cannon') ?
|
|
|
|
|
|
Jul 1 2017, 12:55
|
Noni
Group: Catgirl Camarilla
Posts: 12,956
Joined: 19-February 16
|
QUOTE(LOL50015 @ Jun 30 2017, 10:59) CODE java script: ((function() { if (document.getElementById("persona_form") === null) { console.log("Go to HV Character Page!"); return; }
var base = window.location.protocol + "//" + window.location.hostname + "/"; var URL = base + "?s=Character&ss=in&filter="; var queryValue = ["1handed", "2handed", "staff", "shield", "acloth", "alight", "aheavy"];
var skipped = 0; var queued = 0; var bazaared = 0; var salvaged = 0;
var working = 7;
var storetoken;
var gx = new XMLHttpRequest();
gx.open("GET", base + "?s=Bazaar&ss=es", true); gx.onreadystatechange = (function() { if (gx.readyState == 4) { if (gx.status == 200) { var doc = (new DOMParser()).parseFromString(gx.responseText, "text/html"); storetoken = doc.getElementsByName("storetoken")[0].value; console.log("Store Token retrieved!"); pager(0); } else { alert("Error Retrieving Bazaar Page!"); } } }); gx.send();
function pager(i) { var x = new XMLHttpRequest();
x.open("GET", URL + queryValue[i], true); x.onreadystatechange = (function() { if (x.readyState == 4) { if (x.status == 200) { process(x.responseText); working--; done(0);
if (i + 1 < queryValue.length) { pager(i + 1); } } else { alert("Error Retrieving Equipment Page!"); } } }); x.send(); }
function process(html) { var doc = (new DOMParser()).parseFromString(html, "text/html");
var locks = doc.querySelectorAll(".eqp .il, .eqp .iu"); var names = doc.querySelectorAll(".eqp div:not(.il):not(.iu)");
var trash = /Crude|Fair|Average|Superior|Exquisite/;
for (var i = 0; i < names.length; i++) { var name = names[i].textContent; var id = parseInt(names[i].id.substring(1));
if (name.match(trash) !== null && locks[i].className == "iu" && names[i].outerHTML.includes("onclick=")) { if (name.match(/Phase|Cotton/)) { console.log("Salvage - " + name); baavage(id, "acloth"); continue; }
if (name.match(/Staff/)) { console.log("Salvage - " + name); baavage(id, "staff"); continue; }
console.log("Bazaar - " + name); baavage(id); continue; }
skipped++; } }
function baavage(id, category) { queued++;
var x = new XMLHttpRequest(); x.onload = function() { done(1); };
if (category === undefined) { bazaared++; x.open("POST", base + "?s=Bazaar&ss=es", true); x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); x.send("storetoken=" + storetoken + "&select_group=item_pane&select_eids=" + id); } else { salvaged++; x.open("POST", base + "?s=Forge&ss=sa&filter=" + category, true); x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); x.send("select_item=" + id); } }
function done(i) { queued -= i;
if (working == 0) { if (queued == 0) { alert("Done!\nSkipped: " + skipped + "\nSalvaged: " + salvaged + "\nBazaared: " + bazaared); } else { console.log(queued + " pending response from server."); } } } })())
This is a bookmarklet that automatically salvage or bazaar all equipment of Exquisite quality and below that are not locked or used by other persona. It will salvage cloth and staff while bazaaring the rest. Obviously this is meant as a 1-click solution for mages. Remember that the forum separates the word Javascript, so you need to remove the whitespace between them on the first line before installation. To use, go to your character page and then click on the bookmark. After its done, an alert box will popup showing you how many equip it skipped, bazaared and salvaged. Note that the number of skipped items should correspond to the slots used value on your equipment inventory page after execution. You can find additional information on what it is doing/did in the console. Also note that if you name your Peerless as "Average something" and do not lock it, it will treat it as trash. Potential Bloat: There is a new key needed when bazaaring equipment called the storetoken. I don't know if it's same for everyone, different for each user or if it ever changes. If its the first then it can be hardcoded but for now, I retrieve it from the bazaar page on each execution. I've only tested it on Chromium 55, so be careful when using it. How do I get this to work with Tampermonkey?
|
|
|
|
|
|
Jul 1 2017, 13:46
|
BB-04
Newcomer
Group: Gold Star Club
Posts: 74
Joined: 4-October 13
|
QUOTE(DJNoni @ Jul 1 2017, 17:55) How do I get this to work with Tampermonkey?
Ummm.. for me i change something from original code (by LOL50015). i create text "Sell/Salvage" at Character page on top of right side to run process. look like this.
Automatically_salvage_or_bazaar.user.js.txt ( 5.43k )
Number of downloads: 108 hope it can help you. ps. Thank you a excellent code by LOL50015 ( I don't know if i change original source code i can share it or not? If i do something wrong please tell me. )
|
|
|
|
|
|
Jul 1 2017, 15:09
|
Noni
Group: Catgirl Camarilla
Posts: 12,956
Joined: 19-February 16
|
QUOTE(BB-04 @ Jul 1 2017, 13:46) Ummm.. for me i change something from original code (by LOL50015). i create text "Sell/Salvage" at Character page on top of right side to run process. look like this.
Automatically_salvage_or_bazaar.user.js.txt ( 5.43k )
Number of downloads: 108 hope it can help you. ps. Thank you a excellent code by LOL50015 ( I don't know if i change original source code i can share it or not? If i do something wrong please tell me. ) Thanks! May I suggest a change of name for this script? I call it "TrashBeGone"
|
|
|
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:
|
|
|
|
|