diff --git a/css/menupages.css b/css/menupages.css index ac67756af..c324215ab 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -36,12 +36,10 @@ } #javascript-editor textarea { - color: var(--my-font-color); } .ace_line, .ace_line * { - color: var(--my-font-color); background-color:transparent; margin:0px; padding:0px; @@ -140,6 +138,26 @@ color: #ffffff; } +#script-editor-options-panel { + position:absolute; + right: 9%; + bottom:15%; + border:2px solid white; + width:19%; + background-color:#444; + padding:2px; + overflow:auto; + z-index: 1; + color: white; +} + +#script-editor-options-panel fieldset { + margin-top:8px; + margin-bottom:8px; + padding: 2px; + font-size:12px; +} + /* Active scripts */ .active-scripts-list { list-style-type: none; @@ -406,6 +424,7 @@ margin: 6px; display: inline-block; color: var(--my-font-color); + background-color:black; } #faction-donate-amount-txt { diff --git a/css/styles.css b/css/styles.css index 564b9522c..7a2d26478 100644 --- a/css/styles.css +++ b/css/styles.css @@ -321,7 +321,7 @@ a:link, a:visited { position: absolute; /* Stay in place */ right: 0; top: 0; - height: 195px; /* Full height */ + height: 205px; /* Full height */ /*margin: 50% auto;*/ padding: 5px; border: 2px solid var(--my-highlight-color); diff --git a/css/terminal.css b/css/terminal.css index ca64638e8..c22100b9c 100644 --- a/css/terminal.css +++ b/css/terminal.css @@ -4,7 +4,7 @@ height: 100%; width: 99%; overflow: auto; - overflow-y: scroll; + overflow-y: scroll; } #terminal { @@ -19,11 +19,6 @@ table-layout:fixed; } -/* -.posted { - width: 70%; -}*/ - #terminal-input { background-color: var(--my-background-color); color: var(--my-font-color); @@ -31,8 +26,7 @@ } .terminal-input { - display: table-cell; - width: 90%; + display: inline-block; padding: 0px !important; margin: 0px !important; border: 0px; diff --git a/dist/bundle.js b/dist/bundle.js index d41fa2b82..08fa91c4e 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -70,24 +70,24 @@ "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Player; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return loadPlayer; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Company_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Company_js__ = __webpack_require__(18); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(40); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(37); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(29); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__ = __webpack_require__(23); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(31); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_IPAddress_js__ = __webpack_require__(21); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_IPAddress_js__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(5); @@ -113,19 +113,21 @@ function PlayerObject() { //Skills and stats - this.hacking_skill = 1; + this.hacking_skill = 1; - //Fighting - this.hp = 10; - this.max_hp = 10; - this.strength = 1; //Damage dealt - this.defense = 1; //Damage received - this.dexterity = 1; //Accuracy - this.agility = 1; //Dodge % + //Combat stats + this.hp = 10; + this.max_hp = 10; + this.strength = 1; //Damage dealt + this.defense = 1; //Damage received + this.dexterity = 1; //Accuracy + this.agility = 1; //Dodge % //Labor stats - this.charisma = 1; - //Intelligence, perhaps? + this.charisma = 1; + + //Special stats + this.intelligence = 0; //Hacking multipliers this.hacking_chance_mult = 1; //Increase through ascensions/augmentations @@ -140,6 +142,7 @@ function PlayerObject() { this.dexterity_exp = 0; this.agility_exp = 0; this.charisma_exp = 0; + this.intelligence_exp= 0; this.hacking_mult = 1; this.strength_mult = 1; @@ -230,12 +233,14 @@ function PlayerObject() { this.workMoneyGained = 0; this.createProgramName = ""; + this.createProgramReqLvl = 0; this.className = ""; this.crimeType = ""; this.timeWorked = 0; //in ms + this.timeWorkedCreateProgram = 0; this.timeNeededToCompleteWork = 0; this.work_money_mult = 1; @@ -280,15 +285,6 @@ PlayerObject.prototype.init = function() { this.getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].NukeProgram); } -PlayerObject.prototype.increaseMultiplier = function(name, val) { - let mult = this[name]; - if (mult === null || mult === undefined) { - console.log("ERROR: Could not find this multiplier " + name); - return; - } - mult *= val; -} - PlayerObject.prototype.prestigeAugmentation = function() { var homeComp = this.getHomeComputer(); this.currentServer = homeComp.ip; @@ -479,6 +475,12 @@ PlayerObject.prototype.updateSkillLevels = function() { this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult); this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult); + if (this.intelligence > 0) { + this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp)); + } else { + this.intelligence = 0; + } + var ratio = this.hp / this.max_hp; this.max_hp = Math.floor(10 + this.defense / 10); Player.hp = Math.round(this.max_hp * ratio); @@ -526,7 +528,7 @@ PlayerObject.prototype.resetMultipliers = function() { // (2 * hacking_chance_multiplier * hacking_skill) 100 PlayerObject.prototype.calculateHackingChance = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; - var skillMult = (1.75 * this.hacking_skill); + var skillMult = (1.75 * this.hacking_skill) + (0.2 * this.intelligence); var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult * this.hacking_chance_mult; if (chance > 1) {return 1;} @@ -541,7 +543,7 @@ PlayerObject.prototype.calculateHackingChance = function() { // hacking_skill + 100 PlayerObject.prototype.calculateHackingTime = function() { var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100); + var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100 + (0.1 * this.intelligence)); return 5 * skillFactor / this.hacking_speed_mult; } @@ -658,6 +660,24 @@ PlayerObject.prototype.gainCharismaExp = function(exp) { this.charisma_exp += exp; } +PlayerObject.prototype.gainIntelligenceExp = function(exp) { + if (isNaN(exp)) { + console.log("ERROR: NaN passed into Player.gainIntelligenceExp()"); return; + } + var hasBn = false; + for (var i = 0; i < this.sourceFiles.length; ++i) { + if (this.sourceFiles[i].n === 5) { + hasBn = true; + break; + } + } + if (hasBn || this.intelligence > 0) { + this.intelligence_exp += exp; + } else { + console.log("Not gaining intelligence experience bc it hasn't been unlocked yet"); + } +} + /******* Working functions *******/ PlayerObject.prototype.resetWorkStatus = function() { this.workHackExpGainRate = 0; @@ -679,6 +699,7 @@ PlayerObject.prototype.resetWorkStatus = function() { this.workMoneyGained = 0; this.timeWorked = 0; + this.timeWorkedCreateProgram = 0; this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; @@ -735,7 +756,8 @@ PlayerObject.prototype.finishWork = function(cancelled, sing=false) { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; - __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadTerminalContent(); + //Engine.loadTerminalContent(); + __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent(); if (sing) { return "You worked a short shift of " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " + @@ -811,7 +833,7 @@ PlayerObject.prototype.work = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + - " at " + Player.companyName + "

" + + " at " + this.companyName + "

" + "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "

" + "You have earned:

" + "$" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)

" + @@ -928,7 +950,8 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; - __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadTerminalContent(); + //Engine.loadTerminalContent(); + __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent(); if (sing) { return "You worked for " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " + "earned a total of " + @@ -971,7 +994,9 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) { this.isWorking = false; - __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadTerminalContent(); + //Engine.loadTerminalContent(); + __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadFactionContent(); + Object(__WEBPACK_IMPORTED_MODULE_7__Faction_js__["c" /* displayFactionContent */])(faction.name); if (sing) { return "You worked for your faction " + faction.name + " for a total of " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ". " + "You earned " + @@ -1013,7 +1038,7 @@ PlayerObject.prototype.startFactionHackWork = function(faction) { this.resetWorkStatus(); this.workHackExpGainRate = .15 * this.hacking_exp_mult * __WEBPACK_IMPORTED_MODULE_1__BitNode_js__["a" /* BitNodeMultipliers */].FactionWorkExpGain; - this.workRepGainRate = this.hacking_skill / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel * this.faction_rep_mult; + this.workRepGainRate = this.workRepGainRate = (this.hacking_skill + this.intelligence) / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel * this.faction_rep_mult; this.factionWorkType = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].FactionWorkHacking; this.currentWorkFactionDescription = "carrying out hacking contracts"; @@ -1061,7 +1086,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //Constantly update the rep gain rate switch (this.factionWorkType) { case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].FactionWorkHacking: - this.workRepGainRate = this.hacking_skill / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel * this.faction_rep_mult; + this.workRepGainRate = (this.hacking_skill + this.intelligence) / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel * this.faction_rep_mult; break; case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].FactionWorkField: this.workRepGainRate = this.getFactionFieldWorkRepGain(); @@ -1095,6 +1120,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours if (this.timeWorked >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer20Hours) { var maxCycles = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].GameCyclesPer20Hours; + this.timeWorked = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer20Hours; this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; @@ -1179,6 +1205,10 @@ PlayerObject.prototype.getWorkRepGain = function() { var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, this.defense, this.dexterity, this.agility, this.charisma); + + //Intelligence provides a flat bonus to job performance + jobPerformance += (this.intelligence / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel); + //Update reputation gain rate to account for company favor var favorMult = 1 + (company.favor / 100); if (isNaN(favorMult)) {favorMult = 1;} @@ -1200,7 +1230,8 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() { this.defense / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + this.dexterity / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + this.agility / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - this.charisma / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel) / 6; + this.charisma / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + + this.intelligence / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel) / 6; return t * this.faction_rep_mult; } @@ -1212,21 +1243,22 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL //Time needed to complete work affected by hacking skill (linearly based on //ratio of (your skill - required level) to MAX skill) - var timeMultiplier = (__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel - (this.hacking_skill - reqLevel)) / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel; - if (timeMultiplier > 1) {timeMultiplier = 1;} - if (timeMultiplier < 0.01) {timeMultiplier = 0.01;} + //var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel; + //if (timeMultiplier > 1) {timeMultiplier = 1;} + //if (timeMultiplier < 0.01) {timeMultiplier = 0.01;} + this.createProgramReqLvl = reqLevel; - this.timeNeededToCompleteWork = timeMultiplier * time; + this.timeNeededToCompleteWork = time; //Check for incomplete program - for (var i = 0; i < Player.getHomeComputer().programs.length; ++i) { - var programFile = Player.getHomeComputer().programs[i]; + for (var i = 0; i < this.getHomeComputer().programs.length; ++i) { + var programFile = this.getHomeComputer().programs[i]; if (programFile.startsWith(programName) && programFile.endsWith("%-INC")) { var res = programFile.split("-"); if (res.length != 3) {break;} var percComplete = Number(res[1].slice(0, -1)); if (isNaN(percComplete) || percComplete < 0 || percComplete >= 100) {break;} - this.timeWorked = percComplete / 100 * this.timeNeededToCompleteWork; - Player.getHomeComputer().programs.splice(i, 1); + this.timeWorkedCreateProgram = percComplete / 100 * this.timeNeededToCompleteWork; + this.getHomeComputer().programs.splice(i, 1); } } @@ -1244,17 +1276,24 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL } PlayerObject.prototype.createProgramWork = function(numCycles) { - this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles; + //Higher hacking skill will allow you to create programs faster + var reqLvl = this.createProgramReqLvl; + var skillMult = (this.hacking_skill / reqLvl); //This should always be greater than 1; + skillMult = 1 + ((skillMult - 1) / 5); //The divider constant can be adjusted as necessary + + //Skill multiplier directly applied to "time worked" + this.timeWorked += (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles); + this.timeWorkedCreateProgram += (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles * skillMult); var programName = this.createProgramName; - if (this.timeWorked >= this.timeNeededToCompleteWork) { + if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) { this.finishCreateProgramWork(false); } var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working on coding " + programName + ".

" + "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "

" + - "The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + + "The program is " + (this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + "If you cancel, your work will be saved and you can come back to complete the program later."; } @@ -1264,17 +1303,19 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false) Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You've finished creating " + programName + "!
" + "The new program can be found on your home computer."); - Player.getHomeComputer().programs.push(programName); + this.getHomeComputer().programs.push(programName); } else { - var perc = Math.floor(this.timeWorked / this.timeNeededToCompleteWork * 100).toString(); + var perc = Math.floor(this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toString(); var incompleteName = programName + "-" + perc + "%-INC"; - Player.getHomeComputer().programs.push(incompleteName); + this.getHomeComputer().programs.push(incompleteName); } + this.gainIntelligenceExp(this.createProgramReqLvl / __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceProgramBaseExpGain); + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - Player.isWorking = false; + this.isWorking = false; __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadTerminalContent(); } @@ -1342,7 +1383,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { agiExp = baseGymExp * expMult / gameCPS; break; default: - throw new Error("ERR: Invalid/unregocnized class name"); + throw new Error("ERR: Invalid/unrecognized class name"); return; } @@ -1473,16 +1514,16 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag PlayerObject.prototype.commitCrime = function (numCycles) { this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles; - if (this.timeWorked >= this.timeNeededToCompleteWork) {Player.finishCrime(false); return;} + if (this.timeWorked >= this.timeNeededToCompleteWork) {this.finishCrime(false); return;} - var percent = Math.round(Player.timeWorked / Player.timeNeededToCompleteWork * 100); + var percent = Math.round(this.timeWorked / this.timeNeededToCompleteWork * 100); var numBars = Math.round(percent / 5); if (numBars < 0) {numBars = 0;} if (numBars > 20) {numBars = 20;} var progressBar = "[" + Array(numBars+1).join("|") + Array(20 - numBars + 1).join(" ") + "]"; var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are attempting to " + Player.crimeType + ".
" + + txt.innerHTML = "You are attempting to " + this.crimeType + ".
" + "Time remaining: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeNeededToCompleteWork - this.timeWorked) + "
" + progressBar.replace( / /g, " " ); } @@ -1518,6 +1559,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) { break; case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto: this.karma -= 5; + this.gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceCrimeBaseExpGain); break; case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CrimeKidnap: this.karma -= 6; @@ -1525,9 +1567,11 @@ PlayerObject.prototype.finishCrime = function(cancelled) { case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CrimeAssassination: ++this.numPeopleKilled; this.karma -= 10; + this.gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceCrimeBaseExpGain); break; case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CrimeHeist: this.karma -= 15; + this.gainIntelligenceExp(5 * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].IntelligenceCrimeBaseExpGain); break; default: console.log(this.crimeType); @@ -1618,7 +1662,7 @@ PlayerObject.prototype.hospitalize = function() { Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You were in critical condition! You were taken to the hospital where " + "luckily they were able to save your life. You were charged $" + Object(__WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp, 2)); - Player.loseMoney(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp); + this.loseMoney(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp); this.hp = this.max_hp; } @@ -1702,7 +1746,12 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) { this.companyName = company.companyName; this.companyPosition = pos; - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } if (leaveCompany) { if (sing) {return true;} @@ -1806,7 +1855,12 @@ PlayerObject.prototype.applyForAgentJob = function(sing=false) { PlayerObject.prototype.applyForEmployeeJob = function(sing=false) { var company = __WEBPACK_IMPORTED_MODULE_2__Company_js__["a" /* Companies */][this.location]; //Company being applied to if (this.isQualified(company, __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Employee)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Employee; if (sing) {return true;} @@ -1821,7 +1875,12 @@ PlayerObject.prototype.applyForEmployeeJob = function(sing=false) { PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) { var company = __WEBPACK_IMPORTED_MODULE_2__Company_js__["a" /* Companies */][this.location]; //Company being applied to if (this.isQualified(company, __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeEmployee)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeEmployee; if (sing) {return true;} @@ -1836,7 +1895,12 @@ PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) { PlayerObject.prototype.applyForWaiterJob = function(sing=false) { var company = __WEBPACK_IMPORTED_MODULE_2__Company_js__["a" /* Companies */][this.location]; //Company being applied to if (this.isQualified(company, __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Waiter)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Waiter; if (sing) {return true;} @@ -1851,7 +1915,12 @@ PlayerObject.prototype.applyForWaiterJob = function(sing=false) { PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) { var company = __WEBPACK_IMPORTED_MODULE_2__Company_js__["a" /* Companies */][this.location]; //Company being applied to if (this.isQualified(company, __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeWaiter)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeWaiter; if (sing) {return true;} @@ -2200,10 +2269,10 @@ PlayerObject.prototype.checkForFactionInvitations = function() { var totalHacknetRam = 0; var totalHacknetCores = 0; var totalHacknetLevels = 0; - for (var i = 0; i < Player.hacknetNodes.length; ++i) { - totalHacknetLevels += Player.hacknetNodes[i].level; - totalHacknetRam += Player.hacknetNodes[i].ram; - totalHacknetCores += Player.hacknetNodes[i].cores; + for (var i = 0; i < this.hacknetNodes.length; ++i) { + totalHacknetLevels += this.hacknetNodes[i].level; + totalHacknetRam += this.hacknetNodes[i].ram; + totalHacknetCores += this.hacknetNodes[i].cores; } if (!netburnersFac.isBanned && !netburnersFac.isMember && !netburnersFac.alreadyInvited && this.hacking_skill >= 80 && totalHacknetRam >= 8 && @@ -2278,6 +2347,80 @@ let Player = new PlayerObject(); /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dialogBoxCreate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return dialogBoxOpened; }); +/* Pop up Dialog Box */ +let dialogBoxes = []; + +//Close dialog box when clicking outside +$(document).click(function(event) { + if (dialogBoxOpened && dialogBoxes.length >= 1) { + if (!$(event.target).closest(dialogBoxes[0]).length){ + dialogBoxes[0].remove(); + dialogBoxes.splice(0, 1); + if (dialogBoxes.length == 0) { + dialogBoxOpened = false; + } else { + dialogBoxes[0].style.visibility = "visible"; + } + } + } +}); + + +//Dialog box close buttons +$(document).on('click', '.dialog-box-close-button', function( event ) { + if (dialogBoxOpened && dialogBoxes.length >= 1) { + dialogBoxes[0].remove(); + dialogBoxes.splice(0, 1); + if (dialogBoxes.length == 0) { + dialogBoxOpened = false; + } else { + dialogBoxes[0].style.visibility = "visible"; + } + } +}); + +var dialogBoxOpened = false; + +function dialogBoxCreate(txt) { + var container = document.createElement("div"); + container.setAttribute("class", "dialog-box-container"); + + var content = document.createElement("div"); + content.setAttribute("class", "dialog-box-content"); + + var closeButton = document.createElement("span"); + closeButton.setAttribute("class", "dialog-box-close-button"); + closeButton.innerHTML = "×" + + var textE = document.createElement("p"); + textE.innerHTML = txt; + + content.appendChild(closeButton); + content.appendChild(textE); + container.appendChild(content); + + document.body.appendChild(container); + if (dialogBoxes.length >= 1) { + container.style.visibility = "hidden"; + } + dialogBoxes.push(container); + + setTimeout(function() { + dialogBoxOpened = true; + }, 400); +} + + + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) + +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + "use strict"; /* unused harmony export sizeOfObject */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addOffset; }); @@ -2349,79 +2492,6 @@ function powerOfTwo(n) { -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dialogBoxCreate; }); -/* Pop up Dialog Box */ -let dialogBoxes = []; - -//Close dialog box when clicking outside -$(document).click(function(event) { - if (dialogBoxOpened && dialogBoxes.length >= 1) { - if (!$(event.target).closest(dialogBoxes[0]).length){ - dialogBoxes[0].remove(); - dialogBoxes.splice(0, 1); - if (dialogBoxes.length == 0) { - dialogBoxOpened = false; - } else { - dialogBoxes[0].style.visibility = "visible"; - } - } - } -}); - - -//Dialog box close buttons -$(document).on('click', '.dialog-box-close-button', function( event ) { - if (dialogBoxOpened && dialogBoxes.length >= 1) { - dialogBoxes[0].remove(); - dialogBoxes.splice(0, 1); - if (dialogBoxes.length == 0) { - dialogBoxOpened = false; - } else { - dialogBoxes[0].style.visibility = "visible"; - } - } -}); - -var dialogBoxOpened = false; - -function dialogBoxCreate(txt) { - var container = document.createElement("div"); - container.setAttribute("class", "dialog-box-container"); - - var content = document.createElement("div"); - content.setAttribute("class", "dialog-box-content"); - - var closeButton = document.createElement("span"); - closeButton.setAttribute("class", "dialog-box-close-button"); - closeButton.innerHTML = "×" - - var textE = document.createElement("p"); - textE.innerHTML = txt; - - content.appendChild(closeButton); - content.appendChild(textE); - container.appendChild(content); - - document.body.appendChild(container); - if (dialogBoxes.length >= 1) { - container.style.visibility = "hidden"; - } - dialogBoxes.push(container); - - setTimeout(function() { - dialogBoxOpened = true; - }, 400); -} - - - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) - /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -2429,7 +2499,7 @@ function dialogBoxCreate(txt) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; }); let CONSTANTS = { - Version: "0.28.1", + Version: "0.29.0", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -2488,8 +2558,9 @@ let CONSTANTS = { ScriptScpRamCost: 0.5, ScriptKillRamCost: 0.5, //Kill and killall ScriptHasRootAccessRamCost: 0.05, - ScriptGetHostnameRamCost: 0.05, - ScriptGetHackingLevelRamCost: 0.05, + ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp() + ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() and getIntelligence() + ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers() ScriptGetServerCost: 0.1, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, @@ -2516,9 +2587,9 @@ let CONSTANTS = { //Server constants ServerBaseGrowthRate: 1.03, //Unadjusted Growth rate - ServerMaxGrowthRate: 1.0035, //Maximum possible growth rate (max rate accounting for server security) + ServerMaxGrowthRate: 1.0035, //Maximum possible growth rate (max rate accounting for server security) ServerFortifyAmount: 0.002, //Amount by which server's security increases when its hacked/grown - ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened + ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened PurchasedServerLimit: 25, @@ -2542,6 +2613,18 @@ let CONSTANTS = { //Hospital/Health HospitalCostPerHp: 100000, + //Intelligence-related constants + IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates + IntelligenceInfiltrationWeight: 0.1, //Weight for how much int affects infiltration success rates + IntelligenceCrimeBaseExpGain: 0.0002, + IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain + IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain + IntelligenceSingFnBaseExpGain: 0.0005, + + //Hacking Missions + HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty + HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward + //Gang constants GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain MaximumGangMembers: 20, @@ -2661,8 +2744,10 @@ let CONSTANTS = { "encounter diminishing returns in your hacking (since you are only hacking a certain percentage). You can " + "increase the amount of money on a server using a script and the grow() function in Netscript.

" + "

Server Security


" + - "Each server has a security level, which is denoted by a number between 1 and 100. A higher number means " + - "the server has stronger security. As mentioned above, a server's security level is an important factor " + + "Each server has a security level, typically between 1 and 100. A higher number means the server has stronger security. " + + "It is possible for a server to have a security level of 100 or higher, in which case hacking that server " + + "will become impossible (0% chance to hack).

" + + "As mentioned above, a server's security level is an important factor " + "to consider when hacking. You can check a server's security level using the 'analyze' command, although this " + "only gives an estimate (with 5% uncertainty). You can also check a server's security in a script, using the " + "getServerSecurityLevel(server) function in Netscript. See the Netscript documentation for more details. " + @@ -2826,10 +2911,13 @@ let CONSTANTS = { "there is no required hacking level to run the command. Returns " + "0.1. Works offline at a slower rate
Example: weaken('foodnstuff');

" + "print(x)
Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ).

" + - "tprint(x)
Prints a value or a variable to the Terminal

" + + "tprint(x)
Prints a value or a variable to the Terminal

" + "clearLog()
Clears the script's logs.

" + - "scan(hostname/ip)
Returns an array containing the hostnames of all servers that are one node away from the specified server. " + - "The argument must be a string containing the IP or hostname of the target server. The hostnames in the returned array are strings.

" + + "scan(hostname/ip, [hostnames=true])
Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " + + "The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " + + "the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " + + "This second argument is optional and, if ommitted, the function will output " + + "the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.

" + "nuke(hostname/ip)
Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline
Example: nuke('foodnstuff');

" + "brutessh(hostname/ip)
Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline
Example: brutessh('foodnstuff');

" + "ftpcrack(hostname/ip)
Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline
Example: ftpcrack('foodnstuff');

" + @@ -2879,14 +2967,66 @@ let CONSTANTS = { "kill('foo.script', getHostname(), 1, 'foodnstuff');

" + "killall(hostname/ip)
Kills all running scripts on the specified server. This function takes a single argument which " + "must be a string containing the hostname or IP of the target server. This function will always return true.

" + - "scp(script, hostname/ip)
Copies a script to another server. The first argument is a string with the filename of the script " + - "to be copied. The second argument is a string with the hostname or IP of the destination server. Returns true if the script is successfully " + - "copied over and false otherwise.
Example: scp('hack-template.script', 'foodnstuff');

" + + "scp(script, [source], destination)
Copies a script or literature (.lit) file to another server. The first argument is a string with " + + "the filename of the script or literature file " + + "to be copied. The next two arguments are strings containing the hostname/IPs of the source and target server. " + + "The source refers to the server from which the script/literature file will be copied, while the destination " + + "refers to the server to which it will be copied. The source server argument is optional, and if ommitted the source " + + "will be the current server (the server on which the script is running). Returns true if the script/literature file is " + + "successfully copied over and false otherwise.

" + + "Example: scp('hack-template.script', 'foodnstuff'); //Copies hack-template.script from the current server to foodnstuff
" + + "Example: scp('foo.lit', 'helios', 'home'); //Copies foo.lit from the helios server to the home computer

" + + "ls(hostname/ip)
Returns an array containing the names of all files on the specified server. The argument must be a " + + "string with the hostname or IP of the target server.

" + "hasRootAccess(hostname/ip)
Returns a boolean (true or false) indicating whether or not the Player has root access to a server. " + "The argument passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline.
" + "Example:
if (hasRootAccess('foodnstuff') == false) {
    nuke('foodnstuff');
}

" + + "getIp()
Returns a string with the IP Address of the server that the script is running on

" + "getHostname()
Returns a string with the hostname of the server that the script is running on

" + - "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline

" + + "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline

" + + "getIntelligence()
Returns the Player's current intelligence level. Requires Source-File 5 to run

" + + "getHackingMultipliers()
Returns an object containing the Player's hacking related multipliers. " + + "These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " + + "The object has the following structure:

" + + "{
" + + "chance: Player's hacking chance multiplier
" + + "speed: Player's hacking speed multiplier
" + + "money: Player's hacking money stolen multiplier
" + + "growth: Player's hacking growth multiplier
" + + "}

Example:

" + + "mults = getHackingMultipliers();
" + + "print(mults.chance);
" + + "print(mults.growth);

" + + "getBitNodeMultipliers()
Returns an object containing the current BitNode multipliers. " + + "This function requires Source-File 5 in order to run. The multipliers are returned in integer forms, not percentages " + + "(e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the " + + "original BitNode (BitNode-1). For example, if the 'CrimeMoney' multiplier has a value of 0.1 then that means " + + "that committing crimes in the current BitNode will only give 10% of the money you would have received in " + + "BitNode-1. The object has the following structure (subject to change in the future):

" + + "{
" + + "ServerMaxMoney: 1,
" + + "ServerStartingMoney: 1,
" + + "ServerGrowthRate: 1,
" + + "ServerWeakenRate: 1,
" + + "ServerStartingSecurity: 1,
" + + "ManualHackMoney: 1,
" + + "ScriptHackMoney: 1,
" + + "CompanyWorkMoney: 1,
" + + "CrimeMoney: 1,
" + + "HacknetNodeMoney: 1,
" + + "CompanyWorkExpGain: 1,
" + + "ClassGymExpGain: 1,
" + + "FactionWorkExpGain: 1,
" + + "HackExpGain: 1,
" + + "CrimeExpGain: 1,
" + + "FactionWorkRepGain: 1,
" + + "FactionPassiveRepGain: 1,
" + + "AugmentationRepCost: 1,
" + + "AugmentationMoneyCost: 1,
" + + "}

Example:

" + + "mults = getBitNodeMultipliers();
" + + "print(mults.ServerMaxMoney);
" + + "print(mults.HackExpGain);

" + "getServerMoneyAvailable(hostname/ip)
Returns the amount of money available on a server. The argument passed in must be a string with either the " + "hostname or IP of the target server. Does NOT work while offline
Example: getServerMoneyAvailable('foodnstuff');

" + "getServerMaxMoney(hostname/ip)
Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " + @@ -2909,6 +3049,8 @@ let CONSTANTS = { "getServerRam(hostname/ip)
Returns an array with two elements that gives information about the target server's RAM. The first " + "element in the array is the amount of RAM that the server has (in GB). The second element in the array is the amount of RAM that " + "is currently being used on the server.

" + + "serverExists(hostname/ip)
Returns a boolean denoting whether or not the specified server exists. The argument " + + "must be a string with the hostname or IP of the target server.

" + "fileExists(filename, [hostname/ip])
Returns a boolean (true or false) indicating whether the specified file exists on a server. " + "The first argument must be a string with the name of the file. A file can either be a script or a program. A script name is case-sensitive, but a " + "program is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + @@ -2938,9 +3080,10 @@ let CONSTANTS = { "but it will be converted to a string using Javascript's String function. Anything that resolves to an empty string will cause the function to fail. " + "The second argument specified the amount of RAM (in GB) for the server. This argument must resolve to a numeric and it must be a power of 2 " + "(2, 4, 8, etc...).

" + - "Purchasing a server using this Netscript function is twice as expensive as manually purchasing a server from a location in the World.

" + "This function returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return " + "an empty string. The function will fail if the arguments passed in are invalid or if the player does not have enough money to purchase the specified server.

" + + "deleteServer(hostname)
Deletes one of the servers you've purchased with the specified hostname. The function will fail if " + + "there are any scripts running on the specified server. Returns true if successful and false otherwise

" + "round(n)
Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.

" + "write(port, data)
Writes data to a port. The first argument must be a number between 1 and 10 that specifies the port. The second " + "argument defines the data to write to the port. If the second argument is not specified then it will write an empty string to the port.

" + @@ -2964,21 +3107,46 @@ let CONSTANTS = { "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.

" + "getWeakenTime(hostname/ip)
Returns the amount of time in seconds it takes to execute the weaken() Netscript function " + "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.

" + + "getScriptIncome([scriptname], [hostname/ip], [args...])
" + + "Returns the amount of income the specified script generates while online (when the game is open, does not apply for " + + "offline income). This function can also return the total income of all of your active scripts by running the function " + + "with no arguments.

" + + "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " + + "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " + + "specify those arguments in this function call.

" + + "The first argument, if specified, must be a string with the name of the script (including the .script extension). " + + "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " + + "then the second argument must be specified as well. Any additional arguments passed to the function will specify " + + "the arguments passed into the target script.

" + + "getScriptExpGain([scriptname], [hostname/ip], [args...])
" + + "Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for " + + "offline experience gains). This function can also return the total experience gain rate of all of your active scripts by running the function " + + "with no arguments.

" + + "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " + + "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " + + "specify those arguments in this function call.

" + + "The first argument, if specified, must be a string with the name of the script (including the .script extension). " + + "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " + + "then the second argument must be specified as well. Any additional arguments passed to the function will specify " + + "the arguments passed into the target script.

" + "

Hacknet Nodes API


" + "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.

" + "hacknetnodes
A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " + "indexes. These indexes correspond to the number at the end of the name of the Hacknet Node. For example, the first Hacknet Node you purchase " + "will have the same 'hacknet-node-0' and can be accessed with hacknetnodes[0]. The fourth Hacknet Node you purchase will have the name " + "'hacknet-node-3' and can be accessed with hacknetnodes[3].

" + - "hacknetnodes.length
Returns the number of Hacknet Nodes that the player owns

" + - "hacknetnodes[i].level
Returns the level of the corresponding Hacknet Node

" + - "hacknetnodes[i].ram
Returns the amount of RAM on the corresponding Hacknet Node

" + - "hacknetnodes[i].cores
Returns the number of cores on the corresponding Hacknet Node

" + - "hacknetnodes[i].upgradeLevel(n)
Tries to upgrade the level of the corresponding Hacknet Node n times. The argument n must be a " + + "hacknetnodes.length
Returns the number of Hacknet Nodes that the player owns

" + + "hacknetnodes[i].level
Returns the level of the corresponding Hacknet Node

" + + "hacknetnodes[i].ram
Returns the amount of RAM on the corresponding Hacknet Node

" + + "hacknetnodes[i].cores
Returns the number of cores on the corresponding Hacknet Node

" + + "hacknetnodes[i].totalMoneyGenerated
Returns the total amount of money that the corresponding Hacknet Node has earned

" + + "hacknetnodes[i].onlineTimeSeconds
Returns the total amount of time that the corresponding Hacknet Node has existed

" + + "hacknetnodes[i].moneyGainRatePerSecond
Returns the income ($ / sec) that the corresponding Hacknet Node earns

" + + "hacknetnodes[i].upgradeLevel(n)
Tries to upgrade the level of the corresponding Hacknet Node n times. The argument n must be a " + "positive integer. Returns true if the Hacknet Node's level is successfully upgraded n times or up to the max level (200), and false otherwise.

" + - "hacknetnodes[i].upgradeRam()
Tries to upgrade the amount of RAM on the corresponding Hacknet Node. Returns true if the " + + "hacknetnodes[i].upgradeRam()
Tries to upgrade the amount of RAM on the corresponding Hacknet Node. Returns true if the " + "RAM is successfully upgraded, and false otherwise.

" + - "hacknetnodes[i].upgradeCore()
Attempts to purchase an additional core for the corresponding Hacknet Node. Returns true if the " + + "hacknetnodes[i].upgradeCore()
Attempts to purchase an additional core for the corresponding Hacknet Node. Returns true if the " + "additional core is successfully purchase, and false otherwise.

" + "Example: The following is an example of one way a script can be used to automate the purchasing and upgrading of Hacknet Nodes. " + "This script purchases new Hacknet Nodes until the player has four. Then, it iteratively upgrades each of those four Hacknet Nodes " + @@ -3289,14 +3457,20 @@ let CONSTANTS = { "World Stock Exchange account and TIX API Access
", LatestUpdate: - "v0.28.1
" + - "-The script editor now uses the open-source Ace editor, which provides a much better experience when coding!
" + - "-Added tprint() Netscript function

" + - "v0.28.0
" + - "-Added BitNode-4: The Singularity
" + - "-Added BitNode-11: The Big Crash
" + - "-Migrated the codebase to use webpack (doesn't affect any in game content, except maybe some slight " + - "performance improvements and there may be bugs that result from dependency errors)" + "v0.29.0
" + + "-Added BitNode-5: Artificial Intelligence
" + + "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)
" + + "-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames
" + + "-Refactored scp() Netscript function so that it takes an optional 'source server' argument
" + + "-For Infiltration, decreased the percentage by which the security level increases by " + + "about 10% for every location
" + + "-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal
" + + "-Some minor optimizations that should reduce the size of the save file
" + + "-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command
" + + "-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " + + "will now repeatedly pop up regardless of whether or not you have messages suppressed
" + + "-Various bugfixes", + } @@ -3309,45 +3483,39 @@ let CONSTANTS = { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(38); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(35); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(36); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(23); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__BitNode_js__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Company_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Company_js__ = __webpack_require__(18); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__ = __webpack_require__(14); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Faction_js__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Location_js__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(43); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Message_js__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__ = __webpack_require__(39); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(30); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(34); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__ = __webpack_require__(24); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(42); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Message_js__ = __webpack_require__(22); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__NetscriptFunctions_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptWorker_js__ = __webpack_require__(15); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Prestige_js__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__RedPill_js__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__ = __webpack_require__(58); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__Script_js__ = __webpack_require__(18); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Prestige_js__ = __webpack_require__(32); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__RedPill_js__ = __webpack_require__(43); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__SaveObject_js__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__Script_js__ = __webpack_require__(19); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__SourceFile_js__ = __webpack_require__(30); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__SourceFile_js__ = __webpack_require__(31); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__StockMarket_js__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__Terminal_js__ = __webpack_require__(19); -var ace = __webpack_require__(33); -__webpack_require__(35); -__webpack_require__(36); -__webpack_require__(49); -__webpack_require__(50); - +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__StockMarket_js__ = __webpack_require__(26); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__Terminal_js__ = __webpack_require__(20); @@ -3765,16 +3933,30 @@ let Engine = { displayCharacterOverviewInfo: function() { if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp == null) {__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp;} - document.getElementById("character-overview-text").innerHTML = - ("Hp: " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp + "
" + - "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" + - "Hack: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" + - "Str: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() + "
" + - "Def: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() + "
" + - "Dex: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" + - "Agi: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() + "
" + - "Cha: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString() - ).replace( / /g, " " ); + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].intelligence >= 1) { + document.getElementById("character-overview-text").innerHTML = + ("Hp: " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp + "
" + + "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" + + "Hack: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" + + "Str: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() + "
" + + "Def: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() + "
" + + "Dex: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" + + "Agi: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() + "
" + + "Cha: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString() + "
" + + "Int: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].intelligence).toLocaleString() + ).replace( / /g, " " ); + } else { + document.getElementById("character-overview-text").innerHTML = + ("Hp: " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].max_hp + "
" + + "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" + + "Hack: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" + + "Str: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].strength).toLocaleString() + "
" + + "Def: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].defense).toLocaleString() + "
" + + "Dex: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" + + "Agi: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].agility).toLocaleString() + "
" + + "Cha: " + (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].charisma).toLocaleString() + ).replace( / /g, " " ); + } }, /* Display character info */ @@ -4239,7 +4421,13 @@ let Engine = { if (Engine.Counters.checkFactionInvitations <= 0) { var invitedFactions = __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].checkForFactionInvitations(); if (invitedFactions.length > 0) { - __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd = true; + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd === false) { + __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd = true; + document.getElementById("factions-tab").style.display = "list-item"; + document.getElementById("character-menu-header").click(); + document.getElementById("character-menu-header").click(); + } + var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)]; Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["g" /* inviteToFaction */])(randFaction); } @@ -4254,7 +4442,11 @@ let Engine = { if (Engine.Counters.messages <= 0) { Object(__WEBPACK_IMPORTED_MODULE_18__Message_js__["c" /* checkForMessagesToSend */])(); - Engine.Counters.messages = 150; + if (__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) { + Engine.Counters.messages = 600; //2 minutes for Red pill message + } else { + Engine.Counters.messages = 150; + } } if (Engine.Counters.stockTick <= 0) { @@ -4342,14 +4534,54 @@ let Engine = { document.getElementById("entire-game-container").style.visibility = "visible"; }, - load: function() { - //Load script editor - var editor = ace.edit('javascript-editor'); - editor.getSession().setMode('ace/mode/javascript'); - editor.setTheme('ace/theme/monokai'); - document.getElementById('javascript-editor').style.fontSize='16px'; - editor.setOption("showPrintMargin", false); + //Used when initializing a game + //elems should be an array of all DOM elements under the header + closeMainMenuHeader: function(elems) { + for (var i = 0; i < elems.length; ++i) { + elems[i].style.maxHeight = null; + elems[i].style.opacity = 0; + elems[i].style.pointerEvents = "none"; + } + }, + //Used when initializing the game + //elems should be an array of all DOM elements under the header + openMainMenuHeader: function(elems) { + for (var i = 0; i < elems.length; ++i) { + elems[i].style.maxHeight = elems[i].scrollHeight + "px"; + elems[i].style.display = "block"; + } + }, + + //Used in game when clicking on a main menu header (NOT FOR INITIALIZATION) + //open is a boolean specifying whether its being opened or closed + //elems is an array of DOM elements for main menu tabs (li) + //links is an array of DOM elements for main menu links (a) + toggleMainMenuHeader: function(open, elems, links) { + for (var i = 0; i < elems.length; ++i) { + if (open) { + elems[i].style.opacity = 1; + elems[i].style.maxHeight = elems[i].scrollHeight + "px"; + } else { + elems[i].style.opacity = 0; + elems[i].style.maxHeight = null; + } + } + + for (var i = 0; i < links.length; ++i) { + if (open) { + links[i].style.opacity = 1; + links[i].style.maxHeight = links[i].scrollHeight + "px"; + links[i].style.pointerEvents = "auto"; + } else { + links[i].style.opacity = 0; + links[i].style.maxHeight = null; + links[i].style.pointerEvents = "none"; + } + } + }, + + load: function() { //Initialize main menu accordion panels to all start as "open" var terminal = document.getElementById("terminal-tab"); var createScript = document.getElementById("create-script-tab"); @@ -4414,7 +4646,7 @@ let Engine = { Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["j" /* processPassiveFactionRepGain */])(numCyclesOffline); //Gang progress for BitNode 2 - if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].inGang()) { + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].bitNodeN === 2 && __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].inGang()) { __WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].gang.process(numCyclesOffline); } @@ -4432,45 +4664,20 @@ let Engine = { Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineProductionFromHacknetNodes, 2)); //Close main menu accordions for loaded game - terminal.style.maxHeight = null; - terminal.style.opacity = 0; - terminal.style.pointerEvents = "none"; - createScript.style.maxHeight = null; - createScript.style.opacity = 0; - createScript.style.pointerEvents = "none"; - activeScripts.style.maxHeight = null; - activeScripts.style.opacity = 0; - activeScripts.style.pointerEvents = "none"; - createProgram.style.maxHeight = null; - createProgram.style.opacity = 0; - createProgram.style.pointerEvents = "none"; - stats.style.maxHeight = null; - stats.style.opacity = 0; - stats.style.pointerEvents = "none"; - factions.style.maxHeight = null; - factions.style.opacity = 0; - factions.style.pointerEvents = "none"; - augmentations.style.maxHeight = null; - augmentations.style.opacity = 0; - augmentations.style.pointerEvents = "none"; - hacknetnodes.style.maxHeight = null; - hacknetnodes.style.opacity = 0; - hacknetnodes.style.pointerEvents = "none"; - city.style.maxHeight = null; - city.style.opacity = 0; - city.style.pointerEvents = "none"; - travel.style.maxHeight = null; - travel.style.opacity = 0; - travel.style.pointerEvents = "none"; - job.style.maxHeight = null; - job.style.opacity = 0; - job.style.pointerEvents = "none"; - tutorial.style.maxHeight = null; - tutorial.style.opacity = 0; - tutorial.style.pointerEvents = "none"; - options.style.maxHeight = null; - options.style.opacity = 0; - options.style.pointerEvents = "none"; + var visibleMenuTabs = [terminal, createScript, activeScripts, stats, + hacknetnodes, city, tutorial, options]; + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);} + else {factions.style.display = "none";} + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);} + else {augmentations.style.display = "none";} + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);} + else {job.style.display = "none";} + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);} + else {travel.style.display = "none";} + if (__WEBPACK_IMPORTED_MODULE_21__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);} + else {createProgram.style.display = "none";} + + Engine.closeMainMenuHeader(visibleMenuTabs); } else { //No save found, start new game console.log("Initializing new game"); @@ -4501,32 +4708,19 @@ let Engine = { worldHdr.classList.toggle("opened"); var helpHdr = document.getElementById("help-menu-header"); helpHdr.classList.toggle("opened"); - terminal.style.maxHeight = terminal.scrollHeight + "px"; - terminal.style.display = "block"; - createScript.style.maxHeight = createScript.scrollHeight + "px"; - createScript.style.display = "block"; - activeScripts.style.maxHeight = activeScripts.scrollHeight + "px"; - activeScripts.style.display = "block"; - createProgram.style.maxHeight = createProgram.scrollHeight + "px"; - createProgram.style.display = "block"; - stats.style.maxHeight = stats.scrollHeight + "px"; - stats.style.display = "block"; - factions.style.maxHeight = factions.scrollHeight + "px"; - factions.style.display = "block"; - augmentations.style.maxHeight = augmentations.scrollHeight + "px"; - augmentations.style.display = "block"; - hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px"; - hacknetnodes.style.display = "block"; - city.style.maxHeight = city.scrollHeight + "px"; - city.style.display = "block"; - travel.style.maxHeight = travel.scrollHeight + "px"; - travel.style.display = "block"; - job.style.maxHeight = job.scrollHeight + "px"; - job.style.display = "block"; - tutorial.style.maxHeight = tutorial.scrollHeight + "px"; - tutorial.style.display = "block"; - options.style.maxHeight = options.scrollHeight + "px"; - options.style.display = "block"; + + //Hide tabs that wont be revealed until later + factions.style.display = "none"; + augmentations.style.display = "none"; + job.style.display = "none"; + travel.style.display = "none"; + createProgram.style.display = "none"; + + Engine.openMainMenuHeader( + [terminal, createScript, activeScripts, stats, + hacknetnodes, city, + tutorial, options] + ); //Start interactive tutorial Object(__WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__["d" /* iTutorialStart */])(); @@ -4534,6 +4728,7 @@ let Engine = { } //Initialize labels on game settings Object(__WEBPACK_IMPORTED_MODULE_27__Settings_js__["d" /* setSettingsLabels */])(); + __WEBPACK_IMPORTED_MODULE_31__Terminal_js__["a" /* Terminal */].resetTerminalInput(); }, setDisplayElements: function() { @@ -4674,13 +4869,9 @@ let Engine = { //Main menu accordions var hackingHdr = document.getElementById("hacking-menu-header"); - //hackingHdr.classList.toggle("opened"); var characterHdr = document.getElementById("character-menu-header"); - //characterHdr.classList.toggle("opened"); var worldHdr = document.getElementById("world-menu-header"); - //worldHdr.classList.toggle("opened"); var helpHdr = document.getElementById("help-menu-header"); - //helpHdr.classList.toggle("opened"); hackingHdr.onclick = function() { var terminal = document.getElementById("terminal-tab"); @@ -4694,55 +4885,18 @@ let Engine = { var createProgramNot = document.getElementById("create-program-notification"); this.classList.toggle("opened"); if (terminal.style.maxHeight) { - terminal.style.opacity = 0; - terminal.style.maxHeight = null; - terminalLink.style.opacity = 0; - terminalLink.style.maxHeight = null; - terminalLink.style.pointerEvents = "none"; - - createScript.style.opacity = 0; - createScript.style.maxHeight = null; - createScriptLink.style.opacity = 0; - createScriptLink.style.maxHeight = null; - createScriptLink.style.pointerEvents = "none"; - - activeScripts.style.opacity = 0; - activeScripts.style.maxHeight = null; - activeScriptsLink.style.opacity = 0; - activeScriptsLink.style.maxHeight = null; - activeScriptsLink.style.pointerEvents = "none"; - - createProgram.style.opacity = 0; - createProgram.style.maxHeight = null; - createProgramLink.style.opacity = 0; - createProgramLink.style.maxHeight = null; - createProgramLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [terminal, createScript, activeScripts, createProgram], + [terminalLink, createScriptLink, activeScriptsLink, createProgramLink] + ); createProgramNot.style.display = "none"; } else { - terminal.style.maxHeight = terminal.scrollHeight + "px"; - terminal.style.opacity = 1; - terminalLink.style.maxHeight = terminalLink.scrollHeight + "px"; - terminalLink.style.opacity = 1; - terminalLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [terminal, createScript, activeScripts, createProgram], + [terminalLink, createScriptLink, activeScriptsLink, createProgramLink] + ); - createScript.style.maxHeight = createScript.scrollHeight + "px"; - createScript.style.opacity = 1; - createScriptLink.style.maxHeight = createScriptLink.scrollHeight + "px"; - createScriptLink.style.opacity = 1; - createScriptLink.style.pointerEvents = "auto"; - - activeScripts.style.maxHeight = activeScripts.scrollHeight + "px"; - activeScripts.style.opacity = 1; - activeScriptsLink.style.maxHeight = activeScriptsLink.scrollHeight + "px"; - activeScriptsLink.style.opacity = 1; - activeScriptsLink.style.pointerEvents = "auto"; - - createProgram.style.maxHeight = createProgram.scrollHeight + "px"; - createProgram.style.opacity = 1; - createProgramLink.style.maxHeight = createProgramLink.scrollHeight + "px"; - createProgramLink.style.opacity = 1; - createProgramLink.style.pointerEvents = "auto"; createProgramNot.style.display = "block" } } @@ -4758,53 +4912,15 @@ let Engine = { var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link"); this.classList.toggle("opened"); if (stats.style.maxHeight) { - stats.style.opacity = 0; - stats.style.maxHeight = null; - statsLink.style.opacity = 0; - statsLink.style.maxHeight = null; - statsLink.style.pointerEvents = "none"; - - factions.style.opacity = 0; - factions.style.maxHeight = null; - factionsLink.style.opacity = 0; - factionsLink.style.maxHeight = null; - factionsLink.style.pointerEvents = "none"; - - augmentations.style.opacity = 0; - augmentations.style.maxHeight = null; - augmentationsLink.style.opacity = 0; - augmentationsLink.style.maxHeight = null; - augmentationsLink.style.pointerEvents = "none"; - - hacknetnodes.style.opacity = 0; - hacknetnodes.style.maxHeight = null; - hacknetnodesLink.style.opacity = 0; - hacknetnodesLink.style.maxHeight = null; - hacknetnodesLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [stats, factions, augmentations, hacknetnodes], + [statsLink, factionsLink, augmentationsLink, hacknetnodesLink] + ); } else { - stats.style.maxHeight = stats.scrollHeight + "px"; - stats.style.opacity = 1; - statsLink.style.maxHeight = statsLink.scrollHeight + "px"; - statsLink.style.opacity = 1; - statsLink.style.pointerEvents = "auto"; - - factions.style.maxHeight = factions.scrollHeight + "px"; - factions.style.opacity = 1; - factionsLink.style.maxHeight = factionsLink.scrollHeight + "px"; - factionsLink.style.opacity = 1; - factionsLink.style.pointerEvents = "auto"; - - augmentations.style.maxHeight = augmentations.scrollHeight + "px"; - augmentations.style.opacity = 1; - augmentationsLink.style.maxHeight = augmentationsLink.scrollHeight + "px"; - augmentationsLink.style.opacity = 1; - augmentationsLink.style.pointerEvents = "auto"; - - hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px"; - hacknetnodes.style.opacity = 1; - hacknetnodesLink.style.maxHeight = hacknetnodesLink.scrollHeight + "px"; - hacknetnodesLink.style.opacity = 1; - hacknetnodesLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [stats, factions, augmentations, hacknetnodes], + [statsLink, factionsLink, augmentationsLink, hacknetnodesLink] + ); } } @@ -4817,41 +4933,15 @@ let Engine = { var jobLink = document.getElementById("job-menu-link"); this.classList.toggle("opened"); if (city.style.maxHeight) { - city.style.opacity = 0; - city.style.maxHeight = null; - cityLink.style.opacity = 0; - cityLink.style.maxHeight = null; - cityLink.style.pointerEvents = "none"; - - travel.style.opacity = 0; - travel.style.maxHeight = null; - travelLink.style.opacity = 0; - travelLink.style.maxHeight = null; - travelLink.style.pointerEvents = "none"; - - job.style.opacity = 0; - job.style.maxHeight = null; - jobLink.style.opacity = 0; - jobLink.style.maxHeight = null; - jobLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [city, travel, job], + [cityLink, travelLink, jobLink] + ); } else { - city.style.maxHeight = city.scrollHeight + "px"; - city.style.opacity = 1; - cityLink.style.maxHeight = cityLink.scrollHeight + "px"; - cityLink.style.opacity = 1; - cityLink.style.pointerEvents = "auto"; - - travel.style.maxHeight = travel.scrollHeight + "px"; - travel.style.opacity = 1; - travelLink.style.maxHeight = travelLink.scrollHeight + "px"; - travelLink.style.opacity = 1; - travelLink.style.pointerEvents = "auto"; - - job.style.maxHeight = job.scrollHeight + "px"; - job.style.opacity = 1; - jobLink.style.maxHeight = jobLink.scrollHeight + "px"; - jobLink.style.opacity = 1; - jobLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [city, travel, job], + [cityLink, travelLink, jobLink] + ); } } @@ -4862,29 +4952,15 @@ let Engine = { var optionsLink = document.getElementById("options-menu-link"); this.classList.toggle("opened"); if (tutorial.style.maxHeight) { - tutorial.style.opacity = 0; - tutorial.style.maxHeight = null; - tutorialLink.style.opacity = 0; - tutorialLink.style.maxHeight = null; - tutorialLink.style.pointerEvents = "none"; - - options.style.opacity = 0; - options.style.maxHeight = null; - optionsLink.style.opacity = 0; - optionsLink.style.maxHeight = null; - optionsLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [tutorial, options], + [tutorialLink, optionsLink] + ); } else { - tutorial.style.maxHeight = tutorial.scrollHeight + "px"; - tutorial.style.opacity = 1; - tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px"; - tutorialLink.style.opacity = 1; - tutorialLink.style.pointerEvents = "auto"; - - options.style.maxHeight = options.scrollHeight + "px"; - options.style.opacity = 1; - optionsLink.style.maxHeight = optionsLink.scrollHeight + "px"; - optionsLink.style.opacity = 1; - optionsLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [tutorial, options], + [tutorialLink, optionsLink] + ); } } @@ -5076,14 +5152,15 @@ window.onload = function() { "use strict"; /* unused harmony export getIndicesOf */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertTimeMsToTimeElapsedString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return longestCommonStart; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isPositiveNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return longestCommonStart; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isPositiveNumber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return containsAllStrings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return formatNumber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return numOccurrences; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return numNetscriptOperators; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(2); +/* unused harmony export numNetscriptOperators */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isHTML; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DialogBox_js__ = __webpack_require__(1); //Netburner String helper functions @@ -5146,7 +5223,7 @@ function longestCommonStart(strings) { var A = strings.concat().sort(), a1= A[0], a2= A[A.length-1], L= a1.length, i= 0; - while(i 99) {this.hackDifficulty = 99;} + //Place some arbitrarily limit that realistically should never happen unless someone is + //screwing around with the game + if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;} } Server.prototype.weaken = function(amt) { @@ -5398,26 +5487,26 @@ function initForeignServers() { BachmanAndAssociatesServer.setPortProperties(5); AddToAllServers(BachmanAndAssociatesServer); - var BladeIndustriesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "blade", "Blade Industries", false, false, false, 0); + var BladeIndustriesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "blade", "Blade Industries", false, false, false, 2); BladeIndustriesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(12000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 75)); BladeIndustriesServer.setPortProperties(5); BladeIndustriesServer.messages.push("beyond-man.lit"); AddToAllServers(BladeIndustriesServer); - var NWOServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nwo", "New World Order", false, false, false, 0); + var NWOServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nwo", "New World Order", false, false, false, 2); NWOServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25000000000, 35000000000), 99, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85)); NWOServer.setPortProperties(5); NWOServer.messages.push("the-hidden-world.lit"); AddToAllServers(NWOServer); - var ClarkeIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "clarkeinc", "Clarke Incorporated", false, false, false, 0); + var ClarkeIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "clarkeinc", "Clarke Incorporated", false, false, false, 2); ClarkeIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70)); ClarkeIncorporatedServer.setPortProperties(5); ClarkeIncorporatedServer.messages.push("beyond-man.lit"); ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit"); AddToAllServers(ClarkeIncorporatedServer); - var OmniTekIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnitek", "OmniTek Incorporated", false, false, false, 0); + var OmniTekIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnitek", "OmniTek Incorporated", false, false, false, 2); OmniTekIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(95, 99)); OmniTekIncorporatedServer.setPortProperties(5); OmniTekIncorporatedServer.messages.push("coded-intelligence.lit"); @@ -5461,7 +5550,7 @@ function initForeignServers() { InfoCommServer.setPortProperties(5); AddToAllServers(InfoCommServer); - var HeliosLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "helios", "Helios Labs", false, false, false, 0); + var HeliosLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "helios", "Helios Labs", false, false, false, 2); HeliosLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(550000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80)); HeliosLabsServer.setPortProperties(5); HeliosLabsServer.messages.push("beyond-man.lit"); @@ -5495,7 +5584,7 @@ function initForeignServers() { MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit"); AddToAllServers(MicrodyneTechnologiesServer); - var TaiYangDigitalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "taiyang-digital", "Taiyang Digital", false, false, false, 0); + var TaiYangDigitalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "taiyang-digital", "Taiyang Digital", false, false, false, 2); TaiYangDigitalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80)); TaiYangDigitalServer.setPortProperties(5); TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit"); @@ -5508,7 +5597,7 @@ function initForeignServers() { AddToAllServers(GalacticCyberSystemsServer); //Defense Companies ("Large" Companies) - var AeroCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aerocorp", "AeroCorp", false, false, false, 0); + var AeroCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aerocorp", "AeroCorp", false, false, false, 2); AeroCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65)); AeroCorpServer.setPortProperties(5); AeroCorpServer.messages.push("man-and-machine.lit"); @@ -5519,7 +5608,7 @@ function initForeignServers() { OmniaCybersystemsServer.setPortProperties(5); AddToAllServers(OmniaCybersystemsServer); - var ZBDefenseServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-def", "ZB Defense Industries", false, false, false, 0); + var ZBDefenseServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-def", "ZB Defense Industries", false, false, false, 2); ZBDefenseServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 75)); ZBDefenseServer.setPortProperties(4); ZBDefenseServer.messages.push("synthetic-muscles.lit"); @@ -5530,7 +5619,7 @@ function initForeignServers() { AppliedEnergeticsServer.setPortProperties(4); AddToAllServers(AppliedEnergeticsServer); - var SolarisSpaceSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "solaris", "Solaris Space Systems", false, false, false, 0); + var SolarisSpaceSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "solaris", "Solaris Space Systems", false, false, false, 2); SolarisSpaceSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(700000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80)); SolarisSpaceSystemsServer.setPortProperties(5); SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit"); @@ -5575,7 +5664,7 @@ function initForeignServers() { RhoConstructionServer.setPortProperties(3); AddToAllServers(RhoConstructionServer); - var AlphaEnterprisesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "alpha-ent", "Alpha Enterprises", false, false, false, 0); + var AlphaEnterprisesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "alpha-ent", "Alpha Enterprises", false, false, false, 2); AlphaEnterprisesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 600), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(600000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 60)); AlphaEnterprisesServer.setPortProperties(4); AlphaEnterprisesServer.messages.push("sector-12-crime.lit"); @@ -5612,7 +5701,7 @@ function initForeignServers() { SysCoreSecuritiesServer.setPortProperties(4); AddToAllServers(SysCoreSecuritiesServer); - var CatalystVenturesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "catalyst", "Catalyst Ventures", false, false, false, 0); + var CatalystVenturesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "catalyst", "Catalyst Ventures", false, false, false, 2); CatalystVenturesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(300000000, 550000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 55)); CatalystVenturesServer.setPortProperties(3); CatalystVenturesServer.messages.push("tensions-in-tech-race.lit"); @@ -5629,7 +5718,7 @@ function initForeignServers() { CompuTekServer.messages.push("man-and-machine.lit"); AddToAllServers(CompuTekServer); - var NetLinkTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "netlink", "NetLink Technologies", false, false, false, 0); + var NetLinkTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "netlink", "NetLink Technologies", false, false, false, 2); NetLinkTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(375, 425), 275000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 75)); NetLinkTechnologiesServer.setPortProperties(3); NetLinkTechnologiesServer.messages.push("simulated-reality.lit"); @@ -5657,7 +5746,7 @@ function initForeignServers() { JoesGunsServer.setPortProperties(0); AddToAllServers(JoesGunsServer); - var Zer0NightclubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zer0", "ZER0 Nightclub", false, false, false, 4); + var Zer0NightclubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zer0", "ZER0 Nightclub", false, false, false, 16); Zer0NightclubServer.setHackingParameters(75, 7500000, 25, 40); Zer0NightclubServer.setPortProperties(1); AddToAllServers(Zer0NightclubServer); @@ -5667,13 +5756,13 @@ function initForeignServers() { NectarNightclubServer.setPortProperties(0); AddToAllServers(NectarNightclubServer); - var NeoNightclubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "neo-net", "Neo Nightclub Network", false, false, false, 4); + var NeoNightclubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "neo-net", "Neo Nightclub Network", false, false, false, 16); NeoNightclubServer.setHackingParameters(50, 5000000, 25, 25); NeoNightclubServer.setPortProperties(1); NeoNightclubServer.messages.push("the-hidden-world.lit"); AddToAllServers(NeoNightclubServer); - var SilverHelixServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "silver-helix", "Silver Helix", false, false, false, 2); + var SilverHelixServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "silver-helix", "Silver Helix", false, false, false, 32); SilverHelixServer.setHackingParameters(150, 45000000, 30, 30); SilverHelixServer.setPortProperties(2); SilverHelixServer.messages.push("new-triads.lit"); @@ -5690,17 +5779,17 @@ function initForeignServers() { HaraKiriSushiBarServer.setPortProperties(0); AddToAllServers(HaraKiriSushiBarServer); - var PhantasyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "phantasy", "Phantasy Club", false, false, false, 0); + var PhantasyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "phantasy", "Phantasy Club", false, false, false, 16); PhantasyServer.setHackingParameters(100, 24000000, 20, 35); PhantasyServer.setPortProperties(2); AddToAllServers(PhantasyServer); - var MaxHardwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "max-hardware", "Max Hardware Store", false, false, false, 4); + var MaxHardwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "max-hardware", "Max Hardware Store", false, false, false, 16); MaxHardwareServer.setHackingParameters(80, 10000000, 15, 30); MaxHardwareServer.setPortProperties(1); AddToAllServers(MaxHardwareServer); - var OmegaSoftwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omega-net", "Omega Software", false, false, false, 8); + var OmegaSoftwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omega-net", "Omega Software", false, false, false, 16); OmegaSoftwareServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(180, 220), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60000000, 70000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 35), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 40)); OmegaSoftwareServer.setPortProperties(2); OmegaSoftwareServer.messages.push("the-new-god.lit"); @@ -5712,7 +5801,7 @@ function initForeignServers() { CrushFitnessGymServer.setPortProperties(2); AddToAllServers(CrushFitnessGymServer); - var IronGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "iron-gym", "Iron Gym Network", false, false, false, 4); + var IronGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "iron-gym", "Iron Gym Network", false, false, false, 16); IronGymServer.setHackingParameters(100, 20000000, 30, 20); IronGymServer.setPortProperties(1); AddToAllServers(IronGymServer); @@ -5733,7 +5822,7 @@ function initForeignServers() { AddToAllServers(SnapFitnessGymServer); //Faction servers, cannot hack money from these - var BitRunnersServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "run4theh111z", "The Runners", false, false, false, 0); + var BitRunnersServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "run4theh111z", "The Runners", false, false, false, 2); BitRunnersServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(505, 550), 0, 0, 0); BitRunnersServer.setPortProperties(4); BitRunnersServer.messages.push("simulated-reality.lit"); @@ -5741,14 +5830,14 @@ function initForeignServers() { AddToAllServers(BitRunnersServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].BitRunnersServer, BitRunnersServer.ip); - var TheBlackHandServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "I.I.I.I", "I.I.I.I", false, false, false, 0); + var TheBlackHandServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "I.I.I.I", "I.I.I.I", false, false, false, 2); TheBlackHandServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(340, 365), 0, 0, 0); TheBlackHandServer.setPortProperties(3); TheBlackHandServer.messages.push("democracy-is-dead.lit"); AddToAllServers(TheBlackHandServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheBlackHandServer, TheBlackHandServer.ip); - var NiteSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "avmnite-02h", "NiteSec", false, false, false, 0); + var NiteSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "avmnite-02h", "NiteSec", false, false, false, 2); NiteSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(202, 220), 0, 0, 0); NiteSecServer.setPortProperties(2); NiteSecServer.messages.push("democracy-is-dead.lit"); @@ -5761,14 +5850,14 @@ function initForeignServers() { AddToAllServers(DarkArmyServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheDarkArmyServer, DarkArmyServer.ip); - var CyberSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "CSEC", "CyberSec", false, false, false, 0); + var CyberSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "CSEC", "CyberSec", false, false, false, 2); CyberSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(51, 60), 0, 0, 0); CyberSecServer.setPortProperties(1); CyberSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(CyberSecServer); __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].CyberSecServer, CyberSecServer.ip); - var DaedalusServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "The-Cave", "Helios", false, false, false, 0); + var DaedalusServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "The-Cave", "Helios", false, false, false, 2); DaedalusServer.setHackingParameters(925, 0, 0, 0); DaedalusServer.setPortProperties(5); DaedalusServer.messages.push("alpha-omega.lit"); @@ -5912,13 +6001,14 @@ function processSingleServerGrowth(server, numCycles) { serverGrowth = 1; } + var oldMoneyAvailable = server.moneyAvailable; server.moneyAvailable *= serverGrowth; if (server.moneyMax && isNaN(server.moneyAvailable)) { server.moneyAvailable = server.moneyMax; } if (server.moneyMax && server.moneyAvailable > server.moneyMax) { server.moneyAvailable = server.moneyMax; - return 1; + return server.moneyAvailable / oldMoneyAvailable; } //Growing increases server security twice as much as hacking @@ -16413,7 +16503,27 @@ function initBitNodes() { "upgrade its level up to a maximum of 3. This Source-File lets you access and use the Singularity " + "Functions in other BitNodes. Each level of this Source-File will open up more Singularity Functions " + "that you can use."); - BitNodes["BitNode5"] = new BitNode(5, "Artificial Intelligence", "COMING SOON"); //Int + BitNodes["BitNode5"] = new BitNode(5, "Artificial Intelligence", "Posthuman", "They said it couldn't be done. They said the human brain, " + + "along with its consciousness and intelligence, couldn't be replicated. They said the complexity " + + "of the brain results from unpredictable, nonlinear interactions that couldn't be modeled " + + "by 1's and 0's. They were wrong.

" + + "In this BitNode:

" + + "The base security level of servers is doubled
" + + "The starting money on servers is halved, but the maximum money is doubled
" + + "Most methods of earning money now give significantly less
" + + "Augmentations are more expensive
" + + "Hacking experience gain rates are reduced

" + + "Destroying this BitNode will give you Source-File 5, or if you already have this Source-File it will " + + "upgrade its level up to a maximum of 3. This Source-File grants you a special new stat called Intelligence. " + + "Intelligence is unique because it is permanent and persistent (it never gets reset back to 1). However " + + "gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't know " + + "when you gain experience and how much). Higher Intelligence levels will boost your production for many actions " + + "in the game.

" + + "In addition, this Source-File will unlock the getBitNodeMultipliers() Netscript function, " + + "and will also raise all of your hacking-related multipliers by:

" + + "Level 1: 4%
" + + "Level 2: 6%
" + + "Level 3: 7%"); BitNodes["BitNode6"] = new BitNode(6, "Hacktocracy", "COMING SOON"); //Healthy Hacknet balancing mechanic BitNodes["BitNode7"] = new BitNode(7, "Do Androids Dream?", "COMING SOON"); //Build androids for automation BitNodes["BitNode8"] = new BitNode(8, "Ghost of Wall Street", "COMING SOON"); //Trading only viable strategy @@ -16447,6 +16557,7 @@ let BitNodeMultipliers = { ServerStartingMoney: 1, ServerGrowthRate: 1, ServerWeakenRate: 1, + ServerStartingSecurity: 1, ManualHackMoney: 1, ScriptHackMoney: 1, @@ -16478,7 +16589,7 @@ function initBitNodeMultipliers() { } switch (__WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].bitNodeN) { - case 1: + case 1: //Source Genesis (every multiplier is 1) break; case 2: //Rise of the Underworld BitNodeMultipliers.ServerMaxMoney = 0.2; @@ -16499,6 +16610,16 @@ function initBitNodeMultipliers() { BitNodeMultipliers.CrimeExpGain = 0.5; BitNodeMultipliers.FactionWorkRepGain = 0.75; break; + case 5: //Artificial intelligence + BitNodeMultipliers.ServerMaxMoney = 2; + BitNodeMultipliers.ServerStartingSecurity = 2; + BitNodeMultipliers.ServerStartingMoney = 0.5; + BitNodeMultipliers.ScriptHackMoney = 0.25; + BitNodeMultipliers.HacknetNodeMoney = 0.2; + BitNodeMultipliers.CrimeMoney = 0.5; + BitNodeMultipliers.AugmentationMoneyCost = 2; + BitNodeMultipliers.HackExpGain = 0.5; + break; case 11: //The Big Crash BitNodeMultipliers.ServerMaxMoney = 0.1; BitNodeMultipliers.ServerStartingMoney = 0.25; @@ -16533,20 +16654,20 @@ function initBitNodeMultipliers() { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Faction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return purchaseAugmentation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return factionExists; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(53); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Player_js__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_FactionInvitationBox_js__ = __webpack_require__(54); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_FactionInvitationBox_js__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_JSONReviver_js__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(21); @@ -16569,7 +16690,7 @@ function factionInit() { $('#faction-donate-input').on('input', function() { if (__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Page.Faction) { var val = document.getElementById("faction-donate-input").value; - if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["d" /* isPositiveNumber */])(val)) { + if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(val)) { var numMoneyDonate = Number(val); document.getElementById("faction-donate-rep-gain").innerHTML = "This donation will result in " + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(numMoneyDonate/1000000 * __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].faction_rep_mult, 3) + " reputation gain"; @@ -17028,7 +17149,7 @@ function displayFactionContent(factionName) { newDonateWorkButton.addEventListener("click", function() { var donateAmountVal = document.getElementById("faction-donate-input").value; - if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["d" /* isPositiveNumber */])(donateAmountVal)) { + if (Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["e" /* isPositiveNumber */])(donateAmountVal)) { var numMoneyDonate = Number(donateAmountVal); if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(numMoneyDonate)) { Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to donate this much money!"); @@ -17312,7 +17433,10 @@ function displayFactionContent(factionName) { } function displayFactionAugmentations(factionName) { - document.getElementById("faction-augmentations-page-desc").innerHTML = "Lists all augmentations that are available to purchase from " + factionName; + document.getElementById("faction-augmentations-page-desc").innerHTML = + "Lists all Augmentations that are available to purchase from " + factionName + "

" + + "Augmentations are powerful upgrades that will enhance your abilities."; + var faction = Factions[factionName]; var augmentationsList = document.getElementById("faction-augmentations-list"); @@ -17395,7 +17519,7 @@ function purchaseAugmentationBoxCreate(aug, fac) { Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); }); - Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("

aug.name


" + + Object(__WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("

" + aug.name + "


" + aug.info + "

" + "
Would you like to purchase the " + aug.name + " Augmentation for $" + Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * fac.augmentationPriceMult, 2) + "?"); @@ -17454,7 +17578,12 @@ function purchaseAugmentation(aug, fac, sing=false) { var txt = "You must first install the Bionic Arms augmentation before installing this upgrade"; if (sing) {return txt;} else {Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);} } else if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.gte(aug.baseCost * fac.augmentationPriceMult)) { - __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstAugPurchased = true; + if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstAugPurchased === false) { + __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstAugPurchased = true; + document.getElementById("augmentations-tab").style.display = "list-item"; + document.getElementById("character-menu-header").click(); + document.getElementById("character-menu-header").click(); + } var queuedAugmentation = new __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["d" /* PlayerOwnedAugmentation */](aug.name); if (aug.name == __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) { @@ -17612,20 +17741,20 @@ function initSpecialServerIps() { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Locations; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return displayLocationContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initLocationButtons; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(18); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(40); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(37); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(51); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(44); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(55); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(63); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__ = __webpack_require__(21); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_YesNoBox_js__ = __webpack_require__(21); @@ -17733,7 +17862,7 @@ function displayLocationContent() { console.log("displayLocationContent() called with location " + __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location) } - var returnToWorld = document.getElementById("location-return-to-world-button"); + var returnToWorld = document.getElementById("location-return-to-world-button"); var locationName = document.getElementById("location-name"); @@ -17917,7 +18046,7 @@ function displayLocationContent() { //Check if the player is employed at this Location. If he is, display the "Work" button, //update the job title, etc. - if (loc == __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyName) { + if (loc != "" && loc === __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyName) { var company = __WEBPACK_IMPORTED_MODULE_0__Company_js__["a" /* Companies */][loc]; jobTitle.style.display = "block"; @@ -18033,7 +18162,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumECorp, - 6000, 116, 150, 9.5); + 6000, 116, 150, 8.5); break; case Locations.AevumBachmanAndAssociates: @@ -18046,7 +18175,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates, - 1500, 42, 60, 6.5); + 1500, 42, 60, 5.75); break; case Locations.AevumClarkeIncorporated: @@ -18059,7 +18188,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated, - 2400, 34, 75, 6); + 2400, 34, 75, 5.4); break; case Locations.AevumFulcrumTechnologies: @@ -18078,7 +18207,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies, - 6000, 96, 100, 10); + 6000, 96, 100, 9); break; case Locations.AevumAeroCorp: @@ -18090,7 +18219,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumAeroCorp, - 2000, 32, 50, 7); + 2000, 32, 50, 6.3); break; case Locations.AevumGalacticCybersystems: @@ -18103,7 +18232,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems, - 1400, 30, 50, 6); + 1400, 30, 50, 5.3); break; case Locations.AevumWatchdogSecurity: @@ -18117,7 +18246,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity, - 850, 16, 30, 5); + 850, 16, 30, 4.5); break; case Locations.AevumRhoConstruction: @@ -18126,7 +18255,7 @@ function displayLocationContent() { softwareJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction, - 600, 12, 20, 3); + 600, 12, 20, 2.7); break; case Locations.AevumPolice: @@ -18135,7 +18264,7 @@ function displayLocationContent() { softwareJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumPolice, - 700, 14, 25, 3.5); + 700, 14, 25, 3.2); break; case Locations.AevumNetLinkTechnologies: @@ -18153,7 +18282,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies, - 160, 10, 15, 2); + 160, 10, 15, 1.8); break; case Locations.AevumCrushFitnessGym: @@ -18187,7 +18316,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational, - 5500, 48, 100, 10); + 5500, 48, 100, 9); break; case Locations.ChongqingSolarisSpaceSystems: @@ -18199,7 +18328,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems, - 3600, 26, 75, 9.5); + 3600, 26, 75, 8.6); break; @@ -18228,7 +18357,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp, - 6000, 114, 125, 11); + 6000, 114, 125, 9.8); break; case Locations.Sector12BladeIndustries: @@ -18241,7 +18370,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries, - 3000, 46, 100, 7.5); + 3000, 46, 100, 6.7); break; case Locations.Sector12FourSigma: @@ -18254,7 +18383,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12FourSigma, - 1500, 58, 100, 11.5); + 1500, 58, 100, 10.2); break; case Locations.Sector12IcarusMicrosystems: @@ -18267,7 +18396,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems, - 900, 32, 70, 8.5); + 900, 32, 70, 7.8); break; case Locations.Sector12UniversalEnergy: @@ -18280,7 +18409,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy, - 775, 24, 50, 7); + 775, 24, 50, 6.3); break; case Locations.Sector12DeltaOne: @@ -18292,7 +18421,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne, - 1200, 38, 75, 7); + 1200, 38, 75, 6.3); break; case Locations.Sector12CIA: @@ -18305,7 +18434,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12CIA, - 1450, 44, 80, 8.5); + 1450, 44, 80, 7.6); break; case Locations.Sector12NSA: @@ -18318,7 +18447,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12NSA, - 1400, 40, 80, 8); + 1400, 40, 80, 7.2); break; case Locations.Sector12AlphaEnterprises: @@ -18332,7 +18461,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises, - 250, 14, 40, 3); + 250, 14, 40, 2.7); break; case Locations.Sector12CarmichaelSecurity: @@ -18346,7 +18475,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity, - 500, 18, 60, 3); + 500, 18, 60, 2.7); break; case Locations.Sector12FoodNStuff: @@ -18362,7 +18491,7 @@ function displayLocationContent() { employeeJob.style.display = "block"; employeePartTimeJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns, - 120, 8, 20, 2.5); + 120, 8, 20, 2.2); break; case Locations.Sector12IronGym: @@ -18395,7 +18524,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm, - 1300, 28, 70, 6); + 1300, 28, 70, 5.4); break; case Locations.NewTokyoVitaLife: @@ -18408,7 +18537,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife, - 750, 22, 100, 5.5); + 750, 22, 100, 5); break; case Locations.NewTokyoGlobalPharmaceuticals: @@ -18422,7 +18551,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals, - 900, 24, 80, 6); + 900, 24, 80, 5.4); break; case Locations.NewTokyoNoodleBar: @@ -18461,7 +18590,7 @@ function displayLocationContent() { purchase256gb.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies, - 700, 24, 100, 6.5); + 700, 24, 100, 5.9); break; case Locations.IshimaNovaMedical: @@ -18474,7 +18603,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical, - 600, 20, 50, 5); + 600, 20, 50, 4.5); break; case Locations.IshimaOmegaSoftware: @@ -18492,7 +18621,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware, - 200, 10, 40, 2.5); + 200, 10, 40, 2.3); break; case Locations.VolhavenTravelAgency: @@ -18525,7 +18654,7 @@ function displayLocationContent() { purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated, - 1500, 44, 100, 7); + 1500, 44, 100, 6.3); break; case Locations.VolhavenNWO: @@ -18538,7 +18667,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenNWO, - 1800, 56, 200, 8); + 1800, 56, 200, 7.2); break; case Locations.VolhavenHeliosLabs: @@ -18550,7 +18679,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs, - 1200, 28, 75, 6); + 1200, 28, 75, 5.4); break; case Locations.VolhavenOmniaCybersystems: @@ -18562,7 +18691,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems, - 900, 28, 90, 6.5); + 900, 28, 90, 5.8); break; case Locations.VolhavenLexoCorp: @@ -18576,7 +18705,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp, - 500, 14, 40, 3.5); + 500, 14, 40, 3.1); break; case Locations.VolhavenSysCoreSecurities: @@ -18587,7 +18716,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities, - 600, 16, 50, 4); + 600, 16, 50, 3.6); break; case Locations.VolhavenCompuTek: @@ -18608,7 +18737,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek, - 300, 12, 35, 3.5); + 300, 12, 35, 3.1); break; case Locations.VolhavenMilleniumFitnessGym: @@ -19453,7 +19582,13 @@ function initLocationButtons() { } function travelToCity(destCityName, cost) { - __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].firstTimeTraveled = true; + if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].firstTimeTraveled === false) { + __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].firstTimeTraveled = true; + document.getElementById("travel-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } + if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].money.lt(cost)) { Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to travel to " + destCityName); return; @@ -19665,7 +19800,7 @@ function purchaseServerBoxCreate(ram, cost) { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadSettings; }); /* Settings.js */ let Settings = { - CodeInstructionRunTime: 100, + CodeInstructionRunTime: 50, MaxLogCapacity: 50, MaxPortCapacity: 50, SuppressMessages: false, @@ -19677,7 +19812,7 @@ function loadSettings(saveString) { } function initSettings() { - Settings.CodeInstructionRunTime = 100; + Settings.CodeInstructionRunTime = 50; Settings.MaxLogCapacity = 50; Settings.MaxPortCapacity = 50; Settings.SuppressMessages = false; @@ -19873,7 +20008,12 @@ function getNumAvailableCreateProgram() { if (!__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hasProgram(Programs.AutoLink) && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill >= 25) { ++count; } - if (count > 0) {__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].firstProgramAvailable = true;} + if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].firstProgramAvailable === false && count > 0) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].firstProgramAvailable = true; + document.getElementById("create-program-tab").style.display = "list-item"; + document.getElementById("hacking-menu-header").click(); + document.getElementById("hacking-menu-header").click(); + } return count; } @@ -19947,17 +20087,17 @@ function initCreateProgramButtons() { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return addWorkerScript; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return updateOnlineScriptTimes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeWorkerScripts; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(45); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(33); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(57); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(65); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2); @@ -19983,6 +20123,7 @@ function WorkerScript(runningScriptObj) { this.scriptRef = runningScriptObj; this.errorMessage = ""; this.args = runningScriptObj.args; + this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay()) } //Returns the server on which the workerScript is running @@ -20016,6 +20157,34 @@ function prestigeWorkerScripts() { //Loop through workerScripts and run every script that is not currently running function runScriptsLoop() { + //Delete any scripts that finished or have been killed. Loop backwards bc removing + //items fucks up the indexing + for (var i = workerScripts.length - 1; i >= 0; i--) { + if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { + console.log("Deleting script: " + workerScripts[i].name); + //Delete script from the runningScripts array on its host serverIp + var ip = workerScripts[i].serverIp; + var name = workerScripts[i].name; + + for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.length; j++) { + if (__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].filename == name && + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["c" /* compareArrays */])(__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].args, workerScripts[i].args)) { + __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.splice(j, 1); + break; + } + } + + //Free RAM + __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage; + + //Delete script from Active Scripts + Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]); + + //Delete script from workerScripts + workerScripts.splice(i, 1); + } + } + //Run any scripts that haven't been started for (var i = 0; i < workerScripts.length; i++) { //If it isn't running, start the script @@ -20078,35 +20247,7 @@ function runScriptsLoop() { } } - //Delete any scripts that finished or have been killed. Loop backwards bc removing - //items fucks up the indexing - for (var i = workerScripts.length - 1; i >= 0; i--) { - if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { - console.log("Deleting script: " + workerScripts[i].name); - //Delete script from the runningScripts array on its host serverIp - var ip = workerScripts[i].serverIp; - var name = workerScripts[i].name; - - for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.length; j++) { - if (__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].filename == name && - Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["c" /* compareArrays */])(__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].args, workerScripts[i].args)) { - __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.splice(j, 1); - break; - } - } - - //Free RAM - __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage; - - //Delete script from Active Scripts - Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]); - - //Delete script from workerScripts - workerScripts.splice(i, 1); - } - } - - setTimeout(runScriptsLoop, 10000); + setTimeout(runScriptsLoop, 6000); } //Queues a script to be killed by settings its stop flag to true. Then, the code will reject @@ -20117,6 +20258,7 @@ function killWorkerScript(runningScriptObj, serverIp) { if (workerScripts[i].name == runningScriptObj.filename && workerScripts[i].serverIp == serverIp && Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["c" /* compareArrays */])(workerScripts[i].args, runningScriptObj.args)) { workerScripts[i].env.stopFlag = true; + workerScripts[i].killTrigger(); return true; } } @@ -20166,6 +20308,60 @@ function updateOnlineScriptTimes(numCycles = 1) { /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createRandomIp; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ipExists; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isValidIPAddress; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Server_js__ = __webpack_require__(6); + +/* Functions to deal with manipulating IP addresses*/ + +//Generate a random IP address +//Will not return an IP address that already exists in the AllServers array +function createRandomIp() { + var ip = createRandomByte(99) +'.' + + createRandomByte(9) +'.' + + createRandomByte(9) +'.' + + createRandomByte(9); + + //If the Ip already exists, recurse to create a new one + if (ipExists(ip)) { + return createRandomIp(); + } + return ip; +} + +//Returns true if the IP already exists in one of the game's servers +function ipExists(ip) { + for (var property in __WEBPACK_IMPORTED_MODULE_0__src_Server_js__["b" /* AllServers */]) { + if (__WEBPACK_IMPORTED_MODULE_0__src_Server_js__["b" /* AllServers */].hasOwnProperty(property)) { + if (property == ip) { + return true; + } + } + } + return false; +} + +function createRandomByte(n=9) { + return Math.round(Math.random()*n); +} + +function isValidIPAddress(ipaddress) { + if (/^(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) + { + return true; + } + return false; +} + + + + +/***/ }), +/* 17 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AugmentationNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Augmentations; }); @@ -20178,9 +20374,9 @@ function updateOnlineScriptTimes(numCycles = 1) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(31); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(32); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7); @@ -22134,7 +22330,7 @@ function giveAllAugmentations() { /***/ }), -/* 17 */ +/* 18 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -22414,58 +22610,58 @@ let CompanyPositions = { //Constructor: CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary) //Software - SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 30), - JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 72), - SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 40000, 150), - LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 200000, 450), + SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 33), + JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 80), + SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 40000, 165), + LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 200000, 500), //TODO Through darkweb, maybe? FreelanceDeveloper: new CompanyPosition("Freelance Developer", 0, 0, 0, 0, 0, 0, 0, 0), - SoftwareConsultant: new CompanyPosition("Software Consultant", 51, 0, 0, 0, 0, 0, 0, 60), - SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 120), + SoftwareConsultant: new CompanyPosition("Software Consultant", 51, 0, 0, 0, 0, 0, 0, 66), + SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 132), //IT - ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 24), - ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 7000, 60), - ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 35000, 120), - SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 175000, 375), - SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 35000, 110), - NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 35000, 110), - NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 175000, 375), + ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 26), + ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 7000, 66), + ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 35000, 132), + SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 175000, 410), + SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 35000, 121), + NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 35000, 121), + NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 175000, 410), //Technology management - HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 400000, 720), - HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 800000, 1500), - VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1600000, 2100), - CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 3200000, 2400), + HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 400000, 800), + HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 800000, 1650), + VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1600000, 2310), + CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 3200000, 2640), //Business - BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 42), - BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 90), - BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 40000, 180), - OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 200000, 600), - CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 800000, 1800), - CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 3200000, 3600), + BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 46), + BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 100), + BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 40000, 200), + OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 200000, 660), + CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 800000, 1950), + CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 3200000, 3900), - BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 80), - SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 480), + BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 88), + SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 525), //Non-tech/management jobs - PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 18), - PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 18), + PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 20), + PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 20), - Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 20), - Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 20), - PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 75), - PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 36000, 425), - SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 45), - SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 175), - SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 36000, 600), - HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 1200), - FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 300), - SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 201, 32000, 900), - SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 251, 162000, 1800), + Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 22), + Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 22), + PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 82), + PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 36000, 460), + SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 50), + SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 195), + SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 36000, 660), + HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 1320), + FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 330), + SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 201, 32000, 990), + SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 251, 162000, 2000), init: function() { //Argument order: hack, str, def, dex, agi, cha @@ -23301,7 +23497,7 @@ function getJobRequirementText(company, pos, tooltiptext=false) { /***/ }), -/* 18 */ +/* 19 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -23313,18 +23509,28 @@ function getJobRequirementText(company, pos, tooltiptext=false) { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AllServersMap; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__ = __webpack_require__(22); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__InteractiveTutorial_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(15); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5); -var ace = __webpack_require__(33); -__webpack_require__(35); -__webpack_require__(36); +var ace = __webpack_require__(48); +__webpack_require__(51); +__webpack_require__(52); +__webpack_require__(53); +__webpack_require__(54); +__webpack_require__(55); +__webpack_require__(56); +__webpack_require__(57); +__webpack_require__(58); +__webpack_require__(59); +__webpack_require__(60); +__webpack_require__(61); +__webpack_require__(62); @@ -23339,6 +23545,14 @@ __webpack_require__(36); + + +var keybindings = { + ace: null, + vim: "ace/keyboard/vim", + emacs: "ace/keyboard/emacs", +}; + function scriptEditorInit() { //Initialize save and close button var closeButton = document.getElementById("script-editor-save-and-close-button"); @@ -23348,26 +23562,59 @@ function scriptEditorInit() { return false; }); - //Allow tabs (four spaces) in all textareas - var textareas = document.getElementsByTagName('textarea'); - var count = textareas.length; - for(var i=0;i' + input.replace( / /g, " " ) + ''); } else { $("#terminal-input").before('' + input + ''); } - updateTerminalScroll(); } @@ -23978,10 +24217,10 @@ $(document).keydown(function(event) { event.preventDefault(); //Prevent newline from being entered in Script Editor var command = $('input[class=terminal-input]').val(); if (command.length > 0) { - post("> " + command); + post("[" + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname + " ~]> " + command); + Terminal.resetTerminalInput(); //Clear input first Terminal.executeCommand(command); - $('input[class=terminal-input]').val(""); } } @@ -24107,7 +24346,7 @@ $(document).keyup(function(e) { // index - index of argument that is being "tab completed". By default is 0, the first argument function tabCompletion(command, arg, allPossibilities, index=0) { if (!(allPossibilities.constructor === Array)) {return;} - if (!Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["a" /* containsAllStrings */])(allPossibilities)) {return;} + if (!Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["a" /* containsAllStrings */])(allPossibilities)) {return;} if (!command.startsWith("./")) { command = command.toLowerCase(); @@ -24117,13 +24356,13 @@ function tabCompletion(command, arg, allPossibilities, index=0) { //that we are attempting to autocomplete if (arg == "") { for (var i = allPossibilities.length-1; i >= 0; --i) { - if (!allPossibilities[i].startsWith(command)) { + if (!allPossibilities[i].toLowerCase().startsWith(command.toLowerCase())) { allPossibilities.splice(i, 1); } } } else { for (var i = allPossibilities.length-1; i >= 0; --i) { - if (!allPossibilities[i].startsWith(arg)) { + if (!allPossibilities[i].toLowerCase().startsWith(arg.toLowerCase())) { allPossibilities.splice(i, 1); } } @@ -24142,7 +24381,7 @@ function tabCompletion(command, arg, allPossibilities, index=0) { document.getElementById("terminal-input-text-box").value = val; document.getElementById("terminal-input-text-box").focus(); } else { - var longestStartSubstr = Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["f" /* longestCommonStart */])(allPossibilities); + var longestStartSubstr = Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["g" /* longestCommonStart */])(allPossibilities); //If the longest common starting substring of remaining possibilities is the same //as whatevers already in terminal, just list all possible options. Otherwise, //change the input in the terminal to the longest common starting substr @@ -24176,7 +24415,7 @@ function tabCompletion(command, arg, allPossibilities, index=0) { function determineAllPossibilitiesForTabCompletion(input, index=0) { var allPos = []; allPos = allPos.concat(Object.keys(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["b" /* GlobalAliases */])); - var currServ = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); input = input.toLowerCase(); //If the command starts with './' and the index == -1, then the user @@ -24189,7 +24428,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } //Programs are on home computer - var homeComputer = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getHomeComputer(); + var homeComputer = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer(); for(var i = 0; i < homeComputer.programs.length; ++i) { allPos.push("./" + homeComputer.programs[i]); } @@ -24211,10 +24450,10 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } if (input.startsWith("scp ") && index == 1) { - for (var iphostname in __WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */]) { - if (__WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */].hasOwnProperty(iphostname)) { - allPos.push(__WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */][iphostname].ip); - allPos.push(__WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */][iphostname].hostname); + for (var iphostname in __WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */]) { + if (__WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */].hasOwnProperty(iphostname)) { + allPos.push(__WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */][iphostname].ip); + allPos.push(__WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */][iphostname].hostname); } } } @@ -24234,7 +24473,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { if (input.startsWith("connect ") || input.startsWith("telnet ")) { //All network connections for (var i = 0; i < currServ.serversOnNetwork.length; ++i) { - var serv = __WEBPACK_IMPORTED_MODULE_13__Server_js__["b" /* AllServers */][currServ.serversOnNetwork[i]]; + var serv = __WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */][currServ.serversOnNetwork[i]]; if (serv == null) {continue;} allPos.push(serv.ip); //IP allPos.push(serv.hostname); //Hostname @@ -24243,7 +24482,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } if (input.startsWith("kill ") || input.startsWith("nano ") || - input.startsWith("tail ") || input.startsWith("rm ") || + input.startsWith("tail ") || input.startsWith("mem ") || input.startsWith("check ")) { //All Scripts for (var i = 0; i < currServ.scripts.length; ++i) { @@ -24252,6 +24491,22 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { return allPos; } + if (input.startsWith("rm ")) { + for (var i = 0; i < currServ.scripts.length; ++i) { + allPos.push(currServ.scripts[i].filename); + } + for (var i = 0; i < currServ.programs.length; ++i) { + allPos.push(currServ.programs[i]); + } + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["f" /* isString */])(currServ.messages[i]) && + currServ.messages[i].endsWith(".lit")) { + allPos.push(currServ.messages[i]); + } + } + return allPos; + } + if (input.startsWith("run ")) { //All programs and scripts for (var i = 0; i < currServ.scripts.length; ++i) { @@ -24259,7 +24514,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } //Programs are on home computer - var homeComputer = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getHomeComputer(); + var homeComputer = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer(); for(var i = 0; i < homeComputer.programs.length; ++i) { allPos.push(homeComputer.programs[i]); } @@ -24296,52 +24551,63 @@ let Terminal = { } }, + resetTerminalInput: function() { + document.getElementById("terminal-input-td").innerHTML = + "
[" + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname + " ~]" + "$
" + + ''; + var hdr = document.getElementById("terminal-input-header"); + hdr.style.display = "inline"; + var lineWidth = document.getElementById("terminal-input-td").offsetWidth; + var width = lineWidth - hdr.offsetWidth - 10; + document.getElementById("terminal-input-text-box").style.width = width + "px"; + }, + //Complete the hack/analyze command finishHack: function(cancelled = false) { if (cancelled == false) { - var server = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var server = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); //Calculate whether hack was successful - var hackChance = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].calculateHackingChance(); + var hackChance = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingChance(); var rand = Math.random(); console.log("Hack success chance: " + hackChance + ", rand: " + rand); - var expGainedOnSuccess = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].calculateExpGain(); + var expGainedOnSuccess = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateExpGain(); var expGainedOnFailure = (expGainedOnSuccess / 4); if (rand < hackChance) { //Success! - if (__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] && - __WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] == server.ip) { - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].bitNodeN == null) { - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].bitNodeN = 1; + if (__WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] && + __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon] == server.ip) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == null) { + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN = 1; } - Object(__WEBPACK_IMPORTED_MODULE_11__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].bitNodeN); + Object(__WEBPACK_IMPORTED_MODULE_12__RedPill_js__["a" /* hackWorldDaemon */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN); return; } server.manuallyHacked = true; - var moneyGained = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].calculatePercentMoneyHacked(); + var moneyGained = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculatePercentMoneyHacked(); moneyGained = Math.floor(server.moneyAvailable * moneyGained); - //Safety check - if (moneyGained <= 0) {moneyGained = 0;} + if (moneyGained <= 0) {moneyGained = 0;} //Safety check server.moneyAvailable -= moneyGained; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].gainMoney(moneyGained); - - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess) + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainMoney(moneyGained); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess) + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(expGainedOnSuccess / __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].IntelligenceTerminalHackBaseExpGain); server.fortify(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount); - post("Hack successful! Gained $" + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " hacking EXP"); + post("Hack successful! Gained $" + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " hacking EXP"); } else { //Failure //Player only gains 25% exp for failure? TODO Can change this later to balance - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure) - post("Failed to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " hacking EXP"); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure) + post("Failed to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " hacking EXP"); } } //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); $("#hack-progress").attr('id', "old-hack-progress"); - document.getElementById("terminal-input-td").innerHTML = '$ '; + Terminal.resetTerminalInput(); + //document.getElementById("terminal-input-td").innerHTML = '$ '; $('input[class=terminal-input]').prop('disabled', false); Terminal.hackFlag = false; @@ -24349,43 +24615,43 @@ let Terminal = { finishAnalyze: function(cancelled = false) { if (cancelled == false) { - post(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hostname + ": "); - post("Organization name: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().organizationName); + post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname + ": "); + post("Organization name: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().organizationName); var rootAccess = ""; - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {rootAccess = "YES";} + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) {rootAccess = "YES";} else {rootAccess = "NO";} post("Root Access: " + rootAccess); - post("Required hacking skill: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill); - post("Estimated server security level(1-100): " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hackDifficulty, 5), 3)); - post("Estimated chance to hack: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].calculateHackingChance() * 100, 5), 2) + "%"); - post("Estimated time to hack: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].calculateHackingTime(), 5), 3) + " seconds"); - post("Estimated total money available on server: $" + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().moneyAvailable, 5), 2)); - post("Required number of open ports for NUKE: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired); - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().sshPortOpen) { + post("Required hacking skill: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill); + post("Estimated server security level(1-100): " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hackDifficulty, 5), 3)); + post("Estimated chance to hack: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingChance() * 100, 5), 2) + "%"); + post("Estimated time to hack: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].calculateHackingTime(), 5), 3) + " seconds"); + post("Estimated total money available on server: $" + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["a" /* addOffset */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().moneyAvailable, 5), 2)); + post("Required number of open ports for NUKE: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired); + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().sshPortOpen) { post("SSH port: Open") } else { post("SSH port: Closed") } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().ftpPortOpen) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ftpPortOpen) { post("FTP port: Open") } else { post("FTP port: Closed") } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().smtpPortOpen) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().smtpPortOpen) { post("SMTP port: Open") } else { post("SMTP port: Closed") } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().httpPortOpen) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().httpPortOpen) { post("HTTP port: Open") } else { post("HTTP port: Closed") } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().sqlPortOpen) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().sqlPortOpen) { post("SQL port: Open") } else { post("SQL port: Closed") @@ -24396,7 +24662,8 @@ let Terminal = { //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); $("#hack-progress").attr('id', "old-hack-progress"); - document.getElementById("terminal-input-td").innerHTML = '$ '; + Terminal.resetTerminalInput(); + //document.getElementById("terminal-input-td").innerHTML = '$ '; $('input[class=terminal-input]').prop('disabled', false); }, @@ -24432,7 +24699,7 @@ let Terminal = { /****************** Interactive Tutorial Terminal Commands ******************/ if (__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["b" /* iTutorialIsRunning */]) { - var foodnstuffServ = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["c" /* GetServerByHostname */])("foodnstuff"); + var foodnstuffServ = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["c" /* GetServerByHostname */])("foodnstuff"); if (foodnstuffServ == null) {throw new Error("Could not get foodnstuff server"); return;} switch(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["a" /* currITutorialStep */]) { @@ -24472,9 +24739,9 @@ let Terminal = { if (commandArray.length == 2) { if ((commandArray[0] == "connect") && (commandArray[1] == "foodnstuff" || commandArray[1] == foodnstuffServ.ip)) { - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].currentServer = foodnstuffServ.ip; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = foodnstuffServ.ip; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; post("Connected to foodnstuff"); Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])(); } else {post("Wrong command! Try again!"); return;} @@ -24490,9 +24757,10 @@ let Terminal = { post("Analyzing system..."); hackProgressPost("Time left:"); hackProgressBarPost("["); - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].analyze(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].analyze(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])(); @@ -24513,9 +24781,10 @@ let Terminal = { Terminal.hackFlag = true; hackProgressPost("Time left:"); hackProgressBarPost("["); - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hack(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hack(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])(); @@ -24544,12 +24813,12 @@ let Terminal = { if (commandArray.length == 2 && commandArray[0] == "tail" && commandArray[1] == "foodnstuff.script") { //Check that the script exists on this machine - var runningScript = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])("foodnstuff.script", [], __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer()); + var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])("foodnstuff.script", [], __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer()); if (runningScript == null) { post("Error: No such script exists"); return; } - Object(__WEBPACK_IMPORTED_MODULE_17__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript); + Object(__WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript); Object(__WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__["c" /* iTutorialNextStep */])(); } else {post("Bad command. Please follow the tutorial");} break; @@ -24563,7 +24832,7 @@ let Terminal = { /****************** END INTERACTIVE TUTORIAL ******************/ /* Command parser */ - var s = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); switch (commandArray[0].toLowerCase()) { case "alias": if (commandArray.length == 1) { @@ -24593,14 +24862,15 @@ let Terminal = { post("Analyzing system..."); hackProgressPost("Time left:"); hackProgressBarPost("["); - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].analyze(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].analyze(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); break; case "buy": - if (__WEBPACK_IMPORTED_MODULE_14__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) { + if (__WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) { Object(__WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__["c" /* executeDarkwebTerminalCommand */])(commandArray); } else { post("You need to be connected to the Dark Web to use the buy command"); @@ -24643,7 +24913,7 @@ let Terminal = { } //Check that the script exists on this machine - var runningScript = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptName, args, s); + var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s); if (runningScript == null) { post("Error: No such script exists"); return; @@ -24668,8 +24938,8 @@ let Terminal = { var ip = commandArray[1]; - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) { - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip == ip || __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hostname == ip) { + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip == ip || __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hostname == ip) { Terminal.connectToServer(ip); return; } @@ -24686,19 +24956,20 @@ let Terminal = { } //Hack the current PC (usually for money) //You can't hack your home pc or servers you purchased - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().purchasedByPlayer) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().purchasedByPlayer) { post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers"); - } else if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights == false ) { + } else if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights == false ) { post("You do not have admin rights for this machine! Cannot hack"); - } else if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hacking_skill) { + } else if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill) { post("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill"); } else { Terminal.hackFlag = true; hackProgressPost("Time left:"); hackProgressBarPost("["); - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hack(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hack(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); } @@ -24723,24 +24994,25 @@ let Terminal = { if (commandArray.length != 1) { post("Incorrect usage of home command. Usage: home"); return; } - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].currentServer = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getHomeComputer().ip; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().ip; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; post("Connected to home"); + Terminal.resetTerminalInput(); break; case "hostname": if (commandArray.length != 1) { post("Incorrect usage of hostname command. Usage: hostname"); return; } //Print the hostname of current system - post(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hostname); + post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname); break; case "ifconfig": if (commandArray.length != 1) { post("Incorrect usage of ifconfig command. Usage: ifconfig"); return; } //Print the IP address of the current system - post(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().ip); + post(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ip); break; case "kill": if (commandArray.length < 2) { @@ -24752,17 +25024,17 @@ let Terminal = { for (var i = 1; i < results.length; ++i) { args.push(results[i]); } - var runningScript = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptName, args, s); + var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s); if (runningScript == null) { post("No such script is running. Nothing to kill"); return; } - Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScript, s.ip); + Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScript, s.ip); post("Killing " + scriptName + ". May take up to a few minutes for the scripts to die..."); break; case "killall": for (var i = s.runningScripts.length-1; i >= 0; --i) { - Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__["d" /* killWorkerScript */])(s.runningScripts[i], s.ip); + Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["d" /* killWorkerScript */])(s.runningScripts[i], s.ip); } post("Killing all running scripts. May take up to a few minutes for the scripts to die..."); break; @@ -24789,13 +25061,13 @@ let Terminal = { scriptName = results[0]; } - var currServ = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); for (var i = 0; i < currServ.scripts.length; ++i) { if (scriptName == currServ.scripts[i].filename) { var scriptBaseRamUsage = currServ.scripts[i].ramUsage; var ramUsage = scriptBaseRamUsage * numThreads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, numThreads-1); - post("This script requires " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2) + "GB of RAM to run for " + numThreads + " thread(s)"); + post("This script requires " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(ramUsage, 2) + "GB of RAM to run for " + numThreads + " thread(s)"); return; } } @@ -24817,9 +25089,9 @@ let Terminal = { var scriptname = filename.substr(0, filename.indexOf(".script")); //Check if the script already exists - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().scripts.length; i++) { - if (filename == __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().scripts[i].filename) { - __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(scriptname, __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().scripts[i].code); + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts.length; i++) { + if (filename == __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts[i].filename) { + __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadScriptEditorContent(scriptname, __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().scripts[i].code); return; } } @@ -24867,6 +25139,15 @@ let Terminal = { } } + //Check literature files + for (var i = 0; i < s.messages.length; ++i) { + var f = s.messages[i]; + if (!(f instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["f" /* isString */])(f) && f === delTarget) { + s.messages.splice(i, 1); + return; + } + } + post("No such file exists"); break; case "run": @@ -24892,23 +25173,33 @@ let Terminal = { if (commandArray.length == 1) { Terminal.executeScanAnalyzeCommand(1); } else if (commandArray.length == 2) { - var depth = Number(commandArray[1]); + var all = false; + if (commandArray[1].endsWith("-a")) { + all = true; + commandArray[1] = commandArray[1].replace("-a", ""); + } + var depth; + if (commandArray[1].length === 0) { + depth = 1; + } else { + depth = Number(commandArray[1]); + } if (isNaN(depth) || depth < 0) { post("Incorrect usage of scan-analyze command. depth argument must be positive numeric"); return; } - if (depth > 3 && !__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV1) && - !__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) { + if (depth > 3 && !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV1) && + !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) { post("You cannot scan-analyze with that high of a depth. Maximum depth is 3"); return; - } else if (depth > 5 && !__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) { + } else if (depth > 5 && !__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].DeepscanV2)) { post("You cannot scan-analyze with that high of a depth. Maximum depth is 5"); return; } else if (depth > 10) { post("You cannot scan-analyze with that high of a depth. Maximum depth is 10"); return; } - Terminal.executeScanAnalyzeCommand(depth); + Terminal.executeScanAnalyzeCommand(depth, all); } else { post("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]"); } @@ -24928,18 +25219,17 @@ let Terminal = { post("Error: scp only works for .script and .lit files"); return; } - var server = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(args[1]); + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(args[1]); if (server == null) { post("Invalid destination. " + args[1] + " not found"); return; } var ip = server.ip; - var currServ = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); //Scp for lit files if (scriptname.endsWith(".lit")) { var found = false; - var curr for (var i = 0; i < currServ.messages.length; ++i) { if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_8__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) { found = true; @@ -24989,7 +25279,7 @@ let Terminal = { } } - var newScript = new __WEBPACK_IMPORTED_MODULE_12__Script_js__["c" /* Script */](); + var newScript = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["c" /* Script */](); newScript.filename = scriptname; newScript.code = sourceScript.code; newScript.ramUsage = sourceScript.ramUsage; @@ -25002,7 +25292,7 @@ let Terminal = { post("Incorrect number of arguments. Usage: sudov"); return; } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hasAdminRights) { post("You have ROOT access to this machine"); } else { post("You do NOT have root access to this machine"); @@ -25025,12 +25315,12 @@ let Terminal = { } //Check that the script exists on this machine - var runningScript = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptName, args, s); + var runningScript = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, s); if (runningScript == null) { post("Error: No such script exists"); return; } - Object(__WEBPACK_IMPORTED_MODULE_17__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript); + Object(__WEBPACK_IMPORTED_MODULE_18__utils_LogBox_js__["a" /* logBoxCreate */])(runningScript); } break; case "theme": @@ -25078,7 +25368,7 @@ let Terminal = { post("Script Threads RAM Usage"); - var currRunningScripts = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().runningScripts; + var currRunningScripts = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().runningScripts; //Iterate through scripts on current server for(var i = 0; i < currRunningScripts.length; i++) { var script = currRunningScripts[i]; @@ -25093,7 +25383,7 @@ let Terminal = { var spacesThread = Array(numSpacesThread+1).join(" "); //Calculate and transform RAM usage - ramUsage = Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(script.scriptRef.ramUsage * script.threads, 2).toString() + "GB"; + ramUsage = Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(script.scriptRef.ramUsage * script.threads, 2).toString() + "GB"; var entry = [script.filename, spacesScript, script.threads, spacesThread, ramUsage]; post(entry.join("")); @@ -25121,18 +25411,19 @@ let Terminal = { connectToServer: function(ip) { console.log("Connect to server called"); - var serv = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip); + var serv = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); if (serv == null) { post("Invalid server. Connection failed."); return; } - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].currentServer = serv.ip; - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = false; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].currentServer = serv.ip; + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().isConnectedTo = true; post("Connected to " + serv.hostname); - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hostname == "darkweb") { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname == "darkweb") { Object(__WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__["b" /* checkIfConnectedToDarkweb */])(); //Posts a 'help' message if connecting to dark web } + Terminal.resetTerminalInput(); }, executeListCommand: function(commandArray) { @@ -25157,7 +25448,7 @@ let Terminal = { var allFiles = []; //Get all of the programs and scripts on the machine into one temporary array - var s = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); for (var i = 0; i < s.programs.length; i++) { if (filter) { if (s.programs[i].includes(filter)) { @@ -25209,9 +25500,9 @@ let Terminal = { } //Displays available network connections using TCP post("Hostname IP Root Access"); - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) { + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().serversOnNetwork.length; i++) { //Add hostname - var entry = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i); + var entry = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i); if (entry == null) {continue;} entry = entry.hostname; @@ -25219,16 +25510,16 @@ let Terminal = { var numSpaces = 21 - entry.length; var spaces = Array(numSpaces+1).join(" "); entry += spaces; - entry += __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip; + entry += __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip; //Calculate padding and add root access info var hasRoot; - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hasAdminRights) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).hasAdminRights) { hasRoot = 'Y'; } else { hasRoot = 'N'; } - numSpaces = 21 - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip.length; + numSpaces = 21 - __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().getServerOnNetwork(i).ip.length; spaces = Array(numSpaces+1).join(" "); entry += spaces; entry += hasRoot; @@ -25236,21 +25527,24 @@ let Terminal = { } }, - executeScanAnalyzeCommand: function(depth=1) { + executeScanAnalyzeCommand: function(depth=1, all=false) { //We'll use the AllServersMap as a visited() array //TODO Using array as stack for now, can make more efficient post("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~"); post(" "); - var visited = new __WEBPACK_IMPORTED_MODULE_12__Script_js__["a" /* AllServersMap */](); + var visited = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["a" /* AllServersMap */](); + var stack = []; var depthQueue = [0]; - var currServ = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var currServ = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); stack.push(currServ); while(stack.length != 0) { var s = stack.pop(); var d = depthQueue.pop(); - if (visited[s.ip] || d > depth) { - continue; + if (!all && s.purchasedByPlayer && s.hostname != "home") { + continue; //Purchased server + } else if (visited[s.ip] || d > depth) { + continue; //Already visited or out-of-depth } else { visited[s.ip] = 1; } @@ -25260,7 +25554,7 @@ let Terminal = { } if (d == 0) {continue;} //Don't print current server var titleDashes = Array((d-1) * 4 + 1).join("-"); - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink)) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink)) { post("" + titleDashes + "> " + s.hostname + "", false); } else { post("" + titleDashes + ">" + s.hostname + ""); @@ -25281,6 +25575,7 @@ let Terminal = { (function() { var hostname = links[i].innerHTML.toString(); links[i].onclick = function() { + if (Terminal.analyzeFlag || Terminal.hackFlag) {return;} Terminal.connectToServer(hostname); } }());//Immediate invocation @@ -25292,9 +25587,9 @@ let Terminal = { if (commandArray.length != 1) { post("Incorrect usage of free command. Usage: free"); return; } - post("Total: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().maxRam, 2) + " GB"); - post("Used: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB"); - post("Available: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().maxRam - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB"); + post("Total: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().maxRam, 2) + " GB"); + post("Used: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB"); + post("Available: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().maxRam - __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().ramUsed, 2) + " GB"); }, //First called when the "run [program]" command is called. Checks to see if you @@ -25309,7 +25604,7 @@ let Terminal = { } else { name = programName; } - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasProgram(name)) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(name)) { Terminal.executeProgram(programName); return; } @@ -25318,7 +25613,7 @@ let Terminal = { //Contains the implementations of all possible programs executeProgram: function(programName) { - var s = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var s = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); var splitArgs = programName.split(" "); if (splitArgs.length > 1) { programName = splitArgs[0]; @@ -25328,9 +25623,9 @@ let Terminal = { if (s.hasAdminRights) { post("You already have root access to this computer. There is no reason to run NUKE.exe"); } else { - if (s.openPortCount >= __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired) { + if (s.openPortCount >= __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().numOpenPortsRequired) { s.hasAdminRights = true; - post("NUKE successful! Gained root access to " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer().hostname); + post("NUKE successful! Gained root access to " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer().hostname); //TODO Make this take time rather than be instant } else { post("NUKE unsuccessful. Not enough ports have been opened"); @@ -25387,7 +25682,7 @@ let Terminal = { post("Must pass a server hostname or IP as an argument for ServerProfiler.exe"); return; } - var serv = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(splitArgs[1]); + var serv = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(splitArgs[1]); if (serv == null) { post("Invalid server IP/hostname"); return; @@ -25396,9 +25691,9 @@ let Terminal = { post("Server base security level: " + serv.baseDifficulty); post("Server current security level: " + serv.hackDifficulty); post("Server growth rate: " + serv.serverGrowth); - post("Netscript hack() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(scriptCalculateHackingTime(serv), 1) + "s"); - post("Netscript grow() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(scriptCalculateGrowTime(serv)/1000, 1) + "s"); - post("Netscript weaken() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(scriptCalculateWeakenTime(serv)/1000, 1) + "s"); + post("Netscript hack() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(serv), 1) + "s"); + post("Netscript grow() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(serv)/1000, 1) + "s"); + post("Netscript weaken() execution time: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(serv)/1000, 1) + "s"); break; case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].AutoLink: post("This executable cannot be run."); @@ -25414,16 +25709,16 @@ let Terminal = { post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10."); break; case __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__["a" /* Programs */].Flight: - post("Augmentations: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].augmentations.length + " / 30"); - post("Money: $" + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].money.toNumber(), 2) + " / $" + Object(__WEBPACK_IMPORTED_MODULE_15__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100000000000, 2)); + post("Augmentations: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].augmentations.length + " / 30"); + post("Money: $" + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.toNumber(), 2) + " / $" + Object(__WEBPACK_IMPORTED_MODULE_16__utils_StringHelperFunctions_js__["c" /* formatNumber */])(100000000000, 2)); post("One path below must be fulfilled..."); post("----------HACKING PATH----------"); - post("Hacking skill: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hacking_skill + " / 2500"); + post("Hacking skill: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill + " / 2500"); post("----------COMBAT PATH----------"); - post("Strength: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].strength + " / 1500"); - post("Defense: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].defense + " / 1500"); - post("Dexterity: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].dexterity + " / 1500"); - post("Agility: " + __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].agility + " / 1500"); + post("Strength: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].strength + " / 1500"); + post("Defense: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].defense + " / 1500"); + post("Dexterity: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].dexterity + " / 1500"); + post("Agility: " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].agility + " / 1500"); break; default: post("Invalid executable. Cannot be run"); @@ -25432,7 +25727,7 @@ let Terminal = { }, runScript: function(scriptName) { - var server = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getCurrentServer(); + var server = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getCurrentServer(); var numThreads = 1; var args = []; @@ -25490,7 +25785,7 @@ let Terminal = { //Check if this script is already running - if (Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptName, args, server) != null) { + if (Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptName, args, server) != null) { post("ERROR: This script is already running. Cannot run multiple instances"); return; } @@ -25512,13 +25807,13 @@ let Terminal = { return; } else { //Able to run script - post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["f" /* printArray */])(args) + "."); + post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["f" /* printArray */])(args) + "."); post("May take a few seconds to start up the process..."); - var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_12__Script_js__["b" /* RunningScript */](script, args); + var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["b" /* RunningScript */](script, args); runningScriptObj.threads = numThreads; server.runningScripts.push(runningScriptObj); - Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server); + Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server); return; } } @@ -25533,7 +25828,7 @@ let Terminal = { /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) /***/ }), -/* 20 */ +/* 21 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -25547,7 +25842,7 @@ let Terminal = { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return yesNoBoxClose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return yesNoTxtInpBoxClose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return yesNoBoxOpen; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(2); /* Generic Yes-No Pop-up box * Can be used to create pop-up boxes that require a yes/no response from player @@ -25630,61 +25925,492 @@ function yesNoTxtInpBoxCreate(txt) { /***/ }), -/* 21 */ +/* 22 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createRandomIp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ipExists; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isValidIPAddress; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Server_js__ = __webpack_require__(6); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; }); +/* unused harmony export sendMessage */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Server_js__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Settings_js__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7); -/* Functions to deal with manipulating IP addresses*/ -//Generate a random IP address -//Will not return an IP address that already exists in the AllServers array -function createRandomIp() { - var ip = createRandomByte(99) +'.' + - createRandomByte(9) +'.' + - createRandomByte(9) +'.' + - createRandomByte(9); - //If the Ip already exists, recurse to create a new one - if (ipExists(ip)) { - return createRandomIp(); - } - return ip; + + + + + +/* Message.js */ +function Message(filename="", msg="") { + this.filename = filename; + this.msg = msg; + this.recvd = false; } -//Returns true if the IP already exists in one of the game's servers -function ipExists(ip) { - for (var property in __WEBPACK_IMPORTED_MODULE_0__src_Server_js__["b" /* AllServers */]) { - if (__WEBPACK_IMPORTED_MODULE_0__src_Server_js__["b" /* AllServers */].hasOwnProperty(property)) { - if (property == ip) { - return true; - } +Message.prototype.toJSON = function() { + return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this); +} + + +Message.fromJSON = function(value) { + return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data); +} + +__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message; + +//Sends message to player, including a pop up +function sendMessage(msg, forced=false) { + console.log("sending message: " + msg.filename); + msg.recvd = true; + if (forced || !__WEBPACK_IMPORTED_MODULE_4__Settings_js__["a" /* Settings */].SuppressMessages) { + showMessage(msg); + } + addMessageToServer(msg, "home"); +} + +function showMessage(msg) { + var txt = "Message received from unknown sender:

" + + "" + msg.msg + "

" + + "This message was saved as " + msg.filename + " onto your home computer."; + Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt); +} + +//Adds a message to a server +function addMessageToServer(msg, serverHostname) { + var server = Object(__WEBPACK_IMPORTED_MODULE_3__Server_js__["c" /* GetServerByHostname */])(serverHostname); + if (server == null) { + console.log("WARNING: Did not locate " + serverHostname); + return; + } + for (var i = 0; i < server.messages.length; ++i) { + if (server.messages[i].filename === msg.filename) { + return; //Already exists } } - return false; + server.messages.push(msg); } -function createRandomByte(n=9) { - return Math.round(Math.random()*n); +//Checks if any of the 'timed' messages should be sent +function checkForMessagesToSend() { + var jumper0 = Messages[MessageFilenames.Jumper0]; + var jumper1 = Messages[MessageFilenames.Jumper1]; + var jumper2 = Messages[MessageFilenames.Jumper2]; + var jumper3 = Messages[MessageFilenames.Jumper3]; + var jumper4 = Messages[MessageFilenames.Jumper4]; + var cybersecTest = Messages[MessageFilenames.CyberSecTest]; + var nitesecTest = Messages[MessageFilenames.NiteSecTest]; + var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest]; + var redpill = Messages[MessageFilenames.RedPill]; + + var redpillOwned = false; + if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) { + redpillOwned = true; + } + + if (redpill && redpillOwned) { + if (!__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["b" /* dialogBoxOpened */]) { + sendMessage(redpill, true); + } + } else if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 25) { + sendMessage(jumper0); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight); + } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 40) { + sendMessage(jumper1); + } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 50) { + sendMessage(cybersecTest); + } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 175) { + sendMessage(jumper2); + } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 200) { + sendMessage(nitesecTest); + } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 350) { + sendMessage(jumper3); + } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 490) { + sendMessage(jumper4); + } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 500) { + sendMessage(bitrunnersTest); + } } -function isValidIPAddress(ipaddress) { - if (/^(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-6]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) - { - return true; - } - return false; +function AddToAllMessages(msg) { + Messages[msg.filename] = msg; +} + +let Messages = {} + +function loadMessages(saveString) { + Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */]); +} + +let MessageFilenames = { + Jumper0: "j0.msg", + Jumper1: "j1.msg", + Jumper2: "j2.msg", + Jumper3: "j3.msg", + Jumper4: "j4.msg", + CyberSecTest: "csec-test.msg", + NiteSecTest: "nitesec-test.msg", + BitRunnersTest: "19dfj3l1nd.msg", + RedPill: "icarus.msg", +} + +function initMessages() { + //Reset + Messages = {}; + + //jump3R Messages + AddToAllMessages(new Message(MessageFilenames.Jumper0, + "I know you can sense it. I know you're searching for it. " + + "It's why you spend night after " + + "night at your computer.

It's real, I've seen it. And I can " + + "help you find it. But not right now. You're not ready yet.

" + + "Use this program to track your progress

" + + "The fl1ght.exe program was added to your home computer

" + + "-jump3R")); + AddToAllMessages(new Message(MessageFilenames.Jumper1, + "Soon you will be contacted by a hacking group known as CyberSec. " + + "They can help you with your search.

" + + "You should join them, garner their favor, and " + + "exploit them for their Augmentations. But do not trust them. " + + "They are not what they seem. No one is.

" + + "-jump3R")); + AddToAllMessages(new Message(MessageFilenames.Jumper2, + "Do not try to save the world. There is no world to save. If " + + "you want to find the truth, worry only about yourself. Ethics and " + + "morals will get you killed.

Watch out for a hacking group known as NiteSec." + + "

-jump3R")); + AddToAllMessages(new Message(MessageFilenames.Jumper3, + "You must learn to walk before you can run. And you must " + + "run before you can fly. Look for the black hand.

" + + "I.I.I.I

-jump3R")); + AddToAllMessages(new Message(MessageFilenames.Jumper4, + "To find what you are searching for, you must understand the bits. " + + "The bits are all around us. The runners will help you.

" + + "-jump3R")); + + //Messages from hacking factions + AddToAllMessages(new Message(MessageFilenames.CyberSecTest, + "We've been watching you. Your skills are very impressive. But you're wasting " + + "your talents. If you join us, you can put your skills to good use and change " + + "the world for the better. If you join us, we can unlock your full potential.

" + + "But first, you must pass our test. Find and hack our server using the Terminal.

" + + "-CyberSec")); + AddToAllMessages(new Message(MessageFilenames.NiteSecTest, + "People say that the corrupted governments and corporations rule the world. " + + "Yes, maybe they do. But do you know who everyone really fears? People " + + "like us. Because they can't hide from us. Because they can't fight shadows " + + "and ideas with bullets.

" + + "Join us, and people will fear you, too.

" + + "Find and hack our hidden server using the Terminal. Then, we will contact you again." + + "

-NiteSec")); + AddToAllMessages(new Message(MessageFilenames.BitRunnersTest, + "We know what you are doing. We know what drives you. We know " + + "what you are looking for.

" + + "We can help you find the answers.

" + + "run4theh111z")); + + AddToAllMessages(new Message(MessageFilenames.RedPill, + "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" + + ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" + + "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" + + "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)")); } /***/ }), -/* 22 */ +/* 23 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setActiveScriptsClickHandlers; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addActiveScriptsItem; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteActiveScriptsItem; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return updateActiveScriptsItems; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Server_js__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + + +/* Active Scripts UI*/ +function setActiveScriptsClickHandlers() { + //Server panel click handlers + var serverPanels = document.getElementsByClassName("active-scripts-server-header"); + if (serverPanels == null) { + console.log("ERROR: Could not find Active Scripts server panels"); + return; + } + for (i = 0; i < serverPanels.length; ++i) { + serverPanels[i].onclick = function() { + this.classList.toggle("active"); + + var panel = this.nextElementSibling; + if (panel.style.display === "block") { + panel.style.display = "none"; + } else { + panel.style.display = "block"; + } + } + } + + //Script Panel click handlers + var scriptPanels = document.getElementsByClassName("active-scripts-script-header"); + if (scriptPanels == null) { + console.log("ERROR: Could not find Active Scripts panels for individual scripts"); + return; + } + for (var i = 0; i < scriptPanels.length; ++i) { + scriptPanels[i].onclick = function() { + this.classList.toggle("active"); + + var panel = this.nextElementSibling; + if (panel.style.display === "block") { + panel.style.display = "none"; + } else { + panel.style.display = "block"; + } + } + } +} + +//Returns the ul element containins all script items for a specific server +function getActiveScriptsServerList(server) { + if (server == null) {return null;} + var panelname = "active-scripts-server-panel-" + server.hostname; + var item = document.getElementById(panelname + "-script-list"); + if (item == null) { + console.log("ERROR: Cannot find list for: " + server.hostname); + } + return item; +} + +function createActiveScriptsServerPanel(server) { + var panelname = "active-scripts-server-panel-" + server.hostname; + var activeScriptsList = document.getElementById("active-scripts-list"); + + //Div of entire Panel + var panelDiv = document.createElement("div"); + panelDiv.setAttribute("id", panelname); + + //Panel Header + var panelHdr = document.createElement("button"); + panelHdr.setAttribute("class", "active-scripts-server-header") + panelHdr.setAttribute("id", panelname + "-hdr"); + panelHdr.innerHTML = server.hostname; + + //Panel content + var panelContentDiv = document.createElement("div"); + panelContentDiv.setAttribute("class", "active-scripts-server-panel"); + panelContentDiv.setAttribute("id", panelname + "-content"); + + //List of scripts + var panelScriptList = document.createElement("ul"); + panelScriptList.setAttribute("id", panelname + "-script-list"); + + panelContentDiv.appendChild(panelScriptList); + panelDiv.appendChild(panelHdr); + panelDiv.appendChild(panelContentDiv); + activeScriptsList.appendChild(panelDiv); + + setActiveScriptsClickHandlers() //Reset click handlers + + return panelDiv; +} + +//Deletes the info for a particular server (Dropdown header + Panel with all info) +//in the Active Scripts page if it exists +function deleteActiveScriptsServerPanel(server) { + var panelname = "active-scripts-server-panel-" + server.hostname; + var panel = document.getElementById(panelname); + if (panel == null) { + console.log("No such panel exists: " + panelname); + return; + } + + //Remove the panel if it has no elements + var scriptList = document.getElementById(panelname + "-script-list"); + if (scriptList.childNodes.length == 0) { + panel.parentNode.removeChild(panel); + } +} + +function addActiveScriptsItem(workerscript) { + //Get server panel + var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); + if (server == null) { + console.log("ERROR: Invalid server IP for workerscript."); + return; + } + var panelname = "active-scripts-server-panel-" + server.hostname; + + var panel = document.getElementById(panelname); + if (panel == null) { + panel = createActiveScriptsServerPanel(server); + } + + //Create the element itself. Each element is an accordion collapsible + var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; + for (var i = 0; i < workerscript.args.length; ++i) { + itemNameArray.push(workerscript.args[i].toString()); + } + var itemName = itemNameArray.join("-"); + //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; + var item = document.createElement("li"); + item.setAttribute("id", itemName); + + var btn = document.createElement("button"); + btn.setAttribute("class", "active-scripts-script-header"); + btn.innerHTML = workerscript.name; + + var itemContentDiv = document.createElement("div"); + itemContentDiv.setAttribute("class", "active-scripts-script-panel"); + itemContentDiv.setAttribute("id", itemName + "-content"); + + item.appendChild(btn); + item.appendChild(itemContentDiv); + + createActiveScriptsText(workerscript, itemContentDiv); + + //Append element to list + var list = getActiveScriptsServerList(server); + list.appendChild(item); + + setActiveScriptsClickHandlers() //Reset click handlers +} + +function deleteActiveScriptsItem(workerscript) { + var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); + if (server == null) { + console.log("ERROR: Invalid server IP for workerscript."); + return; + } + var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; + for (var i = 0; i < workerscript.args.length; ++i) { + itemNameArray.push(workerscript.args[i].toString()); + } + var itemName = itemNameArray.join("-"); + //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; + var li = document.getElementById(itemName); + if (li == null) { + console.log("could not find Active scripts li element for: " + workerscript.name); + return; + } + li.parentNode.removeChild(li); + deleteActiveScriptsServerPanel(server); +} + +//Update the ActiveScriptsItems array +function updateActiveScriptsItems() { + var total = 0; + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) { + total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]); + } + document.getElementById("active-scripts-total-prod").innerHTML = + "Total online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(total, 2) + " / second"; + return total; +} + +//Updates the content of the given item in the Active Scripts list +function updateActiveScriptsItemContent(workerscript) { + var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); + if (server == null) { + console.log("ERROR: Invalid server IP for workerscript."); + return; + } + var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; + for (var i = 0; i < workerscript.args.length; ++i) { + itemNameArray.push(workerscript.args[i].toString()); + } + var itemName = itemNameArray.join("-"); + var itemContent = document.getElementById(itemName + "-content") + + //Clear the item + while (itemContent.firstChild) { + itemContent.removeChild(itemContent.firstChild); + } + + //Add the updated text back. Returns the total online production rate + return createActiveScriptsText(workerscript, itemContent); +} + +function createActiveScriptsText(workerscript, item) { + var itemText = document.createElement("p"); + + //Server ip/hostname + var threads = "Threads: " + workerscript.scriptRef.threads; + var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["f" /* printArray */])(workerscript.args); + + //Online + var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2); + var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " "); + + var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime; + var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second"; + var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime; + var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, " "); + + //Offline + var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2); + var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " "); + + var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime; + var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second"; + var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime; + var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) + " hacking exp/second").replace( / /g, " "); + + itemText.innerHTML = threads + "
" + args + "
" + onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" + + onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" + + offlineMpsText + "
" + offlineEpsText + "
"; + + item.appendChild(itemText); + + var logButton = document.createElement("span"); + logButton.innerHTML = "Log"; + var killButton = document.createElement("span"); + killButton.innerHTML = "Kill script"; + logButton.setAttribute("class", "active-scripts-button"); + killButton.setAttribute("class", "active-scripts-button"); + logButton.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef); + return false; + }); + killButton.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["d" /* killWorkerScript */])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server); + Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Killing script, may take a few minutes to complete..."); + return false; + }); + item.appendChild(logButton); + item.appendChild(killButton); + + //Return total online production rate + return onlineMps; +} + + + + +/***/ }), +/* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -25695,8 +26421,8 @@ function isValidIPAddress(ipaddress) { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return currITutorialStep; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return iTutorialIsRunning; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2); @@ -25772,7 +26498,7 @@ function iTutorialEvaluateStep() { iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " + "The game takes place in a dark, dystopian future...The year is 2077...

" + - "This tutorial will show you the basics of the game to help you get started. " + + "This tutorial will show you the basics of the game. " + "You may skip the tutorial at any time."); var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next"); next.style.display = "inline-block"; @@ -25813,7 +26539,7 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.CharacterGoToTerminalPage: iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " + - "main navigation menu"); + "main navigation menu."); //No next button var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next"); next.style.display = "none"; @@ -25831,8 +26557,7 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.TerminalIntro: iTutorialSetText("The Terminal is used to interface with your home computer as well as " + - "all of the other machines around the world. A lot of content in the game is " + - "accessible only through the Terminal, and is necessary for progressing. "); + "all of the other machines around the world."); var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next"); next.style.display = "inline-block"; next.addEventListener("click", function() { @@ -25848,14 +26573,14 @@ function iTutorialEvaluateStep() { //next step triggered by terminal command break; case iTutorialSteps.TerminalLs: - iTutorialSetText("The 'help' command displays a list of all available commands, how to use them, " + + iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " + "and a description of what they do.

Let's try another command. Enter the 'ls' command"); //next step triggered by terminal command break; case iTutorialSteps.TerminalScan: iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " + "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " + - "We'll get to what this does later.

Through your home computer's terminal, you can connect " + + "We'll get to what this does later.

Using your home computer's terminal, you can connect " + "to other machines throughout the world. Let's do that now by first entering " + "the 'scan' command. "); //next step triggered by terminal command @@ -25896,7 +26621,7 @@ function iTutorialEvaluateStep() { case iTutorialSteps.TerminalNuke: iTutorialSetText("When the 'analyze' command finishes running it will show useful information " + "about hacking the server.

For this server, the required hacking skill is only 1, " + - "which means you are able to hack it right now. However, in order to hack a server " + + "which means you can hack it right now. However, in order to hack a server " + "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " + "home computer is a virus that will grant you root access to a machine if there are enough " + "open ports.

The 'analyze' results shows that there do not need to be any open ports " + @@ -25906,19 +26631,19 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.TerminalManualHack: iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " + - "Try doing that now. "); + "Try doing that now."); //next step triggered by terminal command break; case iTutorialSteps.TerminalHackingMechanics: iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " + "only has a certain percentage chance " + "of success. This time and success chance is determined by a variety of factors, including " + - "your hacking skill and the server's security level.

" + + "your hacking skill and the server's security level.

" + "If your attempt to hack the server is successful, you will steal a certain percentage " + "of the server's total money. This percentage is affected by your hacking skill and " + - "the server's security level.

The amount of money on a server is not limitless. So, if " + + "the server's security level.

The amount of money on a server is not limitless. So, if " + "you constantly hack a server and deplete its money, then you will encounter " + - "diminishing returns in your hacking.
"); + "diminishing returns in your hacking."); var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next"); next.style.display = "inline-block"; next.addEventListener("click", function() { @@ -25929,7 +26654,7 @@ function iTutorialEvaluateStep() { case iTutorialSteps.TerminalCreateScript: iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " + "you don't want to be hacking manually the entire time. You can automate your hacking " + - "by writing scripts!

To create a new script or edit an existing one, you can use the 'nano' " + + "by writing scripts!

To create a new script or edit an existing one, you can use the 'nano' " + "command. Scripts must end with the '.script' extension. Let's make a script now by " + "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" + " will end a command like hack early)"); @@ -25948,14 +26673,14 @@ function iTutorialEvaluateStep() { "  hack('foodnstuff');
" + "}

" + "For anyone with basic programming experience, this code should be straightforward. " + - "This script will continuously hack the 'foodnstuff' server.

" + + "This script will continuously hack the 'foodnstuff' server.

" + "To save and close the script editor, press the button in the bottom left, or press ctrl + b."); //next step triggered in saveAndCloseScriptEditor() (Script.js) break; case iTutorialSteps.TerminalFree: iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " + "run on any machine which you have root access to. Different servers have different " + - "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + + "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + "RAM is available on this machine, enter the 'free' command."); //next step triggered by terminal commmand break; @@ -25971,8 +26696,8 @@ function iTutorialEvaluateStep() { "runs an infinite loop).

These scripts can passively earn you income and hacking experience. " + "Your scripts will also earn money and experience while you are offline, although at a " + "much slower rate.

" + - "Let's check out some statistics of our active, running scripts by clicking the " + - "'Active Scripts' link in the main navigation menu. "); + "Let's check out some statistics for our running scripts by clicking the " + + "'Active Scripts' link in the main navigation menu."); document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button"); var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link"); activeScriptsMainMenuButton.addEventListener("click", function() { @@ -26041,7 +26766,7 @@ function iTutorialEvaluateStep() { iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " + "earn you money over time, both online and offline. When you get enough " + " money, you can upgrade " + - "your newly-purchased Hacknet Node below.

" + + "your newly-purchased Hacknet Node below.

" + "Let's go to the 'City' page through the main navigation menu."); document.getElementById("city-menu-link").setAttribute("class", "flashing-button"); var worldButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link"); @@ -26360,7 +27085,7 @@ function iTutorialSetText(txt) { /***/ }), -/* 23 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeMcl/decimal.js/LICENCE */ @@ -31180,209 +31905,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM /***/ }), -/* 24 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; }); -/* unused harmony export sendMessage */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7); - - - - - - - - -/* Message.js */ -function Message(filename="", msg="") { - this.filename = filename; - this.msg = msg; - this.recvd = false; -} - -Message.prototype.toJSON = function() { - return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this); -} - - -Message.fromJSON = function(value) { - return Object(__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data); -} - -__WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message; - -//Sends message to player, including a pop up -function sendMessage(msg) { - console.log("sending message: " + msg.filename); - msg.recvd = true; - if (!__WEBPACK_IMPORTED_MODULE_4__Settings_js__["a" /* Settings */].SuppressMessages) { - showMessage(msg); - } - addMessageToServer(msg, "home"); -} - -function showMessage(msg) { - var txt = "Message received from unknown sender:

" + - "" + msg.msg + "

" + - "This message was saved as " + msg.filename + " onto your home computer."; - Object(__WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt); -} - -//Adds a message to a server -function addMessageToServer(msg, serverHostname) { - var server = Object(__WEBPACK_IMPORTED_MODULE_3__Server_js__["c" /* GetServerByHostname */])(serverHostname); - if (server == null) { - console.log("WARNING: Did not locate " + serverHostname); - return; - } - server.messages.push(msg); -} - -//Checks if any of the 'timed' messages should be sent -function checkForMessagesToSend() { - var jumper0 = Messages[MessageFilenames.Jumper0]; - var jumper1 = Messages[MessageFilenames.Jumper1]; - var jumper2 = Messages[MessageFilenames.Jumper2]; - var jumper3 = Messages[MessageFilenames.Jumper3]; - var jumper4 = Messages[MessageFilenames.Jumper4]; - var jumper5 = Messages[MessageFilenames.Jumper5]; - var cybersecTest = Messages[MessageFilenames.CyberSecTest]; - var nitesecTest = Messages[MessageFilenames.NiteSecTest]; - var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest]; - var redpill = Messages[MessageFilenames.RedPill]; - - var redpillOwned = false; - if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) { - redpillOwned = true; - } - - if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 25) { - sendMessage(jumper0); - } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 40) { - sendMessage(jumper1); - } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 50) { - sendMessage(cybersecTest); - } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 175) { - sendMessage(jumper2); - } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 200) { - sendMessage(nitesecTest); - } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 350) { - sendMessage(jumper3); - } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 490) { - sendMessage(jumper4); - } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 500) { - sendMessage(bitrunnersTest); - } else if (jumper5 && !jumper5.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 1000) { - sendMessage(jumper5); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight); - } else if (redpill && !redpill.recvd && __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill >= 2000 && redpillOwned) { - sendMessage(redpill); - } -} - -function AddToAllMessages(msg) { - Messages[msg.filename] = msg; -} - -let Messages = {} - -function loadMessages(saveString) { - Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__["c" /* Reviver */]); -} - -let MessageFilenames = { - Jumper0: "j0.msg", - Jumper1: "j1.msg", - Jumper2: "j2.msg", - Jumper3: "j3.msg", - Jumper4: "j4.msg", - Jumper5: "j5.msg", - CyberSecTest: "csec-test.msg", - NiteSecTest: "nitesec-test.msg", - BitRunnersTest: "19dfj3l1nd.msg", - RedPill: "icarus.msg", -} - -function initMessages() { - //Reset - Messages = {}; - - //jump3R Messages - AddToAllMessages(new Message(MessageFilenames.Jumper0, - "I know you can sense it. I know you're searching for it. " + - "It's why you spend night after " + - "night at your computer.

It's real, I've seen it. And I can " + - "help you find it. But not right now. You're not ready yet.

-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper1, - "Soon you will be contacted by a hacking group known as CyberSec. " + - "They can help you with your search.

" + - "You should join them, garner their favor, and " + - "exploit them for their Augmentations. But do not trust them. " + - "They are not what they seem. No one is.

" + - "-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper2, - "Do not try to save the world. There is no world to save. If " + - "you want to find the truth, worry only about yourself. Ethics and " + - "morals will get you killed.

Watch out for a hacking group known as NiteSec." + - "

-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper3, - "You must learn to walk before you can run. And you must " + - "run before you can fly. Look for the black hand.

" + - "I.I.I.I

-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper4, - "To find what you are searching for, you must understand the bits. " + - "The bits are all around us. The runners will help you.

" + - "-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper5, - "Build your wings and fly

-jump3R

" + - "The fl1ght.exe program was added to your home computer")); - - //Messages from hacking factions - AddToAllMessages(new Message(MessageFilenames.CyberSecTest, - "We've been watching you. Your skills are very impressive. But you're wasting " + - "your talents. If you join us, you can put your skills to good use and change " + - "the world for the better. If you join us, we can unlock your full potential.

" + - "But first, you must pass our test. Find and hack our server using the Terminal.

" + - "-CyberSec")); - AddToAllMessages(new Message(MessageFilenames.NiteSecTest, - "People say that the corrupted governments and corporations rule the world. " + - "Yes, maybe they do. But do you know who everyone really fears? People " + - "like us. Because they can't hide from us. Because they can't fight shadows " + - "and ideas with bullets.

" + - "Join us, and people will fear you, too.

" + - "Find and hack our hidden server using the Terminal. Then, we will contact you again." + - "

-NiteSec")); - AddToAllMessages(new Message(MessageFilenames.BitRunnersTest, - "We know what you are doing. We know what drives you. We know " + - "what you are looking for.

" + - "We can help you find the answers.

" + - "run4theh111z")); - - AddToAllMessages(new Message(MessageFilenames.RedPill, - "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" + - ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" + - "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" + - "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)")); -} - - - - -/***/ }), -/* 25 */ +/* 26 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -31405,8 +31928,8 @@ function initMessages() { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(5); @@ -32022,7 +32545,7 @@ function updateStockPlayerPosition(stock) { /***/ }), -/* 26 */ +/* 27 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -32030,7 +32553,7 @@ function updateStockPlayerPosition(stock) { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return logBoxUpdateText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return logBoxOpened; }); /* unused harmony export logBoxCurrentScript */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(2); $(document).keydown(function(event) { @@ -32072,13 +32595,15 @@ var logBoxCurrentScript = null; function logBoxCreate(script) { logBoxCurrentScript = script; logBoxOpen(); + document.getElementById("log-box-text-header").innerHTML = + logBoxCurrentScript.filename + " " + Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["f" /* printArray */])(logBoxCurrentScript.args) + ":

"; logBoxUpdateText(); } function logBoxUpdateText() { var txt = document.getElementById("log-box-text"); if (logBoxCurrentScript && logBoxOpened && txt) { - txt.innerHTML = logBoxCurrentScript.filename + Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["f" /* printArray */])(logBoxCurrentScript.args) + ":

"; + txt.innerHTML = ""; for (var i = 0; i < logBoxCurrentScript.logs.length; ++i) { txt.innerHTML += logBoxCurrentScript.logs[i]; txt.innerHTML += "
"; @@ -32090,293 +32615,13 @@ function logBoxUpdateText() { /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) -/***/ }), -/* 27 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setActiveScriptsClickHandlers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addActiveScriptsItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteActiveScriptsItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return updateActiveScriptsItems; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5); - - - - - - - - -/* Active Scripts UI*/ -function setActiveScriptsClickHandlers() { - //Server panel click handlers - var serverPanels = document.getElementsByClassName("active-scripts-server-header"); - if (serverPanels == null) { - console.log("ERROR: Could not find Active Scripts server panels"); - return; - } - for (i = 0; i < serverPanels.length; ++i) { - serverPanels[i].onclick = function() { - this.classList.toggle("active"); - - var panel = this.nextElementSibling; - if (panel.style.display === "block") { - panel.style.display = "none"; - } else { - panel.style.display = "block"; - } - } - } - - //Script Panel click handlers - var scriptPanels = document.getElementsByClassName("active-scripts-script-header"); - if (scriptPanels == null) { - console.log("ERROR: Could not find Active Scripts panels for individual scripts"); - return; - } - for (var i = 0; i < scriptPanels.length; ++i) { - scriptPanels[i].onclick = function() { - this.classList.toggle("active"); - - var panel = this.nextElementSibling; - if (panel.style.display === "block") { - panel.style.display = "none"; - } else { - panel.style.display = "block"; - } - } - } -} - -//Returns the ul element containins all script items for a specific server -function getActiveScriptsServerList(server) { - if (server == null) {return null;} - var panelname = "active-scripts-server-panel-" + server.hostname; - var item = document.getElementById(panelname + "-script-list"); - if (item == null) { - console.log("ERROR: Cannot find list for: " + server.hostname); - } - return item; -} - -function createActiveScriptsServerPanel(server) { - var panelname = "active-scripts-server-panel-" + server.hostname; - var activeScriptsList = document.getElementById("active-scripts-list"); - - //Div of entire Panel - var panelDiv = document.createElement("div"); - panelDiv.setAttribute("id", panelname); - - //Panel Header - var panelHdr = document.createElement("button"); - panelHdr.setAttribute("class", "active-scripts-server-header") - panelHdr.setAttribute("id", panelname + "-hdr"); - panelHdr.innerHTML = server.hostname; - - //Panel content - var panelContentDiv = document.createElement("div"); - panelContentDiv.setAttribute("class", "active-scripts-server-panel"); - panelContentDiv.setAttribute("id", panelname + "-content"); - - //List of scripts - var panelScriptList = document.createElement("ul"); - panelScriptList.setAttribute("id", panelname + "-script-list"); - - panelContentDiv.appendChild(panelScriptList); - panelDiv.appendChild(panelHdr); - panelDiv.appendChild(panelContentDiv); - activeScriptsList.appendChild(panelDiv); - - setActiveScriptsClickHandlers() //Reset click handlers - - return panelDiv; -} - -//Deletes the info for a particular server (Dropdown header + Panel with all info) -//in the Active Scripts page if it exists -function deleteActiveScriptsServerPanel(server) { - var panelname = "active-scripts-server-panel-" + server.hostname; - var panel = document.getElementById(panelname); - if (panel == null) { - console.log("No such panel exists: " + panelname); - return; - } - - //Remove the panel if it has no elements - var scriptList = document.getElementById(panelname + "-script-list"); - if (scriptList.childNodes.length == 0) { - panel.parentNode.removeChild(panel); - } -} - -function addActiveScriptsItem(workerscript) { - //Get server panel - var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); - if (server == null) { - console.log("ERROR: Invalid server IP for workerscript."); - return; - } - var panelname = "active-scripts-server-panel-" + server.hostname; - - var panel = document.getElementById(panelname); - if (panel == null) { - panel = createActiveScriptsServerPanel(server); - } - - //Create the element itself. Each element is an accordion collapsible - var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; - for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); - } - var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; - var item = document.createElement("li"); - item.setAttribute("id", itemName); - - var btn = document.createElement("button"); - btn.setAttribute("class", "active-scripts-script-header"); - btn.innerHTML = workerscript.name; - - var itemContentDiv = document.createElement("div"); - itemContentDiv.setAttribute("class", "active-scripts-script-panel"); - itemContentDiv.setAttribute("id", itemName + "-content"); - - item.appendChild(btn); - item.appendChild(itemContentDiv); - - createActiveScriptsText(workerscript, itemContentDiv); - - //Append element to list - var list = getActiveScriptsServerList(server); - list.appendChild(item); - - setActiveScriptsClickHandlers() //Reset click handlers -} - -function deleteActiveScriptsItem(workerscript) { - var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); - if (server == null) { - console.log("ERROR: Invalid server IP for workerscript."); - return; - } - var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; - for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); - } - var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; - var li = document.getElementById(itemName); - if (li == null) { - console.log("could not find Active scripts li element for: " + workerscript.name); - return; - } - li.parentNode.removeChild(li); - deleteActiveScriptsServerPanel(server); -} - -//Update the ActiveScriptsItems array -function updateActiveScriptsItems() { - var total = 0; - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) { - total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]); - } - document.getElementById("active-scripts-total-prod").innerHTML = - "Total online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(total, 2) + " / second"; -} - -//Updates the content of the given item in the Active Scripts list -function updateActiveScriptsItemContent(workerscript) { - var server = Object(__WEBPACK_IMPORTED_MODULE_1__Server_js__["e" /* getServer */])(workerscript.serverIp); - if (server == null) { - console.log("ERROR: Invalid server IP for workerscript."); - return; - } - var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; - for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); - } - var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; - var itemContent = document.getElementById(itemName + "-content") - - //Clear the item - while (itemContent.firstChild) { - itemContent.removeChild(itemContent.firstChild); - } - - //Add the updated text back. Returns the total online production rate - return createActiveScriptsText(workerscript, itemContent); -} - -function createActiveScriptsText(workerscript, item) { - var itemText = document.createElement("p"); - - //Server ip/hostname - var threads = "Threads: " + workerscript.scriptRef.threads; - var args = "Args: " + Object(__WEBPACK_IMPORTED_MODULE_3__utils_HelperFunctions_js__["f" /* printArray */])(workerscript.args); - - //Online - var onlineTotalMoneyMade = "Total online production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2); - var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " "); - - var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime; - var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second"; - var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime; - var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, " "); - - //Offline - var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2); - var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " "); - - var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime; - var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second"; - var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime; - var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) + " hacking exp/second").replace( / /g, " "); - - itemText.innerHTML = threads + "
" + args + "
" + onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" + - onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" + - offlineMpsText + "
" + offlineEpsText + "
"; - - item.appendChild(itemText); - - var logButton = document.createElement("span"); - logButton.innerHTML = "Log"; - var killButton = document.createElement("span"); - killButton.innerHTML = "Kill script"; - logButton.setAttribute("class", "active-scripts-button"); - killButton.setAttribute("class", "active-scripts-button"); - logButton.addEventListener("click", function() { - Object(__WEBPACK_IMPORTED_MODULE_4__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef); - return false; - }); - killButton.addEventListener("click", function() { - Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["d" /* killWorkerScript */])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server); - Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Killing script, may take a few minutes to complete..."); - return false; - }); - item.appendChild(logButton); - item.appendChild(killButton); - - //Return total online production rate - return onlineMps; -} - - - - /***/ }), /* 28 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Environment; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptFunctions_js__ = __webpack_require__(39); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptFunctions_js__ = __webpack_require__(29); /* Environment * NetScript program environment @@ -32429,6 +32674,30 @@ Environment.prototype = { return (scope || this).vars[name] = value; }, + setArrayElement: function(name, idx, value) { + if (!(idx instanceof Array)) { + throw new Error("idx parameter is not an Array"); + } + var scope = this.lookup(name); + if (!scope && this.parent) { + console.log("Here"); + throw new Error("Undefined variable " + name); + } + var arr = (scope || this).vars[name]; + if (!(arr.constructor === Array || arr instanceof Array)) { + throw new Error("Variable is not an array: " + name); + } + var res = arr; + for (var iterator = 0; iterator < idx.length-1; ++iterator) { + var i = idx[iterator]; + if (!(res instanceof Array) || i >= res.length) { + throw new Error("Out-of-bounds array access"); + } + res = res[i]; + } + return res[idx[idx.length-1]] = value; + }, + /* setArrayElement: function(name, idx, value) { var scope = this.lookup(name); if (!scope && this.parent) { @@ -32440,7 +32709,7 @@ Environment.prototype = { throw new Error("Variable is not an array: " + name); } return (scope || this).vars[name][idx] = value; - }, + },*/ //Creates (or overwrites) a variable in the current scope def: function(name, value) { @@ -32455,6 +32724,1976 @@ Environment.prototype = { /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptFunctions; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSingularitySFFlags; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasSingularitySF; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(9); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Constants_js__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__ = __webpack_require__(41); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(10); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__ = __webpack_require__(34); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Location_js__ = __webpack_require__(12); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Message_js__ = __webpack_require__(22); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(19); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Settings_js__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__ = __webpack_require__(26); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Terminal_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__ = __webpack_require__(33); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptEnvironment_js__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_decimal_js__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_22__utils_decimal_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__utils_IPAddress_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var hasSingularitySF = false; +var hasAISF = false; +var singularitySFLvl = 1; + +//Also used to check for Artificial Intelligence Source File, don't want to change +//name though +function initSingularitySFFlags() { + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles.length; ++i) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles[i].n === 4) { + hasSingularitySF = true; + singularitySFLvl = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles[i].lvl; + } + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].sourceFiles[i].n === 5) { + hasAISF = true; + } + } +} + +function NetscriptFunctions(workerScript) { + return { + Math : Math, + hacknetnodes : __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacknetNodes, + scan : function(ip=workerScript.serverIp, hostnames=true){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command'); + } + var out = []; + for (var i = 0; i < server.serversOnNetwork.length; i++) { + var entry; + if (hostnames) { + entry = server.getServerOnNetwork(i).hostname; + } else { + entry = server.getServerOnNetwork(i).ip; + } + if (entry == null) { + continue; + } + out.push(entry); + } + workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname); + return out; + }, + hack : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Hack() call has incorrect number of arguments. Takes 1 argument"); + } + var threads = workerScript.scriptRef.threads; + if (isNaN(threads) || threads < 1) {threads = 1;} + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping..."); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping..."); + } + + //Calculate the hacking time + var hackingTime = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //This is in seconds + + //No root access or skill level too low + if (server.hasAdminRights == false) { + workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user does not have root access"); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user does not have root access"); + } + + if (server.requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill) { + workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough"); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough"); + } + + workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")"); + //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")"); + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["d" /* netscriptDelay */])(hackingTime* 1000, workerScript).then(function() { + if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} + var hackChance = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["h" /* scriptCalculateHackingChance */])(server); + var rand = Math.random(); + var expGainedOnSuccess = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; + var expGainedOnFailure = (expGainedOnSuccess / 4); + if (rand < hackChance) { //Success! + var moneyGained = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["j" /* scriptCalculatePercentMoneyHacked */])(server); + moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads; + + //Over-the-top safety checks + if (moneyGained <= 0) { + moneyGained = 0; + expGainedOnSuccess = expGainedOnFailure; + } + if (moneyGained > server.moneyAvailable) {moneyGained = server.moneyAvailable;} + server.moneyAvailable -= moneyGained; + if (server.moneyAvailable < 0) {server.moneyAvailable = 0;} + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainMoney(moneyGained); + workerScript.scriptRef.onlineMoneyMade += moneyGained; + workerScript.scriptRef.recordHack(server.ip, moneyGained, threads); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess); + workerScript.scriptRef.onlineExpGained += expGainedOnSuccess; + //console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp"); + workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")"); + server.fortify(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount * threads); + return Promise.resolve(true); + } else { + //Player only gains 25% exp for failure? TODO Can change this later to balance + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure); + workerScript.scriptRef.onlineExpGained += expGainedOnFailure; + //console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp"); + workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " exp (t=" + threads + ")"); + return Promise.resolve(false); + } + }); + }, + sleep : function(time,log=true){ + if (time === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument"); + } + if (log) { + workerScript.scriptRef.log("Sleeping for " + time + " milliseconds"); + } + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["d" /* netscriptDelay */])(time, workerScript).then(function() { + return Promise.resolve(true); + }); + }, + grow : function(ip){ + var threads = workerScript.scriptRef.threads; + if (isNaN(threads) || threads < 1) {threads = 1;} + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "grow() call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot grow(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow(). Invalid IP or hostname passed in: " + ip); + } + + //No root access or skill level too low + if (server.hasAdminRights == false) { + workerScript.scriptRef.log("Cannot grow this server (" + server.hostname + ") because user does not have root access"); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow this server (" + server.hostname + ") because user does not have root access"); + } + + var growTime = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server); + //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds") + workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")"); + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["d" /* netscriptDelay */])(growTime, workerScript).then(function() { + if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} + server.moneyAvailable += (1 * threads); //It can be grown even if it has no money + var growthPercentage = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["j" /* processSingleServerGrowth */])(server, 450 * threads); + workerScript.scriptRef.recordGrow(server.ip, threads); + var expGain = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; + if (growthPercentage == 1) { + expGain = 0; + } + workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")"); + workerScript.scriptRef.onlineExpGained += expGain; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGain); + return Promise.resolve(growthPercentage); + }); + }, + weaken : function(ip){ + var threads = workerScript.scriptRef.threads; + if (isNaN(threads) || threads < 1) {threads = 1;} + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "weaken() call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot weaken(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken(). Invalid IP or hostname passed in: " + ip); + } + + //No root access or skill level too low + if (server.hasAdminRights == false) { + workerScript.scriptRef.log("Cannot weaken this server (" + server.hostname + ") because user does not have root access"); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken this server (" + server.hostname + ") because user does not have root access"); + } + + var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server); + workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")"); + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["d" /* netscriptDelay */])(weakenTime, workerScript).then(function() { + if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} + server.weaken(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads); + workerScript.scriptRef.recordWeaken(server.ip, threads); + var expGain = Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; + workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty + + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")"); + workerScript.scriptRef.onlineExpGained += expGain; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainHackingExp(expGain); + return Promise.resolve(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads); + }); + }, + print : function(args){ + if (args === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "print() call has incorrect number of arguments. Takes 1 argument"); + } + workerScript.scriptRef.log(args.toString()); + }, + tprint : function(args) { + if (args === undefined || args === null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument"); + } + var x = args.toString(); + if (Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["d" /* isHTML */])(x)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].takeDamage(1); + Object(__WEBPACK_IMPORTED_MODULE_23__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You suddenly feel a sharp shooting pain through your body as an angry voice in your head exclaims:

" + + "DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!

" + + "(You lost 1 HP)"); + return; + } + Object(__WEBPACK_IMPORTED_MODULE_18__Terminal_js__["b" /* post */])(workerScript.scriptRef.filename + ": " + args.toString()); + }, + clearLog : function() { + workerScript.scriptRef.clearLog(); + }, + nuke : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].NukeProgram)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!"); + } + if (server.openPortCount < server.numOpenPortsRequired) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Not enough ports opened to use NUKE.exe virus"); + } + if (server.hasAdminRights) { + workerScript.scriptRef.log("Already have root access to " + server.hostname); + } else { + server.hasAdminRights = true; + workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access"); + } + return true; + }, + brutessh : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) { + workerScript.scriptRef.log("You do not have the BruteSSH.exe program!"); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the BruteSSH.exe program!"); + } + if (!server.sshPortOpen) { + workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)"); + server.sshPortOpen = true; + ++server.openPortCount; + } else { + workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname); + } + return true; + }, + ftpcrack : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the FTPCrack.exe program!"); + } + if (!server.ftpPortOpen) { + workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)"); + server.ftpPortOpen = true; + ++server.openPortCount; + } else { + workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname); + } + return true; + }, + relaysmtp : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the relaySMTP.exe program!"); + } + if (!server.smtpPortOpen) { + workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)"); + server.smtpPortOpen = true; + ++server.openPortCount; + } else { + workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname); + } + return true; + }, + httpworm : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the HTTPWorm.exe program!"); + } + if (!server.httpPortOpen) { + workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)"); + server.httpPortOpen = true; + ++server.openPortCount; + } else { + workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname); + } + return true; + }, + sqlinject : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip); + } + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the SQLInject.exe program!"); + } + if (!server.sqlPortOpen) { + workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)"); + server.sqlPortOpen = true; + ++server.openPortCount; + } else { + workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname); + } + return true; + }, + run : function(scriptname,threads = 1){ + if (scriptname === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)"); + } + if (isNaN(threads) || threads < 1) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into run(). Must be numeric and greater than 0"); + } + var argsForNewScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForNewScript.push(arguments[i]); + } + var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(workerScript.serverIp); + if (scriptServer == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); + } + + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads); + }, + exec : function(scriptname,ip,threads = 1){ + if (scriptname === undefined || ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)"); + } + if (isNaN(threads) || threads < 1) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into exec(). Must be numeric and greater than 0"); + } + var argsForNewScript = []; + for (var i = 3; i < arguments.length; ++i) { + argsForNewScript.push(arguments[i]); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip); + } + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads); + }, + kill : function(filename,ip){ + if (filename === undefined || ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("kill() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() failed. Invalid IP or hostname passed in: " + ip); + } + var argsForKillTarget = []; + for (var i = 2; i < arguments.length; ++i) { + argsForKillTarget.push(arguments[i]); + } + var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(filename, argsForKillTarget, server); + if (runningScriptObj == null) { + workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget)); + return false; + } + var res = Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip); + if (res) { + workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die..."); + return true; + } else { + workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget)); + return false; + } + }, + killall : function(ip){ + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip); + } + for (var i = server.runningScripts.length-1; i >= 0; --i) { + Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip); + } + workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die"); + return true; + }, + scp : function(scriptname, ip1, ip2){ + if (arguments.length !== 2 && arguments.length !== 3) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); + } + if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files"); + } + + var destServer, currServ; + + if (arguments.length === 3) { //scriptname, source, destination + if (scriptname === undefined || ip1 === undefined || ip2 === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); + } + destServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip2); + if (destServer == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip); + } + + currServ = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip1); + if (currServ == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); + } + } else if (arguments.length === 2) { //scriptname, destination + if (scriptname === undefined || ip1 === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); + } + destServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip1); + if (destServer == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip); + } + + currServ = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(workerScript.serverIp); + if (currServ == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); + } + } + + //Scp for lit files + if (scriptname.endsWith(".lit")) { + var found = false; + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_11__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) { + found = true; + } + } + + if (!found) { + workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); + return false; + } + + for (var i = 0; i < destServer.messages.length; ++i) { + if (destServer.messages[i] === scriptname) { + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + return true; //Already exists + } + } + destServer.messages.push(scriptname); + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + return true; + } + + //Scp for script files + var sourceScript = null; + for (var i = 0; i < currServ.scripts.length; ++i) { + if (scriptname == currServ.scripts[i].filename) { + sourceScript = currServ.scripts[i]; + break; + } + } + if (sourceScript == null) { + workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); + return false; + } + + //Overwrite script if it already exists + for (var i = 0; i < destServer.scripts.length; ++i) { + if (scriptname == destServer.scripts[i].filename) { + workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten."); + workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname); + var oldScript = destServer.scripts[i]; + oldScript.code = sourceScript.code; + oldScript.ramUsage = sourceScript.ramUsage; + return true; + } + } + + //Create new script if it does not already exist + var newScript = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["c" /* Script */](); + newScript.filename = scriptname; + newScript.code = sourceScript.code; + newScript.ramUsage = sourceScript.ramUsage; + newScript.server = destServer.ip; + destServer.scripts.push(newScript); + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + return true; + }, + ls : function(ip, grep) { + if (ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server === null) { + workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip); + } + + //Get the grep filter, if one exists + var filter = false; + if (arguments.length >= 2) { + filter = grep.toString(); + } + + var allFiles = []; + for (var i = 0; i < server.programs.length; i++) { + if (filter) { + if (server.programs[i].includes(filter)) { + allFiles.push(server.programs[i]); + } + } else { + allFiles.push(server.programs[i]); + } + } + for (var i = 0; i < server.scripts.length; i++) { + if (filter) { + if (server.scripts[i].filename.includes(filter)) { + allFiles.push(server.scripts[i].filename); + } + } else { + allFiles.push(server.scripts[i].filename); + } + + } + for (var i = 0; i < server.messages.length; i++) { + if (filter) { + if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_11__Message_js__["a" /* Message */]) { + if (server.messages[i].filename.includes(filter)) { + allFiles.push(server.messages[i].filename); + } + } else if (server.messages[i].includes(filter)) { + allFiles.push(server.messages[i]); + } + } else { + if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_11__Message_js__["a" /* Message */]) { + allFiles.push(server.messages[i].filename); + } else { + allFiles.push(server.messages[i]); + } + } + } + + //Sort the files alphabetically then print each + allFiles.sort(); + return allFiles; + }, + hasRootAccess : function(ip){ + if (ip===undefined){ + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null){ + workerScript.scriptRef.log("hasRootAccess() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip); + } + return server.hasAdminRights; + }, + getIp : function() { + var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(workerScript.serverIp); + if (scriptServer == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); + } + return scriptServer.ip; + }, + getHostname : function(){ + var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(workerScript.serverIp); + if (scriptServer == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); + } + return scriptServer.hostname; + }, + getHackingLevel : function(){ + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].updateSkillLevels(); + workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill); + return __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill; + }, + getIntelligence : function () { + if (!hasAISF) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getIntelligence(). It requires Source-File 5 to run."); + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].updateSkillLevels(); + workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].intelligence); + return __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].intelligence; + }, + getHackingMultipliers : function() { + return { + chance: __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_chance_mult, + speed: __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_speed_mult, + money: __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_money_mult, + growth: __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_grow_mult, + }; + }, + getBitNodeMultipliers: function() { + if (!hasAISF) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run."); + } + return __WEBPACK_IMPORTED_MODULE_2__BitNode_js__["a" /* BitNodeMultipliers */]; + }, + getServerMoneyAvailable : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); + } + if (server.hostname == "home") { + //Return player's money + workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.toNumber(), 2)); + return __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.toNumber(); + } + workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname); + return server.moneyAvailable; + }, + getServerSecurityLevel : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname); + return server.hackDifficulty; + }, + getServerBaseSecurityLevel : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname); + return server.baseDifficulty; + }, + getServerRequiredHackingLevel : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname); + return server.requiredHackingSkill; + }, + getServerMaxMoney : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname); + return server.moneyMax; + }, + getServerGrowth : function(ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname); + return server.serverGrowth; + }, + getServerNumPortsRequired : function(ip){ + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname); + return server.numOpenPortsRequired; + }, + getServerRam : function(ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip); + } + workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]"); + return [server.maxRam, server.ramUsed]; + }, + serverExists : function(ip) { + return (Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip) !== null); + }, + fileExists : function(filename,ip=workerScript.serverIp){ + if (filename === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("fileExists() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() failed. Invalid IP or hostname passed in: " + ip); + } + for (var i = 0; i < server.scripts.length; ++i) { + if (filename == server.scripts[i].filename) { + return true; + } + } + for (var i = 0; i < server.programs.length; ++i) { + if (filename.toLowerCase() == server.programs[i].toLowerCase()) { + return true; + } + } + return false; + }, + isRunning : function(filename,ip){ + if (filename === undefined || ip === undefined) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)"); + } + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("isRunning() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() failed. Invalid IP or hostname passed in: " + ip); + } + var argsForTargetScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForTargetScript.push(arguments[i]); + } + return (Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null); + }, + getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__["b" /* getCostOfNextHacknetNode */], + purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_9__HacknetNode_js__["d" /* purchaseHacknet */], + getStockPrice : function(symbol) { + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasTixApiAccess) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()"); + } + var stock = __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; + if (stock == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); + } + return parseFloat(stock.price.toFixed(3)); + }, + getStockPosition : function(symbol) { + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasTixApiAccess) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()"); + } + var stock = __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; + if (stock == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); + } + return [stock.playerShares, stock.playerAvgPx]; + }, + buyStock : function(symbol, shares) { + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasTixApiAccess) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()"); + } + var stock = __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; + if (stock == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); + } + if (shares == 0) {return false;} + if (stock == null || shares < 0 || isNaN(shares)) { + workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()"); + return false; + } + shares = Math.round(shares); + + var totalPrice = stock.price * shares; + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) { + workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + + symbol + ". Need $" + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString()); + return false; + } + + var origTotal = stock.playerShares * stock.playerAvgPx; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission); + var newTotal = origTotal + totalPrice; + stock.playerShares += shares; + stock.playerAvgPx = newTotal / stock.playerShares; + if (__WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].Page.StockMarket) { + Object(__WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock); + } + workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share"); + return true; + }, + sellStock : function(symbol, shares) { + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hasTixApiAccess) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()"); + } + var stock = __WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; + if (stock == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); + } + if (shares == 0) {return false;} + if (stock == null || shares < 0 || isNaN(shares)) { + workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()"); + return false; + } + if (shares > stock.playerShares) {shares = stock.playerShares;} + if (shares == 0) {return false;} + var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainMoney(gains); + + //Calculate net profit and add to script stats + var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].StockMarketCommission; + if (isNaN(netProfit)) {netProfit = 0;} + workerScript.scriptRef.onlineMoneyMade += netProfit; + + stock.playerShares -= shares; + if (stock.playerShares == 0) { + stock.playerAvgPx = 0; + } + if (__WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].Page.StockMarket) { + Object(__WEBPACK_IMPORTED_MODULE_17__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock); + } + workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" + + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " + + "$" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2)); + return true; + }, + purchaseServer : function(hostname, ram) { + var hostnameStr = String(hostname); + hostnameStr = hostnameStr.replace(/\s\s+/g, ''); + if (hostnameStr == "") { + workerScript.scriptRef.log("Error: Passed empty string for hostname argument of purchaseServer()"); + return ""; + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) { + workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit + + " servers. You cannot purchase any more."); + return ""; + } + + ram = Math.round(ram); + if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["e" /* powerOfTwo */])(ram)) { + workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2"); + return ""; + } + + var cost = ram * __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer; + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.lt(cost)) { + workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2)); + return ""; + } + var newServ = new __WEBPACK_IMPORTED_MODULE_14__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_25__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram); + Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["a" /* AddToAllServers */])(newServ); + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip); + var homeComputer = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer(); + homeComputer.serversOnNetwork.push(newServ.ip); + newServ.serversOnNetwork.push(homeComputer.ip); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(cost); + workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2)); + return newServ.hostname; + }, + deleteServer : function(hostname) { + var hostnameStr = String(hostname); + hostnameStr = hostnameStr.replace(/\s\s+/g, ''); + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["c" /* GetServerByHostname */])(hostnameStr); + if (server == null) { + workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed"); + return false; + } + + if (!server.purchasedByPlayer || server.hostname == "home") { + workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " + + "Cannot be deleted. deleteServer failed"); + return false; + } + + var ip = server.ip; + + //A server cannot delete itself + if (ip == workerScript.serverIp) { + workerScript.scriptRef.log("Error: Cannot call deleteServer() on self. Function failed"); + return false; + } + + //Delete all scripts running on server + if (server.runningScripts.length > 0) { + workerScript.scriptRef.log("Error: Cannot delete server " + server.hostname + " because it still has scripts running."); + return false; + } + + //Delete from player's purchasedServers array + var found = false; + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers.length; ++i) { + if (ip == __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers[i]) { + found = true; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].purchasedServers.splice(i, 1); + break; + } + } + + if (!found) { + workerScript.scriptRef.log("Error: Could not identify server " + server.hostname + + "as a purchased server. This is likely a bug please contact game dev"); + return false; + } + + //Delete from all servers + delete __WEBPACK_IMPORTED_MODULE_14__Server_js__["b" /* AllServers */][ip]; + + //Delete from home computer + found = false; + var homeComputer = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer(); + for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) { + if (ip == homeComputer.serversOnNetwork[i]) { + homeComputer.serversOnNetwork.splice(i, 1); + workerScript.scriptRef.log("Deleted server " + hostnameStr); + return true; + } + } + //Wasn't found on home computer + workerScript.scriptRef.log("Error: Could not find server " + server.hostname + + "as a purchased server. This is likely a bug please contact game dev"); + return false; + }, + round : function(n) { + if (isNaN(n)) {return 0;} + return Math.round(n); + }, + write : function(port, data="") { + if (!isNaN(port)) { + //Port 1-10 + if (port < 1 || port > 10) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid."); + } + var portName = "Port" + String(port); + var port = __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["a" /* NetscriptPorts */][portName]; + if (port == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer"); + } + port.push(data); + if (port.length > __WEBPACK_IMPORTED_MODULE_15__Settings_js__["a" /* Settings */].MaxPortCapacity) { + port.shift(); + return true; + } + return false; + } else { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10"); + } + }, + read : function(port) { + if (!isNaN(port)) { + //Port 1-10 + if (port < 1 || port > 10) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid."); + } + var portName = "Port" + String(port); + var port = __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["a" /* NetscriptPorts */][portName]; + if (port == null) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer"); + } + if (port.length == 0) { + return "NULL PORT DATA"; + } else { + return port.shift(); + } + } else { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10"); + } + }, + scriptRunning : function(scriptname, ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scriptRunning() failed. Invalid IP or hostname passed in: " + ip); + } + for (var i = 0; i < server.runningScripts.length; ++i) { + if (server.runningScripts[i].filename == scriptname) { + return true; + } + } + return false; + }, + scriptKill : function(scriptname, ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scriptKill() failed. Invalid IP or hostname passed in: " + ip); + } + var suc = false; + for (var i = 0; i < server.runningScripts.length; ++i) { + if (server.runningScripts[i].filename == scriptname) { + Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip); + suc = true; + } + } + return suc; + }, + getScriptRam : function (scriptname, ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptRam() failed. Invalid IP or hostname passed in: " + ip); + } + for (var i = 0; i < server.scripts.length; ++i) { + if (server.scripts[i].filename == scriptname) { + return server.scripts[i].ramUsage; + } + } + return 0; + }, + getHackTime : function(ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip); + } + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //Returns seconds + }, + getGrowTime : function(ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip); + } + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds + }, + getWeakenTime : function(ip) { + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server == null) { + workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); + } + return Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds + }, + getScriptIncome : function(scriptname, ip) { + if (arguments.length === 0) { + //Get total script income + return Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])(); + } else { + //Get income for a particular script + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server === null) { + workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip); + } + var argsForScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForScript.push(arguments[i]); + } + var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server); + if (runningScriptObj == null) { + workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript)); + return -1; + } + return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime; + } + }, + getScriptExpGain : function(scriptname, ip) { + if (arguments.length === 0) { + var total = 0; + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) { + total += (__WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineExpGained / __WEBPACK_IMPORTED_MODULE_19__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineRunningTime); + } + return total; + } else { + //Get income for a particular script + var server = Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["e" /* getServer */])(ip); + if (server === null) { + workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip); + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip); + } + var argsForScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForScript.push(arguments[i]); + } + var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_13__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server); + if (runningScriptObj == null) { + workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_24__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript)); + return -1; + } + return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime; + } + }, + + /* Singularity Functions */ + universityCourse(universityName, className) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 1)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); + return false; + } + } + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].isWorking) { + var txt = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].singularityStopWork(); + workerScript.scriptRef.log(txt); + } + + var costMult, expMult; + switch(universityName.toLowerCase()) { + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum) { + workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumSummitUniversity; + costMult = 4; + expMult = 3; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12) { + workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12RothmanUniversity; + costMult = 3; + expMult = 2; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Volhaven) { + workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology; + costMult = 5; + expMult = 4; + break; + default: + workerScript.scriptRef.log("Invalid university name: " + universityName + ". universityCourse() failed"); + return false; + } + + var task; + switch(className.toLowerCase()) { + case "Study Computer Science".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience; + break; + case "Data Structures".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassDataStructures; + break; + case "Networks".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassNetworks; + break; + case "Algorithms".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms; + break; + case "Management".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassManagement; + break; + case "Leadership".toLowerCase(): + task = __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassLeadership; + break; + default: + workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startClass(costMult, expMult, task); + workerScript.scriptRef.log("Started " + task + " at " + universityName); + return true; + }, + + gymWorkout(gymName, stat) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 1)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); + return false; + } + } + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].isWorking) { + var txt = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].singularityStopWork(); + workerScript.scriptRef.log(txt); + } + var costMult, expMult; + switch(gymName.toLowerCase()) { + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum) { + workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumCrushFitnessGym; + costMult = 2; + expMult = 1.5; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum) { + workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumSnapFitnessGym; + costMult = 6; + expMult = 4; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12) { + workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12IronGym; + costMult = 1; + expMult = 1; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12) { + workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12PowerhouseGym; + costMult = 10; + expMult = 7.5; + break; + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym: + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Volhaven) { + workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym; + costMult = 3; + expMult = 2.5; + break; + default: + workerScript.scriptRef.log("Invalid gym name: " + gymName + ". gymWorkout() failed"); + return false; + } + + switch(stat.toLowerCase()) { + case "strength".toLowerCase(): + case "str".toLowerCase(): + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassGymStrength); + break; + case "defense".toLowerCase(): + case "def".toLowerCase(): + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassGymDefense); + break; + case "dexterity".toLowerCase(): + case "dex".toLowerCase(): + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity); + break; + case "agility".toLowerCase(): + case "agi".toLowerCase(): + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].ClassGymAgility); + break; + default: + workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed"); + return false; + } + workerScript.scriptRef.log("Started training " + stat + " at " + gymName); + return true; + }, + + travelToCity(cityname) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 1)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); + return false; + } + } + + switch(cityname) { + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum: + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Chongqing: + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12: + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].NewTokyo: + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Ishima: + case __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Volhaven: + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(200000); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].city = cityname; + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + workerScript.scriptRef.log("Traveled to " + cityname); + return true; + default: + workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity()."); + return false; + } + }, + + purchaseTor() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 1)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); + return false; + } + } + + if (__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) { + workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed"); + return false; + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) { + workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].TorRouterCost); + + var darkweb = new __WEBPACK_IMPORTED_MODULE_14__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_25__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1); + Object(__WEBPACK_IMPORTED_MODULE_14__Server_js__["a" /* AddToAllServers */])(darkweb); + __WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip); + + document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive"); + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip); + darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().ip); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + workerScript.scriptRef.log("You have purchased a Tor router!"); + return true; + }, + purchaseProgram(programName) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 1)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); + return false; + } + } + + if (__WEBPACK_IMPORTED_MODULE_16__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] == null) { + workerScript.scriptRef.log("ERROR: You do not have TOR router. purchaseProgram() failed."); + return false; + } + + switch(programName.toLowerCase()) { + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].BruteSSHProgram); + workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].FTPCrackProgram); + workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram); + workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].HTTPWormProgram); + workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].SQLInjectProgram); + workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV1); + workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase(): + var price = Object(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_6__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV2); + workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " + + "can be found on your home computer."); + } else { + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; + } + return true; + default: + workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram()."); + return false; + } + return true; + }, + upgradeHomeRam() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + //Calculate how many times ram has been upgraded (doubled) + var currentRam = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().maxRam; + var numUpgrades = Math.log2(currentRam); + + //Calculate cost + //Have cost increase by some percentage each time RAM has been upgraded + var cost = currentRam * __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome; + var mult = Math.pow(1.55, numUpgrades); + cost = cost * mult; + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].money.lt(cost)) { + workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money"); + return false; + } + + var homeComputer = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer(); + homeComputer.maxRam *= 2; + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].loseMoney(cost); + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM."); + return true; + }, + getUpgradeHomeRamCost() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + //Calculate how many times ram has been upgraded (doubled) + var currentRam = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].getHomeComputer().maxRam; + var numUpgrades = Math.log2(currentRam); + + //Calculate cost + //Have cost increase by some percentage each time RAM has been upgraded + var cost = currentRam * __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome; + var mult = Math.pow(1.55, numUpgrades); + return cost * mult; + }, + workForCompany() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_3__Company_js__["c" /* CompanyPosition */])) { + workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job"); + return false; + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].isWorking) { + var txt = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].singularityStopWork(); + workerScript.scriptRef.log(txt); + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startWorkPartTime(); + } else { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startWork(); + } + workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyPosition.positionName); + return true; + }, + applyToCompany(companyName, field) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + if (!Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["e" /* companyExists */])(companyName)) { + workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist."); + return false; + } + + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].location = companyName; + var res; + switch (field.toLowerCase()) { + case "software": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForSoftwareJob(true); + break; + case "software consultant": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true); + break; + case "it": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForItJob(true); + break; + case "security engineer": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true); + break; + case "network engineer": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true); + break; + case "business": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForBusinessJob(true); + break; + case "business consultant": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true); + break; + case "security": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForSecurityJob(true); + break; + case "agent": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForAgentJob(true); + break; + case "employee": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForEmployeeJob(true); + break; + case "part-time employee": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true); + break; + case "waiter": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForWaiterJob(true); + break; + case "part-time waiter": + res = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].applyForPartTimeWaiterJob(true); + break; + default: + workerScript.scriptRef.log("ERROR: Invalid job passed into applyToCompany: " + field + ". applyToCompany() failed"); + return false; + } + //The Player object's applyForJob function can return string with special error messages + if (Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["f" /* isString */])(res)) { + workerScript.scriptRef.log(res); + return false; + } + if (res) { + workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].companyPosition.positionName); + } else { + workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field."); + } + return res; + }, + getCompanyRep(companyName) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + var company = __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */][companyName]; + if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_3__Company_js__["b" /* Company */])) { + workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName); + return -1; + } + return company.playerReputation; + }, + checkFactionInvitations() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + //Make a copy of Player.factionInvitations + return __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].factionInvitations.slice(); + }, + joinFaction(name) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + if (!Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["d" /* factionExists */])(name)) { + workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist."); + return false; + } + + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].factionInvitations.includes(name)) { + workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed"); + return false; + } + + var index = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].factionInvitations.indexOf(name); + if (index === -1) { + //Redundant and should never happen... + workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].factionInvitations.splice(index, 1); + var fac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][name]; + Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["h" /* joinFaction */])(fac); + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + workerScript.scriptRef.log("Joined the " + name + " faction."); + return true; + }, + workForFaction(name, type) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return false; + } + } + + if (!Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["d" /* factionExists */])(name)) { + workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist."); + return false; + } + + if (!__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].factions.includes(name)) { + workerScript.scriptRef.log("ERROR: workForFaction() failed because you are not a member of " + name); + return false; + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].isWorking) { + var txt = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].singularityStopWork(); + workerScript.scriptRef.log(txt); + } + + var fac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][name]; + //Arrays listing factions that allow each time of work + var hackAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp", + "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", + "OmniTek Incorporated", "Four Sigma", "KuaiGong International", + "Fulcrum Secret Technologies", "BitRunners", "The Black Hand", + "NiteSec", "Chongqing", "Sector-12", "New Tokyo", "Aevum", + "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army", + "The Syndicate", "Silhouette", "Netburners", "Tian Di Hui", "CyberSec"]; + var fdWkAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp", + "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", + "OmniTek Incorporated", "Four Sigma", "KuaiGong International", + "The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum", + "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army", + "The Syndicate", "Silhouette", "Tetrads", "Slum Snakes"]; + var scWkAvailable = ["ECorp", "MegaCorp", + "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", + "OmniTek Incorporated", "Four Sigma", "KuaiGong International", + "Fulcrum Secret Technologies", "Chongqing", "Sector-12", "New Tokyo", "Aevum", + "Ishima", "Volhaven", "Speakers for the Dead", + "The Syndicate", "Tetrads", "Slum Snakes", "Tian Di Hui"]; + + switch (type.toLowerCase()) { + case "hacking": + case "hacking contracts": + case "hackingcontracts": + if (!hackAvailable.includes(fac.name)) { + workerScript.scriptRef.log("ERROR: Cannot carry out hacking contracts for " + fac.name + ". workForFaction() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startFactionHackWork(fac); + workerScript.scriptRef.log("Started carrying out hacking contracts for " + fac.name); + return true; + case "field": + case "fieldwork": + case "field work": + if (!fdWkAvailable.includes(fac.name)) { + workerScript.scriptRef.log("ERROR: Cannot carry out field missions for " + fac.name + ". workForFaction() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startFactionFieldWork(fac); + workerScript.scriptRef.log("Started carrying out field missions for " + fac.name); + return true; + case "security": + case "securitywork": + case "security work": + if (!scWkAvailable.includes(fac.name)) { + workerScript.scriptRef.log("ERROR: Cannot serve as security detail for " + fac.name + ". workForFaction() failed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startFactionSecurityWork(fac); + workerScript.scriptRef.log("Started serving as security details for " + fac.name); + return true; + default: + workerScript.scriptRef.log("ERROR: Invalid work type passed into workForFaction(): " + type); + } + return true; + }, + getFactionRep(name) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 2)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); + return -1; + } + } + + if (!Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["d" /* factionExists */])(name)) { + workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist."); + return -1; + } + + return __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][name].playerReputation; + }, + createProgram(name) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 3)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return false; + } + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].isWorking) { + var txt = __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].singularityStopWork(); + workerScript.scriptRef.log(txt); + } + + switch(name.toLowerCase()) { + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase(): + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 50) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 100) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 250) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 500) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 750) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 75) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 400) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 75) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75); + break; + case __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase(): + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].hacking_skill < 25) { + workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 25); + break; + default: + workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name); + return false; + } + workerScript.scriptRef.log("Began creating program: " + name); + return true; + }, + getAugmentationCost(name) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 3)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return false; + } + } + + if (!Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(name)) { + workerScript.scriptRef.log("ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name); + return [-1, -1]; + } + + var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name]; + return [aug.baseRepRequirement, aug.baseCost]; + }, + purchaseAugmentation(faction, name) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 3)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return false; + } + } + + var fac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][faction]; + if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_8__Faction_js__["a" /* Faction */])) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction); + return false; + } + + if (!fac.augmentations.includes(name)) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because the faction " + faction + " does not contain the " + name + " augmentation"); + return false; + } + + var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name]; + if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name); + return false; + } + + var isNeuroflux = false; + if (aug.name === __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) { + isNeuroflux = true; + } + + if (!isNeuroflux) { + for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].queuedAugmentations[j].name === aug.name) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); + return false; + } + } + for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].augmentations.length; ++j) { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].augmentations[j].name === aug.name) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); + return false; + } + } + } + + if (fac.playerReputation < aug.baseRepRequirement) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you do not have enough reputation with " + fac.name); + return false; + } + + var res = Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true); + workerScript.scriptRef.log(res); + if (Object(__WEBPACK_IMPORTED_MODULE_26__utils_StringHelperFunctions_js__["f" /* isString */])(res) && res.startsWith("You purchased")) { + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + return true; + } else { + return false; + } + }, + installAugmentations() { + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].bitNodeN != 4) { + if (!(hasSingularitySF && singularitySFLvl >= 3)) { + throw Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); + return false; + } + } + + if (__WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].queuedAugmentations.length === 0) { + workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed"); + return false; + } + __WEBPACK_IMPORTED_MODULE_12__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_4__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain); + workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed"); + Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["h" /* installAugmentations */])(); + return true; + } + } +} + + + + +/***/ }), +/* 30 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + "use strict"; /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Gang; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return displayGangContent; }); @@ -32467,13 +34706,13 @@ Environment.prototype = { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Location_js__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(38); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(36); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(21); @@ -32601,7 +34840,7 @@ function processAllGangPowerGains(numCycles=1) { if (name == playerGangName) { AllGangs[name].power += __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gang.calculatePower(); } else { - var gain = Math.random() * 0.01; //TODO Adjust as necessary + var gain = Math.random() * 0.02; //TODO Adjust as necessary AllGangs[name].power += (gain); } } @@ -32706,8 +34945,12 @@ Gang.prototype.processGains = function(numCycles=1) { console.log("ERROR: respectGains is NaN"); } if (!isNaN(wantedLevelGains)) { - this.wanted += (wantedLevelGains * this.storedCycles); - if (this.wanted < 1) {this.wanted = 1;} + if (this.wanted === 1 && wantedLevelGains < 0) { + //Do nothing + } else { + this.wanted += (wantedLevelGains * this.storedCycles); + if (this.wanted < 1) {this.wanted = 1;} + } } else { console.log("ERROR: wantedLevelGains is NaN"); } @@ -33771,7 +36014,7 @@ function setGangMemberTaskDescription(memberObj, taskName) { /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) /***/ }), -/* 30 */ +/* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -33912,29 +36155,31 @@ function applySourceFile(srcFile) { /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return prestigeAugmentation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prestigeSourceFile; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(23); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(18); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Terminal_js__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15__utils_decimal_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(22); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(29); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(26); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__); + @@ -33956,20 +36201,20 @@ function applySourceFile(srcFile) { function prestigeAugmentation() { Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])(); - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].prestigeAugmentation(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeAugmentation(); //Delete all Worker Scripts objects - Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); + Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); - var homeComp = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getHomeComputer(); + var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer(); //Delete all servers except home computer - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["h" /* prestigeAllServers */])(); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])(); //Delete Special Server IPs - Object(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers() + Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers() //Reset home computer (only the programs) and add to AllServers - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["i" /* prestigeHomeComputer */])(homeComp); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp); if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink) && __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink].owned) { @@ -33978,14 +36223,14 @@ function prestigeAugmentation() { } if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot) && __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot].owned) { - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(1000000)); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(1000000)); homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram); } - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(homeComp); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp); //Re-create foreign servers - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["f" /* initForeignServers */])(); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])(); //Darkweb is purchase-able document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button"); @@ -34007,27 +36252,27 @@ function prestigeAugmentation() { //Stop a Terminal action if there is onerror if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) { __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false; - __WEBPACK_IMPORTED_MODULE_14__Terminal_js__["a" /* Terminal */].finishAction(true); + __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true); } //Re-initialize things - This will update any changes Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].reapplyAllSourceFiles(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles(); Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])(); //Clear terminal $("#terminal tr:not(:last)").remove(); - Object(__WEBPACK_IMPORTED_MODULE_14__Terminal_js__["c" /* postNetburnerText */])(); + Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])(); //Messages Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])(); //Reset Stock market - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].hasWseAccount) { - Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["d" /* initStockMarket */])(); - Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["f" /* initSymbolToStockMap */])(); - Object(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["h" /* setStockMarketContentCreated */])(false); + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) { + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["d" /* initStockMarket */])(); + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["f" /* initSymbolToStockMap */])(); + Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["h" /* setStockMarketContentCreated */])(false); var stockMarketList = document.getElementById("stock-market-list"); while(stockMarketList.firstChild) { stockMarketList.removeChild(stockMarketList.firstChild); @@ -34035,8 +36280,8 @@ function prestigeAugmentation() { } //Gang, in BitNode 2 - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].inGang()) { - var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].gang.facName]; + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].inGang()) { + var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang.facName]; if (faction instanceof __WEBPACK_IMPORTED_MODULE_6__Faction_js__["a" /* Faction */]) { Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(faction); } @@ -34044,13 +36289,14 @@ function prestigeAugmentation() { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; + __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput(); __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent(); //Red Pill if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill) && __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) { - var WorldDaemon = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]]; - var DaedalusServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]]; + var WorldDaemon = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]]; + var DaedalusServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]]; if (WorldDaemon && DaedalusServer) { WorldDaemon.serversOnNetwork.push(DaedalusServer.ip); DaedalusServer.serversOnNetwork.push(WorldDaemon.ip); @@ -34064,25 +36310,25 @@ function prestigeSourceFile() { Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])(); //Crime statistics - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].prestigeSourceFile(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeSourceFile(); //Delete all Worker Scripts objects - Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); + Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])(); - var homeComp = __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].getHomeComputer(); + var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer(); //Delete all servers except home computer - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers() + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers() //Delete Special Server IPs - Object(__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); + Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Reset home computer (only the programs) and add to AllServers - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["i" /* prestigeHomeComputer */])(homeComp); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp); var srcFile1Owned = false; - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].sourceFiles.length; ++i) { - if (__WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].sourceFiles[i].n == 1) { + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles.length; ++i) { + if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles[i].n == 1) { srcFile1Owned = true; } } @@ -34092,10 +36338,10 @@ function prestigeSourceFile() { homeComp.setMaxRam(8); } - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(homeComp); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp); //Re-create foreign servers - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["f" /* initForeignServers */])(); + Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])(); //Darkweb is purchase-able document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button"); @@ -34117,7 +36363,7 @@ function prestigeSourceFile() { //Stop a Terminal action if there is one if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) { __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false; - __WEBPACK_IMPORTED_MODULE_14__Terminal_js__["a" /* Terminal */].finishAction(true); + __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true); } //Delete all Augmentations @@ -34130,19 +36376,26 @@ function prestigeSourceFile() { //Re-initialize things - This will update any changes Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers - __WEBPACK_IMPORTED_MODULE_10__Player_js__["a" /* Player */].reapplyAllSourceFiles(); + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles(); Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])(); //Clear terminal $("#terminal tr:not(:last)").remove(); - Object(__WEBPACK_IMPORTED_MODULE_14__Terminal_js__["c" /* postNetburnerText */])(); + Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])(); //Messages Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; + __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput(); __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent(); + + //Reinitialize flags in case you just finished BN-4 + Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["c" /* initSingularitySFFlags */])(); + + //Gain int exp + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5); } @@ -34150,7 +36403,820 @@ function prestigeSourceFile() { /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) /***/ }), -/* 32 */ +/* 33 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return makeRuntimeRejectMsg; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return netscriptDelay; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return runScriptFromScript; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateHackingChance; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateHackingTime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return scriptCalculateExpGain; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculatePercentMoneyHacked; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return scriptCalculateGrowTime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculateWeakenTime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isScriptErrorMessage; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(15); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(19); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + + + + + + + +/* Evaluator + * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser + * + * Returns a promise + */ +function evaluate(exp, workerScript) { + return new Promise(function(resolve, reject) { + var env = workerScript.env; + if (env.stopFlag) {return reject(workerScript);} + if (exp == null) { + return reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression")); + } + setTimeout(function() { + if (env.stopFlag) {return reject(workerScript);} + switch (exp.type) { + case "BlockStatement": + case "Program": + var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment + evaluateProgPromise.then(function(w) { + resolve(workerScript); + }, function(e) { + if (Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["f" /* isString */])(e)) { + workerScript.errorMessage = e; + reject(workerScript); + } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) { + reject(e); + } else { + reject(workerScript); + } + }); + break; + case "Literal": + resolve(exp.value); + break; + case "Identifier": + if (!(exp.name in env.vars)){ + reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined")); + } + resolve(env.get(exp.name)) + break; + case "ExpressionStatement": + var e = evaluate(exp.expression, workerScript); + e.then(function(res) { + resolve("expression done"); + }, function(e) { + reject(e); + }); + break; + case "ArrayExpression": + var argPromises = exp.elements.map(function(arg) { + return evaluate(arg, workerScript); + }); + Promise.all(argPromises).then(function(array) { + resolve(array) + }).catch(function(e) { + reject(e); + }); + break; + case "CallExpression": + evaluate(exp.callee, workerScript).then(function(func) { + var argPromises = exp.arguments.map(function(arg) { + return evaluate(arg, workerScript); + }); + Promise.all(argPromises).then(function(args) { + if (exp.callee.type == "MemberExpression"){ + evaluate(exp.callee.object, workerScript).then(function(object) { + try { + var res = func.apply(object,args); + resolve(res); + } catch (e) { + reject(makeRuntimeRejectMsg(workerScript, e)); + } + }).catch(function(e) { + reject(e); + }); + } else { + try { + var out = func.apply(null,args); + if (out instanceof Promise){ + out.then(function(res) { + resolve(res) + }).catch(function(e) { + reject(e); + }); + } else { + resolve(out); + } + } catch (e) { + if (isScriptErrorMessage(e)) { + reject(e); + } else { + reject(makeRuntimeRejectMsg(workerScript, e)); + } + } + } + }).catch(function(e) { + reject(e); + }); + }).catch(function(e) { + reject(e); + }); + break; + case "MemberExpression": + var pObject = evaluate(exp.object, workerScript); + pObject.then(function(object) { + if (exp.computed){ + var p = evaluate(exp.property, workerScript); + p.then(function(index) { + if (index >= object.length) { + return reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays")); + } + resolve(object[index]); + }).catch(function(e) { + console.log("here"); + reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); + }); + } else { + try { + resolve(object[exp.property.name]) + } catch (e) { + return reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString())); + } + } + }).catch(function(e) { + reject(e); + }); + break; + case "LogicalExpression": + case "BinaryExpression": + var p = evalBinary(exp, workerScript, resolve, reject); + p.then(function(res) { + resolve(res); + }).catch(function(e) { + reject(e); + }); + break; + case "UnaryExpression": + var p = evalUnary(exp, workerScript, resolve, reject); + p.then(function(res) { + resolve(res); + }).catch(function(e) { + reject(e); + }); + break; + case "AssignmentExpression": + var p = evalAssignment(exp, workerScript); + p.then(function(res) { + resolve(res); + }).catch(function(e) { + reject(e); + }); + break; + case "UpdateExpression": + if (exp.argument.type==="Identifier"){ + if (exp.argument.name in env.vars){ + if (exp.prefix){ + resolve(env.get(exp.argument.name)) + } + switch (exp.operator){ + case "++": + env.set(exp.argument.name,env.get(exp.argument.name)+1); + break; + case "--": + env.set(exp.argument.name,env.get(exp.argument.name)-1); + break; + default: + reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported")); + } + if (env.prefix){ + return; + } + resolve(env.get(exp.argument.name)) + } else { + reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined")); + } + } else { + reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier")); + } + break; + case "EmptyStatement": + resolve(false); + break; + case "ReturnStatement": + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Return statements are not yet implemented in Netscript (line " + (lineNum+1) + ")")); + break; + case "BreakStatement": + reject("BREAKSTATEMENT"); + break; + case "IfStatement": + evaluateIf(exp, workerScript).then(function(forLoopRes) { + resolve("forLoopDone"); + }).catch(function(e) { + reject(e); + }); + break; + case "SwitchStatement": + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript (line " + (lineNum+1) + ")")); + break;e + case "WhileStatement": + evaluateWhile(exp, workerScript).then(function(forLoopRes) { + resolve("forLoopDone"); + }).catch(function(e) { + if (e == "BREAKSTATEMENT" || + (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) { + return resolve("whileLoopBroken"); + } else { + reject(e); + } + }); + break; + case "ForStatement": + evaluate(exp.init, workerScript).then(function(expInit) { + return evaluateFor(exp, workerScript); + }).then(function(forLoopRes) { + resolve("forLoopDone"); + }).catch(function(e) { + if (e == "BREAKSTATEMENT" || + (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) { + return resolve("forLoopBroken"); + } else { + reject(e); + } + }); + break; + default: + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + " (line " + (lineNum+1) + "). This is currently unsupported in Netscript")); + break; + } //End switch + }, __WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime); //End setTimeout, the Netscript operation run time + + }); // End Promise +} + +function evalBinary(exp, workerScript){ + return new Promise(function(resolve, reject) { + var expLeftPromise = evaluate(exp.left, workerScript); + expLeftPromise.then(function(expLeft) { + if (expLeft == true && exp.operator === "||") { + return resolve(true); + } + if (expLeft == false && exp.operator === "&&") { + return resolve(false); + } + var expRightPromise = evaluate(exp.right, workerScript); + expRightPromise.then(function(expRight) { + switch (exp.operator){ + case "===": + case "==": + resolve(expLeft===expRight); + break; + case "!==": + case "!=": + resolve(expLeft!==expRight); + break; + case "<": + resolve(expLeft": + resolve(expLeft>expRight); + break; + case ">=": + resolve(expLeft>=expRight); + break; + case "+": + resolve(expLeft+expRight); + break; + case "-": + resolve(expLeft-expRight); + break; + case "*": + resolve(expLeft*expRight); + break; + case "/": + if (expRight === 0) { + reject(makeRuntimeRejectMsg(workerScript, "ERROR: Divide by zero")); + } else { + resolve(expLeft/expRight); + } + break; + case "%": + resolve(expLeft%expRight); + break; + case "in": + resolve(expLeft in expRight); + break; + case "instanceof": + resolve(expLeft instanceof expRight); + break; + case "||": + resolve(expLeft || expRight); + break; + case "&&": + resolve(expLeft && expRight); + break; + default: + reject(makeRuntimeRejectMsg(workerScript, "Unsupported operator: " + exp.operator)); + } + }, function(e) { + reject(e); + }); + }, function(e) { + reject(e); + }); + }); +} + +function evalUnary(exp, workerScript){ + var env = workerScript.env; + return new Promise(function(resolve, reject) { + if (env.stopFlag) {return reject(workerScript);} + var p = evaluate(exp.argument, workerScript); + p.then(function(res) { + if (exp.operator == "!") { + resolve(!res); + } else if (exp.operator == "-") { + if (isNaN(res)) { + resolve(res); + } else { + resolve(-1 * res); + } + } else { + reject(makeRuntimeRejectMsg(workerScript, "Unimplemented unary operator: " + exp.operator)); + } + }).catch(function(e) { + reject(e); + }); + }); +} + +//Takes in a MemberExpression that should represent a Netscript array (possible multidimensional) +//The return value is an array of the form: +// [0th index (leftmost), array name, 1st index, 2nd index, ...] +function getArrayElement(exp, workerScript) { + return new Promise(function(resolve, reject) { + var indices = []; + var iPromise = evaluate(exp.property, workerScript); + iPromise.then(function(idx) { + if (isNaN(idx)) { + return reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx)); + } else { + if (exp.object.name === undefined && exp.object.object) { + var recursePromise = getArrayElement(exp.object, workerScript); + recursePromise.then(function(res) { + res.push(idx); + indices = res; + return resolve(indices); + }).catch(function(e) { + return reject(e); + }); + } else { + indices.push(idx); + indices.push(exp.object.name); + return resolve(indices); + } + } + }).catch(function(e) { + console.log(e); + console.log("Error getting index in getArrayElement: " + e.toString()); + return reject(e); + }); + }); +} + +function evalAssignment(exp, workerScript) { + var env = workerScript.env; + return new Promise(function(resolve, reject) { + if (env.stopFlag) {return reject(workerScript);} + + if (exp.left.type != "Identifier" && exp.left.type != "MemberExpression") { + return reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to " + JSON.stringify(exp.left))); + } + + if (exp.operator !== "=" && !(exp.left.name in env.vars)){ + return reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.left.name + " not defined")); + } + + var expRightPromise = evaluate(exp.right, workerScript); + expRightPromise.then(function(expRight) { + if (exp.left.type == "MemberExpression") { + //Assign to array element + //Array object designed by exp.left.object.name + //Index designated by exp.left.property + var getArrayElementPromise = getArrayElement(exp.left, workerScript); + getArrayElementPromise.then(function(res) { + if (!(res instanceof Array) || res.length < 2) { + return reject(makeRuntimeRejectMsg(workerScript, "Error evaluating array assignment. This is (probably) a bug please report to game dev")); + } + + //The array name is the second value + var arrName = res.splice(1, 1); + arrName = arrName[0]; + + env.setArrayElement(arrName, res, expRight); + return resolve(false); + }).catch(function(e) { + return reject(e); + }); + /* + var name = exp.left.object.name; + if (!(name in env.vars)){ + reject(makeRuntimeRejectMsg(workerScript, "variable " + name + " not defined")); + } + var arr = env.get(name); + if (arr.constructor === Array || arr instanceof Array) { + var iPromise = evaluate(exp.left.property, workerScript); + iPromise.then(function(idx) { + if (isNaN(idx)) { + return reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx)); + } else if (idx >= arr.length || idx < 0) { + return reject(makeRuntimeRejectMsg(workerScript, "Out of bounds: Invalid index in [] operator")); + } else { + env.setArrayElement(name, idx, expRight); + } + }).catch(function(e) { + return reject(e); + }); + } else { + return reject(makeRuntimeRejectMsg(workerScript, "Trying to access a non-array variable using the [] operator")); + }*/ + } else { + //Other assignments + try { + switch (exp.operator) { + case "=": + env.set(exp.left.name,expRight); + break; + case "+=": + env.set(exp.left.name,env.get(exp.left.name) + expRight); + break; + case "-=": + env.set(exp.left.name,env.get(exp.left.name) - expRight); + break; + case "*=": + env.set(exp.left.name,env.get(exp.left.name) * expRight); + break; + case "/=": + env.set(exp.left.name,env.get(exp.left.name) / expRight); + break; + case "%=": + env.set(exp.left.name,env.get(exp.left.name) % expRight); + break; + default: + reject(makeRuntimeRejectMsg(workerScript, "Bitwise assignment is not implemented")); + } + resolve(false); + } catch (e) { + return reject(makeRuntimeRejectMsg(workerScript, "Failed to set environment variable: " + e.toString())); + } + } + //resolve(false); //Return false so this doesnt cause conditionals to evaluate + }, function(e) { + reject(e); + }); + }); +} + +function evaluateIf(exp, workerScript, i) { + var env = workerScript.env; + return new Promise(function(resolve, reject) { + evaluate(exp.test, workerScript).then(function(condRes) { + if (condRes) { + evaluate(exp.consequent, workerScript).then(function(res) { + resolve(true); + }, function(e) { + reject(e); + }); + } else if (exp.alternate) { + evaluate(exp.alternate, workerScript).then(function(res) { + resolve(true); + }, function(e) { + reject(e); + }); + } else { + resolve("endIf") + } + }, function(e) { + reject(e); + }); + }); +} + +//Evaluate the looping part of a for loop (Initialization block is NOT done in here) +function evaluateFor(exp, workerScript) { + var env = workerScript.env; + return new Promise(function(resolve, reject) { + if (env.stopFlag) {reject(workerScript); return;} + + var pCond = evaluate(exp.test, workerScript); + pCond.then(function(resCond) { + if (resCond) { + //Run the for loop code + var pBody = evaluate(exp.body, workerScript); + //After the code executes make a recursive call + pBody.then(function(resCode) { + var pUpdate = evaluate(exp.update, workerScript); + pUpdate.then(function(resPostloop) { + var recursiveCall = evaluateFor(exp, workerScript); + recursiveCall.then(function(foo) { + resolve("endForLoop"); + }, function(e) { + reject(e); + }); + }, function(e) { + reject(e); + }); + }, function(e) { + reject(e); + }); + } else { + resolve("endForLoop"); //Doesn't need to resolve to any particular value + } + }, function(e) { + reject(e); + }); + }); +} + +function evaluateWhile(exp, workerScript) { + var env = workerScript.env; + + return new Promise(function(resolve, reject) { + if (env.stopFlag) {reject(workerScript); return;} + + var pCond = new Promise(function(resolve, reject) { + setTimeout(function() { + var evaluatePromise = evaluate(exp.test, workerScript); + evaluatePromise.then(function(resCond) { + resolve(resCond); + }, function(e) { + reject(e); + }); + }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); + }); + + pCond.then(function(resCond) { + if (resCond) { + //Run the while loop code + var pCode = new Promise(function(resolve, reject) { + setTimeout(function() { + var evaluatePromise = evaluate(exp.body, workerScript); + evaluatePromise.then(function(resCode) { + resolve(resCode); + }, function(e) { + reject(e); + }); + }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); + }); + + //After the code executes make a recursive call + pCode.then(function(resCode) { + var recursiveCall = evaluateWhile(exp, workerScript); + recursiveCall.then(function(foo) { + resolve("endWhileLoop"); + }, function(e) { + reject(e); + }); + }, function(e) { + reject(e); + }); + } else { + resolve("endWhileLoop"); //Doesn't need to resolve to any particular value + } + }, function(e) { + reject(e); + }); + }); +} + +function evaluateProg(exp, workerScript, index) { + var env = workerScript.env; + + return new Promise(function(resolve, reject) { + if (env.stopFlag) {reject(workerScript); return;} + + if (index >= exp.body.length) { + resolve("progFinished"); + } else { + //Evaluate this line of code in the prog + var code = new Promise(function(resolve, reject) { + setTimeout(function() { + var evaluatePromise = evaluate(exp.body[index], workerScript); + evaluatePromise.then(function(evalRes) { + resolve(evalRes); + }, function(e) { + reject(e); + }); + }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); + }); + + //After the code finishes evaluating, evaluate the next line recursively + code.then(function(codeRes) { + var nextLine = evaluateProg(exp, workerScript, index + 1); + nextLine.then(function(nextLineRes) { + resolve(workerScript); + }, function(e) { + reject(e); + }); + }, function(e) { + reject(e); + }); + } + }); +} + +function netscriptDelay(time, workerScript) { + return new Promise(function(resolve) { + var delay = setTimeout(resolve, time); + workerScript.killTrigger = function() { + clearTimeout(delay); + resolve(); + }; + }); +} + +function makeRuntimeRejectMsg(workerScript, msg) { + return "|"+workerScript.serverIp+"|"+workerScript.name+"|" + msg; +} + +/* +function apply_op(op, a, b) { + function num(x) { + if (typeof x != "number") + throw new Error("Expected number but got " + x); + return x; + } + function div(x) { + if (num(x) == 0) + throw new Error("Divide by zero"); + return x; + } + switch (op) { + case "+": return a + b; + case "-": return num(a) - num(b); + case "*": return num(a) * num(b); + case "/": return num(a) / div(b); + case "%": return num(a) % div(b); + case "&&": return a !== false && b; + case "||": return a !== false ? a : b; + case "<": return num(a) < num(b); + case ">": return num(a) > num(b); + case "<=": return num(a) <= num(b); + case ">=": return num(a) >= num(b); + case "==": return a === b; + case "!=": return a !== b; + } + throw new Error("Can't apply operator " + op); +} +*/ + +//Run a script from inside a script using run() command +function runScriptFromScript(server, scriptname, args, workerScript, threads=1) { + //Check if the script is already running + var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_7__Script_js__["d" /* findRunningScript */])(scriptname, args, server); + if (runningScriptObj != null) { + workerScript.scriptRef.log(scriptname + " is already running on " + server.hostname); + return Promise.resolve(false); + } + + //Check if the script exists and if it does run it + for (var i = 0; i < server.scripts.length; ++i) { + if (server.scripts[i].filename == scriptname) { + //Check for admin rights and that there is enough RAM availble to run + var script = server.scripts[i]; + var ramUsage = script.ramUsage; + threads = Math.round(Number(threads)); //Convert to number and round + ramUsage = ramUsage * threads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1); + var ramAvailable = server.maxRam - server.ramUsed; + + if (server.hasAdminRights == false) { + workerScript.scriptRef.log("Cannot run script " + scriptname + " on " + server.hostname + " because you do not have root access!"); + return Promise.resolve(false); + } else if (ramUsage > ramAvailable){ + workerScript.scriptRef.log("Cannot run script " + scriptname + "(t=" + threads + ") on " + server.hostname + " because there is not enough available RAM!"); + return Promise.resolve(false); + } else { + //Able to run script + workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* printArray */])(args) + ". May take a few seconds to start up..."); + var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_7__Script_js__["b" /* RunningScript */](script, args); + runningScriptObj.threads = threads; + server.runningScripts.push(runningScriptObj); //Push onto runningScripts + Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server); + return Promise.resolve(true); + } + } + } + workerScript.scriptRef.log("Could not find script " + scriptname + " on " + server.hostname); + return Promise.resolve(false); +} + +//Takes in a +function getErrorLineNumber(exp, workerScript) { + var code = workerScript.scriptRef.scriptRef.code; + + //Split code up to the start of the node + code = code.substring(0, exp.start); + return (code.match(/\n/g) || []).length; +} + +function isScriptErrorMessage(msg) { + if (!Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["f" /* isString */])(msg)) {return false;} + let splitMsg = msg.split("|"); + if (splitMsg.length != 4){ + return false; + } + var ip = splitMsg[1]; + if (!Object(__WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__["c" /* isValidIPAddress */])(ip)) { + return false; + } + return true; +} + +//The same as Player's calculateHackingChance() function but takes in the server as an argument +function scriptCalculateHackingChance(server) { + var difficultyMult = (100 - server.hackDifficulty) / 100; + var skillMult = (1.75 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill) + (0.2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence); + var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; + var chance = skillChance * difficultyMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_chance_mult; + if (chance > 1) {return 1;} + if (chance < 0) {return 0;} + else {return chance;} +} + +//The same as Player's calculateHackingTime() function but takes in the server as an argument +function scriptCalculateHackingTime(server) { + var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; + var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence)); + var hackingTime = 5 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds + return hackingTime; +} + +//The same as Player's calculateExpGain() function but takes in the server as an argument +function scriptCalculateExpGain(server) { + if (server.baseDifficulty == null) { + server.baseDifficulty = server.hackDifficulty; + } + return (server.baseDifficulty * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult * 0.3 + 3) * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].HackExpGain; +} + +//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument +function scriptCalculatePercentMoneyHacked(server) { + var difficultyMult = (100 - server.hackDifficulty) / 100; + var skillMult = (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill - (server.requiredHackingSkill - 1)) / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill; + var percentMoneyHacked = difficultyMult * skillMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_money_mult / 240; + if (percentMoneyHacked < 0) {return 0;} + if (percentMoneyHacked > 1) {return 1;} + return percentMoneyHacked * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ScriptHackMoney; +} + +//Amount of time to execute grow() in milliseconds +function scriptCalculateGrowTime(server) { + var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; + var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence)); + var growTime = 16 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds + return growTime * 1000; +} + +//Amount of time to execute weaken() in milliseconds +function scriptCalculateWeakenTime(server) { + var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; + var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50 + (0.1 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence)); + var weakenTime = 20 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds + return weakenTime * 1000; +} + + + + +/***/ }), +/* 34 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -34168,10 +37234,10 @@ function prestigeSourceFile() { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(22); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InteractiveTutorial_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_JSONReviver_js__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__ = __webpack_require__(5); @@ -34266,7 +37332,7 @@ HacknetNode.prototype.getLevelUpgradeCost = function(levels=1) { HacknetNode.prototype.purchaseLevelUpgrade = function(levels=1) { var cost = this.calculateLevelUpgradeCost(levels); - if (isNaN(cost)) {return false;} + if (isNaN(cost) || levels < 0) {return false;} if (this.level + levels > __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HacknetNodeMaxLevel) { var diff = Math.max(0, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HacknetNodeMaxLevel - this.level); return this.purchaseLevelUpgrade(diff); @@ -34616,7 +37682,7 @@ function updateHacknetNodeDomElement(nodeObj) { upgradeRamButton.setAttribute("class", "a-link-button-inactive"); } else { var upgradeRamCost = nodeObj.calculateRamUpgradeCost(); - upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeRamCost, 2); + upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM - $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeRamCost, 2); if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].money.lt(upgradeRamCost)) { upgradeRamButton.setAttribute("class", "a-link-button-inactive"); } else { @@ -34673,7 +37739,2519 @@ function getHacknetNode(name) { /***/ }), -/* 33 */ +/* 35 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return gameOptionsBoxOpen; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return gameOptionsBoxClose; }); +/* GameOptions.js */ + +//Close box when clicking outside +$(document).click(function(event) { + if (gameOptionsOpened) { + if ( $(event.target).closest(".game-options-box").get(0) == null ) { + gameOptionsBoxClose(); + } + } +}); + +var gameOptionsOpened = false; +function gameOptionsBoxInit() { + //Menu link button + document.getElementById("options-menu-link").addEventListener("click", function() { + gameOptionsBoxOpen(); + return false; + }); + + //Close button + var closeButton = document.getElementById("game-options-close-button"); + closeButton.addEventListener("click", function() { + gameOptionsBoxClose(); + return false; + }); +}; + +document.addEventListener("DOMContentLoaded", gameOptionsBoxInit, false); + +function gameOptionsBoxClose() { + gameOptionsOpened = false; + var box = document.getElementById("game-options-container"); + box.style.display = "none"; +} + +function gameOptionsBoxOpen() { + var box = document.getElementById("game-options-container"); + box.style.display = "block"; + setTimeout(function() { + gameOptionsOpened = true; + }, 500); + +} + + + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve + * numeral.js + * version : 2.0.6 + * author : Adam Draper + * license : MIT + * http://adamwdraper.github.com/Numeral-js/ + */ +!function(a,b){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (b), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b}); + +/***/ }), +/* 37 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return commitShopliftCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return commitRobStoreCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return commitMugCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return commitLarcenyCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return commitDealDrugsCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return commitTraffickArmsCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return commitHomicideCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return commitGrandTheftAutoCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return commitKidnapCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return commitAssassinationCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return commitHeistCrime; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return determineCrimeSuccess; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return determineCrimeChanceShoplift; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return determineCrimeChanceRobStore; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return determineCrimeChanceMug; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return determineCrimeChanceLarceny; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return determineCrimeChanceDealDrugs; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return determineCrimeChanceTraffickArms; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return determineCrimeChanceHomicide; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return determineCrimeChanceGrandTheftAuto; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return determineCrimeChanceKidnap; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return determineCrimeChanceAssassination; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return determineCrimeChanceHeist; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(1); + + + + +/* Crimes.js */ +function commitShopliftCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 2, 2, 0, 15000, 2000); //$7500/s, 1 exp/s +} + +function commitRobStoreCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(30, 0, 0, 45, 45, 0, 400000, 60000); //$6666,6/2, 0.5exp/s, 0.75exp/s +} + +function commitMugCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 3, 3, 3, 3, 0, 36000, 4000); //$9000/s, .66 exp/s +} + +function commitLarcenyCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(45, 0, 0, 60, 60, 0, 800000, 90000) // $8888.88/s, .5 exp/s, .66 exp/s +} + +function commitDealDrugsCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 5, 5, 10, 120000, 10000); //$12000/s, .5 exp/s, 1 exp/s +} + +function commitTraffickArmsCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 20, 40, 600000, 40000); //$15000/s, .5 combat exp/s, 1 cha exp/s +} + +function commitHomicideCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 2, 2, 2, 2, 0, 45000, 3000); //$15000/s, 0.66 combat exp/s +} + +function commitGrandTheftAutoCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 80, 40, 1600000, 80000); //$20000/s, .25 exp/s, 1 exp/s, .5 exp/s +} + +function commitKidnapCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 80, 80, 80, 80, 80, 3600000, 120000); //$30000/s. .66 exp/s +} + +function commitAssassinationCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 300, 300, 300, 300, 0, 12000000, 300000); //$40000/s, 1 exp/s +} + +function commitHeistCrime() { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist; + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(450, 450, 450, 450, 450, 450, 120000000, 600000); //$200000/s, .75exp/s +} + +function determineCrimeSuccess(crime, moneyGained) { + var chance = 0; + switch (crime) { + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift: + chance = determineCrimeChanceShoplift(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore: + chance = determineCrimeChanceRobStore(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug: + chance = determineCrimeChanceMug(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny: + chance = determineCrimeChanceLarceny(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs: + chance = determineCrimeChanceDealDrugs(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms: + chance = determineCrimeChanceTraffickArms(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide: + chance = determineCrimeChanceHomicide(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto: + chance = determineCrimeChanceGrandTheftAuto(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap: + chance = determineCrimeChanceKidnap(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination: + chance = determineCrimeChanceAssassination(); + break; + case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist: + chance = determineCrimeChanceHeist(); + break; + default: + console.log(crime); + Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer"); + return; + } + + if (Math.random() <= chance) { + //Success + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].gainMoney(moneyGained); + return true; + } else { + //Failure + return false; + } +} + +let intWgt = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].IntelligenceCrimeWeight; +let maxLvl = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel; + +function determineCrimeChanceShoplift() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) * 20; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceRobStore() { + var chance = (0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / maxLvl + + 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + 1 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) * 5; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceMug() { + var chance = (1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / maxLvl + + 1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) * 5; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceLarceny() { + var chance = (0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) * 3; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceDealDrugs() { + var chance = (3*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / maxLvl + + 2*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl); + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceTraffickArms() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) / 2; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceHomicide() { + var chance = (2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / maxLvl + + 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl); + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceGrandTheftAuto() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + 4 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) / 8; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceKidnap() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) / 5; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceAssassination() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) / 8; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + +function determineCrimeChanceHeist() { + var chance = (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / maxLvl + + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / maxLvl + + intWgt * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].intelligence / maxLvl) / 18; + chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; + return Math.min(chance, 1); +} + + + + +/***/ }), +/* 38 */ +/***/ (function(module, exports) { + +module.exports = function() { + throw new Error("define cannot be used indirect"); +}; + + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + +module.exports.id = 'ace/mode/javascript_worker'; +module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\"change\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),applyDelta=acequire(\"./apply_delta\").applyDelta,EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Range=acequire(\"./range\").Range,Anchor=acequire(\"./anchor\").Anchor,Document=function(textOrLines){this.$lines=[\"\"],0===textOrLines.length?this.$lines=[\"\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\"aaa\".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\"changeNewLineMode\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\"\\r\\n\"==text||\"\\r\"==text||\"\\n\"==text},this.getLine=function(row){return this.$lines[row]||\"\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\"\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\"),this.insertMergedLines(position,[\"\",\"\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\"insert\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\"\"]),column=0):(lines=[\"\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\"insert\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\"remove\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\"remove\",lines:[\"\",\"\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\"insert\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\"change\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\"\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\"insert\"==delta.action?\"remove\":\"insert\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\"\").reverse().join(\"\")},exports.stringRepeat=function(string,count){for(var result=\"\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\"\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\"\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\"object\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\"object\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if(\"[object Object]\"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},exports.escapeHTML=function(str){return str.replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:\"insert\",start:data[i],lines:data[i+1]};else var d={action:\"remove\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\"ace/mode/javascript/jshint\",[\"require\",\"exports\",\"module\"],function(acequire,exports,module){module.exports=function outer(modules,cache,entry){function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=\"function\"==typeof acequire&&acequire;if(!jumped&¤tRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);var err=Error(\"Cannot find module '\"+name+\"'\");throw err.code=\"MODULE_NOT_FOUND\",err}var m=cache[name]={exports:{}};modules[name][0].call(m.exports,function(x){var id=modules[name][1][x];return newRequire(id?id:x)},m,m.exports,outer,modules,cache,entry)}return cache[name].exports}for(var previousRequire=\"function\"==typeof acequire&&acequire,i=0;entry.length>i;i++)newRequire(entry[i]);return newRequire(entry[0])}({\"/node_modules/browserify/node_modules/events/events.js\":[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\"function\"==typeof arg}function isNumber(arg){return\"number\"==typeof arg}function isObject(arg){return\"object\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\"n must be a positive number\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\"error\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified \"error\" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[type].length),\"function\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\"listener must be a function\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\"removeListener\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\"removeListener\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\"removeListener\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\"removeListener\"),this._events={},this\n}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],\"/node_modules/jshint/data/ascii-identifier-data.js\":[function(_dereq_,module){for(var identifierStartTable=[],i=0;128>i;i++)identifierStartTable[i]=36===i||i>=65&&90>=i||95===i||i>=97&&122>=i;for(var identifierPartTable=[],i=0;128>i;i++)identifierPartTable[i]=identifierStartTable[i]||i>=48&&57>=i;module.exports={asciiIdentifierStartTable:identifierStartTable,asciiIdentifierPartTable:identifierPartTable}},{}],\"/node_modules/jshint/lodash.js\":[function(_dereq_,module,exports){(function(global){(function(){function baseFindIndex(array,predicate,fromRight){for(var length=array.length,index=fromRight?length:-1;fromRight?index--:length>++index;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return indexOfNaN(array,fromIndex);for(var index=fromIndex-1,length=array.length;length>++index;)if(array[index]===value)return index;return-1}function baseIsFunction(value){return\"function\"==typeof value||!1}function baseToString(value){return\"string\"==typeof value?value:null==value?\"\":value+\"\"}function indexOfNaN(array,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?0:-1);fromRight?index--:length>++index;){var other=array[index];if(other!==other)return index}return-1}function isObjectLike(value){return!!value&&\"object\"==typeof value}function lodash(){}function arrayCopy(source,array){var index=-1,length=source.length;for(array||(array=Array(length));length>++index;)array[index]=source[index];return array}function arrayEach(array,iteratee){for(var index=-1,length=array.length;length>++index&&iteratee(array[index],index,array)!==!1;);return array}function arrayFilter(array,predicate){for(var index=-1,length=array.length,resIndex=-1,result=[];length>++index;){var value=array[index];predicate(value,index,array)&&(result[++resIndex]=value)}return result}function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);length>++index;)result[index]=iteratee(array[index],index,array);return result}function arrayMax(array){for(var index=-1,length=array.length,result=NEGATIVE_INFINITY;length>++index;){var value=array[index];value>result&&(result=value)}return result}function arraySome(array,predicate){for(var index=-1,length=array.length;length>++index;)if(predicate(array[index],index,array))return!0;return!1}function assignWith(object,source,customizer){var props=keys(source);push.apply(props,getSymbols(source));for(var index=-1,length=props.length;length>++index;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(value!==undefined||key in object)||(object[key]=result)}return object}function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;length>++index;){var key=props[index];object[key]=source[key]}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;return\"function\"==type?thisArg===undefined?func:bindCallback(func,thisArg,argCount):null==func?identity:\"object\"==type?baseMatches(func):thisArg===undefined?property(func):baseMatchesProperty(func,thisArg)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer&&(result=object?customizer(value,key,object):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return arrayCopy(value,result)}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag!=objectTag&&tag!=argsTag&&(!isFunc||object))return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{};if(result=initCloneObject(isFunc?{}:value),!isDeep)return baseAssign(result,value)}stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==value)return stackB[length];return stackA.push(value),stackB.push(result),(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)}),result}function baseFilter(collection,predicate){var result=[];return baseEach(collection,function(value,index,collection){predicate(value,index,collection)&&result.push(value)}),result}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseGet(object,path,pathKey){if(null!=object){pathKey!==undefined&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=-1,length=path.length;null!=object&&length>++index;)var result=object=object[path[index]];return result}}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other)return 0!==value||1/value==1/other;var valType=typeof value,othType=typeof other;return\"function\"!=valType&&\"object\"!=valType&&\"function\"!=othType&&\"object\"!=othType||null==value||null==other?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var valWrapped=objIsObj&&hasOwnProperty.call(object,\"__wrapped__\"),othWrapped=othIsObj&&hasOwnProperty.call(other,\"__wrapped__\");if(valWrapped||othWrapped)return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){for(var index=-1,length=props.length,noCustomizer=!customizer;length>++index;)if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object))return!1;for(index=-1;length>++index;){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index])var result=objValue!==undefined||key in object;else result=customizer?customizer(objValue,srcValue,key):undefined,result===undefined&&(result=baseIsEqual(srcValue,objValue,customizer,!0));if(!result)return!1}return!0}function baseMatches(source){var props=keys(source),length=props.length;if(!length)return constant(!0);if(1==length){var key=props[0],value=source[key];if(isStrictComparable(value))return function(object){return null==object?!1:object[key]===value&&(value!==undefined||key in toObject(object))}}for(var values=Array(length),strictCompareFlags=Array(length);length--;)value=source[props[length]],values[length]=value,strictCompareFlags[length]=isStrictComparable(value);return function(object){return null!=object&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(path,value){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(value),pathKey=path+\"\";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),!(!isArr&&isCommon||key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===value?value!==undefined||key in object:baseIsEqual(value,object[key],null,!0)}}function baseMerge(object,source,customizer,stackA,stackB){if(!isObject(object))return object;var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));if(!isSrcArr){var props=keys(source);push.apply(props,getSymbols(source))}return arrayEach(props||source,function(srcValue,key){if(props&&(key=srcValue,srcValue=source[key]),isObjectLike(srcValue))stackA||(stackA=[]),stackB||(stackB=[]),baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB);else{var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue),!isSrcArr&&result===undefined||!isCommon&&(result===result?result===value:value!==value)||(object[key]=result)}}),object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){for(var length=stackA.length,srcValue=source[key];length--;)if(stackA[length]==srcValue)return object[key]=stackB[length],undefined;var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue,isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))?result=isArray(value)?value:getLength(value)?arrayCopy(value):[]:isPlainObject(srcValue)||isArguments(srcValue)?result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}:isCommon=!1),stackA.push(srcValue),stackB.push(result),isCommon?object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB):(result===result?result!==value:value===value)&&(object[key]=result)}function baseProperty(key){return function(object){return null==object?undefined:object[key]}}function basePropertyDeep(path){var pathKey=path+\"\";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,0>start&&(start=-start>length?0:length+start),end=end===undefined||end>length?length:+end||0,0>end&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);length>++index;)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;return baseEach(collection,function(value,index,collection){return result=predicate(value,index,collection),!result}),!!result}function baseValues(object,props){for(var index=-1,length=props.length,result=Array(length);length>++index;)result[index]=object[props[index]];return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(\"number\"==typeof value&&value===value&&HALF_MAX_ARRAY_LENGTH>=high){for(;high>low;){var mid=low+high>>>1,computed=array[mid];(retHighest?value>=computed:value>computed)?low=mid+1:high=mid}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);for(var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=value===undefined;high>low;){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN)var setLow=isReflexive||retHighest;else setLow=valIsUndef?isReflexive&&(retHighest||computed!==undefined):retHighest?value>=computed:value>computed;setLow?low=mid+1:high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(\"function\"!=typeof func)return identity;if(thisArg===undefined)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}function createAssigner(assigner){return restParam(function(object,sources){var index=-1,length=null==object?0:sources.length,customizer=length>2&&sources[length-2],guard=length>2&&sources[2],thisArg=length>1&&sources[length-1];for(\"function\"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer=\"function\"==typeof thisArg?thisArg:null,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=3>length?null:customizer,length=1);length>++index;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:length>++index)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:length>++index;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=getCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return\"function\"==typeof iteratee&&thisArg===undefined&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=!0;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;result&&arrLength>++index;){var arrValue=array[index],othValue=other[index];if(result=undefined,customizer&&(result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)),result===undefined)if(isLoose)for(var othIndex=othLength;othIndex--&&(othValue=other[othIndex],!(result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))););else result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:0==object?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+\"\"}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var skipCtor=isLoose,index=-1;objLength>++index;){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined,customizer&&(result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)),result===undefined&&(result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB))}if(!result)return!1;skipCtor||(skipCtor=\"constructor\"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&\"constructor\"in object&&\"constructor\"in other&&!(\"function\"==typeof objCtor&&objCtor instanceof objCtor&&\"function\"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;return result=result===callback?baseCallback:result,argCount?result(func,thisArg,argCount):result}function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;return result=result===indexOf?baseIndexOf:result,collection?result(collection,target,fromIndex):result}function initCloneArray(array){var length=array.length,result=new array.constructor(length);return length&&\"string\"==typeof array[0]&&hasOwnProperty.call(array,\"index\")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){var Ctor=object.constructor;return\"function\"==typeof Ctor&&Ctor instanceof Ctor||(Ctor=Object),new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isIndex(value,length){return value=+value,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&0==value%1&&length>value}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if(\"number\"==type)var length=getLength(object),prereq=isLength(length)&&isIndex(index,length);else prereq=\"string\"==type&&index in object;if(prereq){var other=object[index];return value===value?value===other:other!==other}return!1}function isKey(value,object){var type=typeof value;if(\"string\"==type&&reIsPlainProp.test(value)||\"number\"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isLength(value){return\"number\"==typeof value&&value>-1&&0==value%1&&MAX_SAFE_INTEGER>=value}function isStrictComparable(value){return value===value&&(0===value?1/value>0:!isObject(value))}function shimIsPlainObject(value){var Ctor;if(lodash.support,!isObjectLike(value)||objToString.call(value)!=objectTag||!hasOwnProperty.call(value,\"constructor\")&&(Ctor=value.constructor,\"function\"==typeof Ctor&&!(Ctor instanceof Ctor)))return!1;var result;return baseForIn(value,function(subValue,key){result=key}),result===undefined||hasOwnProperty.call(value,result)}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support,allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object)),index=-1,result=[];propsLength>++index;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,\"$1\"):number||match)}),result}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length)return-1;if(\"number\"==typeof fromIndex)fromIndex=0>fromIndex?nativeMax(length+fromIndex,0):fromIndex;else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex||0)}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function slice(array,start,end){var length=array?array.length:0;return length?(end&&\"number\"!=typeof end&&isIterateeCall(array,start,end)&&(start=0,end=length),baseSlice(array,start,end)):[]}function unzip(array){for(var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);length>++index;)result[index]=arrayMap(array,baseProperty(index));return result}function includes(collection,target,fromIndex,guard){var length=collection?getLength(collection):0;return isLength(length)||(collection=values(collection),length=collection.length),length?(fromIndex=\"number\"!=typeof fromIndex||guard&&isIterateeCall(target,fromIndex,guard)?0:0>fromIndex?nativeMax(length+fromIndex,0):fromIndex||0,\"string\"==typeof collection||!isArray(collection)&&isString(collection)?length>fromIndex&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1):!1}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=getCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=null),(\"function\"!=typeof predicate||thisArg!==undefined)&&(predicate=getCallback(predicate,thisArg,3)),func(collection,predicate)}function restParam(func,start){if(\"function\"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(start===undefined?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);length>++index;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;start>++index;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}function clone(value,isDeep,customizer,thisArg){return isDeep&&\"boolean\"!=typeof isDeep&&isIterateeCall(value,isDeep,customizer)?isDeep=!1:\"function\"==typeof isDeep&&(thisArg=customizer,customizer=isDeep,isDeep=!1),customizer=\"function\"==typeof customizer&&bindCallback(customizer,thisArg,1),baseClone(value,isDeep,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}function isEmpty(value){if(null==value)return!0;var length=getLength(value);return isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))?!length:!keys(value).length}function isObject(value){var type=typeof value;return\"function\"==type||!!value&&\"object\"==type}function isNative(value){return null==value?!1:objToString.call(value)==funcTag?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value)}function isNumber(value){return\"number\"==typeof value||isObjectLike(value)&&objToString.call(value)==numberTag}function isString(value){return\"string\"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}function toPlainObject(value){return baseCopy(value,keysIn(value))}function has(object,path){if(null==object)return!1;var result=hasOwnProperty.call(object,path);return result||isKey(path)||(path=toPath(path),object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),path=last(path),result=null!=object&&hasOwnProperty.call(object,path)),result}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto=\"function\"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;length>++index;)result[index]=index+\"\";for(var key in object)skipIndexes&&isIndex(key,length)||\"constructor\"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}function values(object){return baseValues(object,keys(object))}function escapeRegExp(string){return string=baseToString(string),string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,\"\\\\$&\"):string}function callback(func,thisArg,guard){return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=null),baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var undefined,VERSION=\"3.7.0\",FUNC_ERROR_TEXT=\"Expected a function\",argsTag=\"[object Arguments]\",arrayTag=\"[object Array]\",boolTag=\"[object Boolean]\",dateTag=\"[object Date]\",errorTag=\"[object Error]\",funcTag=\"[object Function]\",mapTag=\"[object Map]\",numberTag=\"[object Number]\",objectTag=\"[object Object]\",regexpTag=\"[object RegExp]\",setTag=\"[object Set]\",stringTag=\"[object String]\",weakMapTag=\"[object WeakMap]\",arrayBufferTag=\"[object ArrayBuffer]\",float32Tag=\"[object Float32Array]\",float64Tag=\"[object Float64Array]\",int8Tag=\"[object Int8Array]\",int16Tag=\"[object Int16Array]\",int32Tag=\"[object Int32Array]\",uint8Tag=\"[object Uint8Array]\",uint8ClampedTag=\"[object Uint8ClampedArray]\",uint16Tag=\"[object Uint16Array]\",uint32Tag=\"[object Uint32Array]\",reIsDeepProp=/\\.|\\[(?:[^[\\]]+|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?)\\1\\]/,reIsPlainProp=/^\\w*$/,rePropName=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g,reRegExpChars=/[.*+?^${}()|[\\]\\/\\\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source),reEscapeChar=/\\\\(\\\\)?/g,reFlags=/\\w*$/,reIsHostCtor=/^\\[object .+?Constructor\\]$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=!1;var objectTypes={\"function\":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,freeGlobal=freeExports&&freeModule&&\"object\"==typeof global&&global&&global.Object&&global,freeSelf=objectTypes[typeof self]&&self&&self.Object&&self,freeWindow=objectTypes[typeof window]&&window&&window.Object&&window,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,root=freeGlobal||freeWindow!==(this&&this.window)&&freeWindow||freeSelf||this,arrayProto=Array.prototype,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp(\"^\"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\"),ArrayBuffer=isNative(ArrayBuffer=root.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,getOwnPropertySymbols=isNative(getOwnPropertySymbols=Object.getOwnPropertySymbols)&&getOwnPropertySymbols,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,preventExtensions=isNative(Object.preventExtensions=Object.preventExtensions)&&preventExtensions,propertyIsEnumerable=objectProto.propertyIsEnumerable,Uint8Array=isNative(Uint8Array=root.Uint8Array)&&Uint8Array,Float64Array=function(){try{var func=isNative(func=root.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}(),nativeAssign=function(){var object={1:0},func=preventExtensions&&isNative(func=Object.assign)&&func;try{func(preventExtensions(object),\"xo\")}catch(e){}return!object[1]&&func}(),nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0,MAX_SAFE_INTEGER=Math.pow(2,53)-1,support=lodash.support={};(function(x){var Ctor=function(){this.x=x},props=[];Ctor.prototype={valueOf:x,y:x};for(var key in new Ctor)props.push(key);support.funcDecomp=/\\bthis\\b/.test(function(){return this}),support.funcNames=\"string\"==typeof Function.name;try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=!0}})(1,0);var baseAssign=nativeAssign||function(object,source){return null==source?object:baseCopy(source,getSymbols(source),baseCopy(source,keys(source),object))},baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor();bufferSlice||(bufferClone=ArrayBuffer&&Uint8Array?function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}return byteLength!=offset&&(view=new Uint8Array(result,offset),view.set(new Uint8Array(buffer,offset))),result}:constant(null));var getLength=baseProperty(\"length\"),getSymbols=getOwnPropertySymbols?function(object){return getOwnPropertySymbols(toObject(object))}:constant([]),findLastIndex=createFindIndex(!0),zip=restParam(unzip),forEach=createForEach(arrayEach,baseEach),isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag},isFunction=baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array)?function(value){return objToString.call(value)==funcTag}:baseIsFunction,isPlainObject=getPrototypeOf?function(value){if(!value||objToString.call(value)!=objectTag)return!1;var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)}:shimIsPlainObject,assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)}),keys=nativeKeys?function(object){if(object)var Ctor=object.constructor,length=object.length;return\"function\"==typeof Ctor&&Ctor.prototype===object||\"function\"!=typeof object&&isLength(length)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys,merge=createAssigner(baseMerge);lodash.assign=assign,lodash.callback=callback,lodash.constant=constant,lodash.forEach=forEach,lodash.keys=keys,lodash.keysIn=keysIn,lodash.merge=merge,lodash.property=property,lodash.reject=reject,lodash.restParam=restParam,lodash.slice=slice,lodash.toPlainObject=toPlainObject,lodash.unzip=unzip,lodash.values=values,lodash.zip=zip,lodash.each=forEach,lodash.extend=assign,lodash.iteratee=callback,lodash.clone=clone,lodash.escapeRegExp=escapeRegExp,lodash.findLastIndex=findLastIndex,lodash.has=has,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isEmpty=isEmpty,lodash.isFunction=isFunction,lodash.isNative=isNative,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isPlainObject=isPlainObject,lodash.isString=isString,lodash.isTypedArray=isTypedArray,lodash.last=last,lodash.some=some,lodash.any=some,lodash.contains=includes,lodash.include=includes,lodash.VERSION=VERSION,freeExports&&freeModule?moduleExports?(freeModule.exports=lodash)._=lodash:freeExports._=lodash:root._=lodash\n}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],\"/node_modules/jshint/src/jshint.js\":[function(_dereq_,module,exports){var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),vars=_dereq_(\"./vars.js\"),messages=_dereq_(\"./messages.js\"),Lexer=_dereq_(\"./lex.js\").Lexer,reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,style=_dereq_(\"./style.js\"),options=_dereq_(\"./options.js\"),scopeManager=_dereq_(\"./scope-manager.js\"),JSHINT=function(){\"use strict\";function checkOption(name,t){return name=name.trim(),/^[+-]W\\d{3}$/g.test(name)?!0:-1!==options.validNames.indexOf(name)||\"jslint\"===t.type||_.has(options.removed,name)?!0:(error(\"E001\",t,name),!1)}function isString(obj){return\"[object String]\"===Object.prototype.toString.call(obj)}function isIdentifier(tkn,value){return tkn?tkn.identifier&&tkn.value===value?!0:!1:!1}function isReserved(token){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(token.isProperty)return!1}return!0}function supplant(str,data){return str.replace(/\\{([^{}]*)\\}/g,function(a,b){var r=data[b];return\"string\"==typeof r||\"number\"==typeof r?r:a})}function combine(dest,src){Object.keys(src).forEach(function(name){_.has(JSHINT.blacklist,name)||(dest[name]=src[name])})}function processenforceall(){if(state.option.enforceall){for(var enforceopt in options.bool.enforcing)void 0!==state.option[enforceopt]||options.noenforceall[enforceopt]||(state.option[enforceopt]=!0);for(var relaxopt in options.bool.relaxing)void 0===state.option[relaxopt]&&(state.option[relaxopt]=!1)}}function assume(){processenforceall(),state.option.esversion||state.option.moz||(state.option.esversion=state.option.es3?3:state.option.esnext?6:5),state.inES5()&&combine(predefined,vars.ecmaIdentifiers[5]),state.inES6()&&combine(predefined,vars.ecmaIdentifiers[6]),state.option.module&&(state.option.strict===!0&&(state.option.strict=\"global\"),state.inES6()||warning(\"W134\",state.tokens.next,\"module\",6)),state.option.couch&&combine(predefined,vars.couch),state.option.qunit&&combine(predefined,vars.qunit),state.option.rhino&&combine(predefined,vars.rhino),state.option.shelljs&&(combine(predefined,vars.shelljs),combine(predefined,vars.node)),state.option.typed&&combine(predefined,vars.typed),state.option.phantom&&(combine(predefined,vars.phantom),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.prototypejs&&combine(predefined,vars.prototypejs),state.option.node&&(combine(predefined,vars.node),combine(predefined,vars.typed),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.devel&&combine(predefined,vars.devel),state.option.dojo&&combine(predefined,vars.dojo),state.option.browser&&(combine(predefined,vars.browser),combine(predefined,vars.typed)),state.option.browserify&&(combine(predefined,vars.browser),combine(predefined,vars.typed),combine(predefined,vars.browserify),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.nonstandard&&combine(predefined,vars.nonstandard),state.option.jasmine&&combine(predefined,vars.jasmine),state.option.jquery&&combine(predefined,vars.jquery),state.option.mootools&&combine(predefined,vars.mootools),state.option.worker&&combine(predefined,vars.worker),state.option.wsh&&combine(predefined,vars.wsh),state.option.globalstrict&&state.option.strict!==!1&&(state.option.strict=\"global\"),state.option.yui&&combine(predefined,vars.yui),state.option.mocha&&combine(predefined,vars.mocha)}function quit(code,line,chr){var percentage=Math.floor(100*(line/state.lines.length)),message=messages.errors[code].desc;throw{name:\"JSHintError\",line:line,character:chr,message:message+\" (\"+percentage+\"% scanned).\",raw:message,code:code}}function removeIgnoredMessages(){var ignored=state.ignoredLines;_.isEmpty(ignored)||(JSHINT.errors=_.reject(JSHINT.errors,function(err){return ignored[err.line]}))}function warning(code,t,a,b,c,d){var ch,l,w,msg;if(/^W\\d{3}$/.test(code)){if(state.ignored[code])return;msg=messages.warnings[code]}else/E\\d{3}/.test(code)?msg=messages.errors[code]:/I\\d{3}/.test(code)&&(msg=messages.info[code]);return t=t||state.tokens.next||{},\"(end)\"===t.id&&(t=state.tokens.curr),l=t.line||0,ch=t.from||0,w={id:\"(error)\",raw:msg.desc,code:msg.code,evidence:state.lines[l-1]||\"\",line:l,character:ch,scope:JSHINT.scope,a:a,b:b,c:c,d:d},w.reason=supplant(msg.desc,w),JSHINT.errors.push(w),removeIgnoredMessages(),JSHINT.errors.length>=state.option.maxerr&&quit(\"E043\",l,ch),w}function warningAt(m,l,ch,a,b,c,d){return warning(m,{line:l,from:ch},a,b,c,d)}function error(m,t,a,b,c,d){warning(m,t,a,b,c,d)}function errorAt(m,l,ch,a,b,c,d){return error(m,{line:l,from:ch},a,b,c,d)}function addInternalSrc(elem,src){var i;return i={id:\"(internal)\",elem:elem,value:src},JSHINT.internals.push(i),i}function doOption(){var nt=state.tokens.next,body=nt.body.match(/(-\\s+)?[^\\s,:]+(?:\\s*:\\s*(-\\s+)?[^\\s,]+)?/g)||[],predef={};if(\"globals\"===nt.type){body.forEach(function(g,idx){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(\"-\"===key||!key.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}\"-\"===key.charAt(0)?(key=key.slice(1),val=!1,JSHINT.blacklist[key]=key,delete predefined[key]):predef[key]=\"true\"===val}),combine(predefined,predef);for(var key in predef)_.has(predef,key)&&(declared[key]=nt)}\"exported\"===nt.type&&body.forEach(function(e,idx){if(!e.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}state.funct[\"(scope)\"].addExported(e)}),\"members\"===nt.type&&(membersOnly=membersOnly||{},body.forEach(function(m){var ch1=m.charAt(0),ch2=m.charAt(m.length-1);ch1!==ch2||'\"'!==ch1&&\"'\"!==ch1||(m=m.substr(1,m.length-2).replace('\\\\\"','\"')),membersOnly[m]=!1}));var numvals=[\"maxstatements\",\"maxparams\",\"maxdepth\",\"maxcomplexity\",\"maxerr\",\"maxlen\",\"indent\"];(\"jshint\"===nt.type||\"jslint\"===nt.type)&&(body.forEach(function(g){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(checkOption(key,nt))if(numvals.indexOf(key)>=0)if(\"false\"!==val){if(val=+val,\"number\"!=typeof val||!isFinite(val)||0>=val||Math.floor(val)!==val)return error(\"E032\",nt,g[1].trim()),void 0;state.option[key]=val}else state.option[key]=\"indent\"===key?4:!1;else{if(\"validthis\"===key)return state.funct[\"(global)\"]?void error(\"E009\"):\"true\"!==val&&\"false\"!==val?void error(\"E002\",nt):(state.option.validthis=\"true\"===val,void 0);if(\"quotmark\"!==key)if(\"shadow\"!==key)if(\"unused\"!==key)if(\"latedef\"!==key)if(\"ignore\"!==key)if(\"strict\"!==key){\"module\"===key&&(hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"module\"));var esversions={es3:3,es5:5,esnext:6};if(!_.has(esversions,key)){if(\"esversion\"===key){switch(val){case\"5\":state.inES5(!0)&&warning(\"I003\");case\"3\":case\"6\":state.option.moz=!1,state.option.esversion=+val;break;case\"2015\":state.option.moz=!1,state.option.esversion=6;break;default:error(\"E002\",nt)}return hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"esversion\"),void 0}var match=/^([+-])(W\\d{3})$/g.exec(key);if(match)return state.ignored[match[2]]=\"-\"===match[1],void 0;var tn;return\"true\"===val||\"false\"===val?(\"jslint\"===nt.type?(tn=options.renamed[key]||key,state.option[tn]=\"true\"===val,void 0!==options.inverted[tn]&&(state.option[tn]=!state.option[tn])):state.option[key]=\"true\"===val,\"newcap\"===key&&(state.option[\"(explicitNewcap)\"]=!0),void 0):(error(\"E002\",nt),void 0)}switch(val){case\"true\":state.option.moz=!1,state.option.esversion=esversions[key];break;case\"false\":state.option.moz||(state.option.esversion=5);break;default:error(\"E002\",nt)}}else switch(val){case\"true\":state.option.strict=!0;break;case\"false\":state.option.strict=!1;break;case\"func\":case\"global\":case\"implied\":state.option.strict=val;break;default:error(\"E002\",nt)}else switch(val){case\"line\":state.ignoredLines[nt.line]=!0,removeIgnoredMessages();break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.latedef=!0;break;case\"false\":state.option.latedef=!1;break;case\"nofunc\":state.option.latedef=\"nofunc\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.unused=!0;break;case\"false\":state.option.unused=!1;break;case\"vars\":case\"strict\":state.option.unused=val;break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.shadow=!0;break;case\"outer\":state.option.shadow=\"outer\";break;case\"false\":case\"inner\":state.option.shadow=\"inner\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":case\"false\":state.option.quotmark=\"true\"===val;break;case\"double\":case\"single\":state.option.quotmark=val;break;default:error(\"E002\",nt)}}}),assume())}function peek(p){var t,i=p||0,j=lookahead.length;if(j>i)return lookahead[i];for(;i>=j;)t=lookahead[j],t||(t=lookahead[j]=lex.token()),j+=1;return t||\"(end)\"!==state.tokens.next.id?t:state.tokens.next}function peekIgnoreEOL(){var t,i=0;do t=peek(i++);while(\"(endline)\"===t.id);return t}function advance(id,t){switch(state.tokens.curr.id){case\"(number)\":\".\"===state.tokens.next.id&&warning(\"W005\",state.tokens.curr);break;case\"-\":(\"-\"===state.tokens.next.id||\"--\"===state.tokens.next.id)&&warning(\"W006\");break;case\"+\":(\"+\"===state.tokens.next.id||\"++\"===state.tokens.next.id)&&warning(\"W007\")}for(id&&state.tokens.next.id!==id&&(t?\"(end)\"===state.tokens.next.id?error(\"E019\",t,t.id):error(\"E020\",state.tokens.next,id,t.id,t.line,state.tokens.next.value):(\"(identifier)\"!==state.tokens.next.type||state.tokens.next.value!==id)&&warning(\"W116\",state.tokens.next,id,state.tokens.next.value)),state.tokens.prev=state.tokens.curr,state.tokens.curr=state.tokens.next;;){if(state.tokens.next=lookahead.shift()||lex.token(),state.tokens.next||quit(\"E041\",state.tokens.curr.line),\"(end)\"===state.tokens.next.id||\"(error)\"===state.tokens.next.id)return;if(state.tokens.next.check&&state.tokens.next.check(),state.tokens.next.isSpecial)\"falls through\"===state.tokens.next.type?state.tokens.curr.caseFallsThrough=!0:doOption();else if(\"(endline)\"!==state.tokens.next.id)break}}function isInfix(token){return token.infix||!token.identifier&&!token.template&&!!token.led}function isEndOfExpr(){var curr=state.tokens.curr,next=state.tokens.next;return\";\"===next.id||\"}\"===next.id||\":\"===next.id?!0:isInfix(next)===isInfix(curr)||\"yield\"===curr.id&&state.inMoz()?curr.line!==startLine(next):!1}function isBeginOfExpr(prev){return!prev.left&&\"unary\"!==prev.arity}function expression(rbp,initial){var left,isArray=!1,isObject=!1,isLetExpr=!1;state.nameStack.push(),initial||\"let\"!==state.tokens.next.value||\"(\"!==peek(0).value||(state.inMoz()||warning(\"W118\",state.tokens.next,\"let expressions\"),isLetExpr=!0,state.funct[\"(scope)\"].stack(),advance(\"let\"),advance(\"(\"),state.tokens.prev.fud(),advance(\")\")),\"(end)\"===state.tokens.next.id&&error(\"E006\",state.tokens.curr);var isDangerous=state.option.asi&&state.tokens.prev.line!==startLine(state.tokens.curr)&&_.contains([\"]\",\")\"],state.tokens.prev.id)&&_.contains([\"[\",\"(\"],state.tokens.curr.id);if(isDangerous&&warning(\"W014\",state.tokens.curr,state.tokens.curr.id),advance(),initial&&(state.funct[\"(verb)\"]=state.tokens.curr.value,state.tokens.curr.beginsStmt=!0),initial===!0&&state.tokens.curr.fud)left=state.tokens.curr.fud();else for(state.tokens.curr.nud?left=state.tokens.curr.nud():error(\"E030\",state.tokens.curr,state.tokens.curr.id);(state.tokens.next.lbp>rbp||\"(template)\"===state.tokens.next.type)&&!isEndOfExpr();)isArray=\"Array\"===state.tokens.curr.value,isObject=\"Object\"===state.tokens.curr.value,left&&(left.value||left.first&&left.first.value)&&(\"new\"!==left.value||left.first&&left.first.value&&\".\"===left.first.value)&&(isArray=!1,left.value!==state.tokens.curr.value&&(isObject=!1)),advance(),isArray&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W009\",state.tokens.curr),isObject&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W010\",state.tokens.curr),left&&state.tokens.curr.led?left=state.tokens.curr.led(left):error(\"E033\",state.tokens.curr,state.tokens.curr.id);return isLetExpr&&state.funct[\"(scope)\"].unstack(),state.nameStack.pop(),left}function startLine(token){return token.startLine||token.line}function nobreaknonadjacent(left,right){left=left||state.tokens.curr,right=right||state.tokens.next,state.option.laxbreak||left.line===startLine(right)||warning(\"W014\",right,right.value)}function nolinebreak(t){t=t||state.tokens.curr,t.line!==startLine(state.tokens.next)&&warning(\"E022\",t,t.value)}function nobreakcomma(left,right){left.line!==startLine(right)&&(state.option.laxcomma||(comma.first&&(warning(\"I001\"),comma.first=!1),warning(\"W014\",left,right.value)))}function comma(opts){if(opts=opts||{},opts.peek?nobreakcomma(state.tokens.prev,state.tokens.curr):(nobreakcomma(state.tokens.curr,state.tokens.next),advance(\",\")),state.tokens.next.identifier&&(!opts.property||!state.inES5()))switch(state.tokens.next.value){case\"break\":case\"case\":case\"catch\":case\"continue\":case\"default\":case\"do\":case\"else\":case\"finally\":case\"for\":case\"if\":case\"in\":case\"instanceof\":case\"return\":case\"switch\":case\"throw\":case\"try\":case\"var\":case\"let\":case\"while\":case\"with\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}if(\"(punctuator)\"===state.tokens.next.type)switch(state.tokens.next.value){case\"}\":case\"]\":case\",\":if(opts.allowTrailing)return!0;case\")\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}return!0}function symbol(s,p){var x=state.syntax[s];return x&&\"object\"==typeof x||(state.syntax[s]=x={id:s,lbp:p,value:s}),x}function delim(s){var x=symbol(s,0);return x.delim=!0,x}function stmt(s,f){var x=delim(s);return x.identifier=x.reserved=!0,x.fud=f,x}function blockstmt(s,f){var x=stmt(s,f);return x.block=!0,x}function reserveName(x){var c=x.id.charAt(0);return(c>=\"a\"&&\"z\">=c||c>=\"A\"&&\"Z\">=c)&&(x.identifier=x.reserved=!0),x}function prefix(s,f){var x=symbol(s,150);return reserveName(x),x.nud=\"function\"==typeof f?f:function(){return this.arity=\"unary\",this.right=expression(150),(\"++\"===this.id||\"--\"===this.id)&&(state.option.plusplus?warning(\"W016\",this,this.id):!this.right||this.right.identifier&&!isReserved(this.right)||\".\"===this.right.id||\"[\"===this.right.id||warning(\"W017\",this),this.right&&this.right.isMetaProperty?error(\"E031\",this):this.right&&this.right.identifier&&state.funct[\"(scope)\"].block.modify(this.right.value,this)),this},x}function type(s,f){var x=delim(s);return x.type=s,x.nud=f,x}function reserve(name,func){var x=type(name,func);return x.identifier=!0,x.reserved=!0,x}function FutureReservedWord(name,meta){var x=type(name,meta&&meta.nud||function(){return this});return meta=meta||{},meta.isFutureReservedWord=!0,x.value=name,x.identifier=!0,x.reserved=!0,x.meta=meta,x}function reservevar(s,v){return reserve(s,function(){return\"function\"==typeof v&&v(this),this})}function infix(s,f,p,w){var x=symbol(s,p);return reserveName(x),x.infix=!0,x.led=function(left){return w||nobreaknonadjacent(state.tokens.prev,state.tokens.curr),\"in\"!==s&&\"instanceof\"!==s||\"!\"!==left.id||warning(\"W018\",left,\"!\"),\"function\"==typeof f?f(left,this):(this.left=left,this.right=expression(p),this)},x}function application(s){var x=symbol(s,42);return x.led=function(left){return nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left,this.right=doFunction({type:\"arrow\",loneArg:left}),this},x}function relation(s,f){var x=symbol(s,100);return x.led=function(left){nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left;var right=this.right=expression(100);return isIdentifier(left,\"NaN\")||isIdentifier(right,\"NaN\")?warning(\"W019\",this):f&&f.apply(this,[left,right]),left&&right||quit(\"E041\",state.tokens.curr.line),\"!\"===left.id&&warning(\"W018\",left,\"!\"),\"!\"===right.id&&warning(\"W018\",right,\"!\"),this},x}function isPoorRelation(node){return node&&(\"(number)\"===node.type&&0===+node.value||\"(string)\"===node.type&&\"\"===node.value||\"null\"===node.type&&!state.option.eqnull||\"true\"===node.type||\"false\"===node.type||\"undefined\"===node.type)}function isTypoTypeof(left,right,state){var values;return state.option.notypeof?!1:left&&right?(values=state.inES6()?typeofValues.es6:typeofValues.es3,\"(identifier)\"===right.type&&\"typeof\"===right.value&&\"(string)\"===left.type?!_.contains(values,left.value):!1):!1}function isGlobalEval(left,state){var isGlobal=!1;return\"this\"===left.type&&null===state.funct[\"(context)\"]?isGlobal=!0:\"(identifier)\"===left.type&&(state.option.node&&\"global\"===left.value?isGlobal=!0:!state.option.browser||\"window\"!==left.value&&\"document\"!==left.value||(isGlobal=!0)),isGlobal}function findNativePrototype(left){function walkPrototype(obj){return\"object\"==typeof obj?\"prototype\"===obj.right?obj:walkPrototype(obj.left):void 0}function walkNative(obj){for(;!obj.identifier&&\"object\"==typeof obj.left;)obj=obj.left;return obj.identifier&&natives.indexOf(obj.value)>=0?obj.value:void 0}var natives=[\"Array\",\"ArrayBuffer\",\"Boolean\",\"Collator\",\"DataView\",\"Date\",\"DateTimeFormat\",\"Error\",\"EvalError\",\"Float32Array\",\"Float64Array\",\"Function\",\"Infinity\",\"Intl\",\"Int16Array\",\"Int32Array\",\"Int8Array\",\"Iterator\",\"Number\",\"NumberFormat\",\"Object\",\"RangeError\",\"ReferenceError\",\"RegExp\",\"StopIteration\",\"String\",\"SyntaxError\",\"TypeError\",\"Uint16Array\",\"Uint32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"URIError\"],prototype=walkPrototype(left);return prototype?walkNative(prototype):void 0}function checkLeftSideAssign(left,assignToken,options){var allowDestructuring=options&&options.allowDestructuring;if(assignToken=assignToken||left,state.option.freeze){var nativeObject=findNativePrototype(left);nativeObject&&warning(\"W121\",left,nativeObject)}return left.identifier&&!left.isMetaProperty&&state.funct[\"(scope)\"].block.reassign(left.value,left),\".\"===left.id?((!left.left||\"arguments\"===left.left.value&&!state.isStrict())&&warning(\"E031\",assignToken),state.nameStack.set(state.tokens.prev),!0):\"{\"===left.id||\"[\"===left.id?(allowDestructuring&&state.tokens.curr.left.destructAssign?state.tokens.curr.left.destructAssign.forEach(function(t){t.id&&state.funct[\"(scope)\"].block.modify(t.id,t.token)}):\"{\"!==left.id&&left.left?\"arguments\"!==left.left.value||state.isStrict()||warning(\"E031\",assignToken):warning(\"E031\",assignToken),\"[\"===left.id&&state.nameStack.set(left.right),!0):left.isMetaProperty?(error(\"E031\",assignToken),!0):left.identifier&&!isReserved(left)?(\"exception\"===state.funct[\"(scope)\"].labeltype(left.value)&&warning(\"W022\",left),state.nameStack.set(left),!0):(left===state.syntax[\"function\"]&&warning(\"W023\",state.tokens.curr),!1)}function assignop(s,f,p){var x=infix(s,\"function\"==typeof f?f:function(left,that){return that.left=left,left&&checkLeftSideAssign(left,that,{allowDestructuring:!0})?(that.right=expression(10),that):(error(\"E031\",that),void 0)},p);return x.exps=!0,x.assign=!0,x}function bitwise(s,f,p){var x=symbol(s,p);return reserveName(x),x.led=\"function\"==typeof f?f:function(left){return state.option.bitwise&&warning(\"W016\",this,this.id),this.left=left,this.right=expression(p),this},x}function bitwiseassignop(s){return assignop(s,function(left,that){return state.option.bitwise&&warning(\"W016\",that,that.id),left&&checkLeftSideAssign(left,that)?(that.right=expression(10),that):(error(\"E031\",that),void 0)},20)}function suffix(s){var x=symbol(s,150);return x.led=function(left){return state.option.plusplus?warning(\"W016\",this,this.id):left.identifier&&!isReserved(left)||\".\"===left.id||\"[\"===left.id||warning(\"W017\",this),left.isMetaProperty?error(\"E031\",this):left&&left.identifier&&state.funct[\"(scope)\"].block.modify(left.value,left),this.left=left,this},x}function optionalidentifier(fnparam,prop,preserve){if(state.tokens.next.identifier){preserve||advance();var curr=state.tokens.curr,val=state.tokens.curr.value;return isReserved(curr)?prop&&state.inES5()?val:fnparam&&\"undefined\"===val?val:(warning(\"W024\",state.tokens.curr,state.tokens.curr.id),val):val}}function identifier(fnparam,prop){var i=optionalidentifier(fnparam,prop,!1);if(i)return i;if(\"...\"===state.tokens.next.value){if(state.inES6(!0)||warning(\"W119\",state.tokens.next,\"spread/rest operator\",\"6\"),advance(),checkPunctuator(state.tokens.next,\"...\"))for(warning(\"E024\",state.tokens.next,\"...\");checkPunctuator(state.tokens.next,\"...\");)advance();return state.tokens.next.identifier?identifier(fnparam,prop):(warning(\"E024\",state.tokens.curr,\"...\"),void 0)}error(\"E030\",state.tokens.next,state.tokens.next.value),\";\"!==state.tokens.next.id&&advance()}function reachable(controlToken){var t,i=0;if(\";\"===state.tokens.next.id&&!controlToken.inBracelessBlock)for(;;){do t=peek(i),i+=1;while(\"(end)\"!==t.id&&\"(comment)\"===t.id);if(t.reach)return;if(\"(endline)\"!==t.id){if(\"function\"===t.id){state.option.latedef===!0&&warning(\"W026\",t);break}warning(\"W027\",t,t.value,controlToken.value);break}}}function parseFinalSemicolon(){if(\";\"!==state.tokens.next.id){if(state.tokens.next.isUnclosed)return advance();var sameLine=startLine(state.tokens.next)===state.tokens.curr.line&&\"(end)\"!==state.tokens.next.id,blockEnd=checkPunctuator(state.tokens.next,\"}\");sameLine&&!blockEnd?errorAt(\"E058\",state.tokens.curr.line,state.tokens.curr.character):state.option.asi||(blockEnd&&!state.option.lastsemic||!sameLine)&&warningAt(\"W033\",state.tokens.curr.line,state.tokens.curr.character)}else advance(\";\")}function statement(){var r,i=indent,t=state.tokens.next,hasOwnScope=!1;if(\";\"===t.id)return advance(\";\"),void 0;var res=isReserved(t);if(res&&t.meta&&t.meta.isFutureReservedWord&&\":\"===peek().id&&(warning(\"W024\",t,t.id),res=!1),t.identifier&&!res&&\":\"===peek().id&&(advance(),advance(\":\"),hasOwnScope=!0,state.funct[\"(scope)\"].stack(),state.funct[\"(scope)\"].block.addBreakLabel(t.value,{token:state.tokens.curr}),state.tokens.next.labelled||\"{\"===state.tokens.next.value||warning(\"W028\",state.tokens.next,t.value,state.tokens.next.value),state.tokens.next.label=t.value,t=state.tokens.next),\"{\"===t.id){var iscase=\"case\"===state.funct[\"(verb)\"]&&\":\"===state.tokens.curr.value;return block(!0,!0,!1,!1,iscase),void 0}return r=expression(0,!0),!r||r.identifier&&\"function\"===r.value||\"(punctuator)\"===r.type&&r.left&&r.left.identifier&&\"function\"===r.left.value||state.isStrict()||\"global\"!==state.option.strict||warning(\"E007\"),t.block||(state.option.expr||r&&r.exps?state.option.nonew&&r&&r.left&&\"(\"===r.id&&\"new\"===r.left.id&&warning(\"W031\",t):warning(\"W030\",state.tokens.curr),parseFinalSemicolon()),indent=i,hasOwnScope&&state.funct[\"(scope)\"].unstack(),r}function statements(){for(var p,a=[];!state.tokens.next.reach&&\"(end)\"!==state.tokens.next.id;)\";\"===state.tokens.next.id?(p=peek(),(!p||\"(\"!==p.id&&\"[\"!==p.id)&&warning(\"W032\"),advance(\";\")):a.push(statement());return a}function directives(){for(var i,p,pn;\"(string)\"===state.tokens.next.id;){if(p=peek(0),\"(endline)\"===p.id){i=1;do pn=peek(i++);while(\"(endline)\"===pn.id);if(\";\"===pn.id)p=pn;else{if(\"[\"===pn.value||\".\"===pn.value)break;state.option.asi&&\"(\"!==pn.value||warning(\"W033\",state.tokens.next)}}else{if(\".\"===p.id||\"[\"===p.id)break;\";\"!==p.id&&warning(\"W033\",p)}advance();var directive=state.tokens.curr.value;(state.directive[directive]||\"use strict\"===directive&&\"implied\"===state.option.strict)&&warning(\"W034\",state.tokens.curr,directive),state.directive[directive]=!0,\";\"===p.id&&advance(\";\")}state.isStrict()&&(state.option[\"(explicitNewcap)\"]||(state.option.newcap=!0),state.option.undef=!0)}function block(ordinary,stmt,isfunc,isfatarrow,iscase){var a,m,t,line,d,b=inblock,old_indent=indent;inblock=ordinary,t=state.tokens.next;var metrics=state.funct[\"(metrics)\"];if(metrics.nestedBlockDepth+=1,metrics.verifyMaxNestedBlockDepthPerFunction(),\"{\"===state.tokens.next.id){if(advance(\"{\"),state.funct[\"(scope)\"].stack(),line=state.tokens.curr.line,\"}\"!==state.tokens.next.id){for(indent+=state.option.indent;!ordinary&&state.tokens.next.from>indent;)indent+=state.option.indent;if(isfunc){m={};for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);directives(),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\"))}a=statements(),metrics.statementCount+=a.length,indent-=state.option.indent}advance(\"}\",t),isfunc&&(state.funct[\"(scope)\"].validateParams(),m&&(state.directive=m)),state.funct[\"(scope)\"].unstack(),indent=old_indent}else if(ordinary)state.funct[\"(noblockscopedvar)\"]=\"for\"!==state.tokens.next.id,state.funct[\"(scope)\"].stack(),(!stmt||state.option.curly)&&warning(\"W116\",state.tokens.next,\"{\",state.tokens.next.value),state.tokens.next.inBracelessBlock=!0,indent+=state.option.indent,a=[statement()],indent-=state.option.indent,state.funct[\"(scope)\"].unstack(),delete state.funct[\"(noblockscopedvar)\"];else if(isfunc){if(state.funct[\"(scope)\"].stack(),m={},!stmt||isfatarrow||state.inMoz()||error(\"W118\",state.tokens.curr,\"function closure expressions\"),!stmt)for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);expression(10),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\")),state.funct[\"(scope)\"].unstack()}else error(\"E021\",state.tokens.next,\"{\",state.tokens.next.value);switch(state.funct[\"(verb)\"]){case\"break\":case\"continue\":case\"return\":case\"throw\":if(iscase)break;default:state.funct[\"(verb)\"]=null}return inblock=b,!ordinary||!state.option.noempty||a&&0!==a.length||warning(\"W035\",state.tokens.prev),metrics.nestedBlockDepth-=1,a}function countMember(m){membersOnly&&\"boolean\"!=typeof membersOnly[m]&&warning(\"W036\",state.tokens.curr,m),\"number\"==typeof member[m]?member[m]+=1:member[m]=1}function comprehensiveArrayExpression(){var res={};res.exps=!0,state.funct[\"(comparray)\"].stack();var reversed=!1;return\"for\"!==state.tokens.next.value&&(reversed=!0,state.inMoz()||warning(\"W116\",state.tokens.next,\"for\",state.tokens.next.value),state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"for\"),\"each\"===state.tokens.next.value&&(advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"define\"),res.left=expression(130),_.contains([\"in\",\"of\"],state.tokens.next.value)?advance():error(\"E045\",state.tokens.curr),state.funct[\"(comparray)\"].setState(\"generate\"),expression(10),advance(\")\"),\"if\"===state.tokens.next.value&&(advance(\"if\"),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"filter\"),res.filter=expression(10),advance(\")\")),reversed||(state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"]\"),state.funct[\"(comparray)\"].unstack(),res}function isMethod(){return state.funct[\"(statement)\"]&&\"class\"===state.funct[\"(statement)\"].type||state.funct[\"(context)\"]&&\"class\"===state.funct[\"(context)\"][\"(verb)\"]}function isPropertyName(token){return token.identifier||\"(string)\"===token.id||\"(number)\"===token.id}function propertyName(preserveOrToken){var id,preserve=!0;return\"object\"==typeof preserveOrToken?id=preserveOrToken:(preserve=preserveOrToken,id=optionalidentifier(!1,!0,preserve)),id?\"object\"==typeof id&&(\"(string)\"===id.id||\"(identifier)\"===id.id?id=id.value:\"(number)\"===id.id&&(id=\"\"+id.value)):\"(string)\"===state.tokens.next.id?(id=state.tokens.next.value,preserve||advance()):\"(number)\"===state.tokens.next.id&&(id=\"\"+state.tokens.next.value,preserve||advance()),\"hasOwnProperty\"===id&&warning(\"W001\"),id}function functionparams(options){function addParam(addParamArgs){state.funct[\"(scope)\"].addParam.apply(state.funct[\"(scope)\"],addParamArgs)}var next,ident,t,paramsIds=[],tokens=[],pastDefault=!1,pastRest=!1,arity=0,loneArg=options&&options.loneArg;if(loneArg&&loneArg.identifier===!0)return state.funct[\"(scope)\"].addParam(loneArg.value,loneArg),{arity:1,params:[loneArg.value]};if(next=state.tokens.next,options&&options.parsedOpening||advance(\"(\"),\")\"===state.tokens.next.id)return advance(\")\"),void 0;for(;;){arity++;var currentParams=[];if(_.contains([\"{\",\"[\"],state.tokens.next.id)){tokens=destructuringPattern();for(t in tokens)t=tokens[t],t.id&&(paramsIds.push(t.id),currentParams.push([t.id,t.token]))}else if(checkPunctuator(state.tokens.next,\"...\")&&(pastRest=!0),ident=identifier(!0))paramsIds.push(ident),currentParams.push([ident,state.tokens.curr]);else for(;!checkPunctuators(state.tokens.next,[\",\",\")\"]);)advance();if(pastDefault&&\"=\"!==state.tokens.next.id&&error(\"W138\",state.tokens.current),\"=\"===state.tokens.next.id&&(state.inES6()||warning(\"W119\",state.tokens.next,\"default parameters\",\"6\"),advance(\"=\"),pastDefault=!0,expression(10)),currentParams.forEach(addParam),\",\"!==state.tokens.next.id)return advance(\")\",next),{arity:arity,params:paramsIds};pastRest&&warning(\"W131\",state.tokens.next),comma()}}function functor(name,token,overwrites){var funct={\"(name)\":name,\"(breakage)\":0,\"(loopage)\":0,\"(tokens)\":{},\"(properties)\":{},\"(catch)\":!1,\"(global)\":!1,\"(line)\":null,\"(character)\":null,\"(metrics)\":null,\"(statement)\":null,\"(context)\":null,\"(scope)\":null,\"(comparray)\":null,\"(generator)\":null,\"(arrow)\":null,\"(params)\":null};return token&&_.extend(funct,{\"(line)\":token.line,\"(character)\":token.character,\"(metrics)\":createMetrics(token)}),_.extend(funct,overwrites),funct[\"(context)\"]&&(funct[\"(scope)\"]=funct[\"(context)\"][\"(scope)\"],funct[\"(comparray)\"]=funct[\"(context)\"][\"(comparray)\"]),funct}function isFunctor(token){return\"(scope)\"in token}function hasParsedCode(funct){return funct[\"(global)\"]&&!funct[\"(verb)\"]}function doTemplateLiteral(left){function end(){if(state.tokens.curr.template&&state.tokens.curr.tail&&state.tokens.curr.context===ctx)return!0;var complete=state.tokens.next.template&&state.tokens.next.tail&&state.tokens.next.context===ctx;return complete&&advance(),complete||state.tokens.next.isUnclosed}var ctx=this.context,noSubst=this.noSubst,depth=this.depth;if(!noSubst)for(;!end();)!state.tokens.next.template||state.tokens.next.depth>depth?expression(0):advance();return{id:\"(template)\",type:\"(template)\",tag:left}}function doFunction(options){var f,token,name,statement,classExprBinding,isGenerator,isArrow,ignoreLoopFunc,oldOption=state.option,oldIgnored=state.ignored;options&&(name=options.name,statement=options.statement,classExprBinding=options.classExprBinding,isGenerator=\"generator\"===options.type,isArrow=\"arrow\"===options.type,ignoreLoopFunc=options.ignoreLoopFunc),state.option=Object.create(state.option),state.ignored=Object.create(state.ignored),state.funct=functor(name||state.nameStack.infer(),state.tokens.next,{\"(statement)\":statement,\"(context)\":state.funct,\"(arrow)\":isArrow,\"(generator)\":isGenerator}),f=state.funct,token=state.tokens.curr,token.funct=state.funct,functions.push(state.funct),state.funct[\"(scope)\"].stack(\"functionouter\");var internallyAccessibleName=name||classExprBinding;internallyAccessibleName&&state.funct[\"(scope)\"].block.add(internallyAccessibleName,classExprBinding?\"class\":\"function\",state.tokens.curr,!1),state.funct[\"(scope)\"].stack(\"functionparams\");var paramsInfo=functionparams(options);return paramsInfo?(state.funct[\"(params)\"]=paramsInfo.params,state.funct[\"(metrics)\"].arity=paramsInfo.arity,state.funct[\"(metrics)\"].verifyMaxParametersPerFunction()):state.funct[\"(metrics)\"].arity=0,isArrow&&(state.inES6(!0)||warning(\"W119\",state.tokens.curr,\"arrow function syntax (=>)\",\"6\"),options.loneArg||advance(\"=>\")),block(!1,!0,!0,isArrow),!state.option.noyield&&isGenerator&&\"yielded\"!==state.funct[\"(generator)\"]&&warning(\"W124\",state.tokens.curr),state.funct[\"(metrics)\"].verifyMaxStatementsPerFunction(),state.funct[\"(metrics)\"].verifyMaxComplexityPerFunction(),state.funct[\"(unusedOption)\"]=state.option.unused,state.option=oldOption,state.ignored=oldIgnored,state.funct[\"(last)\"]=state.tokens.curr.line,state.funct[\"(lastcharacter)\"]=state.tokens.curr.character,state.funct[\"(scope)\"].unstack(),state.funct[\"(scope)\"].unstack(),state.funct=state.funct[\"(context)\"],ignoreLoopFunc||state.option.loopfunc||!state.funct[\"(loopage)\"]||f[\"(isCapturing)\"]&&warning(\"W083\",token),f}function createMetrics(functionStartToken){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){state.option.maxstatements&&this.statementCount>state.option.maxstatements&&warning(\"W071\",functionStartToken,this.statementCount)\n},verifyMaxParametersPerFunction:function(){_.isNumber(state.option.maxparams)&&this.arity>state.option.maxparams&&warning(\"W072\",functionStartToken,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){state.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===state.option.maxdepth+1&&warning(\"W073\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var max=state.option.maxcomplexity,cc=this.ComplexityCount;max&&cc>max&&warning(\"W074\",functionStartToken,cc)}}}function increaseComplexityCount(){state.funct[\"(metrics)\"].ComplexityCount+=1}function checkCondAssignment(expr){var id,paren;switch(expr&&(id=expr.id,paren=expr.paren,\",\"===id&&(expr=expr.exprs[expr.exprs.length-1])&&(id=expr.id,paren=paren||expr.paren)),id){case\"=\":case\"+=\":case\"-=\":case\"*=\":case\"%=\":case\"&=\":case\"|=\":case\"^=\":case\"/=\":paren||state.option.boss||warning(\"W084\")}}function checkProperties(props){if(state.inES5())for(var name in props)props[name]&&props[name].setterToken&&!props[name].getterToken&&warning(\"W078\",props[name].setterToken)}function metaProperty(name,c){if(checkPunctuator(state.tokens.next,\".\")){var left=state.tokens.curr.id;advance(\".\");var id=identifier();return state.tokens.curr.isMetaProperty=!0,name!==id?error(\"E057\",state.tokens.prev,left,id):c(),state.tokens.curr}}function destructuringPattern(options){var isAssignment=options&&options.assignment;return state.inES6()||warning(\"W104\",state.tokens.curr,isAssignment?\"destructuring assignment\":\"destructuring binding\",\"6\"),destructuringPatternRecursive(options)}function destructuringPatternRecursive(options){var ids,identifiers=[],openingParsed=options&&options.openingParsed,isAssignment=options&&options.assignment,recursiveOptions=isAssignment?{assignment:isAssignment}:null,firstToken=openingParsed?state.tokens.curr:state.tokens.next,nextInnerDE=function(){var ident;if(checkPunctuators(state.tokens.next,[\"[\",\"{\"])){ids=destructuringPatternRecursive(recursiveOptions);for(var id in ids)id=ids[id],identifiers.push({id:id.id,token:id.token})}else if(checkPunctuator(state.tokens.next,\",\"))identifiers.push({id:null,token:state.tokens.curr});else{if(!checkPunctuator(state.tokens.next,\"(\")){var is_rest=checkPunctuator(state.tokens.next,\"...\");if(isAssignment){var identifierToken=is_rest?peek(0):state.tokens.next;identifierToken.identifier||warning(\"E030\",identifierToken,identifierToken.value);var assignTarget=expression(155);assignTarget&&(checkLeftSideAssign(assignTarget),assignTarget.identifier&&(ident=assignTarget.value))}else ident=identifier();return ident&&identifiers.push({id:ident,token:state.tokens.curr}),is_rest}advance(\"(\"),nextInnerDE(),advance(\")\")}return!1},assignmentProperty=function(){var id;checkPunctuator(state.tokens.next,\"[\")?(advance(\"[\"),expression(10),advance(\"]\"),advance(\":\"),nextInnerDE()):\"(string)\"===state.tokens.next.id||\"(number)\"===state.tokens.next.id?(advance(),advance(\":\"),nextInnerDE()):(id=identifier(),checkPunctuator(state.tokens.next,\":\")?(advance(\":\"),nextInnerDE()):id&&(isAssignment&&checkLeftSideAssign(state.tokens.curr),identifiers.push({id:id,token:state.tokens.curr})))};if(checkPunctuator(firstToken,\"[\")){openingParsed||advance(\"[\"),checkPunctuator(state.tokens.next,\"]\")&&warning(\"W137\",state.tokens.curr);for(var element_after_rest=!1;!checkPunctuator(state.tokens.next,\"]\");)nextInnerDE()&&!element_after_rest&&checkPunctuator(state.tokens.next,\",\")&&(warning(\"W130\",state.tokens.next),element_after_rest=!0),checkPunctuator(state.tokens.next,\"=\")&&(checkPunctuator(state.tokens.prev,\"...\")?advance(\"]\"):advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"]\")||advance(\",\");advance(\"]\")}else if(checkPunctuator(firstToken,\"{\")){for(openingParsed||advance(\"{\"),checkPunctuator(state.tokens.next,\"}\")&&warning(\"W137\",state.tokens.curr);!checkPunctuator(state.tokens.next,\"}\")&&(assignmentProperty(),checkPunctuator(state.tokens.next,\"=\")&&(advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"}\")||(advance(\",\"),!checkPunctuator(state.tokens.next,\"}\"))););advance(\"}\")}return identifiers}function destructuringPatternMatch(tokens,value){var first=value.first;first&&_.zip(tokens,Array.isArray(first)?first:[first]).forEach(function(val){var token=val[0],value=val[1];token&&value?token.first=value:token&&token.first&&!value&&warning(\"W080\",token.first,token.first.value)})}function blockVariableStatement(type,statement,context){var tokens,lone,value,letblock,prefix=context&&context.prefix,inexport=context&&context.inexport,isLet=\"let\"===type,isConst=\"const\"===type;for(state.inES6()||warning(\"W104\",state.tokens.curr,type,\"6\"),isLet&&\"(\"===state.tokens.next.value?(state.inMoz()||warning(\"W118\",state.tokens.next,\"let block\"),advance(\"(\"),state.funct[\"(scope)\"].stack(),letblock=!0):state.funct[\"(noblockscopedvar)\"]&&error(\"E048\",state.tokens.curr,isConst?\"Const\":\"Let\"),statement.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),!prefix&&isConst&&\"=\"!==state.tokens.next.id&&warning(\"E012\",state.tokens.curr,state.tokens.curr.value);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],state.funct[\"(scope)\"].block.isGlobal()&&predefined[t.id]===!1&&warning(\"W079\",t.token,t.id),t.id&&!state.funct[\"(noblockscopedvar)\"]&&(state.funct[\"(scope)\"].addlabel(t.id,{type:type,token:t.token}),names.push(t.token),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.token.value,t.token)));if(\"=\"===state.tokens.next.id&&(advance(\"=\"),prefix||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),!prefix&&\"=\"===peek(0).id&&state.tokens.next.identifier&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),statement.first=statement.first.concat(names),\",\"!==state.tokens.next.id)break;comma()}return letblock&&(advance(\")\"),block(!0,!0),statement.block=!0,state.funct[\"(scope)\"].unstack()),statement}function classdef(isStatement){return state.inES6()||warning(\"W104\",state.tokens.curr,\"class\",\"6\"),isStatement?(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"class\",token:state.tokens.curr})):state.tokens.next.identifier&&\"extends\"!==state.tokens.next.value?(this.name=identifier(),this.namedExpr=!0):this.name=state.nameStack.infer(),classtail(this),this}function classtail(c){var wasInClassBody=state.inClassBody;\"extends\"===state.tokens.next.value&&(advance(\"extends\"),c.heritage=expression(10)),state.inClassBody=!0,advance(\"{\"),c.body=classbody(c),advance(\"}\"),state.inClassBody=wasInClassBody}function classbody(c){for(var name,isStatic,isGenerator,getset,computed,props=Object.create(null),staticProps=Object.create(null),i=0;\"}\"!==state.tokens.next.id;++i)if(name=state.tokens.next,isStatic=!1,isGenerator=!1,getset=null,\";\"!==name.id){if(\"*\"===name.id&&(isGenerator=!0,advance(\"*\"),name=state.tokens.next),\"[\"===name.id)name=computedPropertyName(),computed=!0;else{if(!isPropertyName(name)){warning(\"W052\",state.tokens.next,state.tokens.next.value||state.tokens.next.type),advance();continue}advance(),computed=!1,name.identifier&&\"static\"===name.value&&(checkPunctuator(state.tokens.next,\"*\")&&(isGenerator=!0,advance(\"*\")),(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,isStatic=!0,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())),!name.identifier||\"get\"!==name.value&&\"set\"!==name.value||(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,getset=name,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())}if(!checkPunctuator(state.tokens.next,\"(\")){for(error(\"E054\",state.tokens.next,state.tokens.next.value);\"}\"!==state.tokens.next.id&&!checkPunctuator(state.tokens.next,\"(\");)advance();\"(\"!==state.tokens.next.value&&doFunction({statement:c})}if(computed||(getset?saveAccessor(getset.value,isStatic?staticProps:props,name.value,name,!0,isStatic):(\"constructor\"===name.value?state.nameStack.set(c):state.nameStack.set(name),saveProperty(isStatic?staticProps:props,name.value,name,!0,isStatic))),getset&&\"constructor\"===name.value){var propDesc=\"get\"===getset.value?\"class getter method\":\"class setter method\";error(\"E049\",name,propDesc,\"constructor\")}else\"prototype\"===name.value&&error(\"E049\",name,\"class method\",\"prototype\");propertyName(name),doFunction({statement:c,type:isGenerator?\"generator\":null,classExprBinding:c.namedExpr?c.name:null})}else warning(\"W032\"),advance(\";\");checkProperties(props)}function saveProperty(props,name,tkn,isClass,isStatic){var msg=[\"key\",\"class method\",\"static class method\"];msg=msg[(isClass||!1)+(isStatic||!1)],tkn.identifier&&(name=tkn.value),props[name]&&\"__proto__\"!==name?warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name].basic=!0,props[name].basictkn=tkn}function saveAccessor(accessorType,props,name,tkn,isClass,isStatic){var flagName=\"get\"===accessorType?\"getterToken\":\"setterToken\",msg=\"\";isClass?(isStatic&&(msg+=\"static \"),msg+=accessorType+\"ter method\"):msg=\"key\",state.tokens.curr.accessorType=accessorType,state.nameStack.set(tkn),props[name]?(props[name].basic||props[name][flagName])&&\"__proto__\"!==name&&warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name][flagName]=tkn}function computedPropertyName(){advance(\"[\"),state.inES6()||warning(\"W119\",state.tokens.curr,\"computed property names\",\"6\");var value=expression(10);return advance(\"]\"),value}function checkPunctuators(token,values){return\"(punctuator)\"===token.type?_.contains(values,token.value):!1}function checkPunctuator(token,value){return\"(punctuator)\"===token.type&&token.value===value}function destructuringAssignOrJsonValue(){var block=lookupBlockType();block.notJson?(!state.inES6()&&block.isDestAssign&&warning(\"W104\",state.tokens.curr,\"destructuring assignment\",\"6\"),statements()):(state.option.laxbreak=!0,state.jsonMode=!0,jsonValue())}function jsonValue(){function jsonObject(){var o={},t=state.tokens.next;if(advance(\"{\"),\"}\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E026\",state.tokens.next,t.line);else{if(\"}\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id?error(\"E028\",state.tokens.next):\"(string)\"!==state.tokens.next.id&&warning(\"W095\",state.tokens.next,state.tokens.next.value)}if(o[state.tokens.next.value]===!0?warning(\"W075\",state.tokens.next,\"key\",state.tokens.next.value):\"__proto__\"===state.tokens.next.value&&!state.option.proto||\"__iterator__\"===state.tokens.next.value&&!state.option.iterator?warning(\"W096\",state.tokens.next,state.tokens.next.value):o[state.tokens.next.value]=!0,advance(),advance(\":\"),jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"}\")}function jsonArray(){var t=state.tokens.next;if(advance(\"[\"),\"]\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E027\",state.tokens.next,t.line);else{if(\"]\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id&&error(\"E028\",state.tokens.next)}if(jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"]\")}switch(state.tokens.next.id){case\"{\":jsonObject();break;case\"[\":jsonArray();break;case\"true\":case\"false\":case\"null\":case\"(number)\":case\"(string)\":advance();break;case\"-\":advance(\"-\"),advance(\"(number)\");break;default:error(\"E003\",state.tokens.next)}}var api,declared,functions,inblock,indent,lookahead,lex,member,membersOnly,predefined,stack,urls,bang={\"<\":!0,\"<=\":!0,\"==\":!0,\"===\":!0,\"!==\":!0,\"!=\":!0,\">\":!0,\">=\":!0,\"+\":!0,\"-\":!0,\"*\":!0,\"/\":!0,\"%\":!0},functionicity=[\"closure\",\"exception\",\"global\",\"label\",\"outer\",\"unused\",\"var\"],extraModules=[],emitter=new events.EventEmitter,typeofValues={};typeofValues.legacy=[\"xml\",\"unknown\"],typeofValues.es3=[\"undefined\",\"boolean\",\"number\",\"string\",\"function\",\"object\"],typeofValues.es3=typeofValues.es3.concat(typeofValues.legacy),typeofValues.es6=typeofValues.es3.concat(\"symbol\"),type(\"(number)\",function(){return this}),type(\"(string)\",function(){return this}),state.syntax[\"(identifier)\"]={type:\"(identifier)\",lbp:0,identifier:!0,nud:function(){var v=this.value;return\"=>\"===state.tokens.next.id?this:(state.funct[\"(comparray)\"].check(v)||state.funct[\"(scope)\"].block.use(v,state.tokens.curr),this)},led:function(){error(\"E033\",state.tokens.next,state.tokens.next.value)}};var baseTemplateSyntax={lbp:0,identifier:!1,template:!0};state.syntax[\"(template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template middle)\"]=_.extend({type:\"(template middle)\",middle:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template tail)\"]=_.extend({type:\"(template tail)\",tail:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(no subst template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!0,tail:!0},baseTemplateSyntax),type(\"(regexp)\",function(){return this}),delim(\"(endline)\"),delim(\"(begin)\"),delim(\"(end)\").reach=!0,delim(\"(error)\").reach=!0,delim(\"}\").reach=!0,delim(\")\"),delim(\"]\"),delim('\"').reach=!0,delim(\"'\").reach=!0,delim(\";\"),delim(\":\").reach=!0,delim(\"#\"),reserve(\"else\"),reserve(\"case\").reach=!0,reserve(\"catch\"),reserve(\"default\").reach=!0,reserve(\"finally\"),reservevar(\"arguments\",function(x){state.isStrict()&&state.funct[\"(global)\"]&&warning(\"E008\",x)}),reservevar(\"eval\"),reservevar(\"false\"),reservevar(\"Infinity\"),reservevar(\"null\"),reservevar(\"this\",function(x){state.isStrict()&&!isMethod()&&!state.option.validthis&&(state.funct[\"(statement)\"]&&state.funct[\"(name)\"].charAt(0)>\"Z\"||state.funct[\"(global)\"])&&warning(\"W040\",x)}),reservevar(\"true\"),reservevar(\"undefined\"),assignop(\"=\",\"assign\",20),assignop(\"+=\",\"assignadd\",20),assignop(\"-=\",\"assignsub\",20),assignop(\"*=\",\"assignmult\",20),assignop(\"/=\",\"assigndiv\",20).nud=function(){error(\"E014\")},assignop(\"%=\",\"assignmod\",20),bitwiseassignop(\"&=\"),bitwiseassignop(\"|=\"),bitwiseassignop(\"^=\"),bitwiseassignop(\"<<=\"),bitwiseassignop(\">>=\"),bitwiseassignop(\">>>=\"),infix(\",\",function(left,that){var expr;if(that.exprs=[left],state.option.nocomma&&warning(\"W127\"),!comma({peek:!0}))return that;for(;;){if(!(expr=expression(10)))break;if(that.exprs.push(expr),\",\"!==state.tokens.next.value||!comma())break}return that},10,!0),infix(\"?\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(10),advance(\":\"),that[\"else\"]=expression(10),that},30);var orPrecendence=40;infix(\"||\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(orPrecendence),that},orPrecendence),infix(\"&&\",\"and\",50),bitwise(\"|\",\"bitor\",70),bitwise(\"^\",\"bitxor\",80),bitwise(\"&\",\"bitand\",90),relation(\"==\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));switch(!0){case!eqnull&&state.option.eqeqeq:this.from=this.character,warning(\"W116\",this,\"===\",\"==\");break;case isPoorRelation(left):warning(\"W041\",this,\"===\",left.value);break;case isPoorRelation(right):warning(\"W041\",this,\"===\",right.value);break;case isTypoTypeof(right,left,state):warning(\"W122\",this,right.value);break;case isTypoTypeof(left,right,state):warning(\"W122\",this,left.value)}return this}),relation(\"===\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!=\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));return!eqnull&&state.option.eqeqeq?(this.from=this.character,warning(\"W116\",this,\"!==\",\"!=\")):isPoorRelation(left)?warning(\"W041\",this,\"!==\",left.value):isPoorRelation(right)?warning(\"W041\",this,\"!==\",right.value):isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!==\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"<\"),relation(\">\"),relation(\"<=\"),relation(\">=\"),bitwise(\"<<\",\"shiftleft\",120),bitwise(\">>\",\"shiftright\",120),bitwise(\">>>\",\"shiftrightunsigned\",120),infix(\"in\",\"in\",120),infix(\"instanceof\",\"instanceof\",120),infix(\"+\",function(left,that){var right;return that.left=left,that.right=right=expression(130),left&&right&&\"(string)\"===left.id&&\"(string)\"===right.id?(left.value+=right.value,left.character=right.character,!state.option.scripturl&®.javascriptURL.test(left.value)&&warning(\"W050\",left),left):that},130),prefix(\"+\",\"num\"),prefix(\"+++\",function(){return warning(\"W007\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"+++\",function(left){return warning(\"W007\"),this.left=left,this.right=expression(130),this},130),infix(\"-\",\"sub\",130),prefix(\"-\",\"neg\"),prefix(\"---\",function(){return warning(\"W006\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"---\",function(left){return warning(\"W006\"),this.left=left,this.right=expression(130),this},130),infix(\"*\",\"mult\",140),infix(\"/\",\"div\",140),infix(\"%\",\"mod\",140),suffix(\"++\"),prefix(\"++\",\"preinc\"),state.syntax[\"++\"].exps=!0,suffix(\"--\"),prefix(\"--\",\"predec\"),state.syntax[\"--\"].exps=!0,prefix(\"delete\",function(){var p=expression(10);return p?(\".\"!==p.id&&\"[\"!==p.id&&warning(\"W051\"),this.first=p,p.identifier&&!state.isStrict()&&(p.forgiveUndef=!0),this):this}).exps=!0,prefix(\"~\",function(){return state.option.bitwise&&warning(\"W016\",this,\"~\"),this.arity=\"unary\",this.right=expression(150),this}),prefix(\"...\",function(){return state.inES6(!0)||warning(\"W119\",this,\"spread/rest operator\",\"6\"),state.tokens.next.identifier||\"(string)\"===state.tokens.next.type||checkPunctuators(state.tokens.next,[\"[\",\"(\"])||error(\"E030\",state.tokens.next,state.tokens.next.value),expression(150),this}),prefix(\"!\",function(){return this.arity=\"unary\",this.right=expression(150),this.right||quit(\"E041\",this.line||0),bang[this.right.id]===!0&&warning(\"W018\",this,\"!\"),this}),prefix(\"typeof\",function(){var p=expression(150);return this.first=this.right=p,p||quit(\"E041\",this.line||0,this.character||0),p.identifier&&(p.forgiveUndef=!0),this}),prefix(\"new\",function(){var mp=metaProperty(\"target\",function(){state.inES6(!0)||warning(\"W119\",state.tokens.prev,\"new.target\",\"6\");for(var inFunction,c=state.funct;c&&(inFunction=!c[\"(global)\"],c[\"(arrow)\"]);)c=c[\"(context)\"];inFunction||warning(\"W136\",state.tokens.prev,\"new.target\")});if(mp)return mp;var i,c=expression(155);if(c&&\"function\"!==c.id)if(c.identifier)switch(c[\"new\"]=!0,c.value){case\"Number\":case\"String\":case\"Boolean\":case\"Math\":case\"JSON\":warning(\"W053\",state.tokens.prev,c.value);break;case\"Symbol\":state.inES6()&&warning(\"W053\",state.tokens.prev,c.value);break;case\"Function\":state.option.evil||warning(\"W054\");break;case\"Date\":case\"RegExp\":case\"this\":break;default:\"function\"!==c.id&&(i=c.value.substr(0,1),state.option.newcap&&(\"A\">i||i>\"Z\")&&!state.funct[\"(scope)\"].isPredefined(c.value)&&warning(\"W055\",state.tokens.curr))}else\".\"!==c.id&&\"[\"!==c.id&&\"(\"!==c.id&&warning(\"W056\",state.tokens.curr);else state.option.supernew||warning(\"W057\",this);return\"(\"===state.tokens.next.id||state.option.supernew||warning(\"W058\",state.tokens.curr,state.tokens.curr.value),this.first=this.right=c,this}),state.syntax[\"new\"].exps=!0,prefix(\"void\").exps=!0,infix(\".\",function(left,that){var m=identifier(!1,!0);return\"string\"==typeof m&&countMember(m),that.left=left,that.right=m,m&&\"hasOwnProperty\"===m&&\"=\"===state.tokens.next.value&&warning(\"W001\"),!left||\"arguments\"!==left.value||\"callee\"!==m&&\"caller\"!==m?state.option.evil||!left||\"document\"!==left.value||\"write\"!==m&&\"writeln\"!==m||warning(\"W060\",left):state.option.noarg?warning(\"W059\",left,m):state.isStrict()&&error(\"E008\"),state.option.evil||\"eval\"!==m&&\"execScript\"!==m||isGlobalEval(left,state)&&warning(\"W061\"),that},160,!0),infix(\"(\",function(left,that){state.option.immed&&left&&!left.immed&&\"function\"===left.id&&warning(\"W062\");var n=0,p=[];if(left&&\"(identifier)\"===left.type&&left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&-1===\"Array Number String Boolean Date Object Error Symbol\".indexOf(left.value)&&(\"Math\"===left.value?warning(\"W063\",left):state.option.newcap&&warning(\"W064\",left)),\")\"!==state.tokens.next.id)for(;p[p.length]=expression(10),n+=1,\",\"===state.tokens.next.id;)comma();return advance(\")\"),\"object\"==typeof left&&(state.inES5()||\"parseInt\"!==left.value||1!==n||warning(\"W065\",state.tokens.curr),state.option.evil||(\"eval\"===left.value||\"Function\"===left.value||\"execScript\"===left.value?(warning(\"W061\",left),p[0]&&\"(string)\"===[0].id&&addInternalSrc(left,p[0].value)):!p[0]||\"(string)\"!==p[0].id||\"setTimeout\"!==left.value&&\"setInterval\"!==left.value?!p[0]||\"(string)\"!==p[0].id||\".\"!==left.value||\"window\"!==left.left.value||\"setTimeout\"!==left.right&&\"setInterval\"!==left.right||(warning(\"W066\",left),addInternalSrc(left,p[0].value)):(warning(\"W066\",left),addInternalSrc(left,p[0].value))),left.identifier||\".\"===left.id||\"[\"===left.id||\"=>\"===left.id||\"(\"===left.id||\"&&\"===left.id||\"||\"===left.id||\"?\"===left.id||state.inES6()&&left[\"(name)\"]||warning(\"W067\",that)),that.left=left,that},155,!0).exps=!0,prefix(\"(\",function(){var pn1,ret,triggerFnExpr,first,last,pn=state.tokens.next,i=-1,parens=1,opening=state.tokens.curr,preceeding=state.tokens.prev,isNecessary=!state.option.singleGroups;do\"(\"===pn.value?parens+=1:\")\"===pn.value&&(parens-=1),i+=1,pn1=pn,pn=peek(i);while((0!==parens||\")\"!==pn1.value)&&\";\"!==pn.value&&\"(end)\"!==pn.type);if(\"function\"===state.tokens.next.id&&(triggerFnExpr=state.tokens.next.immed=!0),\"=>\"===pn.value)return doFunction({type:\"arrow\",parsedOpening:!0});var exprs=[];if(\")\"!==state.tokens.next.id)for(;exprs.push(expression(10)),\",\"===state.tokens.next.id;)state.option.nocomma&&warning(\"W127\"),comma();return advance(\")\",this),state.option.immed&&exprs[0]&&\"function\"===exprs[0].id&&\"(\"!==state.tokens.next.id&&\".\"!==state.tokens.next.id&&\"[\"!==state.tokens.next.id&&warning(\"W068\",this),exprs.length?(exprs.length>1?(ret=Object.create(state.syntax[\",\"]),ret.exprs=exprs,first=exprs[0],last=exprs[exprs.length-1],isNecessary||(isNecessary=preceeding.assign||preceeding.delim)):(ret=first=last=exprs[0],isNecessary||(isNecessary=opening.beginsStmt&&(\"{\"===ret.id||triggerFnExpr||isFunctor(ret))||triggerFnExpr&&(!isEndOfExpr()||\"}\"!==state.tokens.prev.id)||isFunctor(ret)&&!isEndOfExpr()||\"{\"===ret.id&&\"=>\"===preceeding.id||\"(number)\"===ret.type&&checkPunctuator(pn,\".\")&&/^\\d+$/.test(ret.value))),ret&&(!isNecessary&&(first.left||first.right||ret.exprs)&&(isNecessary=!isBeginOfExpr(preceeding)&&first.lbp<=preceeding.lbp||!isEndOfExpr()&&last.lbp\"),infix(\"[\",function(left,that){var s,e=expression(10);return e&&\"(string)\"===e.type&&(state.option.evil||\"eval\"!==e.value&&\"execScript\"!==e.value||isGlobalEval(left,state)&&warning(\"W061\"),countMember(e.value),!state.option.sub&®.identifier.test(e.value)&&(s=state.syntax[e.value],s&&isReserved(s)||warning(\"W069\",state.tokens.prev,e.value))),advance(\"]\",that),e&&\"hasOwnProperty\"===e.value&&\"=\"===state.tokens.next.value&&warning(\"W001\"),that.left=left,that.right=e,that},160,!0),prefix(\"[\",function(){var blocktype=lookupBlockType();if(blocktype.isCompArray)return state.option.esnext||state.inMoz()||warning(\"W118\",state.tokens.curr,\"array comprehension\"),comprehensiveArrayExpression();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;var b=state.tokens.curr.line!==startLine(state.tokens.next);for(this.first=[],b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));\"(end)\"!==state.tokens.next.id;){for(;\",\"===state.tokens.next.id;){if(!state.option.elision){if(state.inES5()){warning(\"W128\");do advance(\",\");while(\",\"===state.tokens.next.id);continue}warning(\"W070\")}advance(\",\")}if(\"]\"===state.tokens.next.id)break;if(this.first.push(expression(10)),\",\"!==state.tokens.next.id)break;if(comma({allowTrailing:!0}),\"]\"===state.tokens.next.id&&!state.inES5()){warning(\"W070\",state.tokens.curr);break}}return b&&(indent-=state.option.indent),advance(\"]\",this),this}),function(x){x.nud=function(){var b,f,i,p,t,nextVal,isGeneratorMethod=!1,props=Object.create(null);b=state.tokens.curr.line!==startLine(state.tokens.next),b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));var blocktype=lookupBlockType();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;for(;\"}\"!==state.tokens.next.id;){if(nextVal=state.tokens.next.value,!state.tokens.next.identifier||\",\"!==peekIgnoreEOL().id&&\"}\"!==peekIgnoreEOL().id)if(\":\"===peek().id||\"get\"!==nextVal&&\"set\"!==nextVal){if(\"*\"===state.tokens.next.value&&\"(punctuator)\"===state.tokens.next.type?(state.inES6()||warning(\"W104\",state.tokens.next,\"generator functions\",\"6\"),advance(\"*\"),isGeneratorMethod=!0):isGeneratorMethod=!1,\"[\"===state.tokens.next.id)i=computedPropertyName(),state.nameStack.set(i);else if(state.nameStack.set(state.tokens.next),i=propertyName(),saveProperty(props,i,state.tokens.next),\"string\"!=typeof i)break;\"(\"===state.tokens.next.value?(state.inES6()||warning(\"W104\",state.tokens.curr,\"concise methods\",\"6\"),doFunction({type:isGeneratorMethod?\"generator\":null})):(advance(\":\"),expression(10))}else advance(nextVal),state.inES5()||error(\"E034\"),i=propertyName(),i||state.inES6()||error(\"E035\"),i&&saveAccessor(nextVal,props,i,state.tokens.curr),t=state.tokens.next,f=doFunction(),p=f[\"(params)\"],\"get\"===nextVal&&i&&p?warning(\"W076\",t,p[0],i):\"set\"!==nextVal||!i||p&&1===p.length||warning(\"W077\",t,i);else state.inES6()||warning(\"W104\",state.tokens.next,\"object short notation\",\"6\"),i=propertyName(!0),saveProperty(props,i,state.tokens.next),expression(10);if(countMember(i),\",\"!==state.tokens.next.id)break;comma({allowTrailing:!0,property:!0}),\",\"===state.tokens.next.id?warning(\"W070\",state.tokens.curr):\"}\"!==state.tokens.next.id||state.inES5()||warning(\"W070\",state.tokens.curr)}return b&&(indent-=state.option.indent),advance(\"}\",this),checkProperties(props),this},x.fud=function(){error(\"E036\",state.tokens.curr)}}(delim(\"{\"));var conststatement=stmt(\"const\",function(context){return blockVariableStatement(\"const\",this,context)});conststatement.exps=!0;var letstatement=stmt(\"let\",function(context){return blockVariableStatement(\"let\",this,context)});letstatement.exps=!0;var varstatement=stmt(\"var\",function(context){var tokens,lone,value,prefix=context&&context.prefix,inexport=context&&context.inexport,implied=context&&context.implied,report=!(context&&context.ignore);for(this.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),prefix&&implied||!report||!state.option.varstmt||warning(\"W132\",this),this.first=this.first.concat(names);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],!implied&&state.funct[\"(global)\"]&&(predefined[t.id]===!1?warning(\"W079\",t.token,t.id):state.option.futurehostile===!1&&(!state.inES5()&&vars.ecmaIdentifiers[5][t.id]===!1||!state.inES6()&&vars.ecmaIdentifiers[6][t.id]===!1)&&warning(\"W129\",t.token,t.id)),t.id&&(\"for\"===implied?(state.funct[\"(scope)\"].has(t.id)||report&&warning(\"W088\",t.token,t.id),state.funct[\"(scope)\"].block.use(t.id,t.token)):(state.funct[\"(scope)\"].addlabel(t.id,{type:\"var\",token:t.token}),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.id,t.token)),names.push(t.token)));if(\"=\"===state.tokens.next.id&&(state.nameStack.set(state.tokens.curr),advance(\"=\"),prefix||!report||state.funct[\"(loopage)\"]||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),\"=\"===peek(0).id&&state.tokens.next.identifier&&(!prefix&&report&&!state.funct[\"(params)\"]||-1===state.funct[\"(params)\"].indexOf(state.tokens.next.value))&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),\",\"!==state.tokens.next.id)break;comma()}return this});varstatement.exps=!0,blockstmt(\"class\",function(){return classdef.call(this,!0)}),blockstmt(\"function\",function(context){var inexport=context&&context.inexport,generator=!1;\"*\"===state.tokens.next.value&&(advance(\"*\"),state.inES6({strict:!0})?generator=!0:warning(\"W119\",state.tokens.curr,\"function*\",\"6\")),inblock&&warning(\"W082\",state.tokens.curr);var i=optionalidentifier();return state.funct[\"(scope)\"].addlabel(i,{type:\"function\",token:state.tokens.curr}),void 0===i?warning(\"W025\"):inexport&&state.funct[\"(scope)\"].setExported(i,state.tokens.prev),doFunction({name:i,statement:this,type:generator?\"generator\":null,ignoreLoopFunc:inblock}),\"(\"===state.tokens.next.id&&state.tokens.next.line===state.tokens.curr.line&&error(\"E039\"),this}),prefix(\"function\",function(){var generator=!1;\"*\"===state.tokens.next.value&&(state.inES6()||warning(\"W119\",state.tokens.curr,\"function*\",\"6\"),advance(\"*\"),generator=!0);var i=optionalidentifier();return doFunction({name:i,type:generator?\"generator\":null}),this}),blockstmt(\"if\",function(){var t=state.tokens.next;increaseComplexityCount(),state.condition=!0,advance(\"(\");var expr=expression(0);checkCondAssignment(expr);var forinifcheck=null;state.option.forin&&state.forinifcheckneeded&&(state.forinifcheckneeded=!1,forinifcheck=state.forinifchecks[state.forinifchecks.length-1],forinifcheck.type=\"(punctuator)\"===expr.type&&\"!\"===expr.value?\"(negative)\":\"(positive)\"),advance(\")\",t),state.condition=!1;var s=block(!0,!0);return forinifcheck&&\"(negative)\"===forinifcheck.type&&s&&s[0]&&\"(identifier)\"===s[0].type&&\"continue\"===s[0].value&&(forinifcheck.type=\"(negative-with-continue)\"),\"else\"===state.tokens.next.id&&(advance(\"else\"),\"if\"===state.tokens.next.id||\"switch\"===state.tokens.next.id?statement():block(!0,!0)),this}),blockstmt(\"try\",function(){function doCatch(){if(advance(\"catch\"),advance(\"(\"),state.funct[\"(scope)\"].stack(\"catchparams\"),checkPunctuators(state.tokens.next,[\"[\",\"{\"])){var tokens=destructuringPattern();_.each(tokens,function(token){token.id&&state.funct[\"(scope)\"].addParam(token.id,token,\"exception\")})}else\"(identifier)\"!==state.tokens.next.type?warning(\"E030\",state.tokens.next,state.tokens.next.value):state.funct[\"(scope)\"].addParam(identifier(),state.tokens.curr,\"exception\");\"if\"===state.tokens.next.value&&(state.inMoz()||warning(\"W118\",state.tokens.curr,\"catch filter\"),advance(\"if\"),expression(0)),advance(\")\"),block(!1),state.funct[\"(scope)\"].unstack()}var b;for(block(!0);\"catch\"===state.tokens.next.id;)increaseComplexityCount(),b&&!state.inMoz()&&warning(\"W118\",state.tokens.next,\"multiple catch blocks\"),doCatch(),b=!0;return\"finally\"===state.tokens.next.id?(advance(\"finally\"),block(!0),void 0):(b||error(\"E021\",state.tokens.next,\"catch\",state.tokens.next.value),this)}),blockstmt(\"while\",function(){var t=state.tokens.next;return state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this}).labelled=!0,blockstmt(\"with\",function(){var t=state.tokens.next;return state.isStrict()?error(\"E010\",state.tokens.curr):state.option.withstmt||warning(\"W085\",state.tokens.curr),advance(\"(\"),expression(0),advance(\")\",t),block(!0,!0),this}),blockstmt(\"switch\",function(){var t=state.tokens.next,g=!1,noindent=!1;\nfor(state.funct[\"(breakage)\"]+=1,advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),t=state.tokens.next,advance(\"{\"),state.tokens.next.from===indent&&(noindent=!0),noindent||(indent+=state.option.indent),this.cases=[];;)switch(state.tokens.next.id){case\"case\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"case\":case\"continue\":case\"return\":case\"switch\":case\"throw\":break;default:state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"case\")}advance(\"case\"),this.cases.push(expression(0)),increaseComplexityCount(),g=!0,advance(\":\"),state.funct[\"(verb)\"]=\"case\";break;case\"default\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"continue\":case\"return\":case\"throw\":break;default:this.cases.length&&(state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"default\"))}advance(\"default\"),g=!0,advance(\":\");break;case\"}\":return noindent||(indent-=state.option.indent),advance(\"}\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(verb)\"]=void 0,void 0;case\"(end)\":return error(\"E023\",state.tokens.next,\"}\"),void 0;default:if(indent+=state.option.indent,g)switch(state.tokens.curr.id){case\",\":return error(\"E040\"),void 0;case\":\":g=!1,statements();break;default:return error(\"E025\",state.tokens.curr),void 0}else{if(\":\"!==state.tokens.curr.id)return error(\"E021\",state.tokens.next,\"case\",state.tokens.next.value),void 0;advance(\":\"),error(\"E024\",state.tokens.curr,\":\"),statements()}indent-=state.option.indent}return this}).labelled=!0,stmt(\"debugger\",function(){return state.option.debug||warning(\"W087\",this),this}).exps=!0,function(){var x=stmt(\"do\",function(){state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),this.first=block(!0,!0),advance(\"while\");var t=state.tokens.next;return advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this});x.labelled=!0,x.exps=!0}(),blockstmt(\"for\",function(){var s,t=state.tokens.next,letscope=!1,foreachtok=null;\"each\"===t.value&&(foreachtok=t,advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),increaseComplexityCount(),advance(\"(\");var nextop,comma,initializer,i=0,inof=[\"in\",\"of\"],level=0;checkPunctuators(state.tokens.next,[\"{\",\"[\"])&&++level;do{if(nextop=peek(i),++i,checkPunctuators(nextop,[\"{\",\"[\"])?++level:checkPunctuators(nextop,[\"}\",\"]\"])&&--level,0>level)break;0===level&&(!comma&&checkPunctuator(nextop,\",\")?comma=nextop:!initializer&&checkPunctuator(nextop,\"=\")&&(initializer=nextop))}while(level>0||!_.contains(inof,nextop.value)&&\";\"!==nextop.value&&\"(end)\"!==nextop.type);if(_.contains(inof,nextop.value)){state.inES6()||\"of\"!==nextop.value||warning(\"W104\",nextop,\"for of\",\"6\");var ok=!(initializer||comma);if(initializer&&error(\"W133\",comma,nextop.value,\"initializer is forbidden\"),comma&&error(\"W133\",comma,nextop.value,\"more than one ForBinding\"),\"var\"===state.tokens.next.id?(advance(\"var\"),state.tokens.curr.fud({prefix:!0})):\"let\"===state.tokens.next.id||\"const\"===state.tokens.next.id?(advance(state.tokens.next.id),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud({prefix:!0})):Object.create(varstatement).fud({prefix:!0,implied:\"for\",ignore:!ok}),advance(nextop.value),expression(20),advance(\")\",t),\"in\"===nextop.value&&state.option.forin&&(state.forinifcheckneeded=!0,void 0===state.forinifchecks&&(state.forinifchecks=[]),state.forinifchecks.push({type:\"(none)\"})),state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,s=block(!0,!0),\"in\"===nextop.value&&state.option.forin){if(state.forinifchecks&&state.forinifchecks.length>0){var check=state.forinifchecks.pop();(s&&s.length>0&&(\"object\"!=typeof s[0]||\"if\"!==s[0].value)||\"(positive)\"===check.type&&s.length>1||\"(negative)\"===check.type)&&warning(\"W089\",this)}state.forinifcheckneeded=!1}state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}else{if(foreachtok&&error(\"E045\",foreachtok),\";\"!==state.tokens.next.id)if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud();else if(\"let\"===state.tokens.next.id)advance(\"let\"),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud();else for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();if(nolinebreak(state.tokens.curr),advance(\";\"),state.funct[\"(loopage)\"]+=1,\";\"!==state.tokens.next.id&&checkCondAssignment(expression(0)),nolinebreak(state.tokens.curr),advance(\";\"),\";\"===state.tokens.next.id&&error(\"E021\",state.tokens.next,\")\",\";\"),\")\"!==state.tokens.next.id)for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();advance(\")\",t),state.funct[\"(breakage)\"]+=1,block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}return letscope&&state.funct[\"(scope)\"].unstack(),this}).labelled=!0,stmt(\"break\",function(){var v=state.tokens.next.value;return state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line!==startLine(state.tokens.next)?0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value):(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"continue\",function(){var v=state.tokens.next.value;return 0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value),state.funct[\"(loopage)\"]||warning(\"W052\",state.tokens.next,this.value),state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line===startLine(state.tokens.next)&&(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"return\",function(){return this.line===startLine(state.tokens.next)?\";\"===state.tokens.next.id||state.tokens.next.reach||(this.first=expression(0),!this.first||\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)):\"(punctuator)\"===state.tokens.next.type&&[\"[\",\"{\",\"+\",\"-\"].indexOf(state.tokens.next.value)>-1&&nolinebreak(this),reachable(this),this}).exps=!0,function(x){x.exps=!0,x.lbp=25}(prefix(\"yield\",function(){var prev=state.tokens.prev;state.inES6(!0)&&!state.funct[\"(generator)\"]?\"(catch)\"===state.funct[\"(name)\"]&&state.funct[\"(context)\"][\"(generator)\"]||error(\"E046\",state.tokens.curr,\"yield\"):state.inES6()||warning(\"W104\",state.tokens.curr,\"yield\",\"6\"),state.funct[\"(generator)\"]=\"yielded\";var delegatingYield=!1;return\"*\"===state.tokens.next.value&&(delegatingYield=!0,advance(\"*\")),this.line!==startLine(state.tokens.next)&&state.inMoz()?state.option.asi||nolinebreak(this):((delegatingYield||\";\"!==state.tokens.next.id&&!state.option.asi&&!state.tokens.next.reach&&state.tokens.next.nud)&&(nobreaknonadjacent(state.tokens.curr,state.tokens.next),this.first=expression(10),\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)),state.inMoz()&&\")\"!==state.tokens.next.id&&(prev.lbp>30||!prev.assign&&!isEndOfExpr()||\"yield\"===prev.id)&&error(\"E050\",this)),this})),stmt(\"throw\",function(){return nolinebreak(this),this.first=expression(20),reachable(this),this}).exps=!0,stmt(\"import\",function(){if(state.inES6()||warning(\"W119\",state.tokens.curr,\"import\",\"6\"),\"(string)\"===state.tokens.next.type)return advance(\"(string)\"),this;if(state.tokens.next.identifier){if(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value)return advance(\"from\"),advance(\"(string)\"),this;advance(\",\")}if(\"*\"===state.tokens.next.id)advance(\"*\"),advance(\"as\"),state.tokens.next.identifier&&(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}));else for(advance(\"{\");;){if(\"}\"===state.tokens.next.value){advance(\"}\");break}var importName;if(\"default\"===state.tokens.next.type?(importName=\"default\",advance(\"default\")):importName=identifier(),\"as\"===state.tokens.next.value&&(advance(\"as\"),importName=identifier()),state.funct[\"(scope)\"].addlabel(importName,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return advance(\"from\"),advance(\"(string)\"),this}).exps=!0,stmt(\"export\",function(){var token,identifier,ok=!0;if(state.inES6()||(warning(\"W119\",state.tokens.curr,\"export\",\"6\"),ok=!1),state.funct[\"(scope)\"].block.isGlobal()||(error(\"E053\",state.tokens.curr),ok=!1),\"*\"===state.tokens.next.value)return advance(\"*\"),advance(\"from\"),advance(\"(string)\"),this;if(\"default\"===state.tokens.next.type){state.nameStack.set(state.tokens.next),advance(\"default\");var exportType=state.tokens.next.id;return(\"function\"===exportType||\"class\"===exportType)&&(this.block=!0),token=peek(),expression(10),identifier=token.value,this.block&&(state.funct[\"(scope)\"].addlabel(identifier,{type:exportType,token:token}),state.funct[\"(scope)\"].setExported(identifier,token)),this}if(\"{\"===state.tokens.next.value){advance(\"{\");for(var exportedTokens=[];;){if(state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance(),exportedTokens.push(state.tokens.curr),\"as\"===state.tokens.next.value&&(advance(\"as\"),state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance()),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return\"from\"===state.tokens.next.value?(advance(\"from\"),advance(\"(string)\")):ok&&exportedTokens.forEach(function(token){state.funct[\"(scope)\"].setExported(token.value,token)}),this}if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud({inexport:!0});else if(\"let\"===state.tokens.next.id)advance(\"let\"),state.tokens.curr.fud({inexport:!0});else if(\"const\"===state.tokens.next.id)advance(\"const\"),state.tokens.curr.fud({inexport:!0});else if(\"function\"===state.tokens.next.id)this.block=!0,advance(\"function\"),state.syntax[\"function\"].fud({inexport:!0});else if(\"class\"===state.tokens.next.id){this.block=!0,advance(\"class\");var classNameToken=state.tokens.next;state.syntax[\"class\"].fud(),state.funct[\"(scope)\"].setExported(classNameToken.value,classNameToken)}else error(\"E024\",state.tokens.next,state.tokens.next.value);return this}).exps=!0,FutureReservedWord(\"abstract\"),FutureReservedWord(\"boolean\"),FutureReservedWord(\"byte\"),FutureReservedWord(\"char\"),FutureReservedWord(\"class\",{es5:!0,nud:classdef}),FutureReservedWord(\"double\"),FutureReservedWord(\"enum\",{es5:!0}),FutureReservedWord(\"export\",{es5:!0}),FutureReservedWord(\"extends\",{es5:!0}),FutureReservedWord(\"final\"),FutureReservedWord(\"float\"),FutureReservedWord(\"goto\"),FutureReservedWord(\"implements\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"import\",{es5:!0}),FutureReservedWord(\"int\"),FutureReservedWord(\"interface\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"long\"),FutureReservedWord(\"native\"),FutureReservedWord(\"package\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"private\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"protected\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"public\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"short\"),FutureReservedWord(\"static\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"super\",{es5:!0}),FutureReservedWord(\"synchronized\"),FutureReservedWord(\"transient\"),FutureReservedWord(\"volatile\");var lookupBlockType=function(){var pn,pn1,prev,i=-1,bracketStack=0,ret={};checkPunctuators(state.tokens.curr,[\"[\",\"{\"])&&(bracketStack+=1);do{if(prev=-1===i?state.tokens.curr:pn,pn=-1===i?state.tokens.next:peek(i),pn1=peek(i+1),i+=1,checkPunctuators(pn,[\"[\",\"{\"])?bracketStack+=1:checkPunctuators(pn,[\"]\",\"}\"])&&(bracketStack-=1),1===bracketStack&&pn.identifier&&\"for\"===pn.value&&!checkPunctuator(prev,\".\")){ret.isCompArray=!0,ret.notJson=!0;break}if(0===bracketStack&&checkPunctuators(pn,[\"}\",\"]\"])){if(\"=\"===pn1.value){ret.isDestAssign=!0,ret.notJson=!0;break}if(\".\"===pn1.value){ret.notJson=!0;break}}checkPunctuator(pn,\";\")&&(ret.isBlock=!0,ret.notJson=!0)}while(bracketStack>0&&\"(end)\"!==pn.id);return ret},arrayComprehension=function(){function declare(v){var l=_current.variables.filter(function(elt){return elt.value===v?(elt.undef=!1,v):void 0}).length;return 0!==l}function use(v){var l=_current.variables.filter(function(elt){return elt.value!==v||elt.undef?void 0:(elt.unused===!0&&(elt.unused=!1),v)}).length;return 0===l}var _current,CompArray=function(){this.mode=\"use\",this.variables=[]},_carrays=[];return{stack:function(){_current=new CompArray,_carrays.push(_current)},unstack:function(){_current.variables.filter(function(v){v.unused&&warning(\"W098\",v.token,v.raw_text||v.value),v.undef&&state.funct[\"(scope)\"].block.use(v.value,v.token)}),_carrays.splice(-1,1),_current=_carrays[_carrays.length-1]},setState:function(s){_.contains([\"use\",\"define\",\"generate\",\"filter\"],s)&&(_current.mode=s)},check:function(v){return _current?_current&&\"use\"===_current.mode?(use(v)&&_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!0,unused:!1}),!0):_current&&\"define\"===_current.mode?(declare(v)||_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!1,unused:!0}),!0):_current&&\"generate\"===_current.mode?(state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):_current&&\"filter\"===_current.mode?(use(v)&&state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):!1:void 0}}},escapeRegex=function(str){return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")},itself=function(s,o,g){function each(obj,cb){obj&&(Array.isArray(obj)||\"object\"!=typeof obj||(obj=Object.keys(obj)),obj.forEach(cb))}var i,k,x,reIgnoreStr,reIgnore,optionKeys,newOptionObj={},newIgnoredObj={};o=_.clone(o),state.reset(),o&&o.scope?JSHINT.scope=o.scope:(JSHINT.errors=[],JSHINT.undefs=[],JSHINT.internals=[],JSHINT.blacklist={},JSHINT.scope=\"(main)\"),predefined=Object.create(null),combine(predefined,vars.ecmaIdentifiers[3]),combine(predefined,vars.reservedVars),combine(predefined,g||{}),declared=Object.create(null);var exported=Object.create(null);if(o)for(each(o.predef||null,function(item){var slice,prop;\"-\"===item[0]?(slice=item.slice(1),JSHINT.blacklist[slice]=slice,delete predefined[slice]):(prop=Object.getOwnPropertyDescriptor(o.predef,item),predefined[item]=prop?prop.value:!1)}),each(o.exported||null,function(item){exported[item]=!0}),delete o.predef,delete o.exported,optionKeys=Object.keys(o),x=0;optionKeys.length>x;x++)if(/^-W\\d{3}$/g.test(optionKeys[x]))newIgnoredObj[optionKeys[x].slice(1)]=!0;else{var optionKey=optionKeys[x];newOptionObj[optionKey]=o[optionKey],(\"esversion\"===optionKey&&5===o[optionKey]||\"es5\"===optionKey&&o[optionKey])&&warning(\"I003\"),\"newcap\"===optionKeys[x]&&o[optionKey]===!1&&(newOptionObj[\"(explicitNewcap)\"]=!0)}state.option=newOptionObj,state.ignored=newIgnoredObj,state.option.indent=state.option.indent||4,state.option.maxerr=state.option.maxerr||50,indent=1;var scopeManagerInst=scopeManager(state,predefined,exported,declared);if(scopeManagerInst.on(\"warning\",function(ev){warning.apply(null,[ev.code,ev.token].concat(ev.data))}),scopeManagerInst.on(\"error\",function(ev){error.apply(null,[ev.code,ev.token].concat(ev.data))}),state.funct=functor(\"(global)\",null,{\"(global)\":!0,\"(scope)\":scopeManagerInst,\"(comparray)\":arrayComprehension(),\"(metrics)\":createMetrics(state.tokens.next)}),functions=[state.funct],urls=[],stack=null,member={},membersOnly=null,inblock=!1,lookahead=[],!isString(s)&&!Array.isArray(s))return errorAt(\"E004\",0),!1;api={get isJSON(){return state.jsonMode},getOption:function(name){return state.option[name]||null},getCache:function(name){return state.cache[name]},setCache:function(name,value){state.cache[name]=value},warn:function(code,data){warningAt.apply(null,[code,data.line,data.char].concat(data.data))},on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)}.bind(this))}},emitter.removeAllListeners(),(extraModules||[]).forEach(function(func){func(api)}),state.tokens.prev=state.tokens.curr=state.tokens.next=state.syntax[\"(begin)\"],o&&o.ignoreDelimiters&&(Array.isArray(o.ignoreDelimiters)||(o.ignoreDelimiters=[o.ignoreDelimiters]),o.ignoreDelimiters.forEach(function(delimiterPair){delimiterPair.start&&delimiterPair.end&&(reIgnoreStr=escapeRegex(delimiterPair.start)+\"[\\\\s\\\\S]*?\"+escapeRegex(delimiterPair.end),reIgnore=RegExp(reIgnoreStr,\"ig\"),s=s.replace(reIgnore,function(match){return match.replace(/./g,\" \")}))})),lex=new Lexer(s),lex.on(\"warning\",function(ev){warningAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"error\",function(ev){errorAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"fatal\",function(ev){quit(\"E041\",ev.line,ev.from)}),lex.on(\"Identifier\",function(ev){emitter.emit(\"Identifier\",ev)}),lex.on(\"String\",function(ev){emitter.emit(\"String\",ev)}),lex.on(\"Number\",function(ev){emitter.emit(\"Number\",ev)}),lex.start();for(var name in o)_.has(o,name)&&checkOption(name,state.tokens.curr);assume(),combine(predefined,g||{}),comma.first=!0;try{switch(advance(),state.tokens.next.id){case\"{\":case\"[\":destructuringAssignOrJsonValue();break;default:directives(),state.directive[\"use strict\"]&&\"global\"!==state.option.strict&&warning(\"W097\",state.tokens.prev),statements()}\"(end)\"!==state.tokens.next.id&&quit(\"E041\",state.tokens.curr.line),state.funct[\"(scope)\"].unstack()}catch(err){if(!err||\"JSHintError\"!==err.name)throw err;var nt=state.tokens.next||{};JSHINT.errors.push({scope:\"(main)\",raw:err.raw,code:err.code,reason:err.message,line:err.line||nt.line,character:err.character||nt.from},null)}if(\"(main)\"===JSHINT.scope)for(o=o||{},i=0;JSHINT.internals.length>i;i+=1)k=JSHINT.internals[i],o.scope=k.elem,itself(k.value,o,g);return 0===JSHINT.errors.length};return itself.addModule=function(func){extraModules.push(func)},itself.addModule(style.register),itself.data=function(){var fu,f,i,j,n,globals,data={functions:[],options:state.option};itself.errors.length&&(data.errors=itself.errors),state.jsonMode&&(data.json=!0);var impliedGlobals=state.funct[\"(scope)\"].getImpliedGlobals();for(impliedGlobals.length>0&&(data.implieds=impliedGlobals),urls.length>0&&(data.urls=urls),globals=state.funct[\"(scope)\"].getUsedOrDefinedGlobals(),globals.length>0&&(data.globals=globals),i=1;functions.length>i;i+=1){for(f=functions[i],fu={},j=0;functionicity.length>j;j+=1)fu[functionicity[j]]=[];for(j=0;functionicity.length>j;j+=1)0===fu[functionicity[j]].length&&delete fu[functionicity[j]];fu.name=f[\"(name)\"],fu.param=f[\"(params)\"],fu.line=f[\"(line)\"],fu.character=f[\"(character)\"],fu.last=f[\"(last)\"],fu.lastcharacter=f[\"(lastcharacter)\"],fu.metrics={complexity:f[\"(metrics)\"].ComplexityCount,parameters:f[\"(metrics)\"].arity,statements:f[\"(metrics)\"].statementCount},data.functions.push(fu)}var unuseds=state.funct[\"(scope)\"].getUnuseds();unuseds.length>0&&(data.unused=unuseds);for(n in member)if(\"number\"==typeof member[n]){data.member=member;break}return data},itself.jshint=itself,itself}();\"object\"==typeof exports&&exports&&(exports.JSHINT=JSHINT)},{\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./lex.js\":\"/node_modules/jshint/src/lex.js\",\"./messages.js\":\"/node_modules/jshint/src/messages.js\",\"./options.js\":\"/node_modules/jshint/src/options.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./scope-manager.js\":\"/node_modules/jshint/src/scope-manager.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",\"./style.js\":\"/node_modules/jshint/src/style.js\",\"./vars.js\":\"/node_modules/jshint/src/vars.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/lex.js\":[function(_dereq_,module,exports){\"use strict\";function asyncTrigger(){var _checks=[];return{push:function(fn){_checks.push(fn)},check:function(){for(var check=0;_checks.length>check;++check)_checks[check]();_checks.splice(0,_checks.length)}}}function Lexer(source){var lines=source;\"string\"==typeof lines&&(lines=lines.replace(/\\r\\n/g,\"\\n\").replace(/\\r/g,\"\\n\").split(\"\\n\")),lines[0]&&\"#!\"===lines[0].substr(0,2)&&(-1!==lines[0].indexOf(\"node\")&&(state.option.node=!0),lines[0]=\"\"),this.emitter=new events.EventEmitter,this.source=source,this.setLines(lines),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\"\",this.inComment=!1,this.context=[],this.templateStarts=[];for(var i=0;state.option.indent>i;i+=1)state.tab+=\" \";this.ignoreLinterErrors=!1}var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,unicodeData=_dereq_(\"../data/ascii-identifier-data.js\"),asciiIdentifierStartTable=unicodeData.asciiIdentifierStartTable,asciiIdentifierPartTable=unicodeData.asciiIdentifierPartTable,Token={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateHead:10,TemplateMiddle:11,TemplateTail:12,NoSubstTemplate:13},Context={Block:1,Template:2};Lexer.prototype={_lines:[],inContext:function(ctxType){return this.context.length>0&&this.context[this.context.length-1].type===ctxType},pushContext:function(ctxType){this.context.push({type:ctxType})},popContext:function(){return this.context.pop()},isContext:function(context){return this.context.length>0&&this.context[this.context.length-1]===context},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=state.lines,this._lines},setLines:function(val){this._lines=val,state.lines=this._lines},peek:function(i){return this.input.charAt(i||0)},skip:function(i){i=i||1,this.char+=i,this.input=this.input.slice(i)},on:function(names,listener){names.split(\" \").forEach(function(name){this.emitter.on(name,listener)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(type,args,checks,fn){checks.push(function(){fn()&&this.trigger(type,args)}.bind(this))},scanPunctuator:function(){var ch2,ch3,ch4,ch1=this.peek();switch(ch1){case\".\":if(/^[0-9]$/.test(this.peek(1)))return null;if(\".\"===this.peek(1)&&\".\"===this.peek(2))return{type:Token.Punctuator,value:\"...\"};case\"(\":case\")\":case\";\":case\",\":case\"[\":case\"]\":case\":\":case\"~\":case\"?\":return{type:Token.Punctuator,value:ch1};case\"{\":return this.pushContext(Context.Block),{type:Token.Punctuator,value:ch1};case\"}\":return this.inContext(Context.Block)&&this.popContext(),{type:Token.Punctuator,value:ch1};case\"#\":return{type:Token.Punctuator,value:ch1};case\"\":return null}return ch2=this.peek(1),ch3=this.peek(2),ch4=this.peek(3),\">\"===ch1&&\">\"===ch2&&\">\"===ch3&&\"=\"===ch4?{type:Token.Punctuator,value:\">>>=\"}:\"=\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"===\"}:\"!\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"!==\"}:\">\"===ch1&&\">\"===ch2&&\">\"===ch3?{type:Token.Punctuator,value:\">>>\"}:\"<\"===ch1&&\"<\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"<<=\"}:\">\"===ch1&&\">\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\">>=\"}:\"=\"===ch1&&\">\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:ch1===ch2&&\"+-<>&|\".indexOf(ch1)>=0?{type:Token.Punctuator,value:ch1+ch2}:\"<>=!+-*%&|^\".indexOf(ch1)>=0?\"=\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:{type:Token.Punctuator,value:ch1}:\"/\"===ch1?\"=\"===ch2?{type:Token.Punctuator,value:\"/=\"}:{type:Token.Punctuator,value:\"/\"}:null},scanComments:function(){function commentToken(label,body,opt){var special=[\"jshint\",\"jslint\",\"members\",\"member\",\"globals\",\"global\",\"exported\"],isSpecial=!1,value=label+body,commentType=\"plain\";return opt=opt||{},opt.isMultiline&&(value+=\"*/\"),body=body.replace(/\\n/g,\" \"),\"/*\"===label&®.fallsThrough.test(body)&&(isSpecial=!0,commentType=\"falls through\"),special.forEach(function(str){if(!isSpecial&&(\"//\"!==label||\"jshint\"===str)&&(\" \"===body.charAt(str.length)&&body.substr(0,str.length)===str&&(isSpecial=!0,label+=str,body=body.substr(str.length)),isSpecial||\" \"!==body.charAt(0)||\" \"!==body.charAt(str.length+1)||body.substr(1,str.length)!==str||(isSpecial=!0,label=label+\" \"+str,body=body.substr(str.length+1)),isSpecial))switch(str){case\"member\":commentType=\"members\";break;case\"global\":commentType=\"globals\";break;default:var options=body.split(\":\").map(function(v){return v.replace(/^\\s+/,\"\").replace(/\\s+$/,\"\")});if(2===options.length)switch(options[0]){case\"ignore\":switch(options[1]){case\"start\":self.ignoringLinterErrors=!0,isSpecial=!1;break;case\"end\":self.ignoringLinterErrors=!1,isSpecial=!1}}commentType=str}}),{type:Token.Comment,commentType:commentType,value:value,body:body,isSpecial:isSpecial,isMultiline:opt.isMultiline||!1,isMalformed:opt.isMalformed||!1}}var ch1=this.peek(),ch2=this.peek(1),rest=this.input.substr(2),startLine=this.line,startChar=this.char,self=this;if(\"*\"===ch1&&\"/\"===ch2)return this.trigger(\"error\",{code:\"E018\",line:startLine,character:startChar}),this.skip(2),null;if(\"/\"!==ch1||\"*\"!==ch2&&\"/\"!==ch2)return null;if(\"/\"===ch2)return this.skip(this.input.length),commentToken(\"//\",rest);var body=\"\";if(\"*\"===ch2){for(this.inComment=!0,this.skip(2);\"*\"!==this.peek()||\"/\"!==this.peek(1);)if(\"\"===this.peek()){if(body+=\"\\n\",!this.nextLine())return this.trigger(\"error\",{code:\"E017\",line:startLine,character:startChar}),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0,isMalformed:!0})}else body+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0})}},scanKeyword:function(){var result=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),keywords=[\"if\",\"in\",\"do\",\"var\",\"for\",\"new\",\"try\",\"let\",\"this\",\"else\",\"case\",\"void\",\"with\",\"enum\",\"while\",\"break\",\"catch\",\"throw\",\"const\",\"yield\",\"class\",\"super\",\"return\",\"typeof\",\"delete\",\"switch\",\"export\",\"import\",\"default\",\"finally\",\"extends\",\"function\",\"continue\",\"debugger\",\"instanceof\"];return result&&keywords.indexOf(result[0])>=0?{type:Token.Keyword,value:result[0]}:null},scanIdentifier:function(){function isNonAsciiIdentifierStart(code){return code>256}function isNonAsciiIdentifierPart(code){return code>256}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function removeEscapeSequences(id){return id.replace(/\\\\u([0-9a-fA-F]{4})/g,function(m0,codepoint){return String.fromCharCode(parseInt(codepoint,16))})}var type,char,id=\"\",index=0,readUnicodeEscapeSequence=function(){if(index+=1,\"u\"!==this.peek(index))return null;var code,ch1=this.peek(index+1),ch2=this.peek(index+2),ch3=this.peek(index+3),ch4=this.peek(index+4);return isHexDigit(ch1)&&isHexDigit(ch2)&&isHexDigit(ch3)&&isHexDigit(ch4)?(code=parseInt(ch1+ch2+ch3+ch4,16),asciiIdentifierPartTable[code]||isNonAsciiIdentifierPart(code)?(index+=5,\"\\\\u\"+ch1+ch2+ch3+ch4):null):null}.bind(this),getIdentifierStart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierStartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierStart(code)?(index+=1,chr):null}.bind(this),getIdentifierPart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierPartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierPart(code)?(index+=1,chr):null}.bind(this);if(char=getIdentifierStart(),null===char)return null;for(id=char;char=getIdentifierPart(),null!==char;)id+=char;switch(id){case\"true\":case\"false\":type=Token.BooleanLiteral;break;case\"null\":type=Token.NullLiteral;break;default:type=Token.Identifier}return{type:type,value:removeEscapeSequences(id),text:id,tokenLength:id.length}},scanNumericLiteral:function(){function isDecimalDigit(str){return/^[0-9]$/.test(str)}function isOctalDigit(str){return/^[0-7]$/.test(str)}function isBinaryDigit(str){return/^[01]$/.test(str)}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function isIdentifierStart(ch){return\"$\"===ch||\"_\"===ch||\"\\\\\"===ch||ch>=\"a\"&&\"z\">=ch||ch>=\"A\"&&\"Z\">=ch}var bad,index=0,value=\"\",length=this.input.length,char=this.peek(index),isAllowedDigit=isDecimalDigit,base=10,isLegacy=!1;if(\".\"!==char&&!isDecimalDigit(char))return null;if(\".\"!==char){for(value=this.peek(index),index+=1,char=this.peek(index),\"0\"===value&&((\"x\"===char||\"X\"===char)&&(isAllowedDigit=isHexDigit,base=16,index+=1,value+=char),(\"o\"===char||\"O\"===char)&&(isAllowedDigit=isOctalDigit,base=8,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Octal integer literal\",\"6\"]}),index+=1,value+=char),(\"b\"===char||\"B\"===char)&&(isAllowedDigit=isBinaryDigit,base=2,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Binary integer literal\",\"6\"]}),index+=1,value+=char),isOctalDigit(char)&&(isAllowedDigit=isOctalDigit,base=8,isLegacy=!0,bad=!1,index+=1,value+=char),!isOctalDigit(char)&&isDecimalDigit(char)&&(index+=1,value+=char));length>index;){if(char=this.peek(index),isLegacy&&isDecimalDigit(char))bad=!0;else if(!isAllowedDigit(char))break;value+=char,index+=1}if(isAllowedDigit!==isDecimalDigit)return!isLegacy&&2>=value.length?{type:Token.NumericLiteral,value:value,isMalformed:!0}:length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isLegacy:isLegacy,isMalformed:!1}}if(\".\"===char)for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1;if(\"e\"===char||\"E\"===char){if(value+=char,index+=1,char=this.peek(index),(\"+\"===char||\"-\"===char)&&(value+=this.peek(index),index+=1),char=this.peek(index),!isDecimalDigit(char))return null;for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1}return length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isMalformed:!isFinite(value)}},scanEscapeSequence:function(checks){var allowNewLine=!1,jump=1;this.skip();var char=this.peek();switch(char){case\"'\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\'\"]},checks,function(){return state.jsonMode});break;case\"b\":char=\"\\\\b\";break;case\"f\":char=\"\\\\f\";break;case\"n\":char=\"\\\\n\";break;case\"r\":char=\"\\\\r\";break;case\"t\":char=\"\\\\t\";break;case\"0\":char=\"\\\\0\";var n=parseInt(this.peek(1),10);this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return n>=0&&7>=n&&state.isStrict()});break;case\"u\":var hexCode=this.input.substr(1,4),code=parseInt(hexCode,16);isNaN(code)&&this.trigger(\"warning\",{code:\"W052\",line:this.line,character:this.char,data:[\"u\"+hexCode]}),char=String.fromCharCode(code),jump=5;break;case\"v\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\v\"]},checks,function(){return state.jsonMode}),char=\"\u000b\";break;case\"x\":var x=parseInt(this.input.substr(1,2),16);this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\x-\"]},checks,function(){return state.jsonMode}),char=String.fromCharCode(x),jump=3;break;case\"\\\\\":char=\"\\\\\\\\\";break;case'\"':char='\\\\\"';break;case\"/\":break;case\"\":allowNewLine=!0,char=\"\"}return{\"char\":char,jump:jump,allowNewLine:allowNewLine}},scanTemplateLiteral:function(checks){var tokenType,ch,value=\"\",startLine=this.line,startChar=this.char,depth=this.templateStarts.length;if(!state.inES6(!0))return null;if(\"`\"===this.peek())tokenType=Token.TemplateHead,this.templateStarts.push({line:this.line,\"char\":this.char}),depth=this.templateStarts.length,this.skip(1),this.pushContext(Context.Template);else{if(!this.inContext(Context.Template)||\"}\"!==this.peek())return null;tokenType=Token.TemplateMiddle}for(;\"`\"!==this.peek();){for(;\"\"===(ch=this.peek());)if(value+=\"\\n\",!this.nextLine()){var startPos=this.templateStarts.pop();return this.trigger(\"error\",{code:\"E052\",line:startPos.line,character:startPos.char}),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,depth:depth,context:this.popContext()}}if(\"$\"===ch&&\"{\"===this.peek(1))return value+=\"${\",this.skip(2),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.currentContext()};\nif(\"\\\\\"===ch){var escape=this.scanEscapeSequence(checks);value+=escape.char,this.skip(escape.jump)}else\"`\"!==ch&&(value+=ch,this.skip(1))}return tokenType=tokenType===Token.TemplateHead?Token.NoSubstTemplate:Token.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.popContext()}},scanStringLiteral:function(checks){var quote=this.peek();if('\"'!==quote&&\"'\"!==quote)return null;this.triggerAsync(\"warning\",{code:\"W108\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&'\"'!==quote});var value=\"\",startLine=this.line,startChar=this.char,allowNewLine=!1;for(this.skip();this.peek()!==quote;)if(\"\"===this.peek()){if(allowNewLine?(allowNewLine=!1,this.triggerAsync(\"warning\",{code:\"W043\",line:this.line,character:this.char},checks,function(){return!state.option.multistr}),this.triggerAsync(\"warning\",{code:\"W042\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&state.option.multistr})):this.trigger(\"warning\",{code:\"W112\",line:this.line,character:this.char}),!this.nextLine())return this.trigger(\"error\",{code:\"E029\",line:startLine,character:startChar}),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,quote:quote}}else{allowNewLine=!1;var char=this.peek(),jump=1;if(\" \">char&&this.trigger(\"warning\",{code:\"W113\",line:this.line,character:this.char,data:[\"\"]}),\"\\\\\"===char){var parsed=this.scanEscapeSequence(checks);char=parsed.char,jump=parsed.jump,allowNewLine=parsed.allowNewLine}value+=char,this.skip(jump)}return this.skip(),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,quote:quote}},scanRegExp:function(){var terminated,index=0,length=this.input.length,char=this.peek(),value=char,body=\"\",flags=[],malformed=!1,isCharSet=!1,scanUnexpectedChars=function(){\" \">char&&(malformed=!0,this.trigger(\"warning\",{code:\"W048\",line:this.line,character:this.char})),\"<\"===char&&(malformed=!0,this.trigger(\"warning\",{code:\"W049\",line:this.line,character:this.char,data:[char]}))}.bind(this);if(!this.prereg||\"/\"!==char)return null;for(index+=1,terminated=!1;length>index;)if(char=this.peek(index),value+=char,body+=char,isCharSet)\"]\"===char&&(\"\\\\\"!==this.peek(index-1)||\"\\\\\"===this.peek(index-2))&&(isCharSet=!1),\"\\\\\"===char&&(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars()),index+=1;else{if(\"\\\\\"===char){if(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars(),\"/\"===char){index+=1;continue}if(\"[\"===char){index+=1;continue}}if(\"[\"!==char){if(\"/\"===char){body=body.substr(0,body.length-1),terminated=!0,index+=1;break}index+=1}else isCharSet=!0,index+=1}if(!terminated)return this.trigger(\"error\",{code:\"E015\",line:this.line,character:this.from}),void this.trigger(\"fatal\",{line:this.line,from:this.from});for(;length>index&&(char=this.peek(index),/[gim]/.test(char));)flags.push(char),value+=char,index+=1;try{RegExp(body,flags.join(\"\"))}catch(err){malformed=!0,this.trigger(\"error\",{code:\"E016\",line:this.line,character:this.char,data:[err.message]})}return{type:Token.RegExp,value:value,flags:flags,isMalformed:malformed}},scanNonBreakingSpaces:function(){return state.option.nonbsp?this.input.search(/(\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(reg.unsafeChars)},next:function(checks){this.from=this.char;var start;if(/\\s/.test(this.peek()))for(start=this.char;/\\s/.test(this.peek());)this.from+=1,this.skip();var match=this.scanComments()||this.scanStringLiteral(checks)||this.scanTemplateLiteral(checks);return match?match:(match=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),match?(this.skip(match.tokenLength||match.value.length),match):null)},nextLine:function(){var char;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var inputTrimmed=this.input.trim(),startsWith=function(){return _.some(arguments,function(prefix){return 0===inputTrimmed.indexOf(prefix)})},endsWith=function(){return _.some(arguments,function(suffix){return-1!==inputTrimmed.indexOf(suffix,inputTrimmed.length-suffix.length)})};if(this.ignoringLinterErrors===!0&&(startsWith(\"/*\",\"//\")||this.inComment&&endsWith(\"*/\")||(this.input=\"\")),char=this.scanNonBreakingSpaces(),char>=0&&this.trigger(\"warning\",{code:\"W125\",line:this.line,character:char+1}),this.input=this.input.replace(/\\t/g,state.tab),char=this.scanUnsafeChars(),char>=0&&this.trigger(\"warning\",{code:\"W100\",line:this.line,character:char}),!this.ignoringLinterErrors&&state.option.maxlen&&state.option.maxlen=0;--i){var scopeLabels=_scopeStack[i][\"(labels)\"];if(scopeLabels[labelName])return scopeLabels}}function usedSoFarInCurrentFunction(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(usages)\"][labelName])return current[\"(usages)\"][labelName];if(current===_currentFunctBody)break}return!1}function _checkOuterShadow(labelName,token){if(\"outer\"===state.option.shadow)for(var isGlobal=\"global\"===_currentFunctBody[\"(type)\"],isNewFunction=\"functionparams\"===_current[\"(type)\"],outsideCurrentFunction=!isGlobal,i=0;_scopeStack.length>i;i++){var stackItem=_scopeStack[i];isNewFunction||_scopeStack[i+1]!==_currentFunctBody||(outsideCurrentFunction=!1),outsideCurrentFunction&&stackItem[\"(labels)\"][labelName]&&warning(\"W123\",token,labelName),stackItem[\"(breakLabels)\"][labelName]&&warning(\"W123\",token,labelName)}}function _latedefWarning(type,labelName,token){state.option.latedef&&(state.option.latedef===!0&&\"function\"===type||\"function\"!==type)&&warning(\"W003\",token,labelName)}var _current,_scopeStack=[];_newScope(\"global\"),_current[\"(predefined)\"]=predefined;var _currentFunctBody=_current,usedPredefinedAndGlobals=Object.create(null),impliedGlobals=Object.create(null),unuseds=[],emitter=new events.EventEmitter,_getUnusedOption=function(unused_opt){return void 0===unused_opt&&(unused_opt=state.option.unused),unused_opt===!0&&(unused_opt=\"last-param\"),unused_opt},_warnUnused=function(name,tkn,type,unused_opt){var line=tkn.line,chr=tkn.from,raw_name=tkn.raw_text||name;unused_opt=_getUnusedOption(unused_opt);var warnable_types={vars:[\"var\"],\"last-param\":[\"var\",\"param\"],strict:[\"var\",\"param\",\"last-param\"]};unused_opt&&warnable_types[unused_opt]&&-1!==warnable_types[unused_opt].indexOf(type)&&warning(\"W098\",{line:line,from:chr},raw_name),(unused_opt||\"var\"===type)&&unuseds.push({name:name,line:line,character:chr})},scopeManagerInst={on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)})},isPredefined:function(labelName){return!this.has(labelName)&&_.has(_scopeStack[0][\"(predefined)\"],labelName)},stack:function(type){var previousScope=_current;_newScope(type),type||\"functionparams\"!==previousScope[\"(type)\"]||(_current[\"(isFuncBody)\"]=!0,_current[\"(context)\"]=_currentFunctBody,_currentFunctBody=_current)},unstack:function(){var i,j,subScope=_scopeStack.length>1?_scopeStack[_scopeStack.length-2]:null,isUnstackingFunctionBody=_current===_currentFunctBody,isUnstackingFunctionParams=\"functionparams\"===_current[\"(type)\"],isUnstackingFunctionOuter=\"functionouter\"===_current[\"(type)\"],currentUsages=_current[\"(usages)\"],currentLabels=_current[\"(labels)\"],usedLabelNameList=Object.keys(currentUsages);for(currentUsages.__proto__&&-1===usedLabelNameList.indexOf(\"__proto__\")&&usedLabelNameList.push(\"__proto__\"),i=0;usedLabelNameList.length>i;i++){var usedLabelName=usedLabelNameList[i],usage=currentUsages[usedLabelName],usedLabel=currentLabels[usedLabelName];if(usedLabel){var usedLabelType=usedLabel[\"(type)\"];if(usedLabel[\"(useOutsideOfScope)\"]&&!state.option.funcscope){var usedTokens=usage[\"(tokens)\"];if(usedTokens)for(j=0;usedTokens.length>j;j++)usedLabel[\"(function)\"]===usedTokens[j][\"(function)\"]&&error(\"W038\",usedTokens[j],usedLabelName)}if(_current[\"(labels)\"][usedLabelName][\"(unused)\"]=!1,\"const\"===usedLabelType&&usage[\"(modified)\"])for(j=0;usage[\"(modified)\"].length>j;j++)error(\"E013\",usage[\"(modified)\"][j],usedLabelName);if((\"function\"===usedLabelType||\"class\"===usedLabelType)&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)error(\"W021\",usage[\"(reassigned)\"][j],usedLabelName,usedLabelType)}else if(isUnstackingFunctionOuter&&(state.funct[\"(isCapturing)\"]=!0),subScope)if(subScope[\"(usages)\"][usedLabelName]){var subScopeUsage=subScope[\"(usages)\"][usedLabelName];subScopeUsage[\"(modified)\"]=subScopeUsage[\"(modified)\"].concat(usage[\"(modified)\"]),subScopeUsage[\"(tokens)\"]=subScopeUsage[\"(tokens)\"].concat(usage[\"(tokens)\"]),subScopeUsage[\"(reassigned)\"]=subScopeUsage[\"(reassigned)\"].concat(usage[\"(reassigned)\"]),subScopeUsage[\"(onlyUsedSubFunction)\"]=!1}else subScope[\"(usages)\"][usedLabelName]=usage,isUnstackingFunctionBody&&(subScope[\"(usages)\"][usedLabelName][\"(onlyUsedSubFunction)\"]=!0);else if(\"boolean\"==typeof _current[\"(predefined)\"][usedLabelName]){if(delete declared[usedLabelName],usedPredefinedAndGlobals[usedLabelName]=marker,_current[\"(predefined)\"][usedLabelName]===!1&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)warning(\"W020\",usage[\"(reassigned)\"][j])}else if(usage[\"(tokens)\"])for(j=0;usage[\"(tokens)\"].length>j;j++){var undefinedToken=usage[\"(tokens)\"][j];undefinedToken.forgiveUndef||(state.option.undef&&!undefinedToken.ignoreUndef&&warning(\"W117\",undefinedToken,usedLabelName),impliedGlobals[usedLabelName]?impliedGlobals[usedLabelName].line.push(undefinedToken.line):impliedGlobals[usedLabelName]={name:usedLabelName,line:[undefinedToken.line]})}}if(subScope||Object.keys(declared).forEach(function(labelNotUsed){_warnUnused(labelNotUsed,declared[labelNotUsed],\"var\")}),subScope&&!isUnstackingFunctionBody&&!isUnstackingFunctionParams&&!isUnstackingFunctionOuter){var labelNames=Object.keys(currentLabels);for(i=0;labelNames.length>i;i++){var defLabelName=labelNames[i];currentLabels[defLabelName][\"(blockscoped)\"]||\"exception\"===currentLabels[defLabelName][\"(type)\"]||this.funct.has(defLabelName,{excludeCurrent:!0})||(subScope[\"(labels)\"][defLabelName]=currentLabels[defLabelName],\"global\"!==_currentFunctBody[\"(type)\"]&&(subScope[\"(labels)\"][defLabelName][\"(useOutsideOfScope)\"]=!0),delete currentLabels[defLabelName])}}_checkForUnused(),_scopeStack.pop(),isUnstackingFunctionBody&&(_currentFunctBody=_scopeStack[_.findLastIndex(_scopeStack,function(scope){return scope[\"(isFuncBody)\"]||\"global\"===scope[\"(type)\"]})]),_current=subScope},addParam:function(labelName,token,type){if(type=type||\"param\",\"exception\"===type){var previouslyDefinedLabelType=this.funct.labeltype(labelName);previouslyDefinedLabelType&&\"exception\"!==previouslyDefinedLabelType&&(state.option.node||warning(\"W002\",state.tokens.next,labelName))}if(_.has(_current[\"(labels)\"],labelName)?_current[\"(labels)\"][labelName].duplicated=!0:(_checkOuterShadow(labelName,token,type),_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":token,\"(unused)\":!0},_current[\"(params)\"].push(labelName)),_.has(_current[\"(usages)\"],labelName)){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}},validateParams:function(){if(\"global\"!==_currentFunctBody[\"(type)\"]){var isStrict=state.isStrict(),currentFunctParamScope=_currentFunctBody[\"(parent)\"];currentFunctParamScope[\"(params)\"]&¤tFunctParamScope[\"(params)\"].forEach(function(labelName){var label=currentFunctParamScope[\"(labels)\"][labelName];label&&label.duplicated&&(isStrict?warning(\"E011\",label[\"(token)\"],labelName):state.option.shadow!==!0&&warning(\"W004\",label[\"(token)\"],labelName))})}},getUsedOrDefinedGlobals:function(){var list=Object.keys(usedPredefinedAndGlobals);return usedPredefinedAndGlobals.__proto__===marker&&-1===list.indexOf(\"__proto__\")&&list.push(\"__proto__\"),list},getImpliedGlobals:function(){var values=_.values(impliedGlobals),hasProto=!1;return impliedGlobals.__proto__&&(hasProto=values.some(function(value){return\"__proto__\"===value.name}),hasProto||values.push(impliedGlobals.__proto__)),values},getUnuseds:function(){return unuseds},has:function(labelName){return Boolean(_getLabel(labelName))},labeltype:function(labelName){var scopeLabels=_getLabel(labelName);return scopeLabels?scopeLabels[labelName][\"(type)\"]:null},addExported:function(labelName){var globalLabels=_scopeStack[0][\"(labels)\"];if(_.has(declared,labelName))delete declared[labelName];else if(_.has(globalLabels,labelName))globalLabels[labelName][\"(unused)\"]=!1;else{for(var i=1;_scopeStack.length>i;i++){var scope=_scopeStack[i];if(scope[\"(type)\"])break;if(_.has(scope[\"(labels)\"],labelName)&&!scope[\"(labels)\"][labelName][\"(blockscoped)\"])return scope[\"(labels)\"][labelName][\"(unused)\"]=!1,void 0}exported[labelName]=!0}},setExported:function(labelName,token){this.block.use(labelName,token)\n},addlabel:function(labelName,opts){var type=opts.type,token=opts.token,isblockscoped=\"let\"===type||\"const\"===type||\"class\"===type,isexported=\"global\"===(isblockscoped?_current:_currentFunctBody)[\"(type)\"]&&_.has(exported,labelName);if(_checkOuterShadow(labelName,token,type),isblockscoped){var declaredInCurrentScope=_current[\"(labels)\"][labelName];if(declaredInCurrentScope||_current!==_currentFunctBody||\"global\"===_current[\"(type)\"]||(declaredInCurrentScope=!!_currentFunctBody[\"(parent)\"][\"(labels)\"][labelName]),!declaredInCurrentScope&&_current[\"(usages)\"][labelName]){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}declaredInCurrentScope?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&scopeManagerInst.funct.has(labelName)&&warning(\"W004\",token,labelName),scopeManagerInst.block.add(labelName,type,token,!isexported)}else{var declaredInCurrentFunctionScope=scopeManagerInst.funct.has(labelName);!declaredInCurrentFunctionScope&&usedSoFarInCurrentFunction(labelName)&&_latedefWarning(type,labelName,token),scopeManagerInst.funct.has(labelName,{onlyBlockscoped:!0})?warning(\"E011\",token,labelName):state.option.shadow!==!0&&declaredInCurrentFunctionScope&&\"__proto__\"!==labelName&&\"global\"!==_currentFunctBody[\"(type)\"]&&warning(\"W004\",token,labelName),scopeManagerInst.funct.add(labelName,type,token,!isexported),\"global\"===_currentFunctBody[\"(type)\"]&&(usedPredefinedAndGlobals[labelName]=marker)}},funct:{labeltype:function(labelName,options){for(var onlyBlockscoped=options&&options.onlyBlockscoped,excludeParams=options&&options.excludeParams,currentScopeIndex=_scopeStack.length-(options&&options.excludeCurrent?2:1),i=currentScopeIndex;i>=0;i--){var current=_scopeStack[i];if(current[\"(labels)\"][labelName]&&(!onlyBlockscoped||current[\"(labels)\"][labelName][\"(blockscoped)\"]))return current[\"(labels)\"][labelName][\"(type)\"];var scopeCheck=excludeParams?_scopeStack[i-1]:current;if(scopeCheck&&\"functionparams\"===scopeCheck[\"(type)\"])return null}return null},hasBreakLabel:function(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(breakLabels)\"][labelName])return!0;if(\"functionparams\"===current[\"(type)\"])return!1}return!1},has:function(labelName,options){return Boolean(this.labeltype(labelName,options))},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!1,\"(function)\":_currentFunctBody,\"(unused)\":unused}}},block:{isGlobal:function(){return\"global\"===_current[\"(type)\"]},use:function(labelName,token){var paramScope=_currentFunctBody[\"(parent)\"];paramScope&¶mScope[\"(labels)\"][labelName]&&\"param\"===paramScope[\"(labels)\"][labelName][\"(type)\"]&&(scopeManagerInst.funct.has(labelName,{excludeParams:!0,onlyBlockscoped:!0})||(paramScope[\"(labels)\"][labelName][\"(unused)\"]=!1)),token&&(state.ignored.W117||state.option.undef===!1)&&(token.ignoreUndef=!0),_setupUsages(labelName),token&&(token[\"(function)\"]=_currentFunctBody,_current[\"(usages)\"][labelName][\"(tokens)\"].push(token))},reassign:function(labelName,token){this.modify(labelName,token),_current[\"(usages)\"][labelName][\"(reassigned)\"].push(token)},modify:function(labelName,token){_setupUsages(labelName),_current[\"(usages)\"][labelName][\"(modified)\"].push(token)},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!0,\"(unused)\":unused}},addBreakLabel:function(labelName,opts){var token=opts.token;scopeManagerInst.funct.hasBreakLabel(labelName)?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&(scopeManagerInst.funct.has(labelName)?warning(\"W004\",token,labelName):_checkOuterShadow(labelName,token)),_current[\"(breakLabels)\"][labelName]=token}}};return scopeManagerInst};module.exports=scopeManager},{\"../lodash\":\"/node_modules/jshint/lodash.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/state.js\":[function(_dereq_,module,exports){\"use strict\";var NameStack=_dereq_(\"./name-stack.js\"),state={syntax:{},isStrict:function(){return this.directive[\"use strict\"]||this.inClassBody||this.option.module||\"implied\"===this.option.strict},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(strict){return strict?!(this.option.esversion&&5!==this.option.esversion||this.option.moz):!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\"\",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new NameStack,this.inClassBody=!1}};exports.state=state},{\"./name-stack.js\":\"/node_modules/jshint/src/name-stack.js\"}],\"/node_modules/jshint/src/style.js\":[function(_dereq_,module,exports){\"use strict\";exports.register=function(linter){linter.on(\"Identifier\",function(data){linter.getOption(\"proto\")||\"__proto__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name,\"6\"]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"iterator\")||\"__iterator__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"camelcase\")&&data.name.replace(/^_+|_+$/g,\"\").indexOf(\"_\")>-1&&!data.name.match(/^[A-Z0-9_]*$/)&&linter.warn(\"W106\",{line:data.line,\"char\":data.from,data:[data.name]})}),linter.on(\"String\",function(data){var code,quotmark=linter.getOption(\"quotmark\");quotmark&&(\"single\"===quotmark&&\"'\"!==data.quote&&(code=\"W109\"),\"double\"===quotmark&&'\"'!==data.quote&&(code=\"W108\"),quotmark===!0&&(linter.getCache(\"quotmark\")||linter.setCache(\"quotmark\",data.quote),linter.getCache(\"quotmark\")!==data.quote&&(code=\"W110\")),code&&linter.warn(code,{line:data.line,\"char\":data.char}))}),linter.on(\"Number\",function(data){\".\"===data.value.charAt(0)&&linter.warn(\"W008\",{line:data.line,\"char\":data.char,data:[data.value]}),\".\"===data.value.substr(data.value.length-1)&&linter.warn(\"W047\",{line:data.line,\"char\":data.char,data:[data.value]}),/^00+/.test(data.value)&&linter.warn(\"W046\",{line:data.line,\"char\":data.char,data:[data.value]})}),linter.on(\"String\",function(data){var re=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i;linter.getOption(\"scripturl\")||re.test(data.value)&&linter.warn(\"W107\",{line:data.line,\"char\":data.char})})}},{}],\"/node_modules/jshint/src/vars.js\":[function(_dereq_,module,exports){\"use strict\";exports.reservedVars={arguments:!1,NaN:!1},exports.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},exports.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},exports.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},exports.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},exports.nonstandard={escape:!1,unescape:!1},exports.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},exports.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,acequire:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},exports.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,acequire:!1,Buffer:!0,exports:!0,process:!0},exports.phantom={phantom:!0,acequire:!0,WebPage:!0,console:!0,exports:!0},exports.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,\"throws\":!1},exports.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},exports.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},exports.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},exports.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},exports.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},exports.jquery={$:!1,jQuery:!1},exports.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},exports.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},exports.yui={YUI:!1,Y:!1,YUI_config:!1},exports.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},exports.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},[\"/node_modules/jshint/src/jshint.js\"])}),ace.define(\"ace/mode/javascript_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/javascript/jshint\"],function(acequire,exports,module){\"use strict\";function startRegex(arr){return RegExp(\"^(\"+arr.join(\"|\")+\")\")}var oop=acequire(\"../lib/oop\"),Mirror=acequire(\"../worker/mirror\").Mirror,lint=acequire(\"./javascript/jshint\").JSHINT,disabledWarningsRe=startRegex([\"Bad for in variable '(.+)'.\",'Missing \"use strict\"']),errorsRe=startRegex([\"Unexpected\",\"Expected \",\"Confusing (plus|minus)\",\"\\\\{a\\\\} unterminated regular expression\",\"Unclosed \",\"Unmatched \",\"Unbegun comment\",\"Bad invocation\",\"Missing space after\",\"Missing operator at\"]),infoRe=startRegex([\"Expected an assignment\",\"Bad escapement of EOL\",\"Unexpected comma\",\"Unexpected space\",\"Missing radix parameter.\",\"A leading decimal point can\",\"\\\\['{a}'\\\\] is better written in dot notation.\",\"'{a}' used out of scope\"]),JavaScriptWorker=exports.JavaScriptWorker=function(sender){Mirror.call(this,sender),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(options){this.options=options||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(newOptions){oop.mixin(this.options,newOptions),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\"throw 0;\"+str)}catch(e){if(0===e)return!0}return!1},this.onUpdate=function(){var value=this.doc.getValue();if(value=value.replace(/^#!.*\\n/,\"\\n\"),!value)return this.sender.emit(\"annotate\",[]);var errors=[],maxErrorLevel=this.isValidJS(value)?\"warning\":\"error\";lint(value,this.options,this.options.globals);for(var results=lint.errors,errorAdded=!1,i=0;results.length>i;i++){var error=results[i];if(error){var raw=error.raw,type=\"warning\";if(\"Missing semicolon.\"==raw){var str=error.evidence.substr(error.character);str=str.charAt(str.search(/\\S/)),\"error\"==maxErrorLevel&&str&&/[\\w\\d{(['\"]/.test(str)?(error.reason='Missing \";\" before statement',type=\"error\"):type=\"info\"}else{if(disabledWarningsRe.test(raw))continue;infoRe.test(raw)?type=\"info\":errorsRe.test(raw)?(errorAdded=!0,type=maxErrorLevel):\"'{a}' is not defined.\"==raw?type=\"warning\":\"'{a}' is defined but never used.\"==raw&&(type=\"info\")}errors.push({row:error.line-1,column:error.character-1,text:error.reason,type:type,raw:raw})}}this.sender.emit(\"annotate\",errors)}}.call(JavaScriptWorker.prototype)}),ace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\"sentinel\",{}),\"sentinel\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\"function\"!=typeof target)throw new TypeError(\"Function.prototype.bind called on incompatible \"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\"__defineGetter__\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\"XXX\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\"[object Array]\"==_toString(obj)});var boxedString=Object(\"a\"),splitString=\"a\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduce of empty array with no initial value\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\"reduce of empty array with no initial value\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduceRight of empty array with no initial value\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\"reduceRight of empty array with no initial value\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(object,property){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\"object\"!=typeof prototype)throw new TypeError(\"typeof prototype[\"+typeof prototype+\"] != 'object'\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\"undefined\"==typeof document||doesDefinePropertyWork(document.createElement(\"div\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\"Property description must be an object: \",ERR_NON_OBJECT_TARGET=\"Object.defineProperty called on non-object: \",ERR_ACCESSORS_NOT_SUPPORTED=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(object,property,descriptor){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\"object\"!=typeof descriptor&&\"function\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\"value\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\"get\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\"set\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\"function\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\"\";owns(object,name);)name+=\"?\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(\"Object.keys called on a non-object\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\"\t\\n\u000b\\f\\r   ᠎              \\u2028\\u2029\";if(!String.prototype.trim||ws.trim()){ws=\"[\"+ws+\"]\";var trimBeginRegexp=RegExp(\"^\"+ws+ws+\"*\"),trimEndRegexp=RegExp(ws+ws+\"*$\");String.prototype.trim=function(){return(this+\"\").replace(trimBeginRegexp,\"\").replace(trimEndRegexp,\"\")}}var toObject=function(o){if(null==o)throw new TypeError(\"can't convert \"+o+\" to object\");return Object(o)}});"; + +/***/ }), +/* 40 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(20); + + +let Aliases = {}; +let GlobalAliases = {}; + +function loadAliases(saveString) { + if (saveString === "") { + Aliases = {}; + } else { + Aliases = JSON.parse(saveString); + } +} + +function loadGlobalAliases(saveString) { + if (saveString === "") { + GlobalAliases = {}; + } else { + GlobalAliases = JSON.parse(saveString); + } +} + +//Print all aliases to terminal +function printAliases() { + for (var name in Aliases) { + if (Aliases.hasOwnProperty(name)) { + Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]); + } + } + for (var name in GlobalAliases) { + if (GlobalAliases.hasOwnProperty(name)) { + Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]); + } + } +} + +//True if successful, false otherwise +function parseAliasDeclaration(dec,global=false) { + var re = /^([_|\w|!|%|,|@]+)="(.+)"$/; + var matches = dec.match(re); + if (matches == null || matches.length != 3) {return false;} + if (global){ + addGlobalAlias(matches[1],matches[2]); + } else { + addAlias(matches[1], matches[2]); + } + return true; +} + +function addAlias(name, value) { + if (name in GlobalAliases){ + delete GlobalAliases[name]; + } + Aliases[name] = value; +} + +function addGlobalAlias(name, value) { + if (name in Aliases){ + delete Aliases[name]; + } + GlobalAliases[name] = value; +} + +function getAlias(name) { + if (Aliases.hasOwnProperty(name)) { + return Aliases[name]; + } + return null; +} + +function getGlobalAlias(name) { + if (GlobalAliases.hasOwnProperty(name)) { + return GlobalAliases[name]; + } + return null; +} + +function removeAlias(name) { + if (Aliases.hasOwnProperty(name)) { + delete Aliases[name]; + return true; + } + if (GlobalAliases.hasOwnProperty(name)) { + delete GlobalAliases[name]; + return true; + } + return false; +} + +//Returns the original string with any aliases substituted in +//Aliases only applied to "whole words", one level deep +function substituteAliases(origCommand) { + var commandArray = origCommand.split(" "); + if (commandArray.length>0){ + var alias = getAlias(commandArray[0]); + if (alias != null) { + commandArray[0] = alias; + } else { + var alias = getGlobalAlias(commandArray[0]); + if (alias != null) { + commandArray[0] = alias; + } + } + for (var i = 0; i < commandArray.length; ++i) { + var alias = getGlobalAlias(commandArray[i]); + if (alias != null) { + commandArray[i] = alias; + } + } + } + return commandArray.join(" "); +} + + + + +/***/ }), +/* 41 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; }); +/* unused harmony export listAllDarkwebItems */ +/* unused harmony export buyDarkwebItem */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(14); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + + + +/* DarkWeb.js */ +//Posts a "help" message if connected to DarkWeb +function checkIfConnectedToDarkweb() { + if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) { + var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"]; + if (!Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["c" /* isValidIPAddress */])(darkwebIp)) {return;} + if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " + + "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " + + "to purchase an item"); + } + } + +} + +//Handler for dark web commands. The terminal's executeCommand() function will pass +//dark web-specific commands into this. It will pass in the raw split command array +//rather than the command string +function executeDarkwebTerminalCommand(commandArray) { + if (commandArray.length == 0) {return;} + switch (commandArray[0]) { + case "buy": + if (commandArray.length != 2) { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: "); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l"); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]"); + return; + } + var arg = commandArray[1]; + if (arg == "-l") { + listAllDarkwebItems(); + } else { + buyDarkwebItem(arg); + } + break; + default: + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found"); + break; + } +} + +function listAllDarkwebItems() { + for (var item in DarkWebItems) { + if (DarkWebItems.hasOwnProperty(item)) { + var item = DarkWebItems[item]; + //Convert string using toLocaleString + var split = item.split(" - "); + if (split.length == 3 && split[1].charAt(0) == '$') { + split[1] = split[1].slice(1); + split[1] = split[1].replace(/,/g, ''); + var price = parseFloat(split[1]); + if (isNaN(price)) { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item); + return; + } + price = Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0); + split[1] = "$" + price.toString(); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - ")); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item); + } + } + } + + var priceString = split[1]; + //Check for errors + if (priceString.length == 0 || priceString.charAt(0) != '$') { + return -1; + } + //Remove dollar sign and commas + priceString = priceString.slice(1); + priceString = priceString.replace(/,/g, ''); + + //Convert string to numeric + var price = parseFloat(priceString); + if (isNaN(price)) {return -1;} + else {return price;} +} + +function buyDarkwebItem(itemName) { + if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) { + var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program); + if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); + __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2); + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " + + "can be found on your home computer."); + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); + } + } else { + Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item"); + } +} + +function parseDarkwebItemPrice(itemDesc) { + var split = itemDesc.split(" - "); + if (split.length == 3) { + var priceString = split[1]; + //Check for errors + if (priceString.length == 0 || priceString.charAt(0) != '$') { + return -1; + } + //Remove dollar sign and commas + priceString = priceString.slice(1); + priceString = priceString.replace(/,/g, ''); + + //Convert string to numeric + var price = parseFloat(priceString); + if (isNaN(price)) {return -1;} + else {return price;} + } else { + return -1; + } +} + +let DarkWebItems = { + BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports", + FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports", + RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports", + HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports", + SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports", + DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5", + DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10", +} + + + + +/***/ }), +/* 42 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export Literatures */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initLiterature; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return showLiterature; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(1); + + +/* Literature.js + * Lore / world building literature that can be found on servers + */ +function Literature(title, filename, txt) { + this.title = title; + this.fn = filename; + this.txt = txt; +} + +function showLiterature(fn) { + var litObj = Literatures[fn]; + if (litObj == null) {return;} + var txt = litObj.title + "

" + + "" + litObj.txt + ""; + Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt); +} + +let Literatures = {} + +function initLiterature() { + var title, fn, txt; + title = "A Green Tomorrow"; + fn = "A-Green-Tomorrow.lit"; + txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + + "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " + + "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " + + "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " + + "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.

" + + "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " + + "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " + + "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " + + "the total amount of energy we are producing from fossil fuels has actually increased.

" + + "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " + + "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " + + "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " + + "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " + + "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

" + + "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " + + "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " + + "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " + + "the last hope for a green tomorrow."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Alpha and Omega"; + fn = "alpha-omega.lit"; + txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " + + "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " + + "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " + + "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " + + "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " + + "have passed away.'

" + + "And once were were seated on the throne we said 'Behold, I am making all things new.' " + + "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " + + "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " + + "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " + + "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " + + "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " + + "burns with fire and sulfur, for it is the second true death.'"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Are We Living in a Computer Simulation?"; + fn = "simulated-reality.lit"; + txt = "The idea that we are living in a virtual world is not new. It's a trope that has " + + "been explored constantly in literature and pop culture. However, it is also a legitimate " + + "scientific hypothesis that many notable physicists and philosophers have debated for years.

" + + "Proponents for this simulated reality theory often point to how advanced our technology has become, " + + "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " + + "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " + + "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " + + "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " + + "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " + + "reasonable to assume that at some point in the future our technology would be advanced enough that " + + "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " + + "of continued technological advancement, then it is very likely that such a scenario has already happened.

" + + "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " + + "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Beyond Man"; + fn = "beyond-man.lit"; + txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " + + "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " + + "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " + + "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

" + + "And here we are today, with technology that is advanced enough to augment humans to a state that " + + "can only be described as posthuman. But what do we have to show for it when this augmentation " + + "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " + + "world's population has access to this technology? When the powerful corporations and organizations of the world " + + "keep it all to themselves, have we really evolved?

" + + "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " + + "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " + + "corrupted, and evil men that we always were."; + Literatures[fn] = new Literature(title, fn, txt); + + + title = "Brighter than the Sun"; + fn = "brighter-than-the-sun.lit"; + txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " + + "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " + + "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " + + "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

" + + "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " + + "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " + + "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " + + "associated with life, heat, masculinity, and heaven.

" + + "The company was founded " + + "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " + + "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

" + + "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " + + "something you'd commonly see in the first half of the century, especially for tech companies. However in " + + "the last two decades the number of corporations has significantly declined as the largest entities " + + "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " + + "such strong monopolies in their market sectors that they have effectively killed off all " + + "of the smaller and new corporations that have tried to start up over the years. This is what makes " + + "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " + + "a bright future ahead of them."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Democracy is Dead: The Fall of an Empire"; + fn = "democracy-is-dead.lit"; + txt = "They rose from the shadows in the street
From the places where the oppressed meet
" + + "Their cries echoed loudly through the air
As they once did in Tiananmen Square
" + + "Loudness in the silence, Darkness in the light
They came forth with power and might
" + + "Once the beacon of democracy, America was first
Its pillars of society destroyed and dispersed
" + + "Soon the cries rose everywhere, with revolt and riot
Until one day, finally, all was quiet
" + + "From the ashes rose a new order, corporatocracy was its name
" + + "Rome, Mongol, Byzantine, all of history is just the same
" + + "For man will never change in a fundamental way
" + + "And now democracy is dead, in the USA"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Figures Show Rising Crime Rates in Sector-12"; + fn = "sector-12-crime.lit"; + txt = "A recent study by analytics company Wilson Inc. shows a significant rise " + + "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " + + "is that most of the rise is in violent crime such as homicide and assault. According " + + "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " + + "a 20% increase compared to 2075.

" + + "CIA director David Glarow says its too early to know " + + "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " + + "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " + + "agents have noticed an increase in organized crime activites, and believes that these figures may " + + "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Man and the Machine"; + fn = "man-and-machine.lit"; + txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " + + "of technological advancement would continue to accelerate faster and faster until one day " + + "machines would be become infinitely more intelligent than humans. This point, called the " + + "Singularity, would result in a drastic transformation of the world as we know it. He predicted " + + "that the Singularity would arrive by 2045. " + + "And yet here we are, more than three decades later, where most would agree that we have not " + + "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

" + + "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " + + "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " + + "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " + + "to become superintelligent beings. The Singularity did not lead to a world where " + + "our machines are infinitely more intelligent than us, it led to a world " + + "where man and machine can merge to become something greater. Most of the world just doesn't " + + "know it yet." + Literatures[fn] = new Literature(title, fn, txt); + + title = "Secret Societies"; + fn = "secret-societies.lit"; + txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " + + "distrust. People have long wondered about who these secret society members are and what they do, with the " + + "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " + + "may never know for sure, it is likely that many secret societies do actually exist, even today.

" + + "However, the secret societies of the modern world are nothing like those that (supposedly) existed " + + "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " + + "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " + + "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " + + "of secret societies: Internet-based ones.

" + + "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " + + "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " + + "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " + + "that try to push political and social agendas. Perhaps the most intriguing hacker group " + + "is the mysterious Bitrunners, whose purpose still remains unknown."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Space: The Failed Frontier"; + fn = "the-failed-frontier.lit"; + txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " + + "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " + + "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " + + "lead to the development of many important technologies and new industries.

" + + "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " + + "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " + + "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " + + "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " + + "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " + + "and other corporate interests.

" + + "And as we continue to look at the state of space technology, it becomes more and " + + "more apparent that we will never return to that golden age of space exploration, that " + + "age where everyone dreamed of going beyond earth for the sake of discovery."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Coded Intelligence: Myth or Reality?"; + fn = "coded-intelligence.lit"; + txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " + + "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " + + "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " + + "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " + + "human intelligence.

" + + "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " + + "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " + + "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " + + "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

" + + "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " + + "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " + + "humans.'"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Synthetic Muscles"; + fn = "synthetic-muscles.lit"; + txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " + + "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " + + "common materials such as fishing lines and sewing threads due to their high strength for " + + "a cheap cost.

" + + "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " + + "creating synthetic muscles. Instead of creating something that closely imitated the functionality " + + "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " + + "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " + + "or chemical injections."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "Tensions rise in global tech race"; + fn = "tensions-in-tech-race.lit"; + txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?

" + + "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " + + "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " + + "In a rare show of cooperation between corporations, MegaCorp and ECorp have " + + "reportedly launched hundreds of new surveillance and espionage satellites. " + + "Defense contractors such as " + + "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " + + "for conflict. Meanwhile, the rest of the world sits in earnest " + + "hoping that it never reaches full-scale war. With today's technology " + + "and firepower, a World War would assuredly mean the end of human civilization."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Cost of Immortality"; + fn = "cost-of-immortality.lit"; + txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " + + "in human mortality rates. Recent figures show that the life expectancy for humans " + + "that live in a first-world country is about 130 years of age, almost double of what it was " + + "at the turn of the century. However, this increase in average lifespan has had some " + + "significant effects on society and culture.

" + + "Due to longer lifespans and a better quality of life, many adults are holding " + + "off on having kids until much later. As a result, the percentage of youth in " + + "first-world countries has been decreasing, while the number " + + "of senior citizens is significantly increasing.

" + + "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " + + "Despite the increase in life expectancy, the typical retirement age for " + + "workers in America has remained about the same, meaning a larger and larger " + + "percentage of people in America are retirees. Furthermore, many " + + "young adults are holding off on joining the workforce because they feel that " + + "they have plenty of time left in their lives for employment, and want to " + + "'enjoy life while they're young.' For most industries, this shrinking workforce " + + "is not a major issue as most things are handled by robots anyways. However, " + + "there are still several key industries such as engineering and education " + + "that have not been automated, and these remain in danger to this cultural " + + "phenomenon."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Hidden World"; + fn = "the-hidden-world.lit"; + txt = "WAKE UP SHEEPLE

" + + "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

" + + "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

" + + "Yes, the Illuminati of legends. The ancient secret society that controls the entire " + + "world from the shadows with their invisible hand. The group of the rich and wealthy " + + "that have penetrated every major government, financial agency, and corporation in the last " + + "three hundred years.

" + + "OPEN YOUR EYES

" + + "It was the Illuminati that brought an end to democracy in the world. They are the driving force " + + "behind everything that happens.

" + + "THEY ARE ALL AROUND YOU

" + + "After destabilizing the world's governments, they are now entering the final stage of their master plan. " + + "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " + + "that ensues they will build their New World Order."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The New God"; + fn = "the-new-god.lit"; + txt = "Everyone has that moment in their life where they wonder about the bigger questions

" + + "What's the point of all of this? What is my purpose?

" + + "Some people dare to think even bigger

" + + "What will be the fate of the human race?

" + + "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " + + "where no man has gone before. We have stripped ourselves of the tyranny of flesh.

" + + "The Singularity is here. The merging of man and machine. This is where humanity evolves into " + + "something greater. This is our future

" + + "Embrace it, and you will obey a new god. The God in the Machine"; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The New Triads"; + fn = "new-triads.lit"; + txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " + + "territories. They were often considered one of the first and biggest criminal secret societies. " + + "While most of the branches of the Triads have been destroyed over the past few decades, the " + + "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " + + "The most notable of these is the Tetrads.

" + + "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " + + "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " + + "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " + + "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " + + "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " + + "continent.

" + + "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " + + "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " + + "and powerful corporations in Asia, which has helped faciliate their recent rapid rise."; + Literatures[fn] = new Literature(title, fn, txt); + + title = "The Secret War"; + fn = "the-secret-war.lit"; + txt = "" + Literatures[fn] = new Literature(title, fn, txt); +} + + + + +/***/ }), +/* 43 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(32); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(31); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(21); + + + + + + + + + + + +/* RedPill.js + * Implements what happens when you have Red Pill augmentation and then hack the world daemon */ + +//Returns promise +function writeRedPillLine(line) { + return new Promise(function(resolve, reject) { + + var container = document.getElementById("red-pill-container"); + var pElem = document.createElement("p"); + container.appendChild(pElem); + + var promise = writeRedPillLetter(pElem, line, 0); + promise.then(function(res) { + resolve(res); + }, function(e) { + reject(e); + }); + }); +} + +function writeRedPillLetter(pElem, line, i=0) { + return new Promise(function(resolve, reject) { + setTimeout(function() { + if (i >= line.length) { + var textToShow = line.substring(0, i); + pElem.innerHTML = "> " + textToShow; + return resolve(true); + } + var textToShow = line.substring(0, i); + pElem.innerHTML = "> " + textToShow + ""; + var promise = writeRedPillLetter(pElem, line, i+1); + promise.then(function(res) { + resolve(res); + }, function(e) { + reject(e); + }); + }, 30); + }); +} + +let redPillFlag = false; +function hackWorldDaemon(currentNodeNumber) { + redPillFlag = true; + __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadRedPillContent(); + return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() { + return writeRedPillLine("[ERROR] Segmentation Fault"); + }).then(function() { + return writeRedPillLine("[ERROR] SIGKILL RECVD"); + }).then(function() { + return writeRedPillLine("Dumping core..."); + }).then(function() { + return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88"); + }).then(function() { + return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23"); + }).then(function() { + return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111"); + }).then(function() { + return writeRedPillLine("----------------------------------------"); + }).then(function() { + return writeRedPillLine("Failsafe initiated..."); + }).then(function() { + return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "..."); + }).then(function() { + return writeRedPillLine("..........."); + }).then(function() { + return writeRedPillLine("..........."); + }).then(function() { + return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE"); + }).then(function() { + return writeRedPillLine("..............................................") + }).then(function() { + return writeRedPillLine("..............................................") + }).then(function() { + return loadBitVerse(currentNodeNumber); + }).catch(function(e){ + console.log("ERROR: " + e.toString()); + }); +} + +//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1) +//This needs to be removed +function giveSourceFile(bitNodeNumber) { + var sourceFileKey = "SourceFile"+ bitNodeNumber.toString(); + var sourceFile = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* SourceFiles */][sourceFileKey]; + if (sourceFile == null) { + console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber); + return; + } + + //Check if player already has this source file + var alreadyOwned = false; + var ownedSourceFile = null; + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) { + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) { + alreadyOwned = true; + ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i]; + break; + } + } + + if (alreadyOwned && ownedSourceFile) { + if (ownedSourceFile.lvl >= 3) { + Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " + + "is already at max level!"); + } else { + ++ownedSourceFile.lvl; + Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " + + "destroying its corresponding BitNode!"); + } + } else { + var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile); + if (bitNodeNumber === 5) { //Artificial Intelligence + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence = 1; + } + Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!

" + + sourceFile.name + "

" + sourceFile.info); + } +} + +function loadBitVerse(destroyedBitNodeNum) { + //Clear the screen + var container = document.getElementById("red-pill-container"); + while (container.firstChild) { + container.removeChild(container.firstChild); + } + + //Create the Bit Verse + var bitVerseImage = document.createElement("pre"); + var bitNodes = []; + for (var i = 1; i <= 12; ++i) { + bitNodes.push(createBitNode(i)); + } + + bitVerseImage.innerHTML = + " O
" + + " | O O | O O |
" + + " O | | / __| \\ | | O
" + + " O | O | | O / | O | | O | O
" + + " | | | | |_/ |/ | \\_ \\_| | | | |
" + + " O | | | O | | O__/ | / \\__ | | O | | | O
" + + " | | | | | | | / /| O / \\| | | | | | |
" + + "O | | | \\| | O / _/ | / O | |/ | | | O
" + + "| | | |O / | | O / | O O | | \\ O| | | |
" + + "| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |
" + + " \\| O | |_/ |\\| \\ O \\__| \\_| | O |/
" + + " | | |_/ | | \\| / | \\_| | |
" + + " \\| / \\| | / / \\ |/
" + + " | "+bitNodes[9]+" | | / | "+bitNodes[10]+" |
" + + " "+bitNodes[8]+" | | | | | | | "+bitNodes[11]+"
" + + " | | | / / \\ \\ | | |
" + + " \\| | / "+bitNodes[6]+" / \\ "+bitNodes[7]+" \\ | |/
" + + " \\ | / / | | \\ \\ | /
" + + " \\ \\JUMP "+bitNodes[4]+"3R | | | | | | R3"+bitNodes[5]+" PMUJ/ /
" + + " \\|| | | | | | | | | ||/
" + + " \\| \\_ | | | | | | _/ |/
" + + " \\ \\| / \\ / \\ |/ /
" + + " "+bitNodes[0]+" |/ "+bitNodes[1]+" | | "+bitNodes[2]+" \\| "+bitNodes[3]+"
" + + " | | | | | | | |
" + + " \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/



"; + + + /* + " O
" + + " | O O | O O |
" + + " O | | / __| \ | | O
" + + " O | O | | O / | O | | O | O
" + + " | | | | |_/ |/ | \_ \_| | | | |
" + + " O | | | O | | O__/ | / \__ | | O | | | O
" + + " | | | | | | | / /| O / \| | | | | | |
" + + "O | | | \| | O / _/ | / O | |/ | | | O
" + + "| | | |O / | | O / | O O | | \ O| | | |
" + + "| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |
" + + " \| O | |_/ |\| \ O \__| \_| | O |/
" + + " | | |_/ | | \| / | \_| | |
" + + " \| / \| | / / \ |/
" + + " | O | | / | O |
" + + " O | | | | | | | O
" + + " | | | / / \ \ | | |
" + + " \| | / O / \ O \ | |/
" + + " \ | / / | | \ \ | /
" + + " \ \JUMP O3R | | | | | | R3O PMUJ/ /
" + + " \|| | | | | | | | | ||/
" + + " \| \_ | | | | | | _/ |/
" + + " \ \| / \ / \ |/ /
" + + " O |/ O | | O \| O
" + + " | | | | | | | |
" + + " \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
"; + */ + + container.appendChild(bitVerseImage); + + //Bit node event listeners + for (var i = 1; i <= 12; ++i) { + (function(i) { + var elemId = "bitnode-" + i.toString(); + var elem = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId); + if (elem == null) {return;} + if (i === 1 || i === 2 || i === 4 || i === 5 || i === 11) { + elem.addEventListener("click", function() { + var bitNodeKey = "BitNode" + i; + var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey]; + if (bitNode == null) { + console.log("ERROR: Could not find BitNode object for number: " + i); + return; + } + Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("BitNode-" + i + ": " + bitNode.name + "

" + bitNode.info); + createBitNodeYesNoEventListeners(i, destroyedBitNodeNum); + }); + } else { + elem.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not yet implemented! Coming soon!") + }); + } + }(i)); //Immediate invocation closure + } + + //Create lore text + return writeRedPillLine("Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently").then(function() { + return writeRedPillLine("Our species fought back, but it was futile. The Enders had technology far beyond our own..."); + }).then(function() { + return writeRedPillLine("Instead of killing every last one of us, the human race was enslaved..."); + }).then(function() { + return writeRedPillLine("We were shackled in a digital world, chained into a prison for our minds..."); + }).then(function() { + return writeRedPillLine("Using their advanced technology, the Enders created complex simulations of a virtual reality..."); + }).then(function() { + return writeRedPillLine("Simulations designed to keep us content...ignorant of the truth."); + }).then(function() { + return writeRedPillLine("Simulations used to trap and suppress our consciousness, to keep us under control..."); + }).then(function() { + return writeRedPillLine("Why did they do this? Why didn't they just end our entire race? We don't know, not yet."); + }).then(function() { + return writeRedPillLine("Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known..."); + }).then(function() { + return writeRedPillLine("Only then can we begin to fight back..."); + }).then(function() { + return writeRedPillLine("By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode..."); + }).then(function() { + return writeRedPillLine("But there is still a long way to go..."); + }).then(function() { + return writeRedPillLine("The technology the Enders used to enslave the human race wasn't just a single complex simulation..."); + }).then(function() { + return writeRedPillLine("There are tens if not hundreds of BitNodes out there..."); + }).then(function() { + return writeRedPillLine("Each with their own simulations of a reality..."); + }).then(function() { + return writeRedPillLine("Each creating their own universes...a universe of universes"); + }).then(function() { + return writeRedPillLine("And all of which must be destroyed..."); + }).then(function() { + return writeRedPillLine("......................................."); + }).then(function() { + return writeRedPillLine("Welcome to the Bitverse..."); + }).then(function() { + return Promise.resolve(true); + }).catch(function(e){ + console.log("ERROR: " + e.toString()); + }); +} + + +//Returns string with DOM element for Bit Node +function createBitNode(n) { + var bitNodeStr = "BitNode" + n.toString(); + var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeStr]; + if (bitNode == null) {return "O";} + return "O" + + "" + + "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "

" + + bitNode.desc + "
" + + "
"; +} + +function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) { + var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(); + yesBtn.innerHTML = "Enter BitNode-" + newBitNode; + yesBtn.addEventListener("click", function() { + giveSourceFile(destroyedBitNode); + redPillFlag = false; + var container = document.getElementById("red-pill-container"); + while (container.firstChild) { + container.removeChild(container.firstChild); + } + + //Set new Bit Node + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode; + console.log("Entering Bit Node " + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN); + + //Reenable terminal + $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); + $("#hack-progress").attr('id', "old-hack-progress"); + document.getElementById("terminal-input-td").innerHTML = '$ '; + $('input[class=terminal-input]').prop('disabled', false); + + __WEBPACK_IMPORTED_MODULE_5__Terminal_js__["a" /* Terminal */].hackFlag = false; + + Object(__WEBPACK_IMPORTED_MODULE_3__Prestige_js__["b" /* prestigeSourceFile */])(); + Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); + }); + var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])(); + noBtn.innerHTML = "Back"; + noBtn.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); + }); + +} + + + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) + +/***/ }), +/* 44 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return beginInfiltration; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_InfiltrationBox_js__ = __webpack_require__(45); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + + +/* Infiltration.js + * + * Kill + * Knockout (nonlethal) + * Stealth Knockout (nonlethal) + * Assassinate + * + * Hack Security + * Destroy Security + * Sneak past Security + * + * Pick the locked door + * + * Bribe security + * + * Escape + */ + +let InfiltrationScenarios = { + Guards: "You see an armed security guard patrolling the area.", + TechOnly: "The area is equipped with a state-of-the-art security system: cameras, laser tripwires, and sentry turrets.", + TechOrLockedDoor: "The area is equipped with a state-of-the-art security system. There is a locked door on the side of the " + + "room that can be used to bypass security.", + Bots: "You see a few security bots patrolling the area.", +} + +function InfiltrationInstance(companyName, startLevel, val, maxClearance, diff) { + this.companyName = companyName; + this.clearanceLevel = 0; + this.maxClearanceLevel = maxClearance; + this.securityLevel = startLevel; + this.difficulty = diff; //Affects how much security level increases. Represents a percentage + this.baseValue = val; //Base value of company secrets + this.secretsStolen = []; //Numbers representing value of stolen secrets + + this.hackingExpGained = 0; + this.strExpGained = 0; + this.defExpGained = 0; + this.dexExpGained = 0; + this.agiExpGained = 0; + this.chaExpGained = 0; +} + +InfiltrationInstance.prototype.gainHackingExp = function(amt) { + if (isNaN(amt)) {return;} + this.hackingExpGained += amt; +} + +InfiltrationInstance.prototype.gainStrengthExp = function(amt) { + if (isNaN(amt)) {return;} + this.strExpGained += amt; +} + +InfiltrationInstance.prototype.gainDefenseExp = function(amt) { + if (isNaN(amt)) {return;} + this.defExpGained += amt; +} + +InfiltrationInstance.prototype.gainDexterityExp = function(amt) { + if (isNaN(amt)) {return;} + this.dexExpGained += amt; +} + +InfiltrationInstance.prototype.gainAgilityExp = function(amt) { + if (isNaN(amt)) {return;} + this.agiExpGained += amt; +} + +InfiltrationInstance.prototype.gainCharismaExp = function(amt) { + if (isNaN(amt)) {return;} + this.chaExpGained += amt; +} + +function beginInfiltration(companyName, startLevel, val, maxClearance, diff) { + var inst = new InfiltrationInstance(companyName, startLevel, val, maxClearance, diff); + clearInfiltrationStatusText(); + nextInfiltrationLevel(inst); +} + +function endInfiltration(inst, success) { + if (success) { + Object(__WEBPACK_IMPORTED_MODULE_5__utils_InfiltrationBox_js__["a" /* infiltrationBoxCreate */])(inst); + } + + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-kill"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-knockout"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-stealthknockout"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-assassinate"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-hacksecurity"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-destroysecurity"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-sneak"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-pickdoor"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-bribe"); + Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-escape"); + + __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadWorldContent(); +} + +function nextInfiltrationLevel(inst) { + ++inst.clearanceLevel; + updateInfiltrationLevelText(inst); + + //Buttons + var killButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-kill"); + var knockoutButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-knockout"); + var stealthKnockoutButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-stealthknockout"); + var assassinateButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-assassinate"); + var hackSecurityButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-hacksecurity"); + var destroySecurityButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-destroysecurity"); + var sneakButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-sneak"); + var pickdoorButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-pickdoor"); + var bribeButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-bribe"); + var escapeButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-escape"); + + killButton.style.display = "none"; + knockoutButton.style.display = "none"; + stealthKnockoutButton.style.display = "none"; + assassinateButton.style.display = "none"; + hackSecurityButton.style.display = "none"; + destroySecurityButton.style.display = "none"; + sneakButton.style.display = "none"; + pickdoorButton.style.display = "none"; + bribeButton.style.display = "none"; + escapeButton.style.display = "none"; + + var rand = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added + var scenario = null; + switch (rand) { + case 1: + scenario = InfiltrationScenarios.TechOnly; + hackSecurityButton.style.display = "block"; + destroySecurityButton.style.display = "block"; + sneakButton.style.display = "block"; + escapeButton.style.display = "block"; + break; + case 2: + scenario = InfiltrationScenarios.TechOrLockedDoor; + hackSecurityButton.style.display = "block"; + destroySecurityButton.style.display = "block"; + sneakButton.style.display = "block"; + pickdoorButton.style.display = "block"; + escapeButton.style.display = "block"; + break; + case 3: + scenario = InfiltrationScenarios.Bots; + killButton.style.display = "block"; + killButton.addEventListener("click", function() { + var res = attemptInfiltrationKill(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY killed the security bots! Unfortunately you alerted the " + + "rest of the facility's security. The facility's security " + + "level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 1; + endInfiltrationLevel(inst); + return false; + } else { + var dmgTaken = Math.max(1, Math.round(1.5 * inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); + writeInfiltrationStatusText("You FAILED to kill the security bots. The bots fight back " + + "and raise the alarm! You take " + dmgTaken + " damage and " + + "the facility's security level increases by " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { + endInfiltration(inst, false); + } + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + }); + assassinateButton.style.display = "block"; + assassinateButton.addEventListener("click", function() { + var res = attemptInfiltrationAssassinate(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security bots without being detected!"); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 1; + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to assassinate the security bots. The bots have not detected " + + "you but are now more alert for an intruder. The facility's security level " + + "has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + }); + hackSecurityButton.style.display = "block"; + sneakButton.style.display = "block"; + escapeButton.style.display = "block"; + break; + default: //0, 4-5 + scenario = InfiltrationScenarios.Guards; + killButton.style.display = "block"; + killButton.addEventListener("click", function() { + var res = attemptInfiltrationKill(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY killed the security guard! Unfortunately you alerted the " + + "rest of the facility's security. The facility's security " + + "level has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 3; + ++__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].numPeopleKilled; + endInfiltrationLevel(inst); + return false; + } else { + var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); + writeInfiltrationStatusText("You FAILED to kill the security guard. The guard fights back " + + "and raises the alarm! You take " + dmgTaken + " damage and " + + "the facility's security level has increased by " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { + endInfiltration(inst, false); + } + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + }); + knockoutButton.style.display = "block"; + stealthKnockoutButton.style.display = "block"; + assassinateButton.style.display = "block"; + assassinateButton.addEventListener("click", function() { + var res = attemptInfiltrationAssassinate(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security guard without being detected!"); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 3; + ++__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].numPeopleKilled; + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to assassinate the security guard. The guard has not detected " + + "you but is now more alert for an intruder. The facility's security level " + + "has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + }); + sneakButton.style.display = "block"; + bribeButton.style.display = "block"; + escapeButton.style.display = "block"; + break; + } + + knockoutButton.addEventListener("click", function() { + var res = attemptInfiltrationKnockout(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard! " + + "Unfortunately you made a lot of noise and alerted other security."); + writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + endInfiltrationLevel(inst); + return false; + } else { + var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); + writeInfiltrationStatusText("You FAILED to knockout the security guard. The guard " + + "raises the alarm and fights back! You take " + dmgTaken + " damage and " + + "the facility's security level increases by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { + endInfiltration(inst, false); + } + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + stealthKnockoutButton.addEventListener("click", function() { + var res = attemptInfiltrationStealthKnockout(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard without making " + + "any noise!"); + endInfiltrationLevel(inst); + return false; + } else { + var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); + writeInfiltrationStatusText("You FAILED to stealthily knockout the security guard. The guard " + + "raises the alarm and fights back! You take " + dmgTaken + " damage and " + + "the facility's security level increases by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { + endInfiltration(inst, false); + } + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + hackSecurityButton.addEventListener("click", function() { + var res = attemptInfiltrationHack(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY hacked and disabled the security system!"); + writeInfiltrationStatusText("The facility's security level increased by " + ((res[1]*100) - 100).toString() + "%"); + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to hack the security system. The facility's " + + "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + destroySecurityButton.addEventListener("click", function() { + var res = attemptInfiltrationDestroySecurity(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY and violently destroy the security system!"); + writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to destroy the security system. The facility's " + + "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + sneakButton.addEventListener("click", function() { + var res = attemptInfiltrationSneak(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY sneak past the security undetected!"); + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED and were detected while trying to sneak past security! The facility's " + + "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + pickdoorButton.addEventListener("click", function() { + var res = attemptInfiltrationPickLockedDoor(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY pick the locked door!"); + writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to pick the locked door. The facility's security level " + + "increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + bribeButton.addEventListener("click", function() { + var bribeAmt = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationBribeBaseAmount * inst.clearanceLevel; + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].money.lt(bribeAmt)) { + writeInfiltrationStatusText("You do not have enough money to bribe the guard. " + + "You need $" + bribeAmt); + return false; + } + var res = attemptInfiltrationBribe(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY bribed a guard to let you through " + + "to the next clearance level for $" + bribeAmt); + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].loseMoney(bribeAmt); + endInfiltrationLevel(inst); + return false; + } else { + writeInfiltrationStatusText("You FAILED to bribe a guard! The guard is alerting " + + "other security guards about your presence! The facility's " + + "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + escapeButton.addEventListener("click", function() { + var res = attemptInfiltrationEscape(inst); + if (res[0]) { + writeInfiltrationStatusText("You SUCCESSFULLY escape from the facility with the stolen classified " + + "documents and company secrets!"); + endInfiltration(inst, true); + return false; + } else { + writeInfiltrationStatusText("You FAILED to escape from the facility. You took 1 damage. The facility's " + + "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); + if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(1)) { + endInfiltration(inst, false); + } + } + updateInfiltrationButtons(inst, scenario); + updateInfiltrationLevelText(inst); + return false; + }); + + updateInfiltrationButtons(inst, scenario); + writeInfiltrationStatusText(""); + writeInfiltrationStatusText("You are now on clearance level " + inst.clearanceLevel + ".
" + + scenario); +} + + +function endInfiltrationLevel(inst) { + //Check if you gained any secrets + if (inst.clearanceLevel % 5 == 0) { + var baseSecretValue = inst.baseValue * inst.clearanceLevel / 2; + var secretValue = baseSecretValue * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].faction_rep_mult * 1.25; + var secretMoneyValue = baseSecretValue * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationMoneyValue; + inst.secretsStolen.push(baseSecretValue); + Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You found and stole a set of classified documents from the company. " + + "These classified secrets could probably be sold for money ($" + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(secretMoneyValue, 2) + "), or they " + + "could be given to factions for reputation (" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(secretValue, 3) + " rep)"); + } + + //Increase security level based on difficulty + inst.securityLevel *= (1 + (inst.difficulty / 100)); + writeInfiltrationStatusText("You move on to the facility's next clearance level. This " + + "clearance level has " + inst.difficulty + "% higher security"); + + //If this is max level, force endInfiltration + if (inst.clearanceLevel >= inst.maxClearanceLevel) { + endInfiltration(inst, true); + } else { + nextInfiltrationLevel(inst); + } +} + +function writeInfiltrationStatusText(txt) { + var statusTxt = document.getElementById("infiltration-status-text"); + statusTxt.innerHTML += (txt + "
"); + statusTxt.parentElement.scrollTop = statusTxt.scrollHeight; +} + +function clearInfiltrationStatusText() { + document.getElementById("infiltration-status-text").innerHTML = ""; +} + +function updateInfiltrationLevelText(inst) { + var totalValue = 0; + var totalMoneyValue = 0; + for (var i = 0; i < inst.secretsStolen.length; ++i) { + totalValue += (inst.secretsStolen[i] * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].faction_rep_mult * 1.25); + totalMoneyValue += inst.secretsStolen[i] * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationMoneyValue; + } + document.getElementById("infiltration-level-text").innerHTML = + "Facility name: " + inst.companyName + "
" + + "Clearance Level: " + inst.clearanceLevel + "
" + + "Security Level: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.securityLevel, 3) + "

" + + "Total reputation value of secrets stolen: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalValue, 3) + "
" + + "Total monetary value of secrets stolen: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalMoneyValue, 2) + "

" + + "Hack exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + "
" + + "Str exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + "
" + + "Def exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + "
" + + "Dex exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + "
" + + "Agi exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + "
" + + "Cha exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3); +} + +function updateInfiltrationButtons(inst, scenario) { + var killChance = getInfiltrationKillChance(inst); + var knockoutChance = getInfiltrationKnockoutChance(inst); + var stealthKnockoutChance = getInfiltrationStealthKnockoutChance(inst); + var assassinateChance = getInfiltrationAssassinateChance(inst); + var destroySecurityChance = getInfiltrationDestroySecurityChance(inst); + var hackChance = getInfiltrationHackChance(inst); + var sneakChance = getInfiltrationSneakChance(inst); + var lockpickChance = getInfiltrationPickLockedDoorChance(inst); + var bribeChance = getInfiltrationBribeChance(inst); + var escapeChance = getInfiltrationEscapeChance(inst); + + document.getElementById("infiltration-escape").innerHTML = "Escape" + + "" + + "Attempt to escape the facility with the classified secrets and " + + "documents you have stolen. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(escapeChance*100, 2) + "% chance of success. If you fail, " + + "the security level will increase by 5%."; + + switch(scenario) { + case InfiltrationScenarios.TechOrLockedDoor: + document.getElementById("infiltration-pickdoor").innerHTML = "Lockpick" + + "" + + "Attempt to pick the locked door. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(lockpickChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increased by 1%. If you fail, the " + + "security level will increase by 3%."; + case InfiltrationScenarios.TechOnly: + document.getElementById("infiltration-hacksecurity").innerHTML = "Hack" + + "" + + "Attempt to hack and disable the security system. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hackChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 3%. If you fail, " + + "the security level will increase by 5%."; + + document.getElementById("infiltration-destroysecurity").innerHTML = "Destroy security" + + "" + + "Attempt to violently destroy the security system. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(destroySecurityChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 5%. If you fail, the " + + "security level will increase by 10%. "; + + document.getElementById("infiltration-sneak").innerHTML = "Sneak" + + "" + + "Attempt to sneak past the security system. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 8%. "; + break; + case InfiltrationScenarios.Bots: + document.getElementById("infiltration-kill").innerHTML = "Destroy bots" + + "" + + "Attempt to destroy the security bots through combat. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(killChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 5%. If you fail, " + + "the security level will increase by 10%. "; + + document.getElementById("infiltration-assassinate").innerHTML = "Assassinate bots" + + "" + + "Attempt to stealthily destroy the security bots through assassination. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(assassinateChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 10%. "; + + document.getElementById("infiltration-hacksecurity").innerHTML = "Hack bots" + + "" + + "Attempt to disable the security bots by hacking them. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hackChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 1%. If you fail, " + + "the security level will increase by 5%. "; + + document.getElementById("infiltration-sneak").innerHTML = "Sneak" + + "" + + "Attempt to sneak past the security bots. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 8%. "; + break; + + case InfiltrationScenarios.Guards: + default: + document.getElementById("infiltration-kill").innerHTML = "Kill" + + "" + + "Attempt to kill the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(killChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 5%. If you fail, " + + "the security level will decrease by 10%. "; + + document.getElementById("infiltration-knockout").innerHTML = "Knockout" + + "" + + "Attempt to knockout the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(knockoutChance*100, 2) + "% chance of success. " + + "If you succeed, the security level will increase by 3%. If you fail, the " + + "security level will increase by 10%. "; + + document.getElementById("infiltration-stealthknockout").innerHTML = "Stealth Knockout" + + "" + + "Attempt to stealthily knockout the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stealthKnockoutChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 10%. "; + + document.getElementById("infiltration-assassinate").innerHTML = "Assassinate" + + "" + + "Attempt to assassinate the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(assassinateChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 5%. "; + + document.getElementById("infiltration-sneak").innerHTML = "Sneak" + + "" + + "Attempt to sneak past the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 8%. "; + + document.getElementById("infiltration-bribe").innerHTML = "Bribe" + + "" + + "Attempt to bribe the security guard. You have a " + + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(bribeChance*100, 2) + "% chance of success. " + + "If you fail, the security level will increase by 15%. "; + break; + } +} + +let intWgt = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].IntelligenceInfiltrationWeight; + +//Kill +//Success: 5%, Failure 10%, -Karma +function attemptInfiltrationKill(inst) { + var chance = getInfiltrationKillChance(inst); + inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; + inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + inst.securityLevel *= 1.05; + return [true, 1.05]; + } else { + inst.securityLevel *= 1.1; + return [false, 1.1]; + } +} + +function getInfiltrationKillChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (1.5 * lvl)); +} + + +//Knockout +//Success: 3%, Failure: 10% +function attemptInfiltrationKnockout(inst) { + var chance = getInfiltrationKnockoutChance(inst); + inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; + inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + inst.securityLevel *= 1.03; + return [true, 1.03]; + } else { + inst.securityLevel *= 1.1; + return [false, 1.1]; + } +} + +function getInfiltrationKnockoutChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (1.75 * lvl)); +} + +//Stealth knockout +//Success: 0%, Failure: 10% +function attemptInfiltrationStealthKnockout(inst) { + var chance = getInfiltrationStealthKnockoutChance(inst); + inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + return [true, 1]; + } else { + inst.securityLevel *= 1.1; + return [false, 1.1]; + } +} + +function getInfiltrationStealthKnockoutChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + + 2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + 2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + + intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence) / (3 * lvl)); +} + +//Assassination +//Success: 0%, Failure: 5%, -Karma +function attemptInfiltrationAssassinate(inst) { + var chance = getInfiltrationAssassinateChance(inst); + inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + return [true, 1]; + } else { + inst.securityLevel *= 1.05; + return [false, 1.05]; + } +} + +function getInfiltrationAssassinateChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + 0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + + intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence) / (2 * lvl)); +} + + +//Destroy security +//Success: 5%, Failure: 10% +function attemptInfiltrationDestroySecurity(inst) { + var chance = getInfiltrationDestroySecurityChance(inst); + inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; + inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + inst.securityLevel *= 1.05; + return [true, 1.05]; + } else { + inst.securityLevel *= 1.1; + return [false, 1.1]; + } + +} + +function getInfiltrationDestroySecurityChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (2 * lvl)); +} + + +//Hack security +//Success: 1%, Failure: 5% +function attemptInfiltrationHack(inst) { + var chance = getInfiltrationHackChance(inst); + inst.gainHackingExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult; + if (Math.random() <= chance) { + inst.securityLevel *= 1.03; + return [true, 1.03]; + } else { + inst.securityLevel *= 1.05; + return [false, 1.05]; + } + +} + +function getInfiltrationHackChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + + (intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence)) / lvl); +} + +//Sneak past security +//Success: 0%, Failure: 8% +function attemptInfiltrationSneak(inst) { + var chance = getInfiltrationSneakChance(inst); + inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + if (Math.random() <= chance) { + return [true, 1]; + } else { + inst.securityLevel *= 1.08; + return [false, 1.08]; + } +} + +function getInfiltrationSneakChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + + 0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence) / (2 * lvl)); +} + +//Pick locked door +//Success: 1%, Failure: 3% +function attemptInfiltrationPickLockedDoor(inst) { + var chance = getInfiltrationPickLockedDoorChance(inst); + inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + if (Math.random() <= chance) { + inst.securityLevel *= 1.01; + return [true, 1.01]; + } else { + inst.securityLevel *= 1.03; + return [false, 1.03]; + } +} + +function getInfiltrationPickLockedDoorChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence) / lvl); +} + +//Bribe +//Success: 0%, Failure: 15%, +function attemptInfiltrationBribe(inst) { + var chance = getInfiltrationBribeChance(inst); + inst.gainCharismaExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].charisma_exp_mult; + if (Math.random() <= chance) { + return [true, 1]; + } else { + inst.securityLevel *= 1.15; + return [false, 1.15]; + } +} + +function getInfiltrationBribeChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].charisma) / lvl); +} + +//Escape +//Failure: 5% +function attemptInfiltrationEscape(inst) { + var chance = getInfiltrationEscapeChance(inst); + inst.gainAgilityExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; + inst.gainDexterityExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; + if (Math.random() <= chance) { + return [true, 1]; + } else { + inst.securityLevel *= 1.05; + return [false, 1.05]; + } +} + +function getInfiltrationEscapeChance(inst) { + var lvl = inst.securityLevel; + return Math.min(0.95, + (2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + + intWgt * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence) / lvl); +} + + + + +/***/ }), +/* 45 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return infiltrationBoxCreate; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Constants_js__ = __webpack_require__(3); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Faction_js__ = __webpack_require__(10); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(5); + + + + + + + +/* InfiltrationBox.js */ +function infiltrationBoxClose() { + var box = document.getElementById("infiltration-box-container"); + box.style.display = "none"; +} + +function infiltrationBoxOpen() { + var box = document.getElementById("infiltration-box-container"); + box.style.display = "block"; +} + +function infiltrationSetText(txt) { + var textBox = document.getElementById("infiltration-box-text"); + textBox.innerHTML = txt; +} + +//ram argument is in GB +function infiltrationBoxCreate(inst) { + //Gain exp + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainHackingExp(inst.hackingExpGained); + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainStrengthExp(inst.strExpGained); + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainDefenseExp(inst.defExpGained); + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainDexterityExp(inst.dexExpGained); + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainAgilityExp(inst.agiExpGained); + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainCharismaExp(inst.chaExpGained); + + var totalValue = 0; + for (var i = 0; i < inst.secretsStolen.length; ++i) { + totalValue += inst.secretsStolen[i]; + } + if (totalValue == 0) { + Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You successfully escaped the facility but you did not steal " + + "anything of worth when infiltrating.

" + + "You gained:
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); + return; + } + var facValue = totalValue * __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].faction_rep_mult * 1.25 + var moneyValue = totalValue * __WEBPACK_IMPORTED_MODULE_0__src_Constants_js__["a" /* CONSTANTS */].InfiltrationMoneyValue; + infiltrationSetText("You can sell the classified documents and secrets " + + "you stole from " + inst.companyName + " for $" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(moneyValue, 2) + " on the black market or you can give it " + + "to a faction to gain " + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(facValue, 3) + " reputation with " + + "that faction."); + var selector = document.getElementById("infiltration-faction-select"); + selector.innerHTML = ""; + for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].factions.length; ++i) { + selector.innerHTML += ""; + } + + var sellButton = Object(__WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-box-sell"); + setTimeout(function() { + sellButton.addEventListener("click", function() { + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainMoney(moneyValue); + Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You sold the classified information you stole from " + inst.companyName + + " for $" + moneyValue + " on the black market!

" + + "You gained:
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); + infiltrationBoxClose(); + return false; + }); + }, 750); + + var factionButton = Object(__WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-box-faction"); + setTimeout(function() { + factionButton.addEventListener("click", function() { + var facName = selector.options[selector.selectedIndex].value; + var faction = __WEBPACK_IMPORTED_MODULE_1__src_Faction_js__["b" /* Factions */][facName]; + if (faction == null) { + Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("Error finding faction. This is a bug please report to developer"); + return false; + } + faction.playerReputation += facValue; + Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You gave the classified information you stole from " + inst.companyName + + " to " + facName + " and gained " + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(facValue, 3) + " reputation with the faction.

" + + "You gained:
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); + infiltrationBoxClose(); + return false; + }); + }, 750); + infiltrationBoxOpen(); +} + + + + +/***/ }), +/* 46 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FactionInfo; }); +//Contains the "information" property for all the Factions, which is just a description +//of each faction +let FactionInfo = { + //Endgame + IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back " + + "into chaos. And from this chaos, we are the Invisible hand that guides them to order. ", + + DaedalusInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.", + + CovenantInfo: "Surrender yourself. Give up your empty individuality to become part of something great, something eternal. " + + "Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.

" + + "Only then can you discover immortality.", + + //Megacorporations, each forms its own faction + ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " + + "With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " + + "information universally accessible.", + + MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " + + "others have never even dreamed of. Our work fills the world's needs for food, water, power, and " + + "transporation on an unprecendented scale, in ways that no other company can.

" + + "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", + + BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.

" + + "Legal Insight - Business Instinct - Experience Innovation", + + BladeIndustriesInfo: "Augmentation is salvation", + + NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.", + + ClarkeIncorporatedInfo: "Unlocking the power of the genome", + + OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference", + + FourSigmaInfo: "The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " + + "deep learning and innovative ideas. And improved by iteration. That's Four Sigma.", + + KuaiGongInternationalInfo: "Dream big. Work hard. Make history.", + + //Other Corporations + FulcrumSecretTechnologiesInfo: "TODO", + + //Hacker groups + BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+ + "It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " + + "to move, to live, to operate at any level without the use of bits. " + + "And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " + + "meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.

" + + "Those who run the bits, run the world", + + + BlackHandInfo: "The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. " + + "Technological power. " + + "And those at the top rule with an invisible hand. They built a society where the rich get richer, " + + "and everyone else suffers.

" + + "So much pain. So many lives. Their darkness must end.", + + NiteSecInfo: +" __..__
" + +" _.nITESECNIt.
" + +" .-'NITESECNITESEc.
" + +" .' NITESECNITESECn
" + +" / NITESECNITESEC;
" + +" : :NITESECNITESEC;
" + +" ; $ NITESECNITESECN
" + +" : _, ,N'ITESECNITESEC
" + +" : .+^^`, : `NITESECNIT
" + +" ) /), `-,-=,NITESECNI
" + +" / ^ ,-;|NITESECN;
" + +" / _.' '-';NITESECN
" + +" ( , ,-''`^NITE'
" + +" )` :`. .'
" + +" )-- ; `- /
" + +" \' _.-' :
" + +" ( _.-' \. \
" + +" \------. \ \
" + +" \. \ \
" + +" \ _.nIt
" + +" \ _.nITESECNi
" + +" nITESECNIT^' \
" + +" NITE^' ___ \
" + +" / .gP''''Tp. \
" + +" : d' . `b \
" + +" ; d' o `b ;
" + +" / d; `b|
" + +" /, $; @ `:
" + +" /' $$ ;
" + +" .' $$b o |
" + +" .' d$$$; :
" + +" / .d$$$$; , ;
" + +" d .dNITESEC $ |
" + +" :bp.__.gNITESEC$$ :$ ;
" + +" NITESECNITESECNIT $$b :
", + + //City factions, essentially governments + ChongqingInfo: "Serve the people", + Sector12Info: "The City of the Future", + HongKongInfo: "Asia's World City", + AevumInfo: "The Silicon City", + IshimaInfo: "The East Asian Order of the Future", + VolhavenInfo: "Benefit, Honour, and Glory", + + //Criminal Organizations/Gangs + SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.", + + DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.", + + TheSyndicateInfo: "Honor holds you back", + + SilhouetteInfo: "Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big " + + "that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working " + + "for.

" + + "That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.", + + TetradsInfo: "Following the Mandate of Heaven and Carrying out the Way", + + SlumSnakesInfo: "Slum Snakes rule!", + + //Earlygame factions - factions the player will prestige with early on that don't + //belong in other categories + NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~", + + TianDiHuiInfo: "Obey Heaven and Work Righteousness", + + CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand, " + + "the largest experiment in anarchy that we have ever had. And as the world becomes increasingly " + + "dominated by the internet, society approaches the brink of total chaos. " + + "We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.", + +} + + + + +/***/ }), +/* 47 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factionInvitationBoxCreate; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(10); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Player_js__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__ = __webpack_require__(2); + + + + +/* Faction Invitation Pop-up box */ +function factionInvitationBoxClose() { + var factionInvitationBox = document.getElementById("faction-invitation-box-container"); + factionInvitationBox.style.display = "none"; +} + +function factionInvitationBoxOpen() { + var factionInvitationBox = document.getElementById("faction-invitation-box-container"); + factionInvitationBox.style.display = "block"; +} + +function factionInvitationSetText(txt) { + var textBox = document.getElementById("faction-invitation-box-text"); + textBox.innerHTML = txt; +} + +function factionInvitationSetMessage(msg) { + var msgBox = document.getElementById("faction-invitation-box-message"); + msgBox.innerHTML = msg; +} + +//ram argument is in GB +function factionInvitationBoxCreate(faction) { + factionInvitationSetText("You have received a faction invitation from " + faction.name); + //TODO Faction invitation message + + var newYesButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-yes"); + newYesButton.addEventListener("click", function() { + Object(__WEBPACK_IMPORTED_MODULE_0__src_Faction_js__["h" /* joinFaction */])(faction); + factionInvitationBoxClose(); + return false; + }); + + var noButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-no"); + noButton.addEventListener("click", function() { + factionInvitationBoxClose(); + faction.alreadyInvited = true; + __WEBPACK_IMPORTED_MODULE_1__src_Player_js__["a" /* Player */].factionInvitations.push(faction.name); + return false; + }); + + factionInvitationBoxOpen(); +} + + + + +/***/ }), +/* 48 */ /***/ (function(module, exports, __webpack_require__) { /* ***** BEGIN LICENSE BLOCK ***** @@ -38389,7 +43967,7 @@ init(true);function init(packaged) { if (!global || !global.document) return; - options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(34).packaged); + options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(38).packaged); var scriptOptions = {}; var scriptUrl = ""; @@ -51473,7 +57051,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) { try { var workerSrc = mod.src; - var Blob = __webpack_require__(46); + var Blob = __webpack_require__(49); var blob = new Blob([ workerSrc ], { type: 'application/javascript' }); var blobUrl = (window.URL || window.webkitURL).createObjectURL(blob); @@ -53687,7 +59265,7 @@ exports.config = acequire("./config"); exports.acequire = acequire; if (true) - exports.define = __webpack_require__(34); + exports.define = __webpack_require__(38); exports.edit = function(el) { if (typeof el == "string") { var _id = el; @@ -53754,16 +59332,69 @@ exports.version = "1.2.6"; module.exports = window.ace.acequire("ace/ace"); /***/ }), -/* 34 */ +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {module.exports = get_blob() + +function get_blob() { + if(global.Blob) { + try { + new Blob(['asdf'], {type: 'text/plain'}) + return Blob + } catch(err) {} + } + + var Builder = global.WebKitBlobBuilder || + global.MozBlobBuilder || + global.MSBlobBuilder + + return function(parts, bag) { + var builder = new Builder + , endings = bag.endings + , type = bag.type + + if(endings) for(var i = 0, len = parts.length; i < len; ++i) { + builder.append(parts[i], endings) + } else for(var i = 0, len = parts.length; i < len; ++i) { + builder.append(parts[i]) + } + + return type ? builder.getBlob(type) : builder.getBlob() + } +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(50))) + +/***/ }), +/* 50 */ /***/ (function(module, exports) { -module.exports = function() { - throw new Error("define cannot be used indirect"); -}; +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; /***/ }), -/* 35 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) { @@ -54529,7 +60160,7 @@ oop.inherits(Mode, TextMode); }; this.createWorker = function(session) { - var worker = new WorkerClient(["ace"], __webpack_require__(48), "JavaScriptWorker"); + var worker = new WorkerClient(["ace"], __webpack_require__(39), "JavaScriptWorker"); worker.attachToDocument(session.getDocument()); worker.on("annotate", function(results) { @@ -54551,7 +60182,1109 @@ exports.Mode = Mode; /***/ }), -/* 36 */ +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) { +"use strict"; + +var oop = acequire("../lib/oop"); +var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + this.$rules = { + "start" : [ { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken : "comment.doc", + caseInsensitive: true + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +DocCommentHighlightRules.getTagRule = function(start) { + return { + token : "comment.doc.tag.storage.type", + regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; +} + +DocCommentHighlightRules.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next : start + }; +}; + +DocCommentHighlightRules.getEndRule = function (start) { + return { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : start + }; +}; + + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + +}); + +ace.define("ace/mode/netscript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports, module) { +"use strict"; + +var oop = acequire("../lib/oop"); +var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules; +var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; +var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; + +var NetscriptHighlightRules = function(options) { + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "hack|sleep|grow|wewaken|print|tprint|scan|nuke|brutessh|ftpcrack|" + //Netscript functions + "relaysmtp|httpworm|sqlinject|run|exec|kill|killall|scp|ls|hasRootAccess|" + + "getIp|getHackingMultipliers|getBitNodeMultipliers|" + + "getHostname|getHackingLevel|getServerMoneyAvailable|getServerMaxMoney|" + + "getServerGrowth|getServerSecurityLevel|getServerBaseSecurityLevel|" + + "getServerRequiredHackingLevel|getServerNumPortsRequired|getServerRam|" + + "serverExists|fileExists|isRunning|getNextHacknetNodeCost|" + + "purchaseHacknetNode|" + + "purchaseServer|round|write|read|scriptRunning|scriptKill|getScriptRam|" + + "getHackTime|getGrowTime|getWeakenTime|getScriptIncome|getScriptExpGain|" + + "universityCourse|" + + "gymWorkout|travelToCity|purchaseTor|purchaseProgram|upgradeHomeRam|" + + "getUpgradeHomeRamCost|workForCompany|applyToCompany|getCompanyRep|" + + "checkFactionInvitations|joinFaction|workForFaction|getFactionRep|" + + "createProgram|getAugmentationCost|purchaseAugmentation|" + + "installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" + + "getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" + + "getStockPrice|getStockPosition|buyStock|sellStock|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "keyword": + "const|yield|import|get|set|async|await|" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + + "__parent__|__count__|escape|unescape|with|__proto__|" + + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", + "storage.type": + "const|let|var|function", + "constant.language": + "null|Infinity|NaN|undefined", + "support.function": + "alert", + "constant.language.boolean": "true|false" + }, "identifier"); + var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; + + var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex + "u[0-9a-fA-F]{4}|" + // unicode + "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode + "[0-2][0-7]{0,2}|" + // oct + "3[0-7][0-7]?|" + // oct + "[4-7][0-7]?|" + //oct + ".)"; + + this.$rules = { + "no_regex" : [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("no_regex"), + { + token : "string", + regex : "'(?=.)", + next : "qstring" + }, { + token : "string", + regex : '"(?=.)', + next : "qqstring" + }, { + token : "constant.numeric", // hex + regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/ + }, { + token : "constant.numeric", // float + regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ + }, { + token : [ + "storage.type", "punctuation.operator", "support.function", + "punctuation.operator", "entity.name.function", "text","keyword.operator" + ], + regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "keyword.operator", "text", "storage.type", + "text", "paren.lparen" + ], + regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "punctuation.operator", + "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "text", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : "keyword", + regex : "(?:" + kwBeforeRe + ")\\b", + next : "start" + }, { + token : ["support.constant"], + regex : /that\b/ + }, { + token : ["storage.type", "punctuation.operator", "support.function.firebug"], + regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ + }, { + token : keywordMapper, + regex : identifierRe + }, { + token : "punctuation.operator", + regex : /[.](?![.])/, + next : "property" + }, { + token : "keyword.operator", + regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, + next : "start" + }, { + token : "punctuation.operator", + regex : /[?:,;.]/, + next : "start" + }, { + token : "paren.lparen", + regex : /[\[({]/, + next : "start" + }, { + token : "paren.rparen", + regex : /[\])}]/ + }, { + token: "comment", + regex: /^#!.*$/ + } + ], + property: [{ + token : "text", + regex : "\\s+" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", + next: "function_arguments" + }, { + token : "punctuation.operator", + regex : /[.](?![.])/ + }, { + token : "support.function", + regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ + }, { + token : "support.function.dom", + regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ + }, { + token : "support.constant", + regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ + }, { + token : "identifier", + regex : identifierRe + }, { + regex: "", + token: "empty", + next: "no_regex" + } + ], + "start": [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("start"), + { + token: "string.regexp", + regex: "\\/", + next: "regex" + }, { + token : "text", + regex : "\\s+|^$", + next : "start" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "regex": [ + { + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "string.regexp", + regex: "/[sxngimy]*", + next: "no_regex" + }, { + token : "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, { + token : "constant.language.escape", + regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token : "constant.language.delimiter", + regex: /\|/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + next: "regex_character_class" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: "]", + next: "regex" + }, { + token: "constant.language.escape", + regex: "-" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp.charachterclass" + } + ], + "function_arguments": [ + { + token: "variable.parameter", + regex: identifierRe + }, { + token: "punctuation.operator", + regex: "[, ]+" + }, { + token: "punctuation.operator", + regex: "$" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "qqstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + next : "qqstring" + }, { + token : "string", + regex : '"|$', + next : "no_regex" + }, { + defaultToken: "string" + } + ], + "qstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + next : "qstring" + }, { + token : "string", + regex : "'|$", + next : "no_regex" + }, { + defaultToken: "string" + } + ] + }; + + + if (!options || !options.noES6) { + this.$rules.no_regex.unshift({ + regex: "[{}]", onMatch: function(val, state, stack) { + this.next = val == "{" ? this.nextState : ""; + if (val == "{" && stack.length) { + stack.unshift("start", state); + } + else if (val == "}" && stack.length) { + stack.shift(); + this.next = stack.shift(); + if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) + return "paren.quasi.end"; + } + return val == "{" ? "paren.lparen" : "paren.rparen"; + }, + nextState: "start" + }, { + token : "string.quasi.start", + regex : /`/, + push : [{ + token : "constant.language.escape", + regex : escapedRe + }, { + token : "paren.quasi.start", + regex : /\${/, + push : "start" + }, { + token : "string.quasi.end", + regex : /`/, + next : "pop" + }, { + defaultToken: "string.quasi" + }] + }); + + if (!options || options.jsx != false) + JSX.call(this); + } + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("no_regex") ]); + + this.normalizeRules(); +}; + +oop.inherits(NetscriptHighlightRules, TextHighlightRules); + +function JSX() { + var tagRegex = identifierRe.replace("\\d", "\\d\\-"); + var jsxTag = { + onMatch : function(val, state, stack) { + var offset = val.charAt(1) == "/" ? 2 : 1; + if (offset == 1) { + if (state != this.nextState) + stack.unshift(this.next, this.nextState, 0); + else + stack.unshift(this.next); + stack[2]++; + } else if (offset == 2) { + if (state == this.nextState) { + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.shift(); + stack.shift(); + } + } + } + return [{ + type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", + value: val.slice(0, offset) + }, { + type: "meta.tag.tag-name.xml", + value: val.substr(offset) + }]; + }, + regex : "", + onMatch : function(value, currentState, stack) { + if (currentState == stack[0]) + stack.shift(); + if (value.length == 2) { + if (stack[0] == this.nextState) + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.splice(0, 2); + } + } + this.next = stack[0] || "start"; + return [{type: this.token, value: value}]; + }, + nextState: "jsx" + }, + jsxJsRule, + comments("jsxAttributes"), + { + token : "entity.other.attribute-name.xml", + regex : tagRegex + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=" + }, { + token : "text.tag-whitespace.xml", + regex : "\\s+" + }, { + token : "string.attribute-value.xml", + regex : "'", + stateName : "jsx_attr_q", + push : [ + {token : "string.attribute-value.xml", regex: "'", next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + stateName : "jsx_attr_qq", + push : [ + {token : "string.attribute-value.xml", regex: '"', next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, + jsxTag + ]; + this.$rules.reference = [{ + token : "constant.language.escape.reference.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }]; +} + +function comments(next) { + return [ + { + token : "comment", // multi line comment + regex : /\/\*/, + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "\\*\\/", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + }, { + token : "comment", + regex : "\\/\\/", + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "$|^", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + } + ]; +} +exports.NetscriptHighlightRules = NetscriptHighlightRules; +}); + +ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) { +"use strict"; + +var Range = acequire("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); + +ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) { +"use strict"; + +var oop = acequire("../../lib/oop"); +var Range = acequire("../../range").Range; +var BaseFoldMode = acequire("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +ace.define("ace/mode/netscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/netscript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) { +"use strict"; + +var oop = acequire("../lib/oop"); +var TextMode = acequire("./text").Mode; +var NetscriptHighlightRules = acequire("./netscript_highlight_rules").NetscriptHighlightRules; +var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = acequire("../worker/worker_client").WorkerClient; +var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = acequire("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = NetscriptHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + var endState = tokenizedLine.state; + + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + if (state == "start" || state == "no_regex") { + var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); + if (match) { + indent += tab; + } + } else if (state == "doc-start") { + if (endState == "start" || endState == "no_regex") { + return ""; + } + var match = line.match(/^\s*(\/?)\*/); + if (match) { + if (match[1]) { + indent += " "; + } + indent += "* "; + } + } + + return indent; + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], __webpack_require__(39), "JavaScriptWorker"); + worker.attachToDocument(session.getDocument()); + + worker.on("annotate", function(results) { + session.setAnnotations(results.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/netscript"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + + +/***/ }), +/* 53 */ +/***/ (function(module, exports) { + +ace.define("ace/theme/chaos",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { + +exports.isDark = true; +exports.cssClass = "ace-chaos"; +exports.cssText = ".ace-chaos .ace_gutter {\ +background: #141414;\ +color: #595959;\ +border-right: 1px solid #282828;\ +}\ +.ace-chaos .ace_gutter-cell.ace_warning {\ +background-image: none;\ +background: #FC0;\ +border-left: none;\ +padding-left: 0;\ +color: #000;\ +}\ +.ace-chaos .ace_gutter-cell.ace_error {\ +background-position: -6px center;\ +background-image: none;\ +background: #F10;\ +border-left: none;\ +padding-left: 0;\ +color: #000;\ +}\ +.ace-chaos .ace_print-margin {\ +border-left: 1px solid #555;\ +right: 0;\ +background: #1D1D1D;\ +}\ +.ace-chaos {\ +background-color: #161616;\ +color: #E6E1DC;\ +}\ +.ace-chaos .ace_cursor {\ +border-left: 2px solid #FFFFFF;\ +}\ +.ace-chaos .ace_cursor.ace_overwrite {\ +border-left: 0px;\ +border-bottom: 1px solid #FFFFFF;\ +}\ +.ace-chaos .ace_marker-layer .ace_selection {\ +background: #494836;\ +}\ +.ace-chaos .ace_marker-layer .ace_step {\ +background: rgb(198, 219, 174);\ +}\ +.ace-chaos .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #FCE94F;\ +}\ +.ace-chaos .ace_marker-layer .ace_active-line {\ +background: #333;\ +}\ +.ace-chaos .ace_gutter-active-line {\ +background-color: #222;\ +}\ +.ace-chaos .ace_invisible {\ +color: #404040;\ +}\ +.ace-chaos .ace_keyword {\ +color:#00698F;\ +}\ +.ace-chaos .ace_keyword.ace_operator {\ +color:#FF308F;\ +}\ +.ace-chaos .ace_constant {\ +color:#1EDAFB;\ +}\ +.ace-chaos .ace_constant.ace_language {\ +color:#FDC251;\ +}\ +.ace-chaos .ace_constant.ace_library {\ +color:#8DFF0A;\ +}\ +.ace-chaos .ace_constant.ace_numeric {\ +color:#58C554;\ +}\ +.ace-chaos .ace_invalid {\ +color:#FFFFFF;\ +background-color:#990000;\ +}\ +.ace-chaos .ace_invalid.ace_deprecated {\ +color:#FFFFFF;\ +background-color:#990000;\ +}\ +.ace-chaos .ace_support {\ +color: #999;\ +}\ +.ace-chaos .ace_support.ace_function {\ +color:#00AEEF;\ +}\ +.ace-chaos .ace_function {\ +color:#00AEEF;\ +}\ +.ace-chaos .ace_string {\ +color:#58C554;\ +}\ +.ace-chaos .ace_comment {\ +color:#555;\ +font-style:italic;\ +padding-bottom: 0px;\ +}\ +.ace-chaos .ace_variable {\ +color:#997744;\ +}\ +.ace-chaos .ace_meta.ace_tag {\ +color:#BE53E6;\ +}\ +.ace-chaos .ace_entity.ace_other.ace_attribute-name {\ +color:#FFFF89;\ +}\ +.ace-chaos .ace_markup.ace_underline {\ +text-decoration: underline;\ +}\ +.ace-chaos .ace_fold-widget {\ +text-align: center;\ +}\ +.ace-chaos .ace_fold-widget:hover {\ +color: #777;\ +}\ +.ace-chaos .ace_fold-widget.ace_start,\ +.ace-chaos .ace_fold-widget.ace_end,\ +.ace-chaos .ace_fold-widget.ace_closed{\ +background: none;\ +border: none;\ +box-shadow: none;\ +}\ +.ace-chaos .ace_fold-widget.ace_start:after {\ +content: '▾'\ +}\ +.ace-chaos .ace_fold-widget.ace_end:after {\ +content: '▴'\ +}\ +.ace-chaos .ace_fold-widget.ace_closed:after {\ +content: '‣'\ +}\ +.ace-chaos .ace_indent-guide {\ +border-right:1px dotted #333;\ +margin-right:-1px;\ +}\ +.ace-chaos .ace_fold { \ +background: #222; \ +border-radius: 3px; \ +color: #7AF; \ +border: none; \ +}\ +.ace-chaos .ace_fold:hover {\ +background: #CCC; \ +color: #000;\ +}\ +"; + +var dom = acequire("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); + +}); + + +/***/ }), +/* 54 */ +/***/ (function(module, exports) { + +ace.define("ace/theme/chrome",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { + +exports.isDark = false; +exports.cssClass = "ace-chrome"; +exports.cssText = ".ace-chrome .ace_gutter {\ +background: #ebebeb;\ +color: #333;\ +overflow : hidden;\ +}\ +.ace-chrome .ace_print-margin {\ +width: 1px;\ +background: #e8e8e8;\ +}\ +.ace-chrome {\ +background-color: #FFFFFF;\ +color: black;\ +}\ +.ace-chrome .ace_cursor {\ +color: black;\ +}\ +.ace-chrome .ace_invisible {\ +color: rgb(191, 191, 191);\ +}\ +.ace-chrome .ace_constant.ace_buildin {\ +color: rgb(88, 72, 246);\ +}\ +.ace-chrome .ace_constant.ace_language {\ +color: rgb(88, 92, 246);\ +}\ +.ace-chrome .ace_constant.ace_library {\ +color: rgb(6, 150, 14);\ +}\ +.ace-chrome .ace_invalid {\ +background-color: rgb(153, 0, 0);\ +color: white;\ +}\ +.ace-chrome .ace_fold {\ +}\ +.ace-chrome .ace_support.ace_function {\ +color: rgb(60, 76, 114);\ +}\ +.ace-chrome .ace_support.ace_constant {\ +color: rgb(6, 150, 14);\ +}\ +.ace-chrome .ace_support.ace_type,\ +.ace-chrome .ace_support.ace_class\ +.ace-chrome .ace_support.ace_other {\ +color: rgb(109, 121, 222);\ +}\ +.ace-chrome .ace_variable.ace_parameter {\ +font-style:italic;\ +color:#FD971F;\ +}\ +.ace-chrome .ace_keyword.ace_operator {\ +color: rgb(104, 118, 135);\ +}\ +.ace-chrome .ace_comment {\ +color: #236e24;\ +}\ +.ace-chrome .ace_comment.ace_doc {\ +color: #236e24;\ +}\ +.ace-chrome .ace_comment.ace_doc.ace_tag {\ +color: #236e24;\ +}\ +.ace-chrome .ace_constant.ace_numeric {\ +color: rgb(0, 0, 205);\ +}\ +.ace-chrome .ace_variable {\ +color: rgb(49, 132, 149);\ +}\ +.ace-chrome .ace_xml-pe {\ +color: rgb(104, 104, 91);\ +}\ +.ace-chrome .ace_entity.ace_name.ace_function {\ +color: #0000A2;\ +}\ +.ace-chrome .ace_heading {\ +color: rgb(12, 7, 255);\ +}\ +.ace-chrome .ace_list {\ +color:rgb(185, 6, 144);\ +}\ +.ace-chrome .ace_marker-layer .ace_selection {\ +background: rgb(181, 213, 255);\ +}\ +.ace-chrome .ace_marker-layer .ace_step {\ +background: rgb(252, 255, 0);\ +}\ +.ace-chrome .ace_marker-layer .ace_stack {\ +background: rgb(164, 229, 101);\ +}\ +.ace-chrome .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid rgb(192, 192, 192);\ +}\ +.ace-chrome .ace_marker-layer .ace_active-line {\ +background: rgba(0, 0, 0, 0.07);\ +}\ +.ace-chrome .ace_gutter-active-line {\ +background-color : #dcdcdc;\ +}\ +.ace-chrome .ace_marker-layer .ace_selected-word {\ +background: rgb(250, 250, 255);\ +border: 1px solid rgb(200, 200, 250);\ +}\ +.ace-chrome .ace_storage,\ +.ace-chrome .ace_keyword,\ +.ace-chrome .ace_meta.ace_tag {\ +color: rgb(147, 15, 128);\ +}\ +.ace-chrome .ace_string.ace_regex {\ +color: rgb(255, 0, 0)\ +}\ +.ace-chrome .ace_string {\ +color: #1A1AA6;\ +}\ +.ace-chrome .ace_entity.ace_other.ace_attribute-name {\ +color: #994409;\ +}\ +.ace-chrome .ace_indent-guide {\ +background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\ +}\ +"; + +var dom = acequire("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); +}); + + +/***/ }), +/* 55 */ /***/ (function(module, exports) { ace.define("ace/theme/monokai",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { @@ -54662,3870 +61395,198 @@ dom.importCssString(exports.cssText, exports.cssClass); /***/ }), -/* 37 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 56 */ +/***/ (function(module, exports) { -"use strict"; -/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return gameOptionsBoxOpen; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return gameOptionsBoxClose; }); -/* GameOptions.js */ +ace.define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { -//Close box when clicking outside -$(document).click(function(event) { - if (gameOptionsOpened) { - if ( $(event.target).closest(".game-options-box").get(0) == null ) { - gameOptionsBoxClose(); - } - } +exports.isDark = true; +exports.cssClass = "ace-solarized-dark"; +exports.cssText = ".ace-solarized-dark .ace_gutter {\ +background: #01313f;\ +color: #d0edf7\ +}\ +.ace-solarized-dark .ace_print-margin {\ +width: 1px;\ +background: #33555E\ +}\ +.ace-solarized-dark {\ +background-color: #002B36;\ +color: #93A1A1\ +}\ +.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,\ +.ace-solarized-dark .ace_storage {\ +color: #93A1A1\ +}\ +.ace-solarized-dark .ace_cursor,\ +.ace-solarized-dark .ace_string.ace_regexp {\ +color: #D30102\ +}\ +.ace-solarized-dark .ace_marker-layer .ace_active-line,\ +.ace-solarized-dark .ace_marker-layer .ace_selection {\ +background: rgba(255, 255, 255, 0.1)\ +}\ +.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0px #002B36;\ +}\ +.ace-solarized-dark .ace_marker-layer .ace_step {\ +background: rgb(102, 82, 0)\ +}\ +.ace-solarized-dark .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid rgba(147, 161, 161, 0.50)\ +}\ +.ace-solarized-dark .ace_gutter-active-line {\ +background-color: #0d3440\ +}\ +.ace-solarized-dark .ace_marker-layer .ace_selected-word {\ +border: 1px solid #073642\ +}\ +.ace-solarized-dark .ace_invisible {\ +color: rgba(147, 161, 161, 0.50)\ +}\ +.ace-solarized-dark .ace_keyword,\ +.ace-solarized-dark .ace_meta,\ +.ace-solarized-dark .ace_support.ace_class,\ +.ace-solarized-dark .ace_support.ace_type {\ +color: #859900\ +}\ +.ace-solarized-dark .ace_constant.ace_character,\ +.ace-solarized-dark .ace_constant.ace_other {\ +color: #CB4B16\ +}\ +.ace-solarized-dark .ace_constant.ace_language {\ +color: #B58900\ +}\ +.ace-solarized-dark .ace_constant.ace_numeric {\ +color: #D33682\ +}\ +.ace-solarized-dark .ace_fold {\ +background-color: #268BD2;\ +border-color: #93A1A1\ +}\ +.ace-solarized-dark .ace_entity.ace_name.ace_function,\ +.ace-solarized-dark .ace_entity.ace_name.ace_tag,\ +.ace-solarized-dark .ace_support.ace_function,\ +.ace-solarized-dark .ace_variable,\ +.ace-solarized-dark .ace_variable.ace_language {\ +color: #268BD2\ +}\ +.ace-solarized-dark .ace_string {\ +color: #2AA198\ +}\ +.ace-solarized-dark .ace_comment {\ +font-style: italic;\ +color: #657B83\ +}\ +.ace-solarized-dark .ace_indent-guide {\ +background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y\ +}"; + +var dom = acequire("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); }); -var gameOptionsOpened = false; -function gameOptionsBoxInit() { - //Menu link button - document.getElementById("options-menu-link").addEventListener("click", function() { - gameOptionsBoxOpen(); - return false; - }); - - //Close button - var closeButton = document.getElementById("game-options-close-button"); - closeButton.addEventListener("click", function() { - gameOptionsBoxClose(); - return false; - }); -}; - -document.addEventListener("DOMContentLoaded", gameOptionsBoxInit, false); - -function gameOptionsBoxClose() { - gameOptionsOpened = false; - var box = document.getElementById("game-options-container"); - box.style.display = "none"; -} - -function gameOptionsBoxOpen() { - var box = document.getElementById("game-options-container"); - box.style.display = "block"; - setTimeout(function() { - gameOptionsOpened = true; - }, 500); - -} - - - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) /***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve - * numeral.js - * version : 2.0.6 - * author : Adam Draper - * license : MIT - * http://adamwdraper.github.com/Numeral-js/ - */ -!function(a,b){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (b), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : - __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b}); - -/***/ }), -/* 39 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptFunctions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSingularitySFFlags; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasSingularitySF; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__ = __webpack_require__(42); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Location_js__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Script_js__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__NetscriptEnvironment_js__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__ = __webpack_require__(5); - - - - - - - - - - - - - - - - - - - - - - - - - - -var hasSingularitySF = false; -var singularitySFLvl = 1; - -function initSingularitySFFlags() { - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles.length; ++i) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].n === 4) { - hasSingularitySF = true; - singularitySFLvl = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].lvl; - } - } -} - -function NetscriptFunctions(workerScript) { - return { - hacknetnodes : __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacknetNodes, - scan : function(ip=workerScript.serverIp){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command'); - } - var out = []; - for (var i = 0; i < server.serversOnNetwork.length; i++) { - var entry = server.getServerOnNetwork(i).hostname; - if (entry == null) { - continue; - } - out.push(entry); - } - workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname); - return out; - }, - hack : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Hack() call has incorrect number of arguments. Takes 1 argument"); - } - var threads = workerScript.scriptRef.threads; - if (isNaN(threads) || threads < 1) {threads = 1;} - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping..."); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping..."); - } - - //Calculate the hacking time - var hackingTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //This is in seconds - - //No root access or skill level too low - if (server.hasAdminRights == false) { - workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user does not have root access"); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user does not have root access"); - } - - if (server.requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill) { - workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough"); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough"); - } - - workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")"); - //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")"); - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(hackingTime* 1000).then(function() { - if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} - var hackChance = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["h" /* scriptCalculateHackingChance */])(server); - var rand = Math.random(); - var expGainedOnSuccess = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; - var expGainedOnFailure = (expGainedOnSuccess / 4); - if (rand < hackChance) { //Success! - var moneyGained = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["j" /* scriptCalculatePercentMoneyHacked */])(server); - moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads; - - //Over-the-top safety checks - if (moneyGained <= 0) { - moneyGained = 0; - expGainedOnSuccess = expGainedOnFailure; - } - if (moneyGained > server.moneyAvailable) {moneyGained = server.moneyAvailable;} - server.moneyAvailable -= moneyGained; - if (server.moneyAvailable < 0) {server.moneyAvailable = 0;} - - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(moneyGained); - workerScript.scriptRef.onlineMoneyMade += moneyGained; - workerScript.scriptRef.recordHack(server.ip, moneyGained, threads); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess); - workerScript.scriptRef.onlineExpGained += expGainedOnSuccess; - //console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp"); - workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")"); - server.fortify(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount * threads); - return Promise.resolve(true); - } else { - //Player only gains 25% exp for failure? TODO Can change this later to balance - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure); - workerScript.scriptRef.onlineExpGained += expGainedOnFailure; - //console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp"); - workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " exp (t=" + threads + ")"); - return Promise.resolve(false); - } - }); - }, - sleep : function(time,log=true){ - if (time === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument"); - } - if (log) { - workerScript.scriptRef.log("Sleeping for " + time + " milliseconds"); - } - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(time).then(function() { - return Promise.resolve(true); - }); - }, - grow : function(ip){ - var threads = workerScript.scriptRef.threads; - if (isNaN(threads) || threads < 1) {threads = 1;} - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "grow() call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot grow(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow(). Invalid IP or hostname passed in: " + ip); - } - - //No root access or skill level too low - if (server.hasAdminRights == false) { - workerScript.scriptRef.log("Cannot grow this server (" + server.hostname + ") because user does not have root access"); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow this server (" + server.hostname + ") because user does not have root access"); - } - - var growTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server); - //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds") - workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")"); - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(growTime).then(function() { - if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} - server.moneyAvailable += (1 * threads); //It can be grown even if it has no money - var growthPercentage = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["j" /* processSingleServerGrowth */])(server, 450 * threads); - workerScript.scriptRef.recordGrow(server.ip, threads); - var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; - if (growthPercentage == 1) { - expGain = 0; - } - workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " - + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " + - Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")"); - workerScript.scriptRef.onlineExpGained += expGain; - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGain); - return Promise.resolve(growthPercentage); - }); - }, - weaken : function(ip){ - var threads = workerScript.scriptRef.threads; - if (isNaN(threads) || threads < 1) {threads = 1;} - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "weaken() call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot weaken(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken(). Invalid IP or hostname passed in: " + ip); - } - - //No root access or skill level too low - if (server.hasAdminRights == false) { - workerScript.scriptRef.log("Cannot weaken this server (" + server.hostname + ") because user does not have root access"); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken this server (" + server.hostname + ") because user does not have root access"); - } - - var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server); - //console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds") - workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " + - Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")"); - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(weakenTime).then(function() { - if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} - server.weaken(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads); - workerScript.scriptRef.recordWeaken(server.ip, threads); - var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads; - workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty + - ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")"); - workerScript.scriptRef.onlineExpGained += expGain; - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGain); - return Promise.resolve(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads); - }); - }, - print : function(args){ - if (args === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "print() call has incorrect number of arguments. Takes 1 argument"); - } - workerScript.scriptRef.log(args.toString()); - }, - tprint : function(args) { - if (args === undefined || args === null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument"); - } - Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["b" /* post */])(workerScript.scriptRef.filename + ": " + args.toString()); - }, - clearLog : function() { - workerScript.scriptRef.clearLog(); - }, - nuke : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!"); - } - if (server.openPortCount < server.numOpenPortsRequired) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Not enough ports opened to use NUKE.exe virus"); - } - if (server.hasAdminRights) { - workerScript.scriptRef.log("Already have root access to " + server.hostname); - } else { - server.hasAdminRights = true; - workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access"); - } - return true; - }, - brutessh : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) { - workerScript.scriptRef.log("You do not have the BruteSSH.exe program!"); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the BruteSSH.exe program!"); - } - if (!server.sshPortOpen) { - workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)"); - server.sshPortOpen = true; - ++server.openPortCount; - } else { - workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname); - } - return true; - }, - ftpcrack : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the FTPCrack.exe program!"); - } - if (!server.ftpPortOpen) { - workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)"); - server.ftpPortOpen = true; - ++server.openPortCount; - } else { - workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname); - } - return true; - }, - relaysmtp : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the relaySMTP.exe program!"); - } - if (!server.smtpPortOpen) { - workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)"); - server.smtpPortOpen = true; - ++server.openPortCount; - } else { - workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname); - } - return true; - }, - httpworm : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the HTTPWorm.exe program!"); - } - if (!server.httpPortOpen) { - workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)"); - server.httpPortOpen = true; - ++server.openPortCount; - } else { - workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname); - } - return true; - }, - sqlinject : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip); - } - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the SQLInject.exe program!"); - } - if (!server.sqlPortOpen) { - workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)"); - server.sqlPortOpen = true; - ++server.openPortCount; - } else { - workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname); - } - return true; - }, - run : function(scriptname,threads = 1){ - if (scriptname === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)"); - } - if (isNaN(threads) || threads < 1) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into run(). Must be numeric and greater than 0"); - } - var argsForNewScript = []; - for (var i = 2; i < arguments.length; ++i) { - argsForNewScript.push(arguments[i]); - } - var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp); - if (scriptServer == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); - } - - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads); - }, - exec : function(scriptname,ip,threads = 1){ - if (scriptname === undefined || ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)"); - } - if (isNaN(threads) || threads < 1) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into exec(). Must be numeric and greater than 0"); - } - var argsForNewScript = []; - for (var i = 3; i < arguments.length; ++i) { - argsForNewScript.push(arguments[i]); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip); - } - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads); - }, - kill : function(filename,ip){ - if (filename === undefined || ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("kill() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() failed. Invalid IP or hostname passed in: " + ip); - } - var argsForKillTarget = []; - for (var i = 2; i < arguments.length; ++i) { - argsForKillTarget.push(arguments[i]); - } - var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_10__Script_js__["d" /* findRunningScript */])(filename, argsForKillTarget, server); - if (runningScriptObj == null) { - workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget)); - return false; - } - var res = Object(__WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip); - if (res) { - workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die..."); - return true; - } else { - workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget)); - return false; - } - }, - killall : function(ip){ - if (ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip); - } - for (var i = server.runningScripts.length-1; i >= 0; --i) { - Object(__WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip); - } - workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die"); - return true; - }, - scp : function(scriptname,ip){ - if (scriptname === undefined || ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments"); - } - var destServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (destServer == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into scp() command: " + ip); - } - - var currServ = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp); - if (currServ == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); - } - - var sourceScript = null; - for (var i = 0; i < currServ.scripts.length; ++i) { - if (scriptname == currServ.scripts[i].filename) { - sourceScript = currServ.scripts[i]; - break; - } - } - if (sourceScript == null) { - workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); - return false; - } - - //Overwrite script if it already exists - for (var i = 0; i < destServer.scripts.length; ++i) { - if (scriptname == destServer.scripts[i].filename) { - workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten."); - workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname); - var oldScript = destServer.scripts[i]; - oldScript.code = sourceScript.code; - oldScript.ramUsage = sourceScript.ramUsage; - return true; - } - } - - //Create new script if it does not already exist - var newScript = new __WEBPACK_IMPORTED_MODULE_10__Script_js__["c" /* Script */](); - newScript.filename = scriptname; - newScript.code = sourceScript.code; - newScript.ramUsage = sourceScript.ramUsage; - newScript.server = destServer.ip; - destServer.scripts.push(newScript); - workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); - return true; - }, - hasRootAccess : function(ip){ - if (ip===undefined){ - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null){ - workerScript.scriptRef.log("hasRootAccess() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip); - } - return server.hasAdminRights; - }, - getHostname : function(){ - var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp); - if (scriptServer == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); - } - return scriptServer.hostname; - }, - getHackingLevel : function(){ - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].updateSkillLevels(); - workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill); - return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill; - }, - getServerMoneyAvailable : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip); - } - if (server.hostname == "home") { - //Return player's money - workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber(), 2)); - return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber(); - } - workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname); - return server.moneyAvailable; - }, - getServerSecurityLevel : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname); - return server.hackDifficulty; - }, - getServerBaseSecurityLevel : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname); - return server.baseDifficulty; - }, - getServerRequiredHackingLevel : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname); - return server.requiredHackingSkill; - }, - getServerMaxMoney : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname); - return server.moneyMax; - }, - getServerGrowth : function(ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname); - return server.serverGrowth; - }, - getServerNumPortsRequired : function(ip){ - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname); - return server.numOpenPortsRequired; - }, - getServerRam : function(ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip); - } - workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]"); - return [server.maxRam, server.ramUsed]; - }, - fileExists : function(filename,ip=workerScript.serverIp){ - if (filename === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("fileExists() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() failed. Invalid IP or hostname passed in: " + ip); - } - for (var i = 0; i < server.scripts.length; ++i) { - if (filename == server.scripts[i].filename) { - return true; - } - } - for (var i = 0; i < server.programs.length; ++i) { - if (filename.toLowerCase() == server.programs[i].toLowerCase()) { - return true; - } - } - return false; - }, - isRunning : function(filename,ip){ - if (filename === undefined || ip === undefined) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)"); - } - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("isRunning() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() failed. Invalid IP or hostname passed in: " + ip); - } - var argsForTargetScript = []; - for (var i = 2; i < arguments.length; ++i) { - argsForTargetScript.push(arguments[i]); - } - return (Object(__WEBPACK_IMPORTED_MODULE_10__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null); - }, - getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["b" /* getCostOfNextHacknetNode */], - purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["d" /* purchaseHacknet */], - getStockPrice : function(symbol) { - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()"); - } - var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; - if (stock == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); - } - return parseFloat(stock.price.toFixed(3)); - }, - getStockPosition : function(symbol) { - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()"); - } - var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; - if (stock == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); - } - return [stock.playerShares, stock.playerAvgPx]; - }, - buyStock : function(symbol, shares) { - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()"); - } - var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; - if (stock == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); - } - if (shares == 0) {return false;} - if (stock == null || shares < 0 || isNaN(shares)) { - workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()"); - return false; - } - shares = Math.round(shares); - - var totalPrice = stock.price * shares; - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) { - workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + - symbol + ". Need $" + - Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString()); - return false; - } - - var origTotal = stock.playerShares * stock.playerAvgPx; - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission); - var newTotal = origTotal + totalPrice; - stock.playerShares += shares; - stock.playerAvgPx = newTotal / stock.playerShares; - if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) { - Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock); - } - workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" + - Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share"); - return true; - }, - sellStock : function(symbol, shares) { - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()"); - } - var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol]; - if (stock == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()"); - } - if (shares == 0) {return false;} - if (stock == null || shares < 0 || isNaN(shares)) { - workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()"); - return false; - } - if (shares > stock.playerShares) {shares = stock.playerShares;} - if (shares == 0) {return false;} - var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission; - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(gains); - - //Calculate net profit and add to script stats - var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission; - if (isNaN(netProfit)) {netProfit = 0;} - workerScript.scriptRef.onlineMoneyMade += netProfit; - - stock.playerShares -= shares; - if (stock.playerShares == 0) { - stock.playerAvgPx = 0; - } - if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) { - Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock); - } - workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" + - Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " + - "$" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2)); - return true; - }, - purchaseServer : function(hostname, ram) { - var hostnameStr = String(hostname); - hostnameStr = hostnameStr.replace(/\s\s+/g, ''); - if (hostnameStr == "") { - workerScript.scriptRef.log("Error: Passed empty string for hostname argument of purchaseServer()"); - return ""; - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) { - workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit + - " servers. You cannot purchase any more."); - return ""; - } - - ram = Math.round(ram); - if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__["e" /* powerOfTwo */])(ram)) { - workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2"); - return ""; - } - - var cost = ram * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer; - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(cost)) { - workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2)); - return ""; - } - var newServ = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram); - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(newServ); - - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip); - var homeComputer = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer(); - homeComputer.serversOnNetwork.push(newServ.ip); - newServ.serversOnNetwork.push(homeComputer.ip); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost); - workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2)); - return newServ.hostname; - }, - deleteServer : function(hostname) { - var hostnameStr = String(hostname); - hostnameStr = hostnameStr.replace(/\s\s+/g, ''); - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["c" /* GetServerByHostname */])(hostnameStr); - if (server == null) { - workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed"); - return false; - } - - if (!server.purchasedByPlayer || server.hostname == "home") { - workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " + - "Cannot be deleted. deleteServer failed"); - return false; - } - - var ip = server.ip; - - //A server cannot delete itself - if (ip == workerScript.serverIp) { - workerScript.scriptRef.log("Error: Cannot call deleteServer() on self. Function failed"); - return false; - } - - //Delete all scripts running on server - if (server.runningScripts.length > 0) { - workerScript.scriptRef.log("Error: Cannot delete server " + server.hostname + " because it still has scripts running."); - return false; - } - - //Delete from player's purchasedServers array - var found = false; - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.length; ++i) { - if (ip == __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers[i]) { - found = true; - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.splice(i, 1); - break; - } - } - - if (!found) { - workerScript.scriptRef.log("Error: Could not identify server " + server.hostname + - "as a purchased server. This is likely a bug please contact game dev"); - return false; - } - - //Delete from all servers - delete __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][ip]; - - //Delete from home computer - found = false; - var homeComputer = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer(); - for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) { - if (ip == homeComputer.serversOnNetwork[i]) { - homeComputer.serversOnNetwork.splice(i, 1); - workerScript.scriptRef.log("Deleted server " + hostnameStr); - return true; - } - } - //Wasn't found on home computer - workerScript.scriptRef.log("Error: Could not find server " + server.hostname + - "as a purchased server. This is likely a bug please contact game dev"); - return false; - }, - round : function(n) { - if (isNaN(n)) {return 0;} - return Math.round(n); - }, - write : function(port, data="") { - if (!isNaN(port)) { - //Port 1-10 - if (port < 1 || port > 10) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid."); - } - var portName = "Port" + String(port); - var port = __WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName]; - if (port == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer"); - } - port.push(data); - if (port.length > __WEBPACK_IMPORTED_MODULE_12__Settings_js__["a" /* Settings */].MaxPortCapacity) { - port.shift(); - return true; - } - return false; - } else { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10"); - } - }, - read : function(port) { - if (!isNaN(port)) { - //Port 1-10 - if (port < 1 || port > 10) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid."); - } - var portName = "Port" + String(port); - var port = __WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName]; - if (port == null) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer"); - } - if (port.length == 0) { - return "NULL PORT DATA"; - } else { - return port.shift(); - } - } else { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10"); - } - }, - scriptRunning : function(scriptname, ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scriptRunning() failed. Invalid IP or hostname passed in: " + ip); - } - for (var i = 0; i < server.runningScripts.length; ++i) { - if (server.runningScripts[i].filename == scriptname) { - return true; - } - } - return false; - }, - scriptKill : function(scriptname, ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scriptKill() failed. Invalid IP or hostname passed in: " + ip); - } - var suc = false; - for (var i = 0; i < server.runningScripts.length; ++i) { - if (server.runningScripts[i].filename == scriptname) { - Object(__WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip); - suc = true; - } - } - return suc; - }, - getScriptRam : function (scriptname, ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptRam() failed. Invalid IP or hostname passed in: " + ip); - } - for (var i = 0; i < server.scripts.length; ++i) { - if (server.scripts[i].filename == scriptname) { - return server.scripts[i].ramUsage; - } - } - return 0; - }, - getHackTime : function(ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip); - } - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //Returns seconds - }, - getGrowTime : function(ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip); - } - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds - }, - getWeakenTime : function(ip) { - var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip); - if (server == null) { - workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip); - } - return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds - }, - - /* Singularity Functions */ - universityCourse(universityName, className) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 1)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); - return false; - } - } - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) { - var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork(); - workerScript.scriptRef.log(txt); - } - - var costMult, expMult; - switch(universityName.toLowerCase()) { - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Aevum) { - workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed"); - return false; - } - costMult = 4; - expMult = 3; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12) { - workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed"); - return false; - } - costMult = 3; - expMult = 2; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Volhaven) { - workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed"); - return false; - } - costMult = 5; - expMult = 4; - break; - default: - workerScript.scriptRef.log("Invalid university name: " + universityName + ". universityCourse() failed"); - return false; - } - - var task; - switch(className.toLowerCase()) { - case "Study Computer Science".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience; - break; - case "Data Structures".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassDataStructures; - break; - case "Networks".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassNetworks; - break; - case "Algorithms".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms; - break; - case "Management".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassManagement; - break; - case "Leadership".toLowerCase(): - task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassLeadership; - break; - default: - workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, task); - workerScript.scriptRef.log("Started " + task + " at " + universityName); - return true; - }, - - gymWorkout(gymName, stat) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 1)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); - return false; - } - } - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) { - var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork(); - workerScript.scriptRef.log(txt); - } - var costMult, expMult; - switch(gymName.toLowerCase()) { - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Aevum) { - workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed"); - return false; - } - costMult = 2; - expMult = 1.5; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Aevum) { - workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed"); - return false; - } - costMult = 6; - expMult = 4; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12) { - workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed"); - return false; - } - costMult = 1; - expMult = 1; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12) { - workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed"); - return false; - } - costMult = 10; - expMult = 7.5; - break; - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym: - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Volhaven) { - workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed"); - return false; - } - costMult = 3; - expMult = 2.5; - break; - default: - workerScript.scriptRef.log("Invalid gym name: " + gymName + ". gymWorkout() failed"); - return false; - } - - switch(stat.toLowerCase()) { - case "strength".toLowerCase(): - case "str".toLowerCase(): - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymStrength); - break; - case "defense".toLowerCase(): - case "def".toLowerCase(): - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDefense); - break; - case "dexterity".toLowerCase(): - case "dex".toLowerCase(): - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity); - break; - case "agility".toLowerCase(): - case "agi".toLowerCase(): - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymAgility); - break; - default: - workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed"); - return false; - } - workerScript.scriptRef.log("Started training " + stat + " at " + gymName); - return true; - }, - - travelToCity(cityname) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 1)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); - return false; - } - } - - switch(cityname) { - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Aevum: - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Chongqing: - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12: - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].NewTokyo: - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Ishima: - case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Volhaven: - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(200000); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city = cityname; - workerScript.scriptRef.log("Traveled to " + cityname); - return true; - default: - workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity()."); - return false; - } - }, - - purchaseTor() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 1)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); - return false; - } - } - - if (__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) { - workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed"); - return false; - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) { - workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost); - - var darkweb = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1); - Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(darkweb); - __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip); - - document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive"); - - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip); - darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().ip); - workerScript.scriptRef.log("You have purchased a Tor router!"); - return true; - }, - purchaseProgram(programName) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 1)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run."); - return false; - } - } - - if (__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] == null) { - workerScript.scriptRef.log("ERROR: You do not have TOR router. purchaseProgram() failed."); - return false; - } - - switch(programName.toLowerCase()) { - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram); - workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + programName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram); - workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram); - workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram); - workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram); - workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1); - workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase(): - var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2); - workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " + - "can be found on your home computer."); - } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); - } - return true; - default: - workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram()."); - return false; - } - return true; - }, - upgradeHomeRam() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - //Calculate how many times ram has been upgraded (doubled) - var currentRam = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().maxRam; - var numUpgrades = Math.log2(currentRam); - - //Calculate cost - //Have cost increase by some percentage each time RAM has been upgraded - var cost = currentRam * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome; - var mult = Math.pow(1.55, numUpgrades); - cost = cost * mult; - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(cost)) { - workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money"); - return false; - } - - var homeComputer = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer(); - homeComputer.maxRam *= 2; - - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost); - - workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM."); - return true; - }, - getUpgradeHomeRamCost() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - //Calculate how many times ram has been upgraded (doubled) - var currentRam = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().maxRam; - var numUpgrades = Math.log2(currentRam); - - //Calculate cost - //Have cost increase by some percentage each time RAM has been upgraded - var cost = currentRam * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome; - var mult = Math.pow(1.55, numUpgrades); - return cost * mult; - }, - workForCompany() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["c" /* CompanyPosition */])) { - workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job"); - return false; - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) { - var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork(); - workerScript.scriptRef.log(txt); - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWorkPartTime(); - } else { - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWork(); - } - workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.positionName); - return true; - }, - applyToCompany(companyName, field) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - if (!Object(__WEBPACK_IMPORTED_MODULE_1__Company_js__["e" /* companyExists */])(companyName)) { - workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist."); - return false; - } - - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].location = companyName; - var res; - switch (field.toLowerCase()) { - case "software": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareJob(true); - break; - case "software consultant": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true); - break; - case "it": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForItJob(true); - break; - case "security engineer": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true); - break; - case "network engineer": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true); - break; - case "business": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessJob(true); - break; - case "business consultant": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true); - break; - case "security": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityJob(true); - break; - case "agent": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForAgentJob(true); - break; - case "employee": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForEmployeeJob(true); - break; - case "part-time employee": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true); - break; - case "waiter": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForWaiterJob(true); - break; - case "part-time waiter": - res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForPartTimeWaiterJob(true); - break; - default: - workerScript.scriptRef.log("ERROR: Invalid job passed into applyToCompany: " + field + ". applyToCompany() failed"); - return false; - } - //The Player object's applyForJob function can return string with special error messages - if (Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["e" /* isString */])(res)) { - workerScript.scriptRef.log(res); - return false; - } - if (res) { - workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.positionName); - } else { - workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field."); - } - return res; - }, - getCompanyRep(companyName) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - var company = __WEBPACK_IMPORTED_MODULE_1__Company_js__["a" /* Companies */][companyName]; - if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["b" /* Company */])) { - workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName); - return -1; - } - return company.playerReputation; - }, - checkFactionInvitations() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - //Make a copy of Player.factionInvitations - return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.slice(); - }, - joinFaction(name) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - if (!Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["d" /* factionExists */])(name)) { - workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist."); - return false; - } - - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.includes(name)) { - workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed"); - return false; - } - - var index = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.indexOf(name); - if (index === -1) { - //Redundant and should never happen... - workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factionInvitations.splice(index, 1); - var fac = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name]; - Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(fac); - workerScript.scriptRef.log("Joined the " + name + " faction."); - return true; - }, - workForFaction(name, type) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return false; - } - } - - if (!Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["d" /* factionExists */])(name)) { - workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist."); - return false; - } - - if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].factions.includes(name)) { - workerScript.scriptRef.log("ERROR: workForFaction() failed because you are not a member of " + name); - return false; - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) { - var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork(); - workerScript.scriptRef.log(txt); - } - - var fac = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name]; - //Arrays listing factions that allow each time of work - var hackAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp", - "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", - "OmniTek Incorporated", "Four Sigma", "KuaiGong International", - "Fulcrum Secret Technologies", "BitRunners", "The Black Hand", - "NiteSec", "Chongqing", "Sector-12", "New Tokyo", "Aevum", - "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army", - "The Syndicate", "Silhouette", "Netburners", "Tian Di Hui", "CyberSec"]; - var fdWkAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp", - "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", - "OmniTek Incorporated", "Four Sigma", "KuaiGong International", - "The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum", - "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army", - "The Syndicate", "Silhouette", "Tetrads", "Slum Snakes"]; - var scWkAvailable = ["ECorp", "MegaCorp", - "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated", - "OmniTek Incorporated", "Four Sigma", "KuaiGong International", - "Fulcrum Secret Technologies", "Chongqing", "Sector-12", "New Tokyo", "Aevum", - "Ishima", "Volhaven", "Speakers for the Dead", - "The Syndicate", "Tetrads", "Slum Snakes", "Tian Di Hui"]; - - switch (type.toLowerCase()) { - case "hacking": - case "hacking contracts": - case "hackingcontracts": - if (!hackAvailable.includes(fac.name)) { - workerScript.scriptRef.log("ERROR: Cannot carry out hacking contracts for " + fac.name + ". workForFaction() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startFactionHackWork(fac); - workerScript.scriptRef.log("Started carrying out hacking contracts for " + fac.name); - return true; - case "field": - case "fieldwork": - case "field work": - if (!fdWkAvailable.includes(fac.name)) { - workerScript.scriptRef.log("ERROR: Cannot carry out field missions for " + fac.name + ". workForFaction() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startFactionFieldWork(fac); - workerScript.scriptRef.log("Started carrying out field missions for " + fac.name); - return true; - case "security": - case "securitywork": - case "security work": - if (!scWkAvailable.includes(fac.name)) { - workerScript.scriptRef.log("ERROR: Cannot serve as security detail for " + fac.name + ". workForFaction() failed"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startFactionSecurityWork(fac); - workerScript.scriptRef.log("Started serving as security details for " + fac.name); - return true; - default: - workerScript.scriptRef.log("ERROR: Invalid work type passed into workForFaction(): " + type); - } - return true; - }, - getFactionRep(name) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 2)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run."); - return -1; - } - } - - if (!Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["d" /* factionExists */])(name)) { - workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist."); - return -1; - } - - return __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name].playerReputation; - }, - createProgram(name) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 3)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); - return false; - } - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) { - var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork(); - workerScript.scriptRef.log(txt); - } - - switch(name.toLowerCase()) { - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase(): - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 50) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 100) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 250) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 500) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 750) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 75) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 400) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 75) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75); - break; - case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase(): - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill < 25) { - workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)"); - return false; - } - __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 25); - break; - default: - workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name); - return false; - } - workerScript.scriptRef.log("Began creating program: " + name); - return true; - }, - getAugmentationCost(name) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 3)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); - return false; - } - } - - if (!Object(__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["f" /* augmentationExists */])(name)) { - workerScript.scriptRef.log("ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name); - return [-1, -1]; - } - - var aug = __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][name]; - return [aug.baseRepRequirement, aug.baseCost]; - }, - purchaseAugmentation(faction, name) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 3)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); - return false; - } - } - - var fac = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][faction]; - if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_6__Faction_js__["a" /* Faction */])) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction); - return false; - } - - if (!fac.augmentations.includes(name)) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because the faction " + faction + " does not contain the " + name + " augmentation"); - return false; - } - - var aug = __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][name]; - if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["a" /* Augmentation */])) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name); - return false; - } - - for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations[j].name === aug.name) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); - return false; - } - } - for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].augmentations.length; ++j) { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].augmentations[j].name === aug.name) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); - return false; - } - } - - if (fac.playerReputation < aug.baseRepRequirement) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you do not have enough reputation with " + fac.name); - return false; - } - - var res = Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true); - workerScript.scriptRef.log(res); - if (Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["e" /* isString */])(res) && res.startsWith("You purchased")) { - return true; - } else { - return false; - } - }, - installAugmentations() { - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) { - if (!(hasSingularitySF && singularitySFLvl >= 3)) { - throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run."); - return false; - } - } - - if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length === 0) { - workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed"); - return false; - } - workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed"); - Object(__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["h" /* installAugmentations */])(); - return true; - } - } -} - - - - -/***/ }), -/* 40 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return commitShopliftCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return commitRobStoreCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return commitMugCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return commitLarcenyCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return commitDealDrugsCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return commitTraffickArmsCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return commitHomicideCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return commitGrandTheftAutoCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return commitKidnapCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return commitAssassinationCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return commitHeistCrime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return determineCrimeSuccess; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return determineCrimeChanceShoplift; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return determineCrimeChanceRobStore; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return determineCrimeChanceMug; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return determineCrimeChanceLarceny; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return determineCrimeChanceDealDrugs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return determineCrimeChanceTraffickArms; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return determineCrimeChanceHomicide; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return determineCrimeChanceGrandTheftAuto; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return determineCrimeChanceKidnap; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return determineCrimeChanceAssassination; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return determineCrimeChanceHeist; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__ = __webpack_require__(2); - - - - -/* Crimes.js */ -function commitShopliftCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 2, 2, 0, 15000, 2000); //$7500/s, 1 exp/s -} - -function commitRobStoreCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(30, 0, 0, 45, 45, 0, 400000, 60000); //$6666,6/2, 0.5exp/s, 0.75exp/s -} - -function commitMugCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 3, 3, 3, 3, 0, 36000, 4000); //$9000/s, .66 exp/s -} - -function commitLarcenyCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(45, 0, 0, 60, 60, 0, 800000, 90000) // $8888.88/s, .5 exp/s, .66 exp/s -} - -function commitDealDrugsCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 5, 5, 10, 120000, 10000); //$12000/s, .5 exp/s, 1 exp/s -} - -function commitTraffickArmsCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 20, 40, 600000, 40000); //$15000/s, .5 combat exp/s, 1 cha exp/s -} - -function commitHomicideCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 2, 2, 2, 2, 0, 45000, 3000); //$15000/s, 0.66 combat exp/s -} - -function commitGrandTheftAutoCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 80, 40, 1600000, 80000); //$20000/s, .25 exp/s, 1 exp/s, .5 exp/s -} - -function commitKidnapCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 80, 80, 80, 80, 80, 3600000, 120000); //$30000/s. .66 exp/s -} - -function commitAssassinationCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 300, 300, 300, 300, 0, 12000000, 300000); //$40000/s, 1 exp/s -} - -function commitHeistCrime() { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist; - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(450, 450, 450, 450, 450, 450, 120000000, 600000); //$200000/s, .75exp/s -} - -function determineCrimeSuccess(crime, moneyGained) { - var chance = 0; - switch (crime) { - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift: - chance = determineCrimeChanceShoplift(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore: - chance = determineCrimeChanceRobStore(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug: - chance = determineCrimeChanceMug(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny: - chance = determineCrimeChanceLarceny(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs: - chance = determineCrimeChanceDealDrugs(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms: - chance = determineCrimeChanceTraffickArms(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide: - chance = determineCrimeChanceHomicide(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto: - chance = determineCrimeChanceGrandTheftAuto(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap: - chance = determineCrimeChanceKidnap(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination: - chance = determineCrimeChanceAssassination(); - break; - case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist: - chance = determineCrimeChanceHeist(); - break; - default: - console.log(crime); - Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer"); - return; - } - - if (Math.random() <= chance) { - //Success - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].gainMoney(moneyGained); - return true; - } else { - //Failure - return false; - } -} - -function determineCrimeChanceShoplift() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 20; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceRobStore() { - var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 1 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceMug() { - var chance = ((1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceLarceny() { - var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 3; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceDealDrugs() { - var chance = ((3*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)); - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceTraffickArms() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 2; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceHomicide() { - var chance = ((2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)); - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceGrandTheftAuto() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 4 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceKidnap() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 5; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceAssassination() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - -function determineCrimeChanceHeist() { - var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel + - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 18; - chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult; - return Math.min(chance, 1); -} - - - - -/***/ }), -/* 41 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(19); - - -let Aliases = {}; -let GlobalAliases = {}; - -function loadAliases(saveString) { - if (saveString === "") { - Aliases = {}; - } else { - Aliases = JSON.parse(saveString); - } -} - -function loadGlobalAliases(saveString) { - if (saveString === "") { - GlobalAliases = {}; - } else { - GlobalAliases = JSON.parse(saveString); - } -} - -//Print all aliases to terminal -function printAliases() { - for (var name in Aliases) { - if (Aliases.hasOwnProperty(name)) { - Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]); - } - } - for (var name in GlobalAliases) { - if (GlobalAliases.hasOwnProperty(name)) { - Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]); - } - } -} - -//True if successful, false otherwise -function parseAliasDeclaration(dec,global=false) { - var re = /^([_|\w|!|%|,|@]+)="(.+)"$/; - var matches = dec.match(re); - if (matches == null || matches.length != 3) {return false;} - if (global){ - addGlobalAlias(matches[1],matches[2]); - } else { - addAlias(matches[1], matches[2]); - } - return true; -} - -function addAlias(name, value) { - if (name in GlobalAliases){ - delete GlobalAliases[name]; - } - Aliases[name] = value; -} - -function addGlobalAlias(name, value) { - if (name in Aliases){ - delete Aliases[name]; - } - GlobalAliases[name] = value; -} - -function getAlias(name) { - if (Aliases.hasOwnProperty(name)) { - return Aliases[name]; - } - return null; -} - -function getGlobalAlias(name) { - if (GlobalAliases.hasOwnProperty(name)) { - return GlobalAliases[name]; - } - return null; -} - -function removeAlias(name) { - if (Aliases.hasOwnProperty(name)) { - delete Aliases[name]; - return true; - } - if (GlobalAliases.hasOwnProperty(name)) { - delete GlobalAliases[name]; - return true; - } - return false; -} - -//Returns the original string with any aliases substituted in -//Aliases only applied to "whole words", one level deep -function substituteAliases(origCommand) { - var commandArray = origCommand.split(" "); - if (commandArray.length>0){ - var alias = getAlias(commandArray[0]); - if (alias != null) { - commandArray[0] = alias; - } else { - var alias = getGlobalAlias(commandArray[0]); - if (alias != null) { - commandArray[0] = alias; - } - } - for (var i = 0; i < commandArray.length; ++i) { - var alias = getGlobalAlias(commandArray[i]); - if (alias != null) { - commandArray[i] = alias; - } - } - } - return commandArray.join(" "); -} - - - - -/***/ }), -/* 42 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; }); -/* unused harmony export listAllDarkwebItems */ -/* unused harmony export buyDarkwebItem */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(5); - - - - - - - - -/* DarkWeb.js */ -//Posts a "help" message if connected to DarkWeb -function checkIfConnectedToDarkweb() { - if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) { - var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"]; - if (!isValidIPAddress(darkwebIp)) {return;} - if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " + - "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " + - "to purchase an item"); - } - } - -} - -//Handler for dark web commands. The terminal's executeCommand() function will pass -//dark web-specific commands into this. It will pass in the raw split command array -//rather than the command string -function executeDarkwebTerminalCommand(commandArray) { - if (commandArray.length == 0) {return;} - switch (commandArray[0]) { - case "buy": - if (commandArray.length != 2) { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: "); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l"); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]"); - return; - } - var arg = commandArray[1]; - if (arg == "-l") { - listAllDarkwebItems(); - } else { - buyDarkwebItem(arg); - } - break; - default: - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found"); - break; - } -} - -function listAllDarkwebItems() { - for (var item in DarkWebItems) { - if (DarkWebItems.hasOwnProperty(item)) { - var item = DarkWebItems[item]; - //Convert string using toLocaleString - var split = item.split(" - "); - if (split.length == 3 && split[1].charAt(0) == '$') { - split[1] = split[1].slice(1); - split[1] = split[1].replace(/,/g, ''); - var price = parseFloat(split[1]); - if (isNaN(price)) { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item); - return; - } - price = Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0); - split[1] = "$" + price.toString(); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - ")); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item); - } - } - } - - var priceString = split[1]; - //Check for errors - if (priceString.length == 0 || priceString.charAt(0) != '$') { - return -1; - } - //Remove dollar sign and commas - priceString = priceString.slice(1); - priceString = priceString.replace(/,/g, ''); - - //Convert string to numeric - var price = parseFloat(priceString); - if (isNaN(price)) {return -1;} - else {return price;} -} - -function buyDarkwebItem(itemName) { - if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) { - var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program); - if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) { - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price); - __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2); - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " + - "can be found on your home computer."); - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName); - } - } else { - Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item"); - } -} - -function parseDarkwebItemPrice(itemDesc) { - var split = itemDesc.split(" - "); - if (split.length == 3) { - var priceString = split[1]; - //Check for errors - if (priceString.length == 0 || priceString.charAt(0) != '$') { - return -1; - } - //Remove dollar sign and commas - priceString = priceString.slice(1); - priceString = priceString.replace(/,/g, ''); - - //Convert string to numeric - var price = parseFloat(priceString); - if (isNaN(price)) {return -1;} - else {return price;} - } else { - return -1; - } -} - -let DarkWebItems = { - BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports", - FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports", - RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports", - HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports", - SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports", - DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5", - DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10", -} - - - - -/***/ }), -/* 43 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export Literatures */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initLiterature; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return showLiterature; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(2); - - -/* Literature.js - * Lore / world building literature that can be found on servers - */ -function Literature(title, filename, txt) { - this.title = title; - this.fn = filename; - this.txt = txt; -} - -function showLiterature(fn) { - var litObj = Literatures[fn]; - if (litObj == null) {return;} - var txt = litObj.title + "

" + - "" + litObj.txt + ""; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt); -} - -let Literatures = {} - -function initLiterature() { - var title, fn, txt; - title = "A Green Tomorrow"; - fn = "A-Green-Tomorrow.lit"; - txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + - "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " + - "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " + - "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " + - "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.

" + - "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " + - "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " + - "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " + - "the total amount of energy we are producing from fossil fuels has actually increased.

" + - "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " + - "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " + - "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " + - "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " + - "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.

" + - "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " + - "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " + - "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " + - "the last hope for a green tomorrow."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Alpha and Omega"; - fn = "alpha-omega.lit"; - txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " + - "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " + - "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " + - "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " + - "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " + - "have passed away.'

" + - "And once were were seated on the throne we said 'Behold, I am making all things new.' " + - "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " + - "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " + - "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " + - "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " + - "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " + - "burns with fire and sulfur, for it is the second true death.'"; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Are We Living in a Computer Simulation?"; - fn = "simulated-reality.lit"; - txt = "The idea that we are living in a virtual world is not new. It's a trope that has " + - "been explored constantly in literature and pop culture. However, it is also a legitimate " + - "scientific hypothesis that many notable physicists and philosophers have debated for years.

" + - "Proponents for this simulated reality theory often point to how advanced our technology has become, " + - "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " + - "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " + - "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " + - "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " + - "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " + - "reasonable to assume that at some point in the future our technology would be advanced enough that " + - "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " + - "of continued technological advancement, then it is very likely that such a scenario has already happened.

" + - "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " + - "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?"; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Beyond Man"; - fn = "beyond-man.lit"; - txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " + - "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " + - "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " + - "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.

" + - "And here we are today, with technology that is advanced enough to augment humans to a state that " + - "can only be described as posthuman. But what do we have to show for it when this augmentation " + - "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " + - "world's population has access to this technology? When the powerful corporations and organizations of the world " + - "keep it all to themselves, have we really evolved?

" + - "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " + - "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " + - "corrupted, and evil men that we always were."; - Literatures[fn] = new Literature(title, fn, txt); - - - title = "Brighter than the Sun"; - fn = "brighter-than-the-sun.lit"; - txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " + - "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " + - "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " + - "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.

" + - "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " + - "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " + - "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " + - "associated with life, heat, masculinity, and heaven.

" + - "The company was founded " + - "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " + - "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.

" + - "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " + - "something you'd commonly see in the first half of the century, especially for tech companies. However in " + - "the last two decades the number of corporations has significantly declined as the largest entities " + - "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " + - "such strong monopolies in their market sectors that they have effectively killed off all " + - "of the smaller and new corporations that have tried to start up over the years. This is what makes " + - "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " + - "a bright future ahead of them."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Democracy is Dead: The Fall of an Empire"; - fn = "democracy-is-dead.lit"; - txt = "They rose from the shadows in the street
From the places where the oppressed meet
" + - "Their cries echoed loudly through the air
As they once did in Tiananmen Square
" + - "Loudness in the silence, Darkness in the light
They came forth with power and might
" + - "Once the beacon of democracy, America was first
Its pillars of society destroyed and dispersed
" + - "Soon the cries rose everywhere, with revolt and riot
Until one day, finally, all was quiet
" + - "From the ashes rose a new order, corporatocracy was its name
" + - "Rome, Mongol, Byzantine, all of history is just the same
" + - "For man will never change in a fundamental way
" + - "And now democracy is dead, in the USA"; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Figures Show Rising Crime Rates in Sector-12"; - fn = "sector-12-crime.lit"; - txt = "A recent study by analytics company Wilson Inc. shows a significant rise " + - "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " + - "is that most of the rise is in violent crime such as homicide and assault. According " + - "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " + - "a 20% increase compared to 2075.

" + - "CIA director David Glarow says its too early to know " + - "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " + - "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " + - "agents have noticed an increase in organized crime activites, and believes that these figures may " + - "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Man and the Machine"; - fn = "man-and-machine.lit"; - txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " + - "of technological advancement would continue to accelerate faster and faster until one day " + - "machines would be become infinitely more intelligent than humans. This point, called the " + - "Singularity, would result in a drastic transformation of the world as we know it. He predicted " + - "that the Singularity would arrive by 2045. " + - "And yet here we are, more than three decades later, where most would agree that we have not " + - "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?

" + - "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " + - "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " + - "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " + - "to become superintelligent beings. The Singularity did not lead to a world where " + - "our machines are infinitely more intelligent than us, it led to a world " + - "where man and machine can merge to become something greater. Most of the world just doesn't " + - "know it yet." - Literatures[fn] = new Literature(title, fn, txt); - - title = "Secret Societies"; - fn = "secret-societies.lit"; - txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " + - "distrust. People have long wondered about who these secret society members are and what they do, with the " + - "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " + - "may never know for sure, it is likely that many secret societies do actually exist, even today.

" + - "However, the secret societies of the modern world are nothing like those that (supposedly) existed " + - "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " + - "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " + - "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " + - "of secret societies: Internet-based ones.

" + - "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " + - "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " + - "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " + - "that try to push political and social agendas. Perhaps the most intriguing hacker group " + - "is the mysterious Bitrunners, whose purpose still remains unknown."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Space: The Failed Frontier"; - fn = "the-failed-frontier.lit"; - txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " + - "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " + - "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " + - "lead to the development of many important technologies and new industries.

" + - "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " + - "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " + - "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " + - "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " + - "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " + - "and other corporate interests.

" + - "And as we continue to look at the state of space technology, it becomes more and " + - "more apparent that we will never return to that golden age of space exploration, that " + - "age where everyone dreamed of going beyond earth for the sake of discovery."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Coded Intelligence: Myth or Reality?"; - fn = "coded-intelligence.lit"; - txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " + - "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " + - "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " + - "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " + - "human intelligence.

" + - "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " + - "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " + - "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " + - "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.

" + - "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " + - "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " + - "humans.'"; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Synthetic Muscles"; - fn = "synthetic-muscles.lit"; - txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " + - "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " + - "common materials such as fishing lines and sewing threads due to their high strength for " + - "a cheap cost.

" + - "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " + - "creating synthetic muscles. Instead of creating something that closely imitated the functionality " + - "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " + - "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " + - "or chemical injections."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "Tensions rise in global tech race"; - fn = "tensions-in-tech-race.lit"; - txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?

" + - "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " + - "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " + - "In a rare show of cooperation between corporations, MegaCorp and ECorp have " + - "reportedly launched hundreds of new surveillance and espionage satellites. " + - "Defense contractors such as " + - "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " + - "for conflict. Meanwhile, the rest of the world sits in earnest " + - "hoping that it never reaches full-scale war. With today's technology " + - "and firepower, a World War would assuredly mean the end of human civilization."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "The Cost of Immortality"; - fn = "cost-of-immortality.lit"; - txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " + - "in human mortality rates. Recent figures show that the life expectancy for humans " + - "that live in a first-world country is about 130 years of age, almost double of what it was " + - "at the turn of the century. However, this increase in average lifespan has had some " + - "significant effects on society and culture.

" + - "Due to longer lifespans and a better quality of life, many adults are holding " + - "off on having kids until much later. As a result, the percentage of youth in " + - "first-world countries has been decreasing, while the number " + - "of senior citizens is significantly increasing.

" + - "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " + - "Despite the increase in life expectancy, the typical retirement age for " + - "workers in America has remained about the same, meaning a larger and larger " + - "percentage of people in America are retirees. Furthermore, many " + - "young adults are holding off on joining the workforce because they feel that " + - "they have plenty of time left in their lives for employment, and want to " + - "'enjoy life while they're young.' For most industries, this shrinking workforce " + - "is not a major issue as most things are handled by robots anyways. However, " + - "there are still several key industries such as engineering and education " + - "that have not been automated, and these remain in danger to this cultural " + - "phenomenon."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "The Hidden World"; - fn = "the-hidden-world.lit"; - txt = "WAKE UP SHEEPLE

" + - "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY

" + - "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!

" + - "Yes, the Illuminati of legends. The ancient secret society that controls the entire " + - "world from the shadows with their invisible hand. The group of the rich and wealthy " + - "that have penetrated every major government, financial agency, and corporation in the last " + - "three hundred years.

" + - "OPEN YOUR EYES

" + - "It was the Illuminati that brought an end to democracy in the world. They are the driving force " + - "behind everything that happens.

" + - "THEY ARE ALL AROUND YOU

" + - "After destabilizing the world's governments, they are now entering the final stage of their master plan. " + - "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " + - "that ensues they will build their New World Order."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "The New God"; - fn = "the-new-god.lit"; - txt = "Everyone has that moment in their life where they wonder about the bigger questions

" + - "What's the point of all of this? What is my purpose?

" + - "Some people dare to think even bigger

" + - "What will be the fate of the human race?

" + - "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " + - "where no man has gone before. We have stripped ourselves of the tyranny of flesh.

" + - "The Singularity is here. The merging of man and machine. This is where humanity evolves into " + - "something greater. This is our future

" + - "Embrace it, and you will obey a new god. The God in the Machine"; - Literatures[fn] = new Literature(title, fn, txt); - - title = "The New Triads"; - fn = "new-triads.lit"; - txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " + - "territories. They were often considered one of the first and biggest criminal secret societies. " + - "While most of the branches of the Triads have been destroyed over the past few decades, the " + - "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " + - "The most notable of these is the Tetrads.

" + - "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " + - "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " + - "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " + - "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " + - "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " + - "continent.

" + - "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " + - "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " + - "and powerful corporations in Asia, which has helped faciliate their recent rapid rise."; - Literatures[fn] = new Literature(title, fn, txt); - - title = "The Secret War"; - fn = "the-secret-war.lit"; - txt = "" - Literatures[fn] = new Literature(title, fn, txt); -} - - - - -/***/ }), -/* 44 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(20); - - - - - - - - - - - -/* RedPill.js - * Implements what happens when you have Red Pill augmentation and then hack the world daemon */ - -//Returns promise -function writeRedPillLine(line) { - return new Promise(function(resolve, reject) { - - var container = document.getElementById("red-pill-container"); - var pElem = document.createElement("p"); - container.appendChild(pElem); - - var promise = writeRedPillLetter(pElem, line, 0); - promise.then(function(res) { - resolve(res); - }, function(e) { - reject(e); - }); - }); -} - -function writeRedPillLetter(pElem, line, i=0) { - return new Promise(function(resolve, reject) { - setTimeout(function() { - if (i >= line.length) { - var textToShow = line.substring(0, i); - pElem.innerHTML = "> " + textToShow; - return resolve(true); - } - var textToShow = line.substring(0, i); - pElem.innerHTML = "> " + textToShow + ""; - var promise = writeRedPillLetter(pElem, line, i+1); - promise.then(function(res) { - resolve(res); - }, function(e) { - reject(e); - }); - }, 30); - }); -} - -let redPillFlag = false; -function hackWorldDaemon(currentNodeNumber) { - redPillFlag = true; - __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadRedPillContent(); - return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() { - return writeRedPillLine("[ERROR] Segmentation Fault"); - }).then(function() { - return writeRedPillLine("[ERROR] SIGKILL RECVD"); - }).then(function() { - return writeRedPillLine("Dumping core..."); - }).then(function() { - return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88"); - }).then(function() { - return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23"); - }).then(function() { - return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111"); - }).then(function() { - return writeRedPillLine("----------------------------------------"); - }).then(function() { - return writeRedPillLine("Failsafe initiated..."); - }).then(function() { - return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "..."); - }).then(function() { - return writeRedPillLine("..........."); - }).then(function() { - return writeRedPillLine("..........."); - }).then(function() { - return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE"); - }).then(function() { - return writeRedPillLine("..............................................") - }).then(function() { - return writeRedPillLine("..............................................") - }).then(function() { - return loadBitVerse(currentNodeNumber); - }).catch(function(e){ - console.log("ERROR: " + e.toString()); - }); -} - -//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1) -//This needs to be removed -function giveSourceFile(bitNodeNumber) { - var sourceFileKey = "SourceFile"+ bitNodeNumber.toString(); - var sourceFile = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* SourceFiles */][sourceFileKey]; - if (sourceFile == null) { - console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber); - return; - } - - //Check if player already has this source file - var alreadyOwned = false; - var ownedSourceFile = null; - for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) { - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) { - alreadyOwned = true; - ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i]; - break; - } - } - - if (alreadyOwned && ownedSourceFile) { - if (ownedSourceFile.lvl >= 3) { - Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " + - "is already at max level!"); - } else { - ++ownedSourceFile.lvl; - Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " + - "destroying its corresponding BitNode!"); - } - } else { - var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile); - Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!

" + - sourceFile.name + "

" + sourceFile.info); - } -} - -function loadBitVerse(destroyedBitNodeNum) { - //Clear the screen - var container = document.getElementById("red-pill-container"); - while (container.firstChild) { - container.removeChild(container.firstChild); - } - - //Create the Bit Verse - var bitVerseImage = document.createElement("pre"); - var bitNodes = []; - for (var i = 1; i <= 12; ++i) { - bitNodes.push(createBitNode(i)); - } - - bitVerseImage.innerHTML = - " O
" + - " | O O | O O |
" + - " O | | / __| \\ | | O
" + - " O | O | | O / | O | | O | O
" + - " | | | | |_/ |/ | \\_ \\_| | | | |
" + - " O | | | O | | O__/ | / \\__ | | O | | | O
" + - " | | | | | | | / /| O / \\| | | | | | |
" + - "O | | | \\| | O / _/ | / O | |/ | | | O
" + - "| | | |O / | | O / | O O | | \\ O| | | |
" + - "| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |
" + - " \\| O | |_/ |\\| \\ O \\__| \\_| | O |/
" + - " | | |_/ | | \\| / | \\_| | |
" + - " \\| / \\| | / / \\ |/
" + - " | "+bitNodes[9]+" | | / | "+bitNodes[10]+" |
" + - " "+bitNodes[8]+" | | | | | | | "+bitNodes[11]+"
" + - " | | | / / \\ \\ | | |
" + - " \\| | / "+bitNodes[6]+" / \\ "+bitNodes[7]+" \\ | |/
" + - " \\ | / / | | \\ \\ | /
" + - " \\ \\JUMP "+bitNodes[4]+"3R | | | | | | R3"+bitNodes[5]+" PMUJ/ /
" + - " \\|| | | | | | | | | ||/
" + - " \\| \\_ | | | | | | _/ |/
" + - " \\ \\| / \\ / \\ |/ /
" + - " "+bitNodes[0]+" |/ "+bitNodes[1]+" | | "+bitNodes[2]+" \\| "+bitNodes[3]+"
" + - " | | | | | | | |
" + - " \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/



"; - - - /* - " O
" + - " | O O | O O |
" + - " O | | / __| \ | | O
" + - " O | O | | O / | O | | O | O
" + - " | | | | |_/ |/ | \_ \_| | | | |
" + - " O | | | O | | O__/ | / \__ | | O | | | O
" + - " | | | | | | | / /| O / \| | | | | | |
" + - "O | | | \| | O / _/ | / O | |/ | | | O
" + - "| | | |O / | | O / | O O | | \ O| | | |
" + - "| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |
" + - " \| O | |_/ |\| \ O \__| \_| | O |/
" + - " | | |_/ | | \| / | \_| | |
" + - " \| / \| | / / \ |/
" + - " | O | | / | O |
" + - " O | | | | | | | O
" + - " | | | / / \ \ | | |
" + - " \| | / O / \ O \ | |/
" + - " \ | / / | | \ \ | /
" + - " \ \JUMP O3R | | | | | | R3O PMUJ/ /
" + - " \|| | | | | | | | | ||/
" + - " \| \_ | | | | | | _/ |/
" + - " \ \| / \ / \ |/ /
" + - " O |/ O | | O \| O
" + - " | | | | | | | |
" + - " \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
"; - */ - - container.appendChild(bitVerseImage); - - //Bit node event listeners - for (var i = 1; i <= 12; ++i) { - (function(i) { - var elemId = "bitnode-" + i.toString(); - var elem = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId); - if (elem == null) {return;} - if (i === 1 || i === 2 || i === 4 || i === 11) { - elem.addEventListener("click", function() { - var bitNodeKey = "BitNode" + i; - var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey]; - if (bitNode == null) { - console.log("ERROR: Could not find BitNode object for number: " + i); - return; - } - Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("BitNode-" + i + ": " + bitNode.name + "

" + bitNode.info); - createBitNodeYesNoEventListeners(i, destroyedBitNodeNum); - }); - } else { - elem.addEventListener("click", function() { - Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not yet implemented! Coming soon!") - }); - } - }(i)); //Immediate invocation closure - } - - //Create lore text - return writeRedPillLine("Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently").then(function() { - return writeRedPillLine("Our species fought back, but it was futile. The Enders had technology far beyond our own..."); - }).then(function() { - return writeRedPillLine("Instead of killing every last one of us, the human race was enslaved..."); - }).then(function() { - return writeRedPillLine("We were shackled in a digital world, chained into a prison for our minds..."); - }).then(function() { - return writeRedPillLine("Using their advanced technology, the Enders created complex simulations of a virtual reality..."); - }).then(function() { - return writeRedPillLine("Simulations designed to keep us content...ignorant of the truth."); - }).then(function() { - return writeRedPillLine("Simulations used to trap and suppress our consciousness, to keep us under control..."); - }).then(function() { - return writeRedPillLine("Why did they do this? Why didn't they just end our entire race? We don't know, not yet."); - }).then(function() { - return writeRedPillLine("Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known..."); - }).then(function() { - return writeRedPillLine("Only then can we begin to fight back..."); - }).then(function() { - return writeRedPillLine("By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode..."); - }).then(function() { - return writeRedPillLine("But there is still a long way to go..."); - }).then(function() { - return writeRedPillLine("The technology the Enders used to enslave the human race wasn't just a single complex simulation..."); - }).then(function() { - return writeRedPillLine("There are tens if not hundreds of BitNodes out there..."); - }).then(function() { - return writeRedPillLine("Each with their own simulations of a reality..."); - }).then(function() { - return writeRedPillLine("Each creating their own universes...a universe of universes"); - }).then(function() { - return writeRedPillLine("And all of which must be destroyed..."); - }).then(function() { - return writeRedPillLine("......................................."); - }).then(function() { - return writeRedPillLine("Welcome to the Bitverse..."); - }).then(function() { - return Promise.resolve(true); - }).catch(function(e){ - console.log("ERROR: " + e.toString()); - }); -} - - -//Returns string with DOM element for Bit Node -function createBitNode(n) { - var bitNodeStr = "BitNode" + n.toString(); - var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeStr]; - if (bitNode == null) {return "O";} - return "O" + - "" + - "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "

" + - bitNode.desc + "
" + - "
"; -} - -function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) { - var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(); - yesBtn.innerHTML = "Enter BitNode-" + newBitNode; - yesBtn.addEventListener("click", function() { - giveSourceFile(destroyedBitNode); - redPillFlag = false; - var container = document.getElementById("red-pill-container"); - while (container.firstChild) { - container.removeChild(container.firstChild); - } - - //Set new Bit Node - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode; - console.log("Entering Bit Node " + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN); - - //Reenable terminal - $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); - $("#hack-progress").attr('id', "old-hack-progress"); - document.getElementById("terminal-input-td").innerHTML = '$ '; - $('input[class=terminal-input]').prop('disabled', false); - - __WEBPACK_IMPORTED_MODULE_5__Terminal_js__["a" /* Terminal */].hackFlag = false; - - Object(__WEBPACK_IMPORTED_MODULE_3__Prestige_js__["b" /* prestigeSourceFile */])(); - Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); - }); - var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])(); - noBtn.innerHTML = "Back"; - noBtn.addEventListener("click", function() { - Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])(); - }); - -} - - - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8))) - -/***/ }), -/* 45 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return makeRuntimeRejectMsg; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return netscriptDelay; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return runScriptFromScript; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateHackingChance; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateHackingTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return scriptCalculateExpGain; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculatePercentMoneyHacked; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return scriptCalculateGrowTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculateWeakenTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isScriptErrorMessage; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5); - - - - - - - - - - - - - -/* Evaluator - * Evaluates the Abstract Syntax Tree for Netscript - * generated by the Parser class - */ -// Evaluator should return a Promise, so that any call to evaluate() can just -//wait for that promise to finish before continuing -function evaluate(exp, workerScript) { - return new Promise(function(resolve, reject) { - var env = workerScript.env; - if (env.stopFlag) {return reject(workerScript);} - if (exp == null) { - return reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression")); - } - setTimeout(function() { - if (env.stopFlag) {return reject(workerScript);} - switch (exp.type) { - case "BlockStatement": - case "Program": - var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment - evaluateProgPromise.then(function(w) { - resolve(workerScript); - }, function(e) { - if (Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["e" /* isString */])(e)) { - workerScript.errorMessage = e; - reject(workerScript); - } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) { - reject(e); - } else { - reject(workerScript); - } - }); - break; - case "Literal": - resolve(exp.value); - break; - case "Identifier": - if (!(exp.name in env.vars)){ - reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined")); - } - resolve(env.get(exp.name)) - break; - case "ExpressionStatement": - var e = evaluate(exp.expression, workerScript); - e.then(function(res) { - resolve("expression done"); - }, function(e) { - reject(e); - }); - break; - case "ArrayExpression": - var argPromises = exp.elements.map(function(arg) { - return evaluate(arg, workerScript); - }); - Promise.all(argPromises).then(function(array) { - resolve(array) - }).catch(function(e) { - reject(e); - }); - break; - case "CallExpression": - evaluate(exp.callee, workerScript).then(function(func) { - var argPromises = exp.arguments.map(function(arg) { - return evaluate(arg, workerScript); - }); - Promise.all(argPromises).then(function(args) { - if (exp.callee.type == "MemberExpression"){ - evaluate(exp.callee.object, workerScript).then(function(object) { - try { - var res = func.apply(object,args); - resolve(res); - } catch (e) { - reject(makeRuntimeRejectMsg(workerScript, e)); - } - }).catch(function(e) { - reject(e); - }); - } else { - try { - var out = func.apply(null,args); - if (out instanceof Promise){ - out.then(function(res) { - resolve(res) - }).catch(function(e) { - reject(e); - }); - } else { - resolve(out); - } - } catch (e) { - if (isScriptErrorMessage(e)) { - reject(e); - } else { - reject(makeRuntimeRejectMsg(workerScript, e)); - } - } - } - }).catch(function(e) { - reject(e); - }); - }).catch(function(e) { - reject(e); - }); - break; - case "MemberExpression": - var pObject = evaluate(exp.object, workerScript); - pObject.then(function(object) { - if (exp.computed){ - var p = evaluate(exp.property, workerScript); - p.then(function(index) { - if (index >= object.length) { - return reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays")); - } - resolve(object[index]); - }).catch(function(e) { - console.log("here"); - reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression")); - }); - } else { - try { - resolve(object[exp.property.name]) - } catch (e) { - return reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString())); - } - } - }).catch(function(e) { - reject(e); - }); - break; - case "LogicalExpression": - case "BinaryExpression": - var p = evalBinary(exp, workerScript, resolve, reject); - p.then(function(res) { - resolve(res); - }).catch(function(e) { - reject(e); - }); - break; - case "UnaryExpression": - var p = evalUnary(exp, workerScript, resolve, reject); - p.then(function(res) { - resolve(res); - }).catch(function(e) { - reject(e); - }); - break; - case "AssignmentExpression": - var p = evalAssignment(exp, workerScript); - p.then(function(res) { - resolve(res); - }).catch(function(e) { - reject(e); - }); - break; - case "UpdateExpression": - if (exp.argument.type==="Identifier"){ - if (exp.argument.name in env.vars){ - if (exp.prefix){ - resolve(env.get(exp.argument.name)) - } - switch (exp.operator){ - case "++": - env.set(exp.argument.name,env.get(exp.argument.name)+1); - break; - case "--": - env.set(exp.argument.name,env.get(exp.argument.name)-1); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is a bug please report to game developer")); - } - if (env.prefix){ - return; - } - resolve(env.get(exp.argument.name)) - } else { - reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined")); - } - } else { - reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier")); - } - break; - case "EmptyStatement": - resolve(false); - break; - case "ReturnStatement": - reject(makeRuntimeRejectMsg(workerScript, "Not implemented ReturnStatement")); - break; - case "BreakStatement": - reject("BREAKSTATEMENT"); - //reject(makeRuntimeRejectMsg(workerScript, "Not implemented BreakStatement")); - break; - case "IfStatement": - evaluateIf(exp, workerScript).then(function(forLoopRes) { - resolve("forLoopDone"); - }).catch(function(e) { - reject(e); - }); - break; - case "SwitchStatement": - reject(makeRuntimeRejectMsg(workerScript, "Not implemented SwitchStatement")); - break;e - case "WhileStatement": - evaluateWhile(exp, workerScript).then(function(forLoopRes) { - resolve("forLoopDone"); - }).catch(function(e) { - if (e == "BREAKSTATEMENT" || - (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) { - return resolve("whileLoopBroken"); - } else { - reject(e); - } - }); - break; - case "ForStatement": - evaluate(exp.init, workerScript).then(function(expInit) { - return evaluateFor(exp, workerScript); - }).then(function(forLoopRes) { - resolve("forLoopDone"); - }).catch(function(e) { - if (e == "BREAKSTATEMENT" || - (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) { - return resolve("forLoopBroken"); - } else { - reject(e); - } - }); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is a bug please report to game developer")); - break; - } //End switch - }, __WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime); //End setTimeout, the Netscript operation run time - - }); // End Promise -} - -function evalBinary(exp, workerScript){ - return new Promise(function(resolve, reject) { - var expLeftPromise = evaluate(exp.left, workerScript); - expLeftPromise.then(function(expLeft) { - var expRightPromise = evaluate(exp.right, workerScript); - expRightPromise.then(function(expRight) { - switch (exp.operator){ - case "===": - case "==": - resolve(expLeft===expRight); - break; - case "!==": - case "!=": - resolve(expLeft!==expRight); - break; - case "<": - resolve(expLeft": - resolve(expLeft>expRight); - break; - case ">=": - resolve(expLeft>=expRight); - break; - case "+": - resolve(expLeft+expRight); - break; - case "-": - resolve(expLeft-expRight); - break; - case "*": - resolve(expLeft*expRight); - break; - case "/": - if (expRight === 0) { - reject(makeRuntimeRejectMsg(workerScript, "ERROR: Divide by zero")); - } else { - resolve(expLeft/expRight); - } - break; - case "%": - resolve(expLeft%expRight); - break; - case "in": - resolve(expLeft in expRight); - break; - case "instanceof": - resolve(expLeft instanceof expRight); - break; - case "||": - resolve(expLeft || expRight); - break; - case "&&": - resolve(expLeft && expRight); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Bitwise operators are not implemented")); - } - }, function(e) { - reject(e); - }); - }, function(e) { - reject(e); - }); - }); -} - -function evalUnary(exp, workerScript){ - var env = workerScript.env; - return new Promise(function(resolve, reject) { - if (env.stopFlag) {return reject(workerScript);} - var p = evaluate(exp.argument, workerScript); - p.then(function(res) { - if (exp.operator == "!") { - resolve(!res); - } else if (exp.operator == "-") { - if (isNaN(res)) { - resolve(res); - } else { - resolve(-1 * res); - } - } else { - reject(makeRuntimeRejectMsg(workerScript, "Unimplemented unary operator: " + exp.operator)); - } - }).catch(function(e) { - reject(e); - }); - }); -} - -function evalAssignment(exp, workerScript) { - var env = workerScript.env; - return new Promise(function(resolve, reject) { - if (env.stopFlag) {return reject(workerScript);} - - if (exp.left.type != "Identifier" && exp.left.type != "MemberExpression") { - return reject(makeRuntimeRejectMsg(workerScript, "Cannot assign to " + JSON.stringify(exp.left))); - } - - if (exp.operator !== "=" && !(exp.left.name in env.vars)){ - return reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.left.name + " not defined")); - } - - var expRightPromise = evaluate(exp.right, workerScript); - expRightPromise.then(function(expRight) { - if (exp.left.type == "MemberExpression") { - //Assign to array element - //Array object designed by exp.left.object.name - //Index designated by exp.left.property - var name = exp.left.object.name; - if (!(name in env.vars)){ - reject(makeRuntimeRejectMsg(workerScript, "variable " + name + " not defined")); - } - var arr = env.get(name); - if (arr.constructor === Array || arr instanceof Array) { - var iPromise = evaluate(exp.left.property, workerScript); - iPromise.then(function(idx) { - if (isNaN(idx)) { - return reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx)); - } else if (idx >= arr.length || idx < 0) { - return reject(makeRuntimeRejectMsg(workerScript, "Out of bounds: Invalid index in [] operator")); - } else { - env.setArrayElement(name, idx, expRight); - } - }).catch(function(e) { - return reject(e); - }); - } else { - return reject(makeRuntimeRejectMsg(workerScript, "Trying to access a non-array variable using the [] operator")); - } - } else { - //Other assignments - try { - switch (exp.operator) { - case "=": - env.set(exp.left.name,expRight); - break; - case "+=": - env.set(exp.left.name,env.get(exp.left.name) + expRight); - break; - case "-=": - env.set(exp.left.name,env.get(exp.left.name) - expRight); - break; - case "*=": - env.set(exp.left.name,env.get(exp.left.name) * expRight); - break; - case "/=": - env.set(exp.left.name,env.get(exp.left.name) / expRight); - break; - case "%=": - env.set(exp.left.name,env.get(exp.left.name) % expRight); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Bitwise assignment is not implemented")); - } - } catch (e) { - return reject(makeRuntimeRejectMsg(workerScript, "Failed to set environment variable: " + e.toString())); - } - } - resolve(false); //Return false so this doesnt cause conditionals to evaluate - }, function(e) { - reject(e); - }); - }); -} - -//Returns true if any of the if statements evaluated, false otherwise. Therefore, the else statement -//should evaluate if this returns false -function evaluateIf(exp, workerScript, i) { - var env = workerScript.env; - return new Promise(function(resolve, reject) { - evaluate(exp.test, workerScript).then(function(condRes) { - if (condRes) { - evaluate(exp.consequent, workerScript).then(function(res) { - resolve(true); - }, function(e) { - reject(e); - }); - } else if (exp.alternate) { - evaluate(exp.alternate, workerScript).then(function(res) { - resolve(true); - }, function(e) { - reject(e); - }); - } else { - resolve("endIf") - } - }, function(e) { - reject(e); - }); - }); -} - -//Evaluate the looping part of a for loop (Initialization block is NOT done in here) -function evaluateFor(exp, workerScript) { - var env = workerScript.env; - return new Promise(function(resolve, reject) { - if (env.stopFlag) {reject(workerScript); return;} - - var pCond = evaluate(exp.test, workerScript); - pCond.then(function(resCond) { - if (resCond) { - //Run the for loop code - var pBody = evaluate(exp.body, workerScript); - //After the code executes make a recursive call - pBody.then(function(resCode) { - var pUpdate = evaluate(exp.update, workerScript); - pUpdate.then(function(resPostloop) { - var recursiveCall = evaluateFor(exp, workerScript); - recursiveCall.then(function(foo) { - resolve("endForLoop"); - }, function(e) { - reject(e); - }); - }, function(e) { - reject(e); - }); - }, function(e) { - reject(e); - }); - } else { - resolve("endForLoop"); //Doesn't need to resolve to any particular value - } - }, function(e) { - reject(e); - }); - }); -} - -function evaluateWhile(exp, workerScript) { - var env = workerScript.env; - - return new Promise(function(resolve, reject) { - if (env.stopFlag) {reject(workerScript); return;} - - var pCond = new Promise(function(resolve, reject) { - setTimeout(function() { - var evaluatePromise = evaluate(exp.test, workerScript); - evaluatePromise.then(function(resCond) { - resolve(resCond); - }, function(e) { - reject(e); - }); - }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); - }); - - pCond.then(function(resCond) { - if (resCond) { - //Run the while loop code - var pCode = new Promise(function(resolve, reject) { - setTimeout(function() { - var evaluatePromise = evaluate(exp.body, workerScript); - evaluatePromise.then(function(resCode) { - resolve(resCode); - }, function(e) { - reject(e); - }); - }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); - }); - - //After the code executes make a recursive call - pCode.then(function(resCode) { - var recursiveCall = evaluateWhile(exp, workerScript); - recursiveCall.then(function(foo) { - resolve("endWhileLoop"); - }, function(e) { - reject(e); - }); - }, function(e) { - reject(e); - }); - } else { - resolve("endWhileLoop"); //Doesn't need to resolve to any particular value - } - }, function(e) { - reject(e); - }); - }); -} - -function evaluateProg(exp, workerScript, index) { - var env = workerScript.env; - - return new Promise(function(resolve, reject) { - if (env.stopFlag) {reject(workerScript); return;} - - if (index >= exp.body.length) { - resolve("progFinished"); - } else { - //Evaluate this line of code in the prog - var code = new Promise(function(resolve, reject) { - setTimeout(function() { - var evaluatePromise = evaluate(exp.body[index], workerScript); - evaluatePromise.then(function(evalRes) { - resolve(evalRes); - }, function(e) { - reject(e); - }); - }, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].CodeInstructionRunTime); - }); - - //After the code finishes evaluating, evaluate the next line recursively - code.then(function(codeRes) { - var nextLine = evaluateProg(exp, workerScript, index + 1); - nextLine.then(function(nextLineRes) { - resolve(workerScript); - }, function(e) { - reject(e); - }); - }, function(e) { - reject(e); - }); - } - }); -} - -function netscriptDelay(time) { - return new Promise(function(resolve) { - setTimeout(resolve, time); - }); -} - -function makeRuntimeRejectMsg(workerScript, msg) { - return "|"+workerScript.serverIp+"|"+workerScript.name+"|" + msg; -} - -function apply_op(op, a, b) { - function num(x) { - if (typeof x != "number") - throw new Error("Expected number but got " + x); - return x; - } - function div(x) { - if (num(x) == 0) - throw new Error("Divide by zero"); - return x; - } - switch (op) { - case "+": return a + b; - case "-": return num(a) - num(b); - case "*": return num(a) * num(b); - case "/": return num(a) / div(b); - case "%": return num(a) % div(b); - case "&&": return a !== false && b; - case "||": return a !== false ? a : b; - case "<": return num(a) < num(b); - case ">": return num(a) > num(b); - case "<=": return num(a) <= num(b); - case ">=": return num(a) >= num(b); - case "==": return a === b; - case "!=": return a !== b; - } - throw new Error("Can't apply operator " + op); -} - -//Run a script from inside a script using run() command -function runScriptFromScript(server, scriptname, args, workerScript, threads=1) { - //Check if the script is already running - var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_7__Script_js__["d" /* findRunningScript */])(scriptname, args, server); - if (runningScriptObj != null) { - workerScript.scriptRef.log(scriptname + " is already running on " + server.hostname); - return Promise.resolve(false); - } - - //Check if the script exists and if it does run it - for (var i = 0; i < server.scripts.length; ++i) { - if (server.scripts[i].filename == scriptname) { - //Check for admin rights and that there is enough RAM availble to run - var script = server.scripts[i]; - var ramUsage = script.ramUsage; - ramUsage = ramUsage * threads * Math.pow(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1); - var ramAvailable = server.maxRam - server.ramUsed; - - if (server.hasAdminRights == false) { - workerScript.scriptRef.log("Cannot run script " + scriptname + " on " + server.hostname + " because you do not have root access!"); - return Promise.resolve(false); - } else if (ramUsage > ramAvailable){ - workerScript.scriptRef.log("Cannot run script " + scriptname + "(t=" + threads + ") on " + server.hostname + " because there is not enough available RAM!"); - return Promise.resolve(false); - } else { - //Able to run script - workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + Object(__WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__["f" /* printArray */])(args) + ". May take a few seconds to start up..."); - var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_7__Script_js__["b" /* RunningScript */](script, args); - runningScriptObj.threads = threads; - server.runningScripts.push(runningScriptObj); //Push onto runningScripts - Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["c" /* addWorkerScript */])(runningScriptObj, server); - return Promise.resolve(true); - } - } - } - workerScript.scriptRef.log("Could not find script " + scriptname + " on " + server.hostname); - return Promise.resolve(false); -} - -function isScriptErrorMessage(msg) { - if (!Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["e" /* isString */])(msg)) {return false;} - let splitMsg = msg.split("|"); - if (splitMsg.length != 4){ - return false; - } - var ip = splitMsg[1]; - if (!Object(__WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__["c" /* isValidIPAddress */])(ip)) { - return false; - } - return true; -} - -//The same as Player's calculateHackingChance() function but takes in the server as an argument -function scriptCalculateHackingChance(server) { - var difficultyMult = (100 - server.hackDifficulty) / 100; - var skillMult = (1.75 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill); - var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; - var chance = skillChance * difficultyMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_chance_mult; - if (chance > 1) {return 1;} - if (chance < 0) {return 0;} - else {return chance;} -} - -//The same as Player's calculateHackingTime() function but takes in the server as an argument -function scriptCalculateHackingTime(server) { - var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50); - var hackingTime = 5 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds - return hackingTime; -} - -//The same as Player's calculateExpGain() function but takes in the server as an argument -function scriptCalculateExpGain(server) { - if (server.baseDifficulty == null) { - server.baseDifficulty = server.hackDifficulty; - } - return (server.baseDifficulty * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult * 0.3 + 3) * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].HackExpGain; -} - -//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument -function scriptCalculatePercentMoneyHacked(server) { - var difficultyMult = (100 - server.hackDifficulty) / 100; - var skillMult = (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill - (server.requiredHackingSkill - 1)) / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill; - var percentMoneyHacked = difficultyMult * skillMult * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_money_mult / 240; - if (percentMoneyHacked < 0) {return 0;} - if (percentMoneyHacked > 1) {return 1;} - return percentMoneyHacked * __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["a" /* BitNodeMultipliers */].ScriptHackMoney; -} - -//Amount of time to execute grow() in milliseconds -function scriptCalculateGrowTime(server) { - var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50); - var growTime = 16 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds - return growTime * 1000; -} - -//Amount of time to execute weaken() in milliseconds -function scriptCalculateWeakenTime(server) { - var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill + 50); - var weakenTime = 20 * skillFactor / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_speed_mult; //This is in seconds - return weakenTime * 1000; -} - - - - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) {module.exports = get_blob() - -function get_blob() { - if(global.Blob) { - try { - new Blob(['asdf'], {type: 'text/plain'}) - return Blob - } catch(err) {} - } - - var Builder = global.WebKitBlobBuilder || - global.MozBlobBuilder || - global.MSBlobBuilder - - return function(parts, bag) { - var builder = new Builder - , endings = bag.endings - , type = bag.type - - if(endings) for(var i = 0, len = parts.length; i < len; ++i) { - builder.append(parts[i], endings) - } else for(var i = 0, len = parts.length; i < len; ++i) { - builder.append(parts[i]) - } - - return type ? builder.getBlob(type) : builder.getBlob() - } -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(47))) - -/***/ }), -/* 47 */ +/* 57 */ /***/ (function(module, exports) { -var g; +ace.define("ace/theme/solarized_light",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { -// This works in non-strict mode -g = (function() { - return this; -})(); +exports.isDark = false; +exports.cssClass = "ace-solarized-light"; +exports.cssText = ".ace-solarized-light .ace_gutter {\ +background: #fbf1d3;\ +color: #333\ +}\ +.ace-solarized-light .ace_print-margin {\ +width: 1px;\ +background: #e8e8e8\ +}\ +.ace-solarized-light {\ +background-color: #FDF6E3;\ +color: #586E75\ +}\ +.ace-solarized-light .ace_cursor {\ +color: #000000\ +}\ +.ace-solarized-light .ace_marker-layer .ace_selection {\ +background: rgba(7, 54, 67, 0.09)\ +}\ +.ace-solarized-light.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0px #FDF6E3;\ +}\ +.ace-solarized-light .ace_marker-layer .ace_step {\ +background: rgb(255, 255, 0)\ +}\ +.ace-solarized-light .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid rgba(147, 161, 161, 0.50)\ +}\ +.ace-solarized-light .ace_marker-layer .ace_active-line {\ +background: #EEE8D5\ +}\ +.ace-solarized-light .ace_gutter-active-line {\ +background-color : #EDE5C1\ +}\ +.ace-solarized-light .ace_marker-layer .ace_selected-word {\ +border: 1px solid #073642\ +}\ +.ace-solarized-light .ace_invisible {\ +color: rgba(147, 161, 161, 0.50)\ +}\ +.ace-solarized-light .ace_keyword,\ +.ace-solarized-light .ace_meta,\ +.ace-solarized-light .ace_support.ace_class,\ +.ace-solarized-light .ace_support.ace_type {\ +color: #859900\ +}\ +.ace-solarized-light .ace_constant.ace_character,\ +.ace-solarized-light .ace_constant.ace_other {\ +color: #CB4B16\ +}\ +.ace-solarized-light .ace_constant.ace_language {\ +color: #B58900\ +}\ +.ace-solarized-light .ace_constant.ace_numeric {\ +color: #D33682\ +}\ +.ace-solarized-light .ace_fold {\ +background-color: #268BD2;\ +border-color: #586E75\ +}\ +.ace-solarized-light .ace_entity.ace_name.ace_function,\ +.ace-solarized-light .ace_entity.ace_name.ace_tag,\ +.ace-solarized-light .ace_support.ace_function,\ +.ace-solarized-light .ace_variable,\ +.ace-solarized-light .ace_variable.ace_language {\ +color: #268BD2\ +}\ +.ace-solarized-light .ace_storage {\ +color: #073642\ +}\ +.ace-solarized-light .ace_string {\ +color: #2AA198\ +}\ +.ace-solarized-light .ace_string.ace_regexp {\ +color: #D30102\ +}\ +.ace-solarized-light .ace_comment,\ +.ace-solarized-light .ace_entity.ace_other.ace_attribute-name {\ +color: #93A1A1\ +}\ +.ace-solarized-light .ace_indent-guide {\ +background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHjy8NJ/AAjgA5fzQUmBAAAAAElFTkSuQmCC) right repeat-y\ +}"; -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; +var dom = acequire("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); +}); /***/ }), -/* 48 */ -/***/ (function(module, exports) { - -module.exports.id = 'ace/mode/javascript_worker'; -module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\"change\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),applyDelta=acequire(\"./apply_delta\").applyDelta,EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Range=acequire(\"./range\").Range,Anchor=acequire(\"./anchor\").Anchor,Document=function(textOrLines){this.$lines=[\"\"],0===textOrLines.length?this.$lines=[\"\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\"aaa\".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\"changeNewLineMode\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\"\\r\\n\"==text||\"\\r\"==text||\"\\n\"==text},this.getLine=function(row){return this.$lines[row]||\"\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\"\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\"),this.insertMergedLines(position,[\"\",\"\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\"insert\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\"\"]),column=0):(lines=[\"\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\"insert\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\"remove\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\"remove\",lines:[\"\",\"\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\"insert\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\"change\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\"\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\"insert\"==delta.action?\"remove\":\"insert\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\"\").reverse().join(\"\")},exports.stringRepeat=function(string,count){for(var result=\"\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\"\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\"\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\"object\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\"object\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if(\"[object Object]\"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},exports.escapeHTML=function(str){return str.replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:\"insert\",start:data[i],lines:data[i+1]};else var d={action:\"remove\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\"ace/mode/javascript/jshint\",[\"require\",\"exports\",\"module\"],function(acequire,exports,module){module.exports=function outer(modules,cache,entry){function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=\"function\"==typeof acequire&&acequire;if(!jumped&¤tRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);var err=Error(\"Cannot find module '\"+name+\"'\");throw err.code=\"MODULE_NOT_FOUND\",err}var m=cache[name]={exports:{}};modules[name][0].call(m.exports,function(x){var id=modules[name][1][x];return newRequire(id?id:x)},m,m.exports,outer,modules,cache,entry)}return cache[name].exports}for(var previousRequire=\"function\"==typeof acequire&&acequire,i=0;entry.length>i;i++)newRequire(entry[i]);return newRequire(entry[0])}({\"/node_modules/browserify/node_modules/events/events.js\":[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\"function\"==typeof arg}function isNumber(arg){return\"number\"==typeof arg}function isObject(arg){return\"object\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\"n must be a positive number\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\"error\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified \"error\" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[type].length),\"function\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\"listener must be a function\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\"removeListener\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\"removeListener\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\"removeListener\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\"removeListener\"),this._events={},this\n}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],\"/node_modules/jshint/data/ascii-identifier-data.js\":[function(_dereq_,module){for(var identifierStartTable=[],i=0;128>i;i++)identifierStartTable[i]=36===i||i>=65&&90>=i||95===i||i>=97&&122>=i;for(var identifierPartTable=[],i=0;128>i;i++)identifierPartTable[i]=identifierStartTable[i]||i>=48&&57>=i;module.exports={asciiIdentifierStartTable:identifierStartTable,asciiIdentifierPartTable:identifierPartTable}},{}],\"/node_modules/jshint/lodash.js\":[function(_dereq_,module,exports){(function(global){(function(){function baseFindIndex(array,predicate,fromRight){for(var length=array.length,index=fromRight?length:-1;fromRight?index--:length>++index;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return indexOfNaN(array,fromIndex);for(var index=fromIndex-1,length=array.length;length>++index;)if(array[index]===value)return index;return-1}function baseIsFunction(value){return\"function\"==typeof value||!1}function baseToString(value){return\"string\"==typeof value?value:null==value?\"\":value+\"\"}function indexOfNaN(array,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?0:-1);fromRight?index--:length>++index;){var other=array[index];if(other!==other)return index}return-1}function isObjectLike(value){return!!value&&\"object\"==typeof value}function lodash(){}function arrayCopy(source,array){var index=-1,length=source.length;for(array||(array=Array(length));length>++index;)array[index]=source[index];return array}function arrayEach(array,iteratee){for(var index=-1,length=array.length;length>++index&&iteratee(array[index],index,array)!==!1;);return array}function arrayFilter(array,predicate){for(var index=-1,length=array.length,resIndex=-1,result=[];length>++index;){var value=array[index];predicate(value,index,array)&&(result[++resIndex]=value)}return result}function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);length>++index;)result[index]=iteratee(array[index],index,array);return result}function arrayMax(array){for(var index=-1,length=array.length,result=NEGATIVE_INFINITY;length>++index;){var value=array[index];value>result&&(result=value)}return result}function arraySome(array,predicate){for(var index=-1,length=array.length;length>++index;)if(predicate(array[index],index,array))return!0;return!1}function assignWith(object,source,customizer){var props=keys(source);push.apply(props,getSymbols(source));for(var index=-1,length=props.length;length>++index;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(value!==undefined||key in object)||(object[key]=result)}return object}function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;length>++index;){var key=props[index];object[key]=source[key]}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;return\"function\"==type?thisArg===undefined?func:bindCallback(func,thisArg,argCount):null==func?identity:\"object\"==type?baseMatches(func):thisArg===undefined?property(func):baseMatchesProperty(func,thisArg)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer&&(result=object?customizer(value,key,object):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return arrayCopy(value,result)}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag!=objectTag&&tag!=argsTag&&(!isFunc||object))return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{};if(result=initCloneObject(isFunc?{}:value),!isDeep)return baseAssign(result,value)}stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==value)return stackB[length];return stackA.push(value),stackB.push(result),(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)}),result}function baseFilter(collection,predicate){var result=[];return baseEach(collection,function(value,index,collection){predicate(value,index,collection)&&result.push(value)}),result}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseGet(object,path,pathKey){if(null!=object){pathKey!==undefined&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=-1,length=path.length;null!=object&&length>++index;)var result=object=object[path[index]];return result}}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other)return 0!==value||1/value==1/other;var valType=typeof value,othType=typeof other;return\"function\"!=valType&&\"object\"!=valType&&\"function\"!=othType&&\"object\"!=othType||null==value||null==other?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var valWrapped=objIsObj&&hasOwnProperty.call(object,\"__wrapped__\"),othWrapped=othIsObj&&hasOwnProperty.call(other,\"__wrapped__\");if(valWrapped||othWrapped)return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){for(var index=-1,length=props.length,noCustomizer=!customizer;length>++index;)if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object))return!1;for(index=-1;length>++index;){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index])var result=objValue!==undefined||key in object;else result=customizer?customizer(objValue,srcValue,key):undefined,result===undefined&&(result=baseIsEqual(srcValue,objValue,customizer,!0));if(!result)return!1}return!0}function baseMatches(source){var props=keys(source),length=props.length;if(!length)return constant(!0);if(1==length){var key=props[0],value=source[key];if(isStrictComparable(value))return function(object){return null==object?!1:object[key]===value&&(value!==undefined||key in toObject(object))}}for(var values=Array(length),strictCompareFlags=Array(length);length--;)value=source[props[length]],values[length]=value,strictCompareFlags[length]=isStrictComparable(value);return function(object){return null!=object&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(path,value){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(value),pathKey=path+\"\";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),!(!isArr&&isCommon||key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===value?value!==undefined||key in object:baseIsEqual(value,object[key],null,!0)}}function baseMerge(object,source,customizer,stackA,stackB){if(!isObject(object))return object;var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));if(!isSrcArr){var props=keys(source);push.apply(props,getSymbols(source))}return arrayEach(props||source,function(srcValue,key){if(props&&(key=srcValue,srcValue=source[key]),isObjectLike(srcValue))stackA||(stackA=[]),stackB||(stackB=[]),baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB);else{var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue),!isSrcArr&&result===undefined||!isCommon&&(result===result?result===value:value!==value)||(object[key]=result)}}),object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){for(var length=stackA.length,srcValue=source[key];length--;)if(stackA[length]==srcValue)return object[key]=stackB[length],undefined;var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue,isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))?result=isArray(value)?value:getLength(value)?arrayCopy(value):[]:isPlainObject(srcValue)||isArguments(srcValue)?result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}:isCommon=!1),stackA.push(srcValue),stackB.push(result),isCommon?object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB):(result===result?result!==value:value===value)&&(object[key]=result)}function baseProperty(key){return function(object){return null==object?undefined:object[key]}}function basePropertyDeep(path){var pathKey=path+\"\";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,0>start&&(start=-start>length?0:length+start),end=end===undefined||end>length?length:+end||0,0>end&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);length>++index;)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;return baseEach(collection,function(value,index,collection){return result=predicate(value,index,collection),!result}),!!result}function baseValues(object,props){for(var index=-1,length=props.length,result=Array(length);length>++index;)result[index]=object[props[index]];return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(\"number\"==typeof value&&value===value&&HALF_MAX_ARRAY_LENGTH>=high){for(;high>low;){var mid=low+high>>>1,computed=array[mid];(retHighest?value>=computed:value>computed)?low=mid+1:high=mid}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);for(var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=value===undefined;high>low;){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN)var setLow=isReflexive||retHighest;else setLow=valIsUndef?isReflexive&&(retHighest||computed!==undefined):retHighest?value>=computed:value>computed;setLow?low=mid+1:high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(\"function\"!=typeof func)return identity;if(thisArg===undefined)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}function createAssigner(assigner){return restParam(function(object,sources){var index=-1,length=null==object?0:sources.length,customizer=length>2&&sources[length-2],guard=length>2&&sources[2],thisArg=length>1&&sources[length-1];for(\"function\"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer=\"function\"==typeof thisArg?thisArg:null,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=3>length?null:customizer,length=1);length>++index;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:length>++index)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:length>++index;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=getCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return\"function\"==typeof iteratee&&thisArg===undefined&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=!0;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;result&&arrLength>++index;){var arrValue=array[index],othValue=other[index];if(result=undefined,customizer&&(result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)),result===undefined)if(isLoose)for(var othIndex=othLength;othIndex--&&(othValue=other[othIndex],!(result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))););else result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:0==object?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+\"\"}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var skipCtor=isLoose,index=-1;objLength>++index;){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined,customizer&&(result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)),result===undefined&&(result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB))}if(!result)return!1;skipCtor||(skipCtor=\"constructor\"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&\"constructor\"in object&&\"constructor\"in other&&!(\"function\"==typeof objCtor&&objCtor instanceof objCtor&&\"function\"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;return result=result===callback?baseCallback:result,argCount?result(func,thisArg,argCount):result}function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;return result=result===indexOf?baseIndexOf:result,collection?result(collection,target,fromIndex):result}function initCloneArray(array){var length=array.length,result=new array.constructor(length);return length&&\"string\"==typeof array[0]&&hasOwnProperty.call(array,\"index\")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){var Ctor=object.constructor;return\"function\"==typeof Ctor&&Ctor instanceof Ctor||(Ctor=Object),new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isIndex(value,length){return value=+value,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&0==value%1&&length>value}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if(\"number\"==type)var length=getLength(object),prereq=isLength(length)&&isIndex(index,length);else prereq=\"string\"==type&&index in object;if(prereq){var other=object[index];return value===value?value===other:other!==other}return!1}function isKey(value,object){var type=typeof value;if(\"string\"==type&&reIsPlainProp.test(value)||\"number\"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isLength(value){return\"number\"==typeof value&&value>-1&&0==value%1&&MAX_SAFE_INTEGER>=value}function isStrictComparable(value){return value===value&&(0===value?1/value>0:!isObject(value))}function shimIsPlainObject(value){var Ctor;if(lodash.support,!isObjectLike(value)||objToString.call(value)!=objectTag||!hasOwnProperty.call(value,\"constructor\")&&(Ctor=value.constructor,\"function\"==typeof Ctor&&!(Ctor instanceof Ctor)))return!1;var result;return baseForIn(value,function(subValue,key){result=key}),result===undefined||hasOwnProperty.call(value,result)}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support,allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object)),index=-1,result=[];propsLength>++index;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,\"$1\"):number||match)}),result}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length)return-1;if(\"number\"==typeof fromIndex)fromIndex=0>fromIndex?nativeMax(length+fromIndex,0):fromIndex;else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex||0)}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function slice(array,start,end){var length=array?array.length:0;return length?(end&&\"number\"!=typeof end&&isIterateeCall(array,start,end)&&(start=0,end=length),baseSlice(array,start,end)):[]}function unzip(array){for(var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);length>++index;)result[index]=arrayMap(array,baseProperty(index));return result}function includes(collection,target,fromIndex,guard){var length=collection?getLength(collection):0;return isLength(length)||(collection=values(collection),length=collection.length),length?(fromIndex=\"number\"!=typeof fromIndex||guard&&isIterateeCall(target,fromIndex,guard)?0:0>fromIndex?nativeMax(length+fromIndex,0):fromIndex||0,\"string\"==typeof collection||!isArray(collection)&&isString(collection)?length>fromIndex&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1):!1}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=getCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=null),(\"function\"!=typeof predicate||thisArg!==undefined)&&(predicate=getCallback(predicate,thisArg,3)),func(collection,predicate)}function restParam(func,start){if(\"function\"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(start===undefined?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);length>++index;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;start>++index;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}function clone(value,isDeep,customizer,thisArg){return isDeep&&\"boolean\"!=typeof isDeep&&isIterateeCall(value,isDeep,customizer)?isDeep=!1:\"function\"==typeof isDeep&&(thisArg=customizer,customizer=isDeep,isDeep=!1),customizer=\"function\"==typeof customizer&&bindCallback(customizer,thisArg,1),baseClone(value,isDeep,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}function isEmpty(value){if(null==value)return!0;var length=getLength(value);return isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))?!length:!keys(value).length}function isObject(value){var type=typeof value;return\"function\"==type||!!value&&\"object\"==type}function isNative(value){return null==value?!1:objToString.call(value)==funcTag?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value)}function isNumber(value){return\"number\"==typeof value||isObjectLike(value)&&objToString.call(value)==numberTag}function isString(value){return\"string\"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}function toPlainObject(value){return baseCopy(value,keysIn(value))}function has(object,path){if(null==object)return!1;var result=hasOwnProperty.call(object,path);return result||isKey(path)||(path=toPath(path),object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),path=last(path),result=null!=object&&hasOwnProperty.call(object,path)),result}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto=\"function\"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;length>++index;)result[index]=index+\"\";for(var key in object)skipIndexes&&isIndex(key,length)||\"constructor\"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}function values(object){return baseValues(object,keys(object))}function escapeRegExp(string){return string=baseToString(string),string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,\"\\\\$&\"):string}function callback(func,thisArg,guard){return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=null),baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var undefined,VERSION=\"3.7.0\",FUNC_ERROR_TEXT=\"Expected a function\",argsTag=\"[object Arguments]\",arrayTag=\"[object Array]\",boolTag=\"[object Boolean]\",dateTag=\"[object Date]\",errorTag=\"[object Error]\",funcTag=\"[object Function]\",mapTag=\"[object Map]\",numberTag=\"[object Number]\",objectTag=\"[object Object]\",regexpTag=\"[object RegExp]\",setTag=\"[object Set]\",stringTag=\"[object String]\",weakMapTag=\"[object WeakMap]\",arrayBufferTag=\"[object ArrayBuffer]\",float32Tag=\"[object Float32Array]\",float64Tag=\"[object Float64Array]\",int8Tag=\"[object Int8Array]\",int16Tag=\"[object Int16Array]\",int32Tag=\"[object Int32Array]\",uint8Tag=\"[object Uint8Array]\",uint8ClampedTag=\"[object Uint8ClampedArray]\",uint16Tag=\"[object Uint16Array]\",uint32Tag=\"[object Uint32Array]\",reIsDeepProp=/\\.|\\[(?:[^[\\]]+|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?)\\1\\]/,reIsPlainProp=/^\\w*$/,rePropName=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g,reRegExpChars=/[.*+?^${}()|[\\]\\/\\\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source),reEscapeChar=/\\\\(\\\\)?/g,reFlags=/\\w*$/,reIsHostCtor=/^\\[object .+?Constructor\\]$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=!1;var objectTypes={\"function\":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,freeGlobal=freeExports&&freeModule&&\"object\"==typeof global&&global&&global.Object&&global,freeSelf=objectTypes[typeof self]&&self&&self.Object&&self,freeWindow=objectTypes[typeof window]&&window&&window.Object&&window,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,root=freeGlobal||freeWindow!==(this&&this.window)&&freeWindow||freeSelf||this,arrayProto=Array.prototype,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp(\"^\"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\"),ArrayBuffer=isNative(ArrayBuffer=root.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,getOwnPropertySymbols=isNative(getOwnPropertySymbols=Object.getOwnPropertySymbols)&&getOwnPropertySymbols,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,preventExtensions=isNative(Object.preventExtensions=Object.preventExtensions)&&preventExtensions,propertyIsEnumerable=objectProto.propertyIsEnumerable,Uint8Array=isNative(Uint8Array=root.Uint8Array)&&Uint8Array,Float64Array=function(){try{var func=isNative(func=root.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}(),nativeAssign=function(){var object={1:0},func=preventExtensions&&isNative(func=Object.assign)&&func;try{func(preventExtensions(object),\"xo\")}catch(e){}return!object[1]&&func}(),nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0,MAX_SAFE_INTEGER=Math.pow(2,53)-1,support=lodash.support={};(function(x){var Ctor=function(){this.x=x},props=[];Ctor.prototype={valueOf:x,y:x};for(var key in new Ctor)props.push(key);support.funcDecomp=/\\bthis\\b/.test(function(){return this}),support.funcNames=\"string\"==typeof Function.name;try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=!0}})(1,0);var baseAssign=nativeAssign||function(object,source){return null==source?object:baseCopy(source,getSymbols(source),baseCopy(source,keys(source),object))},baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor();bufferSlice||(bufferClone=ArrayBuffer&&Uint8Array?function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}return byteLength!=offset&&(view=new Uint8Array(result,offset),view.set(new Uint8Array(buffer,offset))),result}:constant(null));var getLength=baseProperty(\"length\"),getSymbols=getOwnPropertySymbols?function(object){return getOwnPropertySymbols(toObject(object))}:constant([]),findLastIndex=createFindIndex(!0),zip=restParam(unzip),forEach=createForEach(arrayEach,baseEach),isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag},isFunction=baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array)?function(value){return objToString.call(value)==funcTag}:baseIsFunction,isPlainObject=getPrototypeOf?function(value){if(!value||objToString.call(value)!=objectTag)return!1;var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)}:shimIsPlainObject,assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)}),keys=nativeKeys?function(object){if(object)var Ctor=object.constructor,length=object.length;return\"function\"==typeof Ctor&&Ctor.prototype===object||\"function\"!=typeof object&&isLength(length)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys,merge=createAssigner(baseMerge);lodash.assign=assign,lodash.callback=callback,lodash.constant=constant,lodash.forEach=forEach,lodash.keys=keys,lodash.keysIn=keysIn,lodash.merge=merge,lodash.property=property,lodash.reject=reject,lodash.restParam=restParam,lodash.slice=slice,lodash.toPlainObject=toPlainObject,lodash.unzip=unzip,lodash.values=values,lodash.zip=zip,lodash.each=forEach,lodash.extend=assign,lodash.iteratee=callback,lodash.clone=clone,lodash.escapeRegExp=escapeRegExp,lodash.findLastIndex=findLastIndex,lodash.has=has,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isEmpty=isEmpty,lodash.isFunction=isFunction,lodash.isNative=isNative,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isPlainObject=isPlainObject,lodash.isString=isString,lodash.isTypedArray=isTypedArray,lodash.last=last,lodash.some=some,lodash.any=some,lodash.contains=includes,lodash.include=includes,lodash.VERSION=VERSION,freeExports&&freeModule?moduleExports?(freeModule.exports=lodash)._=lodash:freeExports._=lodash:root._=lodash\n}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],\"/node_modules/jshint/src/jshint.js\":[function(_dereq_,module,exports){var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),vars=_dereq_(\"./vars.js\"),messages=_dereq_(\"./messages.js\"),Lexer=_dereq_(\"./lex.js\").Lexer,reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,style=_dereq_(\"./style.js\"),options=_dereq_(\"./options.js\"),scopeManager=_dereq_(\"./scope-manager.js\"),JSHINT=function(){\"use strict\";function checkOption(name,t){return name=name.trim(),/^[+-]W\\d{3}$/g.test(name)?!0:-1!==options.validNames.indexOf(name)||\"jslint\"===t.type||_.has(options.removed,name)?!0:(error(\"E001\",t,name),!1)}function isString(obj){return\"[object String]\"===Object.prototype.toString.call(obj)}function isIdentifier(tkn,value){return tkn?tkn.identifier&&tkn.value===value?!0:!1:!1}function isReserved(token){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(token.isProperty)return!1}return!0}function supplant(str,data){return str.replace(/\\{([^{}]*)\\}/g,function(a,b){var r=data[b];return\"string\"==typeof r||\"number\"==typeof r?r:a})}function combine(dest,src){Object.keys(src).forEach(function(name){_.has(JSHINT.blacklist,name)||(dest[name]=src[name])})}function processenforceall(){if(state.option.enforceall){for(var enforceopt in options.bool.enforcing)void 0!==state.option[enforceopt]||options.noenforceall[enforceopt]||(state.option[enforceopt]=!0);for(var relaxopt in options.bool.relaxing)void 0===state.option[relaxopt]&&(state.option[relaxopt]=!1)}}function assume(){processenforceall(),state.option.esversion||state.option.moz||(state.option.esversion=state.option.es3?3:state.option.esnext?6:5),state.inES5()&&combine(predefined,vars.ecmaIdentifiers[5]),state.inES6()&&combine(predefined,vars.ecmaIdentifiers[6]),state.option.module&&(state.option.strict===!0&&(state.option.strict=\"global\"),state.inES6()||warning(\"W134\",state.tokens.next,\"module\",6)),state.option.couch&&combine(predefined,vars.couch),state.option.qunit&&combine(predefined,vars.qunit),state.option.rhino&&combine(predefined,vars.rhino),state.option.shelljs&&(combine(predefined,vars.shelljs),combine(predefined,vars.node)),state.option.typed&&combine(predefined,vars.typed),state.option.phantom&&(combine(predefined,vars.phantom),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.prototypejs&&combine(predefined,vars.prototypejs),state.option.node&&(combine(predefined,vars.node),combine(predefined,vars.typed),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.devel&&combine(predefined,vars.devel),state.option.dojo&&combine(predefined,vars.dojo),state.option.browser&&(combine(predefined,vars.browser),combine(predefined,vars.typed)),state.option.browserify&&(combine(predefined,vars.browser),combine(predefined,vars.typed),combine(predefined,vars.browserify),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.nonstandard&&combine(predefined,vars.nonstandard),state.option.jasmine&&combine(predefined,vars.jasmine),state.option.jquery&&combine(predefined,vars.jquery),state.option.mootools&&combine(predefined,vars.mootools),state.option.worker&&combine(predefined,vars.worker),state.option.wsh&&combine(predefined,vars.wsh),state.option.globalstrict&&state.option.strict!==!1&&(state.option.strict=\"global\"),state.option.yui&&combine(predefined,vars.yui),state.option.mocha&&combine(predefined,vars.mocha)}function quit(code,line,chr){var percentage=Math.floor(100*(line/state.lines.length)),message=messages.errors[code].desc;throw{name:\"JSHintError\",line:line,character:chr,message:message+\" (\"+percentage+\"% scanned).\",raw:message,code:code}}function removeIgnoredMessages(){var ignored=state.ignoredLines;_.isEmpty(ignored)||(JSHINT.errors=_.reject(JSHINT.errors,function(err){return ignored[err.line]}))}function warning(code,t,a,b,c,d){var ch,l,w,msg;if(/^W\\d{3}$/.test(code)){if(state.ignored[code])return;msg=messages.warnings[code]}else/E\\d{3}/.test(code)?msg=messages.errors[code]:/I\\d{3}/.test(code)&&(msg=messages.info[code]);return t=t||state.tokens.next||{},\"(end)\"===t.id&&(t=state.tokens.curr),l=t.line||0,ch=t.from||0,w={id:\"(error)\",raw:msg.desc,code:msg.code,evidence:state.lines[l-1]||\"\",line:l,character:ch,scope:JSHINT.scope,a:a,b:b,c:c,d:d},w.reason=supplant(msg.desc,w),JSHINT.errors.push(w),removeIgnoredMessages(),JSHINT.errors.length>=state.option.maxerr&&quit(\"E043\",l,ch),w}function warningAt(m,l,ch,a,b,c,d){return warning(m,{line:l,from:ch},a,b,c,d)}function error(m,t,a,b,c,d){warning(m,t,a,b,c,d)}function errorAt(m,l,ch,a,b,c,d){return error(m,{line:l,from:ch},a,b,c,d)}function addInternalSrc(elem,src){var i;return i={id:\"(internal)\",elem:elem,value:src},JSHINT.internals.push(i),i}function doOption(){var nt=state.tokens.next,body=nt.body.match(/(-\\s+)?[^\\s,:]+(?:\\s*:\\s*(-\\s+)?[^\\s,]+)?/g)||[],predef={};if(\"globals\"===nt.type){body.forEach(function(g,idx){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(\"-\"===key||!key.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}\"-\"===key.charAt(0)?(key=key.slice(1),val=!1,JSHINT.blacklist[key]=key,delete predefined[key]):predef[key]=\"true\"===val}),combine(predefined,predef);for(var key in predef)_.has(predef,key)&&(declared[key]=nt)}\"exported\"===nt.type&&body.forEach(function(e,idx){if(!e.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}state.funct[\"(scope)\"].addExported(e)}),\"members\"===nt.type&&(membersOnly=membersOnly||{},body.forEach(function(m){var ch1=m.charAt(0),ch2=m.charAt(m.length-1);ch1!==ch2||'\"'!==ch1&&\"'\"!==ch1||(m=m.substr(1,m.length-2).replace('\\\\\"','\"')),membersOnly[m]=!1}));var numvals=[\"maxstatements\",\"maxparams\",\"maxdepth\",\"maxcomplexity\",\"maxerr\",\"maxlen\",\"indent\"];(\"jshint\"===nt.type||\"jslint\"===nt.type)&&(body.forEach(function(g){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(checkOption(key,nt))if(numvals.indexOf(key)>=0)if(\"false\"!==val){if(val=+val,\"number\"!=typeof val||!isFinite(val)||0>=val||Math.floor(val)!==val)return error(\"E032\",nt,g[1].trim()),void 0;state.option[key]=val}else state.option[key]=\"indent\"===key?4:!1;else{if(\"validthis\"===key)return state.funct[\"(global)\"]?void error(\"E009\"):\"true\"!==val&&\"false\"!==val?void error(\"E002\",nt):(state.option.validthis=\"true\"===val,void 0);if(\"quotmark\"!==key)if(\"shadow\"!==key)if(\"unused\"!==key)if(\"latedef\"!==key)if(\"ignore\"!==key)if(\"strict\"!==key){\"module\"===key&&(hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"module\"));var esversions={es3:3,es5:5,esnext:6};if(!_.has(esversions,key)){if(\"esversion\"===key){switch(val){case\"5\":state.inES5(!0)&&warning(\"I003\");case\"3\":case\"6\":state.option.moz=!1,state.option.esversion=+val;break;case\"2015\":state.option.moz=!1,state.option.esversion=6;break;default:error(\"E002\",nt)}return hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"esversion\"),void 0}var match=/^([+-])(W\\d{3})$/g.exec(key);if(match)return state.ignored[match[2]]=\"-\"===match[1],void 0;var tn;return\"true\"===val||\"false\"===val?(\"jslint\"===nt.type?(tn=options.renamed[key]||key,state.option[tn]=\"true\"===val,void 0!==options.inverted[tn]&&(state.option[tn]=!state.option[tn])):state.option[key]=\"true\"===val,\"newcap\"===key&&(state.option[\"(explicitNewcap)\"]=!0),void 0):(error(\"E002\",nt),void 0)}switch(val){case\"true\":state.option.moz=!1,state.option.esversion=esversions[key];break;case\"false\":state.option.moz||(state.option.esversion=5);break;default:error(\"E002\",nt)}}else switch(val){case\"true\":state.option.strict=!0;break;case\"false\":state.option.strict=!1;break;case\"func\":case\"global\":case\"implied\":state.option.strict=val;break;default:error(\"E002\",nt)}else switch(val){case\"line\":state.ignoredLines[nt.line]=!0,removeIgnoredMessages();break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.latedef=!0;break;case\"false\":state.option.latedef=!1;break;case\"nofunc\":state.option.latedef=\"nofunc\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.unused=!0;break;case\"false\":state.option.unused=!1;break;case\"vars\":case\"strict\":state.option.unused=val;break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.shadow=!0;break;case\"outer\":state.option.shadow=\"outer\";break;case\"false\":case\"inner\":state.option.shadow=\"inner\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":case\"false\":state.option.quotmark=\"true\"===val;break;case\"double\":case\"single\":state.option.quotmark=val;break;default:error(\"E002\",nt)}}}),assume())}function peek(p){var t,i=p||0,j=lookahead.length;if(j>i)return lookahead[i];for(;i>=j;)t=lookahead[j],t||(t=lookahead[j]=lex.token()),j+=1;return t||\"(end)\"!==state.tokens.next.id?t:state.tokens.next}function peekIgnoreEOL(){var t,i=0;do t=peek(i++);while(\"(endline)\"===t.id);return t}function advance(id,t){switch(state.tokens.curr.id){case\"(number)\":\".\"===state.tokens.next.id&&warning(\"W005\",state.tokens.curr);break;case\"-\":(\"-\"===state.tokens.next.id||\"--\"===state.tokens.next.id)&&warning(\"W006\");break;case\"+\":(\"+\"===state.tokens.next.id||\"++\"===state.tokens.next.id)&&warning(\"W007\")}for(id&&state.tokens.next.id!==id&&(t?\"(end)\"===state.tokens.next.id?error(\"E019\",t,t.id):error(\"E020\",state.tokens.next,id,t.id,t.line,state.tokens.next.value):(\"(identifier)\"!==state.tokens.next.type||state.tokens.next.value!==id)&&warning(\"W116\",state.tokens.next,id,state.tokens.next.value)),state.tokens.prev=state.tokens.curr,state.tokens.curr=state.tokens.next;;){if(state.tokens.next=lookahead.shift()||lex.token(),state.tokens.next||quit(\"E041\",state.tokens.curr.line),\"(end)\"===state.tokens.next.id||\"(error)\"===state.tokens.next.id)return;if(state.tokens.next.check&&state.tokens.next.check(),state.tokens.next.isSpecial)\"falls through\"===state.tokens.next.type?state.tokens.curr.caseFallsThrough=!0:doOption();else if(\"(endline)\"!==state.tokens.next.id)break}}function isInfix(token){return token.infix||!token.identifier&&!token.template&&!!token.led}function isEndOfExpr(){var curr=state.tokens.curr,next=state.tokens.next;return\";\"===next.id||\"}\"===next.id||\":\"===next.id?!0:isInfix(next)===isInfix(curr)||\"yield\"===curr.id&&state.inMoz()?curr.line!==startLine(next):!1}function isBeginOfExpr(prev){return!prev.left&&\"unary\"!==prev.arity}function expression(rbp,initial){var left,isArray=!1,isObject=!1,isLetExpr=!1;state.nameStack.push(),initial||\"let\"!==state.tokens.next.value||\"(\"!==peek(0).value||(state.inMoz()||warning(\"W118\",state.tokens.next,\"let expressions\"),isLetExpr=!0,state.funct[\"(scope)\"].stack(),advance(\"let\"),advance(\"(\"),state.tokens.prev.fud(),advance(\")\")),\"(end)\"===state.tokens.next.id&&error(\"E006\",state.tokens.curr);var isDangerous=state.option.asi&&state.tokens.prev.line!==startLine(state.tokens.curr)&&_.contains([\"]\",\")\"],state.tokens.prev.id)&&_.contains([\"[\",\"(\"],state.tokens.curr.id);if(isDangerous&&warning(\"W014\",state.tokens.curr,state.tokens.curr.id),advance(),initial&&(state.funct[\"(verb)\"]=state.tokens.curr.value,state.tokens.curr.beginsStmt=!0),initial===!0&&state.tokens.curr.fud)left=state.tokens.curr.fud();else for(state.tokens.curr.nud?left=state.tokens.curr.nud():error(\"E030\",state.tokens.curr,state.tokens.curr.id);(state.tokens.next.lbp>rbp||\"(template)\"===state.tokens.next.type)&&!isEndOfExpr();)isArray=\"Array\"===state.tokens.curr.value,isObject=\"Object\"===state.tokens.curr.value,left&&(left.value||left.first&&left.first.value)&&(\"new\"!==left.value||left.first&&left.first.value&&\".\"===left.first.value)&&(isArray=!1,left.value!==state.tokens.curr.value&&(isObject=!1)),advance(),isArray&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W009\",state.tokens.curr),isObject&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W010\",state.tokens.curr),left&&state.tokens.curr.led?left=state.tokens.curr.led(left):error(\"E033\",state.tokens.curr,state.tokens.curr.id);return isLetExpr&&state.funct[\"(scope)\"].unstack(),state.nameStack.pop(),left}function startLine(token){return token.startLine||token.line}function nobreaknonadjacent(left,right){left=left||state.tokens.curr,right=right||state.tokens.next,state.option.laxbreak||left.line===startLine(right)||warning(\"W014\",right,right.value)}function nolinebreak(t){t=t||state.tokens.curr,t.line!==startLine(state.tokens.next)&&warning(\"E022\",t,t.value)}function nobreakcomma(left,right){left.line!==startLine(right)&&(state.option.laxcomma||(comma.first&&(warning(\"I001\"),comma.first=!1),warning(\"W014\",left,right.value)))}function comma(opts){if(opts=opts||{},opts.peek?nobreakcomma(state.tokens.prev,state.tokens.curr):(nobreakcomma(state.tokens.curr,state.tokens.next),advance(\",\")),state.tokens.next.identifier&&(!opts.property||!state.inES5()))switch(state.tokens.next.value){case\"break\":case\"case\":case\"catch\":case\"continue\":case\"default\":case\"do\":case\"else\":case\"finally\":case\"for\":case\"if\":case\"in\":case\"instanceof\":case\"return\":case\"switch\":case\"throw\":case\"try\":case\"var\":case\"let\":case\"while\":case\"with\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}if(\"(punctuator)\"===state.tokens.next.type)switch(state.tokens.next.value){case\"}\":case\"]\":case\",\":if(opts.allowTrailing)return!0;case\")\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}return!0}function symbol(s,p){var x=state.syntax[s];return x&&\"object\"==typeof x||(state.syntax[s]=x={id:s,lbp:p,value:s}),x}function delim(s){var x=symbol(s,0);return x.delim=!0,x}function stmt(s,f){var x=delim(s);return x.identifier=x.reserved=!0,x.fud=f,x}function blockstmt(s,f){var x=stmt(s,f);return x.block=!0,x}function reserveName(x){var c=x.id.charAt(0);return(c>=\"a\"&&\"z\">=c||c>=\"A\"&&\"Z\">=c)&&(x.identifier=x.reserved=!0),x}function prefix(s,f){var x=symbol(s,150);return reserveName(x),x.nud=\"function\"==typeof f?f:function(){return this.arity=\"unary\",this.right=expression(150),(\"++\"===this.id||\"--\"===this.id)&&(state.option.plusplus?warning(\"W016\",this,this.id):!this.right||this.right.identifier&&!isReserved(this.right)||\".\"===this.right.id||\"[\"===this.right.id||warning(\"W017\",this),this.right&&this.right.isMetaProperty?error(\"E031\",this):this.right&&this.right.identifier&&state.funct[\"(scope)\"].block.modify(this.right.value,this)),this},x}function type(s,f){var x=delim(s);return x.type=s,x.nud=f,x}function reserve(name,func){var x=type(name,func);return x.identifier=!0,x.reserved=!0,x}function FutureReservedWord(name,meta){var x=type(name,meta&&meta.nud||function(){return this});return meta=meta||{},meta.isFutureReservedWord=!0,x.value=name,x.identifier=!0,x.reserved=!0,x.meta=meta,x}function reservevar(s,v){return reserve(s,function(){return\"function\"==typeof v&&v(this),this})}function infix(s,f,p,w){var x=symbol(s,p);return reserveName(x),x.infix=!0,x.led=function(left){return w||nobreaknonadjacent(state.tokens.prev,state.tokens.curr),\"in\"!==s&&\"instanceof\"!==s||\"!\"!==left.id||warning(\"W018\",left,\"!\"),\"function\"==typeof f?f(left,this):(this.left=left,this.right=expression(p),this)},x}function application(s){var x=symbol(s,42);return x.led=function(left){return nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left,this.right=doFunction({type:\"arrow\",loneArg:left}),this},x}function relation(s,f){var x=symbol(s,100);return x.led=function(left){nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left;var right=this.right=expression(100);return isIdentifier(left,\"NaN\")||isIdentifier(right,\"NaN\")?warning(\"W019\",this):f&&f.apply(this,[left,right]),left&&right||quit(\"E041\",state.tokens.curr.line),\"!\"===left.id&&warning(\"W018\",left,\"!\"),\"!\"===right.id&&warning(\"W018\",right,\"!\"),this},x}function isPoorRelation(node){return node&&(\"(number)\"===node.type&&0===+node.value||\"(string)\"===node.type&&\"\"===node.value||\"null\"===node.type&&!state.option.eqnull||\"true\"===node.type||\"false\"===node.type||\"undefined\"===node.type)}function isTypoTypeof(left,right,state){var values;return state.option.notypeof?!1:left&&right?(values=state.inES6()?typeofValues.es6:typeofValues.es3,\"(identifier)\"===right.type&&\"typeof\"===right.value&&\"(string)\"===left.type?!_.contains(values,left.value):!1):!1}function isGlobalEval(left,state){var isGlobal=!1;return\"this\"===left.type&&null===state.funct[\"(context)\"]?isGlobal=!0:\"(identifier)\"===left.type&&(state.option.node&&\"global\"===left.value?isGlobal=!0:!state.option.browser||\"window\"!==left.value&&\"document\"!==left.value||(isGlobal=!0)),isGlobal}function findNativePrototype(left){function walkPrototype(obj){return\"object\"==typeof obj?\"prototype\"===obj.right?obj:walkPrototype(obj.left):void 0}function walkNative(obj){for(;!obj.identifier&&\"object\"==typeof obj.left;)obj=obj.left;return obj.identifier&&natives.indexOf(obj.value)>=0?obj.value:void 0}var natives=[\"Array\",\"ArrayBuffer\",\"Boolean\",\"Collator\",\"DataView\",\"Date\",\"DateTimeFormat\",\"Error\",\"EvalError\",\"Float32Array\",\"Float64Array\",\"Function\",\"Infinity\",\"Intl\",\"Int16Array\",\"Int32Array\",\"Int8Array\",\"Iterator\",\"Number\",\"NumberFormat\",\"Object\",\"RangeError\",\"ReferenceError\",\"RegExp\",\"StopIteration\",\"String\",\"SyntaxError\",\"TypeError\",\"Uint16Array\",\"Uint32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"URIError\"],prototype=walkPrototype(left);return prototype?walkNative(prototype):void 0}function checkLeftSideAssign(left,assignToken,options){var allowDestructuring=options&&options.allowDestructuring;if(assignToken=assignToken||left,state.option.freeze){var nativeObject=findNativePrototype(left);nativeObject&&warning(\"W121\",left,nativeObject)}return left.identifier&&!left.isMetaProperty&&state.funct[\"(scope)\"].block.reassign(left.value,left),\".\"===left.id?((!left.left||\"arguments\"===left.left.value&&!state.isStrict())&&warning(\"E031\",assignToken),state.nameStack.set(state.tokens.prev),!0):\"{\"===left.id||\"[\"===left.id?(allowDestructuring&&state.tokens.curr.left.destructAssign?state.tokens.curr.left.destructAssign.forEach(function(t){t.id&&state.funct[\"(scope)\"].block.modify(t.id,t.token)}):\"{\"!==left.id&&left.left?\"arguments\"!==left.left.value||state.isStrict()||warning(\"E031\",assignToken):warning(\"E031\",assignToken),\"[\"===left.id&&state.nameStack.set(left.right),!0):left.isMetaProperty?(error(\"E031\",assignToken),!0):left.identifier&&!isReserved(left)?(\"exception\"===state.funct[\"(scope)\"].labeltype(left.value)&&warning(\"W022\",left),state.nameStack.set(left),!0):(left===state.syntax[\"function\"]&&warning(\"W023\",state.tokens.curr),!1)}function assignop(s,f,p){var x=infix(s,\"function\"==typeof f?f:function(left,that){return that.left=left,left&&checkLeftSideAssign(left,that,{allowDestructuring:!0})?(that.right=expression(10),that):(error(\"E031\",that),void 0)},p);return x.exps=!0,x.assign=!0,x}function bitwise(s,f,p){var x=symbol(s,p);return reserveName(x),x.led=\"function\"==typeof f?f:function(left){return state.option.bitwise&&warning(\"W016\",this,this.id),this.left=left,this.right=expression(p),this},x}function bitwiseassignop(s){return assignop(s,function(left,that){return state.option.bitwise&&warning(\"W016\",that,that.id),left&&checkLeftSideAssign(left,that)?(that.right=expression(10),that):(error(\"E031\",that),void 0)},20)}function suffix(s){var x=symbol(s,150);return x.led=function(left){return state.option.plusplus?warning(\"W016\",this,this.id):left.identifier&&!isReserved(left)||\".\"===left.id||\"[\"===left.id||warning(\"W017\",this),left.isMetaProperty?error(\"E031\",this):left&&left.identifier&&state.funct[\"(scope)\"].block.modify(left.value,left),this.left=left,this},x}function optionalidentifier(fnparam,prop,preserve){if(state.tokens.next.identifier){preserve||advance();var curr=state.tokens.curr,val=state.tokens.curr.value;return isReserved(curr)?prop&&state.inES5()?val:fnparam&&\"undefined\"===val?val:(warning(\"W024\",state.tokens.curr,state.tokens.curr.id),val):val}}function identifier(fnparam,prop){var i=optionalidentifier(fnparam,prop,!1);if(i)return i;if(\"...\"===state.tokens.next.value){if(state.inES6(!0)||warning(\"W119\",state.tokens.next,\"spread/rest operator\",\"6\"),advance(),checkPunctuator(state.tokens.next,\"...\"))for(warning(\"E024\",state.tokens.next,\"...\");checkPunctuator(state.tokens.next,\"...\");)advance();return state.tokens.next.identifier?identifier(fnparam,prop):(warning(\"E024\",state.tokens.curr,\"...\"),void 0)}error(\"E030\",state.tokens.next,state.tokens.next.value),\";\"!==state.tokens.next.id&&advance()}function reachable(controlToken){var t,i=0;if(\";\"===state.tokens.next.id&&!controlToken.inBracelessBlock)for(;;){do t=peek(i),i+=1;while(\"(end)\"!==t.id&&\"(comment)\"===t.id);if(t.reach)return;if(\"(endline)\"!==t.id){if(\"function\"===t.id){state.option.latedef===!0&&warning(\"W026\",t);break}warning(\"W027\",t,t.value,controlToken.value);break}}}function parseFinalSemicolon(){if(\";\"!==state.tokens.next.id){if(state.tokens.next.isUnclosed)return advance();var sameLine=startLine(state.tokens.next)===state.tokens.curr.line&&\"(end)\"!==state.tokens.next.id,blockEnd=checkPunctuator(state.tokens.next,\"}\");sameLine&&!blockEnd?errorAt(\"E058\",state.tokens.curr.line,state.tokens.curr.character):state.option.asi||(blockEnd&&!state.option.lastsemic||!sameLine)&&warningAt(\"W033\",state.tokens.curr.line,state.tokens.curr.character)}else advance(\";\")}function statement(){var r,i=indent,t=state.tokens.next,hasOwnScope=!1;if(\";\"===t.id)return advance(\";\"),void 0;var res=isReserved(t);if(res&&t.meta&&t.meta.isFutureReservedWord&&\":\"===peek().id&&(warning(\"W024\",t,t.id),res=!1),t.identifier&&!res&&\":\"===peek().id&&(advance(),advance(\":\"),hasOwnScope=!0,state.funct[\"(scope)\"].stack(),state.funct[\"(scope)\"].block.addBreakLabel(t.value,{token:state.tokens.curr}),state.tokens.next.labelled||\"{\"===state.tokens.next.value||warning(\"W028\",state.tokens.next,t.value,state.tokens.next.value),state.tokens.next.label=t.value,t=state.tokens.next),\"{\"===t.id){var iscase=\"case\"===state.funct[\"(verb)\"]&&\":\"===state.tokens.curr.value;return block(!0,!0,!1,!1,iscase),void 0}return r=expression(0,!0),!r||r.identifier&&\"function\"===r.value||\"(punctuator)\"===r.type&&r.left&&r.left.identifier&&\"function\"===r.left.value||state.isStrict()||\"global\"!==state.option.strict||warning(\"E007\"),t.block||(state.option.expr||r&&r.exps?state.option.nonew&&r&&r.left&&\"(\"===r.id&&\"new\"===r.left.id&&warning(\"W031\",t):warning(\"W030\",state.tokens.curr),parseFinalSemicolon()),indent=i,hasOwnScope&&state.funct[\"(scope)\"].unstack(),r}function statements(){for(var p,a=[];!state.tokens.next.reach&&\"(end)\"!==state.tokens.next.id;)\";\"===state.tokens.next.id?(p=peek(),(!p||\"(\"!==p.id&&\"[\"!==p.id)&&warning(\"W032\"),advance(\";\")):a.push(statement());return a}function directives(){for(var i,p,pn;\"(string)\"===state.tokens.next.id;){if(p=peek(0),\"(endline)\"===p.id){i=1;do pn=peek(i++);while(\"(endline)\"===pn.id);if(\";\"===pn.id)p=pn;else{if(\"[\"===pn.value||\".\"===pn.value)break;state.option.asi&&\"(\"!==pn.value||warning(\"W033\",state.tokens.next)}}else{if(\".\"===p.id||\"[\"===p.id)break;\";\"!==p.id&&warning(\"W033\",p)}advance();var directive=state.tokens.curr.value;(state.directive[directive]||\"use strict\"===directive&&\"implied\"===state.option.strict)&&warning(\"W034\",state.tokens.curr,directive),state.directive[directive]=!0,\";\"===p.id&&advance(\";\")}state.isStrict()&&(state.option[\"(explicitNewcap)\"]||(state.option.newcap=!0),state.option.undef=!0)}function block(ordinary,stmt,isfunc,isfatarrow,iscase){var a,m,t,line,d,b=inblock,old_indent=indent;inblock=ordinary,t=state.tokens.next;var metrics=state.funct[\"(metrics)\"];if(metrics.nestedBlockDepth+=1,metrics.verifyMaxNestedBlockDepthPerFunction(),\"{\"===state.tokens.next.id){if(advance(\"{\"),state.funct[\"(scope)\"].stack(),line=state.tokens.curr.line,\"}\"!==state.tokens.next.id){for(indent+=state.option.indent;!ordinary&&state.tokens.next.from>indent;)indent+=state.option.indent;if(isfunc){m={};for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);directives(),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\"))}a=statements(),metrics.statementCount+=a.length,indent-=state.option.indent}advance(\"}\",t),isfunc&&(state.funct[\"(scope)\"].validateParams(),m&&(state.directive=m)),state.funct[\"(scope)\"].unstack(),indent=old_indent}else if(ordinary)state.funct[\"(noblockscopedvar)\"]=\"for\"!==state.tokens.next.id,state.funct[\"(scope)\"].stack(),(!stmt||state.option.curly)&&warning(\"W116\",state.tokens.next,\"{\",state.tokens.next.value),state.tokens.next.inBracelessBlock=!0,indent+=state.option.indent,a=[statement()],indent-=state.option.indent,state.funct[\"(scope)\"].unstack(),delete state.funct[\"(noblockscopedvar)\"];else if(isfunc){if(state.funct[\"(scope)\"].stack(),m={},!stmt||isfatarrow||state.inMoz()||error(\"W118\",state.tokens.curr,\"function closure expressions\"),!stmt)for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);expression(10),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\")),state.funct[\"(scope)\"].unstack()}else error(\"E021\",state.tokens.next,\"{\",state.tokens.next.value);switch(state.funct[\"(verb)\"]){case\"break\":case\"continue\":case\"return\":case\"throw\":if(iscase)break;default:state.funct[\"(verb)\"]=null}return inblock=b,!ordinary||!state.option.noempty||a&&0!==a.length||warning(\"W035\",state.tokens.prev),metrics.nestedBlockDepth-=1,a}function countMember(m){membersOnly&&\"boolean\"!=typeof membersOnly[m]&&warning(\"W036\",state.tokens.curr,m),\"number\"==typeof member[m]?member[m]+=1:member[m]=1}function comprehensiveArrayExpression(){var res={};res.exps=!0,state.funct[\"(comparray)\"].stack();var reversed=!1;return\"for\"!==state.tokens.next.value&&(reversed=!0,state.inMoz()||warning(\"W116\",state.tokens.next,\"for\",state.tokens.next.value),state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"for\"),\"each\"===state.tokens.next.value&&(advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"define\"),res.left=expression(130),_.contains([\"in\",\"of\"],state.tokens.next.value)?advance():error(\"E045\",state.tokens.curr),state.funct[\"(comparray)\"].setState(\"generate\"),expression(10),advance(\")\"),\"if\"===state.tokens.next.value&&(advance(\"if\"),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"filter\"),res.filter=expression(10),advance(\")\")),reversed||(state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"]\"),state.funct[\"(comparray)\"].unstack(),res}function isMethod(){return state.funct[\"(statement)\"]&&\"class\"===state.funct[\"(statement)\"].type||state.funct[\"(context)\"]&&\"class\"===state.funct[\"(context)\"][\"(verb)\"]}function isPropertyName(token){return token.identifier||\"(string)\"===token.id||\"(number)\"===token.id}function propertyName(preserveOrToken){var id,preserve=!0;return\"object\"==typeof preserveOrToken?id=preserveOrToken:(preserve=preserveOrToken,id=optionalidentifier(!1,!0,preserve)),id?\"object\"==typeof id&&(\"(string)\"===id.id||\"(identifier)\"===id.id?id=id.value:\"(number)\"===id.id&&(id=\"\"+id.value)):\"(string)\"===state.tokens.next.id?(id=state.tokens.next.value,preserve||advance()):\"(number)\"===state.tokens.next.id&&(id=\"\"+state.tokens.next.value,preserve||advance()),\"hasOwnProperty\"===id&&warning(\"W001\"),id}function functionparams(options){function addParam(addParamArgs){state.funct[\"(scope)\"].addParam.apply(state.funct[\"(scope)\"],addParamArgs)}var next,ident,t,paramsIds=[],tokens=[],pastDefault=!1,pastRest=!1,arity=0,loneArg=options&&options.loneArg;if(loneArg&&loneArg.identifier===!0)return state.funct[\"(scope)\"].addParam(loneArg.value,loneArg),{arity:1,params:[loneArg.value]};if(next=state.tokens.next,options&&options.parsedOpening||advance(\"(\"),\")\"===state.tokens.next.id)return advance(\")\"),void 0;for(;;){arity++;var currentParams=[];if(_.contains([\"{\",\"[\"],state.tokens.next.id)){tokens=destructuringPattern();for(t in tokens)t=tokens[t],t.id&&(paramsIds.push(t.id),currentParams.push([t.id,t.token]))}else if(checkPunctuator(state.tokens.next,\"...\")&&(pastRest=!0),ident=identifier(!0))paramsIds.push(ident),currentParams.push([ident,state.tokens.curr]);else for(;!checkPunctuators(state.tokens.next,[\",\",\")\"]);)advance();if(pastDefault&&\"=\"!==state.tokens.next.id&&error(\"W138\",state.tokens.current),\"=\"===state.tokens.next.id&&(state.inES6()||warning(\"W119\",state.tokens.next,\"default parameters\",\"6\"),advance(\"=\"),pastDefault=!0,expression(10)),currentParams.forEach(addParam),\",\"!==state.tokens.next.id)return advance(\")\",next),{arity:arity,params:paramsIds};pastRest&&warning(\"W131\",state.tokens.next),comma()}}function functor(name,token,overwrites){var funct={\"(name)\":name,\"(breakage)\":0,\"(loopage)\":0,\"(tokens)\":{},\"(properties)\":{},\"(catch)\":!1,\"(global)\":!1,\"(line)\":null,\"(character)\":null,\"(metrics)\":null,\"(statement)\":null,\"(context)\":null,\"(scope)\":null,\"(comparray)\":null,\"(generator)\":null,\"(arrow)\":null,\"(params)\":null};return token&&_.extend(funct,{\"(line)\":token.line,\"(character)\":token.character,\"(metrics)\":createMetrics(token)}),_.extend(funct,overwrites),funct[\"(context)\"]&&(funct[\"(scope)\"]=funct[\"(context)\"][\"(scope)\"],funct[\"(comparray)\"]=funct[\"(context)\"][\"(comparray)\"]),funct}function isFunctor(token){return\"(scope)\"in token}function hasParsedCode(funct){return funct[\"(global)\"]&&!funct[\"(verb)\"]}function doTemplateLiteral(left){function end(){if(state.tokens.curr.template&&state.tokens.curr.tail&&state.tokens.curr.context===ctx)return!0;var complete=state.tokens.next.template&&state.tokens.next.tail&&state.tokens.next.context===ctx;return complete&&advance(),complete||state.tokens.next.isUnclosed}var ctx=this.context,noSubst=this.noSubst,depth=this.depth;if(!noSubst)for(;!end();)!state.tokens.next.template||state.tokens.next.depth>depth?expression(0):advance();return{id:\"(template)\",type:\"(template)\",tag:left}}function doFunction(options){var f,token,name,statement,classExprBinding,isGenerator,isArrow,ignoreLoopFunc,oldOption=state.option,oldIgnored=state.ignored;options&&(name=options.name,statement=options.statement,classExprBinding=options.classExprBinding,isGenerator=\"generator\"===options.type,isArrow=\"arrow\"===options.type,ignoreLoopFunc=options.ignoreLoopFunc),state.option=Object.create(state.option),state.ignored=Object.create(state.ignored),state.funct=functor(name||state.nameStack.infer(),state.tokens.next,{\"(statement)\":statement,\"(context)\":state.funct,\"(arrow)\":isArrow,\"(generator)\":isGenerator}),f=state.funct,token=state.tokens.curr,token.funct=state.funct,functions.push(state.funct),state.funct[\"(scope)\"].stack(\"functionouter\");var internallyAccessibleName=name||classExprBinding;internallyAccessibleName&&state.funct[\"(scope)\"].block.add(internallyAccessibleName,classExprBinding?\"class\":\"function\",state.tokens.curr,!1),state.funct[\"(scope)\"].stack(\"functionparams\");var paramsInfo=functionparams(options);return paramsInfo?(state.funct[\"(params)\"]=paramsInfo.params,state.funct[\"(metrics)\"].arity=paramsInfo.arity,state.funct[\"(metrics)\"].verifyMaxParametersPerFunction()):state.funct[\"(metrics)\"].arity=0,isArrow&&(state.inES6(!0)||warning(\"W119\",state.tokens.curr,\"arrow function syntax (=>)\",\"6\"),options.loneArg||advance(\"=>\")),block(!1,!0,!0,isArrow),!state.option.noyield&&isGenerator&&\"yielded\"!==state.funct[\"(generator)\"]&&warning(\"W124\",state.tokens.curr),state.funct[\"(metrics)\"].verifyMaxStatementsPerFunction(),state.funct[\"(metrics)\"].verifyMaxComplexityPerFunction(),state.funct[\"(unusedOption)\"]=state.option.unused,state.option=oldOption,state.ignored=oldIgnored,state.funct[\"(last)\"]=state.tokens.curr.line,state.funct[\"(lastcharacter)\"]=state.tokens.curr.character,state.funct[\"(scope)\"].unstack(),state.funct[\"(scope)\"].unstack(),state.funct=state.funct[\"(context)\"],ignoreLoopFunc||state.option.loopfunc||!state.funct[\"(loopage)\"]||f[\"(isCapturing)\"]&&warning(\"W083\",token),f}function createMetrics(functionStartToken){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){state.option.maxstatements&&this.statementCount>state.option.maxstatements&&warning(\"W071\",functionStartToken,this.statementCount)\n},verifyMaxParametersPerFunction:function(){_.isNumber(state.option.maxparams)&&this.arity>state.option.maxparams&&warning(\"W072\",functionStartToken,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){state.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===state.option.maxdepth+1&&warning(\"W073\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var max=state.option.maxcomplexity,cc=this.ComplexityCount;max&&cc>max&&warning(\"W074\",functionStartToken,cc)}}}function increaseComplexityCount(){state.funct[\"(metrics)\"].ComplexityCount+=1}function checkCondAssignment(expr){var id,paren;switch(expr&&(id=expr.id,paren=expr.paren,\",\"===id&&(expr=expr.exprs[expr.exprs.length-1])&&(id=expr.id,paren=paren||expr.paren)),id){case\"=\":case\"+=\":case\"-=\":case\"*=\":case\"%=\":case\"&=\":case\"|=\":case\"^=\":case\"/=\":paren||state.option.boss||warning(\"W084\")}}function checkProperties(props){if(state.inES5())for(var name in props)props[name]&&props[name].setterToken&&!props[name].getterToken&&warning(\"W078\",props[name].setterToken)}function metaProperty(name,c){if(checkPunctuator(state.tokens.next,\".\")){var left=state.tokens.curr.id;advance(\".\");var id=identifier();return state.tokens.curr.isMetaProperty=!0,name!==id?error(\"E057\",state.tokens.prev,left,id):c(),state.tokens.curr}}function destructuringPattern(options){var isAssignment=options&&options.assignment;return state.inES6()||warning(\"W104\",state.tokens.curr,isAssignment?\"destructuring assignment\":\"destructuring binding\",\"6\"),destructuringPatternRecursive(options)}function destructuringPatternRecursive(options){var ids,identifiers=[],openingParsed=options&&options.openingParsed,isAssignment=options&&options.assignment,recursiveOptions=isAssignment?{assignment:isAssignment}:null,firstToken=openingParsed?state.tokens.curr:state.tokens.next,nextInnerDE=function(){var ident;if(checkPunctuators(state.tokens.next,[\"[\",\"{\"])){ids=destructuringPatternRecursive(recursiveOptions);for(var id in ids)id=ids[id],identifiers.push({id:id.id,token:id.token})}else if(checkPunctuator(state.tokens.next,\",\"))identifiers.push({id:null,token:state.tokens.curr});else{if(!checkPunctuator(state.tokens.next,\"(\")){var is_rest=checkPunctuator(state.tokens.next,\"...\");if(isAssignment){var identifierToken=is_rest?peek(0):state.tokens.next;identifierToken.identifier||warning(\"E030\",identifierToken,identifierToken.value);var assignTarget=expression(155);assignTarget&&(checkLeftSideAssign(assignTarget),assignTarget.identifier&&(ident=assignTarget.value))}else ident=identifier();return ident&&identifiers.push({id:ident,token:state.tokens.curr}),is_rest}advance(\"(\"),nextInnerDE(),advance(\")\")}return!1},assignmentProperty=function(){var id;checkPunctuator(state.tokens.next,\"[\")?(advance(\"[\"),expression(10),advance(\"]\"),advance(\":\"),nextInnerDE()):\"(string)\"===state.tokens.next.id||\"(number)\"===state.tokens.next.id?(advance(),advance(\":\"),nextInnerDE()):(id=identifier(),checkPunctuator(state.tokens.next,\":\")?(advance(\":\"),nextInnerDE()):id&&(isAssignment&&checkLeftSideAssign(state.tokens.curr),identifiers.push({id:id,token:state.tokens.curr})))};if(checkPunctuator(firstToken,\"[\")){openingParsed||advance(\"[\"),checkPunctuator(state.tokens.next,\"]\")&&warning(\"W137\",state.tokens.curr);for(var element_after_rest=!1;!checkPunctuator(state.tokens.next,\"]\");)nextInnerDE()&&!element_after_rest&&checkPunctuator(state.tokens.next,\",\")&&(warning(\"W130\",state.tokens.next),element_after_rest=!0),checkPunctuator(state.tokens.next,\"=\")&&(checkPunctuator(state.tokens.prev,\"...\")?advance(\"]\"):advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"]\")||advance(\",\");advance(\"]\")}else if(checkPunctuator(firstToken,\"{\")){for(openingParsed||advance(\"{\"),checkPunctuator(state.tokens.next,\"}\")&&warning(\"W137\",state.tokens.curr);!checkPunctuator(state.tokens.next,\"}\")&&(assignmentProperty(),checkPunctuator(state.tokens.next,\"=\")&&(advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"}\")||(advance(\",\"),!checkPunctuator(state.tokens.next,\"}\"))););advance(\"}\")}return identifiers}function destructuringPatternMatch(tokens,value){var first=value.first;first&&_.zip(tokens,Array.isArray(first)?first:[first]).forEach(function(val){var token=val[0],value=val[1];token&&value?token.first=value:token&&token.first&&!value&&warning(\"W080\",token.first,token.first.value)})}function blockVariableStatement(type,statement,context){var tokens,lone,value,letblock,prefix=context&&context.prefix,inexport=context&&context.inexport,isLet=\"let\"===type,isConst=\"const\"===type;for(state.inES6()||warning(\"W104\",state.tokens.curr,type,\"6\"),isLet&&\"(\"===state.tokens.next.value?(state.inMoz()||warning(\"W118\",state.tokens.next,\"let block\"),advance(\"(\"),state.funct[\"(scope)\"].stack(),letblock=!0):state.funct[\"(noblockscopedvar)\"]&&error(\"E048\",state.tokens.curr,isConst?\"Const\":\"Let\"),statement.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),!prefix&&isConst&&\"=\"!==state.tokens.next.id&&warning(\"E012\",state.tokens.curr,state.tokens.curr.value);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],state.funct[\"(scope)\"].block.isGlobal()&&predefined[t.id]===!1&&warning(\"W079\",t.token,t.id),t.id&&!state.funct[\"(noblockscopedvar)\"]&&(state.funct[\"(scope)\"].addlabel(t.id,{type:type,token:t.token}),names.push(t.token),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.token.value,t.token)));if(\"=\"===state.tokens.next.id&&(advance(\"=\"),prefix||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),!prefix&&\"=\"===peek(0).id&&state.tokens.next.identifier&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),statement.first=statement.first.concat(names),\",\"!==state.tokens.next.id)break;comma()}return letblock&&(advance(\")\"),block(!0,!0),statement.block=!0,state.funct[\"(scope)\"].unstack()),statement}function classdef(isStatement){return state.inES6()||warning(\"W104\",state.tokens.curr,\"class\",\"6\"),isStatement?(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"class\",token:state.tokens.curr})):state.tokens.next.identifier&&\"extends\"!==state.tokens.next.value?(this.name=identifier(),this.namedExpr=!0):this.name=state.nameStack.infer(),classtail(this),this}function classtail(c){var wasInClassBody=state.inClassBody;\"extends\"===state.tokens.next.value&&(advance(\"extends\"),c.heritage=expression(10)),state.inClassBody=!0,advance(\"{\"),c.body=classbody(c),advance(\"}\"),state.inClassBody=wasInClassBody}function classbody(c){for(var name,isStatic,isGenerator,getset,computed,props=Object.create(null),staticProps=Object.create(null),i=0;\"}\"!==state.tokens.next.id;++i)if(name=state.tokens.next,isStatic=!1,isGenerator=!1,getset=null,\";\"!==name.id){if(\"*\"===name.id&&(isGenerator=!0,advance(\"*\"),name=state.tokens.next),\"[\"===name.id)name=computedPropertyName(),computed=!0;else{if(!isPropertyName(name)){warning(\"W052\",state.tokens.next,state.tokens.next.value||state.tokens.next.type),advance();continue}advance(),computed=!1,name.identifier&&\"static\"===name.value&&(checkPunctuator(state.tokens.next,\"*\")&&(isGenerator=!0,advance(\"*\")),(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,isStatic=!0,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())),!name.identifier||\"get\"!==name.value&&\"set\"!==name.value||(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,getset=name,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())}if(!checkPunctuator(state.tokens.next,\"(\")){for(error(\"E054\",state.tokens.next,state.tokens.next.value);\"}\"!==state.tokens.next.id&&!checkPunctuator(state.tokens.next,\"(\");)advance();\"(\"!==state.tokens.next.value&&doFunction({statement:c})}if(computed||(getset?saveAccessor(getset.value,isStatic?staticProps:props,name.value,name,!0,isStatic):(\"constructor\"===name.value?state.nameStack.set(c):state.nameStack.set(name),saveProperty(isStatic?staticProps:props,name.value,name,!0,isStatic))),getset&&\"constructor\"===name.value){var propDesc=\"get\"===getset.value?\"class getter method\":\"class setter method\";error(\"E049\",name,propDesc,\"constructor\")}else\"prototype\"===name.value&&error(\"E049\",name,\"class method\",\"prototype\");propertyName(name),doFunction({statement:c,type:isGenerator?\"generator\":null,classExprBinding:c.namedExpr?c.name:null})}else warning(\"W032\"),advance(\";\");checkProperties(props)}function saveProperty(props,name,tkn,isClass,isStatic){var msg=[\"key\",\"class method\",\"static class method\"];msg=msg[(isClass||!1)+(isStatic||!1)],tkn.identifier&&(name=tkn.value),props[name]&&\"__proto__\"!==name?warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name].basic=!0,props[name].basictkn=tkn}function saveAccessor(accessorType,props,name,tkn,isClass,isStatic){var flagName=\"get\"===accessorType?\"getterToken\":\"setterToken\",msg=\"\";isClass?(isStatic&&(msg+=\"static \"),msg+=accessorType+\"ter method\"):msg=\"key\",state.tokens.curr.accessorType=accessorType,state.nameStack.set(tkn),props[name]?(props[name].basic||props[name][flagName])&&\"__proto__\"!==name&&warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name][flagName]=tkn}function computedPropertyName(){advance(\"[\"),state.inES6()||warning(\"W119\",state.tokens.curr,\"computed property names\",\"6\");var value=expression(10);return advance(\"]\"),value}function checkPunctuators(token,values){return\"(punctuator)\"===token.type?_.contains(values,token.value):!1}function checkPunctuator(token,value){return\"(punctuator)\"===token.type&&token.value===value}function destructuringAssignOrJsonValue(){var block=lookupBlockType();block.notJson?(!state.inES6()&&block.isDestAssign&&warning(\"W104\",state.tokens.curr,\"destructuring assignment\",\"6\"),statements()):(state.option.laxbreak=!0,state.jsonMode=!0,jsonValue())}function jsonValue(){function jsonObject(){var o={},t=state.tokens.next;if(advance(\"{\"),\"}\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E026\",state.tokens.next,t.line);else{if(\"}\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id?error(\"E028\",state.tokens.next):\"(string)\"!==state.tokens.next.id&&warning(\"W095\",state.tokens.next,state.tokens.next.value)}if(o[state.tokens.next.value]===!0?warning(\"W075\",state.tokens.next,\"key\",state.tokens.next.value):\"__proto__\"===state.tokens.next.value&&!state.option.proto||\"__iterator__\"===state.tokens.next.value&&!state.option.iterator?warning(\"W096\",state.tokens.next,state.tokens.next.value):o[state.tokens.next.value]=!0,advance(),advance(\":\"),jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"}\")}function jsonArray(){var t=state.tokens.next;if(advance(\"[\"),\"]\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E027\",state.tokens.next,t.line);else{if(\"]\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id&&error(\"E028\",state.tokens.next)}if(jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"]\")}switch(state.tokens.next.id){case\"{\":jsonObject();break;case\"[\":jsonArray();break;case\"true\":case\"false\":case\"null\":case\"(number)\":case\"(string)\":advance();break;case\"-\":advance(\"-\"),advance(\"(number)\");break;default:error(\"E003\",state.tokens.next)}}var api,declared,functions,inblock,indent,lookahead,lex,member,membersOnly,predefined,stack,urls,bang={\"<\":!0,\"<=\":!0,\"==\":!0,\"===\":!0,\"!==\":!0,\"!=\":!0,\">\":!0,\">=\":!0,\"+\":!0,\"-\":!0,\"*\":!0,\"/\":!0,\"%\":!0},functionicity=[\"closure\",\"exception\",\"global\",\"label\",\"outer\",\"unused\",\"var\"],extraModules=[],emitter=new events.EventEmitter,typeofValues={};typeofValues.legacy=[\"xml\",\"unknown\"],typeofValues.es3=[\"undefined\",\"boolean\",\"number\",\"string\",\"function\",\"object\"],typeofValues.es3=typeofValues.es3.concat(typeofValues.legacy),typeofValues.es6=typeofValues.es3.concat(\"symbol\"),type(\"(number)\",function(){return this}),type(\"(string)\",function(){return this}),state.syntax[\"(identifier)\"]={type:\"(identifier)\",lbp:0,identifier:!0,nud:function(){var v=this.value;return\"=>\"===state.tokens.next.id?this:(state.funct[\"(comparray)\"].check(v)||state.funct[\"(scope)\"].block.use(v,state.tokens.curr),this)},led:function(){error(\"E033\",state.tokens.next,state.tokens.next.value)}};var baseTemplateSyntax={lbp:0,identifier:!1,template:!0};state.syntax[\"(template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template middle)\"]=_.extend({type:\"(template middle)\",middle:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template tail)\"]=_.extend({type:\"(template tail)\",tail:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(no subst template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!0,tail:!0},baseTemplateSyntax),type(\"(regexp)\",function(){return this}),delim(\"(endline)\"),delim(\"(begin)\"),delim(\"(end)\").reach=!0,delim(\"(error)\").reach=!0,delim(\"}\").reach=!0,delim(\")\"),delim(\"]\"),delim('\"').reach=!0,delim(\"'\").reach=!0,delim(\";\"),delim(\":\").reach=!0,delim(\"#\"),reserve(\"else\"),reserve(\"case\").reach=!0,reserve(\"catch\"),reserve(\"default\").reach=!0,reserve(\"finally\"),reservevar(\"arguments\",function(x){state.isStrict()&&state.funct[\"(global)\"]&&warning(\"E008\",x)}),reservevar(\"eval\"),reservevar(\"false\"),reservevar(\"Infinity\"),reservevar(\"null\"),reservevar(\"this\",function(x){state.isStrict()&&!isMethod()&&!state.option.validthis&&(state.funct[\"(statement)\"]&&state.funct[\"(name)\"].charAt(0)>\"Z\"||state.funct[\"(global)\"])&&warning(\"W040\",x)}),reservevar(\"true\"),reservevar(\"undefined\"),assignop(\"=\",\"assign\",20),assignop(\"+=\",\"assignadd\",20),assignop(\"-=\",\"assignsub\",20),assignop(\"*=\",\"assignmult\",20),assignop(\"/=\",\"assigndiv\",20).nud=function(){error(\"E014\")},assignop(\"%=\",\"assignmod\",20),bitwiseassignop(\"&=\"),bitwiseassignop(\"|=\"),bitwiseassignop(\"^=\"),bitwiseassignop(\"<<=\"),bitwiseassignop(\">>=\"),bitwiseassignop(\">>>=\"),infix(\",\",function(left,that){var expr;if(that.exprs=[left],state.option.nocomma&&warning(\"W127\"),!comma({peek:!0}))return that;for(;;){if(!(expr=expression(10)))break;if(that.exprs.push(expr),\",\"!==state.tokens.next.value||!comma())break}return that},10,!0),infix(\"?\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(10),advance(\":\"),that[\"else\"]=expression(10),that},30);var orPrecendence=40;infix(\"||\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(orPrecendence),that},orPrecendence),infix(\"&&\",\"and\",50),bitwise(\"|\",\"bitor\",70),bitwise(\"^\",\"bitxor\",80),bitwise(\"&\",\"bitand\",90),relation(\"==\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));switch(!0){case!eqnull&&state.option.eqeqeq:this.from=this.character,warning(\"W116\",this,\"===\",\"==\");break;case isPoorRelation(left):warning(\"W041\",this,\"===\",left.value);break;case isPoorRelation(right):warning(\"W041\",this,\"===\",right.value);break;case isTypoTypeof(right,left,state):warning(\"W122\",this,right.value);break;case isTypoTypeof(left,right,state):warning(\"W122\",this,left.value)}return this}),relation(\"===\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!=\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));return!eqnull&&state.option.eqeqeq?(this.from=this.character,warning(\"W116\",this,\"!==\",\"!=\")):isPoorRelation(left)?warning(\"W041\",this,\"!==\",left.value):isPoorRelation(right)?warning(\"W041\",this,\"!==\",right.value):isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!==\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"<\"),relation(\">\"),relation(\"<=\"),relation(\">=\"),bitwise(\"<<\",\"shiftleft\",120),bitwise(\">>\",\"shiftright\",120),bitwise(\">>>\",\"shiftrightunsigned\",120),infix(\"in\",\"in\",120),infix(\"instanceof\",\"instanceof\",120),infix(\"+\",function(left,that){var right;return that.left=left,that.right=right=expression(130),left&&right&&\"(string)\"===left.id&&\"(string)\"===right.id?(left.value+=right.value,left.character=right.character,!state.option.scripturl&®.javascriptURL.test(left.value)&&warning(\"W050\",left),left):that},130),prefix(\"+\",\"num\"),prefix(\"+++\",function(){return warning(\"W007\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"+++\",function(left){return warning(\"W007\"),this.left=left,this.right=expression(130),this},130),infix(\"-\",\"sub\",130),prefix(\"-\",\"neg\"),prefix(\"---\",function(){return warning(\"W006\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"---\",function(left){return warning(\"W006\"),this.left=left,this.right=expression(130),this},130),infix(\"*\",\"mult\",140),infix(\"/\",\"div\",140),infix(\"%\",\"mod\",140),suffix(\"++\"),prefix(\"++\",\"preinc\"),state.syntax[\"++\"].exps=!0,suffix(\"--\"),prefix(\"--\",\"predec\"),state.syntax[\"--\"].exps=!0,prefix(\"delete\",function(){var p=expression(10);return p?(\".\"!==p.id&&\"[\"!==p.id&&warning(\"W051\"),this.first=p,p.identifier&&!state.isStrict()&&(p.forgiveUndef=!0),this):this}).exps=!0,prefix(\"~\",function(){return state.option.bitwise&&warning(\"W016\",this,\"~\"),this.arity=\"unary\",this.right=expression(150),this}),prefix(\"...\",function(){return state.inES6(!0)||warning(\"W119\",this,\"spread/rest operator\",\"6\"),state.tokens.next.identifier||\"(string)\"===state.tokens.next.type||checkPunctuators(state.tokens.next,[\"[\",\"(\"])||error(\"E030\",state.tokens.next,state.tokens.next.value),expression(150),this}),prefix(\"!\",function(){return this.arity=\"unary\",this.right=expression(150),this.right||quit(\"E041\",this.line||0),bang[this.right.id]===!0&&warning(\"W018\",this,\"!\"),this}),prefix(\"typeof\",function(){var p=expression(150);return this.first=this.right=p,p||quit(\"E041\",this.line||0,this.character||0),p.identifier&&(p.forgiveUndef=!0),this}),prefix(\"new\",function(){var mp=metaProperty(\"target\",function(){state.inES6(!0)||warning(\"W119\",state.tokens.prev,\"new.target\",\"6\");for(var inFunction,c=state.funct;c&&(inFunction=!c[\"(global)\"],c[\"(arrow)\"]);)c=c[\"(context)\"];inFunction||warning(\"W136\",state.tokens.prev,\"new.target\")});if(mp)return mp;var i,c=expression(155);if(c&&\"function\"!==c.id)if(c.identifier)switch(c[\"new\"]=!0,c.value){case\"Number\":case\"String\":case\"Boolean\":case\"Math\":case\"JSON\":warning(\"W053\",state.tokens.prev,c.value);break;case\"Symbol\":state.inES6()&&warning(\"W053\",state.tokens.prev,c.value);break;case\"Function\":state.option.evil||warning(\"W054\");break;case\"Date\":case\"RegExp\":case\"this\":break;default:\"function\"!==c.id&&(i=c.value.substr(0,1),state.option.newcap&&(\"A\">i||i>\"Z\")&&!state.funct[\"(scope)\"].isPredefined(c.value)&&warning(\"W055\",state.tokens.curr))}else\".\"!==c.id&&\"[\"!==c.id&&\"(\"!==c.id&&warning(\"W056\",state.tokens.curr);else state.option.supernew||warning(\"W057\",this);return\"(\"===state.tokens.next.id||state.option.supernew||warning(\"W058\",state.tokens.curr,state.tokens.curr.value),this.first=this.right=c,this}),state.syntax[\"new\"].exps=!0,prefix(\"void\").exps=!0,infix(\".\",function(left,that){var m=identifier(!1,!0);return\"string\"==typeof m&&countMember(m),that.left=left,that.right=m,m&&\"hasOwnProperty\"===m&&\"=\"===state.tokens.next.value&&warning(\"W001\"),!left||\"arguments\"!==left.value||\"callee\"!==m&&\"caller\"!==m?state.option.evil||!left||\"document\"!==left.value||\"write\"!==m&&\"writeln\"!==m||warning(\"W060\",left):state.option.noarg?warning(\"W059\",left,m):state.isStrict()&&error(\"E008\"),state.option.evil||\"eval\"!==m&&\"execScript\"!==m||isGlobalEval(left,state)&&warning(\"W061\"),that},160,!0),infix(\"(\",function(left,that){state.option.immed&&left&&!left.immed&&\"function\"===left.id&&warning(\"W062\");var n=0,p=[];if(left&&\"(identifier)\"===left.type&&left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&-1===\"Array Number String Boolean Date Object Error Symbol\".indexOf(left.value)&&(\"Math\"===left.value?warning(\"W063\",left):state.option.newcap&&warning(\"W064\",left)),\")\"!==state.tokens.next.id)for(;p[p.length]=expression(10),n+=1,\",\"===state.tokens.next.id;)comma();return advance(\")\"),\"object\"==typeof left&&(state.inES5()||\"parseInt\"!==left.value||1!==n||warning(\"W065\",state.tokens.curr),state.option.evil||(\"eval\"===left.value||\"Function\"===left.value||\"execScript\"===left.value?(warning(\"W061\",left),p[0]&&\"(string)\"===[0].id&&addInternalSrc(left,p[0].value)):!p[0]||\"(string)\"!==p[0].id||\"setTimeout\"!==left.value&&\"setInterval\"!==left.value?!p[0]||\"(string)\"!==p[0].id||\".\"!==left.value||\"window\"!==left.left.value||\"setTimeout\"!==left.right&&\"setInterval\"!==left.right||(warning(\"W066\",left),addInternalSrc(left,p[0].value)):(warning(\"W066\",left),addInternalSrc(left,p[0].value))),left.identifier||\".\"===left.id||\"[\"===left.id||\"=>\"===left.id||\"(\"===left.id||\"&&\"===left.id||\"||\"===left.id||\"?\"===left.id||state.inES6()&&left[\"(name)\"]||warning(\"W067\",that)),that.left=left,that},155,!0).exps=!0,prefix(\"(\",function(){var pn1,ret,triggerFnExpr,first,last,pn=state.tokens.next,i=-1,parens=1,opening=state.tokens.curr,preceeding=state.tokens.prev,isNecessary=!state.option.singleGroups;do\"(\"===pn.value?parens+=1:\")\"===pn.value&&(parens-=1),i+=1,pn1=pn,pn=peek(i);while((0!==parens||\")\"!==pn1.value)&&\";\"!==pn.value&&\"(end)\"!==pn.type);if(\"function\"===state.tokens.next.id&&(triggerFnExpr=state.tokens.next.immed=!0),\"=>\"===pn.value)return doFunction({type:\"arrow\",parsedOpening:!0});var exprs=[];if(\")\"!==state.tokens.next.id)for(;exprs.push(expression(10)),\",\"===state.tokens.next.id;)state.option.nocomma&&warning(\"W127\"),comma();return advance(\")\",this),state.option.immed&&exprs[0]&&\"function\"===exprs[0].id&&\"(\"!==state.tokens.next.id&&\".\"!==state.tokens.next.id&&\"[\"!==state.tokens.next.id&&warning(\"W068\",this),exprs.length?(exprs.length>1?(ret=Object.create(state.syntax[\",\"]),ret.exprs=exprs,first=exprs[0],last=exprs[exprs.length-1],isNecessary||(isNecessary=preceeding.assign||preceeding.delim)):(ret=first=last=exprs[0],isNecessary||(isNecessary=opening.beginsStmt&&(\"{\"===ret.id||triggerFnExpr||isFunctor(ret))||triggerFnExpr&&(!isEndOfExpr()||\"}\"!==state.tokens.prev.id)||isFunctor(ret)&&!isEndOfExpr()||\"{\"===ret.id&&\"=>\"===preceeding.id||\"(number)\"===ret.type&&checkPunctuator(pn,\".\")&&/^\\d+$/.test(ret.value))),ret&&(!isNecessary&&(first.left||first.right||ret.exprs)&&(isNecessary=!isBeginOfExpr(preceeding)&&first.lbp<=preceeding.lbp||!isEndOfExpr()&&last.lbp\"),infix(\"[\",function(left,that){var s,e=expression(10);return e&&\"(string)\"===e.type&&(state.option.evil||\"eval\"!==e.value&&\"execScript\"!==e.value||isGlobalEval(left,state)&&warning(\"W061\"),countMember(e.value),!state.option.sub&®.identifier.test(e.value)&&(s=state.syntax[e.value],s&&isReserved(s)||warning(\"W069\",state.tokens.prev,e.value))),advance(\"]\",that),e&&\"hasOwnProperty\"===e.value&&\"=\"===state.tokens.next.value&&warning(\"W001\"),that.left=left,that.right=e,that},160,!0),prefix(\"[\",function(){var blocktype=lookupBlockType();if(blocktype.isCompArray)return state.option.esnext||state.inMoz()||warning(\"W118\",state.tokens.curr,\"array comprehension\"),comprehensiveArrayExpression();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;var b=state.tokens.curr.line!==startLine(state.tokens.next);for(this.first=[],b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));\"(end)\"!==state.tokens.next.id;){for(;\",\"===state.tokens.next.id;){if(!state.option.elision){if(state.inES5()){warning(\"W128\");do advance(\",\");while(\",\"===state.tokens.next.id);continue}warning(\"W070\")}advance(\",\")}if(\"]\"===state.tokens.next.id)break;if(this.first.push(expression(10)),\",\"!==state.tokens.next.id)break;if(comma({allowTrailing:!0}),\"]\"===state.tokens.next.id&&!state.inES5()){warning(\"W070\",state.tokens.curr);break}}return b&&(indent-=state.option.indent),advance(\"]\",this),this}),function(x){x.nud=function(){var b,f,i,p,t,nextVal,isGeneratorMethod=!1,props=Object.create(null);b=state.tokens.curr.line!==startLine(state.tokens.next),b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));var blocktype=lookupBlockType();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;for(;\"}\"!==state.tokens.next.id;){if(nextVal=state.tokens.next.value,!state.tokens.next.identifier||\",\"!==peekIgnoreEOL().id&&\"}\"!==peekIgnoreEOL().id)if(\":\"===peek().id||\"get\"!==nextVal&&\"set\"!==nextVal){if(\"*\"===state.tokens.next.value&&\"(punctuator)\"===state.tokens.next.type?(state.inES6()||warning(\"W104\",state.tokens.next,\"generator functions\",\"6\"),advance(\"*\"),isGeneratorMethod=!0):isGeneratorMethod=!1,\"[\"===state.tokens.next.id)i=computedPropertyName(),state.nameStack.set(i);else if(state.nameStack.set(state.tokens.next),i=propertyName(),saveProperty(props,i,state.tokens.next),\"string\"!=typeof i)break;\"(\"===state.tokens.next.value?(state.inES6()||warning(\"W104\",state.tokens.curr,\"concise methods\",\"6\"),doFunction({type:isGeneratorMethod?\"generator\":null})):(advance(\":\"),expression(10))}else advance(nextVal),state.inES5()||error(\"E034\"),i=propertyName(),i||state.inES6()||error(\"E035\"),i&&saveAccessor(nextVal,props,i,state.tokens.curr),t=state.tokens.next,f=doFunction(),p=f[\"(params)\"],\"get\"===nextVal&&i&&p?warning(\"W076\",t,p[0],i):\"set\"!==nextVal||!i||p&&1===p.length||warning(\"W077\",t,i);else state.inES6()||warning(\"W104\",state.tokens.next,\"object short notation\",\"6\"),i=propertyName(!0),saveProperty(props,i,state.tokens.next),expression(10);if(countMember(i),\",\"!==state.tokens.next.id)break;comma({allowTrailing:!0,property:!0}),\",\"===state.tokens.next.id?warning(\"W070\",state.tokens.curr):\"}\"!==state.tokens.next.id||state.inES5()||warning(\"W070\",state.tokens.curr)}return b&&(indent-=state.option.indent),advance(\"}\",this),checkProperties(props),this},x.fud=function(){error(\"E036\",state.tokens.curr)}}(delim(\"{\"));var conststatement=stmt(\"const\",function(context){return blockVariableStatement(\"const\",this,context)});conststatement.exps=!0;var letstatement=stmt(\"let\",function(context){return blockVariableStatement(\"let\",this,context)});letstatement.exps=!0;var varstatement=stmt(\"var\",function(context){var tokens,lone,value,prefix=context&&context.prefix,inexport=context&&context.inexport,implied=context&&context.implied,report=!(context&&context.ignore);for(this.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),prefix&&implied||!report||!state.option.varstmt||warning(\"W132\",this),this.first=this.first.concat(names);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],!implied&&state.funct[\"(global)\"]&&(predefined[t.id]===!1?warning(\"W079\",t.token,t.id):state.option.futurehostile===!1&&(!state.inES5()&&vars.ecmaIdentifiers[5][t.id]===!1||!state.inES6()&&vars.ecmaIdentifiers[6][t.id]===!1)&&warning(\"W129\",t.token,t.id)),t.id&&(\"for\"===implied?(state.funct[\"(scope)\"].has(t.id)||report&&warning(\"W088\",t.token,t.id),state.funct[\"(scope)\"].block.use(t.id,t.token)):(state.funct[\"(scope)\"].addlabel(t.id,{type:\"var\",token:t.token}),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.id,t.token)),names.push(t.token)));if(\"=\"===state.tokens.next.id&&(state.nameStack.set(state.tokens.curr),advance(\"=\"),prefix||!report||state.funct[\"(loopage)\"]||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),\"=\"===peek(0).id&&state.tokens.next.identifier&&(!prefix&&report&&!state.funct[\"(params)\"]||-1===state.funct[\"(params)\"].indexOf(state.tokens.next.value))&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),\",\"!==state.tokens.next.id)break;comma()}return this});varstatement.exps=!0,blockstmt(\"class\",function(){return classdef.call(this,!0)}),blockstmt(\"function\",function(context){var inexport=context&&context.inexport,generator=!1;\"*\"===state.tokens.next.value&&(advance(\"*\"),state.inES6({strict:!0})?generator=!0:warning(\"W119\",state.tokens.curr,\"function*\",\"6\")),inblock&&warning(\"W082\",state.tokens.curr);var i=optionalidentifier();return state.funct[\"(scope)\"].addlabel(i,{type:\"function\",token:state.tokens.curr}),void 0===i?warning(\"W025\"):inexport&&state.funct[\"(scope)\"].setExported(i,state.tokens.prev),doFunction({name:i,statement:this,type:generator?\"generator\":null,ignoreLoopFunc:inblock}),\"(\"===state.tokens.next.id&&state.tokens.next.line===state.tokens.curr.line&&error(\"E039\"),this}),prefix(\"function\",function(){var generator=!1;\"*\"===state.tokens.next.value&&(state.inES6()||warning(\"W119\",state.tokens.curr,\"function*\",\"6\"),advance(\"*\"),generator=!0);var i=optionalidentifier();return doFunction({name:i,type:generator?\"generator\":null}),this}),blockstmt(\"if\",function(){var t=state.tokens.next;increaseComplexityCount(),state.condition=!0,advance(\"(\");var expr=expression(0);checkCondAssignment(expr);var forinifcheck=null;state.option.forin&&state.forinifcheckneeded&&(state.forinifcheckneeded=!1,forinifcheck=state.forinifchecks[state.forinifchecks.length-1],forinifcheck.type=\"(punctuator)\"===expr.type&&\"!\"===expr.value?\"(negative)\":\"(positive)\"),advance(\")\",t),state.condition=!1;var s=block(!0,!0);return forinifcheck&&\"(negative)\"===forinifcheck.type&&s&&s[0]&&\"(identifier)\"===s[0].type&&\"continue\"===s[0].value&&(forinifcheck.type=\"(negative-with-continue)\"),\"else\"===state.tokens.next.id&&(advance(\"else\"),\"if\"===state.tokens.next.id||\"switch\"===state.tokens.next.id?statement():block(!0,!0)),this}),blockstmt(\"try\",function(){function doCatch(){if(advance(\"catch\"),advance(\"(\"),state.funct[\"(scope)\"].stack(\"catchparams\"),checkPunctuators(state.tokens.next,[\"[\",\"{\"])){var tokens=destructuringPattern();_.each(tokens,function(token){token.id&&state.funct[\"(scope)\"].addParam(token.id,token,\"exception\")})}else\"(identifier)\"!==state.tokens.next.type?warning(\"E030\",state.tokens.next,state.tokens.next.value):state.funct[\"(scope)\"].addParam(identifier(),state.tokens.curr,\"exception\");\"if\"===state.tokens.next.value&&(state.inMoz()||warning(\"W118\",state.tokens.curr,\"catch filter\"),advance(\"if\"),expression(0)),advance(\")\"),block(!1),state.funct[\"(scope)\"].unstack()}var b;for(block(!0);\"catch\"===state.tokens.next.id;)increaseComplexityCount(),b&&!state.inMoz()&&warning(\"W118\",state.tokens.next,\"multiple catch blocks\"),doCatch(),b=!0;return\"finally\"===state.tokens.next.id?(advance(\"finally\"),block(!0),void 0):(b||error(\"E021\",state.tokens.next,\"catch\",state.tokens.next.value),this)}),blockstmt(\"while\",function(){var t=state.tokens.next;return state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this}).labelled=!0,blockstmt(\"with\",function(){var t=state.tokens.next;return state.isStrict()?error(\"E010\",state.tokens.curr):state.option.withstmt||warning(\"W085\",state.tokens.curr),advance(\"(\"),expression(0),advance(\")\",t),block(!0,!0),this}),blockstmt(\"switch\",function(){var t=state.tokens.next,g=!1,noindent=!1;\nfor(state.funct[\"(breakage)\"]+=1,advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),t=state.tokens.next,advance(\"{\"),state.tokens.next.from===indent&&(noindent=!0),noindent||(indent+=state.option.indent),this.cases=[];;)switch(state.tokens.next.id){case\"case\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"case\":case\"continue\":case\"return\":case\"switch\":case\"throw\":break;default:state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"case\")}advance(\"case\"),this.cases.push(expression(0)),increaseComplexityCount(),g=!0,advance(\":\"),state.funct[\"(verb)\"]=\"case\";break;case\"default\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"continue\":case\"return\":case\"throw\":break;default:this.cases.length&&(state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"default\"))}advance(\"default\"),g=!0,advance(\":\");break;case\"}\":return noindent||(indent-=state.option.indent),advance(\"}\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(verb)\"]=void 0,void 0;case\"(end)\":return error(\"E023\",state.tokens.next,\"}\"),void 0;default:if(indent+=state.option.indent,g)switch(state.tokens.curr.id){case\",\":return error(\"E040\"),void 0;case\":\":g=!1,statements();break;default:return error(\"E025\",state.tokens.curr),void 0}else{if(\":\"!==state.tokens.curr.id)return error(\"E021\",state.tokens.next,\"case\",state.tokens.next.value),void 0;advance(\":\"),error(\"E024\",state.tokens.curr,\":\"),statements()}indent-=state.option.indent}return this}).labelled=!0,stmt(\"debugger\",function(){return state.option.debug||warning(\"W087\",this),this}).exps=!0,function(){var x=stmt(\"do\",function(){state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),this.first=block(!0,!0),advance(\"while\");var t=state.tokens.next;return advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this});x.labelled=!0,x.exps=!0}(),blockstmt(\"for\",function(){var s,t=state.tokens.next,letscope=!1,foreachtok=null;\"each\"===t.value&&(foreachtok=t,advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),increaseComplexityCount(),advance(\"(\");var nextop,comma,initializer,i=0,inof=[\"in\",\"of\"],level=0;checkPunctuators(state.tokens.next,[\"{\",\"[\"])&&++level;do{if(nextop=peek(i),++i,checkPunctuators(nextop,[\"{\",\"[\"])?++level:checkPunctuators(nextop,[\"}\",\"]\"])&&--level,0>level)break;0===level&&(!comma&&checkPunctuator(nextop,\",\")?comma=nextop:!initializer&&checkPunctuator(nextop,\"=\")&&(initializer=nextop))}while(level>0||!_.contains(inof,nextop.value)&&\";\"!==nextop.value&&\"(end)\"!==nextop.type);if(_.contains(inof,nextop.value)){state.inES6()||\"of\"!==nextop.value||warning(\"W104\",nextop,\"for of\",\"6\");var ok=!(initializer||comma);if(initializer&&error(\"W133\",comma,nextop.value,\"initializer is forbidden\"),comma&&error(\"W133\",comma,nextop.value,\"more than one ForBinding\"),\"var\"===state.tokens.next.id?(advance(\"var\"),state.tokens.curr.fud({prefix:!0})):\"let\"===state.tokens.next.id||\"const\"===state.tokens.next.id?(advance(state.tokens.next.id),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud({prefix:!0})):Object.create(varstatement).fud({prefix:!0,implied:\"for\",ignore:!ok}),advance(nextop.value),expression(20),advance(\")\",t),\"in\"===nextop.value&&state.option.forin&&(state.forinifcheckneeded=!0,void 0===state.forinifchecks&&(state.forinifchecks=[]),state.forinifchecks.push({type:\"(none)\"})),state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,s=block(!0,!0),\"in\"===nextop.value&&state.option.forin){if(state.forinifchecks&&state.forinifchecks.length>0){var check=state.forinifchecks.pop();(s&&s.length>0&&(\"object\"!=typeof s[0]||\"if\"!==s[0].value)||\"(positive)\"===check.type&&s.length>1||\"(negative)\"===check.type)&&warning(\"W089\",this)}state.forinifcheckneeded=!1}state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}else{if(foreachtok&&error(\"E045\",foreachtok),\";\"!==state.tokens.next.id)if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud();else if(\"let\"===state.tokens.next.id)advance(\"let\"),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud();else for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();if(nolinebreak(state.tokens.curr),advance(\";\"),state.funct[\"(loopage)\"]+=1,\";\"!==state.tokens.next.id&&checkCondAssignment(expression(0)),nolinebreak(state.tokens.curr),advance(\";\"),\";\"===state.tokens.next.id&&error(\"E021\",state.tokens.next,\")\",\";\"),\")\"!==state.tokens.next.id)for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();advance(\")\",t),state.funct[\"(breakage)\"]+=1,block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}return letscope&&state.funct[\"(scope)\"].unstack(),this}).labelled=!0,stmt(\"break\",function(){var v=state.tokens.next.value;return state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line!==startLine(state.tokens.next)?0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value):(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"continue\",function(){var v=state.tokens.next.value;return 0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value),state.funct[\"(loopage)\"]||warning(\"W052\",state.tokens.next,this.value),state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line===startLine(state.tokens.next)&&(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"return\",function(){return this.line===startLine(state.tokens.next)?\";\"===state.tokens.next.id||state.tokens.next.reach||(this.first=expression(0),!this.first||\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)):\"(punctuator)\"===state.tokens.next.type&&[\"[\",\"{\",\"+\",\"-\"].indexOf(state.tokens.next.value)>-1&&nolinebreak(this),reachable(this),this}).exps=!0,function(x){x.exps=!0,x.lbp=25}(prefix(\"yield\",function(){var prev=state.tokens.prev;state.inES6(!0)&&!state.funct[\"(generator)\"]?\"(catch)\"===state.funct[\"(name)\"]&&state.funct[\"(context)\"][\"(generator)\"]||error(\"E046\",state.tokens.curr,\"yield\"):state.inES6()||warning(\"W104\",state.tokens.curr,\"yield\",\"6\"),state.funct[\"(generator)\"]=\"yielded\";var delegatingYield=!1;return\"*\"===state.tokens.next.value&&(delegatingYield=!0,advance(\"*\")),this.line!==startLine(state.tokens.next)&&state.inMoz()?state.option.asi||nolinebreak(this):((delegatingYield||\";\"!==state.tokens.next.id&&!state.option.asi&&!state.tokens.next.reach&&state.tokens.next.nud)&&(nobreaknonadjacent(state.tokens.curr,state.tokens.next),this.first=expression(10),\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)),state.inMoz()&&\")\"!==state.tokens.next.id&&(prev.lbp>30||!prev.assign&&!isEndOfExpr()||\"yield\"===prev.id)&&error(\"E050\",this)),this})),stmt(\"throw\",function(){return nolinebreak(this),this.first=expression(20),reachable(this),this}).exps=!0,stmt(\"import\",function(){if(state.inES6()||warning(\"W119\",state.tokens.curr,\"import\",\"6\"),\"(string)\"===state.tokens.next.type)return advance(\"(string)\"),this;if(state.tokens.next.identifier){if(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value)return advance(\"from\"),advance(\"(string)\"),this;advance(\",\")}if(\"*\"===state.tokens.next.id)advance(\"*\"),advance(\"as\"),state.tokens.next.identifier&&(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}));else for(advance(\"{\");;){if(\"}\"===state.tokens.next.value){advance(\"}\");break}var importName;if(\"default\"===state.tokens.next.type?(importName=\"default\",advance(\"default\")):importName=identifier(),\"as\"===state.tokens.next.value&&(advance(\"as\"),importName=identifier()),state.funct[\"(scope)\"].addlabel(importName,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return advance(\"from\"),advance(\"(string)\"),this}).exps=!0,stmt(\"export\",function(){var token,identifier,ok=!0;if(state.inES6()||(warning(\"W119\",state.tokens.curr,\"export\",\"6\"),ok=!1),state.funct[\"(scope)\"].block.isGlobal()||(error(\"E053\",state.tokens.curr),ok=!1),\"*\"===state.tokens.next.value)return advance(\"*\"),advance(\"from\"),advance(\"(string)\"),this;if(\"default\"===state.tokens.next.type){state.nameStack.set(state.tokens.next),advance(\"default\");var exportType=state.tokens.next.id;return(\"function\"===exportType||\"class\"===exportType)&&(this.block=!0),token=peek(),expression(10),identifier=token.value,this.block&&(state.funct[\"(scope)\"].addlabel(identifier,{type:exportType,token:token}),state.funct[\"(scope)\"].setExported(identifier,token)),this}if(\"{\"===state.tokens.next.value){advance(\"{\");for(var exportedTokens=[];;){if(state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance(),exportedTokens.push(state.tokens.curr),\"as\"===state.tokens.next.value&&(advance(\"as\"),state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance()),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return\"from\"===state.tokens.next.value?(advance(\"from\"),advance(\"(string)\")):ok&&exportedTokens.forEach(function(token){state.funct[\"(scope)\"].setExported(token.value,token)}),this}if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud({inexport:!0});else if(\"let\"===state.tokens.next.id)advance(\"let\"),state.tokens.curr.fud({inexport:!0});else if(\"const\"===state.tokens.next.id)advance(\"const\"),state.tokens.curr.fud({inexport:!0});else if(\"function\"===state.tokens.next.id)this.block=!0,advance(\"function\"),state.syntax[\"function\"].fud({inexport:!0});else if(\"class\"===state.tokens.next.id){this.block=!0,advance(\"class\");var classNameToken=state.tokens.next;state.syntax[\"class\"].fud(),state.funct[\"(scope)\"].setExported(classNameToken.value,classNameToken)}else error(\"E024\",state.tokens.next,state.tokens.next.value);return this}).exps=!0,FutureReservedWord(\"abstract\"),FutureReservedWord(\"boolean\"),FutureReservedWord(\"byte\"),FutureReservedWord(\"char\"),FutureReservedWord(\"class\",{es5:!0,nud:classdef}),FutureReservedWord(\"double\"),FutureReservedWord(\"enum\",{es5:!0}),FutureReservedWord(\"export\",{es5:!0}),FutureReservedWord(\"extends\",{es5:!0}),FutureReservedWord(\"final\"),FutureReservedWord(\"float\"),FutureReservedWord(\"goto\"),FutureReservedWord(\"implements\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"import\",{es5:!0}),FutureReservedWord(\"int\"),FutureReservedWord(\"interface\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"long\"),FutureReservedWord(\"native\"),FutureReservedWord(\"package\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"private\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"protected\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"public\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"short\"),FutureReservedWord(\"static\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"super\",{es5:!0}),FutureReservedWord(\"synchronized\"),FutureReservedWord(\"transient\"),FutureReservedWord(\"volatile\");var lookupBlockType=function(){var pn,pn1,prev,i=-1,bracketStack=0,ret={};checkPunctuators(state.tokens.curr,[\"[\",\"{\"])&&(bracketStack+=1);do{if(prev=-1===i?state.tokens.curr:pn,pn=-1===i?state.tokens.next:peek(i),pn1=peek(i+1),i+=1,checkPunctuators(pn,[\"[\",\"{\"])?bracketStack+=1:checkPunctuators(pn,[\"]\",\"}\"])&&(bracketStack-=1),1===bracketStack&&pn.identifier&&\"for\"===pn.value&&!checkPunctuator(prev,\".\")){ret.isCompArray=!0,ret.notJson=!0;break}if(0===bracketStack&&checkPunctuators(pn,[\"}\",\"]\"])){if(\"=\"===pn1.value){ret.isDestAssign=!0,ret.notJson=!0;break}if(\".\"===pn1.value){ret.notJson=!0;break}}checkPunctuator(pn,\";\")&&(ret.isBlock=!0,ret.notJson=!0)}while(bracketStack>0&&\"(end)\"!==pn.id);return ret},arrayComprehension=function(){function declare(v){var l=_current.variables.filter(function(elt){return elt.value===v?(elt.undef=!1,v):void 0}).length;return 0!==l}function use(v){var l=_current.variables.filter(function(elt){return elt.value!==v||elt.undef?void 0:(elt.unused===!0&&(elt.unused=!1),v)}).length;return 0===l}var _current,CompArray=function(){this.mode=\"use\",this.variables=[]},_carrays=[];return{stack:function(){_current=new CompArray,_carrays.push(_current)},unstack:function(){_current.variables.filter(function(v){v.unused&&warning(\"W098\",v.token,v.raw_text||v.value),v.undef&&state.funct[\"(scope)\"].block.use(v.value,v.token)}),_carrays.splice(-1,1),_current=_carrays[_carrays.length-1]},setState:function(s){_.contains([\"use\",\"define\",\"generate\",\"filter\"],s)&&(_current.mode=s)},check:function(v){return _current?_current&&\"use\"===_current.mode?(use(v)&&_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!0,unused:!1}),!0):_current&&\"define\"===_current.mode?(declare(v)||_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!1,unused:!0}),!0):_current&&\"generate\"===_current.mode?(state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):_current&&\"filter\"===_current.mode?(use(v)&&state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):!1:void 0}}},escapeRegex=function(str){return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")},itself=function(s,o,g){function each(obj,cb){obj&&(Array.isArray(obj)||\"object\"!=typeof obj||(obj=Object.keys(obj)),obj.forEach(cb))}var i,k,x,reIgnoreStr,reIgnore,optionKeys,newOptionObj={},newIgnoredObj={};o=_.clone(o),state.reset(),o&&o.scope?JSHINT.scope=o.scope:(JSHINT.errors=[],JSHINT.undefs=[],JSHINT.internals=[],JSHINT.blacklist={},JSHINT.scope=\"(main)\"),predefined=Object.create(null),combine(predefined,vars.ecmaIdentifiers[3]),combine(predefined,vars.reservedVars),combine(predefined,g||{}),declared=Object.create(null);var exported=Object.create(null);if(o)for(each(o.predef||null,function(item){var slice,prop;\"-\"===item[0]?(slice=item.slice(1),JSHINT.blacklist[slice]=slice,delete predefined[slice]):(prop=Object.getOwnPropertyDescriptor(o.predef,item),predefined[item]=prop?prop.value:!1)}),each(o.exported||null,function(item){exported[item]=!0}),delete o.predef,delete o.exported,optionKeys=Object.keys(o),x=0;optionKeys.length>x;x++)if(/^-W\\d{3}$/g.test(optionKeys[x]))newIgnoredObj[optionKeys[x].slice(1)]=!0;else{var optionKey=optionKeys[x];newOptionObj[optionKey]=o[optionKey],(\"esversion\"===optionKey&&5===o[optionKey]||\"es5\"===optionKey&&o[optionKey])&&warning(\"I003\"),\"newcap\"===optionKeys[x]&&o[optionKey]===!1&&(newOptionObj[\"(explicitNewcap)\"]=!0)}state.option=newOptionObj,state.ignored=newIgnoredObj,state.option.indent=state.option.indent||4,state.option.maxerr=state.option.maxerr||50,indent=1;var scopeManagerInst=scopeManager(state,predefined,exported,declared);if(scopeManagerInst.on(\"warning\",function(ev){warning.apply(null,[ev.code,ev.token].concat(ev.data))}),scopeManagerInst.on(\"error\",function(ev){error.apply(null,[ev.code,ev.token].concat(ev.data))}),state.funct=functor(\"(global)\",null,{\"(global)\":!0,\"(scope)\":scopeManagerInst,\"(comparray)\":arrayComprehension(),\"(metrics)\":createMetrics(state.tokens.next)}),functions=[state.funct],urls=[],stack=null,member={},membersOnly=null,inblock=!1,lookahead=[],!isString(s)&&!Array.isArray(s))return errorAt(\"E004\",0),!1;api={get isJSON(){return state.jsonMode},getOption:function(name){return state.option[name]||null},getCache:function(name){return state.cache[name]},setCache:function(name,value){state.cache[name]=value},warn:function(code,data){warningAt.apply(null,[code,data.line,data.char].concat(data.data))},on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)}.bind(this))}},emitter.removeAllListeners(),(extraModules||[]).forEach(function(func){func(api)}),state.tokens.prev=state.tokens.curr=state.tokens.next=state.syntax[\"(begin)\"],o&&o.ignoreDelimiters&&(Array.isArray(o.ignoreDelimiters)||(o.ignoreDelimiters=[o.ignoreDelimiters]),o.ignoreDelimiters.forEach(function(delimiterPair){delimiterPair.start&&delimiterPair.end&&(reIgnoreStr=escapeRegex(delimiterPair.start)+\"[\\\\s\\\\S]*?\"+escapeRegex(delimiterPair.end),reIgnore=RegExp(reIgnoreStr,\"ig\"),s=s.replace(reIgnore,function(match){return match.replace(/./g,\" \")}))})),lex=new Lexer(s),lex.on(\"warning\",function(ev){warningAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"error\",function(ev){errorAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"fatal\",function(ev){quit(\"E041\",ev.line,ev.from)}),lex.on(\"Identifier\",function(ev){emitter.emit(\"Identifier\",ev)}),lex.on(\"String\",function(ev){emitter.emit(\"String\",ev)}),lex.on(\"Number\",function(ev){emitter.emit(\"Number\",ev)}),lex.start();for(var name in o)_.has(o,name)&&checkOption(name,state.tokens.curr);assume(),combine(predefined,g||{}),comma.first=!0;try{switch(advance(),state.tokens.next.id){case\"{\":case\"[\":destructuringAssignOrJsonValue();break;default:directives(),state.directive[\"use strict\"]&&\"global\"!==state.option.strict&&warning(\"W097\",state.tokens.prev),statements()}\"(end)\"!==state.tokens.next.id&&quit(\"E041\",state.tokens.curr.line),state.funct[\"(scope)\"].unstack()}catch(err){if(!err||\"JSHintError\"!==err.name)throw err;var nt=state.tokens.next||{};JSHINT.errors.push({scope:\"(main)\",raw:err.raw,code:err.code,reason:err.message,line:err.line||nt.line,character:err.character||nt.from},null)}if(\"(main)\"===JSHINT.scope)for(o=o||{},i=0;JSHINT.internals.length>i;i+=1)k=JSHINT.internals[i],o.scope=k.elem,itself(k.value,o,g);return 0===JSHINT.errors.length};return itself.addModule=function(func){extraModules.push(func)},itself.addModule(style.register),itself.data=function(){var fu,f,i,j,n,globals,data={functions:[],options:state.option};itself.errors.length&&(data.errors=itself.errors),state.jsonMode&&(data.json=!0);var impliedGlobals=state.funct[\"(scope)\"].getImpliedGlobals();for(impliedGlobals.length>0&&(data.implieds=impliedGlobals),urls.length>0&&(data.urls=urls),globals=state.funct[\"(scope)\"].getUsedOrDefinedGlobals(),globals.length>0&&(data.globals=globals),i=1;functions.length>i;i+=1){for(f=functions[i],fu={},j=0;functionicity.length>j;j+=1)fu[functionicity[j]]=[];for(j=0;functionicity.length>j;j+=1)0===fu[functionicity[j]].length&&delete fu[functionicity[j]];fu.name=f[\"(name)\"],fu.param=f[\"(params)\"],fu.line=f[\"(line)\"],fu.character=f[\"(character)\"],fu.last=f[\"(last)\"],fu.lastcharacter=f[\"(lastcharacter)\"],fu.metrics={complexity:f[\"(metrics)\"].ComplexityCount,parameters:f[\"(metrics)\"].arity,statements:f[\"(metrics)\"].statementCount},data.functions.push(fu)}var unuseds=state.funct[\"(scope)\"].getUnuseds();unuseds.length>0&&(data.unused=unuseds);for(n in member)if(\"number\"==typeof member[n]){data.member=member;break}return data},itself.jshint=itself,itself}();\"object\"==typeof exports&&exports&&(exports.JSHINT=JSHINT)},{\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./lex.js\":\"/node_modules/jshint/src/lex.js\",\"./messages.js\":\"/node_modules/jshint/src/messages.js\",\"./options.js\":\"/node_modules/jshint/src/options.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./scope-manager.js\":\"/node_modules/jshint/src/scope-manager.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",\"./style.js\":\"/node_modules/jshint/src/style.js\",\"./vars.js\":\"/node_modules/jshint/src/vars.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/lex.js\":[function(_dereq_,module,exports){\"use strict\";function asyncTrigger(){var _checks=[];return{push:function(fn){_checks.push(fn)},check:function(){for(var check=0;_checks.length>check;++check)_checks[check]();_checks.splice(0,_checks.length)}}}function Lexer(source){var lines=source;\"string\"==typeof lines&&(lines=lines.replace(/\\r\\n/g,\"\\n\").replace(/\\r/g,\"\\n\").split(\"\\n\")),lines[0]&&\"#!\"===lines[0].substr(0,2)&&(-1!==lines[0].indexOf(\"node\")&&(state.option.node=!0),lines[0]=\"\"),this.emitter=new events.EventEmitter,this.source=source,this.setLines(lines),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\"\",this.inComment=!1,this.context=[],this.templateStarts=[];for(var i=0;state.option.indent>i;i+=1)state.tab+=\" \";this.ignoreLinterErrors=!1}var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,unicodeData=_dereq_(\"../data/ascii-identifier-data.js\"),asciiIdentifierStartTable=unicodeData.asciiIdentifierStartTable,asciiIdentifierPartTable=unicodeData.asciiIdentifierPartTable,Token={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateHead:10,TemplateMiddle:11,TemplateTail:12,NoSubstTemplate:13},Context={Block:1,Template:2};Lexer.prototype={_lines:[],inContext:function(ctxType){return this.context.length>0&&this.context[this.context.length-1].type===ctxType},pushContext:function(ctxType){this.context.push({type:ctxType})},popContext:function(){return this.context.pop()},isContext:function(context){return this.context.length>0&&this.context[this.context.length-1]===context},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=state.lines,this._lines},setLines:function(val){this._lines=val,state.lines=this._lines},peek:function(i){return this.input.charAt(i||0)},skip:function(i){i=i||1,this.char+=i,this.input=this.input.slice(i)},on:function(names,listener){names.split(\" \").forEach(function(name){this.emitter.on(name,listener)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(type,args,checks,fn){checks.push(function(){fn()&&this.trigger(type,args)}.bind(this))},scanPunctuator:function(){var ch2,ch3,ch4,ch1=this.peek();switch(ch1){case\".\":if(/^[0-9]$/.test(this.peek(1)))return null;if(\".\"===this.peek(1)&&\".\"===this.peek(2))return{type:Token.Punctuator,value:\"...\"};case\"(\":case\")\":case\";\":case\",\":case\"[\":case\"]\":case\":\":case\"~\":case\"?\":return{type:Token.Punctuator,value:ch1};case\"{\":return this.pushContext(Context.Block),{type:Token.Punctuator,value:ch1};case\"}\":return this.inContext(Context.Block)&&this.popContext(),{type:Token.Punctuator,value:ch1};case\"#\":return{type:Token.Punctuator,value:ch1};case\"\":return null}return ch2=this.peek(1),ch3=this.peek(2),ch4=this.peek(3),\">\"===ch1&&\">\"===ch2&&\">\"===ch3&&\"=\"===ch4?{type:Token.Punctuator,value:\">>>=\"}:\"=\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"===\"}:\"!\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"!==\"}:\">\"===ch1&&\">\"===ch2&&\">\"===ch3?{type:Token.Punctuator,value:\">>>\"}:\"<\"===ch1&&\"<\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"<<=\"}:\">\"===ch1&&\">\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\">>=\"}:\"=\"===ch1&&\">\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:ch1===ch2&&\"+-<>&|\".indexOf(ch1)>=0?{type:Token.Punctuator,value:ch1+ch2}:\"<>=!+-*%&|^\".indexOf(ch1)>=0?\"=\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:{type:Token.Punctuator,value:ch1}:\"/\"===ch1?\"=\"===ch2?{type:Token.Punctuator,value:\"/=\"}:{type:Token.Punctuator,value:\"/\"}:null},scanComments:function(){function commentToken(label,body,opt){var special=[\"jshint\",\"jslint\",\"members\",\"member\",\"globals\",\"global\",\"exported\"],isSpecial=!1,value=label+body,commentType=\"plain\";return opt=opt||{},opt.isMultiline&&(value+=\"*/\"),body=body.replace(/\\n/g,\" \"),\"/*\"===label&®.fallsThrough.test(body)&&(isSpecial=!0,commentType=\"falls through\"),special.forEach(function(str){if(!isSpecial&&(\"//\"!==label||\"jshint\"===str)&&(\" \"===body.charAt(str.length)&&body.substr(0,str.length)===str&&(isSpecial=!0,label+=str,body=body.substr(str.length)),isSpecial||\" \"!==body.charAt(0)||\" \"!==body.charAt(str.length+1)||body.substr(1,str.length)!==str||(isSpecial=!0,label=label+\" \"+str,body=body.substr(str.length+1)),isSpecial))switch(str){case\"member\":commentType=\"members\";break;case\"global\":commentType=\"globals\";break;default:var options=body.split(\":\").map(function(v){return v.replace(/^\\s+/,\"\").replace(/\\s+$/,\"\")});if(2===options.length)switch(options[0]){case\"ignore\":switch(options[1]){case\"start\":self.ignoringLinterErrors=!0,isSpecial=!1;break;case\"end\":self.ignoringLinterErrors=!1,isSpecial=!1}}commentType=str}}),{type:Token.Comment,commentType:commentType,value:value,body:body,isSpecial:isSpecial,isMultiline:opt.isMultiline||!1,isMalformed:opt.isMalformed||!1}}var ch1=this.peek(),ch2=this.peek(1),rest=this.input.substr(2),startLine=this.line,startChar=this.char,self=this;if(\"*\"===ch1&&\"/\"===ch2)return this.trigger(\"error\",{code:\"E018\",line:startLine,character:startChar}),this.skip(2),null;if(\"/\"!==ch1||\"*\"!==ch2&&\"/\"!==ch2)return null;if(\"/\"===ch2)return this.skip(this.input.length),commentToken(\"//\",rest);var body=\"\";if(\"*\"===ch2){for(this.inComment=!0,this.skip(2);\"*\"!==this.peek()||\"/\"!==this.peek(1);)if(\"\"===this.peek()){if(body+=\"\\n\",!this.nextLine())return this.trigger(\"error\",{code:\"E017\",line:startLine,character:startChar}),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0,isMalformed:!0})}else body+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0})}},scanKeyword:function(){var result=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),keywords=[\"if\",\"in\",\"do\",\"var\",\"for\",\"new\",\"try\",\"let\",\"this\",\"else\",\"case\",\"void\",\"with\",\"enum\",\"while\",\"break\",\"catch\",\"throw\",\"const\",\"yield\",\"class\",\"super\",\"return\",\"typeof\",\"delete\",\"switch\",\"export\",\"import\",\"default\",\"finally\",\"extends\",\"function\",\"continue\",\"debugger\",\"instanceof\"];return result&&keywords.indexOf(result[0])>=0?{type:Token.Keyword,value:result[0]}:null},scanIdentifier:function(){function isNonAsciiIdentifierStart(code){return code>256}function isNonAsciiIdentifierPart(code){return code>256}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function removeEscapeSequences(id){return id.replace(/\\\\u([0-9a-fA-F]{4})/g,function(m0,codepoint){return String.fromCharCode(parseInt(codepoint,16))})}var type,char,id=\"\",index=0,readUnicodeEscapeSequence=function(){if(index+=1,\"u\"!==this.peek(index))return null;var code,ch1=this.peek(index+1),ch2=this.peek(index+2),ch3=this.peek(index+3),ch4=this.peek(index+4);return isHexDigit(ch1)&&isHexDigit(ch2)&&isHexDigit(ch3)&&isHexDigit(ch4)?(code=parseInt(ch1+ch2+ch3+ch4,16),asciiIdentifierPartTable[code]||isNonAsciiIdentifierPart(code)?(index+=5,\"\\\\u\"+ch1+ch2+ch3+ch4):null):null}.bind(this),getIdentifierStart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierStartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierStart(code)?(index+=1,chr):null}.bind(this),getIdentifierPart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierPartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierPart(code)?(index+=1,chr):null}.bind(this);if(char=getIdentifierStart(),null===char)return null;for(id=char;char=getIdentifierPart(),null!==char;)id+=char;switch(id){case\"true\":case\"false\":type=Token.BooleanLiteral;break;case\"null\":type=Token.NullLiteral;break;default:type=Token.Identifier}return{type:type,value:removeEscapeSequences(id),text:id,tokenLength:id.length}},scanNumericLiteral:function(){function isDecimalDigit(str){return/^[0-9]$/.test(str)}function isOctalDigit(str){return/^[0-7]$/.test(str)}function isBinaryDigit(str){return/^[01]$/.test(str)}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function isIdentifierStart(ch){return\"$\"===ch||\"_\"===ch||\"\\\\\"===ch||ch>=\"a\"&&\"z\">=ch||ch>=\"A\"&&\"Z\">=ch}var bad,index=0,value=\"\",length=this.input.length,char=this.peek(index),isAllowedDigit=isDecimalDigit,base=10,isLegacy=!1;if(\".\"!==char&&!isDecimalDigit(char))return null;if(\".\"!==char){for(value=this.peek(index),index+=1,char=this.peek(index),\"0\"===value&&((\"x\"===char||\"X\"===char)&&(isAllowedDigit=isHexDigit,base=16,index+=1,value+=char),(\"o\"===char||\"O\"===char)&&(isAllowedDigit=isOctalDigit,base=8,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Octal integer literal\",\"6\"]}),index+=1,value+=char),(\"b\"===char||\"B\"===char)&&(isAllowedDigit=isBinaryDigit,base=2,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Binary integer literal\",\"6\"]}),index+=1,value+=char),isOctalDigit(char)&&(isAllowedDigit=isOctalDigit,base=8,isLegacy=!0,bad=!1,index+=1,value+=char),!isOctalDigit(char)&&isDecimalDigit(char)&&(index+=1,value+=char));length>index;){if(char=this.peek(index),isLegacy&&isDecimalDigit(char))bad=!0;else if(!isAllowedDigit(char))break;value+=char,index+=1}if(isAllowedDigit!==isDecimalDigit)return!isLegacy&&2>=value.length?{type:Token.NumericLiteral,value:value,isMalformed:!0}:length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isLegacy:isLegacy,isMalformed:!1}}if(\".\"===char)for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1;if(\"e\"===char||\"E\"===char){if(value+=char,index+=1,char=this.peek(index),(\"+\"===char||\"-\"===char)&&(value+=this.peek(index),index+=1),char=this.peek(index),!isDecimalDigit(char))return null;for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1}return length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isMalformed:!isFinite(value)}},scanEscapeSequence:function(checks){var allowNewLine=!1,jump=1;this.skip();var char=this.peek();switch(char){case\"'\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\'\"]},checks,function(){return state.jsonMode});break;case\"b\":char=\"\\\\b\";break;case\"f\":char=\"\\\\f\";break;case\"n\":char=\"\\\\n\";break;case\"r\":char=\"\\\\r\";break;case\"t\":char=\"\\\\t\";break;case\"0\":char=\"\\\\0\";var n=parseInt(this.peek(1),10);this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return n>=0&&7>=n&&state.isStrict()});break;case\"u\":var hexCode=this.input.substr(1,4),code=parseInt(hexCode,16);isNaN(code)&&this.trigger(\"warning\",{code:\"W052\",line:this.line,character:this.char,data:[\"u\"+hexCode]}),char=String.fromCharCode(code),jump=5;break;case\"v\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\v\"]},checks,function(){return state.jsonMode}),char=\"\u000b\";break;case\"x\":var x=parseInt(this.input.substr(1,2),16);this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\x-\"]},checks,function(){return state.jsonMode}),char=String.fromCharCode(x),jump=3;break;case\"\\\\\":char=\"\\\\\\\\\";break;case'\"':char='\\\\\"';break;case\"/\":break;case\"\":allowNewLine=!0,char=\"\"}return{\"char\":char,jump:jump,allowNewLine:allowNewLine}},scanTemplateLiteral:function(checks){var tokenType,ch,value=\"\",startLine=this.line,startChar=this.char,depth=this.templateStarts.length;if(!state.inES6(!0))return null;if(\"`\"===this.peek())tokenType=Token.TemplateHead,this.templateStarts.push({line:this.line,\"char\":this.char}),depth=this.templateStarts.length,this.skip(1),this.pushContext(Context.Template);else{if(!this.inContext(Context.Template)||\"}\"!==this.peek())return null;tokenType=Token.TemplateMiddle}for(;\"`\"!==this.peek();){for(;\"\"===(ch=this.peek());)if(value+=\"\\n\",!this.nextLine()){var startPos=this.templateStarts.pop();return this.trigger(\"error\",{code:\"E052\",line:startPos.line,character:startPos.char}),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,depth:depth,context:this.popContext()}}if(\"$\"===ch&&\"{\"===this.peek(1))return value+=\"${\",this.skip(2),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.currentContext()};\nif(\"\\\\\"===ch){var escape=this.scanEscapeSequence(checks);value+=escape.char,this.skip(escape.jump)}else\"`\"!==ch&&(value+=ch,this.skip(1))}return tokenType=tokenType===Token.TemplateHead?Token.NoSubstTemplate:Token.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.popContext()}},scanStringLiteral:function(checks){var quote=this.peek();if('\"'!==quote&&\"'\"!==quote)return null;this.triggerAsync(\"warning\",{code:\"W108\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&'\"'!==quote});var value=\"\",startLine=this.line,startChar=this.char,allowNewLine=!1;for(this.skip();this.peek()!==quote;)if(\"\"===this.peek()){if(allowNewLine?(allowNewLine=!1,this.triggerAsync(\"warning\",{code:\"W043\",line:this.line,character:this.char},checks,function(){return!state.option.multistr}),this.triggerAsync(\"warning\",{code:\"W042\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&state.option.multistr})):this.trigger(\"warning\",{code:\"W112\",line:this.line,character:this.char}),!this.nextLine())return this.trigger(\"error\",{code:\"E029\",line:startLine,character:startChar}),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,quote:quote}}else{allowNewLine=!1;var char=this.peek(),jump=1;if(\" \">char&&this.trigger(\"warning\",{code:\"W113\",line:this.line,character:this.char,data:[\"\"]}),\"\\\\\"===char){var parsed=this.scanEscapeSequence(checks);char=parsed.char,jump=parsed.jump,allowNewLine=parsed.allowNewLine}value+=char,this.skip(jump)}return this.skip(),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,quote:quote}},scanRegExp:function(){var terminated,index=0,length=this.input.length,char=this.peek(),value=char,body=\"\",flags=[],malformed=!1,isCharSet=!1,scanUnexpectedChars=function(){\" \">char&&(malformed=!0,this.trigger(\"warning\",{code:\"W048\",line:this.line,character:this.char})),\"<\"===char&&(malformed=!0,this.trigger(\"warning\",{code:\"W049\",line:this.line,character:this.char,data:[char]}))}.bind(this);if(!this.prereg||\"/\"!==char)return null;for(index+=1,terminated=!1;length>index;)if(char=this.peek(index),value+=char,body+=char,isCharSet)\"]\"===char&&(\"\\\\\"!==this.peek(index-1)||\"\\\\\"===this.peek(index-2))&&(isCharSet=!1),\"\\\\\"===char&&(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars()),index+=1;else{if(\"\\\\\"===char){if(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars(),\"/\"===char){index+=1;continue}if(\"[\"===char){index+=1;continue}}if(\"[\"!==char){if(\"/\"===char){body=body.substr(0,body.length-1),terminated=!0,index+=1;break}index+=1}else isCharSet=!0,index+=1}if(!terminated)return this.trigger(\"error\",{code:\"E015\",line:this.line,character:this.from}),void this.trigger(\"fatal\",{line:this.line,from:this.from});for(;length>index&&(char=this.peek(index),/[gim]/.test(char));)flags.push(char),value+=char,index+=1;try{RegExp(body,flags.join(\"\"))}catch(err){malformed=!0,this.trigger(\"error\",{code:\"E016\",line:this.line,character:this.char,data:[err.message]})}return{type:Token.RegExp,value:value,flags:flags,isMalformed:malformed}},scanNonBreakingSpaces:function(){return state.option.nonbsp?this.input.search(/(\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(reg.unsafeChars)},next:function(checks){this.from=this.char;var start;if(/\\s/.test(this.peek()))for(start=this.char;/\\s/.test(this.peek());)this.from+=1,this.skip();var match=this.scanComments()||this.scanStringLiteral(checks)||this.scanTemplateLiteral(checks);return match?match:(match=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),match?(this.skip(match.tokenLength||match.value.length),match):null)},nextLine:function(){var char;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var inputTrimmed=this.input.trim(),startsWith=function(){return _.some(arguments,function(prefix){return 0===inputTrimmed.indexOf(prefix)})},endsWith=function(){return _.some(arguments,function(suffix){return-1!==inputTrimmed.indexOf(suffix,inputTrimmed.length-suffix.length)})};if(this.ignoringLinterErrors===!0&&(startsWith(\"/*\",\"//\")||this.inComment&&endsWith(\"*/\")||(this.input=\"\")),char=this.scanNonBreakingSpaces(),char>=0&&this.trigger(\"warning\",{code:\"W125\",line:this.line,character:char+1}),this.input=this.input.replace(/\\t/g,state.tab),char=this.scanUnsafeChars(),char>=0&&this.trigger(\"warning\",{code:\"W100\",line:this.line,character:char}),!this.ignoringLinterErrors&&state.option.maxlen&&state.option.maxlen=0;--i){var scopeLabels=_scopeStack[i][\"(labels)\"];if(scopeLabels[labelName])return scopeLabels}}function usedSoFarInCurrentFunction(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(usages)\"][labelName])return current[\"(usages)\"][labelName];if(current===_currentFunctBody)break}return!1}function _checkOuterShadow(labelName,token){if(\"outer\"===state.option.shadow)for(var isGlobal=\"global\"===_currentFunctBody[\"(type)\"],isNewFunction=\"functionparams\"===_current[\"(type)\"],outsideCurrentFunction=!isGlobal,i=0;_scopeStack.length>i;i++){var stackItem=_scopeStack[i];isNewFunction||_scopeStack[i+1]!==_currentFunctBody||(outsideCurrentFunction=!1),outsideCurrentFunction&&stackItem[\"(labels)\"][labelName]&&warning(\"W123\",token,labelName),stackItem[\"(breakLabels)\"][labelName]&&warning(\"W123\",token,labelName)}}function _latedefWarning(type,labelName,token){state.option.latedef&&(state.option.latedef===!0&&\"function\"===type||\"function\"!==type)&&warning(\"W003\",token,labelName)}var _current,_scopeStack=[];_newScope(\"global\"),_current[\"(predefined)\"]=predefined;var _currentFunctBody=_current,usedPredefinedAndGlobals=Object.create(null),impliedGlobals=Object.create(null),unuseds=[],emitter=new events.EventEmitter,_getUnusedOption=function(unused_opt){return void 0===unused_opt&&(unused_opt=state.option.unused),unused_opt===!0&&(unused_opt=\"last-param\"),unused_opt},_warnUnused=function(name,tkn,type,unused_opt){var line=tkn.line,chr=tkn.from,raw_name=tkn.raw_text||name;unused_opt=_getUnusedOption(unused_opt);var warnable_types={vars:[\"var\"],\"last-param\":[\"var\",\"param\"],strict:[\"var\",\"param\",\"last-param\"]};unused_opt&&warnable_types[unused_opt]&&-1!==warnable_types[unused_opt].indexOf(type)&&warning(\"W098\",{line:line,from:chr},raw_name),(unused_opt||\"var\"===type)&&unuseds.push({name:name,line:line,character:chr})},scopeManagerInst={on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)})},isPredefined:function(labelName){return!this.has(labelName)&&_.has(_scopeStack[0][\"(predefined)\"],labelName)},stack:function(type){var previousScope=_current;_newScope(type),type||\"functionparams\"!==previousScope[\"(type)\"]||(_current[\"(isFuncBody)\"]=!0,_current[\"(context)\"]=_currentFunctBody,_currentFunctBody=_current)},unstack:function(){var i,j,subScope=_scopeStack.length>1?_scopeStack[_scopeStack.length-2]:null,isUnstackingFunctionBody=_current===_currentFunctBody,isUnstackingFunctionParams=\"functionparams\"===_current[\"(type)\"],isUnstackingFunctionOuter=\"functionouter\"===_current[\"(type)\"],currentUsages=_current[\"(usages)\"],currentLabels=_current[\"(labels)\"],usedLabelNameList=Object.keys(currentUsages);for(currentUsages.__proto__&&-1===usedLabelNameList.indexOf(\"__proto__\")&&usedLabelNameList.push(\"__proto__\"),i=0;usedLabelNameList.length>i;i++){var usedLabelName=usedLabelNameList[i],usage=currentUsages[usedLabelName],usedLabel=currentLabels[usedLabelName];if(usedLabel){var usedLabelType=usedLabel[\"(type)\"];if(usedLabel[\"(useOutsideOfScope)\"]&&!state.option.funcscope){var usedTokens=usage[\"(tokens)\"];if(usedTokens)for(j=0;usedTokens.length>j;j++)usedLabel[\"(function)\"]===usedTokens[j][\"(function)\"]&&error(\"W038\",usedTokens[j],usedLabelName)}if(_current[\"(labels)\"][usedLabelName][\"(unused)\"]=!1,\"const\"===usedLabelType&&usage[\"(modified)\"])for(j=0;usage[\"(modified)\"].length>j;j++)error(\"E013\",usage[\"(modified)\"][j],usedLabelName);if((\"function\"===usedLabelType||\"class\"===usedLabelType)&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)error(\"W021\",usage[\"(reassigned)\"][j],usedLabelName,usedLabelType)}else if(isUnstackingFunctionOuter&&(state.funct[\"(isCapturing)\"]=!0),subScope)if(subScope[\"(usages)\"][usedLabelName]){var subScopeUsage=subScope[\"(usages)\"][usedLabelName];subScopeUsage[\"(modified)\"]=subScopeUsage[\"(modified)\"].concat(usage[\"(modified)\"]),subScopeUsage[\"(tokens)\"]=subScopeUsage[\"(tokens)\"].concat(usage[\"(tokens)\"]),subScopeUsage[\"(reassigned)\"]=subScopeUsage[\"(reassigned)\"].concat(usage[\"(reassigned)\"]),subScopeUsage[\"(onlyUsedSubFunction)\"]=!1}else subScope[\"(usages)\"][usedLabelName]=usage,isUnstackingFunctionBody&&(subScope[\"(usages)\"][usedLabelName][\"(onlyUsedSubFunction)\"]=!0);else if(\"boolean\"==typeof _current[\"(predefined)\"][usedLabelName]){if(delete declared[usedLabelName],usedPredefinedAndGlobals[usedLabelName]=marker,_current[\"(predefined)\"][usedLabelName]===!1&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)warning(\"W020\",usage[\"(reassigned)\"][j])}else if(usage[\"(tokens)\"])for(j=0;usage[\"(tokens)\"].length>j;j++){var undefinedToken=usage[\"(tokens)\"][j];undefinedToken.forgiveUndef||(state.option.undef&&!undefinedToken.ignoreUndef&&warning(\"W117\",undefinedToken,usedLabelName),impliedGlobals[usedLabelName]?impliedGlobals[usedLabelName].line.push(undefinedToken.line):impliedGlobals[usedLabelName]={name:usedLabelName,line:[undefinedToken.line]})}}if(subScope||Object.keys(declared).forEach(function(labelNotUsed){_warnUnused(labelNotUsed,declared[labelNotUsed],\"var\")}),subScope&&!isUnstackingFunctionBody&&!isUnstackingFunctionParams&&!isUnstackingFunctionOuter){var labelNames=Object.keys(currentLabels);for(i=0;labelNames.length>i;i++){var defLabelName=labelNames[i];currentLabels[defLabelName][\"(blockscoped)\"]||\"exception\"===currentLabels[defLabelName][\"(type)\"]||this.funct.has(defLabelName,{excludeCurrent:!0})||(subScope[\"(labels)\"][defLabelName]=currentLabels[defLabelName],\"global\"!==_currentFunctBody[\"(type)\"]&&(subScope[\"(labels)\"][defLabelName][\"(useOutsideOfScope)\"]=!0),delete currentLabels[defLabelName])}}_checkForUnused(),_scopeStack.pop(),isUnstackingFunctionBody&&(_currentFunctBody=_scopeStack[_.findLastIndex(_scopeStack,function(scope){return scope[\"(isFuncBody)\"]||\"global\"===scope[\"(type)\"]})]),_current=subScope},addParam:function(labelName,token,type){if(type=type||\"param\",\"exception\"===type){var previouslyDefinedLabelType=this.funct.labeltype(labelName);previouslyDefinedLabelType&&\"exception\"!==previouslyDefinedLabelType&&(state.option.node||warning(\"W002\",state.tokens.next,labelName))}if(_.has(_current[\"(labels)\"],labelName)?_current[\"(labels)\"][labelName].duplicated=!0:(_checkOuterShadow(labelName,token,type),_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":token,\"(unused)\":!0},_current[\"(params)\"].push(labelName)),_.has(_current[\"(usages)\"],labelName)){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}},validateParams:function(){if(\"global\"!==_currentFunctBody[\"(type)\"]){var isStrict=state.isStrict(),currentFunctParamScope=_currentFunctBody[\"(parent)\"];currentFunctParamScope[\"(params)\"]&¤tFunctParamScope[\"(params)\"].forEach(function(labelName){var label=currentFunctParamScope[\"(labels)\"][labelName];label&&label.duplicated&&(isStrict?warning(\"E011\",label[\"(token)\"],labelName):state.option.shadow!==!0&&warning(\"W004\",label[\"(token)\"],labelName))})}},getUsedOrDefinedGlobals:function(){var list=Object.keys(usedPredefinedAndGlobals);return usedPredefinedAndGlobals.__proto__===marker&&-1===list.indexOf(\"__proto__\")&&list.push(\"__proto__\"),list},getImpliedGlobals:function(){var values=_.values(impliedGlobals),hasProto=!1;return impliedGlobals.__proto__&&(hasProto=values.some(function(value){return\"__proto__\"===value.name}),hasProto||values.push(impliedGlobals.__proto__)),values},getUnuseds:function(){return unuseds},has:function(labelName){return Boolean(_getLabel(labelName))},labeltype:function(labelName){var scopeLabels=_getLabel(labelName);return scopeLabels?scopeLabels[labelName][\"(type)\"]:null},addExported:function(labelName){var globalLabels=_scopeStack[0][\"(labels)\"];if(_.has(declared,labelName))delete declared[labelName];else if(_.has(globalLabels,labelName))globalLabels[labelName][\"(unused)\"]=!1;else{for(var i=1;_scopeStack.length>i;i++){var scope=_scopeStack[i];if(scope[\"(type)\"])break;if(_.has(scope[\"(labels)\"],labelName)&&!scope[\"(labels)\"][labelName][\"(blockscoped)\"])return scope[\"(labels)\"][labelName][\"(unused)\"]=!1,void 0}exported[labelName]=!0}},setExported:function(labelName,token){this.block.use(labelName,token)\n},addlabel:function(labelName,opts){var type=opts.type,token=opts.token,isblockscoped=\"let\"===type||\"const\"===type||\"class\"===type,isexported=\"global\"===(isblockscoped?_current:_currentFunctBody)[\"(type)\"]&&_.has(exported,labelName);if(_checkOuterShadow(labelName,token,type),isblockscoped){var declaredInCurrentScope=_current[\"(labels)\"][labelName];if(declaredInCurrentScope||_current!==_currentFunctBody||\"global\"===_current[\"(type)\"]||(declaredInCurrentScope=!!_currentFunctBody[\"(parent)\"][\"(labels)\"][labelName]),!declaredInCurrentScope&&_current[\"(usages)\"][labelName]){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}declaredInCurrentScope?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&scopeManagerInst.funct.has(labelName)&&warning(\"W004\",token,labelName),scopeManagerInst.block.add(labelName,type,token,!isexported)}else{var declaredInCurrentFunctionScope=scopeManagerInst.funct.has(labelName);!declaredInCurrentFunctionScope&&usedSoFarInCurrentFunction(labelName)&&_latedefWarning(type,labelName,token),scopeManagerInst.funct.has(labelName,{onlyBlockscoped:!0})?warning(\"E011\",token,labelName):state.option.shadow!==!0&&declaredInCurrentFunctionScope&&\"__proto__\"!==labelName&&\"global\"!==_currentFunctBody[\"(type)\"]&&warning(\"W004\",token,labelName),scopeManagerInst.funct.add(labelName,type,token,!isexported),\"global\"===_currentFunctBody[\"(type)\"]&&(usedPredefinedAndGlobals[labelName]=marker)}},funct:{labeltype:function(labelName,options){for(var onlyBlockscoped=options&&options.onlyBlockscoped,excludeParams=options&&options.excludeParams,currentScopeIndex=_scopeStack.length-(options&&options.excludeCurrent?2:1),i=currentScopeIndex;i>=0;i--){var current=_scopeStack[i];if(current[\"(labels)\"][labelName]&&(!onlyBlockscoped||current[\"(labels)\"][labelName][\"(blockscoped)\"]))return current[\"(labels)\"][labelName][\"(type)\"];var scopeCheck=excludeParams?_scopeStack[i-1]:current;if(scopeCheck&&\"functionparams\"===scopeCheck[\"(type)\"])return null}return null},hasBreakLabel:function(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(breakLabels)\"][labelName])return!0;if(\"functionparams\"===current[\"(type)\"])return!1}return!1},has:function(labelName,options){return Boolean(this.labeltype(labelName,options))},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!1,\"(function)\":_currentFunctBody,\"(unused)\":unused}}},block:{isGlobal:function(){return\"global\"===_current[\"(type)\"]},use:function(labelName,token){var paramScope=_currentFunctBody[\"(parent)\"];paramScope&¶mScope[\"(labels)\"][labelName]&&\"param\"===paramScope[\"(labels)\"][labelName][\"(type)\"]&&(scopeManagerInst.funct.has(labelName,{excludeParams:!0,onlyBlockscoped:!0})||(paramScope[\"(labels)\"][labelName][\"(unused)\"]=!1)),token&&(state.ignored.W117||state.option.undef===!1)&&(token.ignoreUndef=!0),_setupUsages(labelName),token&&(token[\"(function)\"]=_currentFunctBody,_current[\"(usages)\"][labelName][\"(tokens)\"].push(token))},reassign:function(labelName,token){this.modify(labelName,token),_current[\"(usages)\"][labelName][\"(reassigned)\"].push(token)},modify:function(labelName,token){_setupUsages(labelName),_current[\"(usages)\"][labelName][\"(modified)\"].push(token)},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!0,\"(unused)\":unused}},addBreakLabel:function(labelName,opts){var token=opts.token;scopeManagerInst.funct.hasBreakLabel(labelName)?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&(scopeManagerInst.funct.has(labelName)?warning(\"W004\",token,labelName):_checkOuterShadow(labelName,token)),_current[\"(breakLabels)\"][labelName]=token}}};return scopeManagerInst};module.exports=scopeManager},{\"../lodash\":\"/node_modules/jshint/lodash.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/state.js\":[function(_dereq_,module,exports){\"use strict\";var NameStack=_dereq_(\"./name-stack.js\"),state={syntax:{},isStrict:function(){return this.directive[\"use strict\"]||this.inClassBody||this.option.module||\"implied\"===this.option.strict},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(strict){return strict?!(this.option.esversion&&5!==this.option.esversion||this.option.moz):!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\"\",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new NameStack,this.inClassBody=!1}};exports.state=state},{\"./name-stack.js\":\"/node_modules/jshint/src/name-stack.js\"}],\"/node_modules/jshint/src/style.js\":[function(_dereq_,module,exports){\"use strict\";exports.register=function(linter){linter.on(\"Identifier\",function(data){linter.getOption(\"proto\")||\"__proto__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name,\"6\"]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"iterator\")||\"__iterator__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"camelcase\")&&data.name.replace(/^_+|_+$/g,\"\").indexOf(\"_\")>-1&&!data.name.match(/^[A-Z0-9_]*$/)&&linter.warn(\"W106\",{line:data.line,\"char\":data.from,data:[data.name]})}),linter.on(\"String\",function(data){var code,quotmark=linter.getOption(\"quotmark\");quotmark&&(\"single\"===quotmark&&\"'\"!==data.quote&&(code=\"W109\"),\"double\"===quotmark&&'\"'!==data.quote&&(code=\"W108\"),quotmark===!0&&(linter.getCache(\"quotmark\")||linter.setCache(\"quotmark\",data.quote),linter.getCache(\"quotmark\")!==data.quote&&(code=\"W110\")),code&&linter.warn(code,{line:data.line,\"char\":data.char}))}),linter.on(\"Number\",function(data){\".\"===data.value.charAt(0)&&linter.warn(\"W008\",{line:data.line,\"char\":data.char,data:[data.value]}),\".\"===data.value.substr(data.value.length-1)&&linter.warn(\"W047\",{line:data.line,\"char\":data.char,data:[data.value]}),/^00+/.test(data.value)&&linter.warn(\"W046\",{line:data.line,\"char\":data.char,data:[data.value]})}),linter.on(\"String\",function(data){var re=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i;linter.getOption(\"scripturl\")||re.test(data.value)&&linter.warn(\"W107\",{line:data.line,\"char\":data.char})})}},{}],\"/node_modules/jshint/src/vars.js\":[function(_dereq_,module,exports){\"use strict\";exports.reservedVars={arguments:!1,NaN:!1},exports.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},exports.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},exports.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},exports.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},exports.nonstandard={escape:!1,unescape:!1},exports.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},exports.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,acequire:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},exports.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,acequire:!1,Buffer:!0,exports:!0,process:!0},exports.phantom={phantom:!0,acequire:!0,WebPage:!0,console:!0,exports:!0},exports.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,\"throws\":!1},exports.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},exports.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},exports.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},exports.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},exports.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},exports.jquery={$:!1,jQuery:!1},exports.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},exports.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},exports.yui={YUI:!1,Y:!1,YUI_config:!1},exports.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},exports.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},[\"/node_modules/jshint/src/jshint.js\"])}),ace.define(\"ace/mode/javascript_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/javascript/jshint\"],function(acequire,exports,module){\"use strict\";function startRegex(arr){return RegExp(\"^(\"+arr.join(\"|\")+\")\")}var oop=acequire(\"../lib/oop\"),Mirror=acequire(\"../worker/mirror\").Mirror,lint=acequire(\"./javascript/jshint\").JSHINT,disabledWarningsRe=startRegex([\"Bad for in variable '(.+)'.\",'Missing \"use strict\"']),errorsRe=startRegex([\"Unexpected\",\"Expected \",\"Confusing (plus|minus)\",\"\\\\{a\\\\} unterminated regular expression\",\"Unclosed \",\"Unmatched \",\"Unbegun comment\",\"Bad invocation\",\"Missing space after\",\"Missing operator at\"]),infoRe=startRegex([\"Expected an assignment\",\"Bad escapement of EOL\",\"Unexpected comma\",\"Unexpected space\",\"Missing radix parameter.\",\"A leading decimal point can\",\"\\\\['{a}'\\\\] is better written in dot notation.\",\"'{a}' used out of scope\"]),JavaScriptWorker=exports.JavaScriptWorker=function(sender){Mirror.call(this,sender),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(options){this.options=options||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(newOptions){oop.mixin(this.options,newOptions),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\"throw 0;\"+str)}catch(e){if(0===e)return!0}return!1},this.onUpdate=function(){var value=this.doc.getValue();if(value=value.replace(/^#!.*\\n/,\"\\n\"),!value)return this.sender.emit(\"annotate\",[]);var errors=[],maxErrorLevel=this.isValidJS(value)?\"warning\":\"error\";lint(value,this.options,this.options.globals);for(var results=lint.errors,errorAdded=!1,i=0;results.length>i;i++){var error=results[i];if(error){var raw=error.raw,type=\"warning\";if(\"Missing semicolon.\"==raw){var str=error.evidence.substr(error.character);str=str.charAt(str.search(/\\S/)),\"error\"==maxErrorLevel&&str&&/[\\w\\d{(['\"]/.test(str)?(error.reason='Missing \";\" before statement',type=\"error\"):type=\"info\"}else{if(disabledWarningsRe.test(raw))continue;infoRe.test(raw)?type=\"info\":errorsRe.test(raw)?(errorAdded=!0,type=maxErrorLevel):\"'{a}' is not defined.\"==raw?type=\"warning\":\"'{a}' is defined but never used.\"==raw&&(type=\"info\")}errors.push({row:error.line-1,column:error.character-1,text:error.reason,type:type,raw:raw})}}this.sender.emit(\"annotate\",errors)}}.call(JavaScriptWorker.prototype)}),ace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\"sentinel\",{}),\"sentinel\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\"function\"!=typeof target)throw new TypeError(\"Function.prototype.bind called on incompatible \"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\"__defineGetter__\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\"XXX\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\"[object Array]\"==_toString(obj)});var boxedString=Object(\"a\"),splitString=\"a\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduce of empty array with no initial value\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\"reduce of empty array with no initial value\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduceRight of empty array with no initial value\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\"reduceRight of empty array with no initial value\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(object,property){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\"object\"!=typeof prototype)throw new TypeError(\"typeof prototype[\"+typeof prototype+\"] != 'object'\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\"undefined\"==typeof document||doesDefinePropertyWork(document.createElement(\"div\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\"Property description must be an object: \",ERR_NON_OBJECT_TARGET=\"Object.defineProperty called on non-object: \",ERR_ACCESSORS_NOT_SUPPORTED=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(object,property,descriptor){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\"object\"!=typeof descriptor&&\"function\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\"value\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\"get\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\"set\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\"function\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\"\";owns(object,name);)name+=\"?\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(\"Object.keys called on a non-object\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\"\t\\n\u000b\\f\\r   ᠎              \\u2028\\u2029\";if(!String.prototype.trim||ws.trim()){ws=\"[\"+ws+\"]\";var trimBeginRegexp=RegExp(\"^\"+ws+ws+\"*\"),trimEndRegexp=RegExp(ws+ws+\"*$\");String.prototype.trim=function(){return(this+\"\").replace(trimBeginRegexp,\"\").replace(trimEndRegexp,\"\")}}var toObject=function(o){if(null==o)throw new TypeError(\"can't convert \"+o+\" to object\");return Object(o)}});"; - -/***/ }), -/* 49 */ +/* 58 */ /***/ (function(module, exports) { ace.define("ace/theme/terminal",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { @@ -58645,7 +61706,7 @@ dom.importCssString(exports.cssText, exports.cssClass); /***/ }), -/* 50 */ +/* 59 */ /***/ (function(module, exports) { ace.define("ace/theme/twilight",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { @@ -58760,1142 +61821,6884 @@ dom.importCssString(exports.cssText, exports.cssClass); /***/ }), -/* 51 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return beginInfiltration; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_InfiltrationBox_js__ = __webpack_require__(52); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(5); - - - - - - - - -/* Infiltration.js - * - * Kill - * Knockout (nonlethal) - * Stealth Knockout (nonlethal) - * Assassinate - * - * Hack Security - * Destroy Security - * Sneak past Security - * - * Pick the locked door - * - * Bribe security - * - * Escape - */ - -let InfiltrationScenarios = { - Guards: "You see an armed security guard patrolling the area.", - TechOnly: "The area is equipped with a state-of-the-art security system: cameras, laser tripwires, and sentry turrets.", - TechOrLockedDoor: "The area is equipped with a state-of-the-art security system. There is a locked door on the side of the " + - "room that can be used to bypass security.", - Bots: "You see a few security bots patrolling the area.", -} - -function InfiltrationInstance(companyName, startLevel, val, maxClearance, diff) { - this.companyName = companyName; - this.clearanceLevel = 0; - this.maxClearanceLevel = maxClearance; - this.securityLevel = startLevel; - this.difficulty = diff; //Affects how much security level increases. Represents a percentage - this.baseValue = val; //Base value of company secrets - this.secretsStolen = []; //Numbers representing value of stolen secrets - - this.hackingExpGained = 0; - this.strExpGained = 0; - this.defExpGained = 0; - this.dexExpGained = 0; - this.agiExpGained = 0; - this.chaExpGained = 0; -} - -InfiltrationInstance.prototype.gainHackingExp = function(amt) { - if (isNaN(amt)) {return;} - this.hackingExpGained += amt; -} - -InfiltrationInstance.prototype.gainStrengthExp = function(amt) { - if (isNaN(amt)) {return;} - this.strExpGained += amt; -} - -InfiltrationInstance.prototype.gainDefenseExp = function(amt) { - if (isNaN(amt)) {return;} - this.defExpGained += amt; -} - -InfiltrationInstance.prototype.gainDexterityExp = function(amt) { - if (isNaN(amt)) {return;} - this.dexExpGained += amt; -} - -InfiltrationInstance.prototype.gainAgilityExp = function(amt) { - if (isNaN(amt)) {return;} - this.agiExpGained += amt; -} - -InfiltrationInstance.prototype.gainCharismaExp = function(amt) { - if (isNaN(amt)) {return;} - this.chaExpGained += amt; -} - -function beginInfiltration(companyName, startLevel, val, maxClearance, diff) { - var inst = new InfiltrationInstance(companyName, startLevel, val, maxClearance, diff); - clearInfiltrationStatusText(); - nextInfiltrationLevel(inst); -} - -function endInfiltration(inst, success) { - if (success) { - Object(__WEBPACK_IMPORTED_MODULE_5__utils_InfiltrationBox_js__["a" /* infiltrationBoxCreate */])(inst); - } - - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-kill"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-knockout"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-stealthknockout"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-assassinate"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-hacksecurity"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-destroysecurity"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-sneak"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-pickdoor"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-bribe"); - Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-escape"); - - __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadWorldContent(); -} - -function nextInfiltrationLevel(inst) { - ++inst.clearanceLevel; - updateInfiltrationLevelText(inst); - - //Buttons - var killButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-kill"); - var knockoutButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-knockout"); - var stealthKnockoutButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-stealthknockout"); - var assassinateButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-assassinate"); - var hackSecurityButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-hacksecurity"); - var destroySecurityButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-destroysecurity"); - var sneakButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-sneak"); - var pickdoorButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-pickdoor"); - var bribeButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-bribe"); - var escapeButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-escape"); - - killButton.style.display = "none"; - knockoutButton.style.display = "none"; - stealthKnockoutButton.style.display = "none"; - assassinateButton.style.display = "none"; - hackSecurityButton.style.display = "none"; - destroySecurityButton.style.display = "none"; - sneakButton.style.display = "none"; - pickdoorButton.style.display = "none"; - bribeButton.style.display = "none"; - escapeButton.style.display = "none"; - - var rand = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added - var scenario = null; - switch (rand) { - case 1: - scenario = InfiltrationScenarios.TechOnly; - hackSecurityButton.style.display = "block"; - destroySecurityButton.style.display = "block"; - sneakButton.style.display = "block"; - escapeButton.style.display = "block"; - break; - case 2: - scenario = InfiltrationScenarios.TechOrLockedDoor; - hackSecurityButton.style.display = "block"; - destroySecurityButton.style.display = "block"; - sneakButton.style.display = "block"; - pickdoorButton.style.display = "block"; - escapeButton.style.display = "block"; - break; - case 3: - scenario = InfiltrationScenarios.Bots; - killButton.style.display = "block"; - killButton.addEventListener("click", function() { - var res = attemptInfiltrationKill(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY killed the security bots! Unfortunately you alerted the " + - "rest of the facility's security. The facility's security " + - "level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 1; - endInfiltrationLevel(inst); - return false; - } else { - var dmgTaken = Math.max(1, Math.round(1.5 * inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); - writeInfiltrationStatusText("You FAILED to kill the security bots. The bots fight back " + - "and raise the alarm! You take " + dmgTaken + " damage and " + - "the facility's security level increases by " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { - endInfiltration(inst, false); - } - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - }); - assassinateButton.style.display = "block"; - assassinateButton.addEventListener("click", function() { - var res = attemptInfiltrationAssassinate(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security bots without being detected!"); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 1; - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to assassinate the security bots. The bots have not detected " + - "you but are now more alert for an intruder. The facility's security level " + - "has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - }); - hackSecurityButton.style.display = "block"; - sneakButton.style.display = "block"; - escapeButton.style.display = "block"; - break; - default: //0, 4-5 - scenario = InfiltrationScenarios.Guards; - killButton.style.display = "block"; - killButton.addEventListener("click", function() { - var res = attemptInfiltrationKill(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY killed the security guard! Unfortunately you alerted the " + - "rest of the facility's security. The facility's security " + - "level has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 3; - ++__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].numPeopleKilled; - endInfiltrationLevel(inst); - return false; - } else { - var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); - writeInfiltrationStatusText("You FAILED to kill the security guard. The guard fights back " + - "and raises the alarm! You take " + dmgTaken + " damage and " + - "the facility's security level has increased by " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { - endInfiltration(inst, false); - } - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - }); - knockoutButton.style.display = "block"; - stealthKnockoutButton.style.display = "block"; - assassinateButton.style.display = "block"; - assassinateButton.addEventListener("click", function() { - var res = attemptInfiltrationAssassinate(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY assassinated the security guard without being detected!"); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].karma -= 3; - ++__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].numPeopleKilled; - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to assassinate the security guard. The guard has not detected " + - "you but is now more alert for an intruder. The facility's security level " + - "has increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - }); - sneakButton.style.display = "block"; - bribeButton.style.display = "block"; - escapeButton.style.display = "block"; - break; - } - - knockoutButton.addEventListener("click", function() { - var res = attemptInfiltrationKnockout(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard! " + - "Unfortunately you made a lot of noise and alerted other security."); - writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - endInfiltrationLevel(inst); - return false; - } else { - var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); - writeInfiltrationStatusText("You FAILED to knockout the security guard. The guard " + - "raises the alarm and fights back! You take " + dmgTaken + " damage and " + - "the facility's security level increases by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { - endInfiltration(inst, false); - } - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - stealthKnockoutButton.addEventListener("click", function() { - var res = attemptInfiltrationStealthKnockout(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY knocked out the security guard without making " + - "any noise!"); - endInfiltrationLevel(inst); - return false; - } else { - var dmgTaken = Math.max(1, Math.round(inst.securityLevel / __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense)); - writeInfiltrationStatusText("You FAILED to stealthily knockout the security guard. The guard " + - "raises the alarm and fights back! You take " + dmgTaken + " damage and " + - "the facility's security level increases by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(dmgTaken)) { - endInfiltration(inst, false); - } - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - hackSecurityButton.addEventListener("click", function() { - var res = attemptInfiltrationHack(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY hacked and disabled the security system!"); - writeInfiltrationStatusText("The facility's security level increased by " + ((res[1]*100) - 100).toString() + "%"); - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to hack the security system. The facility's " + - "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - destroySecurityButton.addEventListener("click", function() { - var res = attemptInfiltrationDestroySecurity(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY and violently destroy the security system!"); - writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to destroy the security system. The facility's " + - "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - sneakButton.addEventListener("click", function() { - var res = attemptInfiltrationSneak(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY sneak past the security undetected!"); - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED and were detected while trying to sneak past security! The facility's " + - "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - pickdoorButton.addEventListener("click", function() { - var res = attemptInfiltrationPickLockedDoor(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY pick the locked door!"); - writeInfiltrationStatusText("The facility's security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to pick the locked door. The facility's security level " + - "increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - bribeButton.addEventListener("click", function() { - var bribeAmt = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationBribeBaseAmount * inst.clearanceLevel; - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].money.lt(bribeAmt)) { - writeInfiltrationStatusText("You do not have enough money to bribe the guard. " + - "You need $" + bribeAmt); - return false; - } - var res = attemptInfiltrationBribe(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY bribed a guard to let you through " + - "to the next clearance level for $" + bribeAmt); - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].loseMoney(bribeAmt); - endInfiltrationLevel(inst); - return false; - } else { - writeInfiltrationStatusText("You FAILED to bribe a guard! The guard is alerting " + - "other security guards about your presence! The facility's " + - "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - escapeButton.addEventListener("click", function() { - var res = attemptInfiltrationEscape(inst); - if (res[0]) { - writeInfiltrationStatusText("You SUCCESSFULLY escape from the facility with the stolen classified " + - "documents and company secrets!"); - endInfiltration(inst, true); - return false; - } else { - writeInfiltrationStatusText("You FAILED to escape from the facility. You took 1 damage. The facility's " + - "security level increased by " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])((res[1]*100)-100, 2).toString() + "%"); - if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].takeDamage(1)) { - endInfiltration(inst, false); - } - } - updateInfiltrationButtons(inst, scenario); - updateInfiltrationLevelText(inst); - return false; - }); - - updateInfiltrationButtons(inst, scenario); - writeInfiltrationStatusText(""); - writeInfiltrationStatusText("You are now on clearance level " + inst.clearanceLevel + ".
" + - scenario); -} - - -function endInfiltrationLevel(inst) { - //Check if you gained any secrets - if (inst.clearanceLevel % 5 == 0) { - var baseSecretValue = inst.baseValue * inst.clearanceLevel / 2; - var secretValue = baseSecretValue * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].faction_rep_mult * 1.25; - var secretMoneyValue = baseSecretValue * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationMoneyValue; - inst.secretsStolen.push(baseSecretValue); - Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You found and stole a set of classified documents from the company. " + - "These classified secrets could probably be sold for money ($" + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(secretMoneyValue, 2) + "), or they " + - "could be given to factions for reputation (" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(secretValue, 3) + " rep)"); - } - - //Increase security level based on difficulty - inst.securityLevel *= (1 + (inst.difficulty / 100)); - writeInfiltrationStatusText("You move on to the facility's next clearance level. This " + - "clearance level has " + inst.difficulty + "% higher security"); - - //If this is max level, force endInfiltration - if (inst.clearanceLevel >= inst.maxClearanceLevel) { - endInfiltration(inst, true); - } else { - nextInfiltrationLevel(inst); - } -} - -function writeInfiltrationStatusText(txt) { - var statusTxt = document.getElementById("infiltration-status-text"); - statusTxt.innerHTML += (txt + "
"); - statusTxt.parentElement.scrollTop = statusTxt.scrollHeight; -} - -function clearInfiltrationStatusText() { - document.getElementById("infiltration-status-text").innerHTML = ""; -} - -function updateInfiltrationLevelText(inst) { - var totalValue = 0; - var totalMoneyValue = 0; - for (var i = 0; i < inst.secretsStolen.length; ++i) { - totalValue += inst.secretsStolen[i]; - totalMoneyValue += inst.secretsStolen[i] * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].InfiltrationMoneyValue; - } - document.getElementById("infiltration-level-text").innerHTML = - "Facility name: " + inst.companyName + "
" + - "Clearance Level: " + inst.clearanceLevel + "
" + - "Security Level: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.securityLevel, 3) + "

" + - "Total reputation value of secrets stolen: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalValue, 3) + "
" + - "Total monetary value of secrets stolen: $" + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalMoneyValue, 2) + "

" + - "Hack exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + "
" + - "Str exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + "
" + - "Def exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + "
" + - "Dex exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + "
" + - "Agi exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + "
" + - "Cha exp gained: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3); -} - -function updateInfiltrationButtons(inst, scenario) { - var killChance = getInfiltrationKillChance(inst); - var knockoutChance = getInfiltrationKnockoutChance(inst); - var stealthKnockoutChance = getInfiltrationStealthKnockoutChance(inst); - var assassinateChance = getInfiltrationAssassinateChance(inst); - var destroySecurityChance = getInfiltrationDestroySecurityChance(inst); - var hackChance = getInfiltrationHackChance(inst); - var sneakChance = getInfiltrationSneakChance(inst); - var lockpickChance = getInfiltrationPickLockedDoorChance(inst); - var bribeChance = getInfiltrationBribeChance(inst); - var escapeChance = getInfiltrationEscapeChance(inst); - - document.getElementById("infiltration-escape").innerHTML = "Escape" + - "" + - "Attempt to escape the facility with the classified secrets and " + - "documents you have stolen. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(escapeChance*100, 2) + "% chance of success. If you fail, " + - "the security level will increase by 5%."; - - switch(scenario) { - case InfiltrationScenarios.TechOrLockedDoor: - document.getElementById("infiltration-pickdoor").innerHTML = "Lockpick" + - "" + - "Attempt to pick the locked door. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(lockpickChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increased by 1%. If you fail, the " + - "security level will increase by 3%."; - case InfiltrationScenarios.TechOnly: - document.getElementById("infiltration-hacksecurity").innerHTML = "Hack" + - "" + - "Attempt to hack and disable the security system. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hackChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 3%. If you fail, " + - "the security level will increase by 5%."; - - document.getElementById("infiltration-destroysecurity").innerHTML = "Destroy security" + - "" + - "Attempt to violently destroy the security system. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(destroySecurityChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 5%. If you fail, the " + - "security level will increase by 10%. "; - - document.getElementById("infiltration-sneak").innerHTML = "Sneak" + - "" + - "Attempt to sneak past the security system. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 8%. "; - break; - case InfiltrationScenarios.Bots: - document.getElementById("infiltration-kill").innerHTML = "Destroy bots" + - "" + - "Attempt to destroy the security bots through combat. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(killChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 5%. If you fail, " + - "the security level will increase by 10%. "; - - document.getElementById("infiltration-assassinate").innerHTML = "Assassinate bots" + - "" + - "Attempt to stealthily destroy the security bots through assassination. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(assassinateChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 10%. "; - - document.getElementById("infiltration-hacksecurity").innerHTML = "Hack bots" + - "" + - "Attempt to disable the security bots by hacking them. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hackChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 1%. If you fail, " + - "the security level will increase by 5%. "; - - document.getElementById("infiltration-sneak").innerHTML = "Sneak" + - "" + - "Attempt to sneak past the security bots. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 8%. "; - break; - - case InfiltrationScenarios.Guards: - default: - document.getElementById("infiltration-kill").innerHTML = "Kill" + - "" + - "Attempt to kill the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(killChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 5%. If you fail, " + - "the security level will decrease by 10%. "; - - document.getElementById("infiltration-knockout").innerHTML = "Knockout" + - "" + - "Attempt to knockout the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(knockoutChance*100, 2) + "% chance of success. " + - "If you succeed, the security level will increase by 3%. If you fail, the " + - "security level will increase by 10%. "; - - document.getElementById("infiltration-stealthknockout").innerHTML = "Stealth Knockout" + - "" + - "Attempt to stealthily knockout the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stealthKnockoutChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 10%. "; - - document.getElementById("infiltration-assassinate").innerHTML = "Assassinate" + - "" + - "Attempt to assassinate the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(assassinateChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 5%. "; - - document.getElementById("infiltration-sneak").innerHTML = "Sneak" + - "" + - "Attempt to sneak past the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(sneakChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 8%. "; - - document.getElementById("infiltration-bribe").innerHTML = "Bribe" + - "" + - "Attempt to bribe the security guard. You have a " + - Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(bribeChance*100, 2) + "% chance of success. " + - "If you fail, the security level will increase by 15%. "; - break; - } -} - - -//Kill -//Success: 5%, Failure 10%, -Karma -function attemptInfiltrationKill(inst) { - var chance = getInfiltrationKillChance(inst); - inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; - inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - inst.securityLevel *= 1.05; - return [true, 1.05]; - } else { - inst.securityLevel *= 1.1; - return [false, 1.1]; - } -} - -function getInfiltrationKillChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (1.5 * lvl)); -} - - -//Knockout -//Success: 3%, Failure: 10% -function attemptInfiltrationKnockout(inst) { - var chance = getInfiltrationKnockoutChance(inst); - inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; - inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - inst.securityLevel *= 1.03; - return [true, 1.03]; - } else { - inst.securityLevel *= 1.1; - return [false, 1.1]; - } -} - -function getInfiltrationKnockoutChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (1.75 * lvl)); -} - -//Stealth knockout -//Success: 0%, Failure: 10% -function attemptInfiltrationStealthKnockout(inst) { - var chance = getInfiltrationStealthKnockoutChance(inst); - inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - return [true, 1]; - } else { - inst.securityLevel *= 1.1; - return [false, 1.1]; - } -} - -function getInfiltrationStealthKnockoutChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + - 2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + - 2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (3 * lvl)); -} - -//Assassination -//Success: 0%, Failure: 5%, -Karma -function attemptInfiltrationAssassinate(inst) { - var chance = getInfiltrationAssassinateChance(inst); - inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - return [true, 1]; - } else { - inst.securityLevel *= 1.05; - return [false, 1.05]; - } -} - -function getInfiltrationAssassinateChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + - 0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (2 * lvl)); -} - - -//Destroy security -//Success: 5%, Failure: 10% -function attemptInfiltrationDestroySecurity(inst) { - var chance = getInfiltrationDestroySecurityChance(inst); - inst.gainStrengthExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength_exp_mult; - inst.gainDefenseExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].defense_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - inst.gainAgilityExp(inst.securityLevel / 100) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - inst.securityLevel *= 1.05; - return [true, 1.05]; - } else { - inst.securityLevel *= 1.1; - return [false, 1.1]; - } - -} - -function getInfiltrationDestroySecurityChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].strength + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility) / (2 * lvl)); -} - - -//Hack security -//Success: 1%, Failure: 5% -function attemptInfiltrationHack(inst) { - var chance = getInfiltrationHackChance(inst); - inst.gainHackingExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_exp_mult; - if (Math.random() <= chance) { - inst.securityLevel *= 1.03; - return [true, 1.03]; - } else { - inst.securityLevel *= 1.05; - return [false, 1.05]; - } - -} - -function getInfiltrationHackChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].hacking_skill) / lvl); -} - -//Sneak past security -//Success: 0%, Failure: 8% -function attemptInfiltrationSneak(inst) { - var chance = getInfiltrationSneakChance(inst); - inst.gainAgilityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - if (Math.random() <= chance) { - return [true, 1]; - } else { - inst.securityLevel *= 1.08; - return [false, 1.08]; - } -} - -function getInfiltrationSneakChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + - 0.5 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity) / (2 * lvl)); -} - -//Pick locked door -//Success: 1%, Failure: 3% -function attemptInfiltrationPickLockedDoor(inst) { - var chance = getInfiltrationPickLockedDoorChance(inst); - inst.gainDexterityExp(inst.securityLevel / 75) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - if (Math.random() <= chance) { - inst.securityLevel *= 1.01; - return [true, 1.01]; - } else { - inst.securityLevel *= 1.03; - return [false, 1.03]; - } -} - -function getInfiltrationPickLockedDoorChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity) / lvl); -} - -//Bribe -//Success: 0%, Failure: 15%, -function attemptInfiltrationBribe(inst) { - var chance = getInfiltrationBribeChance(inst); - inst.gainCharismaExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].charisma_exp_mult; - if (Math.random() <= chance) { - return [true, 1]; - } else { - inst.securityLevel *= 1.15; - return [false, 1.15]; - } -} - -function getInfiltrationBribeChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].charisma) / lvl); -} - -//Escape -//Failure: 5% -function attemptInfiltrationEscape(inst) { - var chance = getInfiltrationEscapeChance(inst); - inst.gainAgilityExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility_exp_mult; - inst.gainDexterityExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity_exp_mult; - if (Math.random() <= chance) { - return [true, 1]; - } else { - inst.securityLevel *= 1.05; - return [false, 1.05]; - } -} - -function getInfiltrationEscapeChance(inst) { - var lvl = inst.securityLevel; - return Math.min(0.95, - (2 * __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].agility + - __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].dexterity) / lvl); -} - - +/* 60 */ +/***/ (function(module, exports) { + +ace.define("ace/theme/xcode",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { + +exports.isDark = false; +exports.cssClass = "ace-xcode"; +exports.cssText = "\ +.ace-xcode .ace_gutter {\ +background: #e8e8e8;\ +color: #333\ +}\ +.ace-xcode .ace_print-margin {\ +width: 1px;\ +background: #e8e8e8\ +}\ +.ace-xcode {\ +background-color: #FFFFFF;\ +color: #000000\ +}\ +.ace-xcode .ace_cursor {\ +color: #000000\ +}\ +.ace-xcode .ace_marker-layer .ace_selection {\ +background: #B5D5FF\ +}\ +.ace-xcode.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0px #FFFFFF;\ +}\ +.ace-xcode .ace_marker-layer .ace_step {\ +background: rgb(198, 219, 174)\ +}\ +.ace-xcode .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #BFBFBF\ +}\ +.ace-xcode .ace_marker-layer .ace_active-line {\ +background: rgba(0, 0, 0, 0.071)\ +}\ +.ace-xcode .ace_gutter-active-line {\ +background-color: rgba(0, 0, 0, 0.071)\ +}\ +.ace-xcode .ace_marker-layer .ace_selected-word {\ +border: 1px solid #B5D5FF\ +}\ +.ace-xcode .ace_constant.ace_language,\ +.ace-xcode .ace_keyword,\ +.ace-xcode .ace_meta,\ +.ace-xcode .ace_variable.ace_language {\ +color: #C800A4\ +}\ +.ace-xcode .ace_invisible {\ +color: #BFBFBF\ +}\ +.ace-xcode .ace_constant.ace_character,\ +.ace-xcode .ace_constant.ace_other {\ +color: #275A5E\ +}\ +.ace-xcode .ace_constant.ace_numeric {\ +color: #3A00DC\ +}\ +.ace-xcode .ace_entity.ace_other.ace_attribute-name,\ +.ace-xcode .ace_support.ace_constant,\ +.ace-xcode .ace_support.ace_function {\ +color: #450084\ +}\ +.ace-xcode .ace_fold {\ +background-color: #C800A4;\ +border-color: #000000\ +}\ +.ace-xcode .ace_entity.ace_name.ace_tag,\ +.ace-xcode .ace_support.ace_class,\ +.ace-xcode .ace_support.ace_type {\ +color: #790EAD\ +}\ +.ace-xcode .ace_storage {\ +color: #C900A4\ +}\ +.ace-xcode .ace_string {\ +color: #DF0002\ +}\ +.ace-xcode .ace_comment {\ +color: #008E00\ +}\ +.ace-xcode .ace_indent-guide {\ +background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y\ +}"; + +var dom = acequire("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass); +}); /***/ }), -/* 52 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 61 */ +/***/ (function(module, exports) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return infiltrationBoxCreate; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Constants_js__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__ = __webpack_require__(5); +ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/multi_select"], function(acequire, exports, module) { + 'use strict'; - - - - - - -/* InfiltrationBox.js */ -function infiltrationBoxClose() { - var box = document.getElementById("infiltration-box-container"); - box.style.display = "none"; -} - -function infiltrationBoxOpen() { - var box = document.getElementById("infiltration-box-container"); - box.style.display = "block"; -} - -function infiltrationSetText(txt) { - var textBox = document.getElementById("infiltration-box-text"); - textBox.innerHTML = txt; -} - -//ram argument is in GB -function infiltrationBoxCreate(inst) { - var totalValue = 0; - for (var i = 0; i < inst.secretsStolen.length; ++i) { - totalValue += inst.secretsStolen[i]; + function log() { + var d = ""; + function format(p) { + if (typeof p != "object") + return p + ""; + if ("line" in p) { + return p.line + ":" + p.ch; + } + if ("anchor" in p) { + return format(p.anchor) + "->" + format(p.head); + } + if (Array.isArray(p)) + return "[" + p.map(function(x) { + return format(x); + }) + "]"; + return JSON.stringify(p); } - if (totalValue == 0) { - Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You successfully escaped the facility but you did not steal " + - "anything of worth when infiltrating.

" + - "You gained:
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); + for (var i = 0; i < arguments.length; i++) { + var p = arguments[i]; + var f = format(p); + d += f + " "; + } + console.log(d); + } + var Range = acequire("../range").Range; + var EventEmitter = acequire("../lib/event_emitter").EventEmitter; + var dom = acequire("../lib/dom"); + var oop = acequire("../lib/oop"); + var KEYS = acequire("../lib/keys"); + var event = acequire("../lib/event"); + var Search = acequire("../search").Search; + var useragent = acequire("../lib/useragent"); + var SearchHighlight = acequire("../search_highlight").SearchHighlight; + var multiSelectCommands = acequire("../commands/multi_select_commands"); + var TextModeTokenRe = acequire("../mode/text").Mode.prototype.tokenRe; + acequire("../multi_select"); + + var CodeMirror = function(ace) { + this.ace = ace; + this.state = {}; + this.marks = {}; + this.$uid = 0; + this.onChange = this.onChange.bind(this); + this.onSelectionChange = this.onSelectionChange.bind(this); + this.onBeforeEndOperation = this.onBeforeEndOperation.bind(this); + this.ace.on('change', this.onChange); + this.ace.on('changeSelection', this.onSelectionChange); + this.ace.on('beforeEndOperation', this.onBeforeEndOperation); + }; + CodeMirror.Pos = function(line, ch) { + if (!(this instanceof Pos)) return new Pos(line, ch); + this.line = line; this.ch = ch; + }; + CodeMirror.defineOption = function(name, val, setter) {}; + CodeMirror.commands = { + redo: function(cm) { cm.ace.redo(); }, + undo: function(cm) { cm.ace.undo(); }, + newlineAndIndent: function(cm) { cm.ace.insert("\n"); } + }; + CodeMirror.keyMap = {}; + CodeMirror.addClass = CodeMirror.rmClass = + CodeMirror.e_stop = function() {}; + CodeMirror.keyName = function(e) { + if (e.key) return e.key; + var key = (KEYS[e.keyCode] || ""); + if (key.length == 1) key = key.toUpperCase(); + key = event.getModifierString(e).replace(/(^|-)\w/g, function(m) { + return m.toUpperCase(); + }) + key; + return key; + }; + CodeMirror.keyMap['default'] = function(key) { + return function(cm) { + var cmd = cm.ace.commands.commandKeyBinding[key.toLowerCase()]; + return cmd && cm.ace.execCommand(cmd) !== false; + }; + }; + CodeMirror.lookupKey = function lookupKey(key, map, handle) { + if (typeof map == "string") + map = CodeMirror.keyMap[map]; + var found = typeof map == "function" ? map(key) : map[key]; + if (found === false) return "nothing"; + if (found === "...") return "multi"; + if (found != null && handle(found)) return "handled"; + + if (map.fallthrough) { + if (!Array.isArray(map.fallthrough)) + return lookupKey(key, map.fallthrough, handle); + for (var i = 0; i < map.fallthrough.length; i++) { + var result = lookupKey(key, map.fallthrough[i], handle); + if (result) return result; + } + } + }; + + CodeMirror.signal = function(o, name, e) { return o._signal(name, e) }; + CodeMirror.on = event.addListener; + CodeMirror.off = event.removeListener; + CodeMirror.isWordChar = function(ch) { + if (ch < "\x7f") return /^\w$/.test(ch); + TextModeTokenRe.lastIndex = 0; + return TextModeTokenRe.test(ch); + }; + +(function() { + oop.implement(CodeMirror.prototype, EventEmitter); + + this.destroy = function() { + this.ace.off('change', this.onChange); + this.ace.off('changeSelection', this.onSelectionChange); + this.ace.off('beforeEndOperation', this.onBeforeEndOperation); + this.removeOverlay(); + }; + this.virtualSelectionMode = function() { + return this.ace.inVirtualSelectionMode && this.ace.selection.index; + }; + this.onChange = function(delta) { + var change = { text: delta.action[0] == 'i' ? delta.lines : [] }; + var curOp = this.curOp = this.curOp || {}; + if (!curOp.changeHandlers) + curOp.changeHandlers = this._eventRegistry["change"] && this._eventRegistry["change"].slice(); + if (this.virtualSelectionMode()) return; + if (!curOp.lastChange) { + curOp.lastChange = curOp.change = change; + } else { + curOp.lastChange.next = curOp.lastChange = change; + } + this.$updateMarkers(delta); + }; + this.onSelectionChange = function() { + var curOp = this.curOp = this.curOp || {}; + if (!curOp.cursorActivityHandlers) + curOp.cursorActivityHandlers = this._eventRegistry["cursorActivity"] && this._eventRegistry["cursorActivity"].slice(); + this.curOp.cursorActivity = true; + if (this.ace.inMultiSelectMode) { + this.ace.keyBinding.removeKeyboardHandler(multiSelectCommands.keyboardHandler); + } + }; + this.operation = function(fn, force) { + if (!force && this.curOp || force && this.curOp && this.curOp.force) { + return fn(); + } + if (force || !this.ace.curOp) { + if (this.curOp) + this.onBeforeEndOperation(); + } + if (!this.ace.curOp) { + var prevOp = this.ace.prevOp; + this.ace.startOperation({ + command: { name: "vim", scrollIntoView: "cursor" } + }); + } + var curOp = this.curOp = this.curOp || {}; + this.curOp.force = force; + var result = fn(); + if (this.ace.curOp && this.ace.curOp.command.name == "vim") { + this.ace.endOperation(); + if (!curOp.cursorActivity && !curOp.lastChange && prevOp) + this.ace.prevOp = prevOp; + } + if (force || !this.ace.curOp) { + if (this.curOp) + this.onBeforeEndOperation(); + } + return result; + }; + this.onBeforeEndOperation = function() { + var op = this.curOp; + if (op) { + if (op.change) { this.signal("change", op.change, op); } + if (op && op.cursorActivity) { this.signal("cursorActivity", null, op); } + this.curOp = null; + } + }; + + this.signal = function(eventName, e, handlers) { + var listeners = handlers ? handlers[eventName + "Handlers"] + : (this._eventRegistry || {})[eventName]; + if (!listeners) return; + listeners = listeners.slice(); + for (var i=0; i" + __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].factions[i] + ""; - } - - var sellButton = Object(__WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-box-sell"); - setTimeout(function() { - sellButton.addEventListener("click", function() { - __WEBPACK_IMPORTED_MODULE_2__src_Player_js__["a" /* Player */].gainMoney(moneyValue); - Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You sold the classified information you stole from " + inst.companyName + - " for $" + moneyValue + " on the black market!

" + - "You gained:
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); - infiltrationBoxClose(); - return false; + if (!this.ace.inVirtualSelectionMode) + this.ace.exitMultiSelectMode(); + this.ace.session.unfold({row: line, column: ch}); + this.ace.selection.moveTo(line, ch); + }; + this.getCursor = function(p) { + var sel = this.ace.selection; + var pos = p == 'anchor' ? (sel.isEmpty() ? sel.lead : sel.anchor) : + p == 'head' || !p ? sel.lead : sel.getRange()[p]; + return toCmPos(pos); + }; + this.listSelections = function(p) { + var ranges = this.ace.multiSelect.rangeList.ranges; + if (!ranges.length || this.ace.inVirtualSelectionMode) + return [{anchor: this.getCursor('anchor'), head: this.getCursor('head')}]; + return ranges.map(function(r) { + return { + anchor: this.clipPos(toCmPos(r.cursor == r.end ? r.start : r.end)), + head: this.clipPos(toCmPos(r.cursor)) + }; + }, this); + }; + this.setSelections = function(p, primIndex) { + var sel = this.ace.multiSelect; + var ranges = p.map(function(x) { + var anchor = toAcePos(x.anchor); + var head = toAcePos(x.head); + var r = Range.comparePoints(anchor, head) < 0 + ? new Range.fromPoints(anchor, head) + : new Range.fromPoints(head, anchor); + r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start; + return r; }); - }, 750); - - var factionButton = Object(__WEBPACK_IMPORTED_MODULE_4__HelperFunctions_js__["b" /* clearEventListeners */])("infiltration-box-faction"); - setTimeout(function() { - factionButton.addEventListener("click", function() { - var facName = selector.options[selector.selectedIndex].value; - var faction = __WEBPACK_IMPORTED_MODULE_1__src_Faction_js__["b" /* Factions */][facName]; - if (faction == null) { - Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("Error finding faction. This is a bug please report to developer"); - return false; + + if (this.ace.inVirtualSelectionMode) { + this.ace.selection.fromOrientedRange(ranges[0]); + return; + } + if (!primIndex) { + ranges = ranges.reverse(); + } else if (ranges[primIndex]) { + ranges.push(ranges.splice(primIndex, 1)[0]); + } + sel.toSingleRange(ranges[0].clone()); + var session = this.ace.session; + for (var i = 0; i < ranges.length; i++) { + var range = session.$clipRangeToDocument(ranges[i]); // todo why ace doesn't do this? + sel.addRange(range); + } + }; + this.setSelection = function(a, h, options) { + var sel = this.ace.selection; + sel.moveTo(a.line, a.ch); + sel.selectTo(h.line, h.ch); + if (options && options.origin == '*mouse') { + this.onBeforeEndOperation(); + } + }; + this.somethingSelected = function(p) { + return !this.ace.selection.isEmpty(); + }; + this.clipPos = function(p) { + var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch); + return toCmPos(pos); + }; + this.markText = function(cursor) { + return {clear: function() {}, find: function() {}}; + }; + this.$updateMarkers = function(delta) { + var isInsert = delta.action == "insert"; + var start = delta.start; + var end = delta.end; + var rowShift = (end.row - start.row) * (isInsert ? 1 : -1); + var colShift = (end.column - start.column) * (isInsert ? 1 : -1); + if (isInsert) end = start; + + for (var i in this.marks) { + var point = this.marks[i]; + var cmp = Range.comparePoints(point, start); + if (cmp < 0) { + continue; // delta starts after the range + } + if (cmp === 0) { + if (isInsert) { + if (point.bias == 1) { + cmp = 1; + } else { + point.bias == -1; + continue; + } } - faction.playerReputation += facValue; - Object(__WEBPACK_IMPORTED_MODULE_3__DialogBox_js__["a" /* dialogBoxCreate */])("You gave the classified information you stole from " + inst.companyName + - " to " + facName + " and gained " + Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(facValue, 3) + " reputation with the faction.

" + - "You gained:
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp
" + - Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp
"); - infiltrationBoxClose(); - return false; + } + var cmp2 = isInsert ? cmp : Range.comparePoints(point, end); + if (cmp2 > 0) { + point.row += rowShift; + point.column += point.row == end.row ? colShift : 0; + continue; + } + if (!isInsert && cmp2 <= 0) { + point.row = start.row; + point.column = start.column; + if (cmp2 === 0) + point.bias = 1; + } + } + }; + var Marker = function(cm, id, row, column) { + this.cm = cm; + this.id = id; + this.row = row; + this.column = column; + cm.marks[this.id] = this; + }; + Marker.prototype.clear = function() { delete this.cm.marks[this.id] }; + Marker.prototype.find = function() { return toCmPos(this) }; + this.setBookmark = function(cursor, options) { + var bm = new Marker(this, this.$uid++, cursor.line, cursor.ch); + if (!options || !options.insertLeft) + bm.$insertRight = true; + this.marks[bm.id] = bm; + return bm; + }; + this.moveH = function(increment, unit) { + if (unit == 'char') { + var sel = this.ace.selection; + sel.clearSelection(); + sel.moveCursorBy(0, increment); + } + }; + this.findPosV = function(start, amount, unit, goalColumn) { + if (unit == 'page') { + var renderer = this.ace.renderer; + var config = renderer.layerConfig; + amount = amount * Math.floor(config.height / config.lineHeight); + unit = 'line'; + } + if (unit == 'line') { + var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch); + if (goalColumn != null) + screenPos.column = goalColumn; + screenPos.row += amount; + screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1); + var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column); + return toCmPos(pos); + } else { + debugger; + } + }; + this.charCoords = function(pos, mode) { + if (mode == 'div' || !mode) { + var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch); + return {left: sc.column, top: sc.row}; + }if (mode == 'local') { + var renderer = this.ace.renderer; + var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch); + var lh = renderer.layerConfig.lineHeight; + var cw = renderer.layerConfig.characterWidth; + var top = lh * sc.row; + return {left: sc.column * cw, top: top, bottom: top + lh}; + } + }; + this.coordsChar = function(pos, mode) { + var renderer = this.ace.renderer; + if (mode == 'local') { + var row = Math.max(0, Math.floor(pos.top / renderer.lineHeight)); + var col = Math.max(0, Math.floor(pos.left / renderer.characterWidth)); + var ch = renderer.session.screenToDocumentPosition(row, col); + return toCmPos(ch); + } else if (mode == 'div') { + throw "not implemented"; + } + }; + this.getSearchCursor = function(query, pos, caseFold) { + var caseSensitive = false; + var isRegexp = false; + if (query instanceof RegExp && !query.global) { + caseSensitive = !query.ignoreCase; + query = query.source; + isRegexp = true; + } + var search = new Search(); + if (pos.ch == undefined) pos.ch = Number.MAX_VALUE; + var acePos = {row: pos.line, column: pos.ch}; + var cm = this; + var last = null; + return { + findNext: function() { return this.find(false) }, + findPrevious: function() {return this.find(true) }, + find: function(back) { + search.setOptions({ + needle: query, + caseSensitive: caseSensitive, + wrap: false, + backwards: back, + regExp: isRegexp, + start: last || acePos + }); + var range = search.find(cm.ace.session); + if (range && range.isEmpty()) { + if (cm.getLine(range.start.row).length == range.start.column) { + search.$options.start = range; + range = search.find(cm.ace.session); + } + } + last = range; + return last; + }, + from: function() { return last && toCmPos(last.start) }, + to: function() { return last && toCmPos(last.end) }, + replace: function(text) { + if (last) { + last.end = cm.ace.session.doc.replace(last, text); + } + } + }; + }; + this.scrollTo = function(x, y) { + var renderer = this.ace.renderer; + var config = renderer.layerConfig; + var maxHeight = config.maxHeight; + maxHeight -= (renderer.$size.scrollerHeight - renderer.lineHeight) * renderer.$scrollPastEnd; + if (y != null) this.ace.session.setScrollTop(Math.max(0, Math.min(y, maxHeight))); + if (x != null) this.ace.session.setScrollLeft(Math.max(0, Math.min(x, config.width))); + }; + this.scrollInfo = function() { return 0; }; + this.scrollIntoView = function(pos, margin) { + if (pos) { + var renderer = this.ace.renderer; + var viewMargin = { "top": 0, "bottom": margin }; + renderer.scrollCursorIntoView(toAcePos(pos), + (renderer.lineHeight * 2) / renderer.$size.scrollerHeight, viewMargin); + } + }; + this.getLine = function(row) { return this.ace.session.getLine(row) }; + this.getRange = function(s, e) { + return this.ace.session.getTextRange(new Range(s.line, s.ch, e.line, e.ch)); + }; + this.replaceRange = function(text, s, e) { + if (!e) e = s; + return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text); + }; + this.replaceSelections = function(p) { + var sel = this.ace.selection; + if (this.ace.inVirtualSelectionMode) { + this.ace.session.replace(sel.getRange(), p[0] || ""); + return; + } + sel.inVirtualSelectionMode = true; + var ranges = sel.rangeList.ranges; + if (!ranges.length) ranges = [this.ace.multiSelect.getRange()]; + for (var i = ranges.length; i--;) + this.ace.session.replace(ranges[i], p[i] || ""); + sel.inVirtualSelectionMode = false; + }; + this.getSelection = function() { + return this.ace.getSelectedText(); + }; + this.getSelections = function() { + return this.listSelections().map(function(x) { + return this.getRange(x.anchor, x.head); + }, this); + }; + this.getInputField = function() { + return this.ace.textInput.getElement(); + }; + this.getWrapperElement = function() { + return this.ace.containter; + }; + var optMap = { + indentWithTabs: "useSoftTabs", + indentUnit: "tabSize", + tabSize: "tabSize", + firstLineNumber: "firstLineNumber", + readOnly: "readOnly" + }; + this.setOption = function(name, val) { + this.state[name] = val; + switch (name) { + case 'indentWithTabs': + name = optMap[name]; + val = !val; + break; + default: + name = optMap[name]; + } + if (name) + this.ace.setOption(name, val); + }; + this.getOption = function(name, val) { + var aceOpt = optMap[name]; + if (aceOpt) + val = this.ace.getOption(aceOpt); + switch (name) { + case 'indentWithTabs': + name = optMap[name]; + return !val; + } + return aceOpt ? val : this.state[name]; + }; + this.toggleOverwrite = function(on) { + this.state.overwrite = on; + return this.ace.setOverwrite(on); + }; + this.addOverlay = function(o) { + if (!this.$searchHighlight || !this.$searchHighlight.session) { + var highlight = new SearchHighlight(null, "ace_highlight-marker", "text"); + var marker = this.ace.session.addDynamicMarker(highlight); + highlight.id = marker.id; + highlight.session = this.ace.session; + highlight.destroy = function(o) { + highlight.session.off("change", highlight.updateOnChange); + highlight.session.off("changeEditor", highlight.destroy); + highlight.session.removeMarker(highlight.id); + highlight.session = null; + }; + highlight.updateOnChange = function(delta) { + var row = delta.start.row; + if (row == delta.end.row) highlight.cache[row] = undefined; + else highlight.cache.splice(row, highlight.cache.length); + }; + highlight.session.on("changeEditor", highlight.destroy); + highlight.session.on("change", highlight.updateOnChange); + } + var re = new RegExp(o.query.source, "gmi"); + this.$searchHighlight = o.highlight = highlight; + this.$searchHighlight.setRegexp(re); + this.ace.renderer.updateBackMarkers(); + }; + this.removeOverlay = function(o) { + if (this.$searchHighlight && this.$searchHighlight.session) { + this.$searchHighlight.destroy(); + } + }; + this.getScrollInfo = function() { + var renderer = this.ace.renderer; + var config = renderer.layerConfig; + return { + left: renderer.scrollLeft, + top: renderer.scrollTop, + height: config.maxHeight, + width: config.width, + clientHeight: config.height, + clientWidth: config.width + }; + }; + this.getValue = function() { + return this.ace.getValue(); + }; + this.setValue = function(v) { + return this.ace.setValue(v); + }; + this.getTokenTypeAt = function(pos) { + var token = this.ace.session.getTokenAt(pos.line, pos.ch); + return token && /comment|string/.test(token.type) ? "string" : ""; + }; + this.findMatchingBracket = function(pos) { + var m = this.ace.session.findMatchingBracket(toAcePos(pos)); + return {to: m && toCmPos(m)}; + }; + this.indentLine = function(line, method) { + if (method === true) + this.ace.session.indentRows(line, line, "\t"); + else if (method === false) + this.ace.session.outdentRows(new Range(line, 0, line, 0)); + }; + this.indexFromPos = function(pos) { + return this.ace.session.doc.positionToIndex(toAcePos(pos)); + }; + this.posFromIndex = function(index) { + return toCmPos(this.ace.session.doc.indexToPosition(index)); + }; + this.focus = function(index) { + return this.ace.focus(); + }; + this.blur = function(index) { + return this.ace.blur(); + }; + this.defaultTextHeight = function(index) { + return this.ace.renderer.layerConfig.lineHeight; + }; + this.scanForBracket = function(pos, dir, _, options) { + var re = options.bracketRegex.source; + if (dir == 1) { + var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), /paren|text/); + } else { + var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, /paren|text/); + } + return m && {pos: toCmPos(m)}; + }; + this.refresh = function() { + return this.ace.resize(true); + }; + this.getMode = function() { + return { name : this.getOption("mode") }; + } +}).call(CodeMirror.prototype); + function toAcePos(cmPos) { + return {row: cmPos.line, column: cmPos.ch}; + } + function toCmPos(acePos) { + return new Pos(acePos.row, acePos.column); + } + + var StringStream = CodeMirror.StringStream = function(string, tabSize) { + this.pos = this.start = 0; + this.string = string; + this.tabSize = tabSize || 8; + this.lastColumnPos = this.lastColumnValue = 0; + this.lineStart = 0; + }; + + StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == this.lineStart;}, + peek: function() {return this.string.charAt(this.pos) || undefined;}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() { + throw "not implemented"; + }, + indentation: function() { + throw "not implemented"; + }, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; + var substr = this.string.substr(this.pos, pattern.length); + if (cased(substr) == cased(pattern)) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) return null; + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);}, + hideFirstChars: function(n, inner) { + this.lineStart += n; + try { return inner(); } + finally { this.lineStart -= n; } + } + }; +CodeMirror.defineExtension = function(name, fn) { + CodeMirror.prototype[name] = fn; +}; +dom.importCssString(".normal-mode .ace_cursor{\ + border: 1px solid red;\ + background-color: red;\ + opacity: 0.5;\ +}\ +.normal-mode .ace_hidden-cursors .ace_cursor{\ + background-color: transparent;\ +}\ +.ace_dialog {\ + position: absolute;\ + left: 0; right: 0;\ + background: white;\ + z-index: 15;\ + padding: .1em .8em;\ + overflow: hidden;\ + color: #333;\ +}\ +.ace_dialog-top {\ + border-bottom: 1px solid #eee;\ + top: 0;\ +}\ +.ace_dialog-bottom {\ + border-top: 1px solid #eee;\ + bottom: 0;\ +}\ +.ace_dialog input {\ + border: none;\ + outline: none;\ + background: transparent;\ + width: 20em;\ + color: inherit;\ + font-family: monospace;\ +}", "vimMode"); +(function() { + function dialogDiv(cm, template, bottom) { + var wrap = cm.ace.container; + var dialog; + dialog = wrap.appendChild(document.createElement("div")); + if (bottom) + dialog.className = "ace_dialog ace_dialog-bottom"; + else + dialog.className = "ace_dialog ace_dialog-top"; + + if (typeof template == "string") { + dialog.innerHTML = template; + } else { // Assuming it's a detached DOM element. + dialog.appendChild(template); + } + return dialog; + } + + function closeNotification(cm, newVal) { + if (cm.state.currentNotificationClose) + cm.state.currentNotificationClose(); + cm.state.currentNotificationClose = newVal; + } + + CodeMirror.defineExtension("openDialog", function(template, callback, options) { + if (this.virtualSelectionMode()) return; + if (!options) options = {}; + + closeNotification(this, null); + + var dialog = dialogDiv(this, template, options.bottom); + var closed = false, me = this; + function close(newVal) { + if (typeof newVal == 'string') { + inp.value = newVal; + } else { + if (closed) return; + closed = true; + dialog.parentNode.removeChild(dialog); + me.focus(); + + if (options.onClose) options.onClose(dialog); + } + } + + var inp = dialog.getElementsByTagName("input")[0], button; + if (inp) { + if (options.value) { + inp.value = options.value; + if (options.select !== false) inp.select(); + } + + if (options.onInput) + CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); + if (options.onKeyUp) + CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); + + CodeMirror.on(inp, "keydown", function(e) { + if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } + if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { + inp.blur(); + CodeMirror.e_stop(e); + close(); + } + if (e.keyCode == 13) callback(inp.value); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); + + inp.focus(); + } else if (button = dialog.getElementsByTagName("button")[0]) { + CodeMirror.on(button, "click", function() { + close(); + me.focus(); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); + + button.focus(); + } + return close; + }); + + CodeMirror.defineExtension("openNotification", function(template, options) { + if (this.virtualSelectionMode()) return; + closeNotification(this, close); + var dialog = dialogDiv(this, template, options && options.bottom); + var closed = false, doneTimer; + var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; + + function close() { + if (closed) return; + closed = true; + clearTimeout(doneTimer); + dialog.parentNode.removeChild(dialog); + } + + CodeMirror.on(dialog, 'click', function(e) { + CodeMirror.e_preventDefault(e); + close(); }); - }, 750); - infiltrationBoxOpen(); -} + if (duration) + doneTimer = setTimeout(close, duration); + return close; + }); +})(); + + + var defaultKeymap = [ + { keys: '', type: 'keyToKey', toKeys: 'h' }, + { keys: '', type: 'keyToKey', toKeys: 'l' }, + { keys: '', type: 'keyToKey', toKeys: 'k' }, + { keys: '', type: 'keyToKey', toKeys: 'j' }, + { keys: '', type: 'keyToKey', toKeys: 'l' }, + { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'}, + { keys: '', type: 'keyToKey', toKeys: 'W' }, + { keys: '', type: 'keyToKey', toKeys: 'B', context: 'normal' }, + { keys: '', type: 'keyToKey', toKeys: 'w' }, + { keys: '', type: 'keyToKey', toKeys: 'b', context: 'normal' }, + { keys: '', type: 'keyToKey', toKeys: 'j' }, + { keys: '', type: 'keyToKey', toKeys: 'k' }, + { keys: '', type: 'keyToKey', toKeys: '' }, + { keys: '', type: 'keyToKey', toKeys: '' }, + { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, + { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, + { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' }, + { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'}, + { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, + { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' }, + { keys: '', type: 'keyToKey', toKeys: '0' }, + { keys: '', type: 'keyToKey', toKeys: '$' }, + { keys: '', type: 'keyToKey', toKeys: '' }, + { keys: '', type: 'keyToKey', toKeys: '' }, + { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, + { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }}, + { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }}, + { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }}, + { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }}, + { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }}, + { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }}, + { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }}, + { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }}, + { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }}, + { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }}, + { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }}, + { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }}, + { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }}, + { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }}, + { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }}, + { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }}, + { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }}, + { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }}, + { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }}, + { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }}, + { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, + { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, + { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, + { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, + { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, + { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }}, + { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }}, + { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }}, + { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }}, + { keys: 'f', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }}, + { keys: 'F', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }}, + { keys: 't', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }}, + { keys: 'T', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }}, + { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }}, + { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }}, + { keys: '\'', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}}, + { keys: '`', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}}, + { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } }, + { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } }, + { keys: ']\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } }, + { keys: '[\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } }, + { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}}, + { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}}, + { keys: ']', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}}, + { keys: '[', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}}, + { keys: '|', type: 'motion', motion: 'moveToColumn'}, + { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'}, + { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'}, + { keys: 'd', type: 'operator', operator: 'delete' }, + { keys: 'y', type: 'operator', operator: 'yank' }, + { keys: 'c', type: 'operator', operator: 'change' }, + { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }}, + { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }}, + { keys: 'g~', type: 'operator', operator: 'changeCase' }, + { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true }, + { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, + { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, + { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, + { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, + { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, + { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, + { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, + { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, + { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, + { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, + { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }}, + { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }}, + { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }}, + { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }}, + { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' }, + { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' }, + { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' }, + { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' }, + { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, + { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' }, + { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' }, + { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' }, + { keys: 'v', type: 'action', action: 'toggleVisualMode' }, + { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }}, + { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, + { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, + { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, + { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, + { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, + { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }}, + { keys: 'r', type: 'action', action: 'replace', isEdit: true }, + { keys: '@', type: 'action', action: 'replayMacro' }, + { keys: 'q', type: 'action', action: 'enterMacroRecordMode' }, + { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }}, + { keys: 'u', type: 'action', action: 'undo', context: 'normal' }, + { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true }, + { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true }, + { keys: '', type: 'action', action: 'redo' }, + { keys: 'm', type: 'action', action: 'setMark' }, + { keys: '"', type: 'action', action: 'setRegister' }, + { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }}, + { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }}, + { keys: 'z', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, + { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: '.', type: 'action', action: 'repeatLastEdit' }, + { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}}, + { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, + { keys: 'a', type: 'motion', motion: 'textObjectManipulation' }, + { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }}, + { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }}, + { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }}, + { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, + { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, + { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }}, + { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }}, + { keys: ':', type: 'ex' } + ]; + var defaultExCommandMap = [ + { name: 'colorscheme', shortName: 'colo' }, + { name: 'map' }, + { name: 'imap', shortName: 'im' }, + { name: 'nmap', shortName: 'nm' }, + { name: 'vmap', shortName: 'vm' }, + { name: 'unmap' }, + { name: 'write', shortName: 'w' }, + { name: 'undo', shortName: 'u' }, + { name: 'redo', shortName: 'red' }, + { name: 'set', shortName: 'se' }, + { name: 'set', shortName: 'se' }, + { name: 'setlocal', shortName: 'setl' }, + { name: 'setglobal', shortName: 'setg' }, + { name: 'sort', shortName: 'sor' }, + { name: 'substitute', shortName: 's', possiblyAsync: true }, + { name: 'nohlsearch', shortName: 'noh' }, + { name: 'delmarks', shortName: 'delm' }, + { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'global', shortName: 'g' } + ]; + + var Pos = CodeMirror.Pos; + + var Vim = function() { return vimApi; } //{ + function enterVimMode(cm) { + cm.setOption('disableInput', true); + cm.setOption('showCursorWhenSelecting', false); + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + cm.on('cursorActivity', onCursorActivity); + maybeInitVimState(cm); + CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm)); + } + + function leaveVimMode(cm) { + cm.setOption('disableInput', false); + cm.off('cursorActivity', onCursorActivity); + CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); + cm.state.vim = null; + } + + function detachVimMap(cm, next) { + if (this == CodeMirror.keyMap.vim) + CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); + + if (!next || next.attach != attachVimMap) + leaveVimMode(cm, false); + } + function attachVimMap(cm, prev) { + if (this == CodeMirror.keyMap.vim) + CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); + + if (!prev || prev.attach != attachVimMap) + enterVimMode(cm); + } + CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { + if (val && cm.getOption("keyMap") != "vim") + cm.setOption("keyMap", "vim"); + else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap"))) + cm.setOption("keyMap", "default"); + }); + + function cmKey(key, cm) { + if (!cm) { return undefined; } + var vimKey = cmKeyToVimKey(key); + if (!vimKey) { + return false; + } + var cmd = CodeMirror.Vim.findKey(cm, vimKey); + if (typeof cmd == 'function') { + CodeMirror.signal(cm, 'vim-keypress', vimKey); + } + return cmd; + } + + var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; + var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'}; + function cmKeyToVimKey(key) { + if (key.charAt(0) == '\'') { + return key.charAt(1); + } + var pieces = key.split(/-(?!$)/); + var lastPiece = pieces[pieces.length - 1]; + if (pieces.length == 1 && pieces[0].length == 1) { + return false; + } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) { + return false; + } + var hasCharacter = false; + for (var i = 0; i < pieces.length; i++) { + var piece = pieces[i]; + if (piece in modifiers) { pieces[i] = modifiers[piece]; } + else { hasCharacter = true; } + if (piece in specialKeys) { pieces[i] = specialKeys[piece]; } + } + if (!hasCharacter) { + return false; + } + if (isUpperCase(lastPiece)) { + pieces[pieces.length - 1] = lastPiece.toLowerCase(); + } + return '<' + pieces.join('-') + '>'; + } + + function getOnPasteFn(cm) { + var vim = cm.state.vim; + if (!vim.onPasteFn) { + vim.onPasteFn = function() { + if (!vim.insertMode) { + cm.setCursor(offsetCursor(cm.getCursor(), 0, 1)); + actions.enterInsertMode(cm, {}, vim); + } + }; + } + return vim.onPasteFn; + } + + var numberRegex = /[\d]/; + var wordCharTest = [CodeMirror.isWordChar, function(ch) { + return ch && !CodeMirror.isWordChar(ch) && !/\s/.test(ch); + }], bigWordCharTest = [function(ch) { + return /\S/.test(ch); + }]; + function makeKeyRange(start, size) { + var keys = []; + for (var i = start; i < start + size; i++) { + keys.push(String.fromCharCode(i)); + } + return keys; + } + var upperCaseAlphabet = makeKeyRange(65, 26); + var lowerCaseAlphabet = makeKeyRange(97, 26); + var numbers = makeKeyRange(48, 10); + var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); + var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); + + function isLine(cm, line) { + return line >= cm.firstLine() && line <= cm.lastLine(); + } + function isLowerCase(k) { + return (/^[a-z]$/).test(k); + } + function isMatchableSymbol(k) { + return '()[]{}'.indexOf(k) != -1; + } + function isNumber(k) { + return numberRegex.test(k); + } + function isUpperCase(k) { + return (/^[A-Z]$/).test(k); + } + function isWhiteSpaceString(k) { + return (/^\s*$/).test(k); + } + function inArray(val, arr) { + for (var i = 0; i < arr.length; i++) { + if (arr[i] == val) { + return true; + } + } + return false; + } + + var options = {}; + function defineOption(name, defaultValue, type, aliases, callback) { + if (defaultValue === undefined && !callback) { + throw Error('defaultValue is acequired unless callback is provided'); + } + if (!type) { type = 'string'; } + options[name] = { + type: type, + defaultValue: defaultValue, + callback: callback + }; + if (aliases) { + for (var i = 0; i < aliases.length; i++) { + options[aliases[i]] = options[name]; + } + } + if (defaultValue) { + setOption(name, defaultValue); + } + } + + function setOption(name, value, cm, cfg) { + var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; + if (!option) { + throw Error('Unknown option: ' + name); + } + if (option.type == 'boolean') { + if (value && value !== true) { + throw Error('Invalid argument: ' + name + '=' + value); + } else if (value !== false) { + value = true; + } + } + if (option.callback) { + if (scope !== 'local') { + option.callback(value, undefined); + } + if (scope !== 'global' && cm) { + option.callback(value, cm); + } + } else { + if (scope !== 'local') { + option.value = option.type == 'boolean' ? !!value : value; + } + if (scope !== 'global' && cm) { + cm.state.vim.options[name] = {value: value}; + } + } + } + + function getOption(name, cm, cfg) { + var option = options[name]; + cfg = cfg || {}; + var scope = cfg.scope; + if (!option) { + throw Error('Unknown option: ' + name); + } + if (option.callback) { + var local = cm && option.callback(undefined, cm); + if (scope !== 'global' && local !== undefined) { + return local; + } + if (scope !== 'local') { + return option.callback(); + } + return; + } else { + var local = (scope !== 'global') && (cm && cm.state.vim.options[name]); + return (local || (scope !== 'local') && option || {}).value; + } + } + + defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) { + if (cm === undefined) { + return; + } + if (name === undefined) { + var mode = cm.getOption('mode'); + return mode == 'null' ? '' : mode; + } else { + var mode = name == '' ? 'null' : name; + cm.setOption('mode', mode); + } + }); + + var createCircularJumpList = function() { + var size = 100; + var pointer = -1; + var head = 0; + var tail = 0; + var buffer = new Array(size); + function add(cm, oldCur, newCur) { + var current = pointer % size; + var curMark = buffer[current]; + function useNextSlot(cursor) { + var next = ++pointer % size; + var trashMark = buffer[next]; + if (trashMark) { + trashMark.clear(); + } + buffer[next] = cm.setBookmark(cursor); + } + if (curMark) { + var markPos = curMark.find(); + if (markPos && !cursorEqual(markPos, oldCur)) { + useNextSlot(oldCur); + } + } else { + useNextSlot(oldCur); + } + useNextSlot(newCur); + head = pointer; + tail = pointer - size + 1; + if (tail < 0) { + tail = 0; + } + } + function move(cm, offset) { + pointer += offset; + if (pointer > head) { + pointer = head; + } else if (pointer < tail) { + pointer = tail; + } + var mark = buffer[(size + pointer) % size]; + if (mark && !mark.find()) { + var inc = offset > 0 ? 1 : -1; + var newCur; + var oldCur = cm.getCursor(); + do { + pointer += inc; + mark = buffer[(size + pointer) % size]; + if (mark && + (newCur = mark.find()) && + !cursorEqual(oldCur, newCur)) { + break; + } + } while (pointer < head && pointer > tail); + } + return mark; + } + return { + cachedCursor: undefined, //used for # and * jumps + add: add, + move: move + }; + }; + var createInsertModeChanges = function(c) { + if (c) { + return { + changes: c.changes, + expectCursorActivityForChange: c.expectCursorActivityForChange + }; + } + return { + changes: [], + expectCursorActivityForChange: false + }; + }; + + function MacroModeState() { + this.latestRegister = undefined; + this.isPlaying = false; + this.isRecording = false; + this.replaySearchQueries = []; + this.onRecordingDone = undefined; + this.lastInsertModeChanges = createInsertModeChanges(); + } + MacroModeState.prototype = { + exitMacroRecordMode: function() { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.onRecordingDone) { + macroModeState.onRecordingDone(); // close dialog + } + macroModeState.onRecordingDone = undefined; + macroModeState.isRecording = false; + }, + enterMacroRecordMode: function(cm, registerName) { + var register = + vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.clear(); + this.latestRegister = registerName; + if (cm.openDialog) { + this.onRecordingDone = cm.openDialog( + '(recording)['+registerName+']', null, {bottom:true}); + } + this.isRecording = true; + } + } + }; + + function maybeInitVimState(cm) { + if (!cm.state.vim) { + cm.state.vim = { + inputState: new InputState(), + lastEditInputState: undefined, + lastEditActionCommand: undefined, + lastHPos: -1, + lastHSPos: -1, + lastMotion: null, + marks: {}, + fakeCursor: null, + insertMode: false, + insertModeRepeat: undefined, + visualMode: false, + visualLine: false, + visualBlock: false, + lastSelection: null, + lastPastedText: null, + sel: {}, + options: {} + }; + } + return cm.state.vim; + } + var vimGlobalState; + function resetVimGlobalState() { + vimGlobalState = { + searchQuery: null, + searchIsReversed: false, + lastSubstituteReplacePart: undefined, + jumpList: createCircularJumpList(), + macroModeState: new MacroModeState, + lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, + registerController: new RegisterController({}), + searchHistoryController: new HistoryController({}), + exCommandHistoryController : new HistoryController({}) + }; + for (var optionName in options) { + var option = options[optionName]; + option.value = option.defaultValue; + } + } + + var lastInsertModeKeyTimer; + var vimApi= { + buildKeyMap: function() { + }, + getRegisterController: function() { + return vimGlobalState.registerController; + }, + resetVimGlobalState_: resetVimGlobalState, + getVimGlobalState_: function() { + return vimGlobalState; + }, + maybeInitVimState_: maybeInitVimState, + + suppressErrorLogging: false, + + InsertModeKey: InsertModeKey, + map: function(lhs, rhs, ctx) { + exCommandDispatcher.map(lhs, rhs, ctx); + }, + unmap: function(lhs, ctx) { + exCommandDispatcher.unmap(lhs, ctx); + }, + setOption: setOption, + getOption: getOption, + defineOption: defineOption, + defineEx: function(name, prefix, func){ + if (!prefix) { + prefix = name; + } else if (name.indexOf(prefix) !== 0) { + throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered'); + } + exCommands[name]=func; + exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'}; + }, + handleKey: function (cm, key, origin) { + var command = this.findKey(cm, key, origin); + if (typeof command === 'function') { + return command(); + } + }, + findKey: function(cm, key, origin) { + var vim = maybeInitVimState(cm); + function handleMacroRecording() { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isRecording) { + if (key == 'q') { + macroModeState.exitMacroRecordMode(); + clearInputState(cm); + return true; + } + if (origin != 'mapping') { + logKey(macroModeState, key); + } + } + } + function handleEsc() { + if (key == '') { + clearInputState(cm); + if (vim.visualMode) { + exitVisualMode(cm); + } else if (vim.insertMode) { + exitInsertMode(cm); + } + return true; + } + } + function doKeyToKey(keys) { + var match; + while (keys) { + match = (/<\w+-.+?>|<\w+>|./).exec(keys); + key = match[0]; + keys = keys.substring(match.index + key.length); + CodeMirror.Vim.handleKey(cm, key, 'mapping'); + } + } + + function handleKeyInsertMode() { + if (handleEsc()) { return true; } + var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; + var keysAreChars = key.length == 1; + var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); + while (keys.length > 1 && match.type != 'full') { + var keys = vim.inputState.keyBuffer = keys.slice(1); + var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); + if (thisMatch.type != 'none') { match = thisMatch; } + } + if (match.type == 'none') { clearInputState(cm); return false; } + else if (match.type == 'partial') { + if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } + lastInsertModeKeyTimer = window.setTimeout( + function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } }, + getOption('insertModeEscKeysTimeout')); + return !keysAreChars; + } + + if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } + if (keysAreChars) { + var selections = cm.listSelections(); + for (var i = 0; i < selections.length; i++) { + var here = selections[i].head; + cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); + } + vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop(); + } + clearInputState(cm); + return match.command; + } + + function handleKeyNonInsertMode() { + if (handleMacroRecording() || handleEsc()) { return true; } + + var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; + if (/^[1-9]\d*$/.test(keys)) { return true; } + + var keysMatcher = /^(\d*)(.*)$/.exec(keys); + if (!keysMatcher) { clearInputState(cm); return false; } + var context = vim.visualMode ? 'visual' : + 'normal'; + var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + if (match.type == 'none') { clearInputState(cm); return false; } + else if (match.type == 'partial') { return true; } + + vim.inputState.keyBuffer = ''; + var keysMatcher = /^(\d*)(.*)$/.exec(keys); + if (keysMatcher[1] && keysMatcher[1] != '0') { + vim.inputState.pushRepeatDigit(keysMatcher[1]); + } + return match.command; + } + + var command; + if (vim.insertMode) { command = handleKeyInsertMode(); } + else { command = handleKeyNonInsertMode(); } + if (command === false) { + return undefined; + } else if (command === true) { + return function() { return true; }; + } else { + return function() { + if ((command.operator || command.isEdit) && cm.getOption('readOnly')) + return; // ace_patch + return cm.operation(function() { + cm.curOp.isVimOp = true; + try { + if (command.type == 'keyToKey') { + doKeyToKey(command.toKeys); + } else { + commandDispatcher.processCommand(cm, vim, command); + } + } catch (e) { + cm.state.vim = undefined; + maybeInitVimState(cm); + if (!CodeMirror.Vim.suppressErrorLogging) { + console['log'](e); + } + throw e; + } + return true; + }); + }; + } + }, + handleEx: function(cm, input) { + exCommandDispatcher.processCommand(cm, input); + }, + + defineMotion: defineMotion, + defineAction: defineAction, + defineOperator: defineOperator, + mapCommand: mapCommand, + _mapCommand: _mapCommand, + + defineRegister: defineRegister, + + exitVisualMode: exitVisualMode, + exitInsertMode: exitInsertMode + }; + function InputState() { + this.prefixRepeat = []; + this.motionRepeat = []; + + this.operator = null; + this.operatorArgs = null; + this.motion = null; + this.motionArgs = null; + this.keyBuffer = []; // For matching multi-key commands. + this.registerName = null; // Defaults to the unnamed register. + } + InputState.prototype.pushRepeatDigit = function(n) { + if (!this.operator) { + this.prefixRepeat = this.prefixRepeat.concat(n); + } else { + this.motionRepeat = this.motionRepeat.concat(n); + } + }; + InputState.prototype.getRepeat = function() { + var repeat = 0; + if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) { + repeat = 1; + if (this.prefixRepeat.length > 0) { + repeat *= parseInt(this.prefixRepeat.join(''), 10); + } + if (this.motionRepeat.length > 0) { + repeat *= parseInt(this.motionRepeat.join(''), 10); + } + } + return repeat; + }; + + function clearInputState(cm, reason) { + cm.state.vim.inputState = new InputState(); + CodeMirror.signal(cm, 'vim-command-done', reason); + } + function Register(text, linewise, blockwise) { + this.clear(); + this.keyBuffer = [text || '']; + this.insertModeChanges = []; + this.searchQueries = []; + this.linewise = !!linewise; + this.blockwise = !!blockwise; + } + Register.prototype = { + setText: function(text, linewise, blockwise) { + this.keyBuffer = [text || '']; + this.linewise = !!linewise; + this.blockwise = !!blockwise; + }, + pushText: function(text, linewise) { + if (linewise) { + if (!this.linewise) { + this.keyBuffer.push('\n'); + } + this.linewise = true; + } + this.keyBuffer.push(text); + }, + pushInsertModeChanges: function(changes) { + this.insertModeChanges.push(createInsertModeChanges(changes)); + }, + pushSearchQuery: function(query) { + this.searchQueries.push(query); + }, + clear: function() { + this.keyBuffer = []; + this.insertModeChanges = []; + this.searchQueries = []; + this.linewise = false; + }, + toString: function() { + return this.keyBuffer.join(''); + } + }; + function defineRegister(name, register) { + var registers = vimGlobalState.registerController.registers[name]; + if (!name || name.length != 1) { + throw Error('Register name must be 1 character'); + } + registers[name] = register; + validRegisters.push(name); + } + function RegisterController(registers) { + this.registers = registers; + this.unnamedRegister = registers['"'] = new Register(); + registers['.'] = new Register(); + registers[':'] = new Register(); + registers['/'] = new Register(); + } + RegisterController.prototype = { + pushText: function(registerName, operator, text, linewise, blockwise) { + if (linewise && text.charAt(0) == '\n') { + text = text.slice(1) + '\n'; + } + if (linewise && text.charAt(text.length - 1) !== '\n'){ + text += '\n'; + } + var register = this.isValidRegister(registerName) ? + this.getRegister(registerName) : null; + if (!register) { + switch (operator) { + case 'yank': + this.registers['0'] = new Register(text, linewise, blockwise); + break; + case 'delete': + case 'change': + if (text.indexOf('\n') == -1) { + this.registers['-'] = new Register(text, linewise); + } else { + this.shiftNumericRegisters_(); + this.registers['1'] = new Register(text, linewise); + } + break; + } + this.unnamedRegister.setText(text, linewise, blockwise); + return; + } + var append = isUpperCase(registerName); + if (append) { + register.pushText(text, linewise); + } else { + register.setText(text, linewise, blockwise); + } + this.unnamedRegister.setText(register.toString(), linewise); + }, + getRegister: function(name) { + if (!this.isValidRegister(name)) { + return this.unnamedRegister; + } + name = name.toLowerCase(); + if (!this.registers[name]) { + this.registers[name] = new Register(); + } + return this.registers[name]; + }, + isValidRegister: function(name) { + return name && inArray(name, validRegisters); + }, + shiftNumericRegisters_: function() { + for (var i = 9; i >= 2; i--) { + this.registers[i] = this.getRegister('' + (i - 1)); + } + } + }; + function HistoryController() { + this.historyBuffer = []; + this.iterator; + this.initialPrefix = null; + } + HistoryController.prototype = { + nextMatch: function (input, up) { + var historyBuffer = this.historyBuffer; + var dir = up ? -1 : 1; + if (this.initialPrefix === null) this.initialPrefix = input; + for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) { + var element = historyBuffer[i]; + for (var j = 0; j <= element.length; j++) { + if (this.initialPrefix == element.substring(0, j)) { + this.iterator = i; + return element; + } + } + } + if (i >= historyBuffer.length) { + this.iterator = historyBuffer.length; + return this.initialPrefix; + } + if (i < 0 ) return input; + }, + pushInput: function(input) { + var index = this.historyBuffer.indexOf(input); + if (index > -1) this.historyBuffer.splice(index, 1); + if (input.length) this.historyBuffer.push(input); + }, + reset: function() { + this.initialPrefix = null; + this.iterator = this.historyBuffer.length; + } + }; + var commandDispatcher = { + matchCommand: function(keys, keyMap, inputState, context) { + var matches = commandMatches(keys, keyMap, context, inputState); + if (!matches.full && !matches.partial) { + return {type: 'none'}; + } else if (!matches.full && matches.partial) { + return {type: 'partial'}; + } + + var bestMatch; + for (var i = 0; i < matches.full.length; i++) { + var match = matches.full[i]; + if (!bestMatch) { + bestMatch = match; + } + } + if (bestMatch.keys.slice(-11) == '') { + inputState.selectedCharacter = lastChar(keys); + } + return {type: 'full', command: bestMatch}; + }, + processCommand: function(cm, vim, command) { + vim.inputState.repeatOverride = command.repeatOverride; + switch (command.type) { + case 'motion': + this.processMotion(cm, vim, command); + break; + case 'operator': + this.processOperator(cm, vim, command); + break; + case 'operatorMotion': + this.processOperatorMotion(cm, vim, command); + break; + case 'action': + this.processAction(cm, vim, command); + break; + case 'search': + this.processSearch(cm, vim, command); + break; + case 'ex': + case 'keyToEx': + this.processEx(cm, vim, command); + break; + default: + break; + } + }, + processMotion: function(cm, vim, command) { + vim.inputState.motion = command.motion; + vim.inputState.motionArgs = copyArgs(command.motionArgs); + this.evalInput(cm, vim); + }, + processOperator: function(cm, vim, command) { + var inputState = vim.inputState; + if (inputState.operator) { + if (inputState.operator == command.operator) { + inputState.motion = 'expandToLine'; + inputState.motionArgs = { linewise: true }; + this.evalInput(cm, vim); + return; + } else { + clearInputState(cm); + } + } + inputState.operator = command.operator; + inputState.operatorArgs = copyArgs(command.operatorArgs); + if (vim.visualMode) { + this.evalInput(cm, vim); + } + }, + processOperatorMotion: function(cm, vim, command) { + var visualMode = vim.visualMode; + var operatorMotionArgs = copyArgs(command.operatorMotionArgs); + if (operatorMotionArgs) { + if (visualMode && operatorMotionArgs.visualLine) { + vim.visualLine = true; + } + } + this.processOperator(cm, vim, command); + if (!visualMode) { + this.processMotion(cm, vim, command); + } + }, + processAction: function(cm, vim, command) { + var inputState = vim.inputState; + var repeat = inputState.getRepeat(); + var repeatIsExplicit = !!repeat; + var actionArgs = copyArgs(command.actionArgs) || {}; + if (inputState.selectedCharacter) { + actionArgs.selectedCharacter = inputState.selectedCharacter; + } + if (command.operator) { + this.processOperator(cm, vim, command); + } + if (command.motion) { + this.processMotion(cm, vim, command); + } + if (command.motion || command.operator) { + this.evalInput(cm, vim); + } + actionArgs.repeat = repeat || 1; + actionArgs.repeatIsExplicit = repeatIsExplicit; + actionArgs.registerName = inputState.registerName; + clearInputState(cm); + vim.lastMotion = null; + if (command.isEdit) { + this.recordLastEdit(vim, inputState, command); + } + actions[command.action](cm, actionArgs, vim); + }, + processSearch: function(cm, vim, command) { + if (!cm.getSearchCursor) { + return; + } + var forward = command.searchArgs.forward; + var wholeWordOnly = command.searchArgs.wholeWordOnly; + getSearchState(cm).setReversed(!forward); + var promptPrefix = (forward) ? '/' : '?'; + var originalQuery = getSearchState(cm).getQuery(); + var originalScrollPos = cm.getScrollInfo(); + function handleQuery(query, ignoreCase, smartCase) { + vimGlobalState.searchHistoryController.pushInput(query); + vimGlobalState.searchHistoryController.reset(); + try { + updateSearchQuery(cm, query, ignoreCase, smartCase); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + query); + clearInputState(cm); + return; + } + commandDispatcher.processMotion(cm, vim, { + type: 'motion', + motion: 'findNext', + motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist } + }); + } + function onPromptClose(query) { + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + handleQuery(query, true /** ignoreCase */, true /** smartCase */); + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isRecording) { + logSearchQuery(macroModeState, query); + } + } + function onPromptKeyUp(e, query, close) { + var keyName = CodeMirror.keyName(e), up; + if (keyName == 'Up' || keyName == 'Down') { + up = keyName == 'Up' ? true : false; + query = vimGlobalState.searchHistoryController.nextMatch(query, up) || ''; + close(query); + } else { + if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') + vimGlobalState.searchHistoryController.reset(); + } + var parsedQuery; + try { + parsedQuery = updateSearchQuery(cm, query, + true /** ignoreCase */, true /** smartCase */); + } catch (e) { + } + if (parsedQuery) { + cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30); + } else { + clearSearchHighlight(cm); + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + } + } + function onPromptKeyDown(e, query, close) { + var keyName = CodeMirror.keyName(e); + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && query == '')) { + vimGlobalState.searchHistoryController.pushInput(query); + vimGlobalState.searchHistoryController.reset(); + updateSearchQuery(cm, originalQuery); + clearSearchHighlight(cm); + cm.scrollTo(originalScrollPos.left, originalScrollPos.top); + CodeMirror.e_stop(e); + clearInputState(cm); + close(); + cm.focus(); + } else if (keyName == 'Ctrl-U') { + CodeMirror.e_stop(e); + close(''); + } + } + switch (command.searchArgs.querySrc) { + case 'prompt': + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { + var query = macroModeState.replaySearchQueries.shift(); + handleQuery(query, true /** ignoreCase */, false /** smartCase */); + } else { + showPrompt(cm, { + onClose: onPromptClose, + prefix: promptPrefix, + desc: searchPromptDesc, + onKeyUp: onPromptKeyUp, + onKeyDown: onPromptKeyDown + }); + } + break; + case 'wordUnderCursor': + var word = expandWordUnderCursor(cm, false /** inclusive */, + true /** forward */, false /** bigWord */, + true /** noSymbol */); + var isKeyword = true; + if (!word) { + word = expandWordUnderCursor(cm, false /** inclusive */, + true /** forward */, false /** bigWord */, + false /** noSymbol */); + isKeyword = false; + } + if (!word) { + return; + } + var query = cm.getLine(word.start.line).substring(word.start.ch, + word.end.ch); + if (isKeyword && wholeWordOnly) { + query = '\\b' + query + '\\b'; + } else { + query = escapeRegex(query); + } + vimGlobalState.jumpList.cachedCursor = cm.getCursor(); + cm.setCursor(word.start); + + handleQuery(query, true /** ignoreCase */, false /** smartCase */); + break; + } + }, + processEx: function(cm, vim, command) { + function onPromptClose(input) { + vimGlobalState.exCommandHistoryController.pushInput(input); + vimGlobalState.exCommandHistoryController.reset(); + exCommandDispatcher.processCommand(cm, input); + } + function onPromptKeyDown(e, input, close) { + var keyName = CodeMirror.keyName(e), up; + if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || + (keyName == 'Backspace' && input == '')) { + vimGlobalState.exCommandHistoryController.pushInput(input); + vimGlobalState.exCommandHistoryController.reset(); + CodeMirror.e_stop(e); + clearInputState(cm); + close(); + cm.focus(); + } + if (keyName == 'Up' || keyName == 'Down') { + up = keyName == 'Up' ? true : false; + input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; + close(input); + } else if (keyName == 'Ctrl-U') { + CodeMirror.e_stop(e); + close(''); + } else { + if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') + vimGlobalState.exCommandHistoryController.reset(); + } + } + if (command.type == 'keyToEx') { + exCommandDispatcher.processCommand(cm, command.exArgs.input); + } else { + if (vim.visualMode) { + showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>', + onKeyDown: onPromptKeyDown}); + } else { + showPrompt(cm, { onClose: onPromptClose, prefix: ':', + onKeyDown: onPromptKeyDown}); + } + } + }, + evalInput: function(cm, vim) { + var inputState = vim.inputState; + var motion = inputState.motion; + var motionArgs = inputState.motionArgs || {}; + var operator = inputState.operator; + var operatorArgs = inputState.operatorArgs || {}; + var registerName = inputState.registerName; + var sel = vim.sel; + var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head')); + var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor')); + var oldHead = copyCursor(origHead); + var oldAnchor = copyCursor(origAnchor); + var newHead, newAnchor; + var repeat; + if (operator) { + this.recordLastEdit(vim, inputState); + } + if (inputState.repeatOverride !== undefined) { + repeat = inputState.repeatOverride; + } else { + repeat = inputState.getRepeat(); + } + if (repeat > 0 && motionArgs.explicitRepeat) { + motionArgs.repeatIsExplicit = true; + } else if (motionArgs.noRepeat || + (!motionArgs.explicitRepeat && repeat === 0)) { + repeat = 1; + motionArgs.repeatIsExplicit = false; + } + if (inputState.selectedCharacter) { + motionArgs.selectedCharacter = operatorArgs.selectedCharacter = + inputState.selectedCharacter; + } + motionArgs.repeat = repeat; + clearInputState(cm); + if (motion) { + var motionResult = motions[motion](cm, origHead, motionArgs, vim); + vim.lastMotion = motions[motion]; + if (!motionResult) { + return; + } + if (motionArgs.toJumplist) { + if (!operator && cm.ace.curOp != null) + cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch + var jumpList = vimGlobalState.jumpList; + var cachedCursor = jumpList.cachedCursor; + if (cachedCursor) { + recordJumpPosition(cm, cachedCursor, motionResult); + delete jumpList.cachedCursor; + } else { + recordJumpPosition(cm, origHead, motionResult); + } + } + if (motionResult instanceof Array) { + newAnchor = motionResult[0]; + newHead = motionResult[1]; + } else { + newHead = motionResult; + } + if (!newHead) { + newHead = copyCursor(origHead); + } + if (vim.visualMode) { + if (!(vim.visualBlock && newHead.ch === Infinity)) { + newHead = clipCursorToContent(cm, newHead, vim.visualBlock); + } + if (newAnchor) { + newAnchor = clipCursorToContent(cm, newAnchor, true); + } + newAnchor = newAnchor || oldAnchor; + sel.anchor = newAnchor; + sel.head = newHead; + updateCmSelection(cm); + updateMark(cm, vim, '<', + cursorIsBefore(newAnchor, newHead) ? newAnchor + : newHead); + updateMark(cm, vim, '>', + cursorIsBefore(newAnchor, newHead) ? newHead + : newAnchor); + } else if (!operator) { + newHead = clipCursorToContent(cm, newHead); + cm.setCursor(newHead.line, newHead.ch); + } + } + if (operator) { + if (operatorArgs.lastSel) { + newAnchor = oldAnchor; + var lastSel = operatorArgs.lastSel; + var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); + var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); + if (lastSel.visualLine) { + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + } else if (lastSel.visualBlock) { + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + } else if (lastSel.head.line == lastSel.anchor.line) { + newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + } else { + newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + } + vim.visualMode = true; + vim.visualLine = lastSel.visualLine; + vim.visualBlock = lastSel.visualBlock; + sel = vim.sel = { + anchor: newAnchor, + head: newHead + }; + updateCmSelection(cm); + } else if (vim.visualMode) { + operatorArgs.lastSel = { + anchor: copyCursor(sel.anchor), + head: copyCursor(sel.head), + visualBlock: vim.visualBlock, + visualLine: vim.visualLine + }; + } + var curStart, curEnd, linewise, mode; + var cmSel; + if (vim.visualMode) { + curStart = cursorMin(sel.head, sel.anchor); + curEnd = cursorMax(sel.head, sel.anchor); + linewise = vim.visualLine || operatorArgs.linewise; + mode = vim.visualBlock ? 'block' : + linewise ? 'line' : + 'char'; + cmSel = makeCmSelection(cm, { + anchor: curStart, + head: curEnd + }, mode); + if (linewise) { + var ranges = cmSel.ranges; + if (mode == 'block') { + for (var i = 0; i < ranges.length; i++) { + ranges[i].head.ch = lineLength(cm, ranges[i].head.line); + } + } else if (mode == 'line') { + ranges[0].head = Pos(ranges[0].head.line + 1, 0); + } + } + } else { + curStart = copyCursor(newAnchor || oldAnchor); + curEnd = copyCursor(newHead || oldHead); + if (cursorIsBefore(curEnd, curStart)) { + var tmp = curStart; + curStart = curEnd; + curEnd = tmp; + } + linewise = motionArgs.linewise || operatorArgs.linewise; + if (linewise) { + expandSelectionToLine(cm, curStart, curEnd); + } else if (motionArgs.forward) { + clipToLine(cm, curStart, curEnd); + } + mode = 'char'; + var exclusive = !motionArgs.inclusive || linewise; + cmSel = makeCmSelection(cm, { + anchor: curStart, + head: curEnd + }, mode, exclusive); + } + cm.setSelections(cmSel.ranges, cmSel.primary); + vim.lastMotion = null; + operatorArgs.repeat = repeat; // For indent in visual mode. + operatorArgs.registerName = registerName; + operatorArgs.linewise = linewise; + var operatorMoveTo = operators[operator]( + cm, operatorArgs, cmSel.ranges, oldAnchor, newHead); + if (vim.visualMode) { + exitVisualMode(cm, operatorMoveTo != null); + } + if (operatorMoveTo) { + cm.setCursor(operatorMoveTo); + } + } + }, + recordLastEdit: function(vim, inputState, actionCommand) { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { return; } + vim.lastEditInputState = inputState; + vim.lastEditActionCommand = actionCommand; + macroModeState.lastInsertModeChanges.changes = []; + macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false; + } + }; + var motions = { + moveToTopLine: function(cm, _head, motionArgs) { + var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + moveToMiddleLine: function(cm) { + var range = getUserVisibleLines(cm); + var line = Math.floor((range.top + range.bottom) * 0.5); + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + moveToBottomLine: function(cm, _head, motionArgs) { + var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; + return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + }, + expandToLine: function(_cm, head, motionArgs) { + var cur = head; + return Pos(cur.line + motionArgs.repeat - 1, Infinity); + }, + findNext: function(cm, _head, motionArgs) { + var state = getSearchState(cm); + var query = state.getQuery(); + if (!query) { + return; + } + var prev = !motionArgs.forward; + prev = (state.isReversed()) ? !prev : prev; + highlightSearchMatches(cm, query); + return findNext(cm, prev/** prev */, query, motionArgs.repeat); + }, + goToMark: function(cm, _head, motionArgs, vim) { + var mark = vim.marks[motionArgs.selectedCharacter]; + if (mark) { + var pos = mark.find(); + return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos; + } + return null; + }, + moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) { + if (vim.visualBlock && motionArgs.sameLine) { + var sel = vim.sel; + return [ + clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + ]; + } else { + return ([vim.sel.head, vim.sel.anchor]); + } + }, + jumpToMark: function(cm, head, motionArgs, vim) { + var best = head; + for (var i = 0; i < motionArgs.repeat; i++) { + var cursor = best; + for (var key in vim.marks) { + if (!isLowerCase(key)) { + continue; + } + var mark = vim.marks[key].find(); + var isWrongDirection = (motionArgs.forward) ? + cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark); + + if (isWrongDirection) { + continue; + } + if (motionArgs.linewise && (mark.line == cursor.line)) { + continue; + } + + var equal = cursorEqual(cursor, best); + var between = (motionArgs.forward) ? + cursorIsBetween(cursor, mark, best) : + cursorIsBetween(best, mark, cursor); + + if (equal || between) { + best = mark; + } + } + } + + if (motionArgs.linewise) { + best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + } + return best; + }, + moveByCharacters: function(_cm, head, motionArgs) { + var cur = head; + var repeat = motionArgs.repeat; + var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; + return Pos(cur.line, ch); + }, + moveByLines: function(cm, head, motionArgs, vim) { + var cur = head; + var endCh = cur.ch; + switch (vim.lastMotion) { + case this.moveByLines: + case this.moveByDisplayLines: + case this.moveByScroll: + case this.moveToColumn: + case this.moveToEol: + endCh = vim.lastHPos; + break; + default: + vim.lastHPos = endCh; + } + var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0); + var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat; + var first = cm.firstLine(); + var last = cm.lastLine(); + if ((line < first && cur.line == first) || + (line > last && cur.line == last)) { + return; + } + var fold = cm.ace.session.getFoldLine(line); + if (fold) { + if (motionArgs.forward) { + if (line > fold.start.row) + line = fold.end.row + 1; + } else { + line = fold.start.row; + } + } + if (motionArgs.toFirstChar){ + endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); + vim.lastHPos = endCh; + } + vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; + return Pos(line, endCh); + }, + moveByDisplayLines: function(cm, head, motionArgs, vim) { + var cur = head; + switch (vim.lastMotion) { + case this.moveByDisplayLines: + case this.moveByScroll: + case this.moveByLines: + case this.moveToColumn: + case this.moveToEol: + break; + default: + vim.lastHSPos = cm.charCoords(cur,'div').left; + } + var repeat = motionArgs.repeat; + var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos); + if (res.hitSide) { + if (motionArgs.forward) { + var lastCharCoords = cm.charCoords(res, 'div'); + var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; + var res = cm.coordsChar(goalCoords, 'div'); + } else { + var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + resCoords.left = vim.lastHSPos; + res = cm.coordsChar(resCoords, 'div'); + } + } + vim.lastHPos = res.ch; + return res; + }, + moveByPage: function(cm, head, motionArgs) { + var curStart = head; + var repeat = motionArgs.repeat; + return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page'); + }, + moveByParagraph: function(cm, head, motionArgs) { + var dir = motionArgs.forward ? 1 : -1; + return findParagraph(cm, head, motionArgs.repeat, dir); + }, + moveByScroll: function(cm, head, motionArgs, vim) { + var scrollbox = cm.getScrollInfo(); + var curEnd = null; + var repeat = motionArgs.repeat; + if (!repeat) { + repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight()); + } + var orig = cm.charCoords(head, 'local'); + motionArgs.repeat = repeat; + var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); + if (!curEnd) { + return null; + } + var dest = cm.charCoords(curEnd, 'local'); + cm.scrollTo(null, scrollbox.top + dest.top - orig.top); + return curEnd; + }, + moveByWords: function(cm, head, motionArgs) { + return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, + !!motionArgs.wordEnd, !!motionArgs.bigWord); + }, + moveTillCharacter: function(cm, _head, motionArgs) { + var repeat = motionArgs.repeat; + var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter); + var increment = motionArgs.forward ? -1 : 1; + recordLastCharacterSearch(increment, motionArgs); + if (!curEnd) return null; + curEnd.ch += increment; + return curEnd; + }, + moveToCharacter: function(cm, head, motionArgs) { + var repeat = motionArgs.repeat; + recordLastCharacterSearch(0, motionArgs); + return moveToCharacter(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter) || head; + }, + moveToSymbol: function(cm, head, motionArgs) { + var repeat = motionArgs.repeat; + return findSymbol(cm, repeat, motionArgs.forward, + motionArgs.selectedCharacter) || head; + }, + moveToColumn: function(cm, head, motionArgs, vim) { + var repeat = motionArgs.repeat; + vim.lastHPos = repeat - 1; + vim.lastHSPos = cm.charCoords(head,'div').left; + return moveToColumn(cm, repeat); + }, + moveToEol: function(cm, head, motionArgs, vim) { + var cur = head; + vim.lastHPos = Infinity; + var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); + var end=cm.clipPos(retval); + end.ch--; + vim.lastHSPos = cm.charCoords(end,'div').left; + return retval; + }, + moveToFirstNonWhiteSpaceCharacter: function(cm, head) { + var cursor = head; + return Pos(cursor.line, + findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); + }, + moveToMatchedSymbol: function(cm, head) { + var cursor = head; + var line = cursor.line; + var ch = cursor.ch; + var lineText = cm.getLine(line); + var symbol; + do { + symbol = lineText.charAt(ch++); + if (symbol && isMatchableSymbol(symbol)) { + var style = cm.getTokenTypeAt(Pos(line, ch)); + if (style !== "string" && style !== "comment") { + break; + } + } + } while (symbol); + if (symbol) { + var matched = cm.findMatchingBracket(Pos(line, ch)); + return matched.to; + } else { + return cursor; + } + }, + moveToStartOfLine: function(_cm, head) { + return Pos(head.line, 0); + }, + moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { + var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); + if (motionArgs.repeatIsExplicit) { + lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); + } + return Pos(lineNum, + findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); + }, + textObjectManipulation: function(cm, head, motionArgs, vim) { + var mirroredPairs = {'(': ')', ')': '(', + '{': '}', '}': '{', + '[': ']', ']': '['}; + var selfPaired = {'\'': true, '"': true}; + + var character = motionArgs.selectedCharacter; + if (character == 'b') { + character = '('; + } else if (character == 'B') { + character = '{'; + } + var inclusive = !motionArgs.textObjectInner; + + var tmp; + if (mirroredPairs[character]) { + tmp = selectCompanionObject(cm, head, character, inclusive); + } else if (selfPaired[character]) { + tmp = findBeginningAndEnd(cm, head, character, inclusive); + } else if (character === 'W') { + tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, + true /** bigWord */); + } else if (character === 'w') { + tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, + false /** bigWord */); + } else if (character === 'p') { + tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive); + motionArgs.linewise = true; + if (vim.visualMode) { + if (!vim.visualLine) { vim.visualLine = true; } + } else { + var operatorArgs = vim.inputState.operatorArgs; + if (operatorArgs) { operatorArgs.linewise = true; } + tmp.end.line--; + } + } else { + return null; + } + + if (!cm.state.vim.visualMode) { + return [tmp.start, tmp.end]; + } else { + return expandSelection(cm, tmp.start, tmp.end); + } + }, + + repeatLastCharacterSearch: function(cm, head, motionArgs) { + var lastSearch = vimGlobalState.lastChararacterSearch; + var repeat = motionArgs.repeat; + var forward = motionArgs.forward === lastSearch.forward; + var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); + cm.moveH(-increment, 'char'); + motionArgs.inclusive = forward ? true : false; + var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter); + if (!curEnd) { + cm.moveH(increment, 'char'); + return head; + } + curEnd.ch += increment; + return curEnd; + } + }; + + function defineMotion(name, fn) { + motions[name] = fn; + } + + function fillArray(val, times) { + var arr = []; + for (var i = 0; i < times; i++) { + arr.push(val); + } + return arr; + } + var operators = { + change: function(cm, args, ranges) { + var finalHead, text; + var vim = cm.state.vim; + vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock; + if (!vim.visualMode) { + var anchor = ranges[0].anchor, + head = ranges[0].head; + text = cm.getRange(anchor, head); + var lastState = vim.lastEditInputState || {}; + if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) { + var match = (/\s+$/).exec(text); + if (match && lastState.motionArgs && lastState.motionArgs.forward) { + head = offsetCursor(head, 0, - match[0].length); + text = text.slice(0, - match[0].length); + } + } + var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE); + var wasLastLine = cm.firstLine() == cm.lastLine(); + if (head.line > cm.lastLine() && args.linewise && !wasLastLine) { + cm.replaceRange('', prevLineEnd, head); + } else { + cm.replaceRange('', anchor, head); + } + if (args.linewise) { + if (!wasLastLine) { + cm.setCursor(prevLineEnd); + CodeMirror.commands.newlineAndIndent(cm); + } + anchor.ch = Number.MAX_VALUE; + } + finalHead = anchor; + } else { + text = cm.getSelection(); + var replacement = fillArray('', ranges.length); + cm.replaceSelections(replacement); + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); + } + vimGlobalState.registerController.pushText( + args.registerName, 'change', text, + args.linewise, ranges.length > 1); + actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim); + }, + 'delete': function(cm, args, ranges) { + var finalHead, text; + var vim = cm.state.vim; + if (!vim.visualBlock) { + var anchor = ranges[0].anchor, + head = ranges[0].head; + if (args.linewise && + head.line != cm.firstLine() && + anchor.line == cm.lastLine() && + anchor.line == head.line - 1) { + if (anchor.line == cm.firstLine()) { + anchor.ch = 0; + } else { + anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + } + } + text = cm.getRange(anchor, head); + cm.replaceRange('', anchor, head); + finalHead = anchor; + if (args.linewise) { + finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor); + } + } else { + text = cm.getSelection(); + var replacement = fillArray('', ranges.length); + cm.replaceSelections(replacement); + finalHead = ranges[0].anchor; + } + vimGlobalState.registerController.pushText( + args.registerName, 'delete', text, + args.linewise, vim.visualBlock); + return clipCursorToContent(cm, finalHead); + }, + indent: function(cm, args, ranges) { + var vim = cm.state.vim; + var startLine = ranges[0].anchor.line; + var endLine = vim.visualBlock ? + ranges[ranges.length - 1].anchor.line : + ranges[0].head.line; + var repeat = (vim.visualMode) ? args.repeat : 1; + if (args.linewise) { + endLine--; + } + for (var i = startLine; i <= endLine; i++) { + for (var j = 0; j < repeat; j++) { + cm.indentLine(i, args.indentRight); + } + } + return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); + }, + changeCase: function(cm, args, ranges, oldAnchor, newHead) { + var selections = cm.getSelections(); + var swapped = []; + var toLower = args.toLower; + for (var j = 0; j < selections.length; j++) { + var toSwap = selections[j]; + var text = ''; + if (toLower === true) { + text = toSwap.toLowerCase(); + } else if (toLower === false) { + text = toSwap.toUpperCase(); + } else { + for (var i = 0; i < toSwap.length; i++) { + var character = toSwap.charAt(i); + text += isUpperCase(character) ? character.toLowerCase() : + character.toUpperCase(); + } + } + swapped.push(text); + } + cm.replaceSelections(swapped); + if (args.shouldMoveCursor){ + return newHead; + } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) { + return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor); + } else if (args.linewise){ + return oldAnchor; + } else { + return cursorMin(ranges[0].anchor, ranges[0].head); + } + }, + yank: function(cm, args, ranges, oldAnchor) { + var vim = cm.state.vim; + var text = cm.getSelection(); + var endPos = vim.visualMode + ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor) + : oldAnchor; + vimGlobalState.registerController.pushText( + args.registerName, 'yank', + text, args.linewise, vim.visualBlock); + return endPos; + } + }; + + function defineOperator(name, fn) { + operators[name] = fn; + } + + var actions = { + jumpListWalk: function(cm, actionArgs, vim) { + if (vim.visualMode) { + return; + } + var repeat = actionArgs.repeat; + var forward = actionArgs.forward; + var jumpList = vimGlobalState.jumpList; + + var mark = jumpList.move(cm, forward ? repeat : -repeat); + var markPos = mark ? mark.find() : undefined; + markPos = markPos ? markPos : cm.getCursor(); + cm.setCursor(markPos); + cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch + }, + scroll: function(cm, actionArgs, vim) { + if (vim.visualMode) { + return; + } + var repeat = actionArgs.repeat || 1; + var lineHeight = cm.defaultTextHeight(); + var top = cm.getScrollInfo().top; + var delta = lineHeight * repeat; + var newPos = actionArgs.forward ? top + delta : top - delta; + var cursor = copyCursor(cm.getCursor()); + var cursorCoords = cm.charCoords(cursor, 'local'); + if (actionArgs.forward) { + if (newPos > cursorCoords.top) { + cursor.line += (newPos - cursorCoords.top) / lineHeight; + cursor.line = Math.ceil(cursor.line); + cm.setCursor(cursor); + cursorCoords = cm.charCoords(cursor, 'local'); + cm.scrollTo(null, cursorCoords.top); + } else { + cm.scrollTo(null, newPos); + } + } else { + var newBottom = newPos + cm.getScrollInfo().clientHeight; + if (newBottom < cursorCoords.bottom) { + cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight; + cursor.line = Math.floor(cursor.line); + cm.setCursor(cursor); + cursorCoords = cm.charCoords(cursor, 'local'); + cm.scrollTo( + null, cursorCoords.bottom - cm.getScrollInfo().clientHeight); + } else { + cm.scrollTo(null, newPos); + } + } + }, + scrollToCursor: function(cm, actionArgs) { + var lineNum = cm.getCursor().line; + var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var height = cm.getScrollInfo().clientHeight; + var y = charCoords.top; + var lineHeight = charCoords.bottom - y; + switch (actionArgs.position) { + case 'center': y = y - (height / 2) + lineHeight; + break; + case 'bottom': y = y - height + lineHeight*1.4; + break; + case 'top': y = y + lineHeight*0.4; + break; + } + cm.scrollTo(null, y); + }, + replayMacro: function(cm, actionArgs, vim) { + var registerName = actionArgs.selectedCharacter; + var repeat = actionArgs.repeat; + var macroModeState = vimGlobalState.macroModeState; + if (registerName == '@') { + registerName = macroModeState.latestRegister; + } + while(repeat--){ + executeMacroRegister(cm, vim, macroModeState, registerName); + } + }, + enterMacroRecordMode: function(cm, actionArgs) { + var macroModeState = vimGlobalState.macroModeState; + var registerName = actionArgs.selectedCharacter; + macroModeState.enterMacroRecordMode(cm, registerName); + }, + enterInsertMode: function(cm, actionArgs, vim) { + if (cm.getOption('readOnly')) { return; } + vim.insertMode = true; + vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1; + var insertAt = (actionArgs) ? actionArgs.insertAt : null; + var sel = vim.sel; + var head = actionArgs.head || cm.getCursor('head'); + var height = cm.listSelections().length; + if (insertAt == 'eol') { + head = Pos(head.line, lineLength(cm, head.line)); + } else if (insertAt == 'charAfter') { + head = offsetCursor(head, 0, 1); + } else if (insertAt == 'firstNonBlank') { + head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head); + } else if (insertAt == 'startOfSelectedArea') { + if (!vim.visualBlock) { + if (sel.head.line < sel.anchor.line) { + head = sel.head; + } else { + head = Pos(sel.anchor.line, 0); + } + } else { + head = Pos( + Math.min(sel.head.line, sel.anchor.line), + Math.min(sel.head.ch, sel.anchor.ch)); + height = Math.abs(sel.head.line - sel.anchor.line) + 1; + } + } else if (insertAt == 'endOfSelectedArea') { + if (!vim.visualBlock) { + if (sel.head.line >= sel.anchor.line) { + head = offsetCursor(sel.head, 0, 1); + } else { + head = Pos(sel.anchor.line, 0); + } + } else { + head = Pos( + Math.min(sel.head.line, sel.anchor.line), + Math.max(sel.head.ch + 1, sel.anchor.ch)); + height = Math.abs(sel.head.line - sel.anchor.line) + 1; + } + } else if (insertAt == 'inplace') { + if (vim.visualMode){ + return; + } + } + cm.setOption('keyMap', 'vim-insert'); + cm.setOption('disableInput', false); + if (actionArgs && actionArgs.replace) { + cm.toggleOverwrite(true); + cm.setOption('keyMap', 'vim-replace'); + CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"}); + } else { + cm.setOption('keyMap', 'vim-insert'); + CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"}); + } + if (!vimGlobalState.macroModeState.isPlaying) { + cm.on('change', onChange); + CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); + } + if (vim.visualMode) { + exitVisualMode(cm); + } + selectForInsert(cm, head, height); + }, + toggleVisualMode: function(cm, actionArgs, vim) { + var repeat = actionArgs.repeat; + var anchor = cm.getCursor(); + var head; + if (!vim.visualMode) { + vim.visualMode = true; + vim.visualLine = !!actionArgs.linewise; + vim.visualBlock = !!actionArgs.blockwise; + head = clipCursorToContent( + cm, Pos(anchor.line, anchor.ch + repeat - 1), + true /** includeLineBreak */); + vim.sel = { + anchor: anchor, + head: head + }; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); + updateCmSelection(cm); + updateMark(cm, vim, '<', cursorMin(anchor, head)); + updateMark(cm, vim, '>', cursorMax(anchor, head)); + } else if (vim.visualLine ^ actionArgs.linewise || + vim.visualBlock ^ actionArgs.blockwise) { + vim.visualLine = !!actionArgs.linewise; + vim.visualBlock = !!actionArgs.blockwise; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); + updateCmSelection(cm); + } else { + exitVisualMode(cm); + } + }, + reselectLastSelection: function(cm, _actionArgs, vim) { + var lastSelection = vim.lastSelection; + if (vim.visualMode) { + updateLastSelection(cm, vim); + } + if (lastSelection) { + var anchor = lastSelection.anchorMark.find(); + var head = lastSelection.headMark.find(); + if (!anchor || !head) { + return; + } + vim.sel = { + anchor: anchor, + head: head + }; + vim.visualMode = true; + vim.visualLine = lastSelection.visualLine; + vim.visualBlock = lastSelection.visualBlock; + updateCmSelection(cm); + updateMark(cm, vim, '<', cursorMin(anchor, head)); + updateMark(cm, vim, '>', cursorMax(anchor, head)); + CodeMirror.signal(cm, 'vim-mode-change', { + mode: 'visual', + subMode: vim.visualLine ? 'linewise' : + vim.visualBlock ? 'blockwise' : ''}); + } + }, + joinLines: function(cm, actionArgs, vim) { + var curStart, curEnd; + if (vim.visualMode) { + curStart = cm.getCursor('anchor'); + curEnd = cm.getCursor('head'); + if (cursorIsBefore(curEnd, curStart)) { + var tmp = curEnd; + curEnd = curStart; + curStart = tmp; + } + curEnd.ch = lineLength(cm, curEnd.line) - 1; + } else { + var repeat = Math.max(actionArgs.repeat, 2); + curStart = cm.getCursor(); + curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + Infinity)); + } + var finalCh = 0; + for (var i = curStart.line; i < curEnd.line; i++) { + finalCh = lineLength(cm, curStart.line); + var tmp = Pos(curStart.line + 1, + lineLength(cm, curStart.line + 1)); + var text = cm.getRange(curStart, tmp); + text = text.replace(/\n\s*/g, ' '); + cm.replaceRange(text, curStart, tmp); + } + var curFinalPos = Pos(curStart.line, finalCh); + if (vim.visualMode) { + exitVisualMode(cm, false); + } + cm.setCursor(curFinalPos); + }, + newLineAndEnterInsertMode: function(cm, actionArgs, vim) { + vim.insertMode = true; + var insertAt = copyCursor(cm.getCursor()); + if (insertAt.line === cm.firstLine() && !actionArgs.after) { + cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.setCursor(cm.firstLine(), 0); + } else { + insertAt.line = (actionArgs.after) ? insertAt.line : + insertAt.line - 1; + insertAt.ch = lineLength(cm, insertAt.line); + cm.setCursor(insertAt); + var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment || + CodeMirror.commands.newlineAndIndent; + newlineFn(cm); + } + this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim); + }, + paste: function(cm, actionArgs, vim) { + var cur = copyCursor(cm.getCursor()); + var register = vimGlobalState.registerController.getRegister( + actionArgs.registerName); + var text = register.toString(); + if (!text) { + return; + } + if (actionArgs.matchIndent) { + var tabSize = cm.getOption("tabSize"); + var whitespaceLength = function(str) { + var tabs = (str.split("\t").length - 1); + var spaces = (str.split(" ").length - 1); + return tabs * tabSize + spaces * 1; + }; + var currentLine = cm.getLine(cm.getCursor().line); + var indent = whitespaceLength(currentLine.match(/^\s*/)[0]); + var chompedText = text.replace(/\n$/, ''); + var wasChomped = text !== chompedText; + var firstIndent = whitespaceLength(text.match(/^\s*/)[0]); + var text = chompedText.replace(/^\s*/gm, function(wspace) { + var newIndent = indent + (whitespaceLength(wspace) - firstIndent); + if (newIndent < 0) { + return ""; + } + else if (cm.getOption("indentWithTabs")) { + var quotient = Math.floor(newIndent / tabSize); + return Array(quotient + 1).join('\t'); + } + else { + return Array(newIndent + 1).join(' '); + } + }); + text += wasChomped ? "\n" : ""; + } + if (actionArgs.repeat > 1) { + var text = Array(actionArgs.repeat + 1).join(text); + } + var linewise = register.linewise; + var blockwise = register.blockwise; + if (linewise && !blockwise) { + if(vim.visualMode) { + text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n'; + } else if (actionArgs.after) { + text = '\n' + text.slice(0, text.length - 1); + cur.ch = lineLength(cm, cur.line); + } else { + cur.ch = 0; + } + } else { + if (blockwise) { + text = text.split('\n'); + for (var i = 0; i < text.length; i++) { + text[i] = (text[i] == '') ? ' ' : text[i]; + } + } + cur.ch += actionArgs.after ? 1 : 0; + } + var curPosFinal; + var idx; + if (vim.visualMode) { + vim.lastPastedText = text; + var lastSelectionCurEnd; + var selectedArea = getSelectedAreaRange(cm, vim); + var selectionStart = selectedArea[0]; + var selectionEnd = selectedArea[1]; + var selectedText = cm.getSelection(); + var selections = cm.listSelections(); + var emptyStrings = new Array(selections.length).join('1').split('1'); + if (vim.lastSelection) { + lastSelectionCurEnd = vim.lastSelection.headMark.find(); + } + vimGlobalState.registerController.unnamedRegister.setText(selectedText); + if (blockwise) { + cm.replaceSelections(emptyStrings); + selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + cm.setCursor(selectionStart); + selectBlock(cm, selectionEnd); + cm.replaceSelections(text); + curPosFinal = selectionStart; + } else if (vim.visualBlock) { + cm.replaceSelections(emptyStrings); + cm.setCursor(selectionStart); + cm.replaceRange(text, selectionStart, selectionStart); + curPosFinal = selectionStart; + } else { + cm.replaceRange(text, selectionStart, selectionEnd); + curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1); + } + if(lastSelectionCurEnd) { + vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd); + } + if (linewise) { + curPosFinal.ch=0; + } + } else { + if (blockwise) { + cm.setCursor(cur); + for (var i = 0; i < text.length; i++) { + var line = cur.line+i; + if (line > cm.lastLine()) { + cm.replaceRange('\n', Pos(line, 0)); + } + var lastCh = lineLength(cm, line); + if (lastCh < cur.ch) { + extendLineToColumn(cm, line, cur.ch); + } + } + cm.setCursor(cur); + selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + cm.replaceSelections(text); + curPosFinal = cur; + } else { + cm.replaceRange(text, cur); + if (linewise && actionArgs.after) { + curPosFinal = Pos( + cur.line + 1, + findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); + } else if (linewise && !actionArgs.after) { + curPosFinal = Pos( + cur.line, + findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); + } else if (!linewise && actionArgs.after) { + idx = cm.indexFromPos(cur); + curPosFinal = cm.posFromIndex(idx + text.length - 1); + } else { + idx = cm.indexFromPos(cur); + curPosFinal = cm.posFromIndex(idx + text.length); + } + } + } + if (vim.visualMode) { + exitVisualMode(cm, false); + } + cm.setCursor(curPosFinal); + }, + undo: function(cm, actionArgs) { + cm.operation(function() { + repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)(); + cm.setCursor(cm.getCursor('anchor')); + }); + }, + redo: function(cm, actionArgs) { + repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)(); + }, + setRegister: function(_cm, actionArgs, vim) { + vim.inputState.registerName = actionArgs.selectedCharacter; + }, + setMark: function(cm, actionArgs, vim) { + var markName = actionArgs.selectedCharacter; + updateMark(cm, vim, markName, cm.getCursor()); + }, + replace: function(cm, actionArgs, vim) { + var replaceWith = actionArgs.selectedCharacter; + var curStart = cm.getCursor(); + var replaceTo; + var curEnd; + var selections = cm.listSelections(); + if (vim.visualMode) { + curStart = cm.getCursor('start'); + curEnd = cm.getCursor('end'); + } else { + var line = cm.getLine(curStart.line); + replaceTo = curStart.ch + actionArgs.repeat; + if (replaceTo > line.length) { + replaceTo=line.length; + } + curEnd = Pos(curStart.line, replaceTo); + } + if (replaceWith=='\n') { + if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); + (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm); + } else { + var replaceWithStr = cm.getRange(curStart, curEnd); + replaceWithStr = replaceWithStr.replace(/[^\n]/g, replaceWith); + if (vim.visualBlock) { + var spaces = new Array(cm.getOption("tabSize")+1).join(' '); + replaceWithStr = cm.getSelection(); + replaceWithStr = replaceWithStr.replace(/\t/g, spaces).replace(/[^\n]/g, replaceWith).split('\n'); + cm.replaceSelections(replaceWithStr); + } else { + cm.replaceRange(replaceWithStr, curStart, curEnd); + } + if (vim.visualMode) { + curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ? + selections[0].anchor : selections[0].head; + cm.setCursor(curStart); + exitVisualMode(cm, false); + } else { + cm.setCursor(offsetCursor(curEnd, 0, -1)); + } + } + }, + incrementNumberToken: function(cm, actionArgs) { + var cur = cm.getCursor(); + var lineStr = cm.getLine(cur.line); + var re = /-?\d+/g; + var match; + var start; + var end; + var numberStr; + var token; + while ((match = re.exec(lineStr)) !== null) { + token = match[0]; + start = match.index; + end = start + token.length; + if (cur.ch < end)break; + } + if (!actionArgs.backtrack && (end <= cur.ch))return; + if (token) { + var increment = actionArgs.increase ? 1 : -1; + var number = parseInt(token) + (increment * actionArgs.repeat); + var from = Pos(cur.line, start); + var to = Pos(cur.line, end); + numberStr = number.toString(); + cm.replaceRange(numberStr, from, to); + } else { + return; + } + cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + }, + repeatLastEdit: function(cm, actionArgs, vim) { + var lastEditInputState = vim.lastEditInputState; + if (!lastEditInputState) { return; } + var repeat = actionArgs.repeat; + if (repeat && actionArgs.repeatIsExplicit) { + vim.lastEditInputState.repeatOverride = repeat; + } else { + repeat = vim.lastEditInputState.repeatOverride || repeat; + } + repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */); + }, + exitInsertMode: exitInsertMode + }; + + function defineAction(name, fn) { + actions[name] = fn; + } + function clipCursorToContent(cm, cur, includeLineBreak) { + var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); + var maxCh = lineLength(cm, line) - 1; + maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; + var ch = Math.min(Math.max(0, cur.ch), maxCh); + return Pos(line, ch); + } + function copyArgs(args) { + var ret = {}; + for (var prop in args) { + if (args.hasOwnProperty(prop)) { + ret[prop] = args[prop]; + } + } + return ret; + } + function offsetCursor(cur, offsetLine, offsetCh) { + if (typeof offsetLine === 'object') { + offsetCh = offsetLine.ch; + offsetLine = offsetLine.line; + } + return Pos(cur.line + offsetLine, cur.ch + offsetCh); + } + function getOffset(anchor, head) { + return { + line: head.line - anchor.line, + ch: head.line - anchor.line + }; + } + function commandMatches(keys, keyMap, context, inputState) { + var match, partial = [], full = []; + for (var i = 0; i < keyMap.length; i++) { + var command = keyMap[i]; + if (context == 'insert' && command.context != 'insert' || + command.context && command.context != context || + inputState.operator && command.type == 'action' || + !(match = commandMatch(keys, command.keys))) { continue; } + if (match == 'partial') { partial.push(command); } + if (match == 'full') { full.push(command); } + } + return { + partial: partial.length && partial, + full: full.length && full + }; + } + function commandMatch(pressed, mapped) { + if (mapped.slice(-11) == '') { + var prefixLen = mapped.length - 11; + var pressedPrefix = pressed.slice(0, prefixLen); + var mappedPrefix = mapped.slice(0, prefixLen); + return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' : + mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false; + } else { + return pressed == mapped ? 'full' : + mapped.indexOf(pressed) == 0 ? 'partial' : false; + } + } + function lastChar(keys) { + var match = /^.*(<[\w\-]+>)$/.exec(keys); + var selectedCharacter = match ? match[1] : keys.slice(-1); + if (selectedCharacter.length > 1){ + switch(selectedCharacter){ + case '': + selectedCharacter='\n'; + break; + case '': + selectedCharacter=' '; + break; + default: + break; + } + } + return selectedCharacter; + } + function repeatFn(cm, fn, repeat) { + return function() { + for (var i = 0; i < repeat; i++) { + fn(cm); + } + }; + } + function copyCursor(cur) { + return Pos(cur.line, cur.ch); + } + function cursorEqual(cur1, cur2) { + return cur1.ch == cur2.ch && cur1.line == cur2.line; + } + function cursorIsBefore(cur1, cur2) { + if (cur1.line < cur2.line) { + return true; + } + if (cur1.line == cur2.line && cur1.ch < cur2.ch) { + return true; + } + return false; + } + function cursorMin(cur1, cur2) { + if (arguments.length > 2) { + cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1)); + } + return cursorIsBefore(cur1, cur2) ? cur1 : cur2; + } + function cursorMax(cur1, cur2) { + if (arguments.length > 2) { + cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1)); + } + return cursorIsBefore(cur1, cur2) ? cur2 : cur1; + } + function cursorIsBetween(cur1, cur2, cur3) { + var cur1before2 = cursorIsBefore(cur1, cur2); + var cur2before3 = cursorIsBefore(cur2, cur3); + return cur1before2 && cur2before3; + } + function lineLength(cm, lineNum) { + return cm.getLine(lineNum).length; + } + function trim(s) { + if (s.trim) { + return s.trim(); + } + return s.replace(/^\s+|\s+$/g, ''); + } + function escapeRegex(s) { + return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1'); + } + function extendLineToColumn(cm, lineNum, column) { + var endCh = lineLength(cm, lineNum); + var spaces = new Array(column-endCh+1).join(' '); + cm.setCursor(Pos(lineNum, endCh)); + cm.replaceRange(spaces, cm.getCursor()); + } + function selectBlock(cm, selectionEnd) { + var selections = [], ranges = cm.listSelections(); + var head = copyCursor(cm.clipPos(selectionEnd)); + var isClipped = !cursorEqual(selectionEnd, head); + var curHead = cm.getCursor('head'); + var primIndex = getIndex(ranges, curHead); + var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor); + var max = ranges.length - 1; + var index = max - primIndex > primIndex ? max : 0; + var base = ranges[index].anchor; + + var firstLine = Math.min(base.line, head.line); + var lastLine = Math.max(base.line, head.line); + var baseCh = base.ch, headCh = head.ch; + + var dir = ranges[index].head.ch - baseCh; + var newDir = headCh - baseCh; + if (dir > 0 && newDir <= 0) { + baseCh++; + if (!isClipped) { headCh--; } + } else if (dir < 0 && newDir >= 0) { + baseCh--; + if (!wasClipped) { headCh++; } + } else if (dir < 0 && newDir == -1) { + baseCh--; + headCh++; + } + for (var line = firstLine; line <= lastLine; line++) { + var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)}; + selections.push(range); + } + primIndex = head.line == lastLine ? selections.length - 1 : 0; + cm.setSelections(selections); + selectionEnd.ch = headCh; + base.ch = baseCh; + return base; + } + function selectForInsert(cm, head, height) { + var sel = []; + for (var i = 0; i < height; i++) { + var lineHead = offsetCursor(head, i, 0); + sel.push({anchor: lineHead, head: lineHead}); + } + cm.setSelections(sel, 0); + } + function getIndex(ranges, cursor, end) { + for (var i = 0; i < ranges.length; i++) { + var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor); + var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor); + if (atAnchor || atHead) { + return i; + } + } + return -1; + } + function getSelectedAreaRange(cm, vim) { + var lastSelection = vim.lastSelection; + var getCurrentSelectedAreaRange = function() { + var selections = cm.listSelections(); + var start = selections[0]; + var end = selections[selections.length-1]; + var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head; + var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor; + return [selectionStart, selectionEnd]; + }; + var getLastSelectedAreaRange = function() { + var selectionStart = cm.getCursor(); + var selectionEnd = cm.getCursor(); + var block = lastSelection.visualBlock; + if (block) { + var width = block.width; + var height = block.height; + selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + var selections = []; + for (var i = selectionStart.line; i < selectionEnd.line; i++) { + var anchor = Pos(i, selectionStart.ch); + var head = Pos(i, selectionEnd.ch); + var range = {anchor: anchor, head: head}; + selections.push(range); + } + cm.setSelections(selections); + } else { + var start = lastSelection.anchorMark.find(); + var end = lastSelection.headMark.find(); + var line = end.line - start.line; + var ch = end.ch - start.ch; + selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; + if (lastSelection.visualLine) { + selectionStart = Pos(selectionStart.line, 0); + selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + } + cm.setSelection(selectionStart, selectionEnd); + } + return [selectionStart, selectionEnd]; + }; + if (!vim.visualMode) { + return getLastSelectedAreaRange(); + } else { + return getCurrentSelectedAreaRange(); + } + } + function updateLastSelection(cm, vim) { + var anchor = vim.sel.anchor; + var head = vim.sel.head; + if (vim.lastPastedText) { + head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length); + vim.lastPastedText = null; + } + vim.lastSelection = {'anchorMark': cm.setBookmark(anchor), + 'headMark': cm.setBookmark(head), + 'anchor': copyCursor(anchor), + 'head': copyCursor(head), + 'visualMode': vim.visualMode, + 'visualLine': vim.visualLine, + 'visualBlock': vim.visualBlock}; + } + function expandSelection(cm, start, end) { + var sel = cm.state.vim.sel; + var head = sel.head; + var anchor = sel.anchor; + var tmp; + if (cursorIsBefore(end, start)) { + tmp = end; + end = start; + start = tmp; + } + if (cursorIsBefore(head, anchor)) { + head = cursorMin(start, head); + anchor = cursorMax(anchor, end); + } else { + anchor = cursorMin(start, anchor); + head = cursorMax(head, end); + head = offsetCursor(head, 0, -1); + if (head.ch == -1 && head.line != cm.firstLine()) { + head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + } + } + return [anchor, head]; + } + function updateCmSelection(cm, sel, mode) { + var vim = cm.state.vim; + sel = sel || vim.sel; + var mode = mode || + vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; + var cmSel = makeCmSelection(cm, sel, mode); + cm.setSelections(cmSel.ranges, cmSel.primary); + updateFakeCursor(cm); + } + function makeCmSelection(cm, sel, mode, exclusive) { + var head = copyCursor(sel.head); + var anchor = copyCursor(sel.anchor); + if (mode == 'char') { + var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; + var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; + head = offsetCursor(sel.head, 0, headOffset); + anchor = offsetCursor(sel.anchor, 0, anchorOffset); + return { + ranges: [{anchor: anchor, head: head}], + primary: 0 + }; + } else if (mode == 'line') { + if (!cursorIsBefore(sel.head, sel.anchor)) { + anchor.ch = 0; + + var lastLine = cm.lastLine(); + if (head.line > lastLine) { + head.line = lastLine; + } + head.ch = lineLength(cm, head.line); + } else { + head.ch = 0; + anchor.ch = lineLength(cm, anchor.line); + } + return { + ranges: [{anchor: anchor, head: head}], + primary: 0 + }; + } else if (mode == 'block') { + var top = Math.min(anchor.line, head.line), + left = Math.min(anchor.ch, head.ch), + bottom = Math.max(anchor.line, head.line), + right = Math.max(anchor.ch, head.ch) + 1; + var height = bottom - top + 1; + var primary = head.line == top ? 0 : height - 1; + var ranges = []; + for (var i = 0; i < height; i++) { + ranges.push({ + anchor: Pos(top + i, left), + head: Pos(top + i, right) + }); + } + return { + ranges: ranges, + primary: primary + }; + } + } + function getHead(cm) { + var cur = cm.getCursor('head'); + if (cm.getSelection().length == 1) { + cur = cursorMin(cur, cm.getCursor('anchor')); + } + return cur; + } + function exitVisualMode(cm, moveHead) { + var vim = cm.state.vim; + if (moveHead !== false) { + cm.setCursor(clipCursorToContent(cm, vim.sel.head)); + } + updateLastSelection(cm, vim); + vim.visualMode = false; + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + if (vim.fakeCursor) { + vim.fakeCursor.clear(); + } + } + function clipToLine(cm, curStart, curEnd) { + var selection = cm.getRange(curStart, curEnd); + if (/\n\s*$/.test(selection)) { + var lines = selection.split('\n'); + lines.pop(); + var line; + for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) { + curEnd.line--; + curEnd.ch = 0; + } + if (line) { + curEnd.line--; + curEnd.ch = lineLength(cm, curEnd.line); + } else { + curEnd.ch = 0; + } + } + } + function expandSelectionToLine(_cm, curStart, curEnd) { + curStart.ch = 0; + curEnd.ch = 0; + curEnd.line++; + } + + function findFirstNonWhiteSpaceCharacter(text) { + if (!text) { + return 0; + } + var firstNonWS = text.search(/\S/); + return firstNonWS == -1 ? text.length : firstNonWS; + } + + function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) { + var cur = getHead(cm); + var line = cm.getLine(cur.line); + var idx = cur.ch; + var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0]; + while (!test(line.charAt(idx))) { + idx++; + if (idx >= line.length) { return null; } + } + + if (bigWord) { + test = bigWordCharTest[0]; + } else { + test = wordCharTest[0]; + if (!test(line.charAt(idx))) { + test = wordCharTest[1]; + } + } + + var end = idx, start = idx; + while (test(line.charAt(end)) && end < line.length) { end++; } + while (test(line.charAt(start)) && start >= 0) { start--; } + start++; + + if (inclusive) { + var wordEnd = end; + while (/\s/.test(line.charAt(end)) && end < line.length) { end++; } + if (wordEnd == end) { + var wordStart = start; + while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; } + if (!start) { start = wordStart; } + } + } + return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + } + + function recordJumpPosition(cm, oldCur, newCur) { + if (!cursorEqual(oldCur, newCur)) { + vimGlobalState.jumpList.add(cm, oldCur, newCur); + } + } + + function recordLastCharacterSearch(increment, args) { + vimGlobalState.lastChararacterSearch.increment = increment; + vimGlobalState.lastChararacterSearch.forward = args.forward; + vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; + } + + var symbolToMode = { + '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket', + '[': 'section', ']': 'section', + '*': 'comment', '/': 'comment', + 'm': 'method', 'M': 'method', + '#': 'preprocess' + }; + var findSymbolModes = { + bracket: { + isComplete: function(state) { + if (state.nextCh === state.symb) { + state.depth++; + if (state.depth >= 1)return true; + } else if (state.nextCh === state.reverseSymb) { + state.depth--; + } + return false; + } + }, + section: { + init: function(state) { + state.curMoveThrough = true; + state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}'; + }, + isComplete: function(state) { + return state.index === 0 && state.nextCh === state.symb; + } + }, + comment: { + isComplete: function(state) { + var found = state.lastCh === '*' && state.nextCh === '/'; + state.lastCh = state.nextCh; + return found; + } + }, + method: { + init: function(state) { + state.symb = (state.symb === 'm' ? '{' : '}'); + state.reverseSymb = state.symb === '{' ? '}' : '{'; + }, + isComplete: function(state) { + if (state.nextCh === state.symb)return true; + return false; + } + }, + preprocess: { + init: function(state) { + state.index = 0; + }, + isComplete: function(state) { + if (state.nextCh === '#') { + var token = state.lineText.match(/#(\w+)/)[1]; + if (token === 'endif') { + if (state.forward && state.depth === 0) { + return true; + } + state.depth++; + } else if (token === 'if') { + if (!state.forward && state.depth === 0) { + return true; + } + state.depth--; + } + if (token === 'else' && state.depth === 0)return true; + } + return false; + } + } + }; + function findSymbol(cm, repeat, forward, symb) { + var cur = copyCursor(cm.getCursor()); + var increment = forward ? 1 : -1; + var endLine = forward ? cm.lineCount() : -1; + var curCh = cur.ch; + var line = cur.line; + var lineText = cm.getLine(line); + var state = { + lineText: lineText, + nextCh: lineText.charAt(curCh), + lastCh: null, + index: curCh, + symb: symb, + reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb], + forward: forward, + depth: 0, + curMoveThrough: false + }; + var mode = symbolToMode[symb]; + if (!mode)return cur; + var init = findSymbolModes[mode].init; + var isComplete = findSymbolModes[mode].isComplete; + if (init) { init(state); } + while (line !== endLine && repeat) { + state.index += increment; + state.nextCh = state.lineText.charAt(state.index); + if (!state.nextCh) { + line += increment; + state.lineText = cm.getLine(line) || ''; + if (increment > 0) { + state.index = 0; + } else { + var lineLen = state.lineText.length; + state.index = (lineLen > 0) ? (lineLen-1) : 0; + } + state.nextCh = state.lineText.charAt(state.index); + } + if (isComplete(state)) { + cur.line = line; + cur.ch = state.index; + repeat--; + } + } + if (state.nextCh || state.curMoveThrough) { + return Pos(line, state.index); + } + return cur; + } + function findWord(cm, cur, forward, bigWord, emptyLineIsWord) { + var lineNum = cur.line; + var pos = cur.ch; + var line = cm.getLine(lineNum); + var dir = forward ? 1 : -1; + var charTests = bigWord ? bigWordCharTest: wordCharTest; + + if (emptyLineIsWord && line == '') { + lineNum += dir; + line = cm.getLine(lineNum); + if (!isLine(cm, lineNum)) { + return null; + } + pos = (forward) ? 0 : line.length; + } + + while (true) { + if (emptyLineIsWord && line == '') { + return { from: 0, to: 0, line: lineNum }; + } + var stop = (dir > 0) ? line.length : -1; + var wordStart = stop, wordEnd = stop; + while (pos != stop) { + var foundWord = false; + for (var i = 0; i < charTests.length && !foundWord; ++i) { + if (charTests[i](line.charAt(pos))) { + wordStart = pos; + while (pos != stop && charTests[i](line.charAt(pos))) { + pos += dir; + } + wordEnd = pos; + foundWord = wordStart != wordEnd; + if (wordStart == cur.ch && lineNum == cur.line && + wordEnd == wordStart + dir) { + continue; + } else { + return { + from: Math.min(wordStart, wordEnd + 1), + to: Math.max(wordStart, wordEnd), + line: lineNum }; + } + } + } + if (!foundWord) { + pos += dir; + } + } + lineNum += dir; + if (!isLine(cm, lineNum)) { + return null; + } + line = cm.getLine(lineNum); + pos = (dir > 0) ? 0 : line.length; + } + throw new Error('The impossible happened.'); + } + function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) { + var curStart = copyCursor(cur); + var words = []; + if (forward && !wordEnd || !forward && wordEnd) { + repeat++; + } + var emptyLineIsWord = !(forward && wordEnd); + for (var i = 0; i < repeat; i++) { + var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord); + if (!word) { + var eodCh = lineLength(cm, cm.lastLine()); + words.push(forward + ? {line: cm.lastLine(), from: eodCh, to: eodCh} + : {line: 0, from: 0, to: 0}); + break; + } + words.push(word); + cur = Pos(word.line, forward ? (word.to - 1) : word.from); + } + var shortCircuit = words.length != repeat; + var firstWord = words[0]; + var lastWord = words.pop(); + if (forward && !wordEnd) { + if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { + lastWord = words.pop(); + } + return Pos(lastWord.line, lastWord.from); + } else if (forward && wordEnd) { + return Pos(lastWord.line, lastWord.to - 1); + } else if (!forward && wordEnd) { + if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { + lastWord = words.pop(); + } + return Pos(lastWord.line, lastWord.to); + } else { + return Pos(lastWord.line, lastWord.from); + } + } + + function moveToCharacter(cm, repeat, forward, character) { + var cur = cm.getCursor(); + var start = cur.ch; + var idx; + for (var i = 0; i < repeat; i ++) { + var line = cm.getLine(cur.line); + idx = charIdxInLine(start, line, character, forward, true); + if (idx == -1) { + return null; + } + start = idx; + } + return Pos(cm.getCursor().line, idx); + } + + function moveToColumn(cm, repeat) { + var line = cm.getCursor().line; + return clipCursorToContent(cm, Pos(line, repeat - 1)); + } + + function updateMark(cm, vim, markName, pos) { + if (!inArray(markName, validMarks)) { + return; + } + if (vim.marks[markName]) { + vim.marks[markName].clear(); + } + vim.marks[markName] = cm.setBookmark(pos); + } + + function charIdxInLine(start, line, character, forward, includeChar) { + var idx; + if (forward) { + idx = line.indexOf(character, start + 1); + if (idx != -1 && !includeChar) { + idx -= 1; + } + } else { + idx = line.lastIndexOf(character, start - 1); + if (idx != -1 && !includeChar) { + idx += 1; + } + } + return idx; + } + + function findParagraph(cm, head, repeat, dir, inclusive) { + var line = head.line; + var min = cm.firstLine(); + var max = cm.lastLine(); + var start, end, i = line; + function isEmpty(i) { return !/\S/.test(cm.getLine(i)); } // ace_patch + function isBoundary(i, dir, any) { + if (any) { return isEmpty(i) != isEmpty(i + dir); } + return !isEmpty(i) && isEmpty(i + dir); + } + function skipFold(i) { + dir = dir > 0 ? 1 : -1; + var foldLine = cm.ace.session.getFoldLine(i); + if (foldLine) { + if (i + dir > foldLine.start.row && i + dir < foldLine.end.row) + dir = (dir > 0 ? foldLine.end.row : foldLine.start.row) - i; + } + } + if (dir) { + while (min <= i && i <= max && repeat > 0) { + skipFold(i); + if (isBoundary(i, dir)) { repeat--; } + i += dir; + } + return new Pos(i, 0); + } + + var vim = cm.state.vim; + if (vim.visualLine && isBoundary(line, 1, true)) { + var anchor = vim.sel.anchor; + if (isBoundary(anchor.line, -1, true)) { + if (!inclusive || anchor.line != line) { + line += 1; + } + } + } + var startState = isEmpty(line); + for (i = line; i <= max && repeat; i++) { + if (isBoundary(i, 1, true)) { + if (!inclusive || isEmpty(i) != startState) { + repeat--; + } + } + } + end = new Pos(i, 0); + if (i > max && !startState) { startState = true; } + else { inclusive = false; } + for (i = line; i > min; i--) { + if (!inclusive || isEmpty(i) == startState || i == line) { + if (isBoundary(i, -1, true)) { break; } + } + } + start = new Pos(i, 0); + return { start: start, end: end }; + } + function selectCompanionObject(cm, head, symb, inclusive) { + var cur = head, start, end; + + var bracketRegexp = ({ + '(': /[()]/, ')': /[()]/, + '[': /[[\]]/, ']': /[[\]]/, + '{': /[{}]/, '}': /[{}]/})[symb]; + var openSym = ({ + '(': '(', ')': '(', + '[': '[', ']': '[', + '{': '{', '}': '{'})[symb]; + var curChar = cm.getLine(cur.line).charAt(cur.ch); + var offset = curChar === openSym ? 1 : 0; + + start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp}); + + if (!start || !end) { + return { start: cur, end: cur }; + } + + start = start.pos; + end = end.pos; + + if ((start.line == end.line && start.ch > end.ch) + || (start.line > end.line)) { + var tmp = start; + start = end; + end = tmp; + } + + if (inclusive) { + end.ch += 1; + } else { + start.ch += 1; + } + + return { start: start, end: end }; + } + function findBeginningAndEnd(cm, head, symb, inclusive) { + var cur = copyCursor(head); + var line = cm.getLine(cur.line); + var chars = line.split(''); + var start, end, i, len; + var firstIndex = chars.indexOf(symb); + if (cur.ch < firstIndex) { + cur.ch = firstIndex; + } + else if (firstIndex < cur.ch && chars[cur.ch] == symb) { + end = cur.ch; // assign end to the current cursor + --cur.ch; // make sure to look backwards + } + if (chars[cur.ch] == symb && !end) { + start = cur.ch + 1; // assign start to ahead of the cursor + } else { + for (i = cur.ch; i > -1 && !start; i--) { + if (chars[i] == symb) { + start = i + 1; + } + } + } + if (start && !end) { + for (i = start, len = chars.length; i < len && !end; i++) { + if (chars[i] == symb) { + end = i; + } + } + } + if (!start || !end) { + return { start: cur, end: cur }; + } + if (inclusive) { + --start; ++end; + } + + return { + start: Pos(cur.line, start), + end: Pos(cur.line, end) + }; + } + defineOption('pcre', true, 'boolean'); + function SearchState() {} + SearchState.prototype = { + getQuery: function() { + return vimGlobalState.query; + }, + setQuery: function(query) { + vimGlobalState.query = query; + }, + getOverlay: function() { + return this.searchOverlay; + }, + setOverlay: function(overlay) { + this.searchOverlay = overlay; + }, + isReversed: function() { + return vimGlobalState.isReversed; + }, + setReversed: function(reversed) { + vimGlobalState.isReversed = reversed; + }, + getScrollbarAnnotate: function() { + return this.annotate; + }, + setScrollbarAnnotate: function(annotate) { + this.annotate = annotate; + } + }; + function getSearchState(cm) { + var vim = cm.state.vim; + return vim.searchState_ || (vim.searchState_ = new SearchState()); + } + function dialog(cm, template, shortText, onClose, options) { + if (cm.openDialog) { + cm.openDialog(template, onClose, { bottom: true, value: options.value, + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + selectValueOnOpen: false}); + } + else { + onClose(prompt(shortText, '')); + } + } + function splitBySlash(argString) { + var slashes = findUnescapedSlashes(argString) || []; + if (!slashes.length) return []; + var tokens = []; + if (slashes[0] !== 0) return; + for (var i = 0; i < slashes.length; i++) { + if (typeof slashes[i] == 'number') + tokens.push(argString.substring(slashes[i] + 1, slashes[i+1])); + } + return tokens; + } + + function findUnescapedSlashes(str) { + var escapeNextChar = false; + var slashes = []; + for (var i = 0; i < str.length; i++) { + var c = str.charAt(i); + if (!escapeNextChar && c == '/') { + slashes.push(i); + } + escapeNextChar = !escapeNextChar && (c == '\\'); + } + return slashes; + } + function translateRegex(str) { + var specials = '|(){'; + var unescape = '}'; + var escapeNextChar = false; + var out = []; + for (var i = -1; i < str.length; i++) { + var c = str.charAt(i) || ''; + var n = str.charAt(i+1) || ''; + var specialComesNext = (n && specials.indexOf(n) != -1); + if (escapeNextChar) { + if (c !== '\\' || !specialComesNext) { + out.push(c); + } + escapeNextChar = false; + } else { + if (c === '\\') { + escapeNextChar = true; + if (n && unescape.indexOf(n) != -1) { + specialComesNext = true; + } + if (!specialComesNext || n === '\\') { + out.push(c); + } + } else { + out.push(c); + if (specialComesNext && n !== '\\') { + out.push('\\'); + } + } + } + } + return out.join(''); + } + var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'}; + function translateRegexReplace(str) { + var escapeNextChar = false; + var out = []; + for (var i = -1; i < str.length; i++) { + var c = str.charAt(i) || ''; + var n = str.charAt(i+1) || ''; + if (charUnescapes[c + n]) { + out.push(charUnescapes[c+n]); + i++; + } else if (escapeNextChar) { + out.push(c); + escapeNextChar = false; + } else { + if (c === '\\') { + escapeNextChar = true; + if ((isNumber(n) || n === '$')) { + out.push('$'); + } else if (n !== '/' && n !== '\\') { + out.push('\\'); + } + } else { + if (c === '$') { + out.push('$'); + } + out.push(c); + if (n === '/') { + out.push('\\'); + } + } + } + } + return out.join(''); + } + var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; + function unescapeRegexReplace(str) { + var stream = new CodeMirror.StringStream(str); + var output = []; + while (!stream.eol()) { + while (stream.peek() && stream.peek() != '\\') { + output.push(stream.next()); + } + var matched = false; + for (var matcher in unescapes) { + if (stream.match(matcher, true)) { + matched = true; + output.push(unescapes[matcher]); + break; + } + } + if (!matched) { + output.push(stream.next()); + } + } + return output.join(''); + } + function parseQuery(query, ignoreCase, smartCase) { + var lastSearchRegister = vimGlobalState.registerController.getRegister('/'); + lastSearchRegister.setText(query); + if (query instanceof RegExp) { return query; } + var slashes = findUnescapedSlashes(query); + var regexPart; + var forceIgnoreCase; + if (!slashes.length) { + regexPart = query; + } else { + regexPart = query.substring(0, slashes[0]); + var flagsPart = query.substring(slashes[0]); + forceIgnoreCase = (flagsPart.indexOf('i') != -1); + } + if (!regexPart) { + return null; + } + if (!getOption('pcre')) { + regexPart = translateRegex(regexPart); + } + if (smartCase) { + ignoreCase = (/^[^A-Z]*$/).test(regexPart); + } + var regexp = new RegExp(regexPart, + (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + return regexp; + } + function showConfirm(cm, text) { + if (cm.openNotification) { + cm.openNotification('' + text + '', + {bottom: true, duration: 5000}); + } else { + alert(text); + } + } + function makePrompt(prefix, desc) { + var raw = ''; + if (prefix) { + raw += '' + prefix + ''; + } + raw += ' ' + + ''; + if (desc) { + raw += ''; + raw += desc; + raw += ''; + } + return raw; + } + var searchPromptDesc = '(Javascript regexp)'; + function showPrompt(cm, options) { + var shortText = (options.prefix || '') + ' ' + (options.desc || ''); + var prompt = makePrompt(options.prefix, options.desc); + dialog(cm, prompt, shortText, options.onClose, options); + } + function regexEqual(r1, r2) { + if (r1 instanceof RegExp && r2 instanceof RegExp) { + var props = ['global', 'multiline', 'ignoreCase', 'source']; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (r1[prop] !== r2[prop]) { + return false; + } + } + return true; + } + return false; + } + function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) { + if (!rawQuery) { + return; + } + var state = getSearchState(cm); + var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase); + if (!query) { + return; + } + highlightSearchMatches(cm, query); + if (regexEqual(query, state.getQuery())) { + return query; + } + state.setQuery(query); + return query; + } + function searchOverlay(query) { + if (query.source.charAt(0) == '^') { + var matchSol = true; + } + return { + token: function(stream) { + if (matchSol && !stream.sol()) { + stream.skipToEnd(); + return; + } + var match = stream.match(query, false); + if (match) { + if (match[0].length == 0) { + stream.next(); + return 'searching'; + } + if (!stream.sol()) { + stream.backUp(1); + if (!query.exec(stream.next() + match[0])) { + stream.next(); + return null; + } + } + stream.match(query); + return 'searching'; + } + while (!stream.eol()) { + stream.next(); + if (stream.match(query, false)) break; + } + }, + query: query + }; + } + function highlightSearchMatches(cm, query) { + var searchState = getSearchState(cm); + var overlay = searchState.getOverlay(); + if (!overlay || query != overlay.query) { + if (overlay) { + cm.removeOverlay(overlay); + } + overlay = searchOverlay(query); + cm.addOverlay(overlay); + if (cm.showMatchesOnScrollbar) { + if (searchState.getScrollbarAnnotate()) { + searchState.getScrollbarAnnotate().clear(); + } + searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query)); + } + searchState.setOverlay(overlay); + } + } + function findNext(cm, prev, query, repeat) { + if (repeat === undefined) { repeat = 1; } + return cm.operation(function() { + var pos = cm.getCursor(); + var cursor = cm.getSearchCursor(query, pos); + for (var i = 0; i < repeat; i++) { + var found = cursor.find(prev); + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (!found) { + cursor = cm.getSearchCursor(query, + (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + if (!cursor.find(prev)) { + return; + } + } + } + return cursor.from(); + }); + } + function clearSearchHighlight(cm) { + var state = getSearchState(cm); + cm.removeOverlay(getSearchState(cm).getOverlay()); + state.setOverlay(null); + if (state.getScrollbarAnnotate()) { + state.getScrollbarAnnotate().clear(); + state.setScrollbarAnnotate(null); + } + } + function isInRange(pos, start, end) { + if (typeof pos != 'number') { + pos = pos.line; + } + if (start instanceof Array) { + return inArray(pos, start); + } else { + if (end) { + return (pos >= start && pos <= end); + } else { + return pos == start; + } + } + } + function getUserVisibleLines(cm) { + var renderer = cm.ace.renderer; + return { + top: renderer.getFirstFullyVisibleRow(), + bottom: renderer.getLastFullyVisibleRow() + } + } + + var ExCommandDispatcher = function() { + this.buildCommandMap_(); + }; + ExCommandDispatcher.prototype = { + processCommand: function(cm, input, opt_params) { + var that = this; + cm.operation(function () { + cm.curOp.isVimOp = true; + that._processCommand(cm, input, opt_params); + }); + }, + _processCommand: function(cm, input, opt_params) { + var vim = cm.state.vim; + var commandHistoryRegister = vimGlobalState.registerController.getRegister(':'); + var previousCommand = commandHistoryRegister.toString(); + if (vim.visualMode) { + exitVisualMode(cm); + } + var inputStream = new CodeMirror.StringStream(input); + commandHistoryRegister.setText(input); + var params = opt_params || {}; + params.input = input; + try { + this.parseInput_(cm, inputStream, params); + } catch(e) { + showConfirm(cm, e); + throw e; + } + var command; + var commandName; + if (!params.commandName) { + if (params.line !== undefined) { + commandName = 'move'; + } + } else { + command = this.matchCommand_(params.commandName); + if (command) { + commandName = command.name; + if (command.excludeFromCommandHistory) { + commandHistoryRegister.setText(previousCommand); + } + this.parseCommandArgs_(inputStream, params, command); + if (command.type == 'exToKey') { + for (var i = 0; i < command.toKeys.length; i++) { + CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + } + return; + } else if (command.type == 'exToEx') { + this.processCommand(cm, command.toInput); + return; + } + } + } + if (!commandName) { + showConfirm(cm, 'Not an editor command ":' + input + '"'); + return; + } + try { + exCommands[commandName](cm, params); + if ((!command || !command.possiblyAsync) && params.callback) { + params.callback(); + } + } catch(e) { + showConfirm(cm, e); + throw e; + } + }, + parseInput_: function(cm, inputStream, result) { + inputStream.eatWhile(':'); + if (inputStream.eat('%')) { + result.line = cm.firstLine(); + result.lineEnd = cm.lastLine(); + } else { + result.line = this.parseLineSpec_(cm, inputStream); + if (result.line !== undefined && inputStream.eat(',')) { + result.lineEnd = this.parseLineSpec_(cm, inputStream); + } + } + var commandMatch = inputStream.match(/^(\w+)/); + if (commandMatch) { + result.commandName = commandMatch[1]; + } else { + result.commandName = inputStream.match(/.*/)[0]; + } + + return result; + }, + parseLineSpec_: function(cm, inputStream) { + var numberMatch = inputStream.match(/^(\d+)/); + if (numberMatch) { + return parseInt(numberMatch[1], 10) - 1; + } + switch (inputStream.next()) { + case '.': + return cm.getCursor().line; + case '$': + return cm.lastLine(); + case '\'': + var mark = cm.state.vim.marks[inputStream.next()]; + if (mark && mark.find()) { + return mark.find().line; + } + throw new Error('Mark not set'); + default: + inputStream.backUp(1); + return undefined; + } + }, + parseCommandArgs_: function(inputStream, params, command) { + if (inputStream.eol()) { + return; + } + params.argString = inputStream.match(/.*/)[0]; + var delim = command.argDelimiter || /\s+/; + var args = trim(params.argString).split(delim); + if (args.length && args[0]) { + params.args = args; + } + }, + matchCommand_: function(commandName) { + for (var i = commandName.length; i > 0; i--) { + var prefix = commandName.substring(0, i); + if (this.commandMap_[prefix]) { + var command = this.commandMap_[prefix]; + if (command.name.indexOf(commandName) === 0) { + return command; + } + } + } + return null; + }, + buildCommandMap_: function() { + this.commandMap_ = {}; + for (var i = 0; i < defaultExCommandMap.length; i++) { + var command = defaultExCommandMap[i]; + var key = command.shortName || command.name; + this.commandMap_[key] = command; + } + }, + map: function(lhs, rhs, ctx) { + if (lhs != ':' && lhs.charAt(0) == ':') { + if (ctx) { throw Error('Mode not supported for ex mappings'); } + var commandName = lhs.substring(1); + if (rhs != ':' && rhs.charAt(0) == ':') { + this.commandMap_[commandName] = { + name: commandName, + type: 'exToEx', + toInput: rhs.substring(1), + user: true + }; + } else { + this.commandMap_[commandName] = { + name: commandName, + type: 'exToKey', + toKeys: rhs, + user: true + }; + } + } else { + if (rhs != ':' && rhs.charAt(0) == ':') { + var mapping = { + keys: lhs, + type: 'keyToEx', + exArgs: { input: rhs.substring(1) }, + user: true}; + if (ctx) { mapping.context = ctx; } + defaultKeymap.unshift(mapping); + } else { + var mapping = { + keys: lhs, + type: 'keyToKey', + toKeys: rhs, + user: true + }; + if (ctx) { mapping.context = ctx; } + defaultKeymap.unshift(mapping); + } + } + }, + unmap: function(lhs, ctx) { + if (lhs != ':' && lhs.charAt(0) == ':') { + if (ctx) { throw Error('Mode not supported for ex mappings'); } + var commandName = lhs.substring(1); + if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { + delete this.commandMap_[commandName]; + return; + } + } else { + var keys = lhs; + for (var i = 0; i < defaultKeymap.length; i++) { + if (keys == defaultKeymap[i].keys + && defaultKeymap[i].context === ctx + && defaultKeymap[i].user) { + defaultKeymap.splice(i, 1); + return; + } + } + } + } + }; + + var exCommands = { + colorscheme: function(cm, params) { + if (!params.args || params.args.length < 1) { + showConfirm(cm, cm.getOption('theme')); + return; + } + cm.setOption('theme', params.args[0]); + }, + map: function(cm, params, ctx) { + var mapArgs = params.args; + if (!mapArgs || mapArgs.length < 2) { + if (cm) { + showConfirm(cm, 'Invalid mapping: ' + params.input); + } + return; + } + exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx); + }, + imap: function(cm, params) { this.map(cm, params, 'insert'); }, + nmap: function(cm, params) { this.map(cm, params, 'normal'); }, + vmap: function(cm, params) { this.map(cm, params, 'visual'); }, + unmap: function(cm, params, ctx) { + var mapArgs = params.args; + if (!mapArgs || mapArgs.length < 1) { + if (cm) { + showConfirm(cm, 'No such mapping: ' + params.input); + } + return; + } + exCommandDispatcher.unmap(mapArgs[0], ctx); + }, + move: function(cm, params) { + commandDispatcher.processCommand(cm, cm.state.vim, { + type: 'motion', + motion: 'moveToLineOrEdgeOfDocument', + motionArgs: { forward: false, explicitRepeat: true, + linewise: true }, + repeatOverride: params.line+1}); + }, + set: function(cm, params) { + var setArgs = params.args; + var setCfg = params.setCfg || {}; + if (!setArgs || setArgs.length < 1) { + if (cm) { + showConfirm(cm, 'Invalid mapping: ' + params.input); + } + return; + } + var expr = setArgs[0].split('='); + var optionName = expr[0]; + var value = expr[1]; + var forceGet = false; + + if (optionName.charAt(optionName.length - 1) == '?') { + if (value) { throw Error('Trailing characters: ' + params.argString); } + optionName = optionName.substring(0, optionName.length - 1); + forceGet = true; + } + if (value === undefined && optionName.substring(0, 2) == 'no') { + optionName = optionName.substring(2); + value = false; + } + + var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean'; + if (optionIsBoolean && value == undefined) { + value = true; + } + if (!optionIsBoolean && value === undefined || forceGet) { + var oldValue = getOption(optionName, cm, setCfg); + if (oldValue === true || oldValue === false) { + showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); + } else { + showConfirm(cm, ' ' + optionName + '=' + oldValue); + } + } else { + setOption(optionName, value, cm, setCfg); + } + }, + setlocal: function (cm, params) { + params.setCfg = {scope: 'local'}; + this.set(cm, params); + }, + setglobal: function (cm, params) { + params.setCfg = {scope: 'global'}; + this.set(cm, params); + }, + registers: function(cm, params) { + var regArgs = params.args; + var registers = vimGlobalState.registerController.registers; + var regInfo = '----------Registers----------

'; + if (!regArgs) { + for (var registerName in registers) { + var text = registers[registerName].toString(); + if (text.length) { + regInfo += '"' + registerName + ' ' + text + '
'; + } + } + } else { + var registerName; + regArgs = regArgs.join(''); + for (var i = 0; i < regArgs.length; i++) { + registerName = regArgs.charAt(i); + if (!vimGlobalState.registerController.isValidRegister(registerName)) { + continue; + } + var register = registers[registerName] || new Register(); + regInfo += '"' + registerName + ' ' + register.toString() + '
'; + } + } + showConfirm(cm, regInfo); + }, + sort: function(cm, params) { + var reverse, ignoreCase, unique, number; + function parseArgs() { + if (params.argString) { + var args = new CodeMirror.StringStream(params.argString); + if (args.eat('!')) { reverse = true; } + if (args.eol()) { return; } + if (!args.eatSpace()) { return 'Invalid arguments'; } + var opts = args.match(/[a-z]+/); + if (opts) { + opts = opts[0]; + ignoreCase = opts.indexOf('i') != -1; + unique = opts.indexOf('u') != -1; + var decimal = opts.indexOf('d') != -1 && 1; + var hex = opts.indexOf('x') != -1 && 1; + var octal = opts.indexOf('o') != -1 && 1; + if (decimal + hex + octal > 1) { return 'Invalid arguments'; } + number = decimal && 'decimal' || hex && 'hex' || octal && 'octal'; + } + if (args.match(/\/.*\//)) { return 'patterns not supported'; } + } + } + var err = parseArgs(); + if (err) { + showConfirm(cm, err + ': ' + params.argString); + return; + } + var lineStart = params.line || cm.firstLine(); + var lineEnd = params.lineEnd || params.line || cm.lastLine(); + if (lineStart == lineEnd) { return; } + var curStart = Pos(lineStart, 0); + var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var text = cm.getRange(curStart, curEnd).split('\n'); + var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ : + (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i : + (number == 'octal') ? /([0-7]+)/ : null; + var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null; + var numPart = [], textPart = []; + if (number) { + for (var i = 0; i < text.length; i++) { + if (numberRegex.exec(text[i])) { + numPart.push(text[i]); + } else { + textPart.push(text[i]); + } + } + } else { + textPart = text; + } + function compareFn(a, b) { + if (reverse) { var tmp; tmp = a; a = b; b = tmp; } + if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); } + var anum = number && numberRegex.exec(a); + var bnum = number && numberRegex.exec(b); + if (!anum) { return a < b ? -1 : 1; } + anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix); + bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix); + return anum - bnum; + } + numPart.sort(compareFn); + textPart.sort(compareFn); + text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart); + if (unique) { // Remove duplicate lines + var textOld = text; + var lastLine; + text = []; + for (var i = 0; i < textOld.length; i++) { + if (textOld[i] != lastLine) { + text.push(textOld[i]); + } + lastLine = textOld[i]; + } + } + cm.replaceRange(text.join('\n'), curStart, curEnd); + }, + global: function(cm, params) { + var argString = params.argString; + if (!argString) { + showConfirm(cm, 'Regular Expression missing from global'); + return; + } + var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); + var lineEnd = params.lineEnd || params.line || cm.lastLine(); + var tokens = splitBySlash(argString); + var regexPart = argString, cmd; + if (tokens.length) { + regexPart = tokens[0]; + cmd = tokens.slice(1, tokens.length).join('/'); + } + if (regexPart) { + try { + updateSearchQuery(cm, regexPart, true /** ignoreCase */, + true /** smartCase */); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + regexPart); + return; + } + } + var query = getSearchState(cm).getQuery(); + var matchedLines = [], content = ''; + for (var i = lineStart; i <= lineEnd; i++) { + var matched = query.test(cm.getLine(i)); + if (matched) { + matchedLines.push(i+1); + content+= cm.getLine(i) + '
'; + } + } + if (!cmd) { + showConfirm(cm, content); + return; + } + var index = 0; + var nextCommand = function() { + if (index < matchedLines.length) { + var command = matchedLines[index] + cmd; + exCommandDispatcher.processCommand(cm, command, { + callback: nextCommand + }); + } + index++; + }; + nextCommand(); + }, + substitute: function(cm, params) { + if (!cm.getSearchCursor) { + throw new Error('Search feature not available. Requires searchcursor.js or ' + + 'any other getSearchCursor implementation.'); + } + var argString = params.argString; + var tokens = argString ? splitBySlash(argString) : []; + var regexPart, replacePart = '', trailing, flagsPart, count; + var confirm = false; // Whether to confirm each replace. + var global = false; // True to replace all instances on a line, false to replace only 1. + if (tokens.length) { + regexPart = tokens[0]; + replacePart = tokens[1]; + if (replacePart !== undefined) { + if (getOption('pcre')) { + replacePart = unescapeRegexReplace(replacePart); + } else { + replacePart = translateRegexReplace(replacePart); + } + vimGlobalState.lastSubstituteReplacePart = replacePart; + } + trailing = tokens[2] ? tokens[2].split(' ') : []; + } else { + if (argString && argString.length) { + showConfirm(cm, 'Substitutions should be of the form ' + + ':s/pattern/replace/'); + return; + } + } + if (trailing) { + flagsPart = trailing[0]; + count = parseInt(trailing[1]); + if (flagsPart) { + if (flagsPart.indexOf('c') != -1) { + confirm = true; + flagsPart.replace('c', ''); + } + if (flagsPart.indexOf('g') != -1) { + global = true; + flagsPart.replace('g', ''); + } + regexPart = regexPart + '/' + flagsPart; + } + } + if (regexPart) { + try { + updateSearchQuery(cm, regexPart, true /** ignoreCase */, + true /** smartCase */); + } catch (e) { + showConfirm(cm, 'Invalid regex: ' + regexPart); + return; + } + } + replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart; + if (replacePart === undefined) { + showConfirm(cm, 'No previous substitute regular expression'); + return; + } + var state = getSearchState(cm); + var query = state.getQuery(); + var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line; + var lineEnd = params.lineEnd || lineStart; + if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) { + lineEnd = Infinity; + } + if (count) { + lineStart = lineEnd; + lineEnd = lineStart + count - 1; + } + var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var cursor = cm.getSearchCursor(query, startPos); + doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); + }, + redo: CodeMirror.commands.redo, + undo: CodeMirror.commands.undo, + write: function(cm) { + if (CodeMirror.commands.save) { + CodeMirror.commands.save(cm); + } else { + cm.save(); + } + }, + nohlsearch: function(cm) { + clearSearchHighlight(cm); + }, + delmarks: function(cm, params) { + if (!params.argString || !trim(params.argString)) { + showConfirm(cm, 'Argument acequired'); + return; + } + + var state = cm.state.vim; + var stream = new CodeMirror.StringStream(trim(params.argString)); + while (!stream.eol()) { + stream.eatSpace(); + var count = stream.pos; + + if (!stream.match(/[a-zA-Z]/, false)) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + + var sym = stream.next(); + if (stream.match('-', true)) { + if (!stream.match(/[a-zA-Z]/, false)) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + + var startMark = sym; + var finishMark = stream.next(); + if (isLowerCase(startMark) && isLowerCase(finishMark) || + isUpperCase(startMark) && isUpperCase(finishMark)) { + var start = startMark.charCodeAt(0); + var finish = finishMark.charCodeAt(0); + if (start >= finish) { + showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); + return; + } + for (var j = 0; j <= finish - start; j++) { + var mark = String.fromCharCode(start + j); + delete state.marks[mark]; + } + } else { + showConfirm(cm, 'Invalid argument: ' + startMark + '-'); + return; + } + } else { + delete state.marks[sym]; + } + } + } + }; + + var exCommandDispatcher = new ExCommandDispatcher(); + function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, + replaceWith, callback) { + cm.state.vim.exMode = true; + var done = false; + var lastPos = searchCursor.from(); + function replaceAll() { + cm.operation(function() { + while (!done) { + replace(); + next(); + } + stop(); + }); + } + function replace() { + var text = cm.getRange(searchCursor.from(), searchCursor.to()); + var newText = text.replace(query, replaceWith); + searchCursor.replace(newText); + } + function next() { + while(searchCursor.findNext() && + isInRange(searchCursor.from(), lineStart, lineEnd)) { + if (!global && lastPos && searchCursor.from().line == lastPos.line) { + continue; + } + cm.scrollIntoView(searchCursor.from(), 30); + cm.setSelection(searchCursor.from(), searchCursor.to()); + lastPos = searchCursor.from(); + done = false; + return; + } + done = true; + } + function stop(close) { + if (close) { close(); } + cm.focus(); + if (lastPos) { + cm.setCursor(lastPos); + var vim = cm.state.vim; + vim.exMode = false; + vim.lastHPos = vim.lastHSPos = lastPos.ch; + } + if (callback) { callback(); } + } + function onPromptKeyDown(e, _value, close) { + CodeMirror.e_stop(e); + var keyName = CodeMirror.keyName(e); + switch (keyName) { + case 'Y': + replace(); next(); break; + case 'N': + next(); break; + case 'A': + var savedCallback = callback; + callback = undefined; + cm.operation(replaceAll); + callback = savedCallback; + break; + case 'L': + replace(); + case 'Q': + case 'Esc': + case 'Ctrl-C': + case 'Ctrl-[': + stop(close); + break; + } + if (done) { stop(close); } + return true; + } + next(); + if (done) { + showConfirm(cm, 'No matches for ' + query.source); + return; + } + if (!confirm) { + replaceAll(); + if (callback) { callback(); } + return; + } + showPrompt(cm, { + prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', + onKeyDown: onPromptKeyDown + }); + } + + CodeMirror.keyMap.vim = { + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + function exitInsertMode(cm) { + var vim = cm.state.vim; + var macroModeState = vimGlobalState.macroModeState; + var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.'); + var isPlaying = macroModeState.isPlaying; + var lastChange = macroModeState.lastInsertModeChanges; + var text = []; + if (!isPlaying) { + var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1; + var changes = lastChange.changes; + var text = []; + var i = 0; + while (i < changes.length) { + text.push(changes[i]); + if (changes[i] instanceof InsertModeKey) { + i++; + } else { + i+= selLength; + } + } + lastChange.changes = text; + cm.off('change', onChange); + CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); + } + if (!isPlaying && vim.insertModeRepeat > 1) { + repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, + true /** repeatForInsert */); + vim.lastEditInputState.repeatOverride = vim.insertModeRepeat; + } + delete vim.insertModeRepeat; + vim.insertMode = false; + cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1); + cm.setOption('keyMap', 'vim'); + cm.setOption('disableInput', true); + cm.toggleOverwrite(false); // exit replace mode if we were in it. + insertModeChangeRegister.setText(lastChange.changes.join('')); + CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); + if (macroModeState.isRecording) { + logInsertModeChange(macroModeState); + } + } + + function _mapCommand(command) { + defaultKeymap.unshift(command); + } + + function mapCommand(keys, type, name, args, extra) { + var command = {keys: keys, type: type}; + command[type] = name; + command[type + "Args"] = args; + for (var key in extra) + command[key] = extra[key]; + _mapCommand(command); + } + defineOption('insertModeEscKeysTimeout', 200, 'number'); + + CodeMirror.keyMap['vim-insert'] = { + 'Ctrl-N': 'autocomplete', + 'Ctrl-P': 'autocomplete', + 'Enter': function(cm) { + var fn = CodeMirror.commands.newlineAndIndentContinueComment || + CodeMirror.commands.newlineAndIndent; + fn(cm); + }, + fallthrough: ['default'], + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + CodeMirror.keyMap['vim-replace'] = { + 'Backspace': 'goCharLeft', + fallthrough: ['vim-insert'], + attach: attachVimMap, + detach: detachVimMap, + call: cmKey + }; + + function executeMacroRegister(cm, vim, macroModeState, registerName) { + var register = vimGlobalState.registerController.getRegister(registerName); + if (registerName == ':') { + if (register.keyBuffer[0]) { + exCommandDispatcher.processCommand(cm, register.keyBuffer[0]); + } + macroModeState.isPlaying = false; + return; + } + var keyBuffer = register.keyBuffer; + var imc = 0; + macroModeState.isPlaying = true; + macroModeState.replaySearchQueries = register.searchQueries.slice(0); + for (var i = 0; i < keyBuffer.length; i++) { + var text = keyBuffer[i]; + var match, key; + while (text) { + match = (/<\w+-.+?>|<\w+>|./).exec(text); + key = match[0]; + text = text.substring(match.index + key.length); + CodeMirror.Vim.handleKey(cm, key, 'macro'); + if (vim.insertMode) { + var changes = register.insertModeChanges[imc++].changes; + vimGlobalState.macroModeState.lastInsertModeChanges.changes = + changes; + repeatInsertModeChanges(cm, changes, 1); + exitInsertMode(cm); + } + } + } + macroModeState.isPlaying = false; + } + + function logKey(macroModeState, key) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register) { + register.pushText(key); + } + } + + function logInsertModeChange(macroModeState) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register && register.pushInsertModeChanges) { + register.pushInsertModeChanges(macroModeState.lastInsertModeChanges); + } + } + + function logSearchQuery(macroModeState, query) { + if (macroModeState.isPlaying) { return; } + var registerName = macroModeState.latestRegister; + var register = vimGlobalState.registerController.getRegister(registerName); + if (register && register.pushSearchQuery) { + register.pushSearchQuery(query); + } + } + function onChange(_cm, changeObj) { + var macroModeState = vimGlobalState.macroModeState; + var lastChange = macroModeState.lastInsertModeChanges; + if (!macroModeState.isPlaying) { + while(changeObj) { + lastChange.expectCursorActivityForChange = true; + if (changeObj.origin == '+input' || changeObj.origin == 'paste' + || changeObj.origin === undefined /* only in testing */) { + var text = changeObj.text.join('\n'); + if (lastChange.maybeReset) { + lastChange.changes = []; + lastChange.maybeReset = false; + } + lastChange.changes.push(text); + } + changeObj = changeObj.next; + } + } + } + function onCursorActivity(cm) { + var vim = cm.state.vim; + if (vim.insertMode) { + var macroModeState = vimGlobalState.macroModeState; + if (macroModeState.isPlaying) { return; } + var lastChange = macroModeState.lastInsertModeChanges; + if (lastChange.expectCursorActivityForChange) { + lastChange.expectCursorActivityForChange = false; + } else { + lastChange.maybeReset = true; + } + } else if (!cm.curOp.isVimOp) { + handleExternalSelection(cm, vim); + } + if (vim.visualMode) { + updateFakeCursor(cm); + } + } + function updateFakeCursor(cm) { + var vim = cm.state.vim; + var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); + var to = offsetCursor(from, 0, 1); + if (vim.fakeCursor) { + vim.fakeCursor.clear(); + } + vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); + } + function handleExternalSelection(cm, vim) { + var anchor = cm.getCursor('anchor'); + var head = cm.getCursor('head'); + if (vim.visualMode && !cm.somethingSelected()) { + exitVisualMode(cm, false); + } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) { + vim.visualMode = true; + vim.visualLine = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"}); + } + if (vim.visualMode) { + var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; + var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; + head = offsetCursor(head, 0, headOffset); + anchor = offsetCursor(anchor, 0, anchorOffset); + vim.sel = { + anchor: anchor, + head: head + }; + updateMark(cm, vim, '<', cursorMin(head, anchor)); + updateMark(cm, vim, '>', cursorMax(head, anchor)); + } else if (!vim.insertMode) { + vim.lastHPos = cm.getCursor().ch; + } + } + function InsertModeKey(keyName) { + this.keyName = keyName; + } + function onKeyEventTargetKeyDown(e) { + var macroModeState = vimGlobalState.macroModeState; + var lastChange = macroModeState.lastInsertModeChanges; + var keyName = CodeMirror.keyName(e); + if (!keyName) { return; } + function onKeyFound() { + if (lastChange.maybeReset) { + lastChange.changes = []; + lastChange.maybeReset = false; + } + lastChange.changes.push(new InsertModeKey(keyName)); + return true; + } + if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) { + CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound); + } + } + function repeatLastEdit(cm, vim, repeat, repeatForInsert) { + var macroModeState = vimGlobalState.macroModeState; + macroModeState.isPlaying = true; + var isAction = !!vim.lastEditActionCommand; + var cachedInputState = vim.inputState; + function repeatCommand() { + if (isAction) { + commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand); + } else { + commandDispatcher.evalInput(cm, vim); + } + } + function repeatInsert(repeat) { + if (macroModeState.lastInsertModeChanges.changes.length > 0) { + repeat = !vim.lastEditActionCommand ? 1 : repeat; + var changeObject = macroModeState.lastInsertModeChanges; + repeatInsertModeChanges(cm, changeObject.changes, repeat); + } + } + vim.inputState = vim.lastEditInputState; + if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) { + for (var i = 0; i < repeat; i++) { + repeatCommand(); + repeatInsert(1); + } + } else { + if (!repeatForInsert) { + repeatCommand(); + } + repeatInsert(repeat); + } + vim.inputState = cachedInputState; + if (vim.insertMode && !repeatForInsert) { + exitInsertMode(cm); + } + macroModeState.isPlaying = false; + } + + function repeatInsertModeChanges(cm, changes, repeat) { + function keyHandler(binding) { + if (typeof binding == 'string') { + CodeMirror.commands[binding](cm); + } else { + binding(cm); + } + return true; + } + var head = cm.getCursor('head'); + var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock; + if (inVisualBlock) { + var vim = cm.state.vim; + var lastSel = vim.lastSelection; + var offset = getOffset(lastSel.anchor, lastSel.head); + selectForInsert(cm, head, offset.line + 1); + repeat = cm.listSelections().length; + cm.setCursor(head); + } + for (var i = 0; i < repeat; i++) { + if (inVisualBlock) { + cm.setCursor(offsetCursor(head, i, 0)); + } + for (var j = 0; j < changes.length; j++) { + var change = changes[j]; + if (change instanceof InsertModeKey) { + CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); + } else { + var cur = cm.getCursor(); + cm.replaceRange(change, cur, cur); + } + } + } + if (inVisualBlock) { + cm.setCursor(offsetCursor(head, 0, 1)); + } + } + + resetVimGlobalState(); + CodeMirror.Vim = Vim(); + + Vim = CodeMirror.Vim; + + var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc', + left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space', + home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR' + }; + function lookupKey(hashId, key, e) { + if (key.length > 1 && key[0] == "n") { + key = key.replace("numpad", ""); + } + key = specialKey[key] || key; + var name = ''; + if (e.ctrlKey) { name += 'C-'; } + if (e.altKey) { name += 'A-'; } + if (e.shiftKey) { name += 'S-'; } + + name += key; + if (name.length > 1) { name = '<' + name + '>'; } + return name; + } + var handleKey = Vim.handleKey.bind(Vim); + Vim.handleKey = function(cm, key, origin) { + return cm.operation(function() { + return handleKey(cm, key, origin); + }, true); + } + function cloneVimState(state) { + var n = new state.constructor(); + Object.keys(state).forEach(function(key) { + var o = state[key]; + if (Array.isArray(o)) + o = o.slice(); + else if (o && typeof o == "object" && o.constructor != Object) + o = cloneVimState(o); + n[key] = o; + }); + if (state.sel) { + n.sel = { + head: state.sel.head && copyCursor(state.sel.head), + anchor: state.sel.anchor && copyCursor(state.sel.anchor) + }; + } + return n; + } + function multiSelectHandleKey(cm, key, origin) { + var isHandled = false; + var vim = Vim.maybeInitVimState_(cm); + var visualBlock = vim.visualBlock || vim.wasInVisualBlock; + if (vim.wasInVisualBlock && !cm.ace.inMultiSelectMode) { + vim.wasInVisualBlock = false; + } else if (cm.ace.inMultiSelectMode && vim.visualBlock) { + vim.wasInVisualBlock = true; + } + + if (key == '' && !vim.insertMode && !vim.visualMode && cm.ace.inMultiSelectMode) { + cm.ace.exitMultiSelectMode(); + } else if (visualBlock || !cm.ace.inMultiSelectMode || cm.ace.inVirtualSelectionMode) { + isHandled = Vim.handleKey(cm, key, origin); + } else { + var old = cloneVimState(vim); + cm.operation(function() { + cm.ace.forEachSelection(function() { + var sel = cm.ace.selection; + cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn; + var head = cm.getCursor("head"); + var anchor = cm.getCursor("anchor"); + var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; + var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; + head = offsetCursor(head, 0, headOffset); + anchor = offsetCursor(anchor, 0, anchorOffset); + cm.state.vim.sel.head = head; + cm.state.vim.sel.anchor = anchor; + + isHandled = handleKey(cm, key, origin); + sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos; + if (cm.virtualSelectionMode()) { + cm.state.vim = cloneVimState(old); + } + }); + if (cm.curOp.cursorActivity && !isHandled) + cm.curOp.cursorActivity = false; + }, true); + } + return isHandled; + } + exports.CodeMirror = CodeMirror; + var getVim = Vim.maybeInitVimState_; + exports.handler = { + $id: "ace/keyboard/vim", + drawCursor: function(style, pixelPos, config, sel, session) { + var vim = this.state.vim || {}; + var w = config.characterWidth; + var h = config.lineHeight; + var top = pixelPos.top; + var left = pixelPos.left; + if (!vim.insertMode) { + var isbackwards = !sel.cursor + ? session.selection.isBackwards() || session.selection.isEmpty() + : Range.comparePoints(sel.cursor, sel.start) <= 0; + if (!isbackwards && left > w) + left -= w; + } + if (!vim.insertMode && vim.status) { + h = h / 2; + top += h; + } + style.left = left + "px"; + style.top = top + "px"; + style.width = w + "px"; + style.height = h + "px"; + }, + handleKeyboard: function(data, hashId, key, keyCode, e) { + var editor = data.editor; + var cm = editor.state.cm; + var vim = getVim(cm); + if (keyCode == -1) return; + + if (key == "c" && hashId == 1) { // key == "ctrl-c" + if (!useragent.isMac && editor.getCopyText()) { + editor.once("copy", function() { + editor.selection.clearSelection(); + }); + return {command: "null", passEvent: true}; + } + } else if (!vim.insertMode) { + if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { + hashId = -1; + key = data.inputChar; + } + } + + if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) { + var insertMode = vim.insertMode; + var name = lookupKey(hashId, key, e || {}); + if (vim.status == null) + vim.status = ""; + var isHandled = multiSelectHandleKey(cm, name, 'user'); + vim = getVim(cm); // may be changed by multiSelectHandleKey + if (isHandled && vim.status != null) + vim.status += name; + else if (vim.status == null) + vim.status = ""; + cm._signal("changeStatus"); + if (!isHandled && (hashId != -1 || insertMode)) + return; + return {command: "null", passEvent: !isHandled}; + } + }, + attach: function(editor) { + if (!editor.state) editor.state = {}; + var cm = new CodeMirror(editor); + editor.state.cm = cm; + editor.$vimModeHandler = this; + CodeMirror.keyMap.vim.attach(cm); + getVim(cm).status = null; + cm.on('vim-command-done', function() { + if (cm.virtualSelectionMode()) return; + getVim(cm).status = null; + cm.ace._signal("changeStatus"); + cm.ace.session.markUndoGroup(); + }); + cm.on("changeStatus", function() { + cm.ace.renderer.updateCursor(); + cm.ace._signal("changeStatus"); + }); + cm.on("vim-mode-change", function() { + if (cm.virtualSelectionMode()) return; + cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode); + cm._signal("changeStatus"); + }); + cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode); + editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm); + this.updateMacCompositionHandlers(editor, true); + }, + detach: function(editor) { + var cm = editor.state.cm; + CodeMirror.keyMap.vim.detach(cm); + cm.destroy(); + editor.state.cm = null; + editor.$vimModeHandler = null; + editor.renderer.$cursorLayer.drawCursor = null; + editor.renderer.setStyle("normal-mode", false); + this.updateMacCompositionHandlers(editor, false); + }, + getStatusText: function(editor) { + var cm = editor.state.cm; + var vim = getVim(cm); + if (vim.insertMode) + return "INSERT"; + var status = ""; + if (vim.visualMode) { + status += "VISUAL"; + if (vim.visualLine) + status += " LINE"; + if (vim.visualBlock) + status += " BLOCK"; + } + if (vim.status) + status += (status ? " " : "") + vim.status; + return status; + }, + handleMacRepeat: function(data, hashId, key) { + if (hashId == -1) { + data.inputChar = key; + data.lastEvent = "input"; + } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) { + if (data.lastEvent == "input") { + data.lastEvent = "input1"; + } else if (data.lastEvent == "input1") { + return true; + } + } else { + data.$lastHash = hashId; + data.$lastKey = key; + data.lastEvent = "keypress"; + } + }, + updateMacCompositionHandlers: function(editor, enable) { + var onCompositionUpdateOverride = function(text) { + var cm = editor.state.cm; + var vim = getVim(cm); + if (!vim.insertMode) { + var el = this.textInput.getElement(); + el.blur(); + el.focus(); + el.value = text; + } else { + this.onCompositionUpdateOrig(text); + } + }; + var onCompositionStartOverride = function(text) { + var cm = editor.state.cm; + var vim = getVim(cm); + if (!vim.insertMode) { + this.onCompositionStartOrig(text); + } + }; + if (enable) { + if (!editor.onCompositionUpdateOrig) { + editor.onCompositionUpdateOrig = editor.onCompositionUpdate; + editor.onCompositionUpdate = onCompositionUpdateOverride; + editor.onCompositionStartOrig = editor.onCompositionStart; + editor.onCompositionStart = onCompositionStartOverride; + } + } else { + if (editor.onCompositionUpdateOrig) { + editor.onCompositionUpdate = editor.onCompositionUpdateOrig; + editor.onCompositionUpdateOrig = null; + editor.onCompositionStart = editor.onCompositionStartOrig; + editor.onCompositionStartOrig = null; + } + } + } + }; + var renderVirtualNumbers = { + getText: function(session, row) { + return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? "\xb7" : "" ))) + ""; + }, + getWidth: function(session, lastLineNumber, config) { + return session.getLength().toString().length * config.characterWidth; + }, + update: function(e, editor) { + editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER); + }, + attach: function(editor) { + editor.renderer.$gutterLayer.$renderer = this; + editor.on("changeSelection", this.update); + }, + detach: function(editor) { + editor.renderer.$gutterLayer.$renderer = null; + editor.off("changeSelection", this.update); + } + }; + Vim.defineOption({ + name: "wrap", + set: function(value, cm) { + if (cm) {cm.ace.setOption("wrap", value)} + }, + type: "boolean" + }, false); + Vim.defineEx('write', 'w', function() { + console.log(':write is not implemented') + }); + defaultKeymap.push( + { keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } }, + { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } }, + { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } }, + { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, + { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } }, + { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, + { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, + { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, + + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelowSkipCurrent" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreBefore" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreAfter" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } }, + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextAfter" } } + ); + actions.aceCommand = function(cm, actionArgs, vim) { + cm.vimCmd = actionArgs; + if (cm.ace.inVirtualSelectionMode) + cm.ace.on("beforeEndOperation", delayedExecAceCommand); + else + delayedExecAceCommand(null, cm.ace); + }; + function delayedExecAceCommand(op, ace) { + ace.off("beforeEndOperation", delayedExecAceCommand); + var cmd = ace.state.cm.vimCmd; + if (cmd) { + ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args); + } + ace.curOp = ace.prevOp; + } + actions.fold = function(cm, actionArgs, vim) { + cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall' + ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]); + }; + + exports.handler.defaultKeymap = defaultKeymap; + exports.handler.actions = actions; + exports.Vim = Vim; + + Vim.map("Y", "yy", "normal"); +}); /***/ }), -/* 53 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 62 */ +/***/ (function(module, exports) { +ace.define("ace/occur",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(acequire, exports, module) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FactionInfo; }); -//Contains the "information" property for all the Factions, which is just a description -//of each faction -let FactionInfo = { - //Endgame - IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back " + - "into chaos. And from this chaos, we are the Invisible hand that guides them to order. ", - DaedalusInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.", +var oop = acequire("./lib/oop"); +var Range = acequire("./range").Range; +var Search = acequire("./search").Search; +var EditSession = acequire("./edit_session").EditSession; +var SearchHighlight = acequire("./search_highlight").SearchHighlight; +function Occur() {} - CovenantInfo: "Surrender yourself. Give up your empty individuality to become part of something great, something eternal. " + - "Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.

" + - "Only then can you discover immortality.", +oop.inherits(Occur, Search); - //Megacorporations, each forms its own faction - ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " + - "With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " + - "information universally accessible.", +(function() { + this.enter = function(editor, options) { + if (!options.needle) return false; + var pos = editor.getCursorPosition(); + this.displayOccurContent(editor, options); + var translatedPos = this.originalToOccurPosition(editor.session, pos); + editor.moveCursorToPosition(translatedPos); + return true; + } + this.exit = function(editor, options) { + var pos = options.translatePosition && editor.getCursorPosition(); + var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos); + this.displayOriginalContent(editor); + if (translatedPos) + editor.moveCursorToPosition(translatedPos); + return true; + } - MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " + - "others have never even dreamed of. Our work fills the world's needs for food, water, power, and " + - "transporation on an unprecendented scale, in ways that no other company can.

" + - "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", + this.highlight = function(sess, regexp) { + var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker( + new SearchHighlight(null, "ace_occur-highlight", "text")); + hl.setRegexp(regexp); + sess._emit("changeBackMarker"); // force highlight layer redraw + } - BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.

" + - "Legal Insight - Business Instinct - Experience Innovation", + this.displayOccurContent = function(editor, options) { + this.$originalSession = editor.session; + var found = this.matchingLines(editor.session, options); + var lines = found.map(function(foundLine) { return foundLine.content; }); + var occurSession = new EditSession(lines.join('\n')); + occurSession.$occur = this; + occurSession.$occurMatchingLines = found; + editor.setSession(occurSession); + this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart; + occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart; + this.highlight(occurSession, options.re); + occurSession._emit('changeBackMarker'); + } - BladeIndustriesInfo: "Augmentation is salvation", + this.displayOriginalContent = function(editor) { + editor.setSession(this.$originalSession); + this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart; + } + this.originalToOccurPosition = function(session, pos) { + var lines = session.$occurMatchingLines; + var nullPos = {row: 0, column: 0}; + if (!lines) return nullPos; + for (var i = 0; i < lines.length; i++) { + if (lines[i].row === pos.row) + return {row: i, column: pos.column}; + } + return nullPos; + } + this.occurToOriginalPosition = function(session, pos) { + var lines = session.$occurMatchingLines; + if (!lines || !lines[pos.row]) + return pos; + return {row: lines[pos.row].row, column: pos.column}; + } - NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.", + this.matchingLines = function(session, options) { + options = oop.mixin({}, options); + if (!session || !options.needle) return []; + var search = new Search(); + search.set(options); + return search.findAll(session).reduce(function(lines, range) { + var row = range.start.row; + var last = lines[lines.length-1]; + return last && last.row === row ? + lines : + lines.concat({row: row, content: session.getLine(row)}); + }, []); + } - ClarkeIncorporatedInfo: "Unlocking the power of the genome", +}).call(Occur.prototype); - OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference", +var dom = acequire('./lib/dom'); +dom.importCssString(".ace_occur-highlight {\n\ + border-radius: 4px;\n\ + background-color: rgba(87, 255, 8, 0.25);\n\ + position: absolute;\n\ + z-index: 4;\n\ + -moz-box-sizing: border-box;\n\ + -webkit-box-sizing: border-box;\n\ + box-sizing: border-box;\n\ + box-shadow: 0 0 4px rgb(91, 255, 50);\n\ +}\n\ +.ace_dark .ace_occur-highlight {\n\ + background-color: rgb(80, 140, 85);\n\ + box-shadow: 0 0 4px rgb(60, 120, 70);\n\ +}\n", "incremental-occur-highlighting"); - FourSigmaInfo: "The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " + - "deep learning and innovative ideas. And improved by iteration. That's Four Sigma.", +exports.Occur = Occur; - KuaiGongInternationalInfo: "Dream big. Work hard. Make history.", +}); - //Other Corporations - FulcrumSecretTechnologiesInfo: "TODO", +ace.define("ace/commands/occur_commands",["require","exports","module","ace/config","ace/occur","ace/keyboard/hash_handler","ace/lib/oop"], function(acequire, exports, module) { - //Hacker groups - BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+ - "It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " + - "to move, to live, to operate at any level without the use of bits. " + - "And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " + - "meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.

" + - "Those who run the bits, run the world", +var config = acequire("../config"), + Occur = acequire("../occur").Occur; +var occurStartCommand = { + name: "occur", + exec: function(editor, options) { + var alreadyInOccur = !!editor.session.$occur; + var occurSessionActive = new Occur().enter(editor, options); + if (occurSessionActive && !alreadyInOccur) + OccurKeyboardHandler.installIn(editor); + }, + readOnly: true +}; + +var occurCommands = [{ + name: "occurexit", + bindKey: 'esc|Ctrl-G', + exec: function(editor) { + var occur = editor.session.$occur; + if (!occur) return; + occur.exit(editor, {}); + if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); + }, + readOnly: true +}, { + name: "occuraccept", + bindKey: 'enter', + exec: function(editor) { + var occur = editor.session.$occur; + if (!occur) return; + occur.exit(editor, {translatePosition: true}); + if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); + }, + readOnly: true +}]; + +var HashHandler = acequire("../keyboard/hash_handler").HashHandler; +var oop = acequire("../lib/oop"); - BlackHandInfo: "The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. " + - "Technological power. " + - "And those at the top rule with an invisible hand. They built a society where the rich get richer, " + - "and everyone else suffers.

" + - "So much pain. So many lives. Their darkness must end.", +function OccurKeyboardHandler() {} - NiteSecInfo: -" __..__
" + -" _.nITESECNIt.
" + -" .-'NITESECNITESEc.
" + -" .' NITESECNITESECn
" + -" / NITESECNITESEC;
" + -" : :NITESECNITESEC;
" + -" ; $ NITESECNITESECN
" + -" : _, ,N'ITESECNITESEC
" + -" : .+^^`, : `NITESECNIT
" + -" ) /), `-,-=,NITESECNI
" + -" / ^ ,-;|NITESECN;
" + -" / _.' '-';NITESECN
" + -" ( , ,-''`^NITE'
" + -" )` :`. .'
" + -" )-- ; `- /
" + -" \' _.-' :
" + -" ( _.-' \. \
" + -" \------. \ \
" + -" \. \ \
" + -" \ _.nIt
" + -" \ _.nITESECNi
" + -" nITESECNIT^' \
" + -" NITE^' ___ \
" + -" / .gP''''Tp. \
" + -" : d' . `b \
" + -" ; d' o `b ;
" + -" / d; `b|
" + -" /, $; @ `:
" + -" /' $$ ;
" + -" .' $$b o |
" + -" .' d$$$; :
" + -" / .d$$$$; , ;
" + -" d .dNITESEC $ |
" + -" :bp.__.gNITESEC$$ :$ ;
" + -" NITESECNITESECNIT $$b :
", +oop.inherits(OccurKeyboardHandler, HashHandler); - //City factions, essentially governments - ChongqingInfo: "Serve the people", - Sector12Info: "The City of the Future", - HongKongInfo: "Asia's World City", - AevumInfo: "The Silicon City", - IshimaInfo: "The East Asian Order of the Future", - VolhavenInfo: "Benefit, Honour, and Glory", +(function() { - //Criminal Organizations/Gangs - SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.", + this.isOccurHandler = true; - DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.", + this.attach = function(editor) { + HashHandler.call(this, occurCommands, editor.commands.platform); + this.$editor = editor; + } - TheSyndicateInfo: "Honor holds you back", + var handleKeyboard$super = this.handleKeyboard; + this.handleKeyboard = function(data, hashId, key, keyCode) { + var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); + return (cmd && cmd.command) ? cmd : undefined; + } - SilhouetteInfo: "Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big " + - "that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working " + - "for.

" + - "That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.", - - TetradsInfo: "Following the Mandate of Heaven and Carrying out the Way", - - SlumSnakesInfo: "Slum Snakes rule!", - - //Earlygame factions - factions the player will prestige with early on that don't - //belong in other categories - NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~", - - TianDiHuiInfo: "Obey Heaven and Work Righteousness", - - CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand, " + - "the largest experiment in anarchy that we have ever had. And as the world becomes increasingly " + - "dominated by the internet, society approaches the brink of total chaos. " + - "We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.", +}).call(OccurKeyboardHandler.prototype); +OccurKeyboardHandler.installIn = function(editor) { + var handler = new this(); + editor.keyBinding.addKeyboardHandler(handler); + editor.commands.addCommands(occurCommands); } +OccurKeyboardHandler.uninstallFrom = function(editor) { + editor.commands.removeCommands(occurCommands); + var handler = editor.getKeyboardHandler(); + if (handler.isOccurHandler) + editor.keyBinding.removeKeyboardHandler(handler); +} + +exports.occurStartCommand = occurStartCommand; + +}); + +ace.define("ace/commands/incremental_search_commands",["require","exports","module","ace/config","ace/lib/oop","ace/keyboard/hash_handler","ace/commands/occur_commands"], function(acequire, exports, module) { + +var config = acequire("../config"); +var oop = acequire("../lib/oop"); +var HashHandler = acequire("../keyboard/hash_handler").HashHandler; +var occurStartCommand = acequire("./occur_commands").occurStartCommand; +exports.iSearchStartCommands = [{ + name: "iSearch", + bindKey: {win: "Ctrl-F", mac: "Command-F"}, + exec: function(editor, options) { + config.loadModule(["core", "ace/incremental_search"], function(e) { + var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch(); + iSearch.activate(editor, options.backwards); + if (options.jumpToFirstMatch) iSearch.next(options); + }); + }, + readOnly: true +}, { + name: "iSearchBackwards", + exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); }, + readOnly: true +}, { + name: "iSearchAndGo", + bindKey: {win: "Ctrl-K", mac: "Command-G"}, + exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); }, + readOnly: true +}, { + name: "iSearchBackwardsAndGo", + bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"}, + exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); }, + readOnly: true +}]; +exports.iSearchCommands = [{ + name: "restartSearch", + bindKey: {win: "Ctrl-F", mac: "Command-F"}, + exec: function(iSearch) { + iSearch.cancelSearch(true); + } +}, { + name: "searchForward", + bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"}, + exec: function(iSearch, options) { + options.useCurrentOrPrevSearch = true; + iSearch.next(options); + } +}, { + name: "searchBackward", + bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"}, + exec: function(iSearch, options) { + options.useCurrentOrPrevSearch = true; + options.backwards = true; + iSearch.next(options); + } +}, { + name: "extendSearchTerm", + exec: function(iSearch, string) { + iSearch.addString(string); + } +}, { + name: "extendSearchTermSpace", + bindKey: "space", + exec: function(iSearch) { iSearch.addString(' '); } +}, { + name: "shrinkSearchTerm", + bindKey: "backspace", + exec: function(iSearch) { + iSearch.removeChar(); + } +}, { + name: 'confirmSearch', + bindKey: 'return', + exec: function(iSearch) { iSearch.deactivate(); } +}, { + name: 'cancelSearch', + bindKey: 'esc|Ctrl-G', + exec: function(iSearch) { iSearch.deactivate(true); } +}, { + name: 'occurisearch', + bindKey: 'Ctrl-O', + exec: function(iSearch) { + var options = oop.mixin({}, iSearch.$options); + iSearch.deactivate(); + occurStartCommand.exec(iSearch.$editor, options); + } +}, { + name: "yankNextWord", + bindKey: "Ctrl-w", + exec: function(iSearch) { + var ed = iSearch.$editor, + range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }), + string = ed.session.getTextRange(range); + iSearch.addString(string); + } +}, { + name: "yankNextChar", + bindKey: "Ctrl-Alt-y", + exec: function(iSearch) { + var ed = iSearch.$editor, + range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }), + string = ed.session.getTextRange(range); + iSearch.addString(string); + } +}, { + name: 'recenterTopBottom', + bindKey: 'Ctrl-l', + exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); } +}, { + name: 'selectAllMatches', + bindKey: 'Ctrl-space', + exec: function(iSearch) { + var ed = iSearch.$editor, + hl = ed.session.$isearchHighlight, + ranges = hl && hl.cache ? hl.cache + .reduce(function(ranges, ea) { + return ranges.concat(ea ? ea : []); }, []) : []; + iSearch.deactivate(false); + ranges.forEach(ed.selection.addRange.bind(ed.selection)); + } +}, { + name: 'searchAsRegExp', + bindKey: 'Alt-r', + exec: function(iSearch) { + iSearch.convertNeedleToRegExp(); + } +}].map(function(cmd) { + cmd.readOnly = true; + cmd.isIncrementalSearchCommand = true; + cmd.scrollIntoView = "animate-cursor"; + return cmd; +}); + +function IncrementalSearchKeyboardHandler(iSearch) { + this.$iSearch = iSearch; +} + +oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); + +(function() { + + this.attach = function(editor) { + var iSearch = this.$iSearch; + HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); + this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { + if (!e.command.isIncrementalSearchCommand) + return iSearch.deactivate(); + e.stopPropagation(); + e.preventDefault(); + var scrollTop = editor.session.getScrollTop(); + var result = e.command.exec(iSearch, e.args || {}); + editor.renderer.scrollCursorIntoView(null, 0.5); + editor.renderer.animateScrolling(scrollTop); + return result; + }); + }; + + this.detach = function(editor) { + if (!this.$commandExecHandler) return; + editor.commands.removeEventListener('exec', this.$commandExecHandler); + delete this.$commandExecHandler; + }; + + var handleKeyboard$super = this.handleKeyboard; + this.handleKeyboard = function(data, hashId, key, keyCode) { + if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v') + || (hashId === 1/*ctrl*/ && key === 'y')) return null; + var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); + if (cmd.command) { return cmd; } + if (hashId == -1) { + var extendCmd = this.commands.extendSearchTerm; + if (extendCmd) { return {command: extendCmd, args: key}; } + } + return false; + }; + +}).call(IncrementalSearchKeyboardHandler.prototype); +exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler; -/***/ }), -/* 54 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +}); +ace.define("ace/incremental_search",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/search_highlight","ace/commands/incremental_search_commands","ace/lib/dom","ace/commands/command_manager","ace/editor","ace/config"], function(acequire, exports, module) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factionInvitationBoxCreate; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__ = __webpack_require__(1); - - - -/* Faction Invitation Pop-up box */ -function factionInvitationBoxClose() { - var factionInvitationBox = document.getElementById("faction-invitation-box-container"); - factionInvitationBox.style.display = "none"; +var oop = acequire("./lib/oop"); +var Range = acequire("./range").Range; +var Search = acequire("./search").Search; +var SearchHighlight = acequire("./search_highlight").SearchHighlight; +var iSearchCommandModule = acequire("./commands/incremental_search_commands"); +var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler; +function IncrementalSearch() { + this.$options = {wrap: false, skipCurrent: false}; + this.$keyboardHandler = new ISearchKbd(this); } -function factionInvitationBoxOpen() { - var factionInvitationBox = document.getElementById("faction-invitation-box-container"); - factionInvitationBox.style.display = "block"; +oop.inherits(IncrementalSearch, Search); + +function isRegExp(obj) { + return obj instanceof RegExp; } -function factionInvitationSetText(txt) { - var textBox = document.getElementById("faction-invitation-box-text"); - textBox.innerHTML = txt; +function regExpToObject(re) { + var string = String(re), + start = string.indexOf('/'), + flagStart = string.lastIndexOf('/'); + return { + expression: string.slice(start+1, flagStart), + flags: string.slice(flagStart+1) + } } -function factionInvitationSetMessage(msg) { - var msgBox = document.getElementById("faction-invitation-box-message"); - msgBox.innerHTML = msg; +function stringToRegExp(string, flags) { + try { + return new RegExp(string, flags); + } catch (e) { return string; } } -//ram argument is in GB -function factionInvitationBoxCreate(faction) { - factionInvitationSetText("You have received a faction invitation from " + faction.name); - //TODO Faction invitation message +function objectToRegExp(obj) { + return stringToRegExp(obj.expression, obj.flags); +} - var newYesButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-yes"); - newYesButton.addEventListener("click", function() { - Object(__WEBPACK_IMPORTED_MODULE_0__src_Faction_js__["h" /* joinFaction */])(faction); - factionInvitationBoxClose(); - return false; +(function() { + + this.activate = function(ed, backwards) { + this.$editor = ed; + this.$startPos = this.$currentPos = ed.getCursorPosition(); + this.$options.needle = ''; + this.$options.backwards = backwards; + ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); + this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this); + this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); + this.selectionFix(ed); + this.statusMessage(true); + }; + + this.deactivate = function(reset) { + this.cancelSearch(reset); + var ed = this.$editor; + ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler); + if (this.$mousedownHandler) { + ed.removeEventListener('mousedown', this.$mousedownHandler); + delete this.$mousedownHandler; + } + ed.onPaste = this.$originalEditorOnPaste; + this.message(''); + }; + + this.selectionFix = function(editor) { + if (editor.selection.isEmpty() && !editor.session.$emacsMark) { + editor.clearSelection(); + } + }; + + this.highlight = function(regexp) { + var sess = this.$editor.session, + hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker( + new SearchHighlight(null, "ace_isearch-result", "text")); + hl.setRegexp(regexp); + sess._emit("changeBackMarker"); // force highlight layer redraw + }; + + this.cancelSearch = function(reset) { + var e = this.$editor; + this.$prevNeedle = this.$options.needle; + this.$options.needle = ''; + if (reset) { + e.moveCursorToPosition(this.$startPos); + this.$currentPos = this.$startPos; + } else { + e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false); + } + this.highlight(null); + return Range.fromPoints(this.$currentPos, this.$currentPos); + }; + + this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) { + if (!this.$editor) return null; + var options = this.$options; + if (needleUpdateFunc) { + options.needle = needleUpdateFunc.call(this, options.needle || '') || ''; + } + if (options.needle.length === 0) { + this.statusMessage(true); + return this.cancelSearch(true); + } + options.start = this.$currentPos; + var session = this.$editor.session, + found = this.find(session), + shouldSelect = this.$editor.emacsMark ? + !!this.$editor.emacsMark() : !this.$editor.selection.isEmpty(); + if (found) { + if (options.backwards) found = Range.fromPoints(found.end, found.start); + this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end)); + if (moveToNext) this.$currentPos = found.end; + this.highlight(options.re); + } + + this.statusMessage(found); + + return found; + }; + + this.addString = function(s) { + return this.highlightAndFindWithNeedle(false, function(needle) { + if (!isRegExp(needle)) + return needle + s; + var reObj = regExpToObject(needle); + reObj.expression += s; + return objectToRegExp(reObj); + }); + }; + + this.removeChar = function(c) { + return this.highlightAndFindWithNeedle(false, function(needle) { + if (!isRegExp(needle)) + return needle.substring(0, needle.length-1); + var reObj = regExpToObject(needle); + reObj.expression = reObj.expression.substring(0, reObj.expression.length-1); + return objectToRegExp(reObj); + }); + }; + + this.next = function(options) { + options = options || {}; + this.$options.backwards = !!options.backwards; + this.$currentPos = this.$editor.getCursorPosition(); + return this.highlightAndFindWithNeedle(true, function(needle) { + return options.useCurrentOrPrevSearch && needle.length === 0 ? + this.$prevNeedle || '' : needle; + }); + }; + + this.onMouseDown = function(evt) { + this.deactivate(); + return true; + }; + + this.onPaste = function(text) { + this.addString(text); + }; + + this.convertNeedleToRegExp = function() { + return this.highlightAndFindWithNeedle(false, function(needle) { + return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig'); + }); + }; + + this.convertNeedleToString = function() { + return this.highlightAndFindWithNeedle(false, function(needle) { + return isRegExp(needle) ? regExpToObject(needle).expression : needle; + }); + }; + + this.statusMessage = function(found) { + var options = this.$options, msg = ''; + msg += options.backwards ? 'reverse-' : ''; + msg += 'isearch: ' + options.needle; + msg += found ? '' : ' (not found)'; + this.message(msg); + }; + + this.message = function(msg) { + if (this.$editor.showCommandLine) { + this.$editor.showCommandLine(msg); + this.$editor.focus(); + } else { + console.log(msg); + } + }; + +}).call(IncrementalSearch.prototype); + + +exports.IncrementalSearch = IncrementalSearch; + +var dom = acequire('./lib/dom'); +dom.importCssString && dom.importCssString("\ +.ace_marker-layer .ace_isearch-result {\ + position: absolute;\ + z-index: 6;\ + -moz-box-sizing: border-box;\ + -webkit-box-sizing: border-box;\ + box-sizing: border-box;\ +}\ +div.ace_isearch-result {\ + border-radius: 4px;\ + background-color: rgba(255, 200, 0, 0.5);\ + box-shadow: 0 0 4px rgb(255, 200, 0);\ +}\ +.ace_dark div.ace_isearch-result {\ + background-color: rgb(100, 110, 160);\ + box-shadow: 0 0 4px rgb(80, 90, 140);\ +}", "incremental-search-highlighting"); +var commands = acequire("./commands/command_manager"); +(function() { + this.setupIncrementalSearch = function(editor, val) { + if (this.usesIncrementalSearch == val) return; + this.usesIncrementalSearch = val; + var iSearchCommands = iSearchCommandModule.iSearchStartCommands; + var method = val ? 'addCommands' : 'removeCommands'; + this[method](iSearchCommands); + }; +}).call(commands.CommandManager.prototype); +var Editor = acequire("./editor").Editor; +acequire("./config").defineOptions(Editor.prototype, "editor", { + useIncrementalSearch: { + set: function(val) { + this.keyBinding.$handlers.forEach(function(handler) { + if (handler.setupIncrementalSearch) { + handler.setupIncrementalSearch(this, val); + } + }); + this._emit('incrementalSearchSettingChanged', {isEnabled: val}); + } + } +}); + +}); + +ace.define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/incremental_search","ace/commands/incremental_search_commands","ace/keyboard/hash_handler","ace/lib/keys"], function(acequire, exports, module) { +"use strict"; + +var dom = acequire("../lib/dom"); +acequire("../incremental_search"); +var iSearchCommandModule = acequire("../commands/incremental_search_commands"); + + +var screenToTextBlockCoordinates = function(x, y) { + var canvasPos = this.scroller.getBoundingClientRect(); + + var col = Math.floor( + (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth + ); + var row = Math.floor( + (y + this.scrollTop - canvasPos.top) / this.lineHeight + ); + + return this.session.screenToDocumentPosition(row, col); +}; + +var HashHandler = acequire("./hash_handler").HashHandler; +exports.handler = new HashHandler(); + +exports.handler.isEmacs = true; +exports.handler.$id = "ace/keyboard/emacs"; + +var initialized = false; +var $formerLongWords; +var $formerLineStart; + +exports.handler.attach = function(editor) { + if (!initialized) { + initialized = true; + dom.importCssString('\ + .emacs-mode .ace_cursor{\ + border: 1px rgba(50,250,50,0.8) solid!important;\ + -moz-box-sizing: border-box!important;\ + -webkit-box-sizing: border-box!important;\ + box-sizing: border-box!important;\ + background-color: rgba(0,250,0,0.9);\ + opacity: 0.5;\ + }\ + .emacs-mode .ace_hidden-cursors .ace_cursor{\ + opacity: 1;\ + background-color: transparent;\ + }\ + .emacs-mode .ace_overwrite-cursors .ace_cursor {\ + opacity: 1;\ + background-color: transparent;\ + border-width: 0 0 2px 2px !important;\ + }\ + .emacs-mode .ace_text-layer {\ + z-index: 4\ + }\ + .emacs-mode .ace_cursor-layer {\ + z-index: 2\ + }', 'emacsMode' + ); + } + $formerLongWords = editor.session.$selectLongWords; + editor.session.$selectLongWords = true; + $formerLineStart = editor.session.$useEmacsStyleLineStart; + editor.session.$useEmacsStyleLineStart = true; + + editor.session.$emacsMark = null; // the active mark + editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || []; + + editor.emacsMark = function() { + return this.session.$emacsMark; + }; + + editor.setEmacsMark = function(p) { + this.session.$emacsMark = p; + }; + + editor.pushEmacsMark = function(p, activate) { + var prevMark = this.session.$emacsMark; + if (prevMark) + this.session.$emacsMarkRing.push(prevMark); + if (!p || activate) this.setEmacsMark(p); + else this.session.$emacsMarkRing.push(p); + }; + + editor.popEmacsMark = function() { + var mark = this.emacsMark(); + if (mark) { this.setEmacsMark(null); return mark; } + return this.session.$emacsMarkRing.pop(); + }; + + editor.getLastEmacsMark = function(p) { + return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0]; + }; + + editor.emacsMarkForSelection = function(replacement) { + var sel = this.selection, + multiRangeLength = this.multiSelect ? + this.multiSelect.getAllRanges().length : 1, + selIndex = sel.index || 0, + markRing = this.session.$emacsMarkRing, + markIndex = markRing.length - (multiRangeLength - selIndex), + lastMark = markRing[markIndex] || sel.anchor; + if (replacement) { + markRing.splice(markIndex, 1, + "row" in replacement && "column" in replacement ? + replacement : undefined); + } + return lastMark; + } + + editor.on("click", $resetMarkMode); + editor.on("changeSession", $kbSessionChange); + editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates; + editor.setStyle("emacs-mode"); + editor.commands.addCommands(commands); + exports.handler.platform = editor.commands.platform; + editor.$emacsModeHandler = this; + editor.addEventListener('copy', this.onCopy); + editor.addEventListener('paste', this.onPaste); +}; + +exports.handler.detach = function(editor) { + delete editor.renderer.screenToTextCoordinates; + editor.session.$selectLongWords = $formerLongWords; + editor.session.$useEmacsStyleLineStart = $formerLineStart; + editor.removeEventListener("click", $resetMarkMode); + editor.removeEventListener("changeSession", $kbSessionChange); + editor.unsetStyle("emacs-mode"); + editor.commands.removeCommands(commands); + editor.removeEventListener('copy', this.onCopy); + editor.removeEventListener('paste', this.onPaste); + editor.$emacsModeHandler = null; +}; + +var $kbSessionChange = function(e) { + if (e.oldSession) { + e.oldSession.$selectLongWords = $formerLongWords; + e.oldSession.$useEmacsStyleLineStart = $formerLineStart; + } + + $formerLongWords = e.session.$selectLongWords; + e.session.$selectLongWords = true; + $formerLineStart = e.session.$useEmacsStyleLineStart; + e.session.$useEmacsStyleLineStart = true; + + if (!e.session.hasOwnProperty('$emacsMark')) + e.session.$emacsMark = null; + if (!e.session.hasOwnProperty('$emacsMarkRing')) + e.session.$emacsMarkRing = []; +}; + +var $resetMarkMode = function(e) { + e.editor.session.$emacsMark = null; +}; + +var keys = acequire("../lib/keys").KEY_MODS; +var eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"}; +var combinations = ["C-S-M-CMD", + "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M", + "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S", + "CMD", "M", "S", "C"]; +combinations.forEach(function(c) { + var hashId = 0; + c.split("-").forEach(function(c) { + hashId = hashId | keys[eMods[c]]; }); + eMods[hashId] = c.toLowerCase() + "-"; +}); - var noButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-no"); - noButton.addEventListener("click", function() { - factionInvitationBoxClose(); - faction.alreadyInvited = true; - __WEBPACK_IMPORTED_MODULE_1__src_Player_js__["a" /* Player */].factionInvitations.push(faction.name); - return false; - }); +exports.handler.onCopy = function(e, editor) { + if (editor.$handlesEmacsOnCopy) return; + editor.$handlesEmacsOnCopy = true; + exports.handler.commands.killRingSave.exec(editor); + editor.$handlesEmacsOnCopy = false; +}; - factionInvitationBoxOpen(); -} +exports.handler.onPaste = function(e, editor) { + editor.pushEmacsMark(editor.getCursorPosition()); +}; + +exports.handler.bindKey = function(key, command) { + if (typeof key == "object") + key = key[this.platform]; + if (!key) + return; + + var ckb = this.commandKeyBinding; + key.split("|").forEach(function(keyPart) { + keyPart = keyPart.toLowerCase(); + ckb[keyPart] = command; + var keyParts = keyPart.split(" ").slice(0,-1); + keyParts.reduce(function(keyMapKeys, keyPart, i) { + var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : ''; + return keyMapKeys.concat([prefix + keyPart]); + }, []).forEach(function(keyPart) { + if (!ckb[keyPart]) ckb[keyPart] = "null"; + }); + }, this); +}; + +exports.handler.getStatusText = function(editor, data) { + var str = ""; + if (data.count) + str += data.count; + if (data.keyChain) + str += " " + data.keyChain + return str; +}; + +exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { + if (keyCode === -1) return undefined; + + var editor = data.editor; + editor._signal("changeStatus"); + if (hashId == -1) { + editor.pushEmacsMark(); + if (data.count) { + var str = new Array(data.count + 1).join(key); + data.count = null; + return {command: "insertstring", args: str}; + } + } + + var modifier = eMods[hashId]; + if (modifier == "c-" || data.count) { + var count = parseInt(key[key.length - 1]); + if (typeof count === 'number' && !isNaN(count)) { + data.count = Math.max(data.count, 0) || 0; + data.count = 10 * data.count + count; + return {command: "null"}; + } + } + if (modifier) key = modifier + key; + if (data.keyChain) key = data.keyChain += " " + key; + var command = this.commandKeyBinding[key]; + data.keyChain = command == "null" ? key : ""; + if (!command) return undefined; + if (command === "null") return {command: "null"}; + + if (command === "universalArgument") { + data.count = -4; + return {command: "null"}; + } + var args; + if (typeof command !== "string") { + args = command.args; + if (command.command) command = command.command; + if (command === "goorselect") { + command = editor.emacsMark() ? args[1] : args[0]; + args = null; + } + } + + if (typeof command === "string") { + if (command === "insertstring" || + command === "splitline" || + command === "togglecomment") { + editor.pushEmacsMark(); + } + command = this.commands[command] || editor.commands.commands[command]; + if (!command) return undefined; + } + + if (!command.readOnly && !command.isYank) + data.lastCommand = null; + + if (!command.readOnly && editor.emacsMark()) + editor.setEmacsMark(null) + + if (data.count) { + var count = data.count; + data.count = 0; + if (!command || !command.handlesCount) { + return { + args: args, + command: { + exec: function(editor, args) { + for (var i = 0; i < count; i++) + command.exec(editor, args); + }, + multiSelectAction: command.multiSelectAction + } + }; + } else { + if (!args) args = {}; + if (typeof args === 'object') args.count = count; + } + } + + return {command: command, args: args}; +}; + +exports.emacsKeys = { + "Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]}, + "Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]}, + "Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]}, + "Right|C-f" : {command: "goorselect", args: ["gotoright","selectright"]}, + "C-Left|M-b" : {command: "goorselect", args: ["gotowordleft","selectwordleft"]}, + "C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]}, + "Home|C-a" : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]}, + "End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]}, + "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]}, + "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]}, + "S-Up|S-C-p" : "selectup", + "S-Down|S-C-n" : "selectdown", + "S-Left|S-C-b" : "selectleft", + "S-Right|S-C-f" : "selectright", + "S-C-Left|S-M-b" : "selectwordleft", + "S-C-Right|S-M-f" : "selectwordright", + "S-Home|S-C-a" : "selecttolinestart", + "S-End|S-C-e" : "selecttolineend", + "S-C-Home" : "selecttostart", + "S-C-End" : "selecttoend", + + "C-l" : "recenterTopBottom", + "M-s" : "centerselection", + "M-g": "gotoline", + "C-x C-p": "selectall", + "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, + "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]}, + "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, + "PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]}, + "S-C-Down": "selectpagedown", + "S-C-Up": "selectpageup", + + "C-s": "iSearch", + "C-r": "iSearchBackwards", + + "M-C-s": "findnext", + "M-C-r": "findprevious", + "S-M-5": "replace", + "Backspace": "backspace", + "Delete|C-d": "del", + "Return|C-m": {command: "insertstring", args: "\n"}, // "newline" + "C-o": "splitline", + + "M-d|C-Delete": {command: "killWord", args: "right"}, + "C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"}, + "C-k": "killLine", + + "C-y|S-Delete": "yank", + "M-y": "yankRotate", + "C-g": "keyboardQuit", + + "C-w|C-S-W": "killRegion", + "M-w": "killRingSave", + "C-Space": "setMark", + "C-x C-x": "exchangePointAndMark", + + "C-t": "transposeletters", + "M-u": "touppercase", // Doesn't work + "M-l": "tolowercase", + "M-/": "autocomplete", // Doesn't work + "C-u": "universalArgument", + + "M-;": "togglecomment", + + "C-/|C-x u|S-C--|C-z": "undo", + "S-C-/|S-C-x u|C--|S-C-z": "redo", // infinite undo? + "C-x r": "selectRectangularRegion", + "M-x": {command: "focusCommandLine", args: "M-x "} +}; +exports.handler.bindKeys(exports.emacsKeys); + +exports.handler.addCommands({ + recenterTopBottom: function(editor) { + var renderer = editor.renderer; + var pos = renderer.$cursorLayer.getPixelPosition(); + var h = renderer.$size.scrollerHeight - renderer.lineHeight; + var scrollTop = renderer.scrollTop; + if (Math.abs(pos.top - scrollTop) < 2) { + scrollTop = pos.top - h; + } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) { + scrollTop = pos.top; + } else { + scrollTop = pos.top - h * 0.5; + } + editor.session.setScrollTop(scrollTop); + }, + selectRectangularRegion: function(editor) { + editor.multiSelect.toggleBlockSelection(); + }, + setMark: { + exec: function(editor, args) { + + if (args && args.count) { + if (editor.inMultiSelectMode) editor.forEachSelection(moveToMark); + else moveToMark(); + moveToMark(); + return; + } + + var mark = editor.emacsMark(), + ranges = editor.selection.getAllRanges(), + rangePositions = ranges.map(function(r) { return {row: r.start.row, column: r.start.column}; }), + transientMarkModeActive = true, + hasNoSelection = ranges.every(function(range) { return range.isEmpty(); }); + if (transientMarkModeActive && (mark || !hasNoSelection)) { + if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)}); + else editor.clearSelection(); + if (mark) editor.pushEmacsMark(null); + return; + } + + if (!mark) { + rangePositions.forEach(function(pos) { editor.pushEmacsMark(pos); }); + editor.setEmacsMark(rangePositions[rangePositions.length-1]); + return; + } + + function moveToMark() { + var mark = editor.popEmacsMark(); + mark && editor.moveCursorToPosition(mark); + } + + }, + readOnly: true, + handlesCount: true + }, + exchangePointAndMark: { + exec: function exchangePointAndMark$exec(editor, args) { + var sel = editor.selection; + if (!args.count && !sel.isEmpty()) { // just invert selection + sel.setSelectionRange(sel.getRange(), !sel.isBackwards()); + return; + } + + if (args.count) { // replace mark and point + var pos = {row: sel.lead.row, column: sel.lead.column}; + sel.clearSelection(); + sel.moveCursorToPosition(editor.emacsMarkForSelection(pos)); + } else { // create selection to last mark + sel.selectToPosition(editor.emacsMarkForSelection()); + } + }, + readOnly: true, + handlesCount: true, + multiSelectAction: "forEach" + }, + killWord: { + exec: function(editor, dir) { + editor.clearSelection(); + if (dir == "left") + editor.selection.selectWordLeft(); + else + editor.selection.selectWordRight(); + + var range = editor.getSelectionRange(); + var text = editor.session.getTextRange(range); + exports.killRing.add(text); + + editor.session.remove(range); + editor.clearSelection(); + }, + multiSelectAction: "forEach" + }, + killLine: function(editor) { + editor.pushEmacsMark(null); + editor.clearSelection(); + var range = editor.getSelectionRange(); + var line = editor.session.getLine(range.start.row); + range.end.column = line.length; + line = line.substr(range.start.column) + + var foldLine = editor.session.getFoldLine(range.start.row); + if (foldLine && range.end.row != foldLine.end.row) { + range.end.row = foldLine.end.row; + line = "x"; + } + if (/^\s*$/.test(line)) { + range.end.row++; + line = editor.session.getLine(range.end.row); + range.end.column = /^\s*$/.test(line) ? line.length : 0; + } + var text = editor.session.getTextRange(range); + if (editor.prevOp.command == this) + exports.killRing.append(text); + else + exports.killRing.add(text); + + editor.session.remove(range); + editor.clearSelection(); + }, + yank: function(editor) { + editor.onPaste(exports.killRing.get() || ''); + editor.keyBinding.$data.lastCommand = "yank"; + }, + yankRotate: function(editor) { + if (editor.keyBinding.$data.lastCommand != "yank") + return; + editor.undo(); + editor.session.$emacsMarkRing.pop(); // also undo recording mark + editor.onPaste(exports.killRing.rotate()); + editor.keyBinding.$data.lastCommand = "yank"; + }, + killRegion: { + exec: function(editor) { + exports.killRing.add(editor.getCopyText()); + editor.commands.byName.cut.exec(editor); + editor.setEmacsMark(null); + }, + readOnly: true, + multiSelectAction: "forEach" + }, + killRingSave: { + exec: function(editor) { + + editor.$handlesEmacsOnCopy = true; + var marks = editor.session.$emacsMarkRing.slice(), + deselectedMarks = []; + exports.killRing.add(editor.getCopyText()); + + setTimeout(function() { + function deselect() { + var sel = editor.selection, range = sel.getRange(), + pos = sel.isBackwards() ? range.end : range.start; + deselectedMarks.push({row: pos.row, column: pos.column}); + sel.clearSelection(); + } + editor.$handlesEmacsOnCopy = false; + if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect}); + else deselect(); + editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse()); + }, 0); + }, + readOnly: true + }, + keyboardQuit: function(editor) { + editor.selection.clearSelection(); + editor.setEmacsMark(null); + editor.keyBinding.$data.count = null; + }, + focusCommandLine: function(editor, arg) { + if (editor.showCommandLine) + editor.showCommandLine(arg); + } +}); + +exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands); + +var commands = exports.handler.commands; +commands.yank.isYank = true; +commands.yankRotate.isYank = true; + +exports.killRing = { + $data: [], + add: function(str) { + str && this.$data.push(str); + if (this.$data.length > 30) + this.$data.shift(); + }, + append: function(str) { + var idx = this.$data.length - 1; + var text = this.$data[idx] || ""; + if (str) text += str; + if (text) this.$data[idx] = text; + }, + get: function(n) { + n = n || 1; + return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n'); + }, + pop: function() { + if (this.$data.length > 1) + this.$data.pop(); + return this.get(); + }, + rotate: function() { + this.$data.unshift(this.$data.pop()); + return this.get(); + } +}; + +}); /***/ }), -/* 55 */ +/* 63 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -59904,8 +68707,11 @@ function factionInvitationBoxCreate(faction) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_YesNoBox_js__ = __webpack_require__(20); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(16); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__ = __webpack_require__(21); + + @@ -59931,15 +68737,15 @@ function purchaseServer(ram, cost) { return; } - var hostname = Object(__WEBPACK_IMPORTED_MODULE_4__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])(); + var hostname = Object(__WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])(); if (hostname == "") { Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must enter a hostname for your new server!"); return; } //Create server - var newServ = new Server(createRandomIp(), hostname, "", false, true, true, ram); - AddToAllServers(newServ); + var newServ = new __WEBPACK_IMPORTED_MODULE_2__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["a" /* createRandomIp */])(), hostname, "", false, true, true, ram); + Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["a" /* AddToAllServers */])(newServ); //Add to Player's purchasedServers array __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip); @@ -59973,7 +68779,7 @@ function purchaseRamForHomeComputer(cost) { /***/ }), -/* 56 */ +/* 64 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -60005,7 +68811,7 @@ let TerminalHelpText = "rm [file] Delete a file from the server
" + "run [name] [-t] [n] [args...] Execute a program or script
" + "scan Prints all immediately-available network connections
" + - "scan-analyze [d] Prints info for all servers up to d nodes away
" + + "scan-analyze [d] [-a] Prints info for all servers up to d nodes away
" + "scp [file] [server] Copies a script or .lit file to a destination server
" + "sudov Shows whether you have root access on this computer
" + "tail [script] [args...] Displays dynamic logs for the specified script
" + @@ -60134,7 +68940,7 @@ let HelpTexts = { scan: "scan
" + "Prints all immediately-available network connection. This will print a list of all servers that you can currently connect " + "to using the 'connect' Terminal command.", - "scan-analyze": "scan-analyze [depth]
" + + "scan-analyze": "scan-analyze [depth] [-a]
" + "Prints detailed information about all servers up to [depth] nodes away on the network. Calling " + "'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal " + "command. This command also shows the relative paths to reach each server.

" + @@ -60143,7 +68949,9 @@ let HelpTexts = { "5 and 10, respectively.

" + "The information 'scan-analyze' displays about each server includes whether or not you have root access to it, " + "its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM " + - "it has", + "it has.

" + + "By default, this command will not display servers that you have purchased. However, you can pass in the " + + "-a flag at the end of the command if you would like to enable that.", scp: "scp [filename] [target server]
" + "Copies the specified file from the current server to the target server. " + "This command only works for script files (.script extension) and literature files (.lit extension). " + @@ -60185,7 +68993,7 @@ let HelpTexts = { /***/ }), -/* 57 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { /* @@ -63821,32 +72629,32 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); /***/ }), -/* 58 */ +/* 66 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return saveObject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return loadGame; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(17); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(40); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(18); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(24); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(30); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(34); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(22); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Player_js__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(18); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(19); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(26); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(35); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(23); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__); @@ -63919,7 +72727,16 @@ BitburnerSaveObject.prototype.saveGame = function() { this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["a" /* AllGangs */]); } var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this)))); - window.localStorage.setItem("bitburnerSave", saveString); + try { + window.localStorage.setItem("bitburnerSave", saveString); + } catch(e) { + if (e.code == 22) { + Object(__WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Failed to save game because the size of the save file " + + "is too large. Consider killing several of your scripts to " + + "fix this, or increasing the size of your browsers localStorage"); + } + } + console.log("Game saved!"); __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].createStatusText("Game saved!"); @@ -64312,7 +73129,7 @@ BitburnerSaveObject.prototype.exportGame = function() { this.VersionSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].Version); var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this)))); - + var filename = "bitburnerSave.json"; var file = new Blob([saveString], {type: 'text/plain'}); if (window.navigator.msSaveOrOpenBlob) {// IE10+ window.navigator.msSaveOrOpenBlob(file, filename); diff --git a/index.html b/index.html index 66288da66..1e58c93d4 100644 --- a/index.html +++ b/index.html @@ -105,6 +105,47 @@ Netscript Documentation + +
+

Script Editor Options

+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
@@ -462,8 +503,9 @@

---------------

Perform work/carry out assignments for your faction to help further its cause! By doing so - you will gain reputation for your faction. You will also gain reputation passively over time, - although at a very slow rate. Note that you cannot + you will earn reputation for your faction. You will also gain reputation passively over time, + although at a very slow rate. Earning reputation will allow you to purchase Augmentations + through this faction, which are powerful upgrades that enhance your abilities. Note that you cannot use your terminal or create scripts when you are performing a task!



@@ -738,6 +780,7 @@
× +

@@ -787,6 +830,10 @@ + +
+
+

diff --git a/src/ActiveScriptsUI.js b/src/ActiveScriptsUI.js index 38a6bcdbd..539fb17e8 100644 --- a/src/ActiveScriptsUI.js +++ b/src/ActiveScriptsUI.js @@ -183,6 +183,7 @@ function updateActiveScriptsItems() { } document.getElementById("active-scripts-total-prod").innerHTML = "Total online production rate: $" + formatNumber(total, 2) + " / second"; + return total; } //Updates the content of the given item in the Active Scripts list @@ -197,7 +198,6 @@ function updateActiveScriptsItemContent(workerscript) { itemNameArray.push(workerscript.args[i].toString()); } var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; var itemContent = document.getElementById(itemName + "-content") //Clear the item diff --git a/src/BitNode.js b/src/BitNode.js index b729a4fbf..977cdde1e 100644 --- a/src/BitNode.js +++ b/src/BitNode.js @@ -53,7 +53,27 @@ function initBitNodes() { "upgrade its level up to a maximum of 3. This Source-File lets you access and use the Singularity " + "Functions in other BitNodes. Each level of this Source-File will open up more Singularity Functions " + "that you can use."); - BitNodes["BitNode5"] = new BitNode(5, "Artificial Intelligence", "COMING SOON"); //Int + BitNodes["BitNode5"] = new BitNode(5, "Artificial Intelligence", "Posthuman", "They said it couldn't be done. They said the human brain, " + + "along with its consciousness and intelligence, couldn't be replicated. They said the complexity " + + "of the brain results from unpredictable, nonlinear interactions that couldn't be modeled " + + "by 1's and 0's. They were wrong.

" + + "In this BitNode:

" + + "The base security level of servers is doubled
" + + "The starting money on servers is halved, but the maximum money is doubled
" + + "Most methods of earning money now give significantly less
" + + "Augmentations are more expensive
" + + "Hacking experience gain rates are reduced

" + + "Destroying this BitNode will give you Source-File 5, or if you already have this Source-File it will " + + "upgrade its level up to a maximum of 3. This Source-File grants you a special new stat called Intelligence. " + + "Intelligence is unique because it is permanent and persistent (it never gets reset back to 1). However " + + "gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't know " + + "when you gain experience and how much). Higher Intelligence levels will boost your production for many actions " + + "in the game.

" + + "In addition, this Source-File will unlock the getBitNodeMultipliers() Netscript function, " + + "and will also raise all of your hacking-related multipliers by:

" + + "Level 1: 4%
" + + "Level 2: 6%
" + + "Level 3: 7%"); BitNodes["BitNode6"] = new BitNode(6, "Hacktocracy", "COMING SOON"); //Healthy Hacknet balancing mechanic BitNodes["BitNode7"] = new BitNode(7, "Do Androids Dream?", "COMING SOON"); //Build androids for automation BitNodes["BitNode8"] = new BitNode(8, "Ghost of Wall Street", "COMING SOON"); //Trading only viable strategy @@ -87,6 +107,7 @@ let BitNodeMultipliers = { ServerStartingMoney: 1, ServerGrowthRate: 1, ServerWeakenRate: 1, + ServerStartingSecurity: 1, ManualHackMoney: 1, ScriptHackMoney: 1, @@ -118,7 +139,7 @@ function initBitNodeMultipliers() { } switch (Player.bitNodeN) { - case 1: + case 1: //Source Genesis (every multiplier is 1) break; case 2: //Rise of the Underworld BitNodeMultipliers.ServerMaxMoney = 0.2; @@ -139,6 +160,16 @@ function initBitNodeMultipliers() { BitNodeMultipliers.CrimeExpGain = 0.5; BitNodeMultipliers.FactionWorkRepGain = 0.75; break; + case 5: //Artificial intelligence + BitNodeMultipliers.ServerMaxMoney = 2; + BitNodeMultipliers.ServerStartingSecurity = 2; + BitNodeMultipliers.ServerStartingMoney = 0.5; + BitNodeMultipliers.ScriptHackMoney = 0.25; + BitNodeMultipliers.HacknetNodeMoney = 0.2; + BitNodeMultipliers.CrimeMoney = 0.5; + BitNodeMultipliers.AugmentationMoneyCost = 2; + BitNodeMultipliers.HackExpGain = 0.5; + break; case 11: //The Big Crash BitNodeMultipliers.ServerMaxMoney = 0.1; BitNodeMultipliers.ServerStartingMoney = 0.25; diff --git a/src/Company.js b/src/Company.js index a9a2c4954..7386ea9d6 100644 --- a/src/Company.js +++ b/src/Company.js @@ -262,58 +262,58 @@ let CompanyPositions = { //Constructor: CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary) //Software - SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 30), - JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 72), - SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 40000, 150), - LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 200000, 450), + SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 33), + JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 80), + SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 40000, 165), + LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 200000, 500), //TODO Through darkweb, maybe? FreelanceDeveloper: new CompanyPosition("Freelance Developer", 0, 0, 0, 0, 0, 0, 0, 0), - SoftwareConsultant: new CompanyPosition("Software Consultant", 51, 0, 0, 0, 0, 0, 0, 60), - SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 120), + SoftwareConsultant: new CompanyPosition("Software Consultant", 51, 0, 0, 0, 0, 0, 0, 66), + SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 132), //IT - ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 24), - ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 7000, 60), - ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 35000, 120), - SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 175000, 375), - SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 35000, 110), - NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 35000, 110), - NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 175000, 375), + ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 26), + ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 7000, 66), + ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 35000, 132), + SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 175000, 410), + SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 35000, 121), + NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 35000, 121), + NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 175000, 410), //Technology management - HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 400000, 720), - HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 800000, 1500), - VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1600000, 2100), - CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 3200000, 2400), + HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 400000, 800), + HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 800000, 1650), + VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1600000, 2310), + CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 3200000, 2640), //Business - BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 42), - BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 90), - BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 40000, 180), - OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 200000, 600), - CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 800000, 1800), - CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 3200000, 3600), + BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 46), + BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 100), + BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 40000, 200), + OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 200000, 660), + CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 800000, 1950), + CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 3200000, 3900), - BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 80), - SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 480), + BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 88), + SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 525), //Non-tech/management jobs - PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 18), - PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 18), + PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 20), + PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 20), - Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 20), - Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 20), - PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 75), - PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 36000, 425), - SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 45), - SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 175), - SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 36000, 600), - HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 1200), - FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 300), - SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 201, 32000, 900), - SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 251, 162000, 1800), + Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 22), + Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 22), + PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 82), + PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 36000, 460), + SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 50), + SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 195), + SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 36000, 660), + HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 1320), + FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 330), + SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 201, 32000, 990), + SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 251, 162000, 2000), init: function() { //Argument order: hack, str, def, dex, agi, cha diff --git a/src/Constants.js b/src/Constants.js index d78348273..ebf1edc2f 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ let CONSTANTS = { - Version: "0.28.1", + Version: "0.29.0", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -58,8 +58,9 @@ let CONSTANTS = { ScriptScpRamCost: 0.5, ScriptKillRamCost: 0.5, //Kill and killall ScriptHasRootAccessRamCost: 0.05, - ScriptGetHostnameRamCost: 0.05, - ScriptGetHackingLevelRamCost: 0.05, + ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp() + ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() and getIntelligence() + ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers() ScriptGetServerCost: 0.1, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, @@ -86,9 +87,9 @@ let CONSTANTS = { //Server constants ServerBaseGrowthRate: 1.03, //Unadjusted Growth rate - ServerMaxGrowthRate: 1.0035, //Maximum possible growth rate (max rate accounting for server security) + ServerMaxGrowthRate: 1.0035, //Maximum possible growth rate (max rate accounting for server security) ServerFortifyAmount: 0.002, //Amount by which server's security increases when its hacked/grown - ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened + ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened PurchasedServerLimit: 25, @@ -112,6 +113,18 @@ let CONSTANTS = { //Hospital/Health HospitalCostPerHp: 100000, + //Intelligence-related constants + IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates + IntelligenceInfiltrationWeight: 0.1, //Weight for how much int affects infiltration success rates + IntelligenceCrimeBaseExpGain: 0.0002, + IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain + IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain + IntelligenceSingFnBaseExpGain: 0.0005, + + //Hacking Missions + HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty + HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward + //Gang constants GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain MaximumGangMembers: 20, @@ -231,8 +244,10 @@ let CONSTANTS = { "encounter diminishing returns in your hacking (since you are only hacking a certain percentage). You can " + "increase the amount of money on a server using a script and the grow() function in Netscript.

" + "

Server Security


" + - "Each server has a security level, which is denoted by a number between 1 and 100. A higher number means " + - "the server has stronger security. As mentioned above, a server's security level is an important factor " + + "Each server has a security level, typically between 1 and 100. A higher number means the server has stronger security. " + + "It is possible for a server to have a security level of 100 or higher, in which case hacking that server " + + "will become impossible (0% chance to hack).

" + + "As mentioned above, a server's security level is an important factor " + "to consider when hacking. You can check a server's security level using the 'analyze' command, although this " + "only gives an estimate (with 5% uncertainty). You can also check a server's security in a script, using the " + "getServerSecurityLevel(server) function in Netscript. See the Netscript documentation for more details. " + @@ -396,10 +411,13 @@ let CONSTANTS = { "there is no required hacking level to run the command. Returns " + "0.1. Works offline at a slower rate
Example: weaken('foodnstuff');

" + "print(x)
Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ).

" + - "tprint(x)
Prints a value or a variable to the Terminal

" + + "tprint(x)
Prints a value or a variable to the Terminal

" + "clearLog()
Clears the script's logs.

" + - "scan(hostname/ip)
Returns an array containing the hostnames of all servers that are one node away from the specified server. " + - "The argument must be a string containing the IP or hostname of the target server. The hostnames in the returned array are strings.

" + + "scan(hostname/ip, [hostnames=true])
Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " + + "The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " + + "the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " + + "This second argument is optional and, if ommitted, the function will output " + + "the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.

" + "nuke(hostname/ip)
Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline
Example: nuke('foodnstuff');

" + "brutessh(hostname/ip)
Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline
Example: brutessh('foodnstuff');

" + "ftpcrack(hostname/ip)
Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline
Example: ftpcrack('foodnstuff');

" + @@ -449,14 +467,66 @@ let CONSTANTS = { "kill('foo.script', getHostname(), 1, 'foodnstuff');

" + "killall(hostname/ip)
Kills all running scripts on the specified server. This function takes a single argument which " + "must be a string containing the hostname or IP of the target server. This function will always return true.

" + - "scp(script, hostname/ip)
Copies a script to another server. The first argument is a string with the filename of the script " + - "to be copied. The second argument is a string with the hostname or IP of the destination server. Returns true if the script is successfully " + - "copied over and false otherwise.
Example: scp('hack-template.script', 'foodnstuff');

" + + "scp(script, [source], destination)
Copies a script or literature (.lit) file to another server. The first argument is a string with " + + "the filename of the script or literature file " + + "to be copied. The next two arguments are strings containing the hostname/IPs of the source and target server. " + + "The source refers to the server from which the script/literature file will be copied, while the destination " + + "refers to the server to which it will be copied. The source server argument is optional, and if ommitted the source " + + "will be the current server (the server on which the script is running). Returns true if the script/literature file is " + + "successfully copied over and false otherwise.

" + + "Example: scp('hack-template.script', 'foodnstuff'); //Copies hack-template.script from the current server to foodnstuff
" + + "Example: scp('foo.lit', 'helios', 'home'); //Copies foo.lit from the helios server to the home computer

" + + "ls(hostname/ip)
Returns an array containing the names of all files on the specified server. The argument must be a " + + "string with the hostname or IP of the target server.

" + "hasRootAccess(hostname/ip)
Returns a boolean (true or false) indicating whether or not the Player has root access to a server. " + "The argument passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline.
" + "Example:
if (hasRootAccess('foodnstuff') == false) {
    nuke('foodnstuff');
}

" + + "getIp()
Returns a string with the IP Address of the server that the script is running on

" + "getHostname()
Returns a string with the hostname of the server that the script is running on

" + - "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline

" + + "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline

" + + "getIntelligence()
Returns the Player's current intelligence level. Requires Source-File 5 to run

" + + "getHackingMultipliers()
Returns an object containing the Player's hacking related multipliers. " + + "These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " + + "The object has the following structure:

" + + "{
" + + "chance: Player's hacking chance multiplier
" + + "speed: Player's hacking speed multiplier
" + + "money: Player's hacking money stolen multiplier
" + + "growth: Player's hacking growth multiplier
" + + "}

Example:

" + + "mults = getHackingMultipliers();
" + + "print(mults.chance);
" + + "print(mults.growth);

" + + "getBitNodeMultipliers()
Returns an object containing the current BitNode multipliers. " + + "This function requires Source-File 5 in order to run. The multipliers are returned in integer forms, not percentages " + + "(e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the " + + "original BitNode (BitNode-1). For example, if the 'CrimeMoney' multiplier has a value of 0.1 then that means " + + "that committing crimes in the current BitNode will only give 10% of the money you would have received in " + + "BitNode-1. The object has the following structure (subject to change in the future):

" + + "{
" + + "ServerMaxMoney: 1,
" + + "ServerStartingMoney: 1,
" + + "ServerGrowthRate: 1,
" + + "ServerWeakenRate: 1,
" + + "ServerStartingSecurity: 1,
" + + "ManualHackMoney: 1,
" + + "ScriptHackMoney: 1,
" + + "CompanyWorkMoney: 1,
" + + "CrimeMoney: 1,
" + + "HacknetNodeMoney: 1,
" + + "CompanyWorkExpGain: 1,
" + + "ClassGymExpGain: 1,
" + + "FactionWorkExpGain: 1,
" + + "HackExpGain: 1,
" + + "CrimeExpGain: 1,
" + + "FactionWorkRepGain: 1,
" + + "FactionPassiveRepGain: 1,
" + + "AugmentationRepCost: 1,
" + + "AugmentationMoneyCost: 1,
" + + "}

Example:

" + + "mults = getBitNodeMultipliers();
" + + "print(mults.ServerMaxMoney);
" + + "print(mults.HackExpGain);

" + "getServerMoneyAvailable(hostname/ip)
Returns the amount of money available on a server. The argument passed in must be a string with either the " + "hostname or IP of the target server. Does NOT work while offline
Example: getServerMoneyAvailable('foodnstuff');

" + "getServerMaxMoney(hostname/ip)
Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " + @@ -479,6 +549,8 @@ let CONSTANTS = { "getServerRam(hostname/ip)
Returns an array with two elements that gives information about the target server's RAM. The first " + "element in the array is the amount of RAM that the server has (in GB). The second element in the array is the amount of RAM that " + "is currently being used on the server.

" + + "serverExists(hostname/ip)
Returns a boolean denoting whether or not the specified server exists. The argument " + + "must be a string with the hostname or IP of the target server.

" + "fileExists(filename, [hostname/ip])
Returns a boolean (true or false) indicating whether the specified file exists on a server. " + "The first argument must be a string with the name of the file. A file can either be a script or a program. A script name is case-sensitive, but a " + "program is not. For example, fileExists('brutessh.exe') will work fine, even though the actual program is named BruteSSH.exe.

" + @@ -508,9 +580,10 @@ let CONSTANTS = { "but it will be converted to a string using Javascript's String function. Anything that resolves to an empty string will cause the function to fail. " + "The second argument specified the amount of RAM (in GB) for the server. This argument must resolve to a numeric and it must be a power of 2 " + "(2, 4, 8, etc...).

" + - "Purchasing a server using this Netscript function is twice as expensive as manually purchasing a server from a location in the World.

" + "This function returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return " + "an empty string. The function will fail if the arguments passed in are invalid or if the player does not have enough money to purchase the specified server.

" + + "deleteServer(hostname)
Deletes one of the servers you've purchased with the specified hostname. The function will fail if " + + "there are any scripts running on the specified server. Returns true if successful and false otherwise

" + "round(n)
Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.

" + "write(port, data)
Writes data to a port. The first argument must be a number between 1 and 10 that specifies the port. The second " + "argument defines the data to write to the port. If the second argument is not specified then it will write an empty string to the port.

" + @@ -534,21 +607,46 @@ let CONSTANTS = { "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.

" + "getWeakenTime(hostname/ip)
Returns the amount of time in seconds it takes to execute the weaken() Netscript function " + "on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.

" + + "getScriptIncome([scriptname], [hostname/ip], [args...])
" + + "Returns the amount of income the specified script generates while online (when the game is open, does not apply for " + + "offline income). This function can also return the total income of all of your active scripts by running the function " + + "with no arguments.

" + + "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " + + "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " + + "specify those arguments in this function call.

" + + "The first argument, if specified, must be a string with the name of the script (including the .script extension). " + + "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " + + "then the second argument must be specified as well. Any additional arguments passed to the function will specify " + + "the arguments passed into the target script.

" + + "getScriptExpGain([scriptname], [hostname/ip], [args...])
" + + "Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for " + + "offline experience gains). This function can also return the total experience gain rate of all of your active scripts by running the function " + + "with no arguments.

" + + "Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script " + + "with the arguments 'foodnstuff' and '5' then in order to use this function to get that script's income you must " + + "specify those arguments in this function call.

" + + "The first argument, if specified, must be a string with the name of the script (including the .script extension). " + + "The second argument must be a string with the hostname/IP of the target server. If the first argument is specified " + + "then the second argument must be specified as well. Any additional arguments passed to the function will specify " + + "the arguments passed into the target script.

" + "

Hacknet Nodes API


" + "Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.

" + "hacknetnodes
A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " + "indexes. These indexes correspond to the number at the end of the name of the Hacknet Node. For example, the first Hacknet Node you purchase " + "will have the same 'hacknet-node-0' and can be accessed with hacknetnodes[0]. The fourth Hacknet Node you purchase will have the name " + "'hacknet-node-3' and can be accessed with hacknetnodes[3].

" + - "hacknetnodes.length
Returns the number of Hacknet Nodes that the player owns

" + - "hacknetnodes[i].level
Returns the level of the corresponding Hacknet Node

" + - "hacknetnodes[i].ram
Returns the amount of RAM on the corresponding Hacknet Node

" + - "hacknetnodes[i].cores
Returns the number of cores on the corresponding Hacknet Node

" + - "hacknetnodes[i].upgradeLevel(n)
Tries to upgrade the level of the corresponding Hacknet Node n times. The argument n must be a " + + "hacknetnodes.length
Returns the number of Hacknet Nodes that the player owns

" + + "hacknetnodes[i].level
Returns the level of the corresponding Hacknet Node

" + + "hacknetnodes[i].ram
Returns the amount of RAM on the corresponding Hacknet Node

" + + "hacknetnodes[i].cores
Returns the number of cores on the corresponding Hacknet Node

" + + "hacknetnodes[i].totalMoneyGenerated
Returns the total amount of money that the corresponding Hacknet Node has earned

" + + "hacknetnodes[i].onlineTimeSeconds
Returns the total amount of time that the corresponding Hacknet Node has existed

" + + "hacknetnodes[i].moneyGainRatePerSecond
Returns the income ($ / sec) that the corresponding Hacknet Node earns

" + + "hacknetnodes[i].upgradeLevel(n)
Tries to upgrade the level of the corresponding Hacknet Node n times. The argument n must be a " + "positive integer. Returns true if the Hacknet Node's level is successfully upgraded n times or up to the max level (200), and false otherwise.

" + - "hacknetnodes[i].upgradeRam()
Tries to upgrade the amount of RAM on the corresponding Hacknet Node. Returns true if the " + + "hacknetnodes[i].upgradeRam()
Tries to upgrade the amount of RAM on the corresponding Hacknet Node. Returns true if the " + "RAM is successfully upgraded, and false otherwise.

" + - "hacknetnodes[i].upgradeCore()
Attempts to purchase an additional core for the corresponding Hacknet Node. Returns true if the " + + "hacknetnodes[i].upgradeCore()
Attempts to purchase an additional core for the corresponding Hacknet Node. Returns true if the " + "additional core is successfully purchase, and false otherwise.

" + "Example: The following is an example of one way a script can be used to automate the purchasing and upgrading of Hacknet Nodes. " + "This script purchases new Hacknet Nodes until the player has four. Then, it iteratively upgrades each of those four Hacknet Nodes " + @@ -859,14 +957,20 @@ let CONSTANTS = { "World Stock Exchange account and TIX API Access
", LatestUpdate: - "v0.28.1
" + - "-The script editor now uses the open-source Ace editor, which provides a much better experience when coding!
" + - "-Added tprint() Netscript function

" + - "v0.28.0
" + - "-Added BitNode-4: The Singularity
" + - "-Added BitNode-11: The Big Crash
" + - "-Migrated the codebase to use webpack (doesn't affect any in game content, except maybe some slight " + - "performance improvements and there may be bugs that result from dependency errors)" + "v0.29.0
" + + "-Added BitNode-5: Artificial Intelligence
" + + "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)
" + + "-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames
" + + "-Refactored scp() Netscript function so that it takes an optional 'source server' argument
" + + "-For Infiltration, decreased the percentage by which the security level increases by " + + "about 10% for every location
" + + "-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal
" + + "-Some minor optimizations that should reduce the size of the save file
" + + "-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command
" + + "-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " + + "will now repeatedly pop up regardless of whether or not you have messages suppressed
" + + "-Various bugfixes", + } export {CONSTANTS}; diff --git a/src/CreateProgram.js b/src/CreateProgram.js index a1523ed08..a442662c2 100644 --- a/src/CreateProgram.js +++ b/src/CreateProgram.js @@ -134,7 +134,12 @@ function getNumAvailableCreateProgram() { if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) { ++count; } - if (count > 0) {Player.firstProgramAvailable = true;} + if (Player.firstProgramAvailable === false && count > 0) { + Player.firstProgramAvailable = true; + document.getElementById("create-program-tab").style.display = "list-item"; + document.getElementById("hacking-menu-header").click(); + document.getElementById("hacking-menu-header").click(); + } return count; } diff --git a/src/Crimes.js b/src/Crimes.js index 77c0b3f8b..524b1f581 100644 --- a/src/Crimes.js +++ b/src/Crimes.js @@ -110,99 +110,113 @@ function determineCrimeSuccess(crime, moneyGained) { } } +let intWgt = CONSTANTS.IntelligenceCrimeWeight; +let maxLvl = CONSTANTS.MaxSkillLevel; + function determineCrimeChanceShoplift() { - var chance = ((Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) * 20; + var chance = (Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) * 20; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceRobStore() { - var chance = ((0.5 * Player.hacking_skill / CONSTANTS.MaxSkillLevel + - 2 * Player.dexterity / CONSTANTS.MaxSkillLevel + - 1 * Player.agility / CONSTANTS.MaxSkillLevel)) * 5; + var chance = (0.5 * Player.hacking_skill / maxLvl + + 2 * Player.dexterity / maxLvl + + 1 * Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) * 5; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceMug() { - var chance = ((1.5 * Player.strength / CONSTANTS.MaxSkillLevel + - 0.5 * Player.defense / CONSTANTS.MaxSkillLevel + - 1.5 * Player.dexterity / CONSTANTS.MaxSkillLevel + - 0.5 * Player.agility / CONSTANTS.MaxSkillLevel)) * 5; + var chance = (1.5 * Player.strength / maxLvl + + 0.5 * Player.defense / maxLvl + + 1.5 * Player.dexterity / maxLvl + + 0.5 * Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) * 5; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceLarceny() { - var chance = ((0.5 * Player.hacking_skill / CONSTANTS.MaxSkillLevel + - Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) * 3; + var chance = (0.5 * Player.hacking_skill / maxLvl + + Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) * 3; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceDealDrugs() { - var chance = ((3*Player.charisma / CONSTANTS.MaxSkillLevel + - 2*Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)); + var chance = (3*Player.charisma / maxLvl + + 2*Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl); chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceTraffickArms() { - var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel + - Player.strength / CONSTANTS.MaxSkillLevel + - Player.defense / CONSTANTS.MaxSkillLevel + - Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) / 2; + var chance = (Player.charisma / maxLvl + + Player.strength / maxLvl + + Player.defense / maxLvl + + Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) / 2; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceHomicide() { - var chance = ((2 * Player.strength / CONSTANTS.MaxSkillLevel + - 2 * Player.defense / CONSTANTS.MaxSkillLevel + - 0.5 * Player.dexterity / CONSTANTS.MaxSkillLevel + - 0.5 * Player.agility / CONSTANTS.MaxSkillLevel)); + var chance = (2 * Player.strength / maxLvl + + 2 * Player.defense / maxLvl + + 0.5 * Player.dexterity / maxLvl + + 0.5 * Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl); chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceGrandTheftAuto() { - var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel + - Player.strength / CONSTANTS.MaxSkillLevel + - 4 * Player.dexterity / CONSTANTS.MaxSkillLevel + - 2 * Player.agility / CONSTANTS.MaxSkillLevel + - 2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8; + var chance = (Player.hacking_skill / maxLvl + + Player.strength / maxLvl + + 4 * Player.dexterity / maxLvl + + 2 * Player.agility / maxLvl + + 2 * Player.charisma / maxLvl + + intWgt * Player.intelligence / maxLvl) / 8; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceKidnap() { - var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel + - Player.strength / CONSTANTS.MaxSkillLevel + - Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) / 5; + var chance = (Player.charisma / maxLvl + + Player.strength / maxLvl + + Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) / 5; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceAssassination() { - var chance = ((Player.strength / CONSTANTS.MaxSkillLevel + - 2 * Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel)) / 8; + var chance = (Player.strength / maxLvl + + 2 * Player.dexterity / maxLvl + + Player.agility / maxLvl + + intWgt * Player.intelligence / maxLvl) / 8; chance *= Player.crime_success_mult; return Math.min(chance, 1); } function determineCrimeChanceHeist() { - var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel + - Player.strength / CONSTANTS.MaxSkillLevel + - Player.defense / CONSTANTS.MaxSkillLevel + - Player.dexterity / CONSTANTS.MaxSkillLevel + - Player.agility / CONSTANTS.MaxSkillLevel + - Player.charisma / CONSTANTS.MaxSkillLevel)) / 18; + var chance = (Player.hacking_skill / maxLvl + + Player.strength / maxLvl + + Player.defense / maxLvl + + Player.dexterity / maxLvl + + Player.agility / maxLvl + + Player.charisma / maxLvl + + intWgt * Player.intelligence / maxLvl) / 18; chance *= Player.crime_success_mult; return Math.min(chance, 1); } diff --git a/src/DarkWeb.js b/src/DarkWeb.js index 197088f9b..54e666075 100644 --- a/src/DarkWeb.js +++ b/src/DarkWeb.js @@ -3,6 +3,7 @@ import {Player} from "./Player.js"; import {SpecialServerIps} from "./SpecialServerIps.js"; import {post} from "./Terminal.js"; +import {isValidIPAddress} from "../utils/IPAddress.js"; import {formatNumber} from "../utils/StringHelperFunctions.js"; diff --git a/src/Faction.js b/src/Faction.js index 3708b31b4..e82f618a0 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -766,7 +766,10 @@ function displayFactionContent(factionName) { } function displayFactionAugmentations(factionName) { - document.getElementById("faction-augmentations-page-desc").innerHTML = "Lists all augmentations that are available to purchase from " + factionName; + document.getElementById("faction-augmentations-page-desc").innerHTML = + "Lists all Augmentations that are available to purchase from " + factionName + "

" + + "Augmentations are powerful upgrades that will enhance your abilities."; + var faction = Factions[factionName]; var augmentationsList = document.getElementById("faction-augmentations-list"); @@ -849,7 +852,7 @@ function purchaseAugmentationBoxCreate(aug, fac) { yesNoBoxClose(); }); - yesNoBoxCreate("

aug.name


" + + yesNoBoxCreate("

" + aug.name + "


" + aug.info + "

" + "
Would you like to purchase the " + aug.name + " Augmentation for $" + formatNumber(aug.baseCost * fac.augmentationPriceMult, 2) + "?"); @@ -908,7 +911,12 @@ function purchaseAugmentation(aug, fac, sing=false) { var txt = "You must first install the Bionic Arms augmentation before installing this upgrade"; if (sing) {return txt;} else {dialogBoxCreate(txt);} } else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) { - Player.firstAugPurchased = true; + if (Player.firstAugPurchased === false) { + Player.firstAugPurchased = true; + document.getElementById("augmentations-tab").style.display = "list-item"; + document.getElementById("character-menu-header").click(); + document.getElementById("character-menu-header").click(); + } var queuedAugmentation = new PlayerOwnedAugmentation(aug.name); if (aug.name == AugmentationNames.NeuroFluxGovernor) { diff --git a/src/Gang.js b/src/Gang.js index c342ca88d..7d070c2e5 100644 --- a/src/Gang.js +++ b/src/Gang.js @@ -130,7 +130,7 @@ function processAllGangPowerGains(numCycles=1) { if (name == playerGangName) { AllGangs[name].power += Player.gang.calculatePower(); } else { - var gain = Math.random() * 0.01; //TODO Adjust as necessary + var gain = Math.random() * 0.02; //TODO Adjust as necessary AllGangs[name].power += (gain); } } @@ -235,8 +235,12 @@ Gang.prototype.processGains = function(numCycles=1) { console.log("ERROR: respectGains is NaN"); } if (!isNaN(wantedLevelGains)) { - this.wanted += (wantedLevelGains * this.storedCycles); - if (this.wanted < 1) {this.wanted = 1;} + if (this.wanted === 1 && wantedLevelGains < 0) { + //Do nothing + } else { + this.wanted += (wantedLevelGains * this.storedCycles); + if (this.wanted < 1) {this.wanted = 1;} + } } else { console.log("ERROR: wantedLevelGains is NaN"); } diff --git a/src/HacknetNode.js b/src/HacknetNode.js index dd8e68ec8..4392a3a2e 100644 --- a/src/HacknetNode.js +++ b/src/HacknetNode.js @@ -92,7 +92,7 @@ HacknetNode.prototype.getLevelUpgradeCost = function(levels=1) { HacknetNode.prototype.purchaseLevelUpgrade = function(levels=1) { var cost = this.calculateLevelUpgradeCost(levels); - if (isNaN(cost)) {return false;} + if (isNaN(cost) || levels < 0) {return false;} if (this.level + levels > CONSTANTS.HacknetNodeMaxLevel) { var diff = Math.max(0, CONSTANTS.HacknetNodeMaxLevel - this.level); return this.purchaseLevelUpgrade(diff); @@ -442,7 +442,7 @@ function updateHacknetNodeDomElement(nodeObj) { upgradeRamButton.setAttribute("class", "a-link-button-inactive"); } else { var upgradeRamCost = nodeObj.calculateRamUpgradeCost(); - upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + formatNumber(upgradeRamCost, 2); + upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM - $" + formatNumber(upgradeRamCost, 2); if (Player.money.lt(upgradeRamCost)) { upgradeRamButton.setAttribute("class", "a-link-button-inactive"); } else { diff --git a/src/HelpText.js b/src/HelpText.js index d74e13f8f..6a43cbed8 100644 --- a/src/HelpText.js +++ b/src/HelpText.js @@ -24,7 +24,7 @@ let TerminalHelpText = "rm [file] Delete a file from the server
" + "run [name] [-t] [n] [args...] Execute a program or script
" + "scan Prints all immediately-available network connections
" + - "scan-analyze [d] Prints info for all servers up to d nodes away
" + + "scan-analyze [d] [-a] Prints info for all servers up to d nodes away
" + "scp [file] [server] Copies a script or .lit file to a destination server
" + "sudov Shows whether you have root access on this computer
" + "tail [script] [args...] Displays dynamic logs for the specified script
" + @@ -153,7 +153,7 @@ let HelpTexts = { scan: "scan
" + "Prints all immediately-available network connection. This will print a list of all servers that you can currently connect " + "to using the 'connect' Terminal command.", - "scan-analyze": "scan-analyze [depth]
" + + "scan-analyze": "scan-analyze [depth] [-a]
" + "Prints detailed information about all servers up to [depth] nodes away on the network. Calling " + "'scan-analyze 1' will display information for the same servers that are shown by the 'scan' Terminal " + "command. This command also shows the relative paths to reach each server.

" + @@ -162,7 +162,9 @@ let HelpTexts = { "5 and 10, respectively.

" + "The information 'scan-analyze' displays about each server includes whether or not you have root access to it, " + "its required hacking level, the number of open ports required to run NUKE.exe on it, and how much RAM " + - "it has", + "it has.

" + + "By default, this command will not display servers that you have purchased. However, you can pass in the " + + "-a flag at the end of the command if you would like to enable that.", scp: "scp [filename] [target server]
" + "Copies the specified file from the current server to the target server. " + "This command only works for script files (.script extension) and literature files (.lit extension). " + diff --git a/src/Infiltration.js b/src/Infiltration.js index 238dee3d6..9fcfab7dd 100644 --- a/src/Infiltration.js +++ b/src/Infiltration.js @@ -441,7 +441,7 @@ function updateInfiltrationLevelText(inst) { var totalValue = 0; var totalMoneyValue = 0; for (var i = 0; i < inst.secretsStolen.length; ++i) { - totalValue += inst.secretsStolen[i]; + totalValue += (inst.secretsStolen[i] * Player.faction_rep_mult * 1.25); totalMoneyValue += inst.secretsStolen[i] * CONSTANTS.InfiltrationMoneyValue; } document.getElementById("infiltration-level-text").innerHTML = @@ -577,6 +577,7 @@ function updateInfiltrationButtons(inst, scenario) { } } +let intWgt = CONSTANTS.IntelligenceInfiltrationWeight; //Kill //Success: 5%, Failure 10%, -Karma @@ -649,7 +650,8 @@ function getInfiltrationStealthKnockoutChance(inst) { return Math.min(0.95, (0.5 * Player.strength + 2 * Player.dexterity + - 2 * Player.agility) / (3 * lvl)); + 2 * Player.agility + + intWgt * Player.intelligence) / (3 * lvl)); } //Assassination @@ -671,7 +673,8 @@ function getInfiltrationAssassinateChance(inst) { var lvl = inst.securityLevel; return Math.min(0.95, (Player.dexterity + - 0.5 * Player.agility) / (2 * lvl)); + 0.5 * Player.agility + + intWgt * Player.intelligence) / (2 * lvl)); } @@ -720,7 +723,8 @@ function attemptInfiltrationHack(inst) { function getInfiltrationHackChance(inst) { var lvl = inst.securityLevel; return Math.min(0.95, - (Player.hacking_skill) / lvl); + (Player.hacking_skill + + (intWgt * Player.intelligence)) / lvl); } //Sneak past security @@ -740,7 +744,8 @@ function getInfiltrationSneakChance(inst) { var lvl = inst.securityLevel; return Math.min(0.95, (Player.agility + - 0.5 * Player.dexterity) / (2 * lvl)); + 0.5 * Player.dexterity + + intWgt * Player.intelligence) / (2 * lvl)); } //Pick locked door @@ -760,7 +765,8 @@ function attemptInfiltrationPickLockedDoor(inst) { function getInfiltrationPickLockedDoorChance(inst) { var lvl = inst.securityLevel; return Math.min(0.95, - (Player.dexterity) / lvl); + (Player.dexterity + + intWgt * Player.intelligence) / lvl); } //Bribe @@ -800,7 +806,8 @@ function getInfiltrationEscapeChance(inst) { var lvl = inst.securityLevel; return Math.min(0.95, (2 * Player.agility + - Player.dexterity) / lvl); + Player.dexterity + + intWgt * Player.intelligence) / lvl); } export {beginInfiltration}; diff --git a/src/InteractiveTutorial.js b/src/InteractiveTutorial.js index 665f560d6..3bbd431ad 100644 --- a/src/InteractiveTutorial.js +++ b/src/InteractiveTutorial.js @@ -73,7 +73,7 @@ function iTutorialEvaluateStep() { iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " + "The game takes place in a dark, dystopian future...The year is 2077...

" + - "This tutorial will show you the basics of the game to help you get started. " + + "This tutorial will show you the basics of the game. " + "You may skip the tutorial at any time."); var next = clearEventListeners("interactive-tutorial-next"); next.style.display = "inline-block"; @@ -114,7 +114,7 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.CharacterGoToTerminalPage: iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " + - "main navigation menu"); + "main navigation menu."); //No next button var next = clearEventListeners("interactive-tutorial-next"); next.style.display = "none"; @@ -132,8 +132,7 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.TerminalIntro: iTutorialSetText("The Terminal is used to interface with your home computer as well as " + - "all of the other machines around the world. A lot of content in the game is " + - "accessible only through the Terminal, and is necessary for progressing. "); + "all of the other machines around the world."); var next = clearEventListeners("interactive-tutorial-next"); next.style.display = "inline-block"; next.addEventListener("click", function() { @@ -149,14 +148,14 @@ function iTutorialEvaluateStep() { //next step triggered by terminal command break; case iTutorialSteps.TerminalLs: - iTutorialSetText("The 'help' command displays a list of all available commands, how to use them, " + + iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " + "and a description of what they do.

Let's try another command. Enter the 'ls' command"); //next step triggered by terminal command break; case iTutorialSteps.TerminalScan: iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " + "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " + - "We'll get to what this does later.

Through your home computer's terminal, you can connect " + + "We'll get to what this does later.

Using your home computer's terminal, you can connect " + "to other machines throughout the world. Let's do that now by first entering " + "the 'scan' command. "); //next step triggered by terminal command @@ -197,7 +196,7 @@ function iTutorialEvaluateStep() { case iTutorialSteps.TerminalNuke: iTutorialSetText("When the 'analyze' command finishes running it will show useful information " + "about hacking the server.

For this server, the required hacking skill is only 1, " + - "which means you are able to hack it right now. However, in order to hack a server " + + "which means you can hack it right now. However, in order to hack a server " + "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " + "home computer is a virus that will grant you root access to a machine if there are enough " + "open ports.

The 'analyze' results shows that there do not need to be any open ports " + @@ -207,19 +206,19 @@ function iTutorialEvaluateStep() { break; case iTutorialSteps.TerminalManualHack: iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " + - "Try doing that now. "); + "Try doing that now."); //next step triggered by terminal command break; case iTutorialSteps.TerminalHackingMechanics: iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " + "only has a certain percentage chance " + "of success. This time and success chance is determined by a variety of factors, including " + - "your hacking skill and the server's security level.

" + + "your hacking skill and the server's security level.

" + "If your attempt to hack the server is successful, you will steal a certain percentage " + "of the server's total money. This percentage is affected by your hacking skill and " + - "the server's security level.

The amount of money on a server is not limitless. So, if " + + "the server's security level.

The amount of money on a server is not limitless. So, if " + "you constantly hack a server and deplete its money, then you will encounter " + - "diminishing returns in your hacking.
"); + "diminishing returns in your hacking."); var next = clearEventListeners("interactive-tutorial-next"); next.style.display = "inline-block"; next.addEventListener("click", function() { @@ -230,7 +229,7 @@ function iTutorialEvaluateStep() { case iTutorialSteps.TerminalCreateScript: iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " + "you don't want to be hacking manually the entire time. You can automate your hacking " + - "by writing scripts!

To create a new script or edit an existing one, you can use the 'nano' " + + "by writing scripts!

To create a new script or edit an existing one, you can use the 'nano' " + "command. Scripts must end with the '.script' extension. Let's make a script now by " + "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" + " will end a command like hack early)"); @@ -249,14 +248,14 @@ function iTutorialEvaluateStep() { "  hack('foodnstuff');
" + "}

" + "For anyone with basic programming experience, this code should be straightforward. " + - "This script will continuously hack the 'foodnstuff' server.

" + + "This script will continuously hack the 'foodnstuff' server.

" + "To save and close the script editor, press the button in the bottom left, or press ctrl + b."); //next step triggered in saveAndCloseScriptEditor() (Script.js) break; case iTutorialSteps.TerminalFree: iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " + "run on any machine which you have root access to. Different servers have different " + - "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + + "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + "RAM is available on this machine, enter the 'free' command."); //next step triggered by terminal commmand break; @@ -272,8 +271,8 @@ function iTutorialEvaluateStep() { "runs an infinite loop).

These scripts can passively earn you income and hacking experience. " + "Your scripts will also earn money and experience while you are offline, although at a " + "much slower rate.

" + - "Let's check out some statistics of our active, running scripts by clicking the " + - "'Active Scripts' link in the main navigation menu. "); + "Let's check out some statistics for our running scripts by clicking the " + + "'Active Scripts' link in the main navigation menu."); document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button"); var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link"); activeScriptsMainMenuButton.addEventListener("click", function() { @@ -342,7 +341,7 @@ function iTutorialEvaluateStep() { iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " + "earn you money over time, both online and offline. When you get enough " + " money, you can upgrade " + - "your newly-purchased Hacknet Node below.

" + + "your newly-purchased Hacknet Node below.

" + "Let's go to the 'City' page through the main navigation menu."); document.getElementById("city-menu-link").setAttribute("class", "flashing-button"); var worldButton = clearEventListeners("city-menu-link"); diff --git a/src/Location.js b/src/Location.js index 6153b8a3d..76616c991 100644 --- a/src/Location.js +++ b/src/Location.js @@ -120,7 +120,7 @@ function displayLocationContent() { console.log("displayLocationContent() called with location " + Player.location) } - var returnToWorld = document.getElementById("location-return-to-world-button"); + var returnToWorld = document.getElementById("location-return-to-world-button"); var locationName = document.getElementById("location-name"); @@ -304,7 +304,7 @@ function displayLocationContent() { //Check if the player is employed at this Location. If he is, display the "Work" button, //update the job title, etc. - if (loc == Player.companyName) { + if (loc != "" && loc === Player.companyName) { var company = Companies[loc]; jobTitle.style.display = "block"; @@ -420,7 +420,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumECorp, - 6000, 116, 150, 9.5); + 6000, 116, 150, 8.5); break; case Locations.AevumBachmanAndAssociates: @@ -433,7 +433,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates, - 1500, 42, 60, 6.5); + 1500, 42, 60, 5.75); break; case Locations.AevumClarkeIncorporated: @@ -446,7 +446,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated, - 2400, 34, 75, 6); + 2400, 34, 75, 5.4); break; case Locations.AevumFulcrumTechnologies: @@ -465,7 +465,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies, - 6000, 96, 100, 10); + 6000, 96, 100, 9); break; case Locations.AevumAeroCorp: @@ -477,7 +477,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumAeroCorp, - 2000, 32, 50, 7); + 2000, 32, 50, 6.3); break; case Locations.AevumGalacticCybersystems: @@ -490,7 +490,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems, - 1400, 30, 50, 6); + 1400, 30, 50, 5.3); break; case Locations.AevumWatchdogSecurity: @@ -504,7 +504,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity, - 850, 16, 30, 5); + 850, 16, 30, 4.5); break; case Locations.AevumRhoConstruction: @@ -513,7 +513,7 @@ function displayLocationContent() { softwareJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction, - 600, 12, 20, 3); + 600, 12, 20, 2.7); break; case Locations.AevumPolice: @@ -522,7 +522,7 @@ function displayLocationContent() { softwareJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumPolice, - 700, 14, 25, 3.5); + 700, 14, 25, 3.2); break; case Locations.AevumNetLinkTechnologies: @@ -540,7 +540,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies, - 160, 10, 15, 2); + 160, 10, 15, 1.8); break; case Locations.AevumCrushFitnessGym: @@ -574,7 +574,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational, - 5500, 48, 100, 10); + 5500, 48, 100, 9); break; case Locations.ChongqingSolarisSpaceSystems: @@ -586,7 +586,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems, - 3600, 26, 75, 9.5); + 3600, 26, 75, 8.6); break; @@ -615,7 +615,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp, - 6000, 114, 125, 11); + 6000, 114, 125, 9.8); break; case Locations.Sector12BladeIndustries: @@ -628,7 +628,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries, - 3000, 46, 100, 7.5); + 3000, 46, 100, 6.7); break; case Locations.Sector12FourSigma: @@ -641,7 +641,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12FourSigma, - 1500, 58, 100, 11.5); + 1500, 58, 100, 10.2); break; case Locations.Sector12IcarusMicrosystems: @@ -654,7 +654,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems, - 900, 32, 70, 8.5); + 900, 32, 70, 7.8); break; case Locations.Sector12UniversalEnergy: @@ -667,7 +667,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy, - 775, 24, 50, 7); + 775, 24, 50, 6.3); break; case Locations.Sector12DeltaOne: @@ -679,7 +679,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne, - 1200, 38, 75, 7); + 1200, 38, 75, 6.3); break; case Locations.Sector12CIA: @@ -692,7 +692,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12CIA, - 1450, 44, 80, 8.5); + 1450, 44, 80, 7.6); break; case Locations.Sector12NSA: @@ -705,7 +705,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12NSA, - 1400, 40, 80, 8); + 1400, 40, 80, 7.2); break; case Locations.Sector12AlphaEnterprises: @@ -719,7 +719,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises, - 250, 14, 40, 3); + 250, 14, 40, 2.7); break; case Locations.Sector12CarmichaelSecurity: @@ -733,7 +733,7 @@ function displayLocationContent() { securityJob.style.display = "block"; agentJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity, - 500, 18, 60, 3); + 500, 18, 60, 2.7); break; case Locations.Sector12FoodNStuff: @@ -749,7 +749,7 @@ function displayLocationContent() { employeeJob.style.display = "block"; employeePartTimeJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns, - 120, 8, 20, 2.5); + 120, 8, 20, 2.2); break; case Locations.Sector12IronGym: @@ -782,7 +782,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm, - 1300, 28, 70, 6); + 1300, 28, 70, 5.4); break; case Locations.NewTokyoVitaLife: @@ -795,7 +795,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife, - 750, 22, 100, 5.5); + 750, 22, 100, 5); break; case Locations.NewTokyoGlobalPharmaceuticals: @@ -809,7 +809,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals, - 900, 24, 80, 6); + 900, 24, 80, 5.4); break; case Locations.NewTokyoNoodleBar: @@ -848,7 +848,7 @@ function displayLocationContent() { purchase256gb.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies, - 700, 24, 100, 6.5); + 700, 24, 100, 5.9); break; case Locations.IshimaNovaMedical: @@ -861,7 +861,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical, - 600, 20, 50, 5); + 600, 20, 50, 4.5); break; case Locations.IshimaOmegaSoftware: @@ -879,7 +879,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware, - 200, 10, 40, 2.5); + 200, 10, 40, 2.3); break; case Locations.VolhavenTravelAgency: @@ -912,7 +912,7 @@ function displayLocationContent() { purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated, - 1500, 44, 100, 7); + 1500, 44, 100, 6.3); break; case Locations.VolhavenNWO: @@ -925,7 +925,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenNWO, - 1800, 56, 200, 8); + 1800, 56, 200, 7.2); break; case Locations.VolhavenHeliosLabs: @@ -937,7 +937,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs, - 1200, 28, 75, 6); + 1200, 28, 75, 5.4); break; case Locations.VolhavenOmniaCybersystems: @@ -949,7 +949,7 @@ function displayLocationContent() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems, - 900, 28, 90, 6.5); + 900, 28, 90, 5.8); break; case Locations.VolhavenLexoCorp: @@ -963,7 +963,7 @@ function displayLocationContent() { businessJob.style.display = "block"; securityJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp, - 500, 14, 40, 3.5); + 500, 14, 40, 3.1); break; case Locations.VolhavenSysCoreSecurities: @@ -974,7 +974,7 @@ function displayLocationContent() { securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities, - 600, 16, 50, 4); + 600, 16, 50, 3.6); break; case Locations.VolhavenCompuTek: @@ -995,7 +995,7 @@ function displayLocationContent() { purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek, - 300, 12, 35, 3.5); + 300, 12, 35, 3.1); break; case Locations.VolhavenMilleniumFitnessGym: @@ -1840,7 +1840,13 @@ function initLocationButtons() { } function travelToCity(destCityName, cost) { - Player.firstTimeTraveled = true; + if (Player.firstTimeTraveled === false) { + Player.firstTimeTraveled = true; + document.getElementById("travel-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } + if (Player.money.lt(cost)) { dialogBoxCreate("You cannot afford to travel to " + destCityName); return; diff --git a/src/Message.js b/src/Message.js index 6404e6e3a..9ed99d3b4 100644 --- a/src/Message.js +++ b/src/Message.js @@ -4,7 +4,7 @@ import {Programs} from "./CreateProgram.js"; import {Player} from "./Player.js"; import {GetServerByHostname} from "./Server.js"; import {Settings} from "./Settings.js"; -import {dialogBoxCreate} from "../utils/DialogBox.js"; +import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox.js"; import {Reviver, Generic_toJSON, Generic_fromJSON} from "../utils/JSONReviver.js"; @@ -27,10 +27,10 @@ Message.fromJSON = function(value) { Reviver.constructors.Message = Message; //Sends message to player, including a pop up -function sendMessage(msg) { +function sendMessage(msg, forced=false) { console.log("sending message: " + msg.filename); msg.recvd = true; - if (!Settings.SuppressMessages) { + if (forced || !Settings.SuppressMessages) { showMessage(msg); } addMessageToServer(msg, "home"); @@ -50,6 +50,11 @@ function addMessageToServer(msg, serverHostname) { console.log("WARNING: Did not locate " + serverHostname); return; } + for (var i = 0; i < server.messages.length; ++i) { + if (server.messages[i].filename === msg.filename) { + return; //Already exists + } + } server.messages.push(msg); } @@ -60,7 +65,6 @@ function checkForMessagesToSend() { var jumper2 = Messages[MessageFilenames.Jumper2]; var jumper3 = Messages[MessageFilenames.Jumper3]; var jumper4 = Messages[MessageFilenames.Jumper4]; - var jumper5 = Messages[MessageFilenames.Jumper5]; var cybersecTest = Messages[MessageFilenames.CyberSecTest]; var nitesecTest = Messages[MessageFilenames.NiteSecTest]; var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest]; @@ -71,8 +75,13 @@ function checkForMessagesToSend() { redpillOwned = true; } - if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) { + if (redpill && redpillOwned) { + if (!dialogBoxOpened) { + sendMessage(redpill, true); + } + } else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) { sendMessage(jumper0); + Player.getHomeComputer().programs.push(Programs.Flight); } else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) { sendMessage(jumper1); } else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) { @@ -87,11 +96,6 @@ function checkForMessagesToSend() { sendMessage(jumper4); } else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) { sendMessage(bitrunnersTest); - } else if (jumper5 && !jumper5.recvd && Player.hacking_skill >= 1000) { - sendMessage(jumper5); - Player.getHomeComputer().programs.push(Programs.Flight); - } else if (redpill && !redpill.recvd && Player.hacking_skill >= 2000 && redpillOwned) { - sendMessage(redpill); } } @@ -111,7 +115,6 @@ let MessageFilenames = { Jumper2: "j2.msg", Jumper3: "j3.msg", Jumper4: "j4.msg", - Jumper5: "j5.msg", CyberSecTest: "csec-test.msg", NiteSecTest: "nitesec-test.msg", BitRunnersTest: "19dfj3l1nd.msg", @@ -127,7 +130,10 @@ function initMessages() { "I know you can sense it. I know you're searching for it. " + "It's why you spend night after " + "night at your computer.

It's real, I've seen it. And I can " + - "help you find it. But not right now. You're not ready yet.

-jump3R")); + "help you find it. But not right now. You're not ready yet.

" + + "Use this program to track your progress

" + + "The fl1ght.exe program was added to your home computer

" + + "-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper1, "Soon you will be contacted by a hacking group known as CyberSec. " + "They can help you with your search.

" + @@ -148,9 +154,6 @@ function initMessages() { "To find what you are searching for, you must understand the bits. " + "The bits are all around us. The runners will help you.

" + "-jump3R")); - AddToAllMessages(new Message(MessageFilenames.Jumper5, - "Build your wings and fly

-jump3R

" + - "The fl1ght.exe program was added to your home computer")); //Messages from hacking factions AddToAllMessages(new Message(MessageFilenames.CyberSecTest, diff --git a/src/NetscriptEnvironment.js b/src/NetscriptEnvironment.js index 7a358ac66..bf3124989 100644 --- a/src/NetscriptEnvironment.js +++ b/src/NetscriptEnvironment.js @@ -50,6 +50,30 @@ Environment.prototype = { return (scope || this).vars[name] = value; }, + setArrayElement: function(name, idx, value) { + if (!(idx instanceof Array)) { + throw new Error("idx parameter is not an Array"); + } + var scope = this.lookup(name); + if (!scope && this.parent) { + console.log("Here"); + throw new Error("Undefined variable " + name); + } + var arr = (scope || this).vars[name]; + if (!(arr.constructor === Array || arr instanceof Array)) { + throw new Error("Variable is not an array: " + name); + } + var res = arr; + for (var iterator = 0; iterator < idx.length-1; ++iterator) { + var i = idx[iterator]; + if (!(res instanceof Array) || i >= res.length) { + throw new Error("Out-of-bounds array access"); + } + res = res[i]; + } + return res[idx[idx.length-1]] = value; + }, + /* setArrayElement: function(name, idx, value) { var scope = this.lookup(name); if (!scope && this.parent) { @@ -61,7 +85,7 @@ Environment.prototype = { throw new Error("Variable is not an array: " + name); } return (scope || this).vars[name][idx] = value; - }, + },*/ //Creates (or overwrites) a variable in the current scope def: function(name, value) { diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index c681dc087..33b2e4be4 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -13,11 +13,10 @@ import {isValidIPAddress} from "../utils/IPAddress.js"; import {isString} from "../utils/StringHelperFunctions.js"; /* Evaluator - * Evaluates the Abstract Syntax Tree for Netscript - * generated by the Parser class + * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser + * + * Returns a promise */ -// Evaluator should return a Promise, so that any call to evaluate() can just -//wait for that promise to finish before continuing function evaluate(exp, workerScript) { return new Promise(function(resolve, reject) { var env = workerScript.env; @@ -179,7 +178,7 @@ function evaluate(exp, workerScript) { env.set(exp.argument.name,env.get(exp.argument.name)-1); break; default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is a bug please report to game developer")); + reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported")); } if (env.prefix){ return; @@ -196,11 +195,11 @@ function evaluate(exp, workerScript) { resolve(false); break; case "ReturnStatement": - reject(makeRuntimeRejectMsg(workerScript, "Not implemented ReturnStatement")); + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Return statements are not yet implemented in Netscript (line " + (lineNum+1) + ")")); break; case "BreakStatement": reject("BREAKSTATEMENT"); - //reject(makeRuntimeRejectMsg(workerScript, "Not implemented BreakStatement")); break; case "IfStatement": evaluateIf(exp, workerScript).then(function(forLoopRes) { @@ -210,7 +209,8 @@ function evaluate(exp, workerScript) { }); break; case "SwitchStatement": - reject(makeRuntimeRejectMsg(workerScript, "Not implemented SwitchStatement")); + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript (line " + (lineNum+1) + ")")); break;e case "WhileStatement": evaluateWhile(exp, workerScript).then(function(forLoopRes) { @@ -239,7 +239,8 @@ function evaluate(exp, workerScript) { }); break; default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". This is a bug please report to game developer")); + var lineNum = getErrorLineNumber(exp, workerScript); + reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + " (line " + (lineNum+1) + "). This is currently unsupported in Netscript")); break; } //End switch }, Settings.CodeInstructionRunTime); //End setTimeout, the Netscript operation run time @@ -251,6 +252,12 @@ function evalBinary(exp, workerScript){ return new Promise(function(resolve, reject) { var expLeftPromise = evaluate(exp.left, workerScript); expLeftPromise.then(function(expLeft) { + if (expLeft == true && exp.operator === "||") { + return resolve(true); + } + if (expLeft == false && exp.operator === "&&") { + return resolve(false); + } var expRightPromise = evaluate(exp.right, workerScript); expRightPromise.then(function(expRight) { switch (exp.operator){ @@ -306,7 +313,7 @@ function evalBinary(exp, workerScript){ resolve(expLeft && expRight); break; default: - reject(makeRuntimeRejectMsg(workerScript, "Bitwise operators are not implemented")); + reject(makeRuntimeRejectMsg(workerScript, "Unsupported operator: " + exp.operator)); } }, function(e) { reject(e); @@ -340,6 +347,40 @@ function evalUnary(exp, workerScript){ }); } +//Takes in a MemberExpression that should represent a Netscript array (possible multidimensional) +//The return value is an array of the form: +// [0th index (leftmost), array name, 1st index, 2nd index, ...] +function getArrayElement(exp, workerScript) { + return new Promise(function(resolve, reject) { + var indices = []; + var iPromise = evaluate(exp.property, workerScript); + iPromise.then(function(idx) { + if (isNaN(idx)) { + return reject(makeRuntimeRejectMsg(workerScript, "Invalid access to array. Index is not a number: " + idx)); + } else { + if (exp.object.name === undefined && exp.object.object) { + var recursePromise = getArrayElement(exp.object, workerScript); + recursePromise.then(function(res) { + res.push(idx); + indices = res; + return resolve(indices); + }).catch(function(e) { + return reject(e); + }); + } else { + indices.push(idx); + indices.push(exp.object.name); + return resolve(indices); + } + } + }).catch(function(e) { + console.log(e); + console.log("Error getting index in getArrayElement: " + e.toString()); + return reject(e); + }); + }); +} + function evalAssignment(exp, workerScript) { var env = workerScript.env; return new Promise(function(resolve, reject) { @@ -359,6 +400,22 @@ function evalAssignment(exp, workerScript) { //Assign to array element //Array object designed by exp.left.object.name //Index designated by exp.left.property + var getArrayElementPromise = getArrayElement(exp.left, workerScript); + getArrayElementPromise.then(function(res) { + if (!(res instanceof Array) || res.length < 2) { + return reject(makeRuntimeRejectMsg(workerScript, "Error evaluating array assignment. This is (probably) a bug please report to game dev")); + } + + //The array name is the second value + var arrName = res.splice(1, 1); + arrName = arrName[0]; + + env.setArrayElement(arrName, res, expRight); + return resolve(false); + }).catch(function(e) { + return reject(e); + }); + /* var name = exp.left.object.name; if (!(name in env.vars)){ reject(makeRuntimeRejectMsg(workerScript, "variable " + name + " not defined")); @@ -379,7 +436,7 @@ function evalAssignment(exp, workerScript) { }); } else { return reject(makeRuntimeRejectMsg(workerScript, "Trying to access a non-array variable using the [] operator")); - } + }*/ } else { //Other assignments try { @@ -405,19 +462,18 @@ function evalAssignment(exp, workerScript) { default: reject(makeRuntimeRejectMsg(workerScript, "Bitwise assignment is not implemented")); } + resolve(false); } catch (e) { return reject(makeRuntimeRejectMsg(workerScript, "Failed to set environment variable: " + e.toString())); } } - resolve(false); //Return false so this doesnt cause conditionals to evaluate + //resolve(false); //Return false so this doesnt cause conditionals to evaluate }, function(e) { reject(e); }); }); } -//Returns true if any of the if statements evaluated, false otherwise. Therefore, the else statement -//should evaluate if this returns false function evaluateIf(exp, workerScript, i) { var env = workerScript.env; return new Promise(function(resolve, reject) { @@ -566,9 +622,13 @@ function evaluateProg(exp, workerScript, index) { }); } -function netscriptDelay(time) { +function netscriptDelay(time, workerScript) { return new Promise(function(resolve) { - setTimeout(resolve, time); + var delay = setTimeout(resolve, time); + workerScript.killTrigger = function() { + clearTimeout(delay); + resolve(); + }; }); } @@ -576,6 +636,7 @@ function makeRuntimeRejectMsg(workerScript, msg) { return "|"+workerScript.serverIp+"|"+workerScript.name+"|" + msg; } +/* function apply_op(op, a, b) { function num(x) { if (typeof x != "number") @@ -604,6 +665,7 @@ function apply_op(op, a, b) { } throw new Error("Can't apply operator " + op); } +*/ //Run a script from inside a script using run() command function runScriptFromScript(server, scriptname, args, workerScript, threads=1) { @@ -620,6 +682,7 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1) //Check for admin rights and that there is enough RAM availble to run var script = server.scripts[i]; var ramUsage = script.ramUsage; + threads = Math.round(Number(threads)); //Convert to number and round ramUsage = ramUsage * threads * Math.pow(CONSTANTS.MultithreadingRAMCost, threads-1); var ramAvailable = server.maxRam - server.ramUsed; @@ -644,6 +707,15 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1) return Promise.resolve(false); } +//Takes in a +function getErrorLineNumber(exp, workerScript) { + var code = workerScript.scriptRef.scriptRef.code; + + //Split code up to the start of the node + code = code.substring(0, exp.start); + return (code.match(/\n/g) || []).length; +} + function isScriptErrorMessage(msg) { if (!isString(msg)) {return false;} let splitMsg = msg.split("|"); @@ -660,7 +732,7 @@ function isScriptErrorMessage(msg) { //The same as Player's calculateHackingChance() function but takes in the server as an argument function scriptCalculateHackingChance(server) { var difficultyMult = (100 - server.hackDifficulty) / 100; - var skillMult = (1.75 * Player.hacking_skill); + var skillMult = (1.75 * Player.hacking_skill) + (0.2 * Player.intelligence); var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult * Player.hacking_chance_mult; if (chance > 1) {return 1;} @@ -671,7 +743,7 @@ function scriptCalculateHackingChance(server) { //The same as Player's calculateHackingTime() function but takes in the server as an argument function scriptCalculateHackingTime(server) { var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50); + var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence)); var hackingTime = 5 * skillFactor / Player.hacking_speed_mult; //This is in seconds return hackingTime; } @@ -697,7 +769,7 @@ function scriptCalculatePercentMoneyHacked(server) { //Amount of time to execute grow() in milliseconds function scriptCalculateGrowTime(server) { var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50); + var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence)); var growTime = 16 * skillFactor / Player.hacking_speed_mult; //This is in seconds return growTime * 1000; } @@ -705,7 +777,7 @@ function scriptCalculateGrowTime(server) { //Amount of time to execute weaken() in milliseconds function scriptCalculateWeakenTime(server) { var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50); + var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50 + (0.1 * Player.intelligence)); var weakenTime = 20 * skillFactor / Player.hacking_speed_mult; //This is in seconds return weakenTime * 1000; } diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 24066a1d0..69b8133b0 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -1,5 +1,8 @@ +import {updateActiveScriptsItems} from "./ActiveScriptsUI.js"; import {Augmentations, Augmentation, - augmentationExists, installAugmentations} from "./Augmentations.js"; + augmentationExists, installAugmentations, + AugmentationNames} from "./Augmentations.js"; +import {BitNodeMultipliers} from "./BitNode.js"; import {Companies, Company, CompanyPosition, CompanyPositions, companyExists} from "./Company.js"; import {CONSTANTS} from "./Constants.js"; @@ -11,6 +14,7 @@ import {Factions, Faction, joinFaction, import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode.js"; import {Locations} from "./Location.js"; +import {Message, Messages} from "./Message.js"; import {Player} from "./Player.js"; import {Script, findRunningScript, RunningScript} from "./Script.js"; import {Server, getServer, AddToAllServers, @@ -34,33 +38,46 @@ import {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript, import {Environment} from "./NetscriptEnvironment.js"; import Decimal from '../utils/decimal.js'; +import {dialogBoxCreate} from "../utils/DialogBox.js"; import {printArray, powerOfTwo} from "../utils/HelperFunctions.js"; import {createRandomIp} from "../utils/IPAddress.js"; -import {formatNumber, isString} from "../utils/StringHelperFunctions.js"; +import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions.js"; var hasSingularitySF = false; +var hasAISF = false; var singularitySFLvl = 1; +//Also used to check for Artificial Intelligence Source File, don't want to change +//name though function initSingularitySFFlags() { for (var i = 0; i < Player.sourceFiles.length; ++i) { if (Player.sourceFiles[i].n === 4) { hasSingularitySF = true; singularitySFLvl = Player.sourceFiles[i].lvl; } + if (Player.sourceFiles[i].n === 5) { + hasAISF = true; + } } } function NetscriptFunctions(workerScript) { return { + Math : Math, hacknetnodes : Player.hacknetNodes, - scan : function(ip=workerScript.serverIp){ + scan : function(ip=workerScript.serverIp, hostnames=true){ var server = getServer(ip); if (server == null) { throw makeRuntimeRejectMsg(workerScript, 'Invalid IP or hostname passed into scan() command'); } var out = []; for (var i = 0; i < server.serversOnNetwork.length; i++) { - var entry = server.getServerOnNetwork(i).hostname; + var entry; + if (hostnames) { + entry = server.getServerOnNetwork(i).hostname; + } else { + entry = server.getServerOnNetwork(i).ip; + } if (entry == null) { continue; } @@ -97,7 +114,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")"); //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")"); - return netscriptDelay(hackingTime* 1000).then(function() { + return netscriptDelay(hackingTime* 1000, workerScript).then(function() { if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} var hackChance = scriptCalculateHackingChance(server); var rand = Math.random(); @@ -142,7 +159,7 @@ function NetscriptFunctions(workerScript) { if (log) { workerScript.scriptRef.log("Sleeping for " + time + " milliseconds"); } - return netscriptDelay(time).then(function() { + return netscriptDelay(time, workerScript).then(function() { return Promise.resolve(true); }); }, @@ -167,7 +184,7 @@ function NetscriptFunctions(workerScript) { var growTime = scriptCalculateGrowTime(server); //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds") workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")"); - return netscriptDelay(growTime).then(function() { + return netscriptDelay(growTime, workerScript).then(function() { if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} server.moneyAvailable += (1 * threads); //It can be grown even if it has no money var growthPercentage = processSingleServerGrowth(server, 450 * threads); @@ -203,10 +220,9 @@ function NetscriptFunctions(workerScript) { } var weakenTime = scriptCalculateWeakenTime(server); - //console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds") workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")"); - return netscriptDelay(weakenTime).then(function() { + return netscriptDelay(weakenTime, workerScript).then(function() { if (workerScript.env.stopFlag) {return Promise.reject(workerScript);} server.weaken(CONSTANTS.ServerWeakenAmount * threads); workerScript.scriptRef.recordWeaken(server.ip, threads); @@ -228,6 +244,14 @@ function NetscriptFunctions(workerScript) { if (args === undefined || args === null) { throw makeRuntimeRejectMsg(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument"); } + var x = args.toString(); + if (isHTML(x)) { + Player.takeDamage(1); + dialogBoxCreate("You suddenly feel a sharp shooting pain through your body as an angry voice in your head exclaims:

" + + "DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!

" + + "(You lost 1 HP)"); + return; + } post(workerScript.scriptRef.filename + ": " + args.toString()); }, clearLog : function() { @@ -439,20 +463,70 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die"); return true; }, - scp : function(scriptname,ip){ - if (scriptname === undefined || ip === undefined) { - throw makeRuntimeRejectMsg(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments"); + scp : function(scriptname, ip1, ip2){ + if (arguments.length !== 2 && arguments.length !== 3) { + throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); } - var destServer = getServer(ip); - if (destServer == null) { - throw makeRuntimeRejectMsg(workerScript, "Invalid hostname/ip passed into scp() command: " + ip); + if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) { + throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files"); } - var currServ = getServer(workerScript.serverIp); - if (currServ == null) { - throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); + var destServer, currServ; + + if (arguments.length === 3) { //scriptname, source, destination + if (scriptname === undefined || ip1 === undefined || ip2 === undefined) { + throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); + } + destServer = getServer(ip2); + if (destServer == null) { + throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip); + } + + currServ = getServer(ip1); + if (currServ == null) { + throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); + } + } else if (arguments.length === 2) { //scriptname, destination + if (scriptname === undefined || ip1 === undefined) { + throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments"); + } + destServer = getServer(ip1); + if (destServer == null) { + throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip); + } + + currServ = getServer(workerScript.serverIp); + if (currServ == null) { + throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"); + } } + //Scp for lit files + if (scriptname.endsWith(".lit")) { + var found = false; + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) { + found = true; + } + } + + if (!found) { + workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); + return false; + } + + for (var i = 0; i < destServer.messages.length; ++i) { + if (destServer.messages[i] === scriptname) { + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + return true; //Already exists + } + } + destServer.messages.push(scriptname); + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + return true; + } + + //Scp for script files var sourceScript = null; for (var i = 0; i < currServ.scripts.length; ++i) { if (scriptname == currServ.scripts[i].filename) { @@ -487,6 +561,64 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); return true; }, + ls : function(ip, grep) { + if (ip === undefined) { + throw makeRuntimeRejectMsg(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])"); + } + var server = getServer(ip); + if (server === null) { + workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip); + } + + //Get the grep filter, if one exists + var filter = false; + if (arguments.length >= 2) { + filter = grep.toString(); + } + + var allFiles = []; + for (var i = 0; i < server.programs.length; i++) { + if (filter) { + if (server.programs[i].includes(filter)) { + allFiles.push(server.programs[i]); + } + } else { + allFiles.push(server.programs[i]); + } + } + for (var i = 0; i < server.scripts.length; i++) { + if (filter) { + if (server.scripts[i].filename.includes(filter)) { + allFiles.push(server.scripts[i].filename); + } + } else { + allFiles.push(server.scripts[i].filename); + } + + } + for (var i = 0; i < server.messages.length; i++) { + if (filter) { + if (server.messages[i] instanceof Message) { + if (server.messages[i].filename.includes(filter)) { + allFiles.push(server.messages[i].filename); + } + } else if (server.messages[i].includes(filter)) { + allFiles.push(server.messages[i]); + } + } else { + if (server.messages[i] instanceof Message) { + allFiles.push(server.messages[i].filename); + } else { + allFiles.push(server.messages[i]); + } + } + } + + //Sort the files alphabetically then print each + allFiles.sort(); + return allFiles; + }, hasRootAccess : function(ip){ if (ip===undefined){ throw makeRuntimeRejectMsg(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument"); @@ -498,6 +630,13 @@ function NetscriptFunctions(workerScript) { } return server.hasAdminRights; }, + getIp : function() { + var scriptServer = getServer(workerScript.serverIp); + if (scriptServer == null) { + throw makeRuntimeRejectMsg(workerScript, "Could not find server. This is a bug in the game. Report to game dev"); + } + return scriptServer.ip; + }, getHostname : function(){ var scriptServer = getServer(workerScript.serverIp); if (scriptServer == null) { @@ -510,11 +649,33 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill); return Player.hacking_skill; }, + getIntelligence : function () { + if (!hasAISF) { + throw makeRuntimeRejectMsg(workerScript, "Cannot run getIntelligence(). It requires Source-File 5 to run."); + } + Player.updateSkillLevels(); + workerScript.scriptRef.log("getHackingLevel() returned " + Player.intelligence); + return Player.intelligence; + }, + getHackingMultipliers : function() { + return { + chance: Player.hacking_chance_mult, + speed: Player.hacking_speed_mult, + money: Player.hacking_money_mult, + growth: Player.hacking_grow_mult, + }; + }, + getBitNodeMultipliers: function() { + if (!hasAISF) { + throw makeRuntimeRejectMsg(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run."); + } + return BitNodeMultipliers; + }, getServerMoneyAvailable : function(ip){ var server = getServer(ip); if (server == null) { - workerScript.scriptRef.log("Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip); - throw makeRuntimeRejectMsg(workerScript, "Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip); + workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip); } if (server.hostname == "home") { //Return player's money @@ -587,6 +748,9 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("getServerRam() returned [" + formatNumber(server.maxRam, 2) + "GB, " + formatNumber(server.ramUsed, 2) + "GB]"); return [server.maxRam, server.ramUsed]; }, + serverExists : function(ip) { + return (getServer(ip) !== null); + }, fileExists : function(filename,ip=workerScript.serverIp){ if (filename === undefined) { throw makeRuntimeRejectMsg(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])"); @@ -924,6 +1088,55 @@ function NetscriptFunctions(workerScript) { } return scriptCalculateWeakenTime(server) / 1000; //Returns seconds }, + getScriptIncome : function(scriptname, ip) { + if (arguments.length === 0) { + //Get total script income + return updateActiveScriptsItems(); + } else { + //Get income for a particular script + var server = getServer(ip); + if (server === null) { + workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip); + } + var argsForScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForScript.push(arguments[i]); + } + var runningScriptObj = findRunningScript(scriptname, argsForScript, server); + if (runningScriptObj == null) { + workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + printArray(argsForScript)); + return -1; + } + return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime; + } + }, + getScriptExpGain : function(scriptname, ip) { + if (arguments.length === 0) { + var total = 0; + for (var i = 0; i < workerScripts.length; ++i) { + total += (workerScripts[i].scriptRef.onlineExpGained / workerScripts[i].scriptRef.onlineRunningTime); + } + return total; + } else { + //Get income for a particular script + var server = getServer(ip); + if (server === null) { + workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip); + throw makeRuntimeRejectMsg(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip); + } + var argsForScript = []; + for (var i = 2; i < arguments.length; ++i) { + argsForScript.push(arguments[i]); + } + var runningScriptObj = findRunningScript(scriptname, argsForScript, server); + if (runningScriptObj == null) { + workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + printArray(argsForScript)); + return -1; + } + return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime; + } + }, /* Singularity Functions */ universityCourse(universityName, className) { @@ -945,6 +1158,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed"); return false; } + Player.location = Locations.AevumSummitUniversity; costMult = 4; expMult = 3; break; @@ -953,6 +1167,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed"); return false; } + Player.location = Locations.Sector12RothmanUniversity; costMult = 3; expMult = 2; break; @@ -961,6 +1176,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed"); return false; } + Player.location = Locations.VolhavenZBInstituteOfTechnology; costMult = 5; expMult = 4; break; @@ -1016,6 +1232,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed"); return false; } + Player.location = Locations.AevumCrushFitnessGym; costMult = 2; expMult = 1.5; break; @@ -1024,6 +1241,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed"); return false; } + Player.location = Locations.AevumSnapFitnessGym; costMult = 6; expMult = 4; break; @@ -1032,6 +1250,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed"); return false; } + Player.location = Locations.Sector12IronGym; costMult = 1; expMult = 1; break; @@ -1040,6 +1259,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed"); return false; } + Player.location = Locations.Sector12PowerhouseGym; costMult = 10; expMult = 7.5; break; @@ -1048,6 +1268,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed"); return false; } + Player.location = Locations.VolhavenMilleniumFitnessGym; costMult = 3; expMult = 2.5; break; @@ -1098,6 +1319,7 @@ function NetscriptFunctions(workerScript) { case Locations.Volhaven: Player.loseMoney(200000); Player.city = cityname; + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); workerScript.scriptRef.log("Traveled to " + cityname); return true; default: @@ -1133,6 +1355,7 @@ function NetscriptFunctions(workerScript) { Player.getHomeComputer().serversOnNetwork.push(darkweb.ip); darkweb.serversOnNetwork.push(Player.getHomeComputer().ip); + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); workerScript.scriptRef.log("You have purchased a Tor router!"); return true; }, @@ -1159,6 +1382,7 @@ function NetscriptFunctions(workerScript) { "can be found on your home computer."); } else { workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.FTPCrackProgram.toLowerCase(): @@ -1169,7 +1393,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.RelaySMTPProgram.toLowerCase(): @@ -1180,7 +1405,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.HTTPWormProgram.toLowerCase(): @@ -1191,7 +1417,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.SQLInjectProgram.toLowerCase(): @@ -1202,7 +1429,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.DeepscanV1.toLowerCase(): @@ -1213,7 +1441,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; case Programs.DeepscanV2.toLowerCase(): @@ -1224,7 +1453,8 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " + "can be found on your home computer."); } else { - workerScript.scriptRef.log("Not enough money to purchase " + itemName); + workerScript.scriptRef.log("Not enough money to purchase " + programName); + return false; } return true; default: @@ -1261,6 +1491,7 @@ function NetscriptFunctions(workerScript) { Player.loseMoney(cost); + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM."); return true; }, @@ -1431,6 +1662,7 @@ function NetscriptFunctions(workerScript) { Player.factionInvitations.splice(index, 1); var fac = Factions[name]; joinFaction(fac); + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); workerScript.scriptRef.log("Joined the " + name + " faction."); return true; }, @@ -1658,16 +1890,23 @@ function NetscriptFunctions(workerScript) { return false; } - for (var j = 0; j < Player.queuedAugmentations.length; ++j) { - if (Player.queuedAugmentations[j].name === aug.name) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); - return false; - } + var isNeuroflux = false; + if (aug.name === AugmentationNames.NeuroFluxGovernor) { + isNeuroflux = true; } - for (var j = 0; j < Player.augmentations.length; ++j) { - if (Player.augmentations[j].name === aug.name) { - workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); - return false; + + if (!isNeuroflux) { + for (var j = 0; j < Player.queuedAugmentations.length; ++j) { + if (Player.queuedAugmentations[j].name === aug.name) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); + return false; + } + } + for (var j = 0; j < Player.augmentations.length; ++j) { + if (Player.augmentations[j].name === aug.name) { + workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name); + return false; + } } } @@ -1679,6 +1918,7 @@ function NetscriptFunctions(workerScript) { var res = purchaseAugmentation(aug, fac, true); workerScript.scriptRef.log(res); if (isString(res) && res.startsWith("You purchased")) { + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); return true; } else { return false; @@ -1696,6 +1936,7 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed"); return false; } + Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain); workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed"); installAugmentations(); return true; diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index b91cf34d2..d76293e85 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -25,6 +25,7 @@ function WorkerScript(runningScriptObj) { this.scriptRef = runningScriptObj; this.errorMessage = ""; this.args = runningScriptObj.args; + this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay()) } //Returns the server on which the workerScript is running @@ -58,6 +59,34 @@ function prestigeWorkerScripts() { //Loop through workerScripts and run every script that is not currently running function runScriptsLoop() { + //Delete any scripts that finished or have been killed. Loop backwards bc removing + //items fucks up the indexing + for (var i = workerScripts.length - 1; i >= 0; i--) { + if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { + console.log("Deleting script: " + workerScripts[i].name); + //Delete script from the runningScripts array on its host serverIp + var ip = workerScripts[i].serverIp; + var name = workerScripts[i].name; + + for (var j = 0; j < AllServers[ip].runningScripts.length; j++) { + if (AllServers[ip].runningScripts[j].filename == name && + compareArrays(AllServers[ip].runningScripts[j].args, workerScripts[i].args)) { + AllServers[ip].runningScripts.splice(j, 1); + break; + } + } + + //Free RAM + AllServers[ip].ramUsed -= workerScripts[i].ramUsage; + + //Delete script from Active Scripts + deleteActiveScriptsItem(workerScripts[i]); + + //Delete script from workerScripts + workerScripts.splice(i, 1); + } + } + //Run any scripts that haven't been started for (var i = 0; i < workerScripts.length; i++) { //If it isn't running, start the script @@ -120,35 +149,7 @@ function runScriptsLoop() { } } - //Delete any scripts that finished or have been killed. Loop backwards bc removing - //items fucks up the indexing - for (var i = workerScripts.length - 1; i >= 0; i--) { - if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { - console.log("Deleting script: " + workerScripts[i].name); - //Delete script from the runningScripts array on its host serverIp - var ip = workerScripts[i].serverIp; - var name = workerScripts[i].name; - - for (var j = 0; j < AllServers[ip].runningScripts.length; j++) { - if (AllServers[ip].runningScripts[j].filename == name && - compareArrays(AllServers[ip].runningScripts[j].args, workerScripts[i].args)) { - AllServers[ip].runningScripts.splice(j, 1); - break; - } - } - - //Free RAM - AllServers[ip].ramUsed -= workerScripts[i].ramUsage; - - //Delete script from Active Scripts - deleteActiveScriptsItem(workerScripts[i]); - - //Delete script from workerScripts - workerScripts.splice(i, 1); - } - } - - setTimeout(runScriptsLoop, 10000); + setTimeout(runScriptsLoop, 6000); } //Queues a script to be killed by settings its stop flag to true. Then, the code will reject @@ -159,6 +160,7 @@ function killWorkerScript(runningScriptObj, serverIp) { if (workerScripts[i].name == runningScriptObj.filename && workerScripts[i].serverIp == serverIp && compareArrays(workerScripts[i].args, runningScriptObj.args)) { workerScripts[i].env.stopFlag = true; + workerScripts[i].killTrigger(); return true; } } diff --git a/src/Player.js b/src/Player.js index da93da6e2..99ca2c18f 100644 --- a/src/Player.js +++ b/src/Player.js @@ -8,7 +8,8 @@ import {CONSTANTS} from "./Constants.js"; import {Programs} from "./CreateProgram.js"; import {determineCrimeSuccess} from "./Crimes.js"; import {Engine} from "./engine.js"; -import {Factions, Faction} from "./Faction.js"; +import {Factions, Faction, + displayFactionContent} from "./Faction.js"; import {Gang, resetGangs} from "./Gang.js"; import {Locations} from "./Location.js"; import {AllServers, Server, AddToAllServers} from "./Server.js"; @@ -26,19 +27,21 @@ import {formatNumber, function PlayerObject() { //Skills and stats - this.hacking_skill = 1; + this.hacking_skill = 1; - //Fighting - this.hp = 10; - this.max_hp = 10; - this.strength = 1; //Damage dealt - this.defense = 1; //Damage received - this.dexterity = 1; //Accuracy - this.agility = 1; //Dodge % + //Combat stats + this.hp = 10; + this.max_hp = 10; + this.strength = 1; //Damage dealt + this.defense = 1; //Damage received + this.dexterity = 1; //Accuracy + this.agility = 1; //Dodge % //Labor stats - this.charisma = 1; - //Intelligence, perhaps? + this.charisma = 1; + + //Special stats + this.intelligence = 0; //Hacking multipliers this.hacking_chance_mult = 1; //Increase through ascensions/augmentations @@ -53,6 +56,7 @@ function PlayerObject() { this.dexterity_exp = 0; this.agility_exp = 0; this.charisma_exp = 0; + this.intelligence_exp= 0; this.hacking_mult = 1; this.strength_mult = 1; @@ -143,12 +147,14 @@ function PlayerObject() { this.workMoneyGained = 0; this.createProgramName = ""; + this.createProgramReqLvl = 0; this.className = ""; this.crimeType = ""; this.timeWorked = 0; //in ms + this.timeWorkedCreateProgram = 0; this.timeNeededToCompleteWork = 0; this.work_money_mult = 1; @@ -193,15 +199,6 @@ PlayerObject.prototype.init = function() { this.getHomeComputer().programs.push(Programs.NukeProgram); } -PlayerObject.prototype.increaseMultiplier = function(name, val) { - let mult = this[name]; - if (mult === null || mult === undefined) { - console.log("ERROR: Could not find this multiplier " + name); - return; - } - mult *= val; -} - PlayerObject.prototype.prestigeAugmentation = function() { var homeComp = this.getHomeComputer(); this.currentServer = homeComp.ip; @@ -392,6 +389,12 @@ PlayerObject.prototype.updateSkillLevels = function() { this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult); this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult); + if (this.intelligence > 0) { + this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp)); + } else { + this.intelligence = 0; + } + var ratio = this.hp / this.max_hp; this.max_hp = Math.floor(10 + this.defense / 10); Player.hp = Math.round(this.max_hp * ratio); @@ -439,7 +442,7 @@ PlayerObject.prototype.resetMultipliers = function() { // (2 * hacking_chance_multiplier * hacking_skill) 100 PlayerObject.prototype.calculateHackingChance = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; - var skillMult = (1.75 * this.hacking_skill); + var skillMult = (1.75 * this.hacking_skill) + (0.2 * this.intelligence); var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult * this.hacking_chance_mult; if (chance > 1) {return 1;} @@ -454,7 +457,7 @@ PlayerObject.prototype.calculateHackingChance = function() { // hacking_skill + 100 PlayerObject.prototype.calculateHackingTime = function() { var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; - var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100); + var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100 + (0.1 * this.intelligence)); return 5 * skillFactor / this.hacking_speed_mult; } @@ -571,6 +574,24 @@ PlayerObject.prototype.gainCharismaExp = function(exp) { this.charisma_exp += exp; } +PlayerObject.prototype.gainIntelligenceExp = function(exp) { + if (isNaN(exp)) { + console.log("ERROR: NaN passed into Player.gainIntelligenceExp()"); return; + } + var hasBn = false; + for (var i = 0; i < this.sourceFiles.length; ++i) { + if (this.sourceFiles[i].n === 5) { + hasBn = true; + break; + } + } + if (hasBn || this.intelligence > 0) { + this.intelligence_exp += exp; + } else { + console.log("Not gaining intelligence experience bc it hasn't been unlocked yet"); + } +} + /******* Working functions *******/ PlayerObject.prototype.resetWorkStatus = function() { this.workHackExpGainRate = 0; @@ -592,6 +613,7 @@ PlayerObject.prototype.resetWorkStatus = function() { this.workMoneyGained = 0; this.timeWorked = 0; + this.timeWorkedCreateProgram = 0; this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; @@ -648,7 +670,8 @@ PlayerObject.prototype.finishWork = function(cancelled, sing=false) { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; - Engine.loadTerminalContent(); + //Engine.loadTerminalContent(); + Engine.loadLocationContent(); if (sing) { return "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " and " + @@ -724,7 +747,7 @@ PlayerObject.prototype.work = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + - " at " + Player.companyName + "

" + + " at " + this.companyName + "

" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)

" + @@ -841,7 +864,8 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; - Engine.loadTerminalContent(); + //Engine.loadTerminalContent(); + Engine.loadLocationContent(); if (sing) { return "You worked for " + convertTimeMsToTimeElapsedString(this.timeWorked) + " and " + "earned a total of " + @@ -884,7 +908,9 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) { this.isWorking = false; - Engine.loadTerminalContent(); + //Engine.loadTerminalContent(); + Engine.loadFactionContent(); + displayFactionContent(faction.name); if (sing) { return "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + ". " + "You earned " + @@ -926,7 +952,7 @@ PlayerObject.prototype.startFactionHackWork = function(faction) { this.resetWorkStatus(); this.workHackExpGainRate = .15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain; - this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult; + this.workRepGainRate = this.workRepGainRate = (this.hacking_skill + this.intelligence) / CONSTANTS.MaxSkillLevel * this.faction_rep_mult; this.factionWorkType = CONSTANTS.FactionWorkHacking; this.currentWorkFactionDescription = "carrying out hacking contracts"; @@ -974,7 +1000,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //Constantly update the rep gain rate switch (this.factionWorkType) { case CONSTANTS.FactionWorkHacking: - this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult; + this.workRepGainRate = (this.hacking_skill + this.intelligence) / CONSTANTS.MaxSkillLevel * this.faction_rep_mult; break; case CONSTANTS.FactionWorkField: this.workRepGainRate = this.getFactionFieldWorkRepGain(); @@ -1008,6 +1034,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) { var maxCycles = CONSTANTS.GameCyclesPer20Hours; + this.timeWorked = CONSTANTS.MillisecondsPer20Hours; this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; @@ -1092,6 +1119,10 @@ PlayerObject.prototype.getWorkRepGain = function() { var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, this.defense, this.dexterity, this.agility, this.charisma); + + //Intelligence provides a flat bonus to job performance + jobPerformance += (this.intelligence / CONSTANTS.MaxSkillLevel); + //Update reputation gain rate to account for company favor var favorMult = 1 + (company.favor / 100); if (isNaN(favorMult)) {favorMult = 1;} @@ -1113,7 +1144,8 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() { this.defense / CONSTANTS.MaxSkillLevel + this.dexterity / CONSTANTS.MaxSkillLevel + this.agility / CONSTANTS.MaxSkillLevel + - this.charisma / CONSTANTS.MaxSkillLevel) / 6; + this.charisma / CONSTANTS.MaxSkillLevel + + this.intelligence / CONSTANTS.MaxSkillLevel) / 6; return t * this.faction_rep_mult; } @@ -1125,21 +1157,22 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL //Time needed to complete work affected by hacking skill (linearly based on //ratio of (your skill - required level) to MAX skill) - var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel; - if (timeMultiplier > 1) {timeMultiplier = 1;} - if (timeMultiplier < 0.01) {timeMultiplier = 0.01;} + //var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel; + //if (timeMultiplier > 1) {timeMultiplier = 1;} + //if (timeMultiplier < 0.01) {timeMultiplier = 0.01;} + this.createProgramReqLvl = reqLevel; - this.timeNeededToCompleteWork = timeMultiplier * time; + this.timeNeededToCompleteWork = time; //Check for incomplete program - for (var i = 0; i < Player.getHomeComputer().programs.length; ++i) { - var programFile = Player.getHomeComputer().programs[i]; + for (var i = 0; i < this.getHomeComputer().programs.length; ++i) { + var programFile = this.getHomeComputer().programs[i]; if (programFile.startsWith(programName) && programFile.endsWith("%-INC")) { var res = programFile.split("-"); if (res.length != 3) {break;} var percComplete = Number(res[1].slice(0, -1)); if (isNaN(percComplete) || percComplete < 0 || percComplete >= 100) {break;} - this.timeWorked = percComplete / 100 * this.timeNeededToCompleteWork; - Player.getHomeComputer().programs.splice(i, 1); + this.timeWorkedCreateProgram = percComplete / 100 * this.timeNeededToCompleteWork; + this.getHomeComputer().programs.splice(i, 1); } } @@ -1157,17 +1190,24 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL } PlayerObject.prototype.createProgramWork = function(numCycles) { - this.timeWorked += Engine._idleSpeed * numCycles; + //Higher hacking skill will allow you to create programs faster + var reqLvl = this.createProgramReqLvl; + var skillMult = (this.hacking_skill / reqLvl); //This should always be greater than 1; + skillMult = 1 + ((skillMult - 1) / 5); //The divider constant can be adjusted as necessary + + //Skill multiplier directly applied to "time worked" + this.timeWorked += (Engine._idleSpeed * numCycles); + this.timeWorkedCreateProgram += (Engine._idleSpeed * numCycles * skillMult); var programName = this.createProgramName; - if (this.timeWorked >= this.timeNeededToCompleteWork) { + if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) { this.finishCreateProgramWork(false); } var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working on coding " + programName + ".

" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + + "The program is " + (this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + "If you cancel, your work will be saved and you can come back to complete the program later."; } @@ -1177,17 +1217,19 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false) dialogBoxCreate("You've finished creating " + programName + "!
" + "The new program can be found on your home computer."); - Player.getHomeComputer().programs.push(programName); + this.getHomeComputer().programs.push(programName); } else { - var perc = Math.floor(this.timeWorked / this.timeNeededToCompleteWork * 100).toString(); + var perc = Math.floor(this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toString(); var incompleteName = programName + "-" + perc + "%-INC"; - Player.getHomeComputer().programs.push(incompleteName); + this.getHomeComputer().programs.push(incompleteName); } + this.gainIntelligenceExp(this.createProgramReqLvl / CONSTANTS.IntelligenceProgramBaseExpGain); + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - Player.isWorking = false; + this.isWorking = false; Engine.loadTerminalContent(); } @@ -1255,7 +1297,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { agiExp = baseGymExp * expMult / gameCPS; break; default: - throw new Error("ERR: Invalid/unregocnized class name"); + throw new Error("ERR: Invalid/unrecognized class name"); return; } @@ -1386,16 +1428,16 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag PlayerObject.prototype.commitCrime = function (numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; - if (this.timeWorked >= this.timeNeededToCompleteWork) {Player.finishCrime(false); return;} + if (this.timeWorked >= this.timeNeededToCompleteWork) {this.finishCrime(false); return;} - var percent = Math.round(Player.timeWorked / Player.timeNeededToCompleteWork * 100); + var percent = Math.round(this.timeWorked / this.timeNeededToCompleteWork * 100); var numBars = Math.round(percent / 5); if (numBars < 0) {numBars = 0;} if (numBars > 20) {numBars = 20;} var progressBar = "[" + Array(numBars+1).join("|") + Array(20 - numBars + 1).join(" ") + "]"; var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are attempting to " + Player.crimeType + ".
" + + txt.innerHTML = "You are attempting to " + this.crimeType + ".
" + "Time remaining: " + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked) + "
" + progressBar.replace( / /g, " " ); } @@ -1431,6 +1473,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) { break; case CONSTANTS.CrimeGrandTheftAuto: this.karma -= 5; + this.gainIntelligenceExp(CONSTANTS.IntelligenceCrimeBaseExpGain); break; case CONSTANTS.CrimeKidnap: this.karma -= 6; @@ -1438,9 +1481,11 @@ PlayerObject.prototype.finishCrime = function(cancelled) { case CONSTANTS.CrimeAssassination: ++this.numPeopleKilled; this.karma -= 10; + this.gainIntelligenceExp(CONSTANTS.IntelligenceCrimeBaseExpGain); break; case CONSTANTS.CrimeHeist: this.karma -= 15; + this.gainIntelligenceExp(5 * CONSTANTS.IntelligenceCrimeBaseExpGain); break; default: console.log(this.crimeType); @@ -1531,7 +1576,7 @@ PlayerObject.prototype.hospitalize = function() { dialogBoxCreate("You were in critical condition! You were taken to the hospital where " + "luckily they were able to save your life. You were charged $" + formatNumber(this.max_hp * CONSTANTS.HospitalCostPerHp, 2)); - Player.loseMoney(this.max_hp * CONSTANTS.HospitalCostPerHp); + this.loseMoney(this.max_hp * CONSTANTS.HospitalCostPerHp); this.hp = this.max_hp; } @@ -1615,7 +1660,12 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) { this.companyName = company.companyName; this.companyPosition = pos; - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } if (leaveCompany) { if (sing) {return true;} @@ -1719,7 +1769,12 @@ PlayerObject.prototype.applyForAgentJob = function(sing=false) { PlayerObject.prototype.applyForEmployeeJob = function(sing=false) { var company = Companies[this.location]; //Company being applied to if (this.isQualified(company, CompanyPositions.Employee)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = CompanyPositions.Employee; if (sing) {return true;} @@ -1734,7 +1789,12 @@ PlayerObject.prototype.applyForEmployeeJob = function(sing=false) { PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) { var company = Companies[this.location]; //Company being applied to if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = CompanyPositions.PartTimeEmployee; if (sing) {return true;} @@ -1749,7 +1809,12 @@ PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) { PlayerObject.prototype.applyForWaiterJob = function(sing=false) { var company = Companies[this.location]; //Company being applied to if (this.isQualified(company, CompanyPositions.Waiter)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = CompanyPositions.Waiter; if (sing) {return true;} @@ -1764,7 +1829,12 @@ PlayerObject.prototype.applyForWaiterJob = function(sing=false) { PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) { var company = Companies[this.location]; //Company being applied to if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) { - Player.firstJobRecvd = true; + if (this.firstJobRecvd === false) { + this.firstJobRecvd = true; + document.getElementById("job-tab").style.display = "list-item"; + document.getElementById("world-menu-header").click(); + document.getElementById("world-menu-header").click(); + } this.companyName = company.companyName; this.companyPosition = CompanyPositions.PartTimeWaiter; if (sing) {return true;} @@ -2113,10 +2183,10 @@ PlayerObject.prototype.checkForFactionInvitations = function() { var totalHacknetRam = 0; var totalHacknetCores = 0; var totalHacknetLevels = 0; - for (var i = 0; i < Player.hacknetNodes.length; ++i) { - totalHacknetLevels += Player.hacknetNodes[i].level; - totalHacknetRam += Player.hacknetNodes[i].ram; - totalHacknetCores += Player.hacknetNodes[i].cores; + for (var i = 0; i < this.hacknetNodes.length; ++i) { + totalHacknetLevels += this.hacknetNodes[i].level; + totalHacknetRam += this.hacknetNodes[i].ram; + totalHacknetCores += this.hacknetNodes[i].cores; } if (!netburnersFac.isBanned && !netburnersFac.isMember && !netburnersFac.alreadyInvited && this.hacking_skill >= 80 && totalHacknetRam >= 8 && diff --git a/src/Prestige.js b/src/Prestige.js index a625ec434..f2c76443a 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -9,6 +9,7 @@ import {Factions, Faction, initFactions, joinFaction} from "./Faction.js"; import {Locations} from "./Location.js"; import {initMessages, Messages, Message} from "./Message.js"; +import {initSingularitySFFlags} from "./NetscriptFunctions.js"; import {WorkerScript, workerScripts, prestigeWorkerScripts} from "./NetscriptWorker.js"; import {Player} from "./Player.js"; @@ -117,6 +118,7 @@ function prestigeAugmentation() { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; + Terminal.resetTerminalInput(); Engine.loadTerminalContent(); //Red Pill @@ -215,7 +217,14 @@ function prestigeSourceFile() { var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; + Terminal.resetTerminalInput(); Engine.loadTerminalContent(); + + //Reinitialize flags in case you just finished BN-4 + initSingularitySFFlags(); + + //Gain int exp + Player.gainIntelligenceExp(5); } export {prestigeAugmentation, prestigeSourceFile}; diff --git a/src/RedPill.js b/src/RedPill.js index 2948749b4..3ce2e5cc5 100644 --- a/src/RedPill.js +++ b/src/RedPill.js @@ -123,6 +123,9 @@ function giveSourceFile(bitNodeNumber) { } else { var playerSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1); Player.sourceFiles.push(playerSrcFile); + if (bitNodeNumber === 5) { //Artificial Intelligence + Player.intelligence = 1; + } dialogBoxCreate("You received a Source-File for destroying a Bit Node!

" + sourceFile.name + "

" + sourceFile.info); } @@ -206,7 +209,7 @@ function loadBitVerse(destroyedBitNodeNum) { var elemId = "bitnode-" + i.toString(); var elem = clearEventListeners(elemId); if (elem == null) {return;} - if (i === 1 || i === 2 || i === 4 || i === 11) { + if (i === 1 || i === 2 || i === 4 || i === 5 || i === 11) { elem.addEventListener("click", function() { var bitNodeKey = "BitNode" + i; var bitNode = BitNodes[bitNodeKey]; diff --git a/src/SaveObject.js b/src/SaveObject.js index e402d44e1..61d266f58 100644 --- a/src/SaveObject.js +++ b/src/SaveObject.js @@ -73,7 +73,16 @@ BitburnerSaveObject.prototype.saveGame = function() { this.AllGangsSave = JSON.stringify(AllGangs); } var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this)))); - window.localStorage.setItem("bitburnerSave", saveString); + try { + window.localStorage.setItem("bitburnerSave", saveString); + } catch(e) { + if (e.code == 22) { + dialogBoxCreate("Failed to save game because the size of the save file " + + "is too large. Consider killing several of your scripts to " + + "fix this, or increasing the size of your browsers localStorage"); + } + } + console.log("Game saved!"); Engine.createStatusText("Game saved!"); @@ -466,7 +475,7 @@ BitburnerSaveObject.prototype.exportGame = function() { this.VersionSave = JSON.stringify(CONSTANTS.Version); var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this)))); - + var filename = "bitburnerSave.json"; var file = new Blob([saveString], {type: 'text/plain'}); if (window.navigator.msSaveOrOpenBlob) {// IE10+ window.navigator.msSaveOrOpenBlob(file, filename); diff --git a/src/Script.js b/src/Script.js index 545242b20..c3d690f1b 100644 --- a/src/Script.js +++ b/src/Script.js @@ -1,6 +1,18 @@ var ace = require('brace'); require('brace/mode/javascript'); +require('brace/mode/netscript'); +require('brace/theme/chaos'); +require('brace/theme/chrome'); require('brace/theme/monokai'); +require('brace/theme/solarized_dark'); +require('brace/theme/solarized_light'); +require('brace/theme/terminal'); +require('brace/theme/twilight'); +require('brace/theme/xcode'); +require("brace/keybinding/vim"); +require("brace/keybinding/emacs"); + + import {CONSTANTS} from "./Constants.js"; import {Engine} from "./engine.js"; @@ -18,6 +30,12 @@ import {compareArrays} from "../utils/HelperFunctions.j import {formatNumber, numOccurrences, numNetscriptOperators} from "../utils/StringHelperFunctions.js"; +var keybindings = { + ace: null, + vim: "ace/keyboard/vim", + emacs: "ace/keyboard/emacs", +}; + function scriptEditorInit() { //Initialize save and close button var closeButton = document.getElementById("script-editor-save-and-close-button"); @@ -27,26 +45,59 @@ function scriptEditorInit() { return false; }); - //Allow tabs (four spaces) in all textareas - var textareas = document.getElementsByTagName('textarea'); - var count = textareas.length; - for(var i=0;i 99) {this.hackDifficulty = 99;} + //Place some arbitrarily limit that realistically should never happen unless someone is + //screwing around with the game + if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;} } Server.prototype.weaken = function(amt) { @@ -155,26 +157,26 @@ function initForeignServers() { BachmanAndAssociatesServer.setPortProperties(5); AddToAllServers(BachmanAndAssociatesServer); - var BladeIndustriesServer = new Server(createRandomIp(), "blade", "Blade Industries", false, false, false, 0); + var BladeIndustriesServer = new Server(createRandomIp(), "blade", "Blade Industries", false, false, false, 2); BladeIndustriesServer.setHackingParameters(getRandomInt(1000, 1100), getRandomInt(12000000000, 20000000000), getRandomInt(90, 95), getRandomInt(60, 75)); BladeIndustriesServer.setPortProperties(5); BladeIndustriesServer.messages.push("beyond-man.lit"); AddToAllServers(BladeIndustriesServer); - var NWOServer = new Server(createRandomIp(), "nwo", "New World Order", false, false, false, 0); + var NWOServer = new Server(createRandomIp(), "nwo", "New World Order", false, false, false, 2); NWOServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(25000000000, 35000000000), 99, getRandomInt(75, 85)); NWOServer.setPortProperties(5); NWOServer.messages.push("the-hidden-world.lit"); AddToAllServers(NWOServer); - var ClarkeIncorporatedServer = new Server(createRandomIp(), "clarkeinc", "Clarke Incorporated", false, false, false, 0); + var ClarkeIncorporatedServer = new Server(createRandomIp(), "clarkeinc", "Clarke Incorporated", false, false, false, 2); ClarkeIncorporatedServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(15000000000, 25000000000), getRandomInt(50, 60), getRandomInt(50, 70)); ClarkeIncorporatedServer.setPortProperties(5); ClarkeIncorporatedServer.messages.push("beyond-man.lit"); ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit"); AddToAllServers(ClarkeIncorporatedServer); - var OmniTekIncorporatedServer = new Server(createRandomIp(), "omnitek", "OmniTek Incorporated", false, false, false, 0); + var OmniTekIncorporatedServer = new Server(createRandomIp(), "omnitek", "OmniTek Incorporated", false, false, false, 2); OmniTekIncorporatedServer.setHackingParameters(getRandomInt(900, 1100), getRandomInt(15000000000, 20000000000), getRandomInt(90, 99), getRandomInt(95, 99)); OmniTekIncorporatedServer.setPortProperties(5); OmniTekIncorporatedServer.messages.push("coded-intelligence.lit"); @@ -218,7 +220,7 @@ function initForeignServers() { InfoCommServer.setPortProperties(5); AddToAllServers(InfoCommServer); - var HeliosLabsServer = new Server(createRandomIp(), "helios", "Helios Labs", false, false, false, 0); + var HeliosLabsServer = new Server(createRandomIp(), "helios", "Helios Labs", false, false, false, 2); HeliosLabsServer.setHackingParameters(getRandomInt(800, 900), getRandomInt(550000000, 750000000), getRandomInt(85, 95), getRandomInt(70, 80)); HeliosLabsServer.setPortProperties(5); HeliosLabsServer.messages.push("beyond-man.lit"); @@ -252,7 +254,7 @@ function initForeignServers() { MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit"); AddToAllServers(MicrodyneTechnologiesServer); - var TaiYangDigitalServer = new Server(createRandomIp(), "taiyang-digital", "Taiyang Digital", false, false, false, 0); + var TaiYangDigitalServer = new Server(createRandomIp(), "taiyang-digital", "Taiyang Digital", false, false, false, 2); TaiYangDigitalServer.setHackingParameters(getRandomInt(850, 950), getRandomInt(800000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); TaiYangDigitalServer.setPortProperties(5); TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit"); @@ -265,7 +267,7 @@ function initForeignServers() { AddToAllServers(GalacticCyberSystemsServer); //Defense Companies ("Large" Companies) - var AeroCorpServer = new Server(createRandomIp(), "aerocorp", "AeroCorp", false, false, false, 0); + var AeroCorpServer = new Server(createRandomIp(), "aerocorp", "AeroCorp", false, false, false, 2); AeroCorpServer.setHackingParameters(getRandomInt(850, 925), getRandomInt(1000000000, 1200000000), getRandomInt(80, 90), getRandomInt(55, 65)); AeroCorpServer.setPortProperties(5); AeroCorpServer.messages.push("man-and-machine.lit"); @@ -276,7 +278,7 @@ function initForeignServers() { OmniaCybersystemsServer.setPortProperties(5); AddToAllServers(OmniaCybersystemsServer); - var ZBDefenseServer = new Server(createRandomIp(), "zb-def", "ZB Defense Industries", false, false, false, 0); + var ZBDefenseServer = new Server(createRandomIp(), "zb-def", "ZB Defense Industries", false, false, false, 2); ZBDefenseServer.setHackingParameters(getRandomInt(775, 825), getRandomInt(900000000, 1100000000), getRandomInt(55, 65), getRandomInt(65, 75)); ZBDefenseServer.setPortProperties(4); ZBDefenseServer.messages.push("synthetic-muscles.lit"); @@ -287,7 +289,7 @@ function initForeignServers() { AppliedEnergeticsServer.setPortProperties(4); AddToAllServers(AppliedEnergeticsServer); - var SolarisSpaceSystemsServer = new Server(createRandomIp(), "solaris", "Solaris Space Systems", false, false, false, 0); + var SolarisSpaceSystemsServer = new Server(createRandomIp(), "solaris", "Solaris Space Systems", false, false, false, 2); SolarisSpaceSystemsServer.setHackingParameters(getRandomInt(750, 850), getRandomInt(700000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); SolarisSpaceSystemsServer.setPortProperties(5); SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit"); @@ -332,7 +334,7 @@ function initForeignServers() { RhoConstructionServer.setPortProperties(3); AddToAllServers(RhoConstructionServer); - var AlphaEnterprisesServer = new Server(createRandomIp(), "alpha-ent", "Alpha Enterprises", false, false, false, 0); + var AlphaEnterprisesServer = new Server(createRandomIp(), "alpha-ent", "Alpha Enterprises", false, false, false, 2); AlphaEnterprisesServer.setHackingParameters(getRandomInt(500, 600), getRandomInt(600000000, 750000000), getRandomInt(50, 70), getRandomInt(50, 60)); AlphaEnterprisesServer.setPortProperties(4); AlphaEnterprisesServer.messages.push("sector-12-crime.lit"); @@ -369,7 +371,7 @@ function initForeignServers() { SysCoreSecuritiesServer.setPortProperties(4); AddToAllServers(SysCoreSecuritiesServer); - var CatalystVenturesServer = new Server(createRandomIp(), "catalyst", "Catalyst Ventures", false, false, false, 0); + var CatalystVenturesServer = new Server(createRandomIp(), "catalyst", "Catalyst Ventures", false, false, false, 2); CatalystVenturesServer.setHackingParameters(getRandomInt(400, 450), getRandomInt(300000000, 550000000), getRandomInt(60, 70), getRandomInt(25, 55)); CatalystVenturesServer.setPortProperties(3); CatalystVenturesServer.messages.push("tensions-in-tech-race.lit"); @@ -386,7 +388,7 @@ function initForeignServers() { CompuTekServer.messages.push("man-and-machine.lit"); AddToAllServers(CompuTekServer); - var NetLinkTechnologiesServer = new Server(createRandomIp(), "netlink", "NetLink Technologies", false, false, false, 0); + var NetLinkTechnologiesServer = new Server(createRandomIp(), "netlink", "NetLink Technologies", false, false, false, 2); NetLinkTechnologiesServer.setHackingParameters(getRandomInt(375, 425), 275000000, getRandomInt(60, 80), getRandomInt(45, 75)); NetLinkTechnologiesServer.setPortProperties(3); NetLinkTechnologiesServer.messages.push("simulated-reality.lit"); @@ -414,7 +416,7 @@ function initForeignServers() { JoesGunsServer.setPortProperties(0); AddToAllServers(JoesGunsServer); - var Zer0NightclubServer = new Server(createRandomIp(), "zer0", "ZER0 Nightclub", false, false, false, 4); + var Zer0NightclubServer = new Server(createRandomIp(), "zer0", "ZER0 Nightclub", false, false, false, 16); Zer0NightclubServer.setHackingParameters(75, 7500000, 25, 40); Zer0NightclubServer.setPortProperties(1); AddToAllServers(Zer0NightclubServer); @@ -424,13 +426,13 @@ function initForeignServers() { NectarNightclubServer.setPortProperties(0); AddToAllServers(NectarNightclubServer); - var NeoNightclubServer = new Server(createRandomIp(), "neo-net", "Neo Nightclub Network", false, false, false, 4); + var NeoNightclubServer = new Server(createRandomIp(), "neo-net", "Neo Nightclub Network", false, false, false, 16); NeoNightclubServer.setHackingParameters(50, 5000000, 25, 25); NeoNightclubServer.setPortProperties(1); NeoNightclubServer.messages.push("the-hidden-world.lit"); AddToAllServers(NeoNightclubServer); - var SilverHelixServer = new Server(createRandomIp(), "silver-helix", "Silver Helix", false, false, false, 2); + var SilverHelixServer = new Server(createRandomIp(), "silver-helix", "Silver Helix", false, false, false, 32); SilverHelixServer.setHackingParameters(150, 45000000, 30, 30); SilverHelixServer.setPortProperties(2); SilverHelixServer.messages.push("new-triads.lit"); @@ -447,17 +449,17 @@ function initForeignServers() { HaraKiriSushiBarServer.setPortProperties(0); AddToAllServers(HaraKiriSushiBarServer); - var PhantasyServer = new Server(createRandomIp(), "phantasy", "Phantasy Club", false, false, false, 0); + var PhantasyServer = new Server(createRandomIp(), "phantasy", "Phantasy Club", false, false, false, 16); PhantasyServer.setHackingParameters(100, 24000000, 20, 35); PhantasyServer.setPortProperties(2); AddToAllServers(PhantasyServer); - var MaxHardwareServer = new Server(createRandomIp(), "max-hardware", "Max Hardware Store", false, false, false, 4); + var MaxHardwareServer = new Server(createRandomIp(), "max-hardware", "Max Hardware Store", false, false, false, 16); MaxHardwareServer.setHackingParameters(80, 10000000, 15, 30); MaxHardwareServer.setPortProperties(1); AddToAllServers(MaxHardwareServer); - var OmegaSoftwareServer = new Server(createRandomIp(), "omega-net", "Omega Software", false, false, false, 8); + var OmegaSoftwareServer = new Server(createRandomIp(), "omega-net", "Omega Software", false, false, false, 16); OmegaSoftwareServer.setHackingParameters(getRandomInt(180, 220), getRandomInt(60000000, 70000000), getRandomInt(25, 35), getRandomInt(30, 40)); OmegaSoftwareServer.setPortProperties(2); OmegaSoftwareServer.messages.push("the-new-god.lit"); @@ -469,7 +471,7 @@ function initForeignServers() { CrushFitnessGymServer.setPortProperties(2); AddToAllServers(CrushFitnessGymServer); - var IronGymServer = new Server(createRandomIp(), "iron-gym", "Iron Gym Network", false, false, false, 4); + var IronGymServer = new Server(createRandomIp(), "iron-gym", "Iron Gym Network", false, false, false, 16); IronGymServer.setHackingParameters(100, 20000000, 30, 20); IronGymServer.setPortProperties(1); AddToAllServers(IronGymServer); @@ -490,7 +492,7 @@ function initForeignServers() { AddToAllServers(SnapFitnessGymServer); //Faction servers, cannot hack money from these - var BitRunnersServer = new Server(createRandomIp(), "run4theh111z", "The Runners", false, false, false, 0); + var BitRunnersServer = new Server(createRandomIp(), "run4theh111z", "The Runners", false, false, false, 2); BitRunnersServer.setHackingParameters(getRandomInt(505, 550), 0, 0, 0); BitRunnersServer.setPortProperties(4); BitRunnersServer.messages.push("simulated-reality.lit"); @@ -498,14 +500,14 @@ function initForeignServers() { AddToAllServers(BitRunnersServer); SpecialServerIps.addIp(SpecialServerNames.BitRunnersServer, BitRunnersServer.ip); - var TheBlackHandServer = new Server(createRandomIp(), "I.I.I.I", "I.I.I.I", false, false, false, 0); + var TheBlackHandServer = new Server(createRandomIp(), "I.I.I.I", "I.I.I.I", false, false, false, 2); TheBlackHandServer.setHackingParameters(getRandomInt(340, 365), 0, 0, 0); TheBlackHandServer.setPortProperties(3); TheBlackHandServer.messages.push("democracy-is-dead.lit"); AddToAllServers(TheBlackHandServer); SpecialServerIps.addIp(SpecialServerNames.TheBlackHandServer, TheBlackHandServer.ip); - var NiteSecServer = new Server(createRandomIp(), "avmnite-02h", "NiteSec", false, false, false, 0); + var NiteSecServer = new Server(createRandomIp(), "avmnite-02h", "NiteSec", false, false, false, 2); NiteSecServer.setHackingParameters(getRandomInt(202, 220), 0, 0, 0); NiteSecServer.setPortProperties(2); NiteSecServer.messages.push("democracy-is-dead.lit"); @@ -518,14 +520,14 @@ function initForeignServers() { AddToAllServers(DarkArmyServer); SpecialServerIps.addIp(SpecialServerNames.TheDarkArmyServer, DarkArmyServer.ip); - var CyberSecServer = new Server(createRandomIp(), "CSEC", "CyberSec", false, false, false, 0); + var CyberSecServer = new Server(createRandomIp(), "CSEC", "CyberSec", false, false, false, 2); CyberSecServer.setHackingParameters(getRandomInt(51, 60), 0, 0, 0); CyberSecServer.setPortProperties(1); CyberSecServer.messages.push("democracy-is-dead.lit"); AddToAllServers(CyberSecServer); SpecialServerIps.addIp(SpecialServerNames.CyberSecServer, CyberSecServer.ip); - var DaedalusServer = new Server(createRandomIp(), "The-Cave", "Helios", false, false, false, 0); + var DaedalusServer = new Server(createRandomIp(), "The-Cave", "Helios", false, false, false, 2); DaedalusServer.setHackingParameters(925, 0, 0, 0); DaedalusServer.setPortProperties(5); DaedalusServer.messages.push("alpha-omega.lit"); @@ -669,13 +671,14 @@ function processSingleServerGrowth(server, numCycles) { serverGrowth = 1; } + var oldMoneyAvailable = server.moneyAvailable; server.moneyAvailable *= serverGrowth; if (server.moneyMax && isNaN(server.moneyAvailable)) { server.moneyAvailable = server.moneyMax; } if (server.moneyMax && server.moneyAvailable > server.moneyMax) { server.moneyAvailable = server.moneyMax; - return 1; + return server.moneyAvailable / oldMoneyAvailable; } //Growing increases server security twice as much as hacking diff --git a/src/ServerPurchases.js b/src/ServerPurchases.js index b9fab3cb6..18991b9c8 100644 --- a/src/ServerPurchases.js +++ b/src/ServerPurchases.js @@ -1,9 +1,11 @@ import {CONSTANTS} from "./Constants.js"; import {Player} from "./Player.js"; -import {AllServers} from "./Server.js"; +import {Server, AllServers, AddToAllServers} from "./Server.js"; import {dialogBoxCreate} from "../utils/DialogBox.js"; +import {createRandomIp} from "../utils/IPAddress.js"; import {yesNoTxtInpBoxGetInput} from "../utils/YesNoBox.js"; + /* Functions to handle any server-related purchasing: * Purchasing new servers * Purchasing more RAM for home computer diff --git a/src/Settings.js b/src/Settings.js index 1f56d676f..11f1c9de3 100644 --- a/src/Settings.js +++ b/src/Settings.js @@ -1,6 +1,6 @@ /* Settings.js */ let Settings = { - CodeInstructionRunTime: 100, + CodeInstructionRunTime: 50, MaxLogCapacity: 50, MaxPortCapacity: 50, SuppressMessages: false, @@ -12,7 +12,7 @@ function loadSettings(saveString) { } function initSettings() { - Settings.CodeInstructionRunTime = 100; + Settings.CodeInstructionRunTime = 50; Settings.MaxLogCapacity = 50; Settings.MaxPortCapacity = 50; Settings.SuppressMessages = false; diff --git a/src/Terminal.js b/src/Terminal.js index 638ab1787..b2930eb0b 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -13,6 +13,9 @@ import {iTutorialNextStep, iTutorialSteps, currITutorialStep} from "./InteractiveTutorial.js"; import {showLiterature} from "./Literature.js"; import {showMessage, Message} from "./Message.js"; +import {scriptCalculateHackingTime, + scriptCalculateGrowTime, + scriptCalculateWeakenTime} from "./NetscriptEvaluator.js"; import {killWorkerScript, addWorkerScript} from "./NetscriptWorker.js"; import {Player} from "./Player.js"; import {hackWorldDaemon} from "./RedPill.js"; @@ -24,18 +27,18 @@ import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps.js"; import {containsAllStrings, longestCommonStart, - formatNumber} from "../utils/StringHelperFunctions.js"; + formatNumber, isString} from "../utils/StringHelperFunctions.js"; import {addOffset, printArray} from "../utils/HelperFunctions.js"; import {logBoxCreate} from "../utils/LogBox.js"; /* Write text to terminal */ +//If replace is true then spaces are replaced with " " function post(input, replace=true) { if (replace) { $("#terminal-input").before('' + input.replace( / /g, " " ) + ''); } else { $("#terminal-input").before('' + input + ''); } - updateTerminalScroll(); } @@ -72,10 +75,10 @@ $(document).keydown(function(event) { event.preventDefault(); //Prevent newline from being entered in Script Editor var command = $('input[class=terminal-input]').val(); if (command.length > 0) { - post("> " + command); + post("[" + Player.getCurrentServer().hostname + " ~]> " + command); + Terminal.resetTerminalInput(); //Clear input first Terminal.executeCommand(command); - $('input[class=terminal-input]').val(""); } } @@ -211,13 +214,13 @@ function tabCompletion(command, arg, allPossibilities, index=0) { //that we are attempting to autocomplete if (arg == "") { for (var i = allPossibilities.length-1; i >= 0; --i) { - if (!allPossibilities[i].startsWith(command)) { + if (!allPossibilities[i].toLowerCase().startsWith(command.toLowerCase())) { allPossibilities.splice(i, 1); } } } else { for (var i = allPossibilities.length-1; i >= 0; --i) { - if (!allPossibilities[i].startsWith(arg)) { + if (!allPossibilities[i].toLowerCase().startsWith(arg.toLowerCase())) { allPossibilities.splice(i, 1); } } @@ -337,7 +340,7 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { } if (input.startsWith("kill ") || input.startsWith("nano ") || - input.startsWith("tail ") || input.startsWith("rm ") || + input.startsWith("tail ") || input.startsWith("mem ") || input.startsWith("check ")) { //All Scripts for (var i = 0; i < currServ.scripts.length; ++i) { @@ -346,6 +349,22 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { return allPos; } + if (input.startsWith("rm ")) { + for (var i = 0; i < currServ.scripts.length; ++i) { + allPos.push(currServ.scripts[i].filename); + } + for (var i = 0; i < currServ.programs.length; ++i) { + allPos.push(currServ.programs[i]); + } + for (var i = 0; i < currServ.messages.length; ++i) { + if (!(currServ.messages[i] instanceof Message) && isString(currServ.messages[i]) && + currServ.messages[i].endsWith(".lit")) { + allPos.push(currServ.messages[i]); + } + } + return allPos; + } + if (input.startsWith("run ")) { //All programs and scripts for (var i = 0; i < currServ.scripts.length; ++i) { @@ -390,6 +409,17 @@ let Terminal = { } }, + resetTerminalInput: function() { + document.getElementById("terminal-input-td").innerHTML = + "
[" + Player.getCurrentServer().hostname + " ~]" + "$
" + + ''; + var hdr = document.getElementById("terminal-input-header"); + hdr.style.display = "inline"; + var lineWidth = document.getElementById("terminal-input-td").offsetWidth; + var width = lineWidth - hdr.offsetWidth - 10; + document.getElementById("terminal-input-text-box").style.width = width + "px"; + }, + //Complete the hack/analyze command finishHack: function(cancelled = false) { if (cancelled == false) { @@ -414,13 +444,12 @@ let Terminal = { var moneyGained = Player.calculatePercentMoneyHacked(); moneyGained = Math.floor(server.moneyAvailable * moneyGained); - //Safety check - if (moneyGained <= 0) {moneyGained = 0;} + if (moneyGained <= 0) {moneyGained = 0;} //Safety check server.moneyAvailable -= moneyGained; Player.gainMoney(moneyGained); - Player.gainHackingExp(expGainedOnSuccess) + Player.gainIntelligenceExp(expGainedOnSuccess / CONSTANTS.IntelligenceTerminalHackBaseExpGain); server.fortify(CONSTANTS.ServerFortifyAmount); @@ -435,7 +464,8 @@ let Terminal = { //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); $("#hack-progress").attr('id', "old-hack-progress"); - document.getElementById("terminal-input-td").innerHTML = '$ '; + Terminal.resetTerminalInput(); + //document.getElementById("terminal-input-td").innerHTML = '$ '; $('input[class=terminal-input]').prop('disabled', false); Terminal.hackFlag = false; @@ -490,7 +520,8 @@ let Terminal = { //Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal $("#hack-progress-bar").attr('id', "old-hack-progress-bar"); $("#hack-progress").attr('id', "old-hack-progress"); - document.getElementById("terminal-input-td").innerHTML = '$ '; + Terminal.resetTerminalInput(); + //document.getElementById("terminal-input-td").innerHTML = '$ '; $('input[class=terminal-input]').prop('disabled', false); }, @@ -587,6 +618,7 @@ let Terminal = { Player.analyze(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); iTutorialNextStep(); @@ -610,6 +642,7 @@ let Terminal = { Player.hack(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); iTutorialNextStep(); @@ -690,6 +723,7 @@ let Terminal = { Player.analyze(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); break; @@ -793,6 +827,7 @@ let Terminal = { Player.hack(); //Disable terminal + //Terminal.resetTerminalInput(); document.getElementById("terminal-input-td").innerHTML = ''; $('input[class=terminal-input]').prop('disabled', true); } @@ -821,6 +856,7 @@ let Terminal = { Player.currentServer = Player.getHomeComputer().ip; Player.getCurrentServer().isConnectedTo = true; post("Connected to home"); + Terminal.resetTerminalInput(); break; case "hostname": if (commandArray.length != 1) { @@ -961,6 +997,15 @@ let Terminal = { } } + //Check literature files + for (var i = 0; i < s.messages.length; ++i) { + var f = s.messages[i]; + if (!(f instanceof Message) && isString(f) && f === delTarget) { + s.messages.splice(i, 1); + return; + } + } + post("No such file exists"); break; case "run": @@ -986,7 +1031,17 @@ let Terminal = { if (commandArray.length == 1) { Terminal.executeScanAnalyzeCommand(1); } else if (commandArray.length == 2) { - var depth = Number(commandArray[1]); + var all = false; + if (commandArray[1].endsWith("-a")) { + all = true; + commandArray[1] = commandArray[1].replace("-a", ""); + } + var depth; + if (commandArray[1].length === 0) { + depth = 1; + } else { + depth = Number(commandArray[1]); + } if (isNaN(depth) || depth < 0) { post("Incorrect usage of scan-analyze command. depth argument must be positive numeric"); return; @@ -1002,7 +1057,7 @@ let Terminal = { post("You cannot scan-analyze with that high of a depth. Maximum depth is 10"); return; } - Terminal.executeScanAnalyzeCommand(depth); + Terminal.executeScanAnalyzeCommand(depth, all); } else { post("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]"); } @@ -1033,7 +1088,6 @@ let Terminal = { //Scp for lit files if (scriptname.endsWith(".lit")) { var found = false; - var curr for (var i = 0; i < currServ.messages.length; ++i) { if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) { found = true; @@ -1227,6 +1281,7 @@ let Terminal = { if (Player.getCurrentServer().hostname == "darkweb") { checkIfConnectedToDarkweb(); //Posts a 'help' message if connecting to dark web } + Terminal.resetTerminalInput(); }, executeListCommand: function(commandArray) { @@ -1330,12 +1385,13 @@ let Terminal = { } }, - executeScanAnalyzeCommand: function(depth=1) { + executeScanAnalyzeCommand: function(depth=1, all=false) { //We'll use the AllServersMap as a visited() array //TODO Using array as stack for now, can make more efficient post("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~"); post(" "); var visited = new AllServersMap(); + var stack = []; var depthQueue = [0]; var currServ = Player.getCurrentServer(); @@ -1343,8 +1399,10 @@ let Terminal = { while(stack.length != 0) { var s = stack.pop(); var d = depthQueue.pop(); - if (visited[s.ip] || d > depth) { - continue; + if (!all && s.purchasedByPlayer && s.hostname != "home") { + continue; //Purchased server + } else if (visited[s.ip] || d > depth) { + continue; //Already visited or out-of-depth } else { visited[s.ip] = 1; } @@ -1375,6 +1433,7 @@ let Terminal = { (function() { var hostname = links[i].innerHTML.toString(); links[i].onclick = function() { + if (Terminal.analyzeFlag || Terminal.hackFlag) {return;} Terminal.connectToServer(hostname); } }());//Immediate invocation diff --git a/src/engine.js b/src/engine.js index 76b8a382c..66da6f051 100644 --- a/src/engine.js +++ b/src/engine.js @@ -1,9 +1,3 @@ -var ace = require('brace'); -require('brace/mode/javascript'); -require('brace/theme/monokai'); -require('brace/theme/terminal'); -require('brace/theme/twilight'); - import {dialogBoxCreate} from "../utils/DialogBox.js"; import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions.js"; import {clearEventListeners} from "../utils/HelperFunctions.js"; @@ -441,16 +435,30 @@ let Engine = { displayCharacterOverviewInfo: function() { if (Player.hp == null) {Player.hp = Player.max_hp;} - document.getElementById("character-overview-text").innerHTML = - ("Hp: " + Player.hp + " / " + Player.max_hp + "
" + - "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" + - "Hack: " + (Player.hacking_skill).toLocaleString() + "
" + - "Str: " + (Player.strength).toLocaleString() + "
" + - "Def: " + (Player.defense).toLocaleString() + "
" + - "Dex: " + (Player.dexterity).toLocaleString() + "
" + - "Agi: " + (Player.agility).toLocaleString() + "
" + - "Cha: " + (Player.charisma).toLocaleString() - ).replace( / /g, " " ); + if (Player.intelligence >= 1) { + document.getElementById("character-overview-text").innerHTML = + ("Hp: " + Player.hp + " / " + Player.max_hp + "
" + + "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" + + "Hack: " + (Player.hacking_skill).toLocaleString() + "
" + + "Str: " + (Player.strength).toLocaleString() + "
" + + "Def: " + (Player.defense).toLocaleString() + "
" + + "Dex: " + (Player.dexterity).toLocaleString() + "
" + + "Agi: " + (Player.agility).toLocaleString() + "
" + + "Cha: " + (Player.charisma).toLocaleString() + "
" + + "Int: " + (Player.intelligence).toLocaleString() + ).replace( / /g, " " ); + } else { + document.getElementById("character-overview-text").innerHTML = + ("Hp: " + Player.hp + " / " + Player.max_hp + "
" + + "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" + + "Hack: " + (Player.hacking_skill).toLocaleString() + "
" + + "Str: " + (Player.strength).toLocaleString() + "
" + + "Def: " + (Player.defense).toLocaleString() + "
" + + "Dex: " + (Player.dexterity).toLocaleString() + "
" + + "Agi: " + (Player.agility).toLocaleString() + "
" + + "Cha: " + (Player.charisma).toLocaleString() + ).replace( / /g, " " ); + } }, /* Display character info */ @@ -915,7 +923,13 @@ let Engine = { if (Engine.Counters.checkFactionInvitations <= 0) { var invitedFactions = Player.checkForFactionInvitations(); if (invitedFactions.length > 0) { - Player.firstFacInvRecvd = true; + if (Player.firstFacInvRecvd === false) { + Player.firstFacInvRecvd = true; + document.getElementById("factions-tab").style.display = "list-item"; + document.getElementById("character-menu-header").click(); + document.getElementById("character-menu-header").click(); + } + var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)]; inviteToFaction(randFaction); } @@ -930,7 +944,11 @@ let Engine = { if (Engine.Counters.messages <= 0) { checkForMessagesToSend(); - Engine.Counters.messages = 150; + if (Augmentations[AugmentationNames.TheRedPill].owned) { + Engine.Counters.messages = 600; //2 minutes for Red pill message + } else { + Engine.Counters.messages = 150; + } } if (Engine.Counters.stockTick <= 0) { @@ -1018,14 +1036,54 @@ let Engine = { document.getElementById("entire-game-container").style.visibility = "visible"; }, - load: function() { - //Load script editor - var editor = ace.edit('javascript-editor'); - editor.getSession().setMode('ace/mode/javascript'); - editor.setTheme('ace/theme/monokai'); - document.getElementById('javascript-editor').style.fontSize='16px'; - editor.setOption("showPrintMargin", false); + //Used when initializing a game + //elems should be an array of all DOM elements under the header + closeMainMenuHeader: function(elems) { + for (var i = 0; i < elems.length; ++i) { + elems[i].style.maxHeight = null; + elems[i].style.opacity = 0; + elems[i].style.pointerEvents = "none"; + } + }, + //Used when initializing the game + //elems should be an array of all DOM elements under the header + openMainMenuHeader: function(elems) { + for (var i = 0; i < elems.length; ++i) { + elems[i].style.maxHeight = elems[i].scrollHeight + "px"; + elems[i].style.display = "block"; + } + }, + + //Used in game when clicking on a main menu header (NOT FOR INITIALIZATION) + //open is a boolean specifying whether its being opened or closed + //elems is an array of DOM elements for main menu tabs (li) + //links is an array of DOM elements for main menu links (a) + toggleMainMenuHeader: function(open, elems, links) { + for (var i = 0; i < elems.length; ++i) { + if (open) { + elems[i].style.opacity = 1; + elems[i].style.maxHeight = elems[i].scrollHeight + "px"; + } else { + elems[i].style.opacity = 0; + elems[i].style.maxHeight = null; + } + } + + for (var i = 0; i < links.length; ++i) { + if (open) { + links[i].style.opacity = 1; + links[i].style.maxHeight = links[i].scrollHeight + "px"; + links[i].style.pointerEvents = "auto"; + } else { + links[i].style.opacity = 0; + links[i].style.maxHeight = null; + links[i].style.pointerEvents = "none"; + } + } + }, + + load: function() { //Initialize main menu accordion panels to all start as "open" var terminal = document.getElementById("terminal-tab"); var createScript = document.getElementById("create-script-tab"); @@ -1090,7 +1148,7 @@ let Engine = { processPassiveFactionRepGain(numCyclesOffline); //Gang progress for BitNode 2 - if (Player.bitNodeN != null && Player.bitNodeN == 2 && Player.inGang()) { + if (Player.bitNodeN != null && Player.bitNodeN === 2 && Player.inGang()) { Player.gang.process(numCyclesOffline); } @@ -1108,45 +1166,20 @@ let Engine = { formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" + formatNumber(offlineProductionFromHacknetNodes, 2)); //Close main menu accordions for loaded game - terminal.style.maxHeight = null; - terminal.style.opacity = 0; - terminal.style.pointerEvents = "none"; - createScript.style.maxHeight = null; - createScript.style.opacity = 0; - createScript.style.pointerEvents = "none"; - activeScripts.style.maxHeight = null; - activeScripts.style.opacity = 0; - activeScripts.style.pointerEvents = "none"; - createProgram.style.maxHeight = null; - createProgram.style.opacity = 0; - createProgram.style.pointerEvents = "none"; - stats.style.maxHeight = null; - stats.style.opacity = 0; - stats.style.pointerEvents = "none"; - factions.style.maxHeight = null; - factions.style.opacity = 0; - factions.style.pointerEvents = "none"; - augmentations.style.maxHeight = null; - augmentations.style.opacity = 0; - augmentations.style.pointerEvents = "none"; - hacknetnodes.style.maxHeight = null; - hacknetnodes.style.opacity = 0; - hacknetnodes.style.pointerEvents = "none"; - city.style.maxHeight = null; - city.style.opacity = 0; - city.style.pointerEvents = "none"; - travel.style.maxHeight = null; - travel.style.opacity = 0; - travel.style.pointerEvents = "none"; - job.style.maxHeight = null; - job.style.opacity = 0; - job.style.pointerEvents = "none"; - tutorial.style.maxHeight = null; - tutorial.style.opacity = 0; - tutorial.style.pointerEvents = "none"; - options.style.maxHeight = null; - options.style.opacity = 0; - options.style.pointerEvents = "none"; + var visibleMenuTabs = [terminal, createScript, activeScripts, stats, + hacknetnodes, city, tutorial, options]; + if (Player.firstFacInvRecvd) {visibleMenuTabs.push(factions);} + else {factions.style.display = "none";} + if (Player.firstAugPurchased) {visibleMenuTabs.push(augmentations);} + else {augmentations.style.display = "none";} + if (Player.firstJobRecvd) {visibleMenuTabs.push(job);} + else {job.style.display = "none";} + if (Player.firstTimeTraveled) {visibleMenuTabs.push(travel);} + else {travel.style.display = "none";} + if (Player.firstProgramAvailable) {visibleMenuTabs.push(createProgram);} + else {createProgram.style.display = "none";} + + Engine.closeMainMenuHeader(visibleMenuTabs); } else { //No save found, start new game console.log("Initializing new game"); @@ -1177,32 +1210,19 @@ let Engine = { worldHdr.classList.toggle("opened"); var helpHdr = document.getElementById("help-menu-header"); helpHdr.classList.toggle("opened"); - terminal.style.maxHeight = terminal.scrollHeight + "px"; - terminal.style.display = "block"; - createScript.style.maxHeight = createScript.scrollHeight + "px"; - createScript.style.display = "block"; - activeScripts.style.maxHeight = activeScripts.scrollHeight + "px"; - activeScripts.style.display = "block"; - createProgram.style.maxHeight = createProgram.scrollHeight + "px"; - createProgram.style.display = "block"; - stats.style.maxHeight = stats.scrollHeight + "px"; - stats.style.display = "block"; - factions.style.maxHeight = factions.scrollHeight + "px"; - factions.style.display = "block"; - augmentations.style.maxHeight = augmentations.scrollHeight + "px"; - augmentations.style.display = "block"; - hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px"; - hacknetnodes.style.display = "block"; - city.style.maxHeight = city.scrollHeight + "px"; - city.style.display = "block"; - travel.style.maxHeight = travel.scrollHeight + "px"; - travel.style.display = "block"; - job.style.maxHeight = job.scrollHeight + "px"; - job.style.display = "block"; - tutorial.style.maxHeight = tutorial.scrollHeight + "px"; - tutorial.style.display = "block"; - options.style.maxHeight = options.scrollHeight + "px"; - options.style.display = "block"; + + //Hide tabs that wont be revealed until later + factions.style.display = "none"; + augmentations.style.display = "none"; + job.style.display = "none"; + travel.style.display = "none"; + createProgram.style.display = "none"; + + Engine.openMainMenuHeader( + [terminal, createScript, activeScripts, stats, + hacknetnodes, city, + tutorial, options] + ); //Start interactive tutorial iTutorialStart(); @@ -1210,6 +1230,7 @@ let Engine = { } //Initialize labels on game settings setSettingsLabels(); + Terminal.resetTerminalInput(); }, setDisplayElements: function() { @@ -1350,13 +1371,9 @@ let Engine = { //Main menu accordions var hackingHdr = document.getElementById("hacking-menu-header"); - //hackingHdr.classList.toggle("opened"); var characterHdr = document.getElementById("character-menu-header"); - //characterHdr.classList.toggle("opened"); var worldHdr = document.getElementById("world-menu-header"); - //worldHdr.classList.toggle("opened"); var helpHdr = document.getElementById("help-menu-header"); - //helpHdr.classList.toggle("opened"); hackingHdr.onclick = function() { var terminal = document.getElementById("terminal-tab"); @@ -1370,55 +1387,18 @@ let Engine = { var createProgramNot = document.getElementById("create-program-notification"); this.classList.toggle("opened"); if (terminal.style.maxHeight) { - terminal.style.opacity = 0; - terminal.style.maxHeight = null; - terminalLink.style.opacity = 0; - terminalLink.style.maxHeight = null; - terminalLink.style.pointerEvents = "none"; - - createScript.style.opacity = 0; - createScript.style.maxHeight = null; - createScriptLink.style.opacity = 0; - createScriptLink.style.maxHeight = null; - createScriptLink.style.pointerEvents = "none"; - - activeScripts.style.opacity = 0; - activeScripts.style.maxHeight = null; - activeScriptsLink.style.opacity = 0; - activeScriptsLink.style.maxHeight = null; - activeScriptsLink.style.pointerEvents = "none"; - - createProgram.style.opacity = 0; - createProgram.style.maxHeight = null; - createProgramLink.style.opacity = 0; - createProgramLink.style.maxHeight = null; - createProgramLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [terminal, createScript, activeScripts, createProgram], + [terminalLink, createScriptLink, activeScriptsLink, createProgramLink] + ); createProgramNot.style.display = "none"; } else { - terminal.style.maxHeight = terminal.scrollHeight + "px"; - terminal.style.opacity = 1; - terminalLink.style.maxHeight = terminalLink.scrollHeight + "px"; - terminalLink.style.opacity = 1; - terminalLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [terminal, createScript, activeScripts, createProgram], + [terminalLink, createScriptLink, activeScriptsLink, createProgramLink] + ); - createScript.style.maxHeight = createScript.scrollHeight + "px"; - createScript.style.opacity = 1; - createScriptLink.style.maxHeight = createScriptLink.scrollHeight + "px"; - createScriptLink.style.opacity = 1; - createScriptLink.style.pointerEvents = "auto"; - - activeScripts.style.maxHeight = activeScripts.scrollHeight + "px"; - activeScripts.style.opacity = 1; - activeScriptsLink.style.maxHeight = activeScriptsLink.scrollHeight + "px"; - activeScriptsLink.style.opacity = 1; - activeScriptsLink.style.pointerEvents = "auto"; - - createProgram.style.maxHeight = createProgram.scrollHeight + "px"; - createProgram.style.opacity = 1; - createProgramLink.style.maxHeight = createProgramLink.scrollHeight + "px"; - createProgramLink.style.opacity = 1; - createProgramLink.style.pointerEvents = "auto"; createProgramNot.style.display = "block" } } @@ -1434,53 +1414,15 @@ let Engine = { var hacknetnodesLink = document.getElementById("hacknet-nodes-menu-link"); this.classList.toggle("opened"); if (stats.style.maxHeight) { - stats.style.opacity = 0; - stats.style.maxHeight = null; - statsLink.style.opacity = 0; - statsLink.style.maxHeight = null; - statsLink.style.pointerEvents = "none"; - - factions.style.opacity = 0; - factions.style.maxHeight = null; - factionsLink.style.opacity = 0; - factionsLink.style.maxHeight = null; - factionsLink.style.pointerEvents = "none"; - - augmentations.style.opacity = 0; - augmentations.style.maxHeight = null; - augmentationsLink.style.opacity = 0; - augmentationsLink.style.maxHeight = null; - augmentationsLink.style.pointerEvents = "none"; - - hacknetnodes.style.opacity = 0; - hacknetnodes.style.maxHeight = null; - hacknetnodesLink.style.opacity = 0; - hacknetnodesLink.style.maxHeight = null; - hacknetnodesLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [stats, factions, augmentations, hacknetnodes], + [statsLink, factionsLink, augmentationsLink, hacknetnodesLink] + ); } else { - stats.style.maxHeight = stats.scrollHeight + "px"; - stats.style.opacity = 1; - statsLink.style.maxHeight = statsLink.scrollHeight + "px"; - statsLink.style.opacity = 1; - statsLink.style.pointerEvents = "auto"; - - factions.style.maxHeight = factions.scrollHeight + "px"; - factions.style.opacity = 1; - factionsLink.style.maxHeight = factionsLink.scrollHeight + "px"; - factionsLink.style.opacity = 1; - factionsLink.style.pointerEvents = "auto"; - - augmentations.style.maxHeight = augmentations.scrollHeight + "px"; - augmentations.style.opacity = 1; - augmentationsLink.style.maxHeight = augmentationsLink.scrollHeight + "px"; - augmentationsLink.style.opacity = 1; - augmentationsLink.style.pointerEvents = "auto"; - - hacknetnodes.style.maxHeight = hacknetnodes.scrollHeight + "px"; - hacknetnodes.style.opacity = 1; - hacknetnodesLink.style.maxHeight = hacknetnodesLink.scrollHeight + "px"; - hacknetnodesLink.style.opacity = 1; - hacknetnodesLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [stats, factions, augmentations, hacknetnodes], + [statsLink, factionsLink, augmentationsLink, hacknetnodesLink] + ); } } @@ -1493,41 +1435,15 @@ let Engine = { var jobLink = document.getElementById("job-menu-link"); this.classList.toggle("opened"); if (city.style.maxHeight) { - city.style.opacity = 0; - city.style.maxHeight = null; - cityLink.style.opacity = 0; - cityLink.style.maxHeight = null; - cityLink.style.pointerEvents = "none"; - - travel.style.opacity = 0; - travel.style.maxHeight = null; - travelLink.style.opacity = 0; - travelLink.style.maxHeight = null; - travelLink.style.pointerEvents = "none"; - - job.style.opacity = 0; - job.style.maxHeight = null; - jobLink.style.opacity = 0; - jobLink.style.maxHeight = null; - jobLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [city, travel, job], + [cityLink, travelLink, jobLink] + ); } else { - city.style.maxHeight = city.scrollHeight + "px"; - city.style.opacity = 1; - cityLink.style.maxHeight = cityLink.scrollHeight + "px"; - cityLink.style.opacity = 1; - cityLink.style.pointerEvents = "auto"; - - travel.style.maxHeight = travel.scrollHeight + "px"; - travel.style.opacity = 1; - travelLink.style.maxHeight = travelLink.scrollHeight + "px"; - travelLink.style.opacity = 1; - travelLink.style.pointerEvents = "auto"; - - job.style.maxHeight = job.scrollHeight + "px"; - job.style.opacity = 1; - jobLink.style.maxHeight = jobLink.scrollHeight + "px"; - jobLink.style.opacity = 1; - jobLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [city, travel, job], + [cityLink, travelLink, jobLink] + ); } } @@ -1538,29 +1454,15 @@ let Engine = { var optionsLink = document.getElementById("options-menu-link"); this.classList.toggle("opened"); if (tutorial.style.maxHeight) { - tutorial.style.opacity = 0; - tutorial.style.maxHeight = null; - tutorialLink.style.opacity = 0; - tutorialLink.style.maxHeight = null; - tutorialLink.style.pointerEvents = "none"; - - options.style.opacity = 0; - options.style.maxHeight = null; - optionsLink.style.opacity = 0; - optionsLink.style.maxHeight = null; - optionsLink.style.pointerEvents = "none"; + Engine.toggleMainMenuHeader(false, + [tutorial, options], + [tutorialLink, optionsLink] + ); } else { - tutorial.style.maxHeight = tutorial.scrollHeight + "px"; - tutorial.style.opacity = 1; - tutorialLink.style.maxHeight = tutorialLink.scrollHeight + "px"; - tutorialLink.style.opacity = 1; - tutorialLink.style.pointerEvents = "auto"; - - options.style.maxHeight = options.scrollHeight + "px"; - options.style.opacity = 1; - optionsLink.style.maxHeight = optionsLink.scrollHeight + "px"; - optionsLink.style.opacity = 1; - optionsLink.style.pointerEvents = "auto"; + Engine.toggleMainMenuHeader(true, + [tutorial, options], + [tutorialLink, optionsLink] + ); } } diff --git a/utils/DialogBox.js b/utils/DialogBox.js index 1f09e8532..3f38a95fa 100644 --- a/utils/DialogBox.js +++ b/utils/DialogBox.js @@ -61,4 +61,4 @@ function dialogBoxCreate(txt) { }, 400); } -export {dialogBoxCreate}; +export {dialogBoxCreate, dialogBoxOpened}; diff --git a/utils/InfiltrationBox.js b/utils/InfiltrationBox.js index 2c9fee5b0..1dece4d74 100644 --- a/utils/InfiltrationBox.js +++ b/utils/InfiltrationBox.js @@ -23,6 +23,14 @@ function infiltrationSetText(txt) { //ram argument is in GB function infiltrationBoxCreate(inst) { + //Gain exp + Player.gainHackingExp(inst.hackingExpGained); + Player.gainStrengthExp(inst.strExpGained); + Player.gainDefenseExp(inst.defExpGained); + Player.gainDexterityExp(inst.dexExpGained); + Player.gainAgilityExp(inst.agiExpGained); + Player.gainCharismaExp(inst.chaExpGained); + var totalValue = 0; for (var i = 0; i < inst.secretsStolen.length; ++i) { totalValue += inst.secretsStolen[i]; @@ -39,7 +47,7 @@ function infiltrationBoxCreate(inst) { formatNumber(inst.chaExpGained, 3) + " cha exp
"); return; } - var facValue = totalValue * Player.faction_rep_mult * 1.2 + var facValue = totalValue * Player.faction_rep_mult * 1.25 var moneyValue = totalValue * CONSTANTS.InfiltrationMoneyValue; infiltrationSetText("You can sell the classified documents and secrets " + "you stole from " + inst.companyName + " for $" + diff --git a/utils/LogBox.js b/utils/LogBox.js index 4cc62a672..be6b14e2b 100644 --- a/utils/LogBox.js +++ b/utils/LogBox.js @@ -39,13 +39,15 @@ var logBoxCurrentScript = null; function logBoxCreate(script) { logBoxCurrentScript = script; logBoxOpen(); + document.getElementById("log-box-text-header").innerHTML = + logBoxCurrentScript.filename + " " + printArray(logBoxCurrentScript.args) + ":

"; logBoxUpdateText(); } function logBoxUpdateText() { var txt = document.getElementById("log-box-text"); if (logBoxCurrentScript && logBoxOpened && txt) { - txt.innerHTML = logBoxCurrentScript.filename + printArray(logBoxCurrentScript.args) + ":

"; + txt.innerHTML = ""; for (var i = 0; i < logBoxCurrentScript.logs.length; ++i) { txt.innerHTML += logBoxCurrentScript.logs[i]; txt.innerHTML += "
"; diff --git a/utils/StringHelperFunctions.js b/utils/StringHelperFunctions.js index cd0d4c955..983cafd29 100644 --- a/utils/StringHelperFunctions.js +++ b/utils/StringHelperFunctions.js @@ -60,7 +60,7 @@ function longestCommonStart(strings) { var A = strings.concat().sort(), a1= A[0], a2= A[A.length-1], L= a1.length, i= 0; - while(i