Skip to content

Instantly share code, notes, and snippets.

@dube116
Last active March 12, 2019 13:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dube116/20c7798c6c1a4baffb857721055bde0f to your computer and use it in GitHub Desktop.
Save dube116/20c7798c6c1a4baffb857721055bde0f to your computer and use it in GitHub Desktop.
og api
buildingData = {'metalMine':{'id':1, 'type':'supply'},
'crystalMine':{'id':2, 'type':'supply'},
'deuteriumSynthesizer':{'id':3, 'type':'supply'},
'solarPlant':{'id':4, 'type':'supply'},
'fusionReactor':{'id':12, 'type':'supply'},
'solarSatellite':{'id':212, 'type':'supply'},
'metalStorage':{'id':22, 'type':'supply'},
'crystalStorage':{'id':23, 'type':'supply'},
'deuteriumTank':{'id':24, 'type':'supply'},
'roboticsFactory':{'id':14, 'type':'station'},
'shipyard':{'id':21, 'type':'station'},
'researchLab':{'id':31, 'type':'station'},
'allianceDepot':{'id':34, 'type':'station'},
'missileSilo':{'id':44, 'type':'station'},
'naniteFactory':{'id':15, 'type':'station'},
'terraformer':{'id':33, 'type':'station'},
'spaceDock':{'id':36, 'type':'station'},
'lunarBase':{'id':41, 'type':'station'},
'sensorPhalanx':{'id':42, 'type':'station'},
'jumpGate':{'id':43, 'type':'station'}
}
function clickDetailButton(name){
$("."+buildingData[name].type+buildingData[name].id+">div>.detail_button").click();
}
function enegryIsNegative(){
return resourceIsFull('energy');
}
function getBuildingLevel(name){
return parseInt($("."+buildingData[name].type+buildingData[name].id+">.buildingimg>a>.ecke>.level"));
}
function getEnergy(){
return getResource('energy');
}
function getResource(name){
//metal, crystal, deuterium, darkmatter
return parseInt($("#resources_"+name).text().replace(/[^0-9]/g,""));
}
function resourceIsFull(name){
//metal, crystal, deuterium
return $("#resources_"+name).hasClass("overmark");
}
function upgradeBuilding(name){
$("."+buildingData[name].type+buildingData[name].id+">.buildingimg>.fastBuild").click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment