diff --git a/README.md b/README.md index 6f4313e8a..e79ee7f2c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ TESTING TODO: Should add something where if you click it in the "Active Scripts" GUI you can see the logs too Seems to work fine - + + Gyms - Later..don't need for MVP + Tasks TODO: Adding augmentations for Silhouette fac @@ -42,11 +44,7 @@ Tasks TODO: Create new menu page for purchased servers - Gyms - Later..don't need for MVP - - Update CONSTANTS.HelpText Account for Max possible int when gaining exp (it will overflow) - Text in script editor that says ("ctrl + x" to save and quit) OPTIMIZATION https://gamealchemist.wordpress.com/2013/05/01/lets-get-those-javascript-arrays-to-work-fast/ \ No newline at end of file diff --git a/css/styles.css b/css/styles.css index c9d4aa532..f4c78224f 100644 --- a/css/styles.css +++ b/css/styles.css @@ -149,7 +149,7 @@ tr:focus { .tooltip .tooltiptext { visibility: hidden; - width: 200px; + width: 300px; background-color: black; border: 2px solid white; color: white; diff --git a/src/Constants.js b/src/Constants.js index d25209afa..238574eac 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -31,9 +31,6 @@ CONSTANTS = { /* Script related things */ //Time (ms) it takes to run one operation in Netscript. CodeInstructionRunTime: 1500, - - //Time (seconds) it takes to run one operation in Netscript OFFLINE - CodeOfflineExecutionTime: 10, //Server growth rate ServerGrowthRate: 1.00075, diff --git a/src/Crimes.js b/src/Crimes.js index c6c846c9a..26ffea532 100644 --- a/src/Crimes.js +++ b/src/Crimes.js @@ -92,7 +92,7 @@ function determineCrimeChanceShoplift() { var chance = ((Player.strength / CONSTANTS.MaxSkillLevel + Player.defense / CONSTANTS.MaxSkillLevel + Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) * 8; + Player.agility / CONSTANTS.MaxSkillLevel)) * 10; return Math.min(chance, 1); } @@ -101,12 +101,12 @@ function determineCrimeChanceMug() { var chance = ((Player.strength / CONSTANTS.MaxSkillLevel + Player.defense / CONSTANTS.MaxSkillLevel + Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) * 4; + Player.agility / CONSTANTS.MaxSkillLevel)) * 5; return Math.min(chance, 1); } function determineCrimeChanceDealDrugs() { - var chance = ((1.5*Player.charisma / CONSTANTS.MaxSkillLevel + + var chance = ((2*Player.charisma / CONSTANTS.MaxSkillLevel + Player.strength / CONSTANTS.MaxSkillLevel + Player.defense / CONSTANTS.MaxSkillLevel + Player.dexterity / CONSTANTS.MaxSkillLevel + diff --git a/src/Faction.js b/src/Faction.js index 2219e0a81..4974c7ded 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -747,13 +747,13 @@ displayFactionAugmentations = function(factionName) { aElem.setAttribute("href", "#"); var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult; if (aug.name != AugmentationNames.NeuroFluxGovernor && aug.owned) { - aElem.setAttribute("class", "a-link-button-inactive"); + aElem.setAttribute("class", "a-link-button-inactive tooltip"); pElem.innerHTML = "ALREADY OWNED"; } else if (faction.playerReputation >= req) { aElem.setAttribute("class", "a-link-button tooltip"); pElem.innerHTML = "UNLOCKED - $" + formatNumber(aug.baseCost * faction.augmentationPriceMult, 2); } else { - aElem.setAttribute("class", "a-link-button-inactive"); + aElem.setAttribute("class", "a-link-button-inactive tooltip"); pElem.innerHTML = "LOCKED (Requires " + formatNumber(req, 4) + " faction reputation)"; pElem.style.color = "red"; } @@ -764,7 +764,7 @@ displayFactionAugmentations = function(factionName) { aElem.innerHTML += " - Level " + (aug.level + 1); } - aElem.innerHTML += "" + aug.info + " "; + aElem.innerHTML += '' + aug.info + " "; aElem.addEventListener("click", function() { purchaseAugmentationBoxCreate(aug, faction); diff --git a/src/FactionInfo.js b/src/FactionInfo.js index 4f2941715..0debe2a54 100644 --- a/src/FactionInfo.js +++ b/src/FactionInfo.js @@ -27,7 +27,8 @@ FactionInfo = { "transporation on an unprecendented scale, in ways that no other company can.\n\n" + "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", - BachmanAndAssociatesInfo: "TODO", + BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.

" + + "Legal Insight - Business Instinct - Experience Innovation", BladeIndustriesInfo: "TODO", @@ -39,7 +40,7 @@ FactionInfo = { FourSigmaInfo: "TODO", - KuaiGongInternationalInfo: "TODO", + KuaiGongInternationalInfo: "Dream big. Work hard. Make history.", //Other Corporations FulcrumSecretTechnologiesInfo: "TODO", @@ -116,6 +117,7 @@ FactionInfo = { //Earlygame factions - factions the player will prestige with early on that don't //belong in other categories NetburnersInfo: "~~//*>?>\\~~", + TianDiHuiInfo: "Obey Heaven and Work Righteousness", CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand,\n" + diff --git a/src/Location.js b/src/Location.js index 22ca01c89..5174ffd81 100644 --- a/src/Location.js +++ b/src/Location.js @@ -900,7 +900,7 @@ displayLocationContent = function() { employeeJob.style.display = "none"; } else if (currPos.positionName == CompanyPositions.Waiter.positionName) { waiterJob.style.display = "none"; - } else if (currPos.positionName == CompanyPositions.PartTimeEmploye.positionName) { + } else if (currPos.positionName == CompanyPositions.PartTimeEmployee.positionName) { employeePartTimeJob.style.display = "none"; } else if (currPos.positionName == CompanyPositions.PartTimeWaiter.positionName) { waiterPartTimeJob.style.display = "none"; diff --git a/src/Player.js b/src/Player.js index ff1127044..874beb842 100644 --- a/src/Player.js +++ b/src/Player.js @@ -562,24 +562,24 @@ PlayerObject.prototype.workPartTime = function(numCycles) { } PlayerObject.prototype.finishWorkPartTime = function() { - this.gainWorkExp(cancMult); + this.gainWorkExp(); var company = Companies[this.companyName]; - company.playerReputation += (this.workRepGained / cancMult); + company.playerReputation += (this.workRepGained); - this.gainMoney(this.workMoneyGained / cancMult); + this.gainMoney(this.workMoneyGained); this.updateSkillLevels(); var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained / cancMult, 2) + "
" + - formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp
" + - formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp
" + - formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp
" + - formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp
"; + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workRepGained, 4) + " reputation for the company
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + + formatNumber(this.workDefExpGained, 4) + " defense exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workChaExpGained, 4) + " charisma exp
"; txt = "You worked for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ".

" + txt; dialogBoxCreate(txt); diff --git a/src/Prestige.js b/src/Prestige.js index e8971703e..ea4367048 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -128,12 +128,7 @@ function prestigeAugmentation() { //Reset statistics of all scripts on home computer for (var i = 0; i < homeComp.scripts.length; ++i) { var s = homeComp.scripts[i]; - s.offlineRunningTime = 0.01; //Seconds - s.offlineMoneyMade = 0; - s.offlineExpGained = 0; - s.onlineRunningTime = 0.01; //Seconds - s.onlineMoneyMade = 0; - s.onlineExpGained = 0; + s.reset(); } //Delete all running scripts objects @@ -159,13 +154,17 @@ function prestigeAugmentation() { //Delete Companies for (var member in Companies) { - delete Companies[member]; + if (Companies.hasOwnProperty(member)) { + delete Companies[member]; + } } Companies = {}; //Reset Factions for (var member in Factions) { - Factions[member].reset(); + if (Factions.hasOwnProperty(member)) { + Factions[member].reset(); + } } //Re-initialize Augmentations - This will update any changes diff --git a/src/Script.js b/src/Script.js index e8efd17b8..5a4d7eff1 100644 --- a/src/Script.js +++ b/src/Script.js @@ -139,6 +139,17 @@ Script.prototype.saveScript = function() { } } +Script.prototype.reset = function() { + this.offlineRunningTime = 0.01; //Seconds + this.offlineMoneyMade = 0; + this.offlineExpGained = 0; + this.onlineRunningTime = 0.01; //Seconds + this.onlineMoneyMade = 0; + this.onlineExpGained = 0; + + this.moneyStolenMap = new AllServersToMoneyMap(); +} + //Calculates the number of instructions, which is just determined by number of semicolons Script.prototype.updateNumInstructions = function() { var numSemicolons = this.code.split(";").length - 1; @@ -146,9 +157,6 @@ Script.prototype.updateNumInstructions = function() { } //Updates how much RAM the script uses when it is running. -//Right now, it is determined solely by the number of instructions -//Ideally, I would want it to be based on type of instructions as well -// (e.g. hack() costs a lot but others dont) Script.prototype.updateRamUsage = function() { this.ramUsage = this.numInstructions * 0.5; } @@ -225,8 +233,9 @@ scriptCalculateOfflineProduction = function(script) { var totalOfflineProduction = 0; for (var ip in script.moneyStolenMap) { if (script.moneyStolenMap.hasOwnProperty(ip)) { - if (script.moneyStolenMap[ip] == 0) {continue;} + if (script.moneyStolenMap[ip] == 0 || script.moneyStolenMap[ip] == null) {continue;} var serv = AllServers[ip]; + if (serv == null) {continue;} var production = 0.5 * script.moneyStolenMap[ip] / script.onlineRunningTime * timePassed; production *= confidence; if (production > serv.moneyAvailable) { diff --git a/src/Server.js b/src/Server.js index e3fdaa6a0..d5ce08576 100644 --- a/src/Server.js +++ b/src/Server.js @@ -415,92 +415,92 @@ initForeignServers = function() { var JoesGunsServer = new Server(); JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 2); - JoesGunsServer.setHackingParameters(10, 600000, 20, 20); + JoesGunsServer.setHackingParameters(10, 1000000, 20, 20); JoesGunsServer.setPortProperties(0); AddToAllServers(JoesGunsServer); var Zer0NightclubServer = new Server(); Zer0NightclubServer.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 2); - Zer0NightclubServer.setHackingParameters(75, 750000, 25, 40); + Zer0NightclubServer.setHackingParameters(75, 5000000, 25, 40); Zer0NightclubServer.setPortProperties(1); AddToAllServers(Zer0NightclubServer); var NectarNightclubServer = new Server(); NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 2); - NectarNightclubServer.setHackingParameters(20, 650000, 20, 25); + NectarNightclubServer.setHackingParameters(20, 1200000, 20, 25); NectarNightclubServer.setPortProperties(0); AddToAllServers(NectarNightclubServer); var NeoNightclubServer = new Server(); NeoNightclubServer.init(createRandomIp(), "neo-net", "Neo Nightclub Network", true, false, false, false, 2); - NeoNightclubServer.setHackingParameters(50, 900000, 25, 25); + NeoNightclubServer.setHackingParameters(50, 2500000, 25, 25); NeoNightclubServer.setPortProperties(1); AddToAllServers(NeoNightclubServer); var SilverHelixServer = new Server(); SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 2); - SilverHelixServer.setHackingParameters(150, 5000000, 30, 30); + SilverHelixServer.setHackingParameters(150, 50000000, 30, 30); SilverHelixServer.setPortProperties(2); AddToAllServers(SilverHelixServer); var HongFangTeaHouseServer = new Server(); HongFangTeaHouseServer.init(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", true, false, false, false, 0); - HongFangTeaHouseServer.setHackingParameters(30, 800000, 15, 15); + HongFangTeaHouseServer.setHackingParameters(30, 1500000, 15, 15); HongFangTeaHouseServer.setPortProperties(0); AddToAllServers(HongFangTeaHouseServer); var HaraKiriSushiBarServer = new Server(); - HaraKiriSushiBarServer.setHackingParameters(40, 800000, 15, 40); + HaraKiriSushiBarServer.setHackingParameters(40, 2000000, 15, 40); HaraKiriSushiBarServer.init(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", true, false, false, false, 0); HaraKiriSushiBarServer.setPortProperties(1); AddToAllServers(HaraKiriSushiBarServer); var PhantasyServer = new Server(); PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 4); - PhantasyServer.setHackingParameters(100, 1500000, 20, 35); + PhantasyServer.setHackingParameters(100, 25000000, 20, 35); PhantasyServer.setPortProperties(2); AddToAllServers(PhantasyServer); var MaxHardwareServer = new Server(); MaxHardwareServer.init(createRandomIp(), "max-hardware", "Max Hardware Store", true, false, false, false, 0); - MaxHardwareServer.setHackingParameters(80, 800000, 15, 25); + MaxHardwareServer.setHackingParameters(80, 10000000, 15, 25); MaxHardwareServer.setPortProperties(1); AddToAllServers(MaxHardwareServer); var OmegaSoftwareServer = new Server(); OmegaSoftwareServer.init(createRandomIp(), "omega-net", "Omega Software", true, false, false, false, 8); - OmegaSoftwareServer.setHackingParameters(200, 10000000, 30, 35); + OmegaSoftwareServer.setHackingParameters(200, 80000000, 30, 35); OmegaSoftwareServer.setPortProperties(2); AddToAllServers(OmegaSoftwareServer); //Gyms var CrushFitnessGymServer = new Server(); CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 0); - CrushFitnessGymServer.setHackingParameters(250, 5000000, 40, 25); + CrushFitnessGymServer.setHackingParameters(250, 10000000, 40, 25); CrushFitnessGymServer.setPortProperties(2); AddToAllServers(CrushFitnessGymServer); var IronGymServer = new Server(); IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 0); - IronGymServer.setHackingParameters(100, 2500000, 30, 15); + IronGymServer.setHackingParameters(100, 5000000, 30, 15); IronGymServer.setPortProperties(1); AddToAllServers(IronGymServer); var MilleniumFitnessGymServer = new Server(); MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 0); - MilleniumFitnessGymServer.setHackingParameters(500, 7500000, 50, 30); + MilleniumFitnessGymServer.setHackingParameters(500, 2500000, 50, 30); MilleniumFitnessGymServer.setPortProperties(3); AddToAllServers(MilleniumFitnessGymServer); var PowerhouseGymServer = new Server(); PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 0); - PowerhouseGymServer.setHackingParameters(1000, 20000000, 60, 50); + PowerhouseGymServer.setHackingParameters(1000, 100000000, 60, 50); PowerhouseGymServer.setPortProperties(5); AddToAllServers(PowerhouseGymServer); var SnapFitnessGymServer = new Server(); SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 0); - SnapFitnessGymServer.setHackingParameters(750, 750000, 50, 45); + SnapFitnessGymServer.setHackingParameters(750, 75000000, 50, 45); SnapFitnessGymServer.setPortProperties(4); AddToAllServers(SnapFitnessGymServer); diff --git a/src/engine.js b/src/engine.js index ed600d685..04fe00df3 100644 --- a/src/engine.js +++ b/src/engine.js @@ -543,6 +543,8 @@ var Engine = { Player.takeClass(numCycles); } else if (Player.workType == CONSTANTS.WorkTypeCrime) { Player.commitCrime(numCycles); + } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) { + Player.workPartTime(numCycles); } else { Player.work(numCycles); } @@ -703,6 +705,10 @@ var Engine = { Player.createProgramWork(numCyclesOffline); } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) { Player.takeClass(numCyclesOffline); + } else if (Player.workType == CONSTANTS.WorkTypeCrime) { + Player.commitCrime(numCyclesOffline); + } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) { + Player.workPartTime(numCycles); } else { Player.work(numCyclesOffline); } @@ -960,7 +966,7 @@ var Engine = { //Message at the top of terminal postNetburnerText(); - //Player was working + //Player was working cancel button if (Player.isWorking) { var cancelButton = document.getElementById("work-in-progress-cancel-button"); cancelButton.addEventListener("click", function() { @@ -971,6 +977,10 @@ var Engine = { Player.finishCreateProgramWork(true, Player.createProgramName); } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) { Player.finishClass(); + } else if (Player.workType == CONSTANTS.WorkTypeCrime) { + Player.finishCrime(true); + } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) { + Player.finishWorkPartTime(); } else { Player.finishWork(true); } diff --git a/utils/DialogBox.js b/utils/DialogBox.js index 13dbce1e2..ebb443a54 100644 --- a/utils/DialogBox.js +++ b/utils/DialogBox.js @@ -13,9 +13,6 @@ function dialogBoxInit() { document.addEventListener("DOMContentLoaded", dialogBoxInit, false); dialogBoxClose = function() { - if (Engine.Debug) { - console.log("Dialog Box Close called"); - } var dialogBox = document.getElementById("dialog-box-container"); dialogBox.style.display = "none"; }