[refactor] Extracting Locations to its own file to remove circular dependency

This commit is contained in:
Steven Evans 2018-07-21 00:22:04 -04:00
parent 26b0840f26
commit 826a8799fa
9 changed files with 101 additions and 97 deletions

@ -4,7 +4,7 @@ import {CONSTANTS} from "./Constants";
import {Engine} from "./engine"; import {Engine} from "./engine";
import {Faction, Factions, factionExists, import {Faction, Factions, factionExists,
joinFaction, displayFactionContent} from "./Faction"; joinFaction, displayFactionContent} from "./Faction";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {Player} from "./Player"; import {Player} from "./Player";
import {hackWorldDaemon, redPillFlag} from "./RedPill"; import {hackWorldDaemon, redPillFlag} from "./RedPill";
import {KEY} from "../utils/helpers/keyCodes"; import {KEY} from "../utils/helpers/keyCodes";

@ -1,6 +1,5 @@
import {CONSTANTS} from "./Constants"; import {CONSTANTS} from "./Constants";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {Player} from "./Player";
import {Reviver, Generic_toJSON, import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver"; Generic_fromJSON} from "../utils/JSONReviver";

@ -1,7 +1,7 @@
import {BitNodeMultipliers} from "./BitNode"; import {BitNodeMultipliers} from "./BitNode";
import {Factions} from "./Faction"; import {Factions} from "./Faction";
import {showLiterature} from "./Literature"; import {showLiterature} from "./Literature";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {Player} from "./Player"; import {Player} from "./Player";
import Decimal from "decimal.js"; import Decimal from "decimal.js";

@ -7,6 +7,7 @@ import {Crimes} from "./Crimes";
import {Engine} from "./engine"; import {Engine} from "./engine";
import {beginInfiltration} from "./Infiltration"; import {beginInfiltration} from "./Infiltration";
import {hasBladeburnerSF} from "./NetscriptFunctions"; import {hasBladeburnerSF} from "./NetscriptFunctions";
import {Locations} from "./Locations";
import {Player} from "./Player"; import {Player} from "./Player";
import {Server, AllServers, AddToAllServers} from "./Server"; import {Server, AllServers, AddToAllServers} from "./Server";
import {purchaseServer, import {purchaseServer,
@ -25,95 +26,8 @@ import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
yesNoTxtInpBoxGetInput, yesNoBoxClose, yesNoTxtInpBoxGetInput, yesNoBoxClose,
yesNoTxtInpBoxClose} from "../utils/YesNoBox"; yesNoTxtInpBoxClose} from "../utils/YesNoBox";
/* Display Location Content when visiting somewhere in the World*/
var Locations = {
//Cities
Aevum: "Aevum",
//AevumDesc: ""
Chongqing: "Chongqing",
Sector12: "Sector-12",
NewTokyo: "New Tokyo",
Ishima: "Ishima",
Volhaven: "Volhaven",
//Aevum Locations
AevumTravelAgency: "Aevum Travel Agency",
AevumSummitUniversity: "Summit University",
AevumECorp: "ECorp",
AevumBachmanAndAssociates: "Bachman & Associates",
AevumClarkeIncorporated: "Clarke Incorporated",
AevumFulcrumTechnologies: "Fulcrum Technologies",
AevumAeroCorp: "AeroCorp",
AevumGalacticCybersystems: "Galactic Cybersystems",
AevumWatchdogSecurity: "Watchdog Security",
AevumRhoConstruction: "Rho Construction",
AevumPolice: "Aevum Police Headquarters",
AevumNetLinkTechnologies: "NetLink Technologies",
AevumCrushFitnessGym: "Crush Fitness Gym",
AevumSnapFitnessGym: "Snap Fitness Gym",
AevumSlums: "Aevum Slums",
//Chongqing locations
ChongqingTravelAgency: "Chongqing Travel Agency",
ChongqingKuaiGongInternational: "KuaiGong International",
ChongqingSolarisSpaceSystems: "Solaris Space Systems",
ChongqingSlums: "Chongqing Slums",
//Sector 12
Sector12TravelAgency: "Sector-12 Travel Agency",
Sector12RothmanUniversity: "Rothman University",
Sector12MegaCorp: "MegaCorp",
Sector12BladeIndustries: "Blade Industries",
Sector12FourSigma: "Four Sigma",
Sector12IcarusMicrosystems: "Icarus Microsystems",
Sector12UniversalEnergy: "Universal Energy",
Sector12DeltaOne: "DeltaOne",
Sector12CIA: "Central Intelligence Agency",
Sector12NSA: "National Security Agency",
Sector12AlphaEnterprises: "Alpha Enterprises",
Sector12CarmichaelSecurity: "Carmichael Security",
Sector12FoodNStuff: "FoodNStuff",
Sector12JoesGuns: "Joe's Guns",
Sector12IronGym: "Iron Gym",
Sector12PowerhouseGym: "Powerhouse Gym",
Sector12Slums: "Sector-12 Slums",
Sector12CityHall: "Sector-12 City Hall",
//New Tokyo
NewTokyoTravelAgency: "New Tokyo Travel Agency",
NewTokyoDefComm: "DefComm",
NewTokyoVitaLife: "VitaLife",
NewTokyoGlobalPharmaceuticals: "Global Pharmaceuticals",
NewTokyoNoodleBar: "Noodle Bar",
NewTokyoSlums: "New Tokyo Slums",
//Ishima
IshimaTravelAgency: "Ishima Travel Agency",
IshimaStormTechnologies: "Storm Technologies",
IshimaNovaMedical: "Nova Medical",
IshimaOmegaSoftware: "Omega Software",
IshimaSlums: "Ishima Slums",
//Volhaven
VolhavenTravelAgency: "Volhaven Travel Agency",
VolhavenZBInstituteOfTechnology: "ZB Institute of Technology",
VolhavenOmniTekIncorporated: "OmniTek Incorporated",
VolhavenNWO: "NWO",
VolhavenHeliosLabs: "Helios Labs",
VolhavenOmniaCybersystems: "Omnia Cybersystems",
VolhavenLexoCorp: "LexoCorp",
VolhavenSysCoreSecurities: "SysCore Securities",
VolhavenCompuTek: "CompuTek",
VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
VolhavenSlums: "Volhaven Slums",
//Generic locations
Hospital: "Hospital",
WorldStockExchange: "World Stock Exchange",
}
function displayLocationContent() { function displayLocationContent() {
if (Engine.debug) { if (Engine.Debug) {
console.log("displayLocationContent() called with location " + Player.location) console.log("displayLocationContent() called with location " + Player.location)
} }
@ -2199,4 +2113,4 @@ function purchaseServerBoxCreate(ram, cost) {
"Please enter the server hostname below:<br>"); "Please enter the server hostname below:<br>");
} }
export {Locations, displayLocationContent, initLocationButtons}; export {displayLocationContent, initLocationButtons};

90
src/Locations.ts Normal file

@ -0,0 +1,90 @@
import { IMap } from "./types";
/**
* Display Location Content when visiting somewhere in the World
*/
// tslint:disable-next-line:variable-name
export const Locations: IMap<string> = {
// Cities
Aevum: "Aevum",
Chongqing: "Chongqing",
Ishima: "Ishima",
NewTokyo: "New Tokyo",
Sector12: "Sector-12",
Volhaven: "Volhaven",
// Aevum Locations
AevumAeroCorp: "AeroCorp",
AevumBachmanAndAssociates: "Bachman & Associates",
AevumClarkeIncorporated: "Clarke Incorporated",
AevumCrushFitnessGym: "Crush Fitness Gym",
AevumECorp: "ECorp",
AevumFulcrumTechnologies: "Fulcrum Technologies",
AevumGalacticCybersystems: "Galactic Cybersystems",
AevumNetLinkTechnologies: "NetLink Technologies",
AevumPolice: "Aevum Police Headquarters",
AevumRhoConstruction: "Rho Construction",
AevumSlums: "Aevum Slums",
AevumSnapFitnessGym: "Snap Fitness Gym",
AevumSummitUniversity: "Summit University",
AevumTravelAgency: "Aevum Travel Agency",
AevumWatchdogSecurity: "Watchdog Security",
// Chongqing locations
ChongqingKuaiGongInternational: "KuaiGong International",
ChongqingSlums: "Chongqing Slums",
ChongqingSolarisSpaceSystems: "Solaris Space Systems",
ChongqingTravelAgency: "Chongqing Travel Agency",
// Sector 12
Sector12AlphaEnterprises: "Alpha Enterprises",
Sector12BladeIndustries: "Blade Industries",
Sector12CIA: "Central Intelligence Agency",
Sector12CarmichaelSecurity: "Carmichael Security",
Sector12CityHall: "Sector-12 City Hall",
Sector12DeltaOne: "DeltaOne",
Sector12FoodNStuff: "FoodNStuff",
Sector12FourSigma: "Four Sigma",
Sector12IcarusMicrosystems: "Icarus Microsystems",
Sector12IronGym: "Iron Gym",
Sector12JoesGuns: "Joe's Guns",
Sector12MegaCorp: "MegaCorp",
Sector12NSA: "National Security Agency",
Sector12PowerhouseGym: "Powerhouse Gym",
Sector12RothmanUniversity: "Rothman University",
Sector12Slums: "Sector-12 Slums",
Sector12TravelAgency: "Sector-12 Travel Agency",
Sector12UniversalEnergy: "Universal Energy",
// New Tokyo
NewTokyoDefComm: "DefComm",
NewTokyoGlobalPharmaceuticals: "Global Pharmaceuticals",
NewTokyoNoodleBar: "Noodle Bar",
NewTokyoSlums: "New Tokyo Slums",
NewTokyoTravelAgency: "New Tokyo Travel Agency",
NewTokyoVitaLife: "VitaLife",
// Ishima
IshimaNovaMedical: "Nova Medical",
IshimaOmegaSoftware: "Omega Software",
IshimaSlums: "Ishima Slums",
IshimaStormTechnologies: "Storm Technologies",
IshimaTravelAgency: "Ishima Travel Agency",
// Volhaven
VolhavenCompuTek: "CompuTek",
VolhavenHeliosLabs: "Helios Labs",
VolhavenLexoCorp: "LexoCorp",
VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
VolhavenNWO: "NWO",
VolhavenOmniTekIncorporated: "OmniTek Incorporated",
VolhavenOmniaCybersystems: "Omnia Cybersystems",
VolhavenSlums: "Volhaven Slums",
VolhavenSysCoreSecurities: "SysCore Securities",
VolhavenTravelAgency: "Volhaven Travel Agency",
VolhavenZBInstituteOfTechnology: "ZB Institute of Technology",
// Generic locations
Hospital: "Hospital",
WorldStockExchange: "World Stock Exchange",
};

@ -17,7 +17,7 @@ import {AllGangs} from "./Gang";
import {Factions, Faction, joinFaction, import {Factions, Faction, joinFaction,
factionExists, purchaseAugmentation} from "./Faction"; factionExists, purchaseAugmentation} from "./Faction";
import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode"; import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {Message, Messages} from "./Message"; import {Message, Messages} from "./Message";
import {inMission} from "./Missions"; import {inMission} from "./Missions";
import {Player} from "./Player"; import {Player} from "./Player";

@ -13,7 +13,7 @@ import {Engine} from "./engine";
import {Factions, Faction, import {Factions, Faction,
displayFactionContent} from "./Faction"; displayFactionContent} from "./Faction";
import {Gang, resetGangs} from "./Gang"; import {Gang, resetGangs} from "./Gang";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions"; import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions";
import {AllServers, Server, AddToAllServers} from "./Server"; import {AllServers, Server, AddToAllServers} from "./Server";
import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps"; import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps";

@ -1,5 +1,5 @@
import {CONSTANTS} from "./Constants"; import {CONSTANTS} from "./Constants";
import {Locations} from "./Location"; import {Locations} from "./Locations";
import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions"; import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions";
import {WorkerScript} from "./NetscriptWorker"; import {WorkerScript} from "./NetscriptWorker";
import {Player} from "./Player"; import {Player} from "./Player";

@ -32,8 +32,9 @@ import {displayFactionContent, joinFaction,
processPassiveFactionRepGain, Factions, processPassiveFactionRepGain, Factions,
inviteToFaction, initFactions} from "./Faction"; inviteToFaction, initFactions} from "./Faction";
import {FconfSettings} from "./Fconf"; import {FconfSettings} from "./Fconf";
import {Locations, displayLocationContent, import {displayLocationContent,
initLocationButtons} from "./Location"; initLocationButtons} from "./Location";
import {Locations} from "./Locations";
import {displayGangContent, updateGangContent, import {displayGangContent, updateGangContent,
Gang} from "./Gang"; Gang} from "./Gang";
import {displayHacknetNodesContent, processAllHacknetNodeEarnings, import {displayHacknetNodesContent, processAllHacknetNodeEarnings,