mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
Added some init functions to the engine's init(). Began writing out the hack function for servers
This commit is contained in:
parent
4057f946d8
commit
4517020719
@ -57,6 +57,14 @@ Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, i
|
|||||||
this.maxRam = maxRam;
|
this.maxRam = maxRam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Hack a server. Return the amount of money hacked.
|
||||||
|
//This assumes that the server being hacked is not purchased by the palyer, that the player's hacking skill is greater than the
|
||||||
|
//required hacking skill and that the player has admin rights.
|
||||||
|
Server.prototype.hack = function(hackingSkill) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Set the hacking properties of a server
|
//Set the hacking properties of a server
|
||||||
Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) {
|
Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) {
|
||||||
this.requiredHackingSkill = requiredHackingSkill;
|
this.requiredHackingSkill = requiredHackingSkill;
|
||||||
|
@ -53,8 +53,12 @@ var Terminal = {
|
|||||||
//You can't hack your home pc or servers you purchased
|
//You can't hack your home pc or servers you purchased
|
||||||
if (Player.currentServer.purchasedByPlayer) {
|
if (Player.currentServer.purchasedByPlayer) {
|
||||||
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");
|
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");
|
||||||
|
} else if (Player.currentServer.hasAdminRights == false ) {
|
||||||
|
post("You do not have admin rights for this machine! Cannot hack");
|
||||||
|
} else if (Player.currentServer.requiredHackingSkill > Player.hacking_skill) {
|
||||||
|
post("Your hacking skill is not high enough to attempt hacking this machine");
|
||||||
} else {
|
} else {
|
||||||
|
var hackResult = Player.currentServer.hack();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "help":
|
case "help":
|
||||||
|
@ -144,6 +144,9 @@ var Engine = {
|
|||||||
//Initialize Player objects
|
//Initialize Player objects
|
||||||
Player.init();
|
Player.init();
|
||||||
|
|
||||||
|
//Initialize foreign servers
|
||||||
|
ForeignServers.init();
|
||||||
|
|
||||||
//Load, save, and delete buttons
|
//Load, save, and delete buttons
|
||||||
//Engine.Clickables.saveButton = document.getElementById("save");
|
//Engine.Clickables.saveButton = document.getElementById("save");
|
||||||
//Engine.Clickables.saveButton.addEventListener("click", function() {
|
//Engine.Clickables.saveButton.addEventListener("click", function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user