Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //javascript:(function(){var d=document,s=d.createElement('script');s.src='http://127.0.0.1/nipBot.js';d.body.appendChild(s);})();
- /*
- _ ____ _ _
- (_) | _ \ | | (_)
- _ __ _ _ __ | |_) | ___ | |_ _ ___
- | '_ \| | '_ \| _ < / _ \| __| | / __|
- | | | | | |_) | |_) | (_) | |_ _| \__ \
- |_| |_|_| .__/|____/ \___/ \__(_) |___/
- | | _/ |
- |_| |__/
- javascript:(function(){var d=document,s=d.createElement('script');s.src='http://127.0.0.1/nipBot.js';d.body.appendChild(s);})();
- */
- /*
- _____ _ _ _
- / ____| | | | | |
- | | __| | ___ | |__ __ _| | __ ____ _ _ __ ___
- | | |_ | |/ _ \| '_ \ / _` | | \ \ / / _` | '__/ __|
- | |__| | | (_) | |_) | (_| | | \ V / (_| | | \__ \
- \_____|_|\___/|_.__/ \__,_|_| \_/ \__,_|_| |___/
- */
- //Frame count of spiner
- var myCount = 0;
- //Trigger mySpinner() evry x ticks
- var evryTicks = 5;
- //Store last trick that triggered mySpinner
- var lastTick = 0;
- // Array to store craft list, [i][0] = resToCraftName [i][1] = resTriggerName
- var craftList = [
- ["wood", "catnip"],
- ["beam", "wood"],
- ["slab", "minerals"],
- ["plate", "iron"],
- ["steel", "coal"],
- ["manuscript", "culture"],
- ["kerosene", "oil"],
- ["thorium", "uranium"],
- ["alloy", "titanium"],
- ["eludium", "unobtainium"]
- ];
- var myConfig = {
- speed :1,
- speedTmp :1,
- autoObserveBtn :false,
- autoHunt :false,
- autoHuntSec :10,
- autoPraise :false,
- autoPraiseSec :10,
- autoFurs :false,
- autoFursSec :10,
- autoCompedium :false,
- autoCompediumSec :10,
- autoCompediumSpend :10,
- autoBlueprint :false,
- autoBlueprintSec :10,
- autoBlueprintSpend :10,
- wood :false,
- woodSec :10,
- woodSpend :10,
- beam :false,
- beamSec :10,
- beamSpend :10,
- slab :false,
- slabSec :10,
- slabSpend :10,
- plate :false,
- plateSec :10,
- plateSpend :10,
- steel :false,
- steelSec :10,
- steelSpend :10,
- manuscript :false,
- manuscriptSec :10,
- manuscriptSpend :10,
- kerosene :false,
- keroseneSec :10,
- keroseneSpend :10,
- thorium :false,
- thoriumSec :10,
- thoriumSpend :10,
- alloy :false,
- alloySec :10,
- alloySpend :10,
- eludium :false,
- eludiumSec :10,
- eludiumSpend :10
- };
- if(!!localStorage.getItem("nipBotConfig"))
- {
- myConfig = JSON.parse(localStorage.getItem("nipBotConfig"));
- }
- /*
- _____ _ _
- |_ _| (_) | |
- | | _ __ _ ___ ___| |_
- | | | '_ \| |/ _ \/ __| __|
- _| |_| | | | | __/ (__| |_
- |_____|_| |_| |\___|\___|\__|
- _/ |
- |__/
- */
- gamePage.timer.updateScheduledEvents = function()
- {
- nipBot();
- for (var i in this.scheduledHandlers)
- {
- this.scheduledHandlers[i]();
- }
- this.scheduledHandlers = [];
- };
- document.getElementById('motd').innerHTML += " <a href='#' class='myAnimStart' id='mySpinner' onclick='toggleMenu();'>?</a>";
- setTimeout(function (){
- g('mySpinner').className = "myAnimEnd";
- }, 1000);
- setTimeout(function (){
- g('mySpinner').className = "";
- }, 5000);
- mySpinner();
- injectCss();
- injectHtmlMenu();
- if(!gamePage.nipUpdateModel){gamePage.nipUpdateModel = gamePage.updateModel;}
- gamePage.updateModel = function()
- {
- for(var myi = 0; myi < myConfig.speed; myi++)
- {
- if(myi != 0)
- {
- game.calendar.tick();
- }
- game.nipUpdateModel();
- }
- }
- /*
- ______ _ _ _____
- | ____| | | | |_ _|
- | |__ _ _ _ __ ___ ___ | | | | | |
- | __| | | | '_ \ / __/ __| | | | | | |
- | | | |_| | | | | (__\__ \ | |__| |_| |_
- |_| \__,_|_| |_|\___|___/ \____/|_____|
- */
- function g(id)
- {
- return document.getElementById(id);
- }
- function gr(id)
- {
- return gamePage.resPool.get(id);
- }
- function myLast(arr)
- {
- return arr[arr.length -1];
- }
- function toggleMenu()
- {
- if(g('myMenuId').style.display == "none")
- {
- myConfig.speedTmp = myConfig.speed;
- myConfig.speed = 1;
- printHtmlMenu();
- g('myMenuId').style.display = "block";
- }
- else
- {
- myConfig.speed = myConfig.speedTmp;
- mySaveConfig();
- g('myMenuId').style.display = "none";
- }
- }
- function mySpinner()
- {
- var frames = ['⠋','⠛','⠙','⠹','⠸','⢸','⢰','⣰','⣠','⣤','⣄','⣆','⡆','⡇','⠇','⠏'];
- document.getElementById('mySpinner').innerHTML = ""+frames[myCount];
- myCount++;
- if(myCount >= frames.length)
- {
- myCount = 0;
- }
- }
- function printCss()
- {
- var cssCode = "";
- cssCode += `
- #mySpinner
- {
- text-decoration:none;
- transition: transform ease 4s, background-color ease 4s;
- transform-origin: left top;
- }
- .myAnimStart
- {
- position: fixed;
- transform: scale(30);
- background-color:rgba(30,30,30,0.6);
- }
- .myAnimEnd
- {
- position: fixed;
- transform: scale(1);
- background-color:rgba(200,200,200,0);
- }
- .close
- {
- transition : background-color ease 0.3s;
- }
- .close:hover
- {
- background-color:rgba(255,0,0,0.3);
- }
- .scheme_grassy #myMenuId
- {
- padding: 30px;
- background-color: #C6EBA1;
- }
- #myMenuIdTable
- {
- text-align:center;
- width:100%;
- }
- #myMenuIdTable > tbody > tr > td
- {
- padding:8px 0 8px 0;
- }
- `;
- return cssCode;
- }
- function printHtmlMenu()
- {
- var myStrHtml = ""
- myStrHtml = `
- <a href="#" class="close" onclick="toggleMenu();" style="position: absolute; top: 0px; right: 0px; padding:16px;">close</a>
- <table id="myMenuIdTable"><tbody>
- <tr>
- <td style="text-align:right;"><input id="autoObserveBtn" type="checkbox" `+((myConfig.autoObserveBtn) ? "checked" : "")+`>
- <label for="autoObserveBtn">Auto Observe </label></td><td style="text-align:left;"> the Sky </td><td> </td><td> </td><td> </td><td> </td>
- </tr>
- <tr style="display:`+((gr("manpower").unlocked) ? "table-row" : "none")+`">
- <td><input id="autoHunt" type="checkbox" `+((myConfig.autoHunt) ? "checked" : "")+`>
- <label for="autoHunt">Auto send </td><td>hunters</td><td> if </td><td>` +gr('manpower').title+` </td><td> will be full in </label> </td><td><input type="number" id="autoHuntSec" value="`+(myConfig.autoHuntSec)+`" style="width:8ch" /> seconds</td>
- </tr>
- <tr style="display:`+((gr("faith").unlocked) ? "table-row" : "none")+`">
- <td><input id="autoPraise" type="checkbox" `+((myConfig.autoPraise) ? "checked" : "")+`>
- <label for="autoPraise">Auto Praise </td><td> the sun</td><td> if </td><td>`+gr('faith').title+` </td><td> will be full in </label> </td><td><input type="number" id="autoPraiseSec" value="`+(myConfig.autoPraiseSec)+`" style="width:8ch" /> seconds</td>
- </tr>
- <tr style="display:`+((gamePage.workshop.getCraft("parchment").unlocked) ? "table-row" : "none")+`">
- <td><input id="autoFurs" type="checkbox" `+((myConfig.autoFurs) ? "checked" : "")+`>
- <label for="autoFurs">Auto Craft </td><td>`+gr("parchment").title+` </td><td> if </td><td>`+gr('furs').title+` </td><td> is more than </label> </td><td><input type="number" id="autoFursSec" value="`+(myConfig.autoFursSec)+`" style="width:18ch" /> units </td>
- </tr>
- <tr style="display:`+((gamePage.workshop.getCraft("compedium").unlocked) ? "table-row" : "none")+`">
- <td><input id="autoCompedium" type="checkbox" `+((myConfig.autoCompedium) ? "checked" : "")+`>
- <label for="autoCompedium">Auto Craft </td><td>`+gr("compedium").title+` </td><td> if </td><td> `+gr("science").title+` </td><td> will be full in </label> </td><td><input type="number" id="autoCompediumSec" value="`+(myConfig.autoCompediumSec)+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="autoCompediumSpend" value="`+(myConfig.autoCompediumSpend)+`" style="width:8ch" />%</td>
- </tr>
- <tr style="display:`+((gamePage.workshop.getCraft("blueprint").unlocked) ? "table-row" : "none")+`">
- <td><input id="autoBlueprint" type="checkbox" `+((myConfig.autoBlueprint) ? "checked" : "")+`>
- <label for="autoBlueprint">Auto Craft </td><td>`+gr("blueprint").title+` </td><td> if </td><td> `+gr("science").title+` </td><td> will be full in </label> </td><td><input type="number" id="autoBlueprintSec" value="`+(myConfig.autoBlueprintSec)+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="autoBlueprintSpend" value="`+(myConfig.autoBlueprintSpend)+`" style="width:8ch" />%</td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- `;
- myStrHtml += genCraftList();
- myStrHtml += `</body></table><br><br> !Déja Vus ! speed : <input id="mySpeed" type="number" min="1" max="64" value="`+(myConfig.speedTmp)+`" style="width:5ch"><br><br><br><br>`;
- g("myMenuId").innerHTML = myStrHtml;
- }
- function genCraftList()
- {
- var myStr = "";
- var trDisplay = "";
- craftList.forEach(function(truck){
- //if(gamePage.workshop.getCraft(truck[0]).unlocked)
- //{
- console.log(truck[0]+" et "+truck[0]);
- if( (gamePage.workshop.getCraft(truck[0]).unlocked && gr(truck[0]).unlocked && gr(truck[1]).unlocked) )
- {
- trDisplay = "table-row";
- }
- else
- {
- trDisplay = "none";
- }
- console.log(trDisplay);
- myStr += `
- <tr style="display:`+trDisplay+`">
- <td><input id="auto`+truck[0]+`" type="checkbox" `+( (eval("myConfig."+truck[0]) ) ? "checked" : "")+`>
- <label for="auto`+truck[0]+`">Auto Craft </td><td>`+gr(truck[0]).title+` </td><td> if </td><td> `+gr(truck[1]).title+` </td><td> will be full in </label> </td><td><input type="number" id="auto`+truck[0]+`Sec" value="`+(eval('myConfig.'+truck[0]+'Sec'))+`" style="width:8ch" /> sec, spend <input type="number" min="1" max="100" id="auto`+truck[0]+`Spend" value="`+(eval('myConfig.'+truck[0]+'Spend'))+`" style="width:8ch" />%</td>
- </tr>
- `;
- //}
- })
- return myStr;
- }
- function injectCss()
- {
- var cssCode = printCss();
- var styleElement = document.createElement("style");
- styleElement.type = "text/css";
- if (styleElement.styleSheet)
- {
- styleElement.styleSheet.cssText = cssCode;
- }
- else
- {
- styleElement.appendChild(document.createTextNode(cssCode));
- }
- document.getElementsByTagName("head")[0].appendChild(styleElement);
- }
- function injectHtmlMenu()
- {
- var myDiv = document.createElement("div");
- //myDiv.innerHTML = myStrHtml;
- myDiv.setAttribute("class", "dialog help");
- myDiv.setAttribute("style", "height: 72vh !important;top:225px !important;display:none; overflow:auto;width:720px;margin-left:-30%;");
- myDiv.setAttribute("id", "myMenuId");
- document.body.appendChild(myDiv);
- }
- function mySaveConfig()
- {
- myConfig.speed = g('mySpeed').value;
- //console.log(myConfig.speed);
- if(myConfig.speed < 1 || myConfig.speed > 64){myConfig.speed = 1}
- myConfig.autoObserveBtn = g('autoObserveBtn').checked;
- myConfig.autoHunt = g('autoHunt').checked;
- myConfig.autoHuntSec = g('autoHuntSec').value;
- myConfig.autoPraise = g('autoPraise').checked;
- myConfig.autoPraiseSec = g('autoPraiseSec').value;
- myConfig.autoFurs = g('autoFurs').checked;
- myConfig.autoFursSec = g('autoFursSec').value;
- myConfig.autoCompedium = g('autoCompedium').checked;
- myConfig.autoCompediumSec = g('autoCompediumSec').value;
- myConfig.autoCompediumSpend = g('autoCompediumSpend').value;
- myConfig.autoBlueprint = g('autoBlueprint').checked;
- myConfig.autoBlueprintSec = g('autoBlueprintSec').value;
- myConfig.autoBlueprintSpend = g('autoBlueprintSpend').value;
- myConfig.wood = g('autowood').checked;
- myConfig.woodSec = g('autowoodSec').value;
- myConfig.woodSpend = g('autowoodSpend').value;
- myConfig.beam = g('autobeam').checked;
- myConfig.beamSec = g('autobeamSec').value;
- myConfig.beamSpend = g('autobeamSpend').value;
- myConfig.slab = g('autoslab').checked;
- myConfig.slabSec = g('autoslabSec').value;
- myConfig.slabSpend = g('autoslabSpend').value;
- myConfig.plate = g('autoplate').checked;
- myConfig.plateSec = g('autoplateSec').value;
- myConfig.plateSpend = g('autoplateSpend').value;
- myConfig.steel = g('autosteel').checked;
- myConfig.steelSec = g('autosteelSec').value;
- myConfig.steelSpend = g('autosteelSpend').value;
- myConfig.manuscript = g('automanuscript').checked;
- myConfig.manuscriptSec = g('automanuscriptSec').value;
- myConfig.manuscriptSpend = g('automanuscriptSpend').value;
- myConfig.kerosene = g('autokerosene').checked;
- myConfig.keroseneSec = g('autokeroseneSec').value;
- myConfig.keroseneSpend = g('autokeroseneSpend').value;
- myConfig.thorium = g('autothorium').checked;
- myConfig.thoriumSec = g('autothoriumSec').value;
- myConfig.thoriumSpend = g('autothoriumSpend').value;
- myConfig.alloy = g('autoalloy').checked;
- myConfig.alloySec = g('autoalloySec').value;
- myConfig.alloySpend = g('autoalloySpend').value;
- myConfig.eludium = g('autoeludium').checked;
- myConfig.eludiumSec = g('autoeludiumSec').value;
- myConfig.eludiumSpend = g('autoeludiumSpend').value;
- localStorage.setItem("nipBotConfig", JSON.stringify(myConfig));
- }
- /*
- ______ ____ _
- | ____| | _ \ | |
- | |__ _ _ _ __ ___ | |_) | ___ | |_
- | __| | | | '_ \/ __| | _ < / _ \| __|
- | | | |_| | | | \__ \ | |_) | (_) | |_
- |_| \__,_|_| |_|___/ |____/ \___/ \__|
- */
- function nipBot()
- {
- if(gamePage.ticks >= lastTick + evryTicks)
- {
- //console.log(gamePage.ticks);
- mySpinner();
- myJobs();
- lastTick = gamePage.ticks;
- }
- }
- function myJobs()
- {
- var nbToCraft = 0;
- var objTemp;
- var objTempSec;
- var priceTmp;
- myConfig.speedTmp = myConfig.speed;
- myConfig.speed = 1;
- if(myConfig.autoObserveBtn)
- {
- if (g('observeBtn') != null)
- {
- g('observeBtn').click();
- }
- }
- if(myConfig.autoHunt)
- {
- if ((gr("manpower").value + (gr("manpower").perTickCached * 5 * myConfig.autoHuntSec)) > gr("manpower").maxValue)
- {
- gamePage.village.huntAll();
- }
- }
- if(myConfig.autoPraise)
- {
- if ((gr("faith").value + (gr("faith").perTickCached * 5 * myConfig.autoPraiseSec)) > gr("faith").maxValue)
- {
- gamePage.religion.praise();
- }
- }
- if(myConfig.autoFurs)
- {
- if (gr("furs").value > myConfig.autoFursSec)
- {
- gamePage.craft("parchment", Math.floor(gr("furs").value / 1000) );
- }
- }
- if(myConfig.autoCompedium)
- {
- if ((gr("science").value + (gr("science").perTickCached * 5 * myConfig.autoCompediumSec)) > gr("science").maxValue)
- {
- //nbToCraft = Math.floor( (gr("science").perTickCached * 5 * myConfig.autoCompediumSec) / 10000);
- nbToCraft = Math.floor( (gr("science").value * (myConfig.autoCompediumSpend / 100)) / 10000 );
- if(nbToCraft < 1){nbToCraft = 1;}
- gamePage.craft("compedium", nbToCraft);
- }
- }
- if(myConfig.autoBlueprint)
- {
- if ((gr("science").value + (gr("science").perTickCached * 5 * myConfig.autoBlueprintSec)) > gr("science").maxValue)
- {
- //nbToCraft = Math.floor( (gr("science").perTickCached * 5 * myConfig.autoBlueprintSec) / 25000);
- nbToCraft = Math.floor( (gr("science").value * (myConfig.autoBlueprintSpend / 100)) / 25000 );
- if(nbToCraft < 1){nbToCraft = 1;}
- gamePage.craft("blueprint", nbToCraft);
- }
- }
- craftList.forEach(function(truck){
- objTemp = eval("myConfig."+truck[0]);
- objTempSec = eval("myConfig."+truck[0]+"Sec");
- priceTmp = myLast(gamePage.workshop.getCraft(truck[0]).prices).val;
- if(objTemp)
- {
- if ((gr(truck[1]).value + (gr(truck[1]).perTickCached * 5 * objTempSec)) > gr(truck[1]).maxValue)
- {
- //nbToCraft = Math.floor( (gr(truck[1]).perTickCached * 5 * objTempSec) / priceTmp);
- nbToCraft = Math.floor( (gr(truck[1]).value * ( eval("myConfig."+truck[0]+"Spend") / 100)) / priceTmp );
- if(nbToCraft < 1){nbToCraft = 1;}
- gamePage.craft(truck[0], nbToCraft);
- }
- }
- })
- myConfig.speed = myConfig.speedTmp;
- }
- /*
- function drawMenuCss()
- {
- var cssCode = "";
- cssCode += `
- .scheme_grassy #myMenuId
- {
- padding: 30px;
- background-color: #C6EBA1;
- }
- #myMenuId
- {
- width: 600px;
- height: 80% !important;
- position: absolute;
- margin: auto;
- top: 0px !important;
- right: 0px;
- bottom: 0px;
- left: 0px;
- display: block;
- overflow: auto;
- }
- .btn.myModern {
- font-family: Helvetica;
- font-size: 14px;
- border-radius: 3px;
- border: 1px solid #888;
- width: 264px;
- padding: 10px 0 10px 10px;
- cursor: initial;
- }
- #myMenuTabs
- {
- position:absolute;
- top:100px;
- width:600px;
- text-align:center;
- }
- #myContener
- {
- position: relative;
- margin: 0 auto;
- width:100%;
- top:128px;
- }
- #myContener > div
- {
- width:600px;
- display:none;
- }
- #myMenuTabInfo
- {
- font-size:11px;
- }
- #myMenuTabInfo > table > tbody > tr > td, #myMenuTabInfo > table > tr > td
- {
- padding: 0px 10px 0px 10px;
- }
- .optionLabelText
- {
- display:inline-block;
- width:260px;
- margin: 0 0 0 60px;
- }
- .optionLabel
- {
- position: relative;
- display: block;
- width: 40px;
- height: 20px;
- margin: 0 0 5px 0;
- }
- .slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #ccc;
- -webkit-transition: .4s;
- transition: .4s;
- }
- .slider:before {
- position: absolute;
- content: "";
- height: 14px;
- width: 14px;
- left: 3px;
- bottom: 3px;
- background-color: white;
- -webkit-transition: .4s;
- transition: .4s;
- }
- input:checked + .slider {
- background-color: #2196F3;
- }
- input:focus + .slider {
- box-shadow: 0 0 1px #2196F3;
- }
- input:checked + .slider:before {
- -webkit-transform: translateX(20px);
- -ms-transform: translateX(20px);
- transform: translateX(20px);
- }
- // Rounded sliders
- .slider.round {
- border-radius: 34px;
- }
- .slider.round:before {
- border-radius: 50%;
- }
- `;
- return cssCode;
- }
- */
- /*
- function drawMenu()
- {
- var cssCode = drawMenuCss();
- var styleElement = document.createElement("style");
- styleElement.type = "text/css";
- if (styleElement.styleSheet)
- {
- styleElement.styleSheet.cssText = cssCode;
- }
- else
- {
- styleElement.appendChild(document.createTextNode(cssCode));
- }
- document.getElementsByTagName("head")[0].appendChild(styleElement);
- var mydiv = document.createElement("div");
- mydiv.innerHTML = `
- <div style="display: inline-block;position: relative;top: 0px;left: 86px;font-family: Helvetica;letter-spacing: 0px;">(^u^) ⟵ Hi Humain ! i'm a kitten.., totaly not a robot =]</div>
- <a style="cursor:pointer;position:absolute;top:0px;right:8px;text-decoration: underline;" onclick="toggleMenu();">close</a>
- <div id="myMenuTabs" class="">
- <a href="#" onclick="myMenuOpenTab(1);">Infos</a> |
- <a href="#" onclick="myMenuOpenTab(2);">Option</a> |
- <a href="#" onclick="myMenuOpenTab(3);">Default Tasks</a> |
- <a href="#" onclick="myMenuOpenTab(4);">My Tasks</a>
- </div>
- <div id="myContener">
- <div id="myMenuTabInfo"></div>
- <div id="myMenuTabOption">
- <label class="optionLabel"><input id="optionShowTrueValues" type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Show true values</span></label>
- <label class="optionLabel"><input id="optionShowHiddenRessources" type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Show hidden ressources</span></label>
- <label class="optionLabel"><input id="optionEnableExtraTicks" type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Enable extra ticks feature (not legit)</span></label>
- </div>
- <div id="myMenuTabDefaultTasks">
- <label class="optionLabel"><input id="optionAutoCraftWood" type="checkbox" /><div class="slider round"></div><span class="optionLabelText">Auto craft wood</span></label>
- </div>
- <div id="myMenuTabMyTasks">
- <br />
- </div>
- </div>
- `;
- mydiv.setAttribute("class", "dialog help");
- mydiv.setAttribute("style", "width:600px;height:80%;position:absolute;margin:auto;top:0;right:0;bottom:0;left:0;display:none;overflow:auto;");
- mydiv.setAttribute("id", "myMenuId");
- document.body.appendChild(mydiv);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement