Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:
- var GetNumber = function (x)
- {
- return parseInt(x.replace(/<span class="grey">.<\/span>/g, '').match(/\d+/));
- };
- $('tbody').find('tr.supply_location').each(function()
- {
- var traders = GetNumber($(this).find('td.traders')[0].innerHTML);
- var wood = GetNumber($(this).find('span[class *= "wood"]')[0].innerHTML);
- var stone = GetNumber($(this).find('span[class *= "stone"]')[0].innerHTML);
- var iron = GetNumber($(this).find('span[class *= "iron"]')[0].innerHTML);
- var totalresources = wood + stone + iron;
- var checkValue = Math.min(wood,stone,iron);
- if(traders > 0 && totalresources * 3 > traders*1000 && checkValue > 1000)
- {
- var button = $(this).find('input.call_button.btn');
- if(button.val() == "Selecteren")
- {
- button.click();
- var MaxGoldCoins = Math.min(wood/28000,stone/30000,iron/25000);
- wood = Math.floor(MaxGoldCoins*28000);
- stone = Math.floor(MaxGoldCoins*30000);
- iron = Math.floor(MaxGoldCoins*25000);
- totalresources = wood + stone + iron;
- if (totalresources > traders*1000)
- {
- MaxGoldCoins = traders / 83;
- wood = Math.floor(MaxGoldCoins*28000);
- stone = Math.floor(MaxGoldCoins*30000);
- iron = Math.floor(MaxGoldCoins*25000);
- }
- this.children[2].children[1].value = wood;
- this.children[3].children[1].value = stone;
- this.children[4].children[1].value = iron;
- }
- else
- {
- button.click();
- return false;
- }
- }
- });
- void(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement