mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 06:03:50 +01:00
Added copy save to clipbaord option. Added getOrders netscript function. Fixed Corporation Bugs
This commit is contained in:
parent
b540a56c50
commit
736020b33a
19
css/gameoptions.scss
Normal file
19
css/gameoptions.scss
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* Styling for the game options/settings
|
||||||
|
*
|
||||||
|
* Styling for the actual Game Options popup box can be found in popupboxes.scss
|
||||||
|
* This stylesheet is for everything inside the Game Options pop-up box
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import "theme";
|
||||||
|
|
||||||
|
#game-options-right-panel {
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
width: 46%;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: inline-block;
|
||||||
|
width: 46%;
|
||||||
|
}
|
||||||
|
}
|
1642
dist/engine.bundle.js
vendored
1642
dist/engine.bundle.js
vendored
File diff suppressed because it is too large
Load Diff
15
dist/engine.css
vendored
15
dist/engine.css
vendored
@ -1512,6 +1512,21 @@ button {
|
|||||||
#import-game-file-selector {
|
#import-game-file-selector {
|
||||||
display: none; }
|
display: none; }
|
||||||
|
|
||||||
|
/* Styling for the game options/settings
|
||||||
|
*
|
||||||
|
* Styling for the actual Game Options popup box can be found in popupboxes.scss
|
||||||
|
* This stylesheet is for everything inside the Game Options pop-up box
|
||||||
|
*/
|
||||||
|
/* COLORS */
|
||||||
|
/* Attributes */
|
||||||
|
#game-options-right-panel a {
|
||||||
|
display: block;
|
||||||
|
width: 46%; }
|
||||||
|
|
||||||
|
#game-options-right-panel button {
|
||||||
|
display: inline-block;
|
||||||
|
width: 46%; }
|
||||||
|
|
||||||
/* COLORS */
|
/* COLORS */
|
||||||
/* Attributes */
|
/* Attributes */
|
||||||
/* interactivetutorial.css */
|
/* interactivetutorial.css */
|
||||||
|
858
dist/vendor.bundle.js
vendored
858
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
25
index.html
25
index.html
@ -964,27 +964,30 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="game-options-right-panel">
|
<div id="game-options-right-panel">
|
||||||
<a class="a-link-button" style="display:block;" href="https://bitburner.readthedocs.io/en/latest/changelog.html" target="_blank"> Changelog </a>
|
<a class="a-link-button" href="https://bitburner.readthedocs.io/en/latest/changelog.html" target="_blank"> Changelog </a>
|
||||||
<a class="a-link-button" style="display:block;" href="https://bitburner.wikia.com" target="_blank">Wiki</a>
|
<a class="a-link-button" href="https://bitburner.wikia.com" target="_blank">Wiki</a>
|
||||||
<a class="a-link-button" style="display:block;" href="https://www.reddit.com/r/bitburner" target="_blank">Subreddit</a>
|
<a class="a-link-button" href="https://www.reddit.com/r/bitburner" target="_blank">Subreddit</a>
|
||||||
<a id="save-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Save Game </a>
|
<button id="save-game-link" class="a-link-button"> Save Game </button>
|
||||||
<a id="delete-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Delete Game </a>
|
<button id="delete-game-link" class="a-link-button"> Delete Game </button>
|
||||||
<a id="export-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Export Game </a>
|
<button id="export-game-link" class="a-link-button"> Export Game </button>
|
||||||
<input type="file" id="import-game-file-selector" name="file" />
|
<input type="file" id="import-game-file-selector" name="file" />
|
||||||
<a id="import-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Import Game </a>
|
<button id="import-game-link" class="a-link-button"> Import Game </button>
|
||||||
<a id="debug-delete-scripts-link" class="a-link-button tooltip" style="display:block;width:46%;">
|
<button id="copy-save-to-clipboard-link" class="std-button">
|
||||||
|
Copy Save data to Clipboard
|
||||||
|
</button>
|
||||||
|
<button id="debug-delete-scripts-link" class="a-link-button tooltip">
|
||||||
(DEBUG) Delete Active Scripts
|
(DEBUG) Delete Active Scripts
|
||||||
<span class="tooltiptextleft">
|
<span class="tooltiptextleft">
|
||||||
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
||||||
using this, save the game and then reload the page.
|
using this, save the game and then reload the page.
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</button>
|
||||||
<a id="debug-soft-reset" class="a-link-button tooltip" style="display:block;width:46%;">
|
<button id="debug-soft-reset" class="a-link-button tooltip">
|
||||||
(DEBUG) Soft Reset
|
(DEBUG) Soft Reset
|
||||||
<span class="tooltiptextleft">
|
<span class="tooltiptextleft">
|
||||||
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,7 +95,7 @@ let NetscriptFunctions =
|
|||||||
// TIX API
|
// TIX API
|
||||||
"getStockPrice|getStockPosition|getStockSymbols|buyStock|sellStock|" +
|
"getStockPrice|getStockPosition|getStockSymbols|buyStock|sellStock|" +
|
||||||
"shortStock|sellShort|" +
|
"shortStock|sellShort|" +
|
||||||
"placeOrder|cancelOrder|getStockVolatility|getStockForecast|" +
|
"placeOrder|cancelOrder|getOrders|getStockVolatility|getStockForecast|" +
|
||||||
"purchase4SMarketData|purchase4SMarketDataTixApi|" +
|
"purchase4SMarketData|purchase4SMarketDataTixApi|" +
|
||||||
|
|
||||||
// Hacknet Node API
|
// Hacknet Node API
|
||||||
|
@ -520,12 +520,15 @@ export let CONSTANTS: IMap<any> = {
|
|||||||
** Slightly reduced the effect "Real Estate" has on the Production Multiplier for the
|
** Slightly reduced the effect "Real Estate" has on the Production Multiplier for the
|
||||||
Agriculture industry
|
Agriculture industry
|
||||||
|
|
||||||
|
* Added getOrders() Netscript function to the TIX API
|
||||||
|
*
|
||||||
* Stock Market, Travel, and Corporation main menu links are now properly styled
|
* Stock Market, Travel, and Corporation main menu links are now properly styled
|
||||||
* Many pop-up/dialog boxes now support the 'Enter' and 'Esc' hotkeys. If you
|
* Many pop-up/dialog boxes now support the 'Enter' and 'Esc' hotkeys. If you
|
||||||
find a pop-up/dialog box that doesnt support this, let me know specifically which one
|
find a pop-up/dialog box that doesnt support this, let me know specifically which one
|
||||||
('Enter' for the default option, 'Esc' for cancelling and closing the pop-up box)
|
('Enter' for the default option, 'Esc' for cancelling and closing the pop-up box)
|
||||||
* Added "brace_style = preserve_inline" configuration to Script Editor Beautifier
|
* Added "brace_style = preserve_inline" configuration to Script Editor Beautifier
|
||||||
* ServerProfiler.exe can now be purchased from the Dark Web
|
* ServerProfiler.exe can now be purchased from the Dark Web
|
||||||
|
* Added an option to copy save data to clipboard
|
||||||
`
|
`
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2425,12 +2425,17 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
|
|||||||
let marketTaClickListener = () => {
|
let marketTaClickListener = () => {
|
||||||
const popupId = "cmpy-mgmt-marketta-popup";
|
const popupId = "cmpy-mgmt-marketta-popup";
|
||||||
const markupLimit = mat.getMarkupLimit();
|
const markupLimit = mat.getMarkupLimit();
|
||||||
const ta1 = createElemenet("p", {
|
const ta1 = createElement("p", {
|
||||||
innerText: "The maximum sale price you can mark this up to is " +
|
innerHTML: "<u><strong>Market-TA.I</strong></u><br>" +
|
||||||
|
"The maximum sale price you can mark this up to is " +
|
||||||
numeralWrapper.format(mat.bCost + markupLimit, '$0.000a') +
|
numeralWrapper.format(mat.bCost + markupLimit, '$0.000a') +
|
||||||
". This means that if you set the sale price higher than this, " +
|
". This means that if you set the sale price higher than this, " +
|
||||||
"you will begin to experience a loss in number of sales",
|
"you will begin to experience a loss in number of sales",
|
||||||
});
|
});
|
||||||
|
const closeBtn = createPopupCloseButton(popupId, {
|
||||||
|
class: "std-button",
|
||||||
|
display: "block",
|
||||||
|
});
|
||||||
|
|
||||||
if (industry.hasResearch("Market-TA.II")) {
|
if (industry.hasResearch("Market-TA.II")) {
|
||||||
let updateTa2Text;
|
let updateTa2Text;
|
||||||
@ -2442,11 +2447,11 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
|
|||||||
updateTa2Text();
|
updateTa2Text();
|
||||||
},
|
},
|
||||||
type: "number",
|
type: "number",
|
||||||
value: mat.sCost,
|
value: mat.bCost,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function that updates the text in ta2Text element
|
// Function that updates the text in ta2Text element
|
||||||
updateTa2Text = () => {
|
updateTa2Text = function() {
|
||||||
const sCost = parseFloat(ta2Input.value);
|
const sCost = parseFloat(ta2Input.value);
|
||||||
let markup = 1;
|
let markup = 1;
|
||||||
if (sCost > mat.bCost) {
|
if (sCost > mat.bCost) {
|
||||||
@ -2462,15 +2467,16 @@ Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
|
|||||||
markup = mat.bCost / sCost;
|
markup = mat.bCost / sCost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ta2Text.innerText = `If you sell at ${numeralWrapper.format(sCost, "$0.0001")}, ` +
|
ta2Text.innerHTML = `<br><u><strong>Market-TA.II</strong></u><br>` +
|
||||||
`then you will sell ${formatNumber(markup, 2)}x as much compared `
|
`If you sell at ${numeralWrapper.format(sCost, "$0.0001")}, ` +
|
||||||
|
`then you will sell ${formatNumber(markup, 5)}x as much compared ` +
|
||||||
`to if you sold at market price.`;
|
`to if you sold at market price.`;
|
||||||
}
|
}
|
||||||
updateTa2Text();
|
updateTa2Text();
|
||||||
createPopup(popupId, [ta1, ta2Input, ta2Text]);
|
createPopup(popupId, [ta1, ta2Text, ta2Input, closeBtn]);
|
||||||
} else {
|
} else {
|
||||||
// Market-TA.I only
|
// Market-TA.I only
|
||||||
createPopup(popupId, [ta1]);
|
createPopup(popupId, [ta1, closeBtn]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1713,6 +1713,40 @@ function NetscriptFunctions(workerScript) {
|
|||||||
};
|
};
|
||||||
return cancelOrder(params, workerScript);
|
return cancelOrder(params, workerScript);
|
||||||
},
|
},
|
||||||
|
getOrders : function() {
|
||||||
|
if (workerScript.checkingRam) {
|
||||||
|
return updateStaticRam("getOrders", CONSTANTS.ScriptBuySellStockRamCost);
|
||||||
|
}
|
||||||
|
updateDynamicRam("getOrders", CONSTANTS.ScriptBuySellStockRamCost);
|
||||||
|
if (!Player.hasTixApiAccess) {
|
||||||
|
throw makeRuntimeRejectMsg(workerScript, "You don't have TIX API Access! Cannot use getOrders()");
|
||||||
|
}
|
||||||
|
if (Player.bitNodeN !== 8) {
|
||||||
|
if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
|
||||||
|
throw makeRuntimeRejectMsg(workerScript, "ERROR: Cannot use getOrders(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const orders = {};
|
||||||
|
|
||||||
|
const stockMarketOrders = StockMarket["Orders"];
|
||||||
|
for (let symbol in stockMarketOrders) {
|
||||||
|
const orderBook = stockMarketOrders[symbol];
|
||||||
|
if (orderBook.constructor === Array && orderBook.length > 0) {
|
||||||
|
orders[symbol] = [];
|
||||||
|
for (let i = 0; i < orderBook.length; ++i) {
|
||||||
|
orders[symbol].push({
|
||||||
|
shares: orderBook[i].shares,
|
||||||
|
price: orderBook[i].price,
|
||||||
|
type: orderBook[i].type,
|
||||||
|
position: orderBook[i].pos,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return orders;
|
||||||
|
},
|
||||||
getStockVolatility : function(symbol) {
|
getStockVolatility : function(symbol) {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getStockVolatility", CONSTANTS.ScriptBuySellStockRamCost);
|
return updateStaticRam("getStockVolatility", CONSTANTS.ScriptBuySellStockRamCost);
|
||||||
|
@ -54,7 +54,7 @@ function BitburnerSaveObject() {
|
|||||||
this.CorporationResearchTreesSave = "";
|
this.CorporationResearchTreesSave = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
BitburnerSaveObject.prototype.saveGame = function(db) {
|
BitburnerSaveObject.prototype.getSaveString = function() {
|
||||||
this.PlayerSave = JSON.stringify(Player);
|
this.PlayerSave = JSON.stringify(Player);
|
||||||
|
|
||||||
//Delete all logs from all running scripts
|
//Delete all logs from all running scripts
|
||||||
@ -85,6 +85,12 @@ BitburnerSaveObject.prototype.saveGame = function(db) {
|
|||||||
}
|
}
|
||||||
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
|
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
|
||||||
|
|
||||||
|
return saveString;
|
||||||
|
}
|
||||||
|
|
||||||
|
BitburnerSaveObject.prototype.saveGame = function(db) {
|
||||||
|
var saveString = this.getSaveString();
|
||||||
|
|
||||||
//We'll save to both localstorage and indexedDb
|
//We'll save to both localstorage and indexedDb
|
||||||
var objectStore = db.transaction(["savestring"], "readwrite").objectStore("savestring");
|
var objectStore = db.transaction(["savestring"], "readwrite").objectStore("savestring");
|
||||||
var request = objectStore.put(saveString, "save");
|
var request = objectStore.put(saveString, "save");
|
||||||
|
@ -9,6 +9,7 @@ import { exceptionAlert } from "../utils/helpers/e
|
|||||||
import { removeLoadingScreen } from "../utils/uiHelpers/removeLoadingScreen";
|
import { removeLoadingScreen } from "../utils/uiHelpers/removeLoadingScreen";
|
||||||
|
|
||||||
import {numeralWrapper} from "./ui/numeralFormat";
|
import {numeralWrapper} from "./ui/numeralFormat";
|
||||||
|
import { createStatusText } from "./ui/createStatusText";
|
||||||
|
|
||||||
import {formatNumber,
|
import {formatNumber,
|
||||||
convertTimeMsToTimeElapsedString,
|
convertTimeMsToTimeElapsedString,
|
||||||
@ -89,6 +90,7 @@ import "../css/terminal.scss";
|
|||||||
import "../css/menupages.scss";
|
import "../css/menupages.scss";
|
||||||
import "../css/workinprogress.scss";
|
import "../css/workinprogress.scss";
|
||||||
import "../css/popupboxes.scss";
|
import "../css/popupboxes.scss";
|
||||||
|
import "../css/gameoptions.scss";
|
||||||
import "../css/interactivetutorial.scss";
|
import "../css/interactivetutorial.scss";
|
||||||
import "../css/loader.scss";
|
import "../css/loader.scss";
|
||||||
import "../css/missions.scss";
|
import "../css/missions.scss";
|
||||||
@ -97,6 +99,7 @@ import "../css/bladeburner.scss";
|
|||||||
import "../css/gang.scss";
|
import "../css/gang.scss";
|
||||||
import "../css/treant.css";
|
import "../css/treant.css";
|
||||||
|
|
||||||
|
|
||||||
/* Shortcuts to navigate through the game
|
/* Shortcuts to navigate through the game
|
||||||
* Alt-t - Terminal
|
* Alt-t - Terminal
|
||||||
* Alt-c - Character
|
* Alt-c - Character
|
||||||
@ -1804,6 +1807,43 @@ const Engine = {
|
|||||||
document.getElementById("city-menu-link").removeAttribute("class");
|
document.getElementById("city-menu-link").removeAttribute("class");
|
||||||
document.getElementById("tutorial-menu-link").removeAttribute("class");
|
document.getElementById("tutorial-menu-link").removeAttribute("class");
|
||||||
|
|
||||||
|
// Copy Save Data to Clipboard
|
||||||
|
document.getElementById("copy-save-to-clipboard-link").addEventListener("click", function() {
|
||||||
|
const saveString = saveObject.getSaveString();
|
||||||
|
if (!navigator.clipboard) {
|
||||||
|
// Async Clipboard API not supported, so we'll use this using the
|
||||||
|
// textarea and document.execCommand('copy') trick
|
||||||
|
const textArea = document.createElement("textarea");
|
||||||
|
textArea.value = saveString;
|
||||||
|
textArea.setAttribute("readonly", '');
|
||||||
|
textArea.style.position = 'absolute';
|
||||||
|
textArea.left = '-9999px';
|
||||||
|
document.body.appendChild(textArea);
|
||||||
|
textArea.focus();
|
||||||
|
textArea.select();
|
||||||
|
try {
|
||||||
|
const successful = document.execCommand("copy");
|
||||||
|
if (successful) {
|
||||||
|
createStatusText("Copied save to clipboard");
|
||||||
|
} else {
|
||||||
|
createStatusText("Failed to copy save");
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.error("Unable to copy save data to clipboard using document.execCommand('copy')");
|
||||||
|
createStatusText("Failed to copy save");
|
||||||
|
}
|
||||||
|
document.body.removeChild(textArea);
|
||||||
|
} else {
|
||||||
|
// Use the Async Clipboard API
|
||||||
|
navigator.clipboard.writeText(saveString).then(function() {
|
||||||
|
createStatusText("Copied save to clipboard");
|
||||||
|
}, function(e) {
|
||||||
|
console.error("Unable to copy save data to clipboard using Async API");
|
||||||
|
createStatusText("Failed to copy save");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//DEBUG Delete active Scripts on home
|
//DEBUG Delete active Scripts on home
|
||||||
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
|
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
|
||||||
console.log("Deleting running scripts on home computer");
|
console.log("Deleting running scripts on home computer");
|
||||||
|
@ -966,27 +966,30 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="game-options-right-panel">
|
<div id="game-options-right-panel">
|
||||||
<a class="a-link-button" style="display:block;" href="https://bitburner.readthedocs.io/en/latest/changelog.html" target="_blank"> Changelog </a>
|
<a class="a-link-button" href="https://bitburner.readthedocs.io/en/latest/changelog.html" target="_blank"> Changelog </a>
|
||||||
<a class="a-link-button" style="display:block;" href="https://bitburner.wikia.com" target="_blank">Wiki</a>
|
<a class="a-link-button" href="https://bitburner.wikia.com" target="_blank">Wiki</a>
|
||||||
<a class="a-link-button" style="display:block;" href="https://www.reddit.com/r/bitburner" target="_blank">Subreddit</a>
|
<a class="a-link-button" href="https://www.reddit.com/r/bitburner" target="_blank">Subreddit</a>
|
||||||
<a id="save-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Save Game </a>
|
<button id="save-game-link" class="a-link-button"> Save Game </button>
|
||||||
<a id="delete-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Delete Game </a>
|
<button id="delete-game-link" class="a-link-button"> Delete Game </button>
|
||||||
<a id="export-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Export Game </a>
|
<button id="export-game-link" class="a-link-button"> Export Game </button>
|
||||||
<input type="file" id="import-game-file-selector" name="file" />
|
<input type="file" id="import-game-file-selector" name="file" />
|
||||||
<a id="import-game-link" class="a-link-button" style="display:inline-block;width:46%;"> Import Game </a>
|
<button id="import-game-link" class="a-link-button"> Import Game </button>
|
||||||
<a id="debug-delete-scripts-link" class="a-link-button tooltip" style="display:block;width:46%;">
|
<button id="copy-save-to-clipboard-link" class="std-button">
|
||||||
|
Copy Save data to Clipboard
|
||||||
|
</button>
|
||||||
|
<button id="debug-delete-scripts-link" class="a-link-button tooltip">
|
||||||
(DEBUG) Delete Active Scripts
|
(DEBUG) Delete Active Scripts
|
||||||
<span class="tooltiptextleft">
|
<span class="tooltiptextleft">
|
||||||
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After
|
||||||
using this, save the game and then reload the page.
|
using this, save the game and then reload the page.
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</button>
|
||||||
<a id="debug-soft-reset" class="a-link-button tooltip" style="display:block;width:46%;">
|
<button id="debug-soft-reset" class="a-link-button tooltip">
|
||||||
(DEBUG) Soft Reset
|
(DEBUG) Soft Reset
|
||||||
<span class="tooltiptextleft">
|
<span class="tooltiptextleft">
|
||||||
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
Perform a soft reset. Resets everything as if you had just purchased an Augmentation.
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user