Finishing Infiltration returns to company page. Infiltration remembers selected faction

This commit is contained in:
danielyxie 2018-06-27 22:34:57 -05:00
parent 8046ec51a7
commit 393ce096fd
3 changed files with 32 additions and 4 deletions

18
dist/engine.bundle.js vendored

@ -72987,6 +72987,9 @@ __webpack_require__.r(__webpack_exports__);
//Keep track of last faction
var lastFac = "";
/* InfiltrationBox.js */ /* InfiltrationBox.js */
function infiltrationBoxClose() { function infiltrationBoxClose() {
var box = document.getElementById("infiltration-box-container"); var box = document.getElementById("infiltration-box-container");
@ -73041,12 +73044,22 @@ function infiltrationBoxCreate(inst) {
"that faction."); "that faction.");
var selector = document.getElementById("infiltration-faction-select"); var selector = document.getElementById("infiltration-faction-select");
selector.innerHTML = ""; selector.innerHTML = "";
for (var i = 0; i < _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions.length; ++i) { for (let i = 0; i < _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions.length; ++i) {
if (_src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] === "Bladeburners") {continue;} if (_src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] === "Bladeburners") {continue;}
selector.innerHTML += "<option value='" + _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] + selector.innerHTML += "<option value='" + _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] +
"'>" + _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] + "</option>"; "'>" + _src_Player__WEBPACK_IMPORTED_MODULE_3__["Player"].factions[i] + "</option>";
} }
//Set initial value, if applicable
if (lastFac !== "") {
for (let i = 0; i < selector.options.length; ++i) {
if (selector.options[i].value === lastFac) {
selector.selectedIndex = i;
break;
}
}
}
var sellButton = Object(_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-box-sell"); var sellButton = Object(_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-box-sell");
setTimeout(function() { setTimeout(function() {
sellButton.addEventListener("click", function() { sellButton.addEventListener("click", function() {
@ -73069,6 +73082,7 @@ function infiltrationBoxCreate(inst) {
setTimeout(function() { setTimeout(function() {
factionButton.addEventListener("click", function() { factionButton.addEventListener("click", function() {
var facName = selector.options[selector.selectedIndex].value; var facName = selector.options[selector.selectedIndex].value;
lastFac = facName;
var faction = _src_Faction__WEBPACK_IMPORTED_MODULE_2__["Factions"][facName]; var faction = _src_Faction__WEBPACK_IMPORTED_MODULE_2__["Factions"][facName];
if (faction == null) { if (faction == null) {
Object(_DialogBox__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("Error finding faction. This is a bug please report to developer"); Object(_DialogBox__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("Error finding faction. This is a bug please report to developer");
@ -73221,7 +73235,7 @@ function endInfiltration(inst, success) {
Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-bribe"); Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-bribe");
Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-escape"); Object(_utils_HelperFunctions__WEBPACK_IMPORTED_MODULE_5__["clearEventListeners"])("infiltration-escape");
_engine__WEBPACK_IMPORTED_MODULE_2__["Engine"].loadWorldContent(); _engine__WEBPACK_IMPORTED_MODULE_2__["Engine"].loadLocationContent();
} }
function nextInfiltrationLevel(inst) { function nextInfiltrationLevel(inst) {

@ -106,7 +106,7 @@ function endInfiltration(inst, success) {
clearEventListeners("infiltration-bribe"); clearEventListeners("infiltration-bribe");
clearEventListeners("infiltration-escape"); clearEventListeners("infiltration-escape");
Engine.loadWorldContent(); Engine.loadLocationContent();
} }
function nextInfiltrationLevel(inst) { function nextInfiltrationLevel(inst) {

@ -6,6 +6,9 @@ import {dialogBoxCreate} from "./DialogBox";
import {clearEventListeners} from "./HelperFunctions"; import {clearEventListeners} from "./HelperFunctions";
import {formatNumber} from "./StringHelperFunctions"; import {formatNumber} from "./StringHelperFunctions";
//Keep track of last faction
var lastFac = "";
/* InfiltrationBox.js */ /* InfiltrationBox.js */
function infiltrationBoxClose() { function infiltrationBoxClose() {
var box = document.getElementById("infiltration-box-container"); var box = document.getElementById("infiltration-box-container");
@ -60,12 +63,22 @@ function infiltrationBoxCreate(inst) {
"that faction."); "that faction.");
var selector = document.getElementById("infiltration-faction-select"); var selector = document.getElementById("infiltration-faction-select");
selector.innerHTML = ""; selector.innerHTML = "";
for (var i = 0; i < Player.factions.length; ++i) { for (let i = 0; i < Player.factions.length; ++i) {
if (Player.factions[i] === "Bladeburners") {continue;} if (Player.factions[i] === "Bladeburners") {continue;}
selector.innerHTML += "<option value='" + Player.factions[i] + selector.innerHTML += "<option value='" + Player.factions[i] +
"'>" + Player.factions[i] + "</option>"; "'>" + Player.factions[i] + "</option>";
} }
//Set initial value, if applicable
if (lastFac !== "") {
for (let i = 0; i < selector.options.length; ++i) {
if (selector.options[i].value === lastFac) {
selector.selectedIndex = i;
break;
}
}
}
var sellButton = clearEventListeners("infiltration-box-sell"); var sellButton = clearEventListeners("infiltration-box-sell");
setTimeout(function() { setTimeout(function() {
sellButton.addEventListener("click", function() { sellButton.addEventListener("click", function() {
@ -88,6 +101,7 @@ function infiltrationBoxCreate(inst) {
setTimeout(function() { setTimeout(function() {
factionButton.addEventListener("click", function() { factionButton.addEventListener("click", function() {
var facName = selector.options[selector.selectedIndex].value; var facName = selector.options[selector.selectedIndex].value;
lastFac = facName;
var faction = Factions[facName]; var faction = Factions[facName];
if (faction == null) { if (faction == null) {
dialogBoxCreate("Error finding faction. This is a bug please report to developer"); dialogBoxCreate("Error finding faction. This is a bug please report to developer");