Twisted Legacy
Active Member
- Reaction score
- 12
- Author
- Erlend
- Contributors
- Linoko
- Quickbar Entry
-
javascript:
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/
var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,
troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
},
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
minExclamationCount = 1,
dockMode = false;
/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/
var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,
coords = "",
populationLim = 0.01;
/*-------------------------- The Script, created by Erlend/Linoko 05.08.2020 --------------------------*/
function m(){if(!location.href.includes("overview_villages")||dockMode){if(jumpToRandomVillage){var e=localStorage.getItem("fs_fakecount");if(null==e&&localStorage.setItem("fs_fakecount",0),""==document.forms[0].x.value&&null==$(".village-item")[0]){if(e>=fakesPerVillage)return localStorage.setItem("fs_fakecount",0),void gtrv();localStorage.setItem("fs_fakecount",Number(e)+1)}}it(),jumpToRandomVillage&&!ci()&&(localStorage.setItem("fs_fakecount",0),gtrv())}else sc()}function it(){var e=guti(geu()),o=grc();document.forms[0].x.value=o.split("|")[0],document.forms[0].y.value=o.split("|")[1];for(var t=0;t<e.length;t++)$("input[id*="+e[t][0]+"]")[0].value=e[t][1]}function gtrv(){var e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length);if(dockMode){if(e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length),0==e.length)throw villageDock.open(),new Error("Village dock not open!");e[o].click()}else{if(villageIds=localStorage.getItem("fs_villagedata"),null==villageIds)return void alert("No villages found, please run the script from the overview page to update own villages");villageIds=villageIds.split(","),o=Math.floor(Math.random()*villageIds.length),window.location.href=window.location.href.replace(/(village=)\d+/,"village="+villageIds[o])}}function geu(){var e=[];for(key in troops)0!=troops[key]&&e.push([key,troops[key]]);return e}function guti(e){for(var o=[],t={spear:1,sword:1,axe:1,archer:1,spy:2,light:4,marcher:5,heavy:6,ram:5,catapult:8,knight:10,snob:100},r=[],l=[],a=0,i=0;i<e.length;i++){var n=0;isNaN(Number(e[i][1]))?e[i][1].includes("min")?(r.push(e[i][0]),n=0,l.push(i),e[i][1].includes("min!")&&(n=minExclamationCount)):"max"==e[i][1]&&(n=Number($("#units_entry_all_"+e[i][0])[0].innerText.match(/\d+/)[0])):n=e[i][1],o.push([e[i][0],n]),a+=n*t[e[i][0]]}for(var u=game_data.village.points*populationLim,s=(i=0,[0,3e4*populationLim]);a<u&&0!=r.length;){var c=Number($("#units_entry_all_"+o[l[i]][0])[0].innerText.match(/\d+/g)[0]);if((o[l[i]][1]<c||forceEqualTroopCount)&&o[l[i]][1]<s[0]&&(!distributeByPopulation||o[l[i]][1]<s[0]/t[o[l[i]][0]])&&(o[l[i]][1]+=1,a+=t[o[l[i]][0]]),i<r.length-1?i++:(i=0,s[0]+=1),s[0]>s[1]){o[l[i]][1]+=Math.ceil((u-a)/t[o[l[i]][0]]),a+=t[o[l[i]][0]];break}}return o}function grc(){if(useForumCoords){var e=Timing.getCurrentServerTime(),o=forumLink.split("forum_id=")[1].split("&")[0],t=forumLink.split("thread_id=")[1].split("&")[0],r="fs_coords_"+t+"_"+forumSpoilerName,l="fs_lastforumcheck_"+t+"_"+forumSpoilerName,a=localStorage.getItem(l);if(null!=a&&e-Number(a)<36e5*hoursBeforeCheckingForum)coords=localStorage.getItem(r);else try{$.get("/game.php?screen=forum&screenmode=view_thread&forum_id="+o+"&thread_id="+t).then(function(o){try{if(coords=$(o).find(".spoiler").has("[value='"+forumSpoilerName+"']").find("pre").html(),null==coords)throw Exception;localStorage.setItem(r,coords),localStorage.setItem(l,e.toString())}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to format your coords like this: \n\n["+"spoiler="+forumSpoilerName+"]["+"code]123|456 456|789 876|543["+"/code]["+"/spoiler]"),new Error("Could not get coords!")}},"html"),localStorage.setItem("fs_fakecount",0)}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to include forum1412&thread_id=18009 in your link!"),new Error("Could not get coords!")}}var i=coords.split(" ");return i[Math.floor(Math.random()*i.length)]}function ci(){for(var e=$(".unitsInput","#command-data-form"),o=$(".units-entry-all","#command-data-form"),t=!0,r=0;r<e.length;r++){var l=Number(o[r].innerText.match(/\d+/g)[0]);Number(e[r].value)>l&&(t=!1)}return t}function sc(){for(var e=$("a[href*=village]","#combined_table").has("span"),o="",t=0;t<e.length;t++){var r=e[t].href.split("village=")[1].split("&")[0];o+=t==e.length-1?r:r+","}localStorage.setItem("fs_villagedata",o),alert(e.length+" villages stored!")}m();
- Public?
- Public
The best faking script around
Below you will see a fake script.
This script is a multipurpose script.
With this one script you can customise to suit your needs.
Break Down of the attack script
In the script snippets below, you will notice that I have colour coded the first half of the Script. The second half should never be changed
The sections in red are the titles/admin text to explain what the section above or below does.
The Blue sections are then the areas of the script which you can change to suit your needs.
Let's Begin
Admin/Tribe setting
one last thing to add, if you dont use the code bb tags when posting this in the forum or mail itll break the script due to it using coord examples in the bottom section of the script.
it will attempt to read the coords as an actual village which doesn't exsist
Below you will see a fake script.
This script is a multipurpose script.
With this one script you can customise to suit your needs.
Code:
javascript:
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/
var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,
troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
},
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
minExclamationCount = 1,
dockMode = false;
/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/
var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,
coords = "",
populationLim = 0.01;
/*-------------------------- The Script, created by Erlend/Linoko 05.08.2020 --------------------------*/
function m(){if(!location.href.includes("overview_villages")||dockMode){if(jumpToRandomVillage){var e=localStorage.getItem("fs_fakecount");if(null==e&&localStorage.setItem("fs_fakecount",0),""==document.forms[0].x.value&&null==$(".village-item")[0]){if(e>=fakesPerVillage)return localStorage.setItem("fs_fakecount",0),void gtrv();localStorage.setItem("fs_fakecount",Number(e)+1)}}it(),jumpToRandomVillage&&!ci()&&(localStorage.setItem("fs_fakecount",0),gtrv())}else sc()}function it(){var e=guti(geu()),o=grc();document.forms[0].x.value=o.split("|")[0],document.forms[0].y.value=o.split("|")[1];for(var t=0;t<e.length;t++)$("input[id*="+e[t][0]+"]")[0].value=e[t][1]}function gtrv(){var e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length);if(dockMode){if(e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length),0==e.length)throw villageDock.open(),new Error("Village dock not open!");e[o].click()}else{if(villageIds=localStorage.getItem("fs_villagedata"),null==villageIds)return void alert("No villages found, please run the script from the overview page to update own villages");villageIds=villageIds.split(","),o=Math.floor(Math.random()*villageIds.length),window.location.href=window.location.href.replace(/(village=)\d+/,"village="+villageIds[o])}}function geu(){var e=[];for(key in troops)0!=troops[key]&&e.push([key,troops[key]]);return e}function guti(e){for(var o=[],t={spear:1,sword:1,axe:1,archer:1,spy:2,light:4,marcher:5,heavy:6,ram:5,catapult:8,knight:10,snob:100},r=[],l=[],a=0,i=0;i<e.length;i++){var n=0;isNaN(Number(e[1]))?e[1].includes("min")?(r.push(e[0]),n=0,l.push(i),e[1].includes("min!")&&(n=minExclamationCount)):"max"==e[1]&&(n=Number($("#units_entry_all_"+e[0])[0].innerText.match(/\d+/)[0])):n=e[1],o.push([e[0],n]),a+=n*t[e[0]]}for(var u=game_data.village.points*populationLim,s=(i=0,[0,3e4*populationLim]);a<u&&0!=r.length;){var c=Number($("#units_entry_all_"+o[l][0])[0].innerText.match(/\d+/g)[0]);if((o[l][1]<c||forceEqualTroopCount)&&o[l][1]<s[0]&&(!distributeByPopulation||o[l][1]<s[0]/t[o[l][0]])&&(o[l][1]+=1,a+=t[o[l][0]]),i<r.length-1?i++:(i=0,s[0]+=1),s[0]>s[1]){o[l][1]+=Math.ceil((u-a)/t[o[l][0]]),a+=t[o[l][0]];break}}return o}function grc(){if(useForumCoords){var e=Timing.getCurrentServerTime(),o=forumLink.split("forum_id=")[1].split("&")[0],t=forumLink.split("thread_id=")[1].split("&")[0],r="fs_coords_"+t+"_"+forumSpoilerName,l="fs_lastforumcheck_"+t+"_"+forumSpoilerName,a=localStorage.getItem(l);if(null!=a&&e-Number(a)<36e5*hoursBeforeCheckingForum)coords=localStorage.getItem(r);else try{$.get("/game.php?screen=forum&screenmode=view_thread&forum_id="+o+"&thread_id="+t).then(function(o){try{if(coords=$(o).find(".spoiler").has("[value='"+forumSpoilerName+"']").find("pre").html(),null==coords)throw Exception;localStorage.setItem(r,coords),localStorage.setItem(l,e.toString())}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to format your coords like this: \n\n["+"spoiler="+forumSpoilerName+"]["+"code]123|456 456|789 876|543["+"/code]["+"/spoiler]"),new Error("Could not get coords!")}},"html"),localStorage.setItem("fs_fakecount",0)}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to include forum1412&thread_id=18009 in your link!"),new Error("Could not get coords!")}}var i=coords.split(" ");return i[Math.floor(Math.random()*i.length)]}function ci(){for(var e=$(".unitsInput","#command-data-form"),o=$(".units-entry-all","#command-data-form"),t=!0,r=0;r<e.length;r++){var l=Number(o[r].innerText.match(/\d+/g)[0]);Number(e[r].value)>l&&(t=!1)}return t}function sc(){for(var e=$("a[href*=village]","#combined_table").has("span"),o="",t=0;t<e.length;t++){var r=e[t].href.split("village=")[1].split("&")[0];o+=t==e.length-1?r:r+","}localStorage.setItem("fs_villagedata",o),alert(e.length+" villages stored!")}m();
Break Down of the attack script
In the script snippets below, you will notice that I have colour coded the first half of the Script. The second half should never be changed
The sections in red are the titles/admin text to explain what the section above or below does.
The Blue sections are then the areas of the script which you can change to suit your needs.
Let's Begin
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/
False = Turned off, true = Turned on
You will notice there are parts there that say false so if you read what they are and decide you want to turn them off or on change the word next to them I.e change false to true or vis versa.
var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,
The next section is the troops and below that blue section is a red section that explains what you can put next to troops.
troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
}, /
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
You should notice your are allowed 4 options, Your own number of troops, min, max and min!.
So min means it'll try and force atleast 1 into the attack rally but if you dont have that type of troop it wont bother.
Max means all of that type of unit will be inserted in the rally point.. I.e you have 6000 axe and it'll input the 6000 axe
min! This will always put a 1 into the rally point for what ever unit you choose, even if you dont have 1 it'll still input it.
False = Turned off, true = Turned on
You will notice there are parts there that say false so if you read what they are and decide you want to turn them off or on change the word next to them I.e change false to true or vis versa.
var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,
The next section is the troops and below that blue section is a red section that explains what you can put next to troops.
troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
}, /
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
You should notice your are allowed 4 options, Your own number of troops, min, max and min!.
So min means it'll try and force atleast 1 into the attack rally but if you dont have that type of troop it wont bother.
Max means all of that type of unit will be inserted in the rally point.. I.e you have 6000 axe and it'll input the 6000 axe
min! This will always put a 1 into the rally point for what ever unit you choose, even if you dont have 1 it'll still input it.
Admin/Tribe setting
/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/
var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,
Above you will see 4 lines of code. In these 4 lines the Script is asking a question do I look for the coords in the fourm. If yes what's the forum link. The forum link is the ending of the url to where you will be hosting the coords.
Next we have the spoiler name coordsA.
This means it will search the forum URL and look for a spoiler called coordsA to which the coords to attack will be inside
coords = "",
populationLim = 0.01;
Lastly if you dont want to attack the tribes coords and want to attack your own you simply change the true to false and then in the section coords = "", you enter your own attack coords
var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,
Above you will see 4 lines of code. In these 4 lines the Script is asking a question do I look for the coords in the fourm. If yes what's the forum link. The forum link is the ending of the url to where you will be hosting the coords.
Next we have the spoiler name coordsA.
This means it will search the forum URL and look for a spoiler called coordsA to which the coords to attack will be inside
coords = "",
populationLim = 0.01;
Lastly if you dont want to attack the tribes coords and want to attack your own you simply change the true to false and then in the section coords = "", you enter your own attack coords
one last thing to add, if you dont use the code bb tags when posting this in the forum or mail itll break the script due to it using coord examples in the bottom section of the script.
it will attempt to read the coords as an actual village which doesn't exsist
Last edited:
Upvote
2