From ac3e5c8c9e760bfd0385be87c27f97bfeade3e60 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Wed, 7 Jun 2017 18:35:56 -0500 Subject: [PATCH] Added Deepscan to darkweb. Cannot get invited to faction if you decline --- index.html | 2 + src/DarkWeb.js | 32 +++++++++++++--- src/Faction.js | 71 +++++++++++++++++------------------ src/SaveObject.js | 22 ++++++++--- utils/FactionInvitationBox.js | 23 ++++-------- 5 files changed, 87 insertions(+), 63 deletions(-) diff --git a/index.html b/index.html index 5067e3572..fce111073 100644 --- a/index.html +++ b/index.html @@ -749,6 +749,8 @@
Changelog Save Game + Export Game + Import Game Delete Game (DEBUG) Delete Active Scripts diff --git a/src/DarkWeb.js b/src/DarkWeb.js index 6d0299f0c..9c3bfd377 100644 --- a/src/DarkWeb.js +++ b/src/DarkWeb.js @@ -47,7 +47,7 @@ listAllDarkwebItems = function() { } buyDarkwebItem = function(itemName) { - if (itemName.toLowerCase() == "brutessh.exe") { + if (itemName.toLowerCase() == Programs.BruteSSHProgram.toLowerCase()) { var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram); if (price > 0 && Player.money >= price) { Player.loseMoney(price); @@ -57,7 +57,7 @@ buyDarkwebItem = function(itemName) { } else { post("Not enough money to purchase " + itemName); } - } else if (itemName.toLowerCase() == "ftpcrack.exe") { + } else if (itemName.toLowerCase() == Programs.FTPCrackProgram.toLowerCase()) { var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram); if (price > 0 && Player.money >= price) { Player.loseMoney(price); @@ -67,7 +67,7 @@ buyDarkwebItem = function(itemName) { } else { post("Not enough money to purchase " + itemName); } - } else if (itemName.toLowerCase() == "relaysmtp.exe") { + } else if (itemName.toLowerCase() == Programs.RelaySMTPProgram.toLowerCase()) { var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram); if (price > 0 && Player.money >= price) { Player.loseMoney(price); @@ -77,7 +77,7 @@ buyDarkwebItem = function(itemName) { } else { post("Not enough money to purchase " + itemName); } - } else if (itemName.toLowerCase() == "httpworm.exe") { + } else if (itemName.toLowerCase() == Programs.HTTPWormProgram.toLowerCase()) { var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram); if (price > 0 && Player.money >= price) { Player.loseMoney(price); @@ -87,7 +87,7 @@ buyDarkwebItem = function(itemName) { } else { post("Not enough money to purchase " + itemName); } - } else if (itemName.toLowerCase() == "sqlinject.exe") { + } else if (itemName.toLowerCase() == Programs.SQLInjectProgram.toLowerCase()) { var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram); if (price > 0 && Player.money >= price) { Player.loseMoney(price); @@ -97,6 +97,26 @@ buyDarkwebItem = function(itemName) { } else { post("Not enough money to purchase " + itemName); } + } else if (itemName.toLowerCase() == Programs.DeepscanV1.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program); + if (price > 0 && Player.money >= price) { + Player.loseMoney(price); + Player.getHomeComputer().programs.push(Programs.DeepscanV1); + post("You have purchased the DeepscanV1.exe program. The new program " + + "can be found on your home computer."); + } else { + post("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == Programs.DeepscanV2.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program); + if (price > 0 && Player.money >= price) { + Player.loseMoney(price); + Player.getHomeComputer().programs.push(Programs.DeepscanV2); + post("You have purchased the DeepscanV2.exe program. The new program " + + "can be found on your home computer."); + } else { + post("Not enough money to purchase " + itemName); + } } else { post("Unrecognized item"); } @@ -129,4 +149,6 @@ DarkWebItems = { RelaySMTPProgram: Programs.RelaySMTPProgram + " - $5,000,000 - Opens up SMTP Ports", HTTPWormProgram: Programs.HTTPWormProgram + " - $30,000,000 - Opens up HTTP Ports", SQLInjectProgram: Programs.SQLInjectProgram + " - $250,000,000 - Opens up SQL Ports", + DeepScanV1Program: Programs.DeepscanV1 + " - $500,000 - Enables 'scan-analyze' with a depth up to 5", + DeepScanV2Program: Programs.DeepscanV2 + " - $25,000,000 - Enables 'scan-analyze' with a depth up to 10", } \ No newline at end of file diff --git a/src/Faction.js b/src/Faction.js index 6f71b507b..30d9a6f7e 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -189,7 +189,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Illuminati var illuminatiFac = Factions["Illuminati"]; - if (illuminatiFac.isBanned == false && illuminatiFac.isMember == false && + if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited && this.numAugmentations >= 10 && this.money >= 10000000000 && this.total_money >= 20000000000 && this.hacking_skill >= 800 && this.total_hacking >= 7000 && @@ -202,7 +202,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Daedalus var daedalusFac = Factions["Daedalus"]; - if (daedalusFac.isBanned == false && daedalusFac.isMember == false && + if (!daedalusFac.isBanned && !daedalusFac.isMember && !daedalusFac.alreadyInvited && this.numAugmentations >= 15 && this.money >= 1000000000 && this.total_money >= 10000000000 && this.hacking_skill >= 1000 && this.total_hacking >= 10000 && @@ -215,7 +215,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //The Covenant var covenantFac = Factions["The Covenant"]; - if (covenantFac.isBanned == false && covenantFac.isMember == false && + if (!covenantFac.isBanned && !covenantFac.isMember && !covenantFac.alreadyInvited && this.numAugmentations >= 12 && this.money >= 5000000000 && this.total_money >= 10000000000 && this.hacking_skill >= 850 && this.total_hack >= 5000 && @@ -228,63 +228,65 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //ECorp var ecorpFac = Factions["ECorp"]; - if (ecorpFac.isBanned == false && ecorpFac.isMember == false && + if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited && this.companyName == Locations.AevumECorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(ecorpFac); } //MegaCorp var megacorpFac = Factions["MegaCorp"]; - if (megacorpFac.isBanned == false && megacorpFac.isMember == false && + if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited && this.companyName == Locations.Sector12MegaCorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(megacorpFac); } //Bachman & Associates var bachmanandassociatesFac = Factions["Bachman & Associates"]; - if (bachmanandassociatesFac.isBanned == false && bachmanandassociatesFac.isMember == false && + if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember && + !bachmanandassociatesFac.alreadyInvited && this.companyName == Locations.AevumBachmanAndAssociates && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(bachmanandassociatesFac); } //Blade Industries var bladeindustriesFac = Factions["Blade Industries"]; - if (bladeindustriesFac.isBanned == false && bladeindustriesFac.isMember == false && + if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited && this.companyName == Locations.Sector12BladeIndustries && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(bladeindustriesFac); } //NWO var nwoFac = Factions["NWO"]; - if (nwoFac.isBanned == false && nwoFac.isMember == false && + if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited && this.companyName == Locations.VolhavenNWO && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(nwoFac); } //Clarke Incorporated var clarkeincorporatedFac = Factions["Clarke Incorporated"]; - if (clarkeincorporatedFac.isBanned == false && clarkeincorporatedFac.isMember == false && + if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited && this.companyName == Locations.AevumClarkeIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(clarkeincorporatedFac); } //OmniTek Incorporated var omnitekincorporatedFac = Factions["OmniTek Incorporated"]; - if (omnitekincorporatedFac.isBanned == false && omnitekincorporatedFac.isMember == false && + if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited && this.companyName == Locations.VolhavenOmniTekIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(omnitekincorporatedFac); } //Four Sigma var foursigmaFac = Factions["Four Sigma"]; - if (foursigmaFac.isBanned == false && foursigmaFac.isMember == false && + if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited && this.companyName == Locations.Sector12FourSigma && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(foursigmaFac); } //KuaiGong International var kuaigonginternationalFac = Factions["KuaiGong International"]; - if (kuaigonginternationalFac.isBanned == false && kuaigonginternationalFac.isMember == false && + if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember && + !kuaigonginternationalFac.alreadyInvited && this.companyName == Locations.ChongqingKuaiGongInternational && companyRep >= CONSTANTS.CorpFactionRepRequirement) { invitedFactions.push(kuaigonginternationalFac); } @@ -295,7 +297,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() { if (fulcrumSecretServer == null) { console.log("ERROR: Could not find Fulcrum Secret Technologies Server"); } else { - if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false && + if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember && + !fulcrumsecrettechonologiesFac.alreadyInvited && fulcrumSecretServer.manuallyHacked && this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) { invitedFactions.push(fulcrumsecrettechonologiesFac); @@ -308,8 +311,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() { var bitrunnersServer = AllServers[SpecialServerIps[SpecialServerNames.BitRunnersServer]]; if (bitrunnersServer == null) { console.log("ERROR: Could not find BitRunners Server"); - } else if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false && bitrunnersServer.manuallyHacked && - this.hacking_skill >= 500 && homeComp.maxRam >= 128) { + } else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked && + !bitrunnersFac.alreadyInvited && this.hacking_skill >= 500 && homeComp.maxRam >= 128) { invitedFactions.push(bitrunnersFac); } @@ -319,7 +322,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { if (blackhandServer == null) { console.log("ERROR: Could not find The Black Hand Server"); } else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked && - this.hacking_skill >= 350 && homeComp.maxRam >= 64) { + !theblackhandFac.alreadyInvited && this.hacking_skill >= 350 && homeComp.maxRam >= 64) { invitedFactions.push(theblackhandFac); } @@ -329,55 +332,55 @@ PlayerObject.prototype.checkForFactionInvitations = function() { if (nitesecServer == null) { console.log("ERROR: Could not find NiteSec Server"); } else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked && - this.hacking_skill >= 200 && homeComp.maxRam >= 32) { + !nitesecFac.alreadyInvited && this.hacking_skill >= 200 && homeComp.maxRam >= 32) { invitedFactions.push(nitesecFac); } //Chongqing var chongqingFac = Factions["Chongqing"]; - if (chongqingFac.isBanned == false && chongqingFac.isMember == false && + if (!chongqingFac.isBanned && !chongqingFac.isMember && !chongqingFac.alreadyInvited && this.money >= 20000000 && this.city == Locations.Chongqing) { invitedFactions.push(chongqingFac); } //Sector-12 var sector12Fac = Factions["Sector-12"]; - if (sector12Fac.isBanned == false && sector12Fac.isMember == false && + if (!sector12Fac.isBanned && !sector12Fac.isMember && !sector12Fac.alreadyInvited && this.money >= 15000000 && this.city == Locations.Sector12) { invitedFactions.push(sector12Fac); } //New Tokyo var newtokyoFac = Factions["New Tokyo"]; - if (newtokyoFac.isBanned == false && newtokyoFac.isMember == false && + if (!newtokyoFac.isBanned && !newtokyoFac.isMember && !newtokyoFac.alreadyInvited && this.money >= 20000000 && this.city == Locations.NewTokyo) { invitedFactions.push(newtokyoFac); } //Aevum var aevumFac = Factions["Aevum"]; - if (aevumFac.isBanned == false && aevumFac.isMember == false && + if (!aevumFac.isBanned && !aevumFac.isMember && !aevumFac.alreadyInvited && this.money >= 40000000 && this.city == Locations.Aevum) { invitedFactions.push(aevumFac); } //Ishima var ishimaFac = Factions["Ishima"]; - if (ishimaFac.isBanned == false && ishimaFac.isMember == false && + if (!ishimaFac.isBanned && !ishimaFac.isMember && !ishimaFac.alreadyInvited && this.money >= 30000000 && this.city == Locations.Ishima) { invitedFactions.push(ishimaFac); } //Volhaven var volhavenFac = Factions["Volhaven"]; - if (volhavenFac.isBanned == false && volhavenFac.isMember == false && + if (!volhavenFac.isBanned && !volhavenFac.isMember && !volhavenFac.alreadyInvited && this.money >= 50000000 && this.city == Locations.Volhaven) { invitedFactions.push(volhavenFac); } //Speakers for the Dead var speakersforthedeadFac = Factions["Speakers for the Dead"]; - if (speakersforthedeadFac.isBanned == false && speakersforthedeadFac.isMember == false && + if (!speakersforthedeadFac.isBanned && !speakersforthedeadFac.isMember && !speakersforthedeadFac.alreadyInvited && this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 && this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 10 && this.numPeopleKilledTotal >= 100 && this.karma <= -45 && this.companyName != Locations.Sector12CIA && @@ -387,7 +390,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //The Dark Army var thedarkarmyFac = Factions["The Dark Army"]; - if (thedarkarmyFac.isBanned == false && thedarkarmyFac.isMember == false && + if (!thedarkarmyFac.isBanned && !thedarkarmyFac.isMember && !thedarkarmyFac.alreadyInvited && this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 && this.dexterity >= 300 && this.agility >= 300 && this.city == Locations.Chongqing && this.numPeopleKilled >= 5 && this.karma <= -45 && this.companyName != Locations.Sector12CIA && @@ -397,7 +400,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //The Syndicate var thesyndicateFac = Factions["The Syndicate"]; - if (thesyndicateFac.isBanned == false && thesyndicateFac.isMember == false && + if (!thesyndicateFac.isBanned && !thesyndicateFac.isMember && !thesyndicateFac.alreadyInvited && this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 && this.dexterity >= 200 && this.agility >= 200 && (this.city == Locations.Aevum || this.city == Locations.Sector12) && @@ -408,7 +411,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Silhouette var silhouetteFac = Factions["Silhouette"]; - if (silhouetteFac.isBanned == false && silhouetteFac.isMember == false && + if (!silhouetteFac.isBanned && !silhouetteFac.isMember && !silhouetteFac.alreadyInvited && (this.companyPosition.positionName == CompanyPositions.CTO.positionName || this.companyPosition.positionName == CompanyPositions.CFO.positionName || this.companyPosition.positionName == CompanyPositions.CEO.positionName) && @@ -418,7 +421,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Tetrads var tetradsFac = Factions["Tetrads"]; - if (tetradsFac.isBanned == false && tetradsFac.isMember == false && + if (!tetradsFac.isBanned && !tetradsFac.isMember && !tetradsFac.alreadyInvited && (this.city == Locations.Chongqing || this.city == Locations.NewTokyo || this.city == Locations.Ishima) && this.strength >= 75 && this.defense >= 75 && this.dexterity >= 75 && this.agility >= 75 && this.karma <= -18) { @@ -427,7 +430,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //SlumSnakes var slumsnakesFac = Factions["Slum Snakes"]; - if (slumsnakesFac.isBanned == false && slumsnakesFac.isMember == false && + if (!slumsnakesFac.isBanned && !slumsnakesFac.isMember && !slumsnakesFac.alreadyInvited && this.strength >= 30 && this.defense >= 30 && this.dexterity >= 30 && this.agility >= 30 && this.karma <= -9 && this.money >= 1000000) { invitedFactions.push(slumsnakesFac); @@ -443,7 +446,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { totalHacknetRam += Player.hacknetNodes[i].ram; totalHacknetCores += Player.hacknetNodes[i].numCores; } - if (netburnersFac.isBanned == false && netburnersFac.isMember == false && + if (!netburnersFac.isBanned && !netburnersFac.isMember && !netburnersFac.alreadyInvited && this.hacking_skill >= 80 && totalHacknetRam >= 8 && totalHacknetCores >= 4 && totalHacknetLevels >= 100) { invitedFactions.push(netburnersFac); @@ -451,7 +454,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Tian Di Hui var tiandihuiFac = Factions["Tian Di Hui"]; - if (tiandihuiFac.isBanned == false && tiandihuiFac.isMember == false && + if (!tiandihuiFac.isBanned && !tiandihuiFac.isMember && !tiandihuiFac.alreadyInvited && this.money >= 1000000 && this.hacking_skill >= 50 && (this.city == Locations.Chongqing || this.city == Locations.NewTokyo || this.city == Locations.Ishima)) { @@ -464,18 +467,14 @@ PlayerObject.prototype.checkForFactionInvitations = function() { if (cybersecServer == null) { console.log("ERROR: Could not find CyberSec Server"); } else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked && - this.hacking_skill >= 50) { + !cybersecFac.alreadyInvited && this.hacking_skill >= 50) { invitedFactions.push(cybersecFac); } - console.log("invited factions: " + invitedFactions); return invitedFactions; } inviteToFaction = function(faction) { - if (Engine.Debug) { - console.log("inviteToFaction() called with faction: " + faction.name); - } factionInvitationBoxCreate(faction); } diff --git a/src/SaveObject.js b/src/SaveObject.js index 7bc88c30b..8d701dfca 100644 --- a/src/SaveObject.js +++ b/src/SaveObject.js @@ -33,13 +33,19 @@ BitburnerSaveObject.prototype.saveGame = function() { Engine.createStatusText("Game saved!"); } -loadGame = function(saveObj) { - if (!window.localStorage.getItem("bitburnerSave")) { - console.log("No save file to load"); - return false; +loadGame = function(saveObj, imported=false) { + var saveString = ""; + if (imported) { + + } else { + if (!window.localStorage.getItem("bitburnerSave")) { + console.log("No save file to load"); + return false; + } + var saveString = decodeURIComponent(escape(atob(window.localStorage.getItem("bitburnerSave")))); } - var saveString = decodeURIComponent(escape(atob(window.localStorage.getItem("bitburnerSave")))); - saveObj = JSON.parse(saveString, Reviver); + + saveObj = JSON.parse(saveString, Reviver); Player = JSON.parse(saveObj.PlayerSave, Reviver); AllServers = JSON.parse(saveObj.AllServersSave, Reviver); @@ -81,6 +87,10 @@ loadGame = function(saveObj) { return true; } +BitburnerSaveObject.prototype.exportGame = function() { + +} + BitburnerSaveObject.prototype.deleteGame = function() { if (window.localStorage.getItem("bitburnerSave")) { window.localStorage.removeItem("bitburnerSave"); diff --git a/utils/FactionInvitationBox.js b/utils/FactionInvitationBox.js index e32a64ccf..2c7912969 100644 --- a/utils/FactionInvitationBox.js +++ b/utils/FactionInvitationBox.js @@ -1,16 +1,4 @@ /* Faction Invitation Pop-up box */ -function factionInvitationBoxInit() { - var cancelButton = document.getElementById("faction-invitation-box-no"); - - //Close Dialog box - cancelButton.addEventListener("click", function() { - factionInvitationBoxClose(); - return false; - }); -}; - -document.addEventListener("DOMContentLoaded", factionInvitationBoxInit, false); - factionInvitationBoxClose = function() { var factionInvitationBox = document.getElementById("faction-invitation-box-container"); factionInvitationBox.style.display = "none"; @@ -37,15 +25,18 @@ factionInvitationBoxCreate = function(faction) { //TODO Faction invitation message var newYesButton = clearEventListeners("faction-invitation-box-yes"); - //var yesButton = document.getElementById("faction-invitation-box-yes"); - //var newYesButton = yesButton.cloneNode(true); - //yesButton.parentNode.replaceChild(newYesButton, yesButton); - newYesButton.addEventListener("click", function() { joinFaction(faction); factionInvitationBoxClose(); return false; }); + var noButton = clearEventListeners("faction-invitation-box-no"); + noButton.addEventListener("click", function() { + factionInvitationBoxClose(); + faction.alreadyInvited = true; + return false; + }); + factionInvitationBoxOpen(); } \ No newline at end of file