Merge pull request #987 from danielyxie/dev

hotfix making getPlayer a non-singularity function
This commit is contained in:
hydroflame 2021-06-02 21:29:41 -04:00 committed by GitHub
commit 8d80ecffd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 43 additions and 46 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -5,8 +5,6 @@ getPlayer() Netscript Function
:RAM cost: 0.5 GB :RAM cost: 0.5 GB
If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
The result of this function can be passed to the :doc:`formulas API<../netscriptformulasapi>`. The result of this function can be passed to the :doc:`formulas API<../netscriptformulasapi>`.
Returns an object with the Player's stats. The object has the following properties:: Returns an object with the Player's stats. The object has the following properties::

@ -46,6 +46,7 @@ This includes information such as function signatures, what they do, and their r
getHackingLevel() <basicfunctions/getHackingLevel> getHackingLevel() <basicfunctions/getHackingLevel>
getHackingMultipliers() <basicfunctions/getHackingMultipliers> getHackingMultipliers() <basicfunctions/getHackingMultipliers>
getHacknetMultipliers() <basicfunctions/getHacknetMultipliers> getHacknetMultipliers() <basicfunctions/getHacknetMultipliers>
getPlayer() <basicfunctions/getPlayer>
getServerMoneyAvailable() <basicfunctions/getServerMoneyAvailable> getServerMoneyAvailable() <basicfunctions/getServerMoneyAvailable>
getServerMaxMoney() <basicfunctions/getServerMaxMoney> getServerMaxMoney() <basicfunctions/getServerMaxMoney>
getServerGrowth() <basicfunctions/getServerGrowth> getServerGrowth() <basicfunctions/getServerGrowth>

@ -28,7 +28,6 @@ level 3, then you will be able to access all of the Singularity Functions.
connect() <singularityfunctions/connect> connect() <singularityfunctions/connect>
manualHack() <singularityfunctions/manualHack> manualHack() <singularityfunctions/manualHack>
installBackdoor() <singularityfunctions/installBackdoor> installBackdoor() <singularityfunctions/installBackdoor>
getPlayer() <singularityfunctions/getPlayer>
hospitalize() <singularityfunctions/hospitalize> hospitalize() <singularityfunctions/hospitalize>
isBusy() <singularityfunctions/isBusy> isBusy() <singularityfunctions/isBusy>
stopAction() <singularityfunctions/stopAction> stopAction() <singularityfunctions/stopAction>

@ -387,7 +387,7 @@ function initAugmentations() {
const ArtificialSynapticPotentiation = new Augmentation({ const ArtificialSynapticPotentiation = new Augmentation({
name:AugmentationNames.ArtificialSynapticPotentiation, repCost:2500, moneyCost:16e6, name:AugmentationNames.ArtificialSynapticPotentiation, repCost:2500, moneyCost:16e6,
info:"The body is injected with a chemical that artificially induces synaptic potentiation, " + info:"The body is injected with a chemical that artificially induces synaptic potentiation, " +
"otherwise known as the strengthening of synapses. This results in a enhanced cognitive abilities.<br><br>" + "otherwise known as the strengthening of synapses. This results in enhanced cognitive abilities.<br><br>" +
"This augmentation:<br>" + "This augmentation:<br>" +
"Increases the player's hacking speed by 2%.<br>" + "Increases the player's hacking speed by 2%.<br>" +
"Increases the player's hacking chance by 5%.<br>" + "Increases the player's hacking chance by 5%.<br>" +

@ -123,8 +123,8 @@ export const Literatures: IMap<Literature> = {};
txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " + 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 " + "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 " + "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 " + "number is down to only 15%. Most of the world's energy now comes from nuclear power and renewable sources such as " +
"solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.<br><br>" + "solar and geothermal energy. Unfortunately, these efforts were not the huge success that they seem to be.<br><br>" +
"Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " + "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, " + "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, " + "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " +
@ -142,8 +142,8 @@ export const Literatures: IMap<Literature> = {};
title = "Alpha and Omega"; title = "Alpha and Omega";
fn = LiteratureNames.AlphaOmega; fn = LiteratureNames.AlphaOmega;
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. " + 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 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 " + "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 " + "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 " + "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " +
@ -169,8 +169,8 @@ export const Literatures: IMap<Literature> = {};
"by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " + "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 " + "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 " + "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 " + "we could create simulations that are indistinguishable from reality. However, if continued technological advancement " +
"of continued technological advancement, then it is very likely that such a scenario has already happened. <br><br>" + "is a reasonable outcome, then it is very likely that such a scenario has already happened. <br><br>" +
"Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " + "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?"; "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); Literatures[fn] = new Literature(title, fn, txt);
@ -199,7 +199,7 @@ export const Literatures: IMap<Literature> = {};
"drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " + "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.<br><br>" + "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.<br><br>" +
"TaiYang Digital is a Chinese internet-technology corporation that provides services such as " + "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 " + "online advertising, search engines, 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 " + "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " +
"associated with life, heat, masculinity, and heaven.<br><br>" + "associated with life, heat, masculinity, and heaven.<br><br>" +
"The company was founded " + "The company was founded " +
@ -217,15 +217,15 @@ export const Literatures: IMap<Literature> = {};
title = "Democracy is Dead: The Fall of an Empire"; title = "Democracy is Dead: The Fall of an Empire";
fn = LiteratureNames.DemocracyIsDead; fn = LiteratureNames.DemocracyIsDead;
txt = "They rose from the shadows in the street<br>From the places where the oppressed meet<br>" + txt = "They rose from the shadows in the street.<br>From the places where the oppressed meet.<br>" +
"Their cries echoed loudly through the air<br>As they once did in Tiananmen Square<br>" + "Their cries echoed loudly through the air.<br>As they once did in Tiananmen Square.<br>" +
"Loudness in the silence, Darkness in the light<br>They came forth with power and might<br>" + "Loudness in the silence, Darkness in the light.<br>They came forth with power and might.<br>" +
"Once the beacon of democracy, America was first<br>Its pillars of society destroyed and dispersed<br>" + "Once the beacon of democracy, America was first.<br>Its pillars of society destroyed and dispersed.<br>" +
"Soon the cries rose everywhere, with revolt and riot<br>Until one day, finally, all was quiet<br>" + "Soon the cries rose everywhere, with revolt and riot.<br>Until one day, finally, all was quiet.<br>" +
"From the ashes rose a new order, corporatocracy was its name<br>" + "From the ashes rose a new order, corporatocracy was its name.<br>" +
"Rome, Mongol, Byzantine, all of history is just the same<br>" + "Rome, Mongol, Byzantine, all of history is just the same.<br>" +
"For man will never change in a fundamental way<br>" + "For man will never change in a fundamental way.<br>" +
"And now democracy is dead, in the USA"; "And now democracy is dead, in the USA.";
Literatures[fn] = new Literature(title, fn, txt); Literatures[fn] = new Literature(title, fn, txt);
title = "Figures Show Rising Crime Rates in Sector-12"; title = "Figures Show Rising Crime Rates in Sector-12";
@ -382,15 +382,15 @@ export const Literatures: IMap<Literature> = {};
title = "The New God"; title = "The New God";
fn = LiteratureNames.TheNewGod; fn = LiteratureNames.TheNewGod;
txt = "Everyone has that moment in their life where they wonder about the bigger questions<br><br>" + txt = "Everyone has a moment in their life when they wonder about the bigger questions.<br><br>" +
"What's the point of all of this? What is my purpose?<br><br>" + "What's the point of all this? What is my purpose?<br><br>" +
"Some people dare to think even bigger<br><br>" + "Some people dare to think even bigger.<br><br>" +
"What will be the fate of the human race?<br><br>" + "What will the fate of the human race be?<br><br>" +
"We live in an era vastly different from that of even 15 or 20 years ago. We have gone " + "We live in an era vastly different from that of 15 or even 20 years ago. We have gone " +
"where no man has gone before. We have stripped ourselves of the tyranny of flesh.<br><br>" + "beyond the limits of humanity. We have stripped ourselves of the tyranny of flesh.<br><br>" +
"The Singularity is here. The merging of man and machine. This is where humanity evolves into " + "The Singularity is here. The merging of man and machine. This is where humanity evolves into "
"something greater. This is our future<br><br>" + "something greater. This is our future.<br><br>" +
"Embrace it, and you will obey a new god. The God in the Machine"; "Embrace it, and you will obey a new god. The God in the Machine.";
Literatures[fn] = new Literature(title, fn, txt); Literatures[fn] = new Literature(title, fn, txt);
title = "The New Triads"; title = "The New Triads";
@ -415,4 +415,4 @@ export const Literatures: IMap<Literature> = {};
fn = LiteratureNames.TheSecretWar; fn = LiteratureNames.TheSecretWar;
txt = "" txt = ""
Literatures[fn] = new Literature(title, fn, txt); Literatures[fn] = new Literature(title, fn, txt);
})() })()

@ -61,7 +61,7 @@ export function createTravelPopup(destination: CityName, travelFn: TravelFunctio
const yesBtn = yesNoBoxGetYesButton(); const yesBtn = yesNoBoxGetYesButton();
const noBtn = yesNoBoxGetNoButton(); const noBtn = yesNoBoxGetNoButton();
if (yesBtn == null || noBtn == null) { if (yesBtn == null || noBtn == null) {
console.warn(`Could nto find YesNo pop-up box buttons`); console.warn(`Could not find YesNo pop-up box buttons`);
return; return;
} }
@ -90,7 +90,7 @@ export function createTravelPopup(destination: CityName, travelFn: TravelFunctio
export function createPurchaseServerPopup(ram: number, p: IPlayer): void { export function createPurchaseServerPopup(ram: number, p: IPlayer): void {
const cost = getPurchaseServerCost(ram); const cost = getPurchaseServerCost(ram);
if (cost === Infinity) { if (cost === Infinity) {
dialogBoxCreate("Something went wrong when trying to purchase this server. Please contact developer"); dialogBoxCreate("Something went wrong when trying to purchase this server. Please contact developer.");
return; return;
} }
@ -137,7 +137,7 @@ export function createStartCorporationPopup(p: IPlayer): void {
innerText: "Self-Fund", innerText: "Self-Fund",
clickListener: () => { clickListener: () => {
if (!p.canAfford(150e9)) { if (!p.canAfford(150e9)) {
dialogBoxCreate("You don't have enough money to create a corporation! You need $150b"); dialogBoxCreate("You don't have enough money to create a corporation! You need $150b.");
return false; return false;
} }
@ -155,7 +155,7 @@ export function createStartCorporationPopup(p: IPlayer): void {
worldHeader.click(); worldHeader.click(); worldHeader.click(); worldHeader.click();
} }
dialogBoxCreate("Congratulations! You just self-funded your own corporation. You can visit " + dialogBoxCreate("Congratulations! You just self-funded your own corporation. You can visit " +
"and manage your company in the City"); "and manage your company in the City.");
removeElementById(popupId); removeElementById(popupId);
return false; return false;
}, },
@ -179,7 +179,7 @@ export function createStartCorporationPopup(p: IPlayer): void {
} }
dialogBoxCreate( dialogBoxCreate(
"Congratulations! You just started your own corporation with government seed money. " + "Congratulations! You just started your own corporation with government seed money. " +
"You can visit and manage your company in the City", "You can visit and manage your company in the City.",
); );
removeElementById(popupId); removeElementById(popupId);
return false; return false;
@ -200,7 +200,7 @@ export function createUpgradeHomeCoresPopup(p: IPlayer): void {
const currentCores = p.getHomeComputer().cpuCores; const currentCores = p.getHomeComputer().cpuCores;
if (currentCores >= 8) { if (currentCores >= 8) {
dialogBoxCreate(<> dialogBoxCreate(<>
You've have the maximum amount of CPU cores on your home computer. You have the maximum amount of CPU cores on your home computer.
</>); </>);
return; return;
} }
@ -263,7 +263,7 @@ export function createUpgradeHomeRamPopup(p: IPlayer): void {
const homeComputer = p.getHomeComputer(); const homeComputer = p.getHomeComputer();
if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) { if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) {
dialogBoxCreate(<> dialogBoxCreate(<>
You've have the maximum amount of RAM on your home computer. You have the maximum amount of RAM on your home computer.
</>); </>);
return; return;
} }
@ -293,11 +293,11 @@ export function createUpgradeHomeRamPopup(p: IPlayer): void {
*/ */
export function purchaseTorRouter(p: IPlayer): void { export function purchaseTorRouter(p: IPlayer): void {
if (p.hasTorRouter()) { if (p.hasTorRouter()) {
dialogBoxCreate(`You already have a TOR Router`); dialogBoxCreate(`You already have a TOR Router!`);
return; return;
} }
if (!p.canAfford(CONSTANTS.TorRouterCost)) { if (!p.canAfford(CONSTANTS.TorRouterCost)) {
dialogBoxCreate("You cannot afford to purchase the Tor router"); dialogBoxCreate("You cannot afford to purchase the TOR router!");
return; return;
} }
p.loseMoney(CONSTANTS.TorRouterCost); p.loseMoney(CONSTANTS.TorRouterCost);
@ -312,8 +312,8 @@ export function purchaseTorRouter(p: IPlayer): void {
p.getHomeComputer().serversOnNetwork.push(darkweb.ip); p.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(p.getHomeComputer().ip); darkweb.serversOnNetwork.push(p.getHomeComputer().ip);
dialogBoxCreate( dialogBoxCreate(
"You have purchased a Tor router!<br>" + "You have purchased a TOR router!<br>" +
"You now have access to the dark web from your home computer<br>" + "You now have access to the dark web from your home computer.<br>" +
"Use the scan/scan-analyze commands to search for the dark web connection.", "Use the scan/scan-analyze commands to search for the dark web connection.",
); );
} }

@ -2946,7 +2946,6 @@ function NetscriptFunctions(workerScript) {
}, },
getPlayer: function() { getPlayer: function() {
updateDynamicRam("getPlayer", getRamCost("getPlayer")); updateDynamicRam("getPlayer", getRamCost("getPlayer"));
checkSingularityAccess("getPlayer", 1);
const data = { const data = {
hacking_skill: Player.hacking_skill, hacking_skill: Player.hacking_skill,

@ -37,7 +37,7 @@ export class CharacterOverviewComponent extends Component {
<table> <table>
<tbody> <tbody>
<tr id="character-hp-wrapper"> <tr id="character-hp-wrapper">
<td className="character-hp-cell">Hp:</td><td id="character-hp-text" className="character-hp-cell character-stat-cell">{numeralWrapper.formatHp(Player.hp) + " / " + numeralWrapper.formatHp(Player.max_hp)}</td> <td className="character-hp-cell">HP:</td><td id="character-hp-text" className="character-hp-cell character-stat-cell">{numeralWrapper.formatHp(Player.hp) + " / " + numeralWrapper.formatHp(Player.max_hp)}</td>
</tr> </tr>
<tr id="character-money-wrapper"> <tr id="character-money-wrapper">
<td className="character-money-cell">Money:&nbsp;</td><td id="character-money-text" className="character-money-cell character-stat-cell">{numeralWrapper.formatMoney(Player.money.toNumber())}</td> <td className="character-money-cell">Money:&nbsp;</td><td id="character-money-text" className="character-money-cell character-stat-cell">{numeralWrapper.formatMoney(Player.money.toNumber())}</td>