Kittens Game Data output

enter something useful

Verze ze dne 03. 06. 2015. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Kittens Game Data output
// @namespace    https://greasyfork.org/en/users/11994-yuriy-stejko
// @version      0.1
// @description  enter something useful
// @author       You
// @match        http://bloodrizer.ru/games/kittens/
// @grant        none
// ==/UserScript==

function initiate_script() {
    var data_out = document.createElement('div');
    data_out.id = 'data_container';
    data_out.style.width = '100%';
    data_out.style.height = '150px';
    data_out.style.bottom = '0px';
    data_out.style.position = 'absolute';
    data_out.innerHTML = '<div style="float: left; width: 340px;"><table id="food_table" table-layout: fixed;></table></div><div style="float: left; width: 340px;"> <table id="food_table_season" table-layout: fixed;></table></div>';
    document.body.appendChild(data_out);
    
    document.getElementById('data_container').style.display = '';
    document.getElementById('game').style.marginBottom = '200px';
    document.getElementById('footerLinks').style.marginBottom = '150px';
    document.body.style.backgroundPosition = 'center bottom 30px';
}

if (!document.getElementById('data_container')) {
  initiate_script();
}

function calculate_food_data(weather_ratio_val, seconds) {
    var total_value = '';
    var total = 0;
    var subtotal = 0;
    
    total += gamePage.getEffect("catnip" + "PerTickBase")*5
    total *= 1+weather_ratio_val;
    
    var resMapProduction = gamePage.village.getResProduction();
    subtotal = resMapProduction['catnip']*5 || 0;
    subtotal *= 1+(gamePage.workshop.getEffect('catnip' + "Ratio"))
    
    total += subtotal;
    
    total *= 1+(gamePage.bld.getEffect('catnip' + "Ratio"))
    
    total *= (1 + gamePage.space.getEffect('catnip' + "Ratio"))
    
    total *= (1 + gamePage.religion.getEffect('catnip' + "Ratio"))
    
    var paragonRatio = gamePage.resPool.get("paragon").value * 0.01;
    paragonRatio = gamePage.bld.getHyperbolicEffect(paragonRatio, 2);
    
    total *= 1+paragonRatio
    
    if (gamePage.religion.getRU("solarRevolution").researched){
        total *= 1+(gamePage.religion.getProductionBonus() / 100)
	}
    
    var resMapConsumption = gamePage.village.getResConsumption();
    var resConsumption = resMapConsumption['catnip'] || 0;
    resConsumption = resConsumption * (1 + gamePage.bld.getEffect('catnip' + "DemandRatio", true));
    resConsumption *= 5;
    
    total += resConsumption;
    
    total *= seconds;
    
    if(total>1000){
        total = total / 1000;
        total = total.toFixed(1);
        total_value += total;
        total_value += ' k';
    }else{
        total = total.toFixed(2);
        total_value += total;
    }
    
    return total_value;
}

function generate_food_table(seconds, label) {
    var contents = '';
    //Define the table colomn widths
    contents += '<col width="100">';
    contents += '<col width="60">';
    contents += '<col width="60">';
    contents += '<col width="60">';
    contents += '<col width="60">';
    //The top of the table, describing what it is showing. Leave once cell blank at the start
    contents += '<tr>';
    contents += '<td style="text-align:center">'
    contents += ' '
    contents += '</td>';
    contents += '<td style="text-align:center" colspan="4">'
    contents += label
    contents += '</td>';
    contents += '</tr>';
    //Second level of the top of the table, describing what it is showing. Leave once cell blank at the start
    contents += '<tr>';
    contents += '<td style="text-align:center">'
    contents += ' '
    contents += '</td>';
    contents += '<td style="text-align:center">'
    contents += 'Winter'
    contents += '</td> <td style="text-align:center">'
    contents += 'Spring'
    contents += '</td> <td style="text-align:center">'
    contents += 'Summer'
    contents += '</td> <td style="text-align:center">'
    contents += 'Fall'
    contents += '</td>';
    contents += '</tr>';
    //Data for a good season
    contents += '<tr>';
    contents += '<td style="text-align:center">'
    contents += 'Good season'
    contents += '</td>';
    contents += '<td style="text-align:center">'
    contents += calculate_food_data(-0.60, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.65, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.15, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.15, seconds)
    contents += '</td>';
    contents += '</tr>';
    //Data for an average season
    contents += '<tr>';
    contents += '<td style="text-align:center">'
    contents += 'Normal season'
    contents += '</td>';
    contents += '<td style="text-align:center">'
    contents += calculate_food_data(-0.75, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.50, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.0, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.0, seconds)
    contents += '</td>';
    contents += '</tr>';
    //Data for a bad season
    contents += '<tr>';
    contents += '<td style="text-align:center">'
    contents += 'Bad season'
    contents += '</td>';
    contents += '<td style="text-align:center">'
    contents += calculate_food_data(-0.90, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(0.35, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(-0.15, seconds)
    contents += '</td> <td style="text-align:center">'
    contents += calculate_food_data(-0.15, seconds)
    contents += '</td>';
    contents += '</tr>';
    return contents
}

function output_data() {
    document.getElementById('food_table').innerHTML = generate_food_table(1, 'Food during seasons (/s)');
    document.getElementById('food_table_season').innerHTML = generate_food_table(200, 'Food during seasons (/season)');
}

setInterval(output_data, 200);