Advertisement
Guest User

Scavenging script condensed

a guest
Mar 19th, 2019
1,995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:
  2.  
  3. var spearEnabled = true;
  4. var swordEnabled = true;
  5. var axeEnabled = true;
  6. var lightEnabled = true;
  7. var heavyEnabled = true;
  8. var archerEnabled = true;
  9. var marcherEnabled = true;
  10. var hours = 3;
  11.  
  12. function scavenge(){function a(a,b,c){scavengeOptions[a].forEach(a=>{const d=a.type,e=a.count;let f=b[d]<e?b[d]:e;$(`input.unitsInput[name='${d}']`).val(f).trigger("change"),$(c).focus()})}function b(a){startButtonName=document.getElementsByClassName("btn btn-default free_send_button")[0].innerHTML;let b=$(`.scavenge-option:contains("${a}")`).find("a:contains("+startButtonName+")");if(0<b.length&&!$(b).hasClass("btn-disabled"))return b}function c(){let a={};return $(".units-entry-all").each((b,c)=>{const d=$(c).attr("data-unit"),e=$(c).text().replace(/[()]/,"");a[d]=parseInt(e)}),a}const d=document;0<window.frames.length&&null!=window.main&&(d=window.main.document),0>window.location.href.indexOf("screen=place&mode=scavenge")&&window.location.assign(game_data.link_base_pure+"place&mode=scavenge");var e=document.getElementsByClassName("title")[0].innerHTML,f=document.getElementsByClassName("title")[1].innerHTML,g=document.getElementsByClassName("title")[2].innerHTML,h=document.getElementsByClassName("title")[3].innerHTML,i=JSON.parse($("html").find("script:contains(\"ScavengeScreen\")").html().match(/\{.*\:\{.*\:.*\}\}/g)[0]),j=i[1].duration_factor,k=i[1].duration_exponent,l=i[1].duration_initial_seconds;spears=$(".units-entry-all[data-unit=spear]").text().match(/\((\d+)\)/)[1],swords=$(".units-entry-all[data-unit=sword]").text().match(/\((\d+)\)/)[1],axes=$(".units-entry-all[data-unit=axe]").text().match(/\((\d+)\)/)[1],lightC=$(".units-entry-all[data-unit=light]").text().match(/\((\d+)\)/)[1],heavyC=$(".units-entry-all[data-unit=heavy]").text().match(/\((\d+)\)/)[1],archer=""==$(".units-entry-all[data-unit=archer]").text()?0:$(".units-entry-all[data-unit=archer]").text().match(/\((\d+)\)/)[1],marcher=""==$(".units-entry-all[data-unit=marcher]").text()?0:$(".units-entry-all[data-unit=marcher]").text().match(/\((\d+)\)/)[1],!1,!1,!0!=archerEnabled&&(archer=0),!0!=marcherEnabled&&(marcher=0),!0!=axeEnabled&&(axes=0),!0!=lightEnabled&&(lightC=0),!0!=heavyEnabled&&(heavyC=0),function(){totalLoot=25*spears+15*swords+10*axes+80*lightC+50*heavyC+10*archer+50*marcher,totalSpSwLoot=25*spears+15*swords,possibleLoot=25*spears+15*swords+10*axes+80*lightC+50*heavyC+10*archer+50*marcher,spearRatio=spears/(25*spears+15*swords),swordRatio=swords/(25*spears+15*swords),time=3600*hours,haul=((time/j-l)**(1/k)/100)**(1/2),haul1=haul/.1,haul2=haul/.25,haul3=haul/.5,haul4=haul/.75,totalHaul=haul1+haul2+haul3+haul4,console.log(haul1),console.log(haul2),console.log(haul3),console.log(haul4),console.log(totalHaul)}(),"haulCategory"in sessionStorage?haulCategory=sessionStorage.getItem("haulCategory"):(haulCategory=0,sessionStorage.setItem("haulCategory",haulCategory)),totalLoot>totalHaul?totalSpSwLoot>totalHaul?0==haulCategory&&(haulCategory=1,sessionStorage.setItem("haulCategory",haulCategory)):0==haulCategory&&(haulCategory=2,sessionStorage.setItem("haulCategory",haulCategory)):0==haulCategory&&(haulCategory=3,sessionStorage.setItem("haulCategory",haulCategory)),1==haulCategory?(scavengeOptions={},scavengeOptions[h]=[{type:"spear",count:haul4*spearRatio},{type:"sword",count:haul4*swordRatio},{type:"axe",count:0},{type:"archer",count:0},{type:"light",count:0},{type:"marcher",count:0},{type:"heavy",count:0}],scavengeOptions[g]=[{type:"spear",count:haul3*spearRatio},{type:"sword",count:haul3*swordRatio},{type:"axe",count:0},{type:"archer",count:0},{type:"light",count:0},{type:"marcher",count:0},{type:"heavy",count:0}],scavengeOptions[f]=[{type:"spear",count:haul2*spearRatio},{type:"sword",count:haul2*swordRatio},{type:"axe",count:0},{type:"archer",count:0},{type:"light",count:0},{type:"marcher",count:0},{type:"heavy",count:0}],scavengeOptions[e]=[{type:"spear",count:haul1*spearRatio},{type:"sword",count:haul1*swordRatio},{type:"axe",count:0},{type:"archer",count:0},{type:"light",count:0},{type:"marcher",count:0},{type:"heavy",count:0}]):2==haulCategory?(scavengeOptions={},scavengeOptions[h]=[{type:"spear",count:haul4*(spears/possibleLoot)},{type:"sword",count:haul4*(swords/possibleLoot)},{type:"axe",count:haul4*(axes/possibleLoot)},{type:"light",count:haul4*(lightC/possibleLoot)},{type:"heavy",count:haul4*(heavyC/possibleLoot)},{type:"archer",count:haul4*(archer/possibleLoot)},{type:"marcher",count:haul4*(marcher/possibleLoot)}],scavengeOptions[g]=[{type:"spear",count:haul3*(spears/possibleLoot)},{type:"sword",count:haul3*(swords/possibleLoot)},{type:"axe",count:haul3*(axes/possibleLoot)},{type:"light",count:haul3*(lightC/possibleLoot)},{type:"heavy",count:haul3*(heavyC/possibleLoot)},{type:"archer",count:haul3*(archer/possibleLoot)},{type:"marcher",count:haul3*(marcher/possibleLoot)}],scavengeOptions[f]=[{type:"spear",count:haul2*(spears/possibleLoot)},{type:"sword",count:haul2*(swords/possibleLoot)},{type:"axe",count:haul2*(axes/possibleLoot)},{type:"light",count:haul2*(lightC/possibleLoot)},{type:"heavy",count:haul2*(heavyC/possibleLoot)},{type:"archer",count:haul2*(archer/possibleLoot)},{type:"marcher",count:haul2*(marcher/possibleLoot)}],scavengeOptions[e]=[{type:"spear",count:haul1*(spears/possibleLoot)},{type:"sword",count:haul1*(swords/possibleLoot)},{type:"axe",count:haul1*(axes/possibleLoot)},{type:"light",count:haul1*(lightC/possibleLoot)},{type:"heavy",count:haul1*(heavyC/possibleLoot)},{type:"archer",count:haul1*(archer/possibleLoot)},{type:"marcher",count:haul1*(marcher/possibleLoot)}]):3==haulCategory&&(scavengeOptions={},scavengeOptions[h]=[{type:"spear",count:totalLoot/totalHaul*haul4*(spears/possibleLoot)},{type:"sword",count:totalLoot/totalHaul*haul4*(swords/possibleLoot)},{type:"axe",count:totalLoot/totalHaul*haul4*(axes/possibleLoot)},{type:"light",count:totalLoot/totalHaul*haul4*(lightC/possibleLoot)},{type:"heavy",count:totalLoot/totalHaul*haul4*(heavyC/possibleLoot)},{type:"archer",count:totalLoot/totalHaul*haul4*(archer/possibleLoot)},{type:"marcher",count:totalLoot/totalHaul*haul4*(marcher/possibleLoot)}],scavengeOptions[g]=[{type:"spear",count:totalLoot/(totalHaul-haul4)*haul3*(spears/possibleLoot)},{type:"sword",count:totalLoot/(totalHaul-haul4)*haul3*(swords/possibleLoot)},{type:"axe",count:totalLoot/(totalHaul-haul4)*haul3*(axes/possibleLoot)},{type:"light",count:totalLoot/(totalHaul-haul4)*haul3*(lightC/possibleLoot)},{type:"heavy",count:totalLoot/(totalHaul-haul4)*haul3*(heavyC/possibleLoot)},{type:"archer",count:totalLoot/(totalHaul-haul4)*haul3*(archer/possibleLoot)},{type:"marcher",count:totalLoot/(totalHaul-haul4)*haul3*(marcher/possibleLoot)}],scavengeOptions[f]=[{type:"spear",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(spears/possibleLoot)},{type:"sword",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(swords/possibleLoot)},{type:"axe",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(axes/possibleLoot)},{type:"light",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(lightC/possibleLoot)},{type:"heavy",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(heavyC/possibleLoot)},{type:"archer",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(archer/possibleLoot)},{type:"marcher",count:totalLoot/(totalHaul-haul4-haul3)*haul2*(marcher/possibleLoot)}],scavengeOptions[e]=[{type:"spear",count:totalLoot*(spears/possibleLoot)},{type:"sword",count:totalLoot*(swords/possibleLoot)},{type:"axe",count:totalLoot*(axes/possibleLoot)},{type:"light",count:totalLoot*(lightC/possibleLoot)},{type:"heavy",count:totalLoot*(heavyC/possibleLoot)},{type:"archer",count:totalLoot*(archer/possibleLoot)},{type:"marcher",count:totalLoot*(marcher/possibleLoot)}]),function(){let d=null;for(const e in scavengeOptions)if(d=b(e),d){a(e,c(),d);break}}()}scavenge();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement