Features found in TribalWars js files

This page describes a list of features found in the JS files of the game, which can be useful for scripting.

Interesting URLs

https://help.tribalwars.nl/wiki/Wereld_Data

https://nlp9.tribalwars.nl/interface.php?func=get_config
https://nlp9.tribalwars.nl/interface.php?func=get_building_info
https://nlp9.tribalwars.nl/interface.php?func=get_unit_info
https://nlp9.tribalwars.nl/interface.php?func=get_conquer&since=1587946846 (since can be max 24h back.)

(Replace nlp9 with the required server.)

Resources

ResourcesForecaster.fetchSchedules(window.game_data.village.id,(oSchedule)=>{window.oSchedule = oSchedule;console.log(ResourcesForecaster.getForecast(new Resources(20000,10000,10000), game_data.village, oSchedule.rates, oSchedule.amounts))});//Shows when you'll have the given resources. TODO: Figure out if it's possible for other villages.
//WIP: Prgress on figuring out how to use it in other vilages:
ResourcesForecaster.fetchSchedules(2406,(oSchedule)=>{window.oSchedule = oSchedule;console.log(new Date(ResourcesForecaster.getForecast(new Resources(100,100,100), {"wood_float":0,"wood_prod":2,"stone_float":0,"stone_prod":2,"iron_float":0,"iron_prod":2,"storage_max":40000}, oSchedule.rates, oSchedule.amounts).when * 1000))});

Villages

VillageGroupMenu;//TODO: Figure out what this does. Looks interesting though.

Commands

let iCommandID = 12171160;Command.loadDetailsForTooltip({trigger:(eEvent)=>{console.log(Command.details_cache[iCommandID])}},iCommandID);//See command URL for command ID. Retrieves all details of the given command and saves them in a cache. Potentially very useful together with localstorage?
Place.confirmScreen.addAdditionalAttack();//This function allows sending multiple attacks at once, if enough snobs are available. Copy-paste-modify and it works without? To be tested. - Edit: Does not work without snobs, server-side error.

Units

UnitPopup.fetchData(()=>{console.log(UnitPopup.unit_data);});//Show all unit data. Build-time, speed, attack, etc.

Others

STracking;//Seems to be session-tracking? Encoded code, so probably do-not-touch.
BotProtect;//Leave untouched. Probably not allowed to hook into this.
define("Ig/TribalWars/Modules/TimedCommandQueue", function() {/*...*/});//TODO: Figure out what it does, and what it's used for. Seems to be disabled... Maybe used on different pages?
var csrf_token="some token";//Used to confirm specific actions like build commands. Without it, when attempting those actions, you get the error "this might happen when you logged in on a different computer."

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA ImageChange Image