Small UI improvements, balancing crime money

This commit is contained in:
Daniel Xie 2017-05-06 14:12:45 -05:00
parent 2e55f1d472
commit 534f5c1dbe
12 changed files with 107 additions and 107 deletions

@ -189,6 +189,12 @@
width: 99%;
}
#world-city-name,
#world-city-desc {
padding: 4px;
margin: 4px;
}
/* Create program */
#create-program-container {
position: fixed;
@ -248,16 +254,28 @@
margin: 6px;
}
#faction-hack-button-div, #faction-hack-text-div {
display:inline-block;
#faction-hack-div,
#faction-fieldwork-div,
#faction-securitywork-div {
overflow: hidden;
height: 100%;
}
#faction-fieldwork-button-div, #faction-fieldwork-text-div {
display:inline-block;
#faction-hack-div-wrapper,
#faction-fieldwork-div-wrapper,
#faction-securitywork-div-wrapper {
float: left;
border: 2px solid #333;
padding: 14px 6px 4px 6px;
margin: 6px;
}
#faction-securitywork-button-div, #faction-securitywork-text-div {
display:inline-block;
#faction-hack-button {
margin: 8px;
}
div.faction-clear {
clear: both;
}
#faction-container p {

@ -177,6 +177,8 @@
<!-- World -->
<div id="world-container" class="world-container">
<h2 id="world-city-name"> </h2>
<p id="world-city-desc"> </p>
<ul id="aevum-locations-list">
<li id="aevum-travelagency-li">
<a href="#" id="aevum-travelagency" class="a-link-button"> Travel Agency </a>
@ -373,30 +375,12 @@
<!-- Create a program(executable) -->
<div id="create-program-container">
<ul id="create-program-list">
<a class="create-program-a-link-button" id="create-program-porthack" href="#">
PortHack.exe
</a>
<a class="create-program-a-link-button" id="create-program-brutessh" href="#">
BruteSSH.exe
</a>
<a class="create-program-a-link-button" id="create-program-ftpcrack" href="#">
FTPCrack.exe
</a>
<a class="create-program-a-link-button" id="create-program-relaysmtp" href="#">
relaySMTP.exe
</a>
<a class="create-program-a-link-button" id="create-program-httpworm" href="#">
HTTPWorm.exe
</a>
<a class="create-program-a-link-button" id="create-program-sqlinject" href="#">
SQLInject.exe
</a>
<a class="create-program-a-link-button" id="create-program-porthack" href="#">PortHack.exe</a>
<a class="create-program-a-link-button" id="create-program-brutessh" href="#">BruteSSH.exe</a>
<a class="create-program-a-link-button" id="create-program-ftpcrack" href="#">FTPCrack.exe</a>
<a class="create-program-a-link-button" id="create-program-relaysmtp" href="#">relaySMTP.exe</a>
<a class="create-program-a-link-button" id="create-program-httpworm" href="#">HTTPWorm.exe</a>
<a class="create-program-a-link-button" id="create-program-sqlinject" href="#">SQLInject.exe</a>
</ul>
</div>
@ -404,8 +388,7 @@
<div id="factions-container">
<h1> Factions </h1>
<p> Lists all factions you have joined </p>
<ul class="factions-list" id="factions-list">
</ul>
<ul class="factions-list" id="factions-list"></ul>
</div>
<!-- Single Faction info (when you select a faction from the Factions menu) -->
@ -419,45 +402,50 @@
Perform work/carry out assignments for your faction to help further its cause! Each
task takes a certain amount of time to complete, which is dependent on your stats. Completing
a task will earn you exp and increase your reputation with the faction. Note that you cannot
use your terminal or create scripts when you are performing a task!
use your terminal or create scripts when you are performing a task! <br><br><br><br>
</p>
<div id="faction-hack-div">
<a href="#" id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
<p id="faction-hack-text">
Complete hacking contracts for your faction! <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. <br>
Gain hacking exp.
</p>
<div id="faction-hack-text-div">
</div>
<div id="faction-hack-div-wrapper">
<a href="#" id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
<p id="faction-hack-text">
Complete hacking contracts for your faction! <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. <br>
You will gain hacking exp.
</p>
</div>
<div class="faction-clear"></div>
</div>
<div id="faction-fieldwork-div">
<a href="#" id="faction-fieldwork-button" class="a-link-button">Field Work</a>
<div id="faction-fieldwork-text-div">
<p id="faction-fieldwork-text">
Carry out field missions for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. <br>
Gains exp for all stats.
</p>
</div>
<div id="faction-fieldwork-div-wrapper">
<a href="#" id="faction-fieldwork-button" class="a-link-button">Field Work</a>
<p id="faction-fieldwork-text">
Carry out field missions for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. <br>
You will gain exp for all stats.
</p>
</div>
<div class="faction-clear"></div>
</div>
<div id="faction-securitywork-div">
<a href="#" id="faction-securitywork-button" class="a-link-button">Security Work</a>
<div id="faction-securitywork-text-div">
<p id="faction-securitywork-text">
Serve in a security detail for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. <br>
Gains exp for all combat stats.
</p>
</div>
<div id="faction-securitywork-div-wrapper">
<a href="#" id="faction-securitywork-button" class="a-link-button">Security Work</a>
<p id="faction-securitywork-text">
Serve in a security detail for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. <br>
You will gain exp for all combat stats.
</p>
</div>
<div class="faction-clear"></div>
</div>
<p>
<br><br><br>
As your reputation with this faction rises, you will unlock Augmentations, which you
can purchase to enhance your abilities.
<br><br>
</p>
<a href="#" id="faction-purchase-augmentations" class="a-link-button">Purchase Augmentations</a>
</div>
@ -542,7 +530,7 @@
<a href="#" id="location-purchase-256gb" class="a-link-button"> Purchase 256GB Server - $100,000,000</a>
<a href="#" id="location-purchase-512gb" class="a-link-button"> Purchase 512GB Server - $250,000,000</a>
<a href="#" id="location-purchase-1tb" class="a-link-button"> Purchase 1TB Server - $750,000,000</a>
<a href="#" id="location-purchase-tor" class="a-link-button"> Purchase TOR Router - $100,000</a>
<a href="#" id="location-purchase-tor" class="a-link-button"> Purchase TOaR Router - $100,000</a>
<a href="#" id="location-purchase-home-ram" class="a-link-button"> Purchase RAM for Home computer </a>
<!-- Travel agency -->
@ -619,7 +607,7 @@
<!-- Purchase Augmentation Pop-up Box -->
<div id="purchase-augmentation-box-container">
<div id="purchase-augmentation-box-content">
<h2 id="purchase-augmentation-box-aug-name"> <h2>
<h2 id="purchase-augmentation-box-aug-name"> </h2>
<p id="purchase-augmentation-box-aug-info"> </p>
<p id="purchase-augmentation-box-text"> </p>
<p> <br> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>

@ -17,7 +17,7 @@ CONSTANTS = {
/* Hacknet Node constants */
HacknetNodeMoneyGainPerLevel: 0.75,
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
HacknetNodeUpgradeLevelMult: 1.08, //Multiplier for cost when upgrading level
HacknetNodeUpgradeLevelMult: 1.07, //Multiplier for cost when upgrading level
HacknetNodeUpgradeRamMult: 1.2, //Multiplier for cost when upgrading RAM
HacknetNodeUpgradeCoreMult: 1.5, //Multiplier for cost when buying another core

@ -1,32 +1,32 @@
/* Crimes.js */
function commitShopliftCrime() {
Player.crimeType = CONSTANTS.CrimeShoplift;
Player.startCrime(0, 0.5, 0.5, 0.5, 0.5, 0, 100, 3000); //$33.33/s, .167 exp/s
Player.startCrime(0, 0.5, 0.5, 0.5, 0.5, 0, 500, 3000); //$166.66/s, .167 exp/s
}
function commitMugCrime() {
Player.crimeType = CONSTANTS.CrimeMug;
Player.startCrime(0, 1, 1, 1, 1, 0, 250, 5000); //$50/s, .2 exp/s
Player.startCrime(0, 1, 1, 1, 1, 0, 1000, 5000); //$200/s, .2 exp/s
}
function commitDealDrugsCrime() {
Player.crimeType = CONSTANTS.CrimeDrugs;
Player.startCrime(0, 2, 2, 2, 2, 2, 1000, 10000); //$100/s, .2 exp/s
Player.startCrime(0, 2, 2, 2, 2, 2, 2500, 10000); //$250/s, .2 exp/s
}
function commitTraffickArmsCrime() {
Player.crimeType = CONSTANTS.CrimeTraffickArms;
Player.startCrime(0, 8, 8, 8, 8, 12, 5000, 40000); //$125/s, .2 combat exp/s, .3 cha exp/s
Player.startCrime(0, 8, 8, 8, 8, 12, 15000, 40000); //$375/s, .2 combat exp/s, .3 cha exp/s
}
function commitHomicideCrime() {
Player.crimeType = CONSTANTS.CrimeHomicide;
Player.startCrime(0, 2, 2, 2, 2, 0, 300, 3000); //$100/s, 0.66 combat exp/s
Player.startCrime(0, 2, 2, 2, 2, 0, 600, 3000); //$200/s, 0.66 combat exp/s
}
function commitKidnapCrime() {
Player.crimeType = CONSTANTS.CrimeKidnap;
Player.startCrime(0, 20, 20, 20, 20, 20, 20000, 120000); //$166.67/s. .167 exp/s
Player.startCrime(0, 20, 20, 20, 20, 20, 50000, 120000); //$416.67/s. .167 exp/s
}
function determineCrimeSuccess(crime, moneyGained) {

@ -41,7 +41,7 @@ executeDarkwebTerminalCommand = function(commandArray) {
listAllDarkwebItems = function() {
for (var item in DarkWebItems) {
if (DarkWebItems.hasOwnProperty(item)) {
post(item);
post(DarkWebItems[item]);
}
}
}
@ -62,7 +62,7 @@ buyDarkwebItem = function(itemName) {
if (price > 0 && Player.money >= price) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.FTPCrackProgram);
post("You have purchased the BruteSSH.exe program. The new program " +
post("You have purchased the FTPCrack.exe program. The new program " +
"can be found on your home computer.");
} else {
post("Not enough money to purchase " + itemName);
@ -72,7 +72,7 @@ buyDarkwebItem = function(itemName) {
if (price > 0 && Player.money >= price) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram);
post("You have purchased the BruteSSH.exe program. The new program " +
post("You have purchased the relaySMTP.exe program. The new program " +
"can be found on your home computer.");
} else {
post("Not enough money to purchase " + itemName);
@ -82,7 +82,7 @@ buyDarkwebItem = function(itemName) {
if (price > 0 && Player.money >= price) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.HTTPWormProgram);
post("You have purchased the BruteSSH.exe program. The new program " +
post("You have purchased the HTTPWorm.exe program. The new program " +
"can be found on your home computer.");
} else {
post("Not enough money to purchase " + itemName);
@ -92,7 +92,7 @@ buyDarkwebItem = function(itemName) {
if (price > 0 && Player.money >= price) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.SQLInjectProgram);
post("You have purchased the BruteSSH.exe program. The new program " +
post("You have purchased the SQLInject.exe program. The new program " +
"can be found on your home computer.");
} else {
post("Not enough money to purchase " + itemName);
@ -124,7 +124,7 @@ parseDarkwebItemPrice = function(itemDesc) {
}
DarkWebItems = {
BruteSSHProgram: Programs.BRUTESSHProgram + " - $50,000 - Opens up SSH Ports",
BruteSSHProgram: Programs.BruteSSHProgram + " - $50,000 - Opens up SSH Ports",
FTPCrackProgram: Programs.FTPCrackProgram + " - $150,000 - Opens up FTP Ports",
RelaySMTPProgram: Programs.RelaySMTPProgram + " - $500,000 - Opens up SMTP Ports",
HTTPWormProgram: Programs.HTTPWormProgram + " - $3,000,000 - Opens up HTTP Ports",

@ -527,26 +527,19 @@ leaveFaction = function(faction) {
displayFactionContent = function(factionName) {
var faction = Factions[factionName];
document.getElementById("faction-name").innerHTML = factionName;
document.getElementById("faction-info").innerHTML = faction.info;
document.getElementById("faction-info").innerHTML = "<i>" + faction.info + "</i>";
document.getElementById("faction-reputation").innerHTML = "Reputation: " + formatNumber(faction.playerReputation, 4);
var hackDiv = document.getElementById("faction-hack-div");
var fieldWorkDiv = document.getElementById("faction-fieldwork-div");
var securityWorkDiv = document.getElementById("faction-securitywork-div");
var hackButton = document.getElementById("faction-hack-button");
var fieldWorkButton = document.getElementById("faction-fieldwork-button");
var securityWorkButton = document.getElementById("faction-securitywork-button");
//Set new event listener for all of the work buttons
//The old buttons need to be replaced to clear the old event listeners
var newHackButton = hackButton.cloneNode(true);
var newFieldWorkButton = fieldWorkButton.cloneNode(true);
var newSecurityWorkButton = securityWorkButton.cloneNode(true);
var newHackButton = clearEventListeners("faction-hack-button");
var newFieldWorkButton = clearEventListeners("faction-fieldwork-button");
var newSecurityWorkButton = clearEventListeners("faction-securitywork-button");
hackButton.parentNode.replaceChild(newHackButton, hackButton);
fieldWorkButton.parentNode.replaceChild(newFieldWorkButton, fieldWorkButton);
securityWorkButton.parentNode.replaceChild(newSecurityWorkButton, securityWorkButton);
newHackButton.addEventListener("click", function() {
Player.startFactionHackWork(faction);
@ -566,17 +559,13 @@ displayFactionContent = function(factionName) {
//Set new event listener for the purchase augmentation buttons
//The old button needs to be replaced to clear the old event listeners
var purchaseAugmentations = document.getElementById("faction-purchase-augmentations");
var newPurchaseAugmentationsButton = purchaseAugmentations.cloneNode(true);
purchaseAugmentations.parentNode.replaceChild(newPurchaseAugmentationsButton, purchaseAugmentations);
var newPurchaseAugmentationsButton = clearEventListeners("faction-purchase-augmentations");
newPurchaseAugmentationsButton.addEventListener("click", function() {
Engine.hideAllContent();
Engine.Display.factionAugmentationsContent.style.visibility = "visible";
var backButton = document.getElementById("faction-augmentations-back-button");
var newBackButton = backButton.cloneNode(true);
backButton.parentNode.replaceChild(newBackButton, backButton);
var newBackButton = clearEventListeners("faction-augmentations-back-button");
newBackButton.addEventListener("click", function() {
Engine.loadFactionContent();
displayFactionContent(factionName);

@ -333,7 +333,6 @@ function iTutorialEvaluateStep() {
//Go to the next step and evaluate it
function iTutorialNextStep() {
console.log("iTutorialNextStep() called with current step: " + currITutorialStep);
switch(currITutorialStep) {
case iTutorialSteps.Start:
currITutorialStep = iTutorialSteps.GoToCharacterPage;

@ -4,6 +4,7 @@
Locations = {
//Cities
Aevum: "Aevum",
//AevumDesc: ""
Chongqing: "Chongqing",
Sector12: "Sector-12",
NewTokyo: "New Tokyo",
@ -1503,7 +1504,10 @@ purchaseTorRouter = function() {
AddToAllServers(darkweb);
SpecialServerIps.addIp("Darkweb Server", darkweb.ip);
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
dialogBoxCreate("You have purchased a Tor router!", "You now have access to the dark web from your home computer", "Use the scan/netstat commands to search for the dark web connection.");
}

@ -56,6 +56,14 @@ function Server() {
//Initialize the properties of a server
Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, isConnectedTo, adminRights, purchasedByPlayer, maxRam) {
this.ip = ip;
//Check if hostname is unique
var i = 0;
while (GetServerByHostname(hostname) != null) {
//Server already exists
hostname = hostname + "-" + i;
++i;
}
this.hostname = hostname;
this.organizationName = organizationName;
this.isOnline = onlineStatus;

@ -525,7 +525,7 @@ var Terminal = {
post("Host not found");
break;
case "free":
executeFreeCommand(commandArray);
Terminal.executeFreeCommand(commandArray);
break;
case "hack":
if (commandArray.length != 1) {

@ -290,7 +290,10 @@ var Engine = {
Engine.ishimaLocationsList.style.display = "none";
Engine.volhavenLocationsList.style.display = "none";
document.getElementById("world-city-name").innerHTML = Player.city;
var cityDesc = document.getElementById("world-city-desc"); //TODO
switch(Player.city) {
case Locations.Aevum:
Engine.aevumLocationsList.style.display = "inline";
break;
@ -831,33 +834,34 @@ var Engine = {
Engine.Clickables.tutorialBackButton.addEventListener("click", function() {
Engine.displayTutorialContent();
});
//If DarkWeb already purchased, disable the button
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
}
},
/* Initialization */
init: function() {
//Main menu buttons and content
Engine.Clickables.terminalMainMenuButton = clearEventListeners("terminal-menu-link");
//Engine.Clickables.terminalMainMenuButton = document.getElementById("terminal-menu-link");
Engine.Clickables.terminalMainMenuButton.addEventListener("click", function() {
Engine.loadTerminalContent();
return false;
});
Engine.Clickables.characterMainMenuButton = clearEventListeners("character-menu-link");
//Engine.Clickables.characterMainMenuButton = document.getElementById("character-menu-link");
Engine.Clickables.characterMainMenuButton.addEventListener("click", function() {
Engine.loadCharacterContent();
return false;
});
Engine.Clickables.scriptEditorMainMenuButton = clearEventListeners("create-script-menu-link");
//Engine.Clickables.scriptEditorMainMenuButton = document.getElementById("create-script-menu-link");
Engine.Clickables.scriptEditorMainMenuButton.addEventListener("click", function() {
Engine.loadScriptEditorContent();
return false;
});
//Engine.Clickables.activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
Engine.Clickables.activeScriptsMainMenuButton = clearEventListeners("active-scripts-menu-link");
Engine.Clickables.activeScriptsMainMenuButton.addEventListener("click", function() {
Engine.loadActiveScriptsContent();
@ -865,42 +869,36 @@ var Engine = {
});
Engine.Clickables.hacknetNodesMainMenuButton = clearEventListeners("hacknet-nodes-menu-link");
//Engine.Clickables.hacknetNodesMainMenuButton = document.getElementById("hacknet-nodes-menu-link");
Engine.Clickables.hacknetNodesMainMenuButton.addEventListener("click", function() {
Engine.loadHacknetNodesContent();
return false;
});
Engine.Clickables.worldMainMenuButton = clearEventListeners("world-menu-link");
//Engine.Clickables.worldMainMenuButton = document.getElementById("world-menu-link");
Engine.Clickables.worldMainMenuButton.addEventListener("click", function() {
Engine.loadWorldContent();
return false;
});
Engine.Clickables.createProgramMainMenuButton = clearEventListeners("create-program-menu-link");
//Engine.Clickables.createProgramMainMenuButton = document.getElementById("create-program-menu-link");
Engine.Clickables.createProgramMainMenuButton.addEventListener("click", function() {
Engine.loadCreateProgramContent();
return false;
});
Engine.Clickables.factionsMainMenuButton = clearEventListeners("factions-menu-link");
//Engine.Clickables.factionsMainMenuButton = document.getElementById("factions-menu-link");
Engine.Clickables.factionsMainMenuButton.addEventListener("click", function() {
Engine.loadFactionsContent();
return false;
});
Engine.Clickables.augmentationsMainMenuButton = clearEventListeners("augmentations-menu-link");
//Engine.Clickables.augmentationsMainMenuButton = document.getElementById("augmentations-menu-link");
Engine.Clickables.augmentationsMainMenuButton.addEventListener("click", function() {
Engine.loadAugmentationsContent();
return false;
});
Engine.Clickables.tutorialMainMenuButton = clearEventListeners("tutorial-menu-link");
//Engine.Clickables.tutorialMainMenuButton = document.getElementById("tutorial-menu-link");
Engine.Clickables.tutorialMainMenuButton.addEventListener("click", function() {
Engine.loadTutorialContent();
return false;

@ -28,17 +28,13 @@ purchaseAugmentationBoxSetText = function(txt) {
//ram argument is in GB
purchaseAugmentationBoxCreate = function(aug, fac) {
console.log("here");
document.getElementById("purchase-augmentation-box-aug-name").innerHTML = aug.name;
document.getElementById("purchase-augmentation-box-aug-info").innerHTML = aug.info;
purchaseAugmentationBoxSetText("Would you like to purchase the " + aug.name + " Augmentation for $" +
purchaseAugmentationBoxSetText("<br>Would you like to purchase the " + aug.name + " Augmentation for $" +
formatNumber(aug.baseCost * fac.augmentationPriceMult, 2) + "?");
//Clear old event listeners from Confirm button
var newConfirmButton = clearEventListeners("purchase-augmentation-box-confirm");
//var confirmButton = document.getElementById("purchase-augmentation-box-confirm");
//var newConfirmButton = confirmButton.cloneNode(true);
//confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {