Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Travian & over
- // @namespace travian
- // @description Script for Travian 4 to get some nice informations
- // @author AGF2413
- // @include *.travian.*
- // @grant GM_addStyle
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
- // @version 0.1.3
- // ==/UserScript==
- this.$ = this.jQuery = jQuery.noConflict(true);
- $( document ).ready(function() {
- setResourceBar();
- });
- function setResourceBar() {
- //Wood
- $("#stockBarResource1").append("<div class='t&b-rbar'>"+rSpaceLeft("l1")+"<br />"+secondsToTime(rSpaceLeft("l1")/resources.production['l1']*3600)+"</div>");
- //clay
- $("#stockBarResource2").append(rSpaceLeft("l2")+"<br />"+secondsToTime(rSpaceLeft("l2")/resources.production['l2']*3600));
- //iron
- $("#stockBarResource3").append(rSpaceLeft("l3")+"<br />"+secondsToTime(rSpaceLeft("l3")/resources.production['l3']*3600));
- //grain
- $("#stockBarResource4").append(rSpaceLeft("l4")+"<br />"+secondsToTime(rSpaceLeft("l4")/resources.production['l4']*3600));
- }
- function rSpaceLeft(resourceType) {
- return resources.maxStorage[resourceType]-resources.storage[resourceType];
- }
- function secondsToTime(totalSec) {
- console.log("TotalSec:"+totalSec);
- var days = parseInt( totalSec / 86400 ) % 360;
- var hours = parseInt( totalSec / 3600 ) % 24;
- var minutes = parseInt( totalSec / 60 ) % 60;
- var seconds = parseInt(totalSec % 60);
- return days+"d"+hours+"h"+minutes+"m"+seconds+"s";
- }
- GM_addStyle("#stockBarResource1 { color: red; }");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement