[Pasek] Wystawianie ofert na rynku

  • Rozpoczynający wątek DeletedUser137384
  • Data rozpoczęcia

DeletedUser137384

Guest
Kod skryptu:
Kod:
javascript: doc = document;if (window.frames.length > 0) doc = document.main;url = document.URL;var start = url.indexOf("village");var end = url.indexOf('%26', start);var id;if (end > 0) id = url.substring(start, end);elseid = url.substring(start);if (url.indexOf('screen=market') == -1 || url.indexOf('mode=own_offer') == -1) location.search = '?screen=market&mode=own_offer&' + id;else {    var wood = new Number(doc.getElementById('wood').innerHTML);    var clay = new Number(doc.getElementById('stone').innerHTML);    var iron = new Number(doc.getElementById('iron').innerHTML);    var forms = doc.getElementsByTagName('form');    var table = "";    for (i = 0; i < forms.length && table == ""; i++) {        if (forms[i].action.indexOf('action=modify_offers') != -1) {            table = forms[i].getElementsByTagName('table')[0];        }    }    for (i = 1; table != "" && i < table.rows.length - 1; i++) {        child = table.rows[i].cells[1].childNodes;        res = child[0].title;        num = "";        for (j = 0; j < child.length; j++) {            value = child[j].nodeValue;            if (value != null) num += value;        }        num = num.substring(0, num.length - 1);        num *= new Number(table.rows[i].cells[2].innerHTML);        if (res == 'Wood') wood += num;        if (res == 'Clay') clay += num;        if (res == 'Iron') iron += num;    }    doc.getElementById('res_sell_wood').checked = wood > clay && wood > iron;    doc.getElementById('res_sell_stone').checked = clay > wood && clay > iron;    doc.getElementById('res_sell_iron').checked = iron > clay && iron > wood;    doc.getElementById('res_buy_wood').checked = wood < clay && wood < iron;    doc.getElementById('res_buy_stone').checked = clay < wood && clay < iron;    doc.getElementById('res_buy_iron').checked = iron < clay && iron < wood;    wood = Math.round(wood / 1000);    clay = Math.round(clay / 1000);    iron = Math.round(iron / 1000);    offers = Math.max(Math.max(wood, clay), iron) - Math.min(Math.min(wood, clay), iron);    offers = Math.round(offers / 2);    tables = doc.getElementsByTagName('table');    for (i = 0; i < tables.length; i++) {        cell = tables[i].rows[0].cells[0].innerHTML;        if (cell.indexOf('Merchants:') == 0) {            offers = Math.min(offers, new Number(cell.substring(cell.indexOf(' ') + 1, cell.indexOf('/'))));        }    }if(offers>Data.Trader.amount) offers=Data.Trader.amount;    inputs = doc.getElementsByTagName('input');    for (i = 0; i < inputs.length; i++) {        if (inputs[i].value == 'Create') inputs[i].focus();    }    doc.getElementsByName('multi')[0].value = offers;    doc.getElementsByName[B]('max_time')[0].value = 40[/B];    doc.getElementsByName('sell')[0].value = 1000;    doc.getElementsByName('buy')[0].value = 1000;}end();

Kod skryptu do pobrania na stronie Skryptoteki.



JAK TO WYGLĄDA W PRAKTYCE?

1) Instalujemy skrypt w pasku skrótów (instrukcja)


2) Skrypt można uruchomić praktycznie z każdego przeglądu. Wystarczy kliknąć go i zostaniemy przekierowani do Rynku.
hX2bRYg.jpg


3) Klikamy ponownie na skrypt, który tworzy ofertę: wpisuje automatycznie ilości surowców, jakich potrzebujemy i jakich chcemy się "pozbyć" (skrypt stara się "wyrównać" liczbę surowca, którego jest najwięcej, z surowcem, którego jest w danej wiosce najmniej), a także wpisuje maksymalny czas podróży kupców.
FPNgaxY.jpg

4) Teraz wystarczy kliknąć "Utwórz" i oferta jest gotowa.
xm4RuVE.jpg



Zmiana maksymalnego czasu trwania podróży
W skrypcie automatycznie wpisuje nam maksymalny czas trwania podróży 40h. Jeśli to dla Was za długo/krótko i chcecie to zmienić, wystarczy poprawić ten fragment: ('max_time')[0].value = 40; (pogrubiłam go w kodzie skryptu wyżej) - zamiast 40 wpisujecie, jaki Wam odpowiada maksymalny czas trwania podróży.
 
Ostatnio edytowane przez moderatora:

DeletedUser169954

Guest
Co zrobić żeby zamiast żelaza ustawiało automatycznie premkę ? zamiast iron wpisać coś innego ?
 
Do góry