Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(typeof CHBuildingIncSize !='undefined'){
- alert("CivHelper already loaded. Reload page to reload");
- }
- else{
- var CHBuildingIncSize = 1000;
- var CHJobIncSize = 100;
- CHLoad();
- }
- function CHLoad(){
- /*$('#buildingsPane > h3').after('<p>Size of CivHelper incrementer <input size=5 type="test" id="CHBuildingIncSize" value="'+CHBuildingIncSize+'"/><input type="button" id="CHBuildingIncSubmit" value="Update"/></p>');
- $('#buildings .x1000').each(function(){
- var onclickval = $(this).attr('onclick');
- var item = onclickval.split('(')[1].split(',')[0];
- $(this).html('xCH');
- $(this).attr('onclick','CHcreateBuilding('+item+');');
- //$(this).after('<button class="x1000" onClick="CHcreateBuilding('+item+')">CH</button>');
- });
- $('#CHBuildingIncSubmit').click(CHupdateBuildingSize);
- $("#CHBuildingIncSize").keyup(function(event){
- if(event.keyCode == 13){
- CHupdateBuildingSize();
- }
- });
- // $("#population > h3 :contains('Jobs')").after('<p>Size of CivHelper incrementer <input size=5 type="test" id="CHJobIncSize" value="'+CHJobIncSize+'"/><input type="button" id="CHJobIncSubmit" value="Update"/></p>');
- $("#jobs").before('<p>Size of CivHelper incrementer <input size=5 type="test" id="CHJobIncSize" value="'+CHJobIncSize+'"/><input type="button" id="CHJobIncSubmit" value="Update"/></p>');
- $('#jobs .job100 button').each(function(){
- var onclickval = $(this).attr('onclick');
- if(!onclickval) return;
- var itemtype = onclickval.split('(')[0];
- //var item = onclickval.split('(')[1].split(',')[0].replace("'","",'g');
- var item = onclickval.split('(')[1].split(',')[0];
- if(itemtype=='fire'){
- $(this).html('-CH');
- $(this).attr('onclick','CHfireJob('+item+');');
- //$(this).before('<button onClick="CHfireJob('+item+')">-CH</button>');
- }
- else{
- $(this).html('+CH');
- $(this).attr('onclick','CHhireJob('+item+');');
- //$(this).after('<button onClick="CHhireJob('+item+')">+CH</button>');
- }
- });
- $('#CHJobIncSubmit').click(CHupdateJobSize);
- $("#CHJobIncSize").keyup(function(event){
- if(event.keyCode == 13){
- CHupdateJobSize();
- }
- });*/
- var Empire = $('#raidEmpire');
- Empire.after('<p>This is getting ridiculous. Continue at your own peril.</p><button id="CHraidPlanet" onClick="CHinvade(\'planet\')" disabled>Raid Planet</button>');
- $('#CHraidPlanet').after('<br/><button id="CHraidSystem" onClick="CHinvade(\'system\')" disabled>Raid Solar System</button>');
- $('#CHraidSystem').after('<br/><button id="CHraidSector" onClick="CHinvade(\'sector\')" disabled>Raid Planetary Sector</button>');
- $('#CHraidSector').after('<br/><button id="CHraidSSector" onClick="CHinvade(\'ssector\')" disabled>Raid Star Sector</button>');
- $('#CHraidSSector').after('<br/><button id="CHraidQuadrant" onClick="CHinvade(\'quadrant\')" disabled>Raid Galactic Quadrant</button>');
- $('#CHraidQuadrant').after('<br/><button id="CHraidGalaxy" onClick="CHinvade(\'galaxy\')" disabled>Raid Entire Galaxy!</button>');
- //alert(Empire.prop('disabled'));
- if(!Empire.prop('disabled')){
- $('#CHraidPlanet').removeAttr('disabled');
- $('#CHraidSystem').removeAttr('disabled');
- $('#CHraidSector').removeAttr('disabled');
- $('#CHraidSSector').removeAttr('disabled');
- $('#CHraidQuadrant').removeAttr('disabled');
- $('#CHraidGalaxy').removeAttr('disabled');
- }
- Empire.click(function(){
- if(!$(this).prop('disabled')){
- $('#CHraidPlanet').removeAttr('disabled');
- $('#CHraidSystem').removeAttr('disabled');
- $('#CHraidSector').removeAttr('disabled');
- $('#CHraidSSector').removeAttr('disabled');
- $('#CHraidQuadrant').removeAttr('disabled');
- $('#CHraidGalaxy').removeAttr('disabled');
- }
- });
- }
- function CHinvade(ecivtype){
- //basically rewriting the invade function
- //I feel a little dirty doing this
- //invades a certain type of civilisation based on the button clicked
- var iterations = 0; //used to calculate random number of soldiers
- if (ecivtype == "planet"){
- raiding.raiding = true;
- raiding.last = 'planet';
- iterations = 1000000; //fuck it, planets have large armies, OK?
- }
- if (ecivtype == "system"){
- raiding.raiding = true;
- raiding.last = 'system';
- iterations = 5000000; //systems are even bigger.
- }
- if (ecivtype == "sector"){
- raiding.raiding = true;
- raiding.last = 'sector';
- iterations = 10000000; //you asked for it
- }
- if (ecivtype == "ssector"){
- raiding.raiding = true;
- raiding.last = 'ssector';
- iterations = 100000000; //you asked for it
- }
- if (ecivtype == "quadrant"){
- raiding.raiding = true;
- raiding.last = 'quadrant';
- iterations = 1000000000; //quadrants are way bigger than sectors
- }
- if (ecivtype == "galaxy"){
- raiding.raiding = true;
- raiding.last = 'galaxy';
- iterations = 4000000000; //galaxies only have 4 quadrants
- }
- if (gloryTimer > 0) iterations = (iterations * 2); //doubles soldiers fought
- var esoldierRes = iterations + Math.floor(Math.random() * iterations * 4);
- var efortsRes = Math.floor(Math.random() * Math.pow(1.6,Math.log(iterations)));
- population.esoldiers += esoldierRes;
- population.esoldiersCas += esoldierRes;
- population.eforts += efortsRes;
- if (gloryTimer > 0) iterations = (iterations * 2); //quadruples rewards (doubled here because doubled already above)
- raiding.iterations = iterations;
- updateTargets(); //updates largest raid target
- updateParty();
- document.getElementById('raidGroup').style.display = 'none'; //Hides raid buttons until the raid is finished
- }
- /*function CHupdateBuildingSize(){
- var newBuildingIncSize = parseInt($('#CHBuildingIncSize').val());
- if(newBuildingIncSize == CHBuildingIncSize) return;
- if(isNaN(newBuildingIncSize)){
- alert('Try Again');
- $('#CHBuildingIncSize').val(CHBuildingIncSize);
- }
- else{
- CHBuildingIncSize = newBuildingIncSize;
- }
- }
- function CHupdateJobSize(){
- var newJobIncSize = parseInt($('#CHJobIncSize').val());
- if(newJobIncSize == CHJobIncSize) return;
- if(isNaN(newJobIncSize)){
- alert('Try Again');
- $('#CHJobIncSize').val(CHJobIncSize);
- }
- else{
- CHJobIncSize = newJobIncSize;
- }
- }
- function CHcreateBuilding(building){
- createBuilding(building,CHBuildingIncSize);
- }
- function CHfireJob(job){
- fire(job,CHJobIncSize);
- }
- function CHhireJob(job){
- hire(job,CHJobIncSize);
- }*/
Advertisement
Add Comment
Please, Sign In to add comment