2016-10-14 23:02:06 +02:00
|
|
|
//Netburner Player class
|
2016-12-01 23:18:18 +01:00
|
|
|
function PlayerObject() {
|
|
|
|
//Skills and stats
|
|
|
|
this.hacking_skill = 1;
|
|
|
|
|
|
|
|
//Fighting
|
|
|
|
this.strength = 1; //Damage dealt
|
|
|
|
this.defense = 1; //Damage received
|
|
|
|
this.dexterity = 1; //Accuracy
|
|
|
|
this.agility = 1; //Dodge %
|
|
|
|
|
|
|
|
//Labor stats
|
|
|
|
this.charisma = 1;
|
2017-01-11 21:00:51 +01:00
|
|
|
//Intelligence, perhaps?
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
//Hacking multipliers
|
2017-02-20 23:06:16 +01:00
|
|
|
this.hacking_chance_mult = 2; //Increase through ascensions/augmentations
|
2017-04-17 14:26:54 +02:00
|
|
|
this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations
|
|
|
|
//this.hacking_speed_mult = 1; //Make it faster for debugging
|
2017-02-20 23:06:16 +01:00
|
|
|
this.hacking_money_mult = .001; //Increase through ascensions/augmentations. Can't go above 1
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
//Note: "Lifetime" refers to current ascension, "total" refers to the entire game history
|
|
|
|
//Accumulative stats and skills
|
|
|
|
this.total_hacking = 1;
|
|
|
|
this.total_strength = 1;
|
|
|
|
this.total_defense = 1;
|
|
|
|
this.total_dexterity = 1;
|
|
|
|
this.total_agility = 1;
|
|
|
|
this.total_charisma = 1;
|
|
|
|
this.lifetime_hacking = 1;
|
|
|
|
this.lifetime_strength = 1;
|
|
|
|
this.lifetime_defense = 1;
|
|
|
|
this.lifetime_dexterity = 1;
|
|
|
|
this.lifetime_agility = 1;
|
|
|
|
this.lifetime_charisma = 1;
|
|
|
|
|
|
|
|
//Experience and multipliers
|
|
|
|
this.hacking_exp = 0;
|
|
|
|
this.strength_exp = 0;
|
|
|
|
this.defense_exp = 0;
|
|
|
|
this.dexterity_exp = 0;
|
|
|
|
this.agility_exp = 0;
|
|
|
|
this.charisma_exp = 0;
|
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
this.hacking_mult = 1;
|
|
|
|
this.strength_mult = 1;
|
|
|
|
this.defense_mult = 1;
|
|
|
|
this.dexterity_mult = 1;
|
|
|
|
this.agility_mult = 1;
|
|
|
|
this.charisma_mult = 1;
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
this.hacking_exp_mult = 1;
|
|
|
|
this.strength_exp_mult = 1;
|
|
|
|
this.defense_exp_mult = 1;
|
|
|
|
this.dexterity_exp_mult = 1;
|
|
|
|
this.agility_exp_mult = 1;
|
|
|
|
this.charisma_exp_mult = 1;
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
this.company_rep_mult = 1;
|
|
|
|
this.faction_rep_mult = 1;
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
//Money
|
|
|
|
this.money = 0;
|
2017-04-13 19:33:34 +02:00
|
|
|
this.total_money = 0; //Total money ever earned
|
|
|
|
this.lifetime_money = 0; //Total money ever earned
|
2016-12-01 23:18:18 +01:00
|
|
|
|
2016-12-15 18:51:23 +01:00
|
|
|
//IP Address of Starting (home) computer
|
2017-01-11 21:00:51 +01:00
|
|
|
this.homeComputer = "";
|
|
|
|
|
2017-01-31 04:41:42 +01:00
|
|
|
//Location information
|
2017-02-03 23:05:59 +01:00
|
|
|
this.city = Locations.Sector12;
|
2017-01-11 21:00:51 +01:00
|
|
|
this.location = "";
|
2016-12-01 23:18:18 +01:00
|
|
|
|
2017-01-31 04:41:42 +01:00
|
|
|
//Company Information
|
2017-02-06 06:01:01 +01:00
|
|
|
this.companyName = ""; //Name of Company, equivalent to an object from Locations
|
|
|
|
this.companyPosition = ""; //CompanyPosition object
|
2017-01-31 04:41:42 +01:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Servers
|
2017-01-11 21:00:51 +01:00
|
|
|
this.currentServer = ""; //IP address of Server currently being accessed through terminal
|
2017-02-03 23:05:59 +01:00
|
|
|
this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered
|
2016-12-01 23:18:18 +01:00
|
|
|
this.purchasedServers = [];
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
//Factions
|
|
|
|
this.factions = []; //Names of all factions player has joined
|
|
|
|
|
2017-02-09 23:40:55 +01:00
|
|
|
//Augmentations
|
2017-02-17 23:19:25 +01:00
|
|
|
this.augmentations = []; //Names of all installed augmentations
|
2017-02-09 23:40:55 +01:00
|
|
|
this.numAugmentations = 0;
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
//Misc statistics
|
|
|
|
this.numPeopleKilled = 0;
|
|
|
|
this.numPeopleKilledTotal = 0;
|
|
|
|
this.numPeopleKilledLifetime = 0;
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Achievements and achievement progress
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
//Flag to let the engine know the player is starting an action
|
|
|
|
// Current actions: hack, analyze
|
2016-12-01 23:18:18 +01:00
|
|
|
this.startAction = false;
|
|
|
|
this.actionTime = 0;
|
2017-02-06 06:01:01 +01:00
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
//Flags/variables for working (Company, Faction, and Creating Programin)
|
2017-02-06 06:01:01 +01:00
|
|
|
this.isWorking = false;
|
2017-02-17 23:19:25 +01:00
|
|
|
this.currentWorkFactionName = "";
|
|
|
|
this.currentWorkFactionDescription = "";
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
this.workHackExpGainRate = 0;
|
|
|
|
this.workStrExpGainRate = 0;
|
|
|
|
this.workDefExpGainRate = 0;
|
|
|
|
this.workDexExpGainRate = 0;
|
|
|
|
this.workAgiExpGainRate = 0;
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGainRate = 0;
|
2017-02-08 01:27:11 +01:00
|
|
|
this.workRepGainRate = 0;
|
|
|
|
this.workMoneyGainRate = 0;
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
this.workHackExpGained = 0;
|
|
|
|
this.workStrExpGained = 0;
|
|
|
|
this.workDefExpGained = 0;
|
|
|
|
this.workDexExpGained = 0;
|
|
|
|
this.workAgiExpGained = 0;
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGained = 0;
|
2017-02-06 06:01:01 +01:00
|
|
|
this.workRepGained = 0;
|
|
|
|
this.workMoneyGained = 0;
|
2017-02-08 01:27:11 +01:00
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
this.createProgramName = "";
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
this.timeWorked = 0; //in ms
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
this.work_money_mult = 1;
|
2016-12-19 21:59:13 +01:00
|
|
|
|
|
|
|
//Used to store the last update time.
|
|
|
|
this.lastUpdate = new Date().getTime();
|
2016-12-01 23:18:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
PlayerObject.prototype.init = function() {
|
|
|
|
/* Initialize Player's home computer */
|
|
|
|
var t_homeComp = new Server();
|
|
|
|
t_homeComp.init(createRandomIp(), "home", "Home PC", true, true, true, true, 1);
|
|
|
|
this.homeComputer = t_homeComp.ip;
|
|
|
|
this.currentServer = t_homeComp.ip;
|
|
|
|
AddToAllServers(t_homeComp);
|
|
|
|
|
2017-04-13 19:33:34 +02:00
|
|
|
this.getHomeComputer().programs.push(Programs.NukeProgram);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
2016-10-14 23:02:06 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
PlayerObject.prototype.getCurrentServer = function() {
|
|
|
|
return AllServers[this.currentServer];
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.getHomeComputer = function() {
|
|
|
|
return AllServers[this.homeComputer];
|
|
|
|
}
|
|
|
|
|
|
|
|
//Calculates skill level based on experience. The same formula will be used for every skill
|
2016-12-19 19:20:19 +01:00
|
|
|
// At the maximum possible exp (MAX_INT = 9007199254740991), the hacking skill will be 1796 TODO REcalculate this
|
|
|
|
// Gets to level 1000 hacking skill at (TODO Determine this)
|
2016-12-01 23:18:18 +01:00
|
|
|
PlayerObject.prototype.calculateSkill = function(exp) {
|
2017-02-16 19:52:11 +01:00
|
|
|
return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
|
2016-12-15 23:22:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.updateSkillLevels = function() {
|
2017-02-08 01:27:11 +01:00
|
|
|
//TODO Account for total and lifetime stats for achievements and stuff
|
2017-02-20 23:06:16 +01:00
|
|
|
this.hacking_skill = Math.floor(this.calculateSkill(this.hacking_exp) * this.hacking_mult);
|
|
|
|
this.strength = Math.floor(this.calculateSkill(this.strength_exp) * this.strength_mult);
|
|
|
|
this.defense = Math.floor(this.calculateSkill(this.defense_exp) * this.defense_mult);
|
|
|
|
this.dexterity = Math.floor(this.calculateSkill(this.dexterity_exp) * this.dexterity_mult);
|
|
|
|
this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult);
|
|
|
|
this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult);
|
2016-12-15 23:22:42 +01:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
//Calculates the chance of hacking a server
|
|
|
|
//The formula is:
|
|
|
|
// (hacking_chance_multiplier * hacking_skill - requiredLevel) 100 - difficulty
|
|
|
|
// ----------------------------------------------------------- * -----------------
|
|
|
|
// (hacking_chance_multiplier * hacking_skill) 100
|
|
|
|
PlayerObject.prototype.calculateHackingChance = function() {
|
|
|
|
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
|
2017-02-20 23:06:16 +01:00
|
|
|
var skillMult = (this.hacking_chance_mult * this.hacking_skill);
|
2016-12-01 23:18:18 +01:00
|
|
|
var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult;
|
2017-04-17 14:26:54 +02:00
|
|
|
var chance = skillChance * difficultyMult;
|
|
|
|
if (chance < 0) {return 0;}
|
|
|
|
else {return chance;}
|
2016-12-15 23:22:42 +01:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
//Calculate the time it takes to hack a server in seconds. Returns the time
|
|
|
|
//The formula is:
|
|
|
|
// (requiredLevel * difficulty)
|
|
|
|
// ------------------------------- * hacking_speed_multiplier
|
|
|
|
// hacking_skill
|
|
|
|
PlayerObject.prototype.calculateHackingTime = function() {
|
|
|
|
var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty;
|
2017-02-16 19:52:11 +01:00
|
|
|
var skillFactor = (difficultyMult + 500) / (this.hacking_skill + 100);
|
2017-02-20 23:06:16 +01:00
|
|
|
return skillFactor * this.hacking_speed_mult;
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful
|
|
|
|
//The formula is:
|
|
|
|
// (hacking_skill - (requiredLevel-1)) 100 - difficulty
|
|
|
|
// --------------------------------------* ----------------------- * hacking_money_multiplier
|
|
|
|
// hacking_skill 100
|
|
|
|
PlayerObject.prototype.calculatePercentMoneyHacked = function() {
|
|
|
|
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
|
|
|
|
var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill;
|
2017-02-20 23:06:16 +01:00
|
|
|
var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult;
|
2016-12-01 23:18:18 +01:00
|
|
|
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
|
|
|
|
return percentMoneyHacked;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Returns how much EXP the player gains on a successful hack
|
|
|
|
//The formula is:
|
|
|
|
// difficulty * requiredLevel * hacking_multiplier
|
|
|
|
//
|
|
|
|
// Note: Keep it at an integer for now,
|
|
|
|
PlayerObject.prototype.calculateExpGain = function() {
|
|
|
|
return Math.round(this.getCurrentServer().hackDifficulty * this.getCurrentServer().requiredHackingSkill * this.hacking_exp_mult);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Hack/Analyze a server. Return the amount of time the hack will take. This lets the Terminal object know how long to disable itself for
|
|
|
|
//This assumes that the server being hacked is not purchased by the player, that the player's hacking skill is greater than the
|
|
|
|
//required hacking skill and that the player has admin rights.
|
|
|
|
PlayerObject.prototype.hack = function() {
|
|
|
|
this.actionTime = this.calculateHackingTime();
|
|
|
|
console.log("Hacking time: " + this.actionTime);
|
2016-12-14 21:29:40 +01:00
|
|
|
//Set the startAction flag so the engine starts the hacking process
|
2016-12-01 23:18:18 +01:00
|
|
|
this.startAction = true;
|
|
|
|
}
|
2016-12-15 23:22:42 +01:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
PlayerObject.prototype.analyze = function() {
|
|
|
|
//TODO Analyze only takes 5 seconds for now..maybe change this in the future?
|
|
|
|
this.actionTime = 5;
|
|
|
|
this.startAction = true;
|
|
|
|
}
|
|
|
|
|
2016-12-19 21:59:13 +01:00
|
|
|
PlayerObject.prototype.gainMoney = function(money) {
|
|
|
|
this.money += money;
|
|
|
|
this.total_money += money;
|
|
|
|
this.lifetime_money += money;
|
|
|
|
}
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
/* Working for Company */
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.finishWork = function(cancelled) {
|
|
|
|
//Since the work was cancelled early, player only gains half of what they've earned so far
|
|
|
|
var cancMult = 1;
|
|
|
|
if (cancelled) {
|
|
|
|
cancMult = 2;
|
|
|
|
}
|
2017-02-16 19:52:11 +01:00
|
|
|
if (Engine.Debug) {
|
|
|
|
console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained");
|
|
|
|
}
|
|
|
|
this.hacking_exp += (this.workHackExpGained / cancMult);
|
|
|
|
this.strength_exp += (this.workStrExpGained / cancMult);
|
|
|
|
this.defense_exp += (this.workDefExpGained / cancMult);
|
|
|
|
this.dexterity_exp += (this.workDexExpGained / cancMult);
|
|
|
|
this.agility_exp += (this.workAgiExpGained / cancMult);
|
|
|
|
this.charisma_exp += (this.workChaExpGained / cancMult);
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
var company = Companies[this.companyName];
|
|
|
|
company.playerReputation += (this.workRepGained / cancMult);
|
|
|
|
|
|
|
|
this.gainMoney(this.workMoneyGained / cancMult);
|
|
|
|
|
|
|
|
this.updateSkillLevels();
|
|
|
|
|
|
|
|
var txt = "";
|
|
|
|
if (cancelled) {
|
|
|
|
txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
|
|
|
|
"Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned. <br><br>" +
|
|
|
|
"You earned a total of: <br>" +
|
2017-02-08 05:48:50 +01:00
|
|
|
"$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" +
|
|
|
|
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" +
|
|
|
|
(this.workHackExpGained / cancMult).toFixed(3) + " hacking exp <br>" +
|
|
|
|
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" +
|
|
|
|
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" +
|
|
|
|
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" +
|
2017-02-16 19:52:11 +01:00
|
|
|
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" +
|
|
|
|
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp<br>";
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
} else {
|
2017-02-16 19:52:11 +01:00
|
|
|
txt = "You worked a full shift of 8 hours! <br><br> " +
|
2017-02-08 01:27:11 +01:00
|
|
|
"You earned a total of: <br>" +
|
|
|
|
"$" + (this.workMoneyGained / cancMult) + "<br>" +
|
|
|
|
(this.workRepGained / cancMult) + " reputation for the company <br>" +
|
|
|
|
(this.workHackExpGained / cancMult) + " hacking exp <br>" +
|
|
|
|
(this.workStrExpGained / cancMult) + " strength exp <br>" +
|
|
|
|
(this.workDefExpGained / cancMult) + " defense exp <br>" +
|
|
|
|
(this.workDexExpGained / cancMult) + " dexterity exp <br>" +
|
2017-02-16 19:52:11 +01:00
|
|
|
(this.workAgiExpGained / cancMult) + " agility exp <br>" +
|
|
|
|
(this.workChaExpGained / cancMult) + " charisma exp <br>";
|
2017-02-08 01:27:11 +01:00
|
|
|
}
|
|
|
|
dialogBoxCreate(txt);
|
2017-02-08 05:48:50 +01:00
|
|
|
|
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
|
|
|
|
2017-03-31 14:32:04 +02:00
|
|
|
this.isWorking = false;
|
2017-02-16 19:52:11 +01:00
|
|
|
|
2017-02-08 05:48:50 +01:00
|
|
|
Engine.loadTerminalContent();
|
2017-02-08 01:27:11 +01:00
|
|
|
}
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
PlayerObject.prototype.startWork = function() {
|
|
|
|
this.isWorking = true;
|
2017-04-13 22:21:03 +02:00
|
|
|
this.currentWorkFactionName = "";
|
|
|
|
this.currentWorkFactionDescription = "";
|
|
|
|
this.createProgramName = "";
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
this.workHackExpGainRate = this.getWorkHackExpGain();
|
|
|
|
this.workStrExpGainRate = this.getWorkStrExpGain();
|
|
|
|
this.workDefExpGainRate = this.getWorkDefExpGain();
|
|
|
|
this.workDexExpGainRate = this.getWorkDexExpGain();
|
|
|
|
this.workAgiExpGainRate = this.getWorkAgiExpGain();
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGainRate = this.getWorkChaExpGain();
|
2017-02-08 01:27:11 +01:00
|
|
|
this.workRepGainRate = this.getWorkRepGain();
|
|
|
|
this.workMoneyGainRate = this.getWorkMoneyGain();
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
this.workHackExpGained = 0;
|
|
|
|
this.workStrExpGained = 0;
|
|
|
|
this.workDefExpGained = 0;
|
|
|
|
this.workDexExpGained = 0;
|
|
|
|
this.workAgiExpGained = 0;
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGained = 0;
|
2017-02-06 06:01:01 +01:00
|
|
|
this.workRepGained = 0;
|
|
|
|
this.workMoneyGained = 0;
|
2017-02-08 01:27:11 +01:00
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
this.timeWorked = 0;
|
2017-02-08 01:27:11 +01:00
|
|
|
|
|
|
|
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
2017-02-16 19:52:11 +01:00
|
|
|
|
|
|
|
//Remove all old event listeners from Cancel button
|
|
|
|
var newCancelButton = cancelButton.cloneNode(true);
|
|
|
|
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
|
|
|
|
|
|
|
|
newCancelButton.addEventListener("click", function() {
|
2017-02-08 05:48:50 +01:00
|
|
|
Player.finishWork(true);
|
2017-02-16 19:52:11 +01:00
|
|
|
return false;
|
2017-02-08 01:27:11 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//Display Work In Progress Screen
|
|
|
|
Engine.loadWorkInProgressContent();
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.work = function(numCycles) {
|
2017-02-08 01:27:11 +01:00
|
|
|
this.workHackExpGained += this.workHackExpGainRate * numCycles;
|
|
|
|
this.workStrExpGained += this.workStrExpGainRate * numCycles;
|
|
|
|
this.workDefExpGained += this.workDefExpGainRate * numCycles;
|
|
|
|
this.workDexExpGained += this.workDexExpGainRate * numCycles;
|
|
|
|
this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGained += this.workChaExpGainRate * numCycles;
|
2017-02-08 01:27:11 +01:00
|
|
|
this.workRepGained += this.workRepGainRate * numCycles;
|
|
|
|
this.workMoneyGained += this.workMoneyGainRate * numCycles;
|
|
|
|
|
|
|
|
var cyclesPerSec = 1000 / Engine._idleSpeed;
|
|
|
|
|
|
|
|
this.timeWorked += Engine._idleSpeed * numCycles;
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
|
2017-02-08 01:27:11 +01:00
|
|
|
if (this.timeWorked >= 28800000) {
|
2017-02-16 19:52:11 +01:00
|
|
|
var maxCycles = 144000; //Number of cycles in 8 hours
|
|
|
|
this.workHackExpGained = this.workhackExpGainRate * maxCycles;
|
|
|
|
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
|
|
|
|
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
|
|
|
|
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
|
|
|
|
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
|
|
|
|
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
|
|
|
|
this.workRepGained = this.workRepGainRate * maxCycles;
|
|
|
|
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
|
2017-02-08 01:27:11 +01:00
|
|
|
this.finishWork(false);
|
|
|
|
}
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
var txt = document.getElementById("work-in-progress-text");
|
|
|
|
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName +
|
|
|
|
" at " + Player.companyName + "<br><br>" +
|
|
|
|
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
|
|
|
"You have earned: <br><br>" +
|
2017-02-08 05:48:50 +01:00
|
|
|
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
|
|
|
|
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
|
2017-02-08 05:48:50 +01:00
|
|
|
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
|
|
|
|
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
|
|
|
|
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
|
|
|
|
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
|
|
|
|
|
2017-02-08 01:27:11 +01:00
|
|
|
|
2017-02-08 05:48:50 +01:00
|
|
|
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
|
2017-02-06 06:01:01 +01:00
|
|
|
"but you will only gain half of the experience, money, and reputation you've earned so far."
|
2017-02-08 01:27:11 +01:00
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
/* Working for Faction */
|
2017-02-17 23:19:25 +01:00
|
|
|
PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
|
|
|
|
this.hacking_exp += (this.workHackExpGained);
|
|
|
|
this.strength_exp += (this.workStrExpGained);
|
|
|
|
this.defense_exp += (this.workDefExpGained);
|
|
|
|
this.dexterity_exp += (this.workDexExpGained);
|
|
|
|
this.agility_exp += (this.workAgiExpGained);
|
|
|
|
this.charisma_exp += (this.workChaExpGained);
|
2017-02-16 19:52:11 +01:00
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
var faction = Factions[this.currentWorkFactionName];
|
|
|
|
faction.playerReputation += (this.workRepGained);
|
2017-02-16 19:52:11 +01:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
this.gainMoney(this.workMoneyGained);
|
2017-02-16 19:52:11 +01:00
|
|
|
|
|
|
|
this.updateSkillLevels();
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
|
2017-02-16 19:52:11 +01:00
|
|
|
"You earned a total of: <br>" +
|
2017-02-20 23:06:16 +01:00
|
|
|
"$" + (this.workMoneyGained).toFixed(2) + "<br>" +
|
|
|
|
(this.workRepGained).toFixed(3) + " reputation for the company <br>" +
|
|
|
|
(this.workHackExpGained).toFixed(3) + " hacking exp <br>" +
|
|
|
|
(this.workStrExpGained).toFixed(3) + " strength exp <br>" +
|
|
|
|
(this.workDefExpGained).toFixed(3) + " defense exp <br>" +
|
|
|
|
(this.workDexExpGained).toFixed(3) + " dexterity exp <br>" +
|
|
|
|
(this.workAgiExpGained).toFixed(3) + " agility exp <br>" +
|
|
|
|
(this.workChaExpGained).toFixed(3) + " charisma exp<br>";
|
2017-02-16 19:52:11 +01:00
|
|
|
dialogBoxCreate(txt);
|
|
|
|
|
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
|
|
|
|
|
|
|
Player.isWorking = false;
|
|
|
|
|
|
|
|
Engine.loadTerminalContent();
|
|
|
|
}
|
|
|
|
|
2017-02-27 23:14:11 +01:00
|
|
|
PlayerObject.prototype.startFactionWork = function(faction) {
|
2017-02-16 19:52:11 +01:00
|
|
|
this.isWorking = true;
|
2017-02-17 23:19:25 +01:00
|
|
|
this.currentWorkFactionName = faction.name;
|
2017-04-13 22:21:03 +02:00
|
|
|
this.createProgramName = "";
|
2017-02-16 19:52:11 +01:00
|
|
|
|
|
|
|
this.workHackExpGained = 0;
|
|
|
|
this.workStrExpGained = 0;
|
|
|
|
this.workDefExpGained = 0;
|
|
|
|
this.workDexExpGained = 0;
|
|
|
|
this.workAgiExpGained = 0;
|
|
|
|
this.workChaExpGained = 0;
|
|
|
|
this.workRepGained = 0;
|
|
|
|
this.workMoneyGained = 0;
|
|
|
|
|
|
|
|
this.timeWorked = 0;
|
|
|
|
|
|
|
|
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
|
|
|
|
|
|
|
//Remove all old event listeners from Cancel button
|
|
|
|
var newCancelButton = cancelButton.cloneNode(true);
|
|
|
|
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
|
|
|
|
|
|
|
|
newCancelButton.addEventListener("click", function() {
|
2017-02-17 23:19:25 +01:00
|
|
|
Player.finishFactionWork(true, faction);
|
2017-02-16 19:52:11 +01:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
//Display Work In Progress Screen
|
|
|
|
Engine.loadWorkInProgressContent();
|
|
|
|
}
|
2017-02-17 23:19:25 +01:00
|
|
|
|
|
|
|
PlayerObject.prototype.startFactionHackWork = function(faction) {
|
|
|
|
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
|
|
|
|
this.workStrExpGainRate = 0;
|
|
|
|
this.workDefExpGainRate = 0;
|
|
|
|
this.workDexExpGainRate = 0;
|
|
|
|
this.workAgiExpGainRate = 0;
|
|
|
|
this.workChaExpGainRate = 0;
|
|
|
|
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
|
|
|
|
this.workMoneyGainRate = 0;
|
|
|
|
|
|
|
|
this.currentWorkFactionDescription = "carrying out hacking contracts";
|
|
|
|
|
|
|
|
this.startFactionWork(faction);
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.startFactionFieldWork = function(faction) {
|
|
|
|
this.workHackExpGainRate = .05 * this.hacking_exp_mult;
|
|
|
|
this.workStrExpGainRate = .05 * this.strength_exp_mult;
|
|
|
|
this.workDefExpGainRate = .05 * this.defense_exp_mult;
|
|
|
|
this.workDexExpGainRate = .05 * this.dexterity_exp_mult;
|
|
|
|
this.workAgiExpGainRate = .05 * this.agility_exp_mult;
|
|
|
|
this.workChaExpGainRate = .05 * this.charisma_exp_mult;
|
|
|
|
this.workRepGainRate = this.getFactionFieldWorkRepGain();
|
|
|
|
this.workMoneyGainRate = 0;
|
|
|
|
|
|
|
|
this.currentWorkFactionDescription = "carrying out field missions"
|
|
|
|
|
|
|
|
this.startFactionWork(faction);
|
|
|
|
}
|
|
|
|
|
2017-02-27 23:14:11 +01:00
|
|
|
PlayerObject.prototype.startFactionSecurityWork = function(faction) {
|
2017-02-17 23:19:25 +01:00
|
|
|
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
|
|
|
|
this.workStrExpGainRate = 0;
|
|
|
|
this.workDefExpGainRate = 0;
|
|
|
|
this.workDexExpGainRate = 0;
|
|
|
|
this.workAgiExpGainRate = 0;
|
|
|
|
this.workChaExpGainRate = 0;
|
|
|
|
this.workRepGainRate = this.getFactionFieldWorkRepGain();
|
|
|
|
this.workMoneyGainRate = 0;
|
|
|
|
|
|
|
|
this.currentWorkFactionDescription = "performing security detail"
|
|
|
|
|
|
|
|
this.startFactionWork(faction);
|
|
|
|
}
|
2017-02-16 19:52:11 +01:00
|
|
|
|
|
|
|
PlayerObject.prototype.workForFaction = function(numCycles) {
|
2017-02-17 23:19:25 +01:00
|
|
|
var faction = Factions[this.currentWorkFactionName];
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workHackExpGained += this.workHackExpGainRate * numCycles;
|
|
|
|
this.workStrExpGained += this.workStrExpGainRate * numCycles;
|
|
|
|
this.workDefExpGained += this.workDefExpGainRate * numCycles;
|
|
|
|
this.workDexExpGained += this.workDexExpGainRate * numCycles;
|
|
|
|
this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
|
|
|
|
this.workChaExpGained += this.workChaExpGainRate * numCycles;
|
|
|
|
this.workRepGained += this.workRepGainRate * numCycles;
|
|
|
|
this.workMoneyGained += this.workMoneyGainRate * numCycles;
|
|
|
|
|
|
|
|
var cyclesPerSec = 1000 / Engine._idleSpeed;
|
|
|
|
|
|
|
|
this.timeWorked += Engine._idleSpeed * numCycles;
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
//If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours
|
|
|
|
if (this.timeWorked >= 72000000) {
|
|
|
|
var maxCycles = 360000; //Number of cycles in 20 hours
|
2017-02-16 19:52:11 +01:00
|
|
|
this.workHackExpGained = this.workhackExpGainRate * maxCycles;
|
|
|
|
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
|
|
|
|
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
|
|
|
|
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
|
|
|
|
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
|
|
|
|
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
|
|
|
|
this.workRepGained = this.workRepGainRate * maxCycles;
|
|
|
|
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
|
2017-02-17 23:19:25 +01:00
|
|
|
this.finishFactionWork(false, faction);
|
2017-02-16 19:52:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var txt = document.getElementById("work-in-progress-text");
|
2017-02-17 23:19:25 +01:00
|
|
|
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
|
|
|
|
"You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
2017-02-16 19:52:11 +01:00
|
|
|
"You have earned: <br><br>" +
|
|
|
|
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
|
|
|
|
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
|
|
|
|
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
|
|
|
|
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
|
|
|
|
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
|
|
|
|
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
|
|
|
|
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
|
|
|
|
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
|
|
|
|
|
2017-02-17 23:19:25 +01:00
|
|
|
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish.<br>" +
|
|
|
|
"There is no penalty for cancelling earlier";
|
2017-02-16 19:52:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
//Money gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkMoneyGain = function() {
|
2017-02-06 06:01:01 +01:00
|
|
|
var company = Companies[this.companyName];
|
2017-02-08 01:27:11 +01:00
|
|
|
return this.companyPosition.baseSalary * company.salaryMultiplier * this.work_money_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Hack exp gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkHackExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
|
|
|
return this.companyPosition.hackingExpGain * company.expMultiplier * this.hacking_exp_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Str exp gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkStrExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
2017-02-08 05:48:50 +01:00
|
|
|
return this.companyPosition.strengthExpGain * company.expMultiplier * this.strength_exp_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Def exp gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkDefExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
2017-02-08 05:48:50 +01:00
|
|
|
return this.companyPosition.defenseExpGain * company.expMultiplier * this.defense_exp_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Dex exp gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkDexExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
2017-02-08 05:48:50 +01:00
|
|
|
return this.companyPosition.dexterityExpGain * company.expMultiplier * this.dexterity_exp_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Agi exp gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkAgiExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
2017-02-08 05:48:50 +01:00
|
|
|
return this.companyPosition.agilityExpGain * company.expMultiplier * this.agility_exp_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
//Charisma exp gained per game cycle
|
|
|
|
PlayerObject.prototype.getWorkChaExpGain = function() {
|
|
|
|
var company = Companies[this.companyName];
|
|
|
|
return this.companyPosition.charismaExpGain * company.expMultiplier * this.charisma_exp_mult;
|
|
|
|
}
|
|
|
|
|
2017-02-06 06:01:01 +01:00
|
|
|
//Reputation gained per game cycle
|
2017-02-08 01:27:11 +01:00
|
|
|
PlayerObject.prototype.getWorkRepGain = function() {
|
2017-02-17 23:19:25 +01:00
|
|
|
|
|
|
|
var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,
|
|
|
|
this.defense, this.dexterity,
|
|
|
|
this.agility, this.charisma);
|
|
|
|
return jobPerformance * this.company_rep_mult;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.getFactionSecurityWorkRepGain = function() {
|
|
|
|
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.agility / CONSTANTS.MaxSkillLevel) / 5;
|
|
|
|
return t * this.faction_rep_mult;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
|
|
|
|
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.agility / CONSTANTS.MaxSkillLevel +
|
|
|
|
this.charisma / CONSTANTS.MaxSkillLevel) / 6;
|
|
|
|
return t * this.faction_rep_mult;
|
2017-02-06 06:01:01 +01:00
|
|
|
}
|
|
|
|
|
2017-03-31 14:32:04 +02:00
|
|
|
/* Creating a Program */
|
2017-03-31 23:47:06 +02:00
|
|
|
PlayerObject.prototype.startCreateProgramWork = function(programName) {
|
2017-03-31 14:32:04 +02:00
|
|
|
this.isWorking = true;
|
|
|
|
|
|
|
|
this.timeWorked = 0;
|
|
|
|
|
2017-04-13 22:21:03 +02:00
|
|
|
this.currentWorkFactionName = "";
|
|
|
|
this.currentWorkFactionDescription = "";
|
2017-03-31 23:47:06 +02:00
|
|
|
this.createProgramName = programName;
|
|
|
|
|
2017-03-31 14:32:04 +02:00
|
|
|
var cancelButton = document.getElementById("work-in-progress-cancel-button");
|
|
|
|
|
|
|
|
//Remove all old event listeners from Cancel button
|
|
|
|
var newCancelButton = cancelButton.cloneNode(true);
|
|
|
|
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
|
|
|
|
|
|
|
|
newCancelButton.addEventListener("click", function() {
|
2017-03-31 23:47:06 +02:00
|
|
|
Player.finishCreateProgramWork(true, programName);
|
2017-03-31 14:32:04 +02:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
//Display Work In Progress Screen
|
|
|
|
Engine.loadWorkInProgressContent();
|
|
|
|
}
|
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
PlayerObject.prototype.createProgramWork = function(numCycles) {
|
|
|
|
this.timeWorked += Engine._idleSpeed * numCycles;
|
|
|
|
var programName = this.createProgramName;
|
|
|
|
|
|
|
|
//If timeWorked == 10 hours, then finish
|
|
|
|
//Creating a program will take a flat 10 hours for now. We can make this variable based
|
|
|
|
//on skill level later
|
|
|
|
var timeToComplete = 36000000;
|
|
|
|
if (this.timeWorked >= timeToComplete) {
|
|
|
|
this.finishCreateProgramWork(false, programName);
|
|
|
|
}
|
2017-03-31 14:32:04 +02:00
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
var txt = document.getElementById("work-in-progress-text");
|
|
|
|
txt.innerHTML = "You are currently working on coding " + programName + ".<br><br> " +
|
|
|
|
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
|
2017-04-13 19:33:34 +02:00
|
|
|
"The program is " + (this.timeWorked / timeToComplete).toFixed(2) + "% complete. <br>" +
|
2017-03-31 23:47:06 +02:00
|
|
|
"If you cancel, you will lose all of your progress.";
|
2017-03-31 14:32:04 +02:00
|
|
|
}
|
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName) {
|
|
|
|
if (cancelled == false) {
|
|
|
|
dialogBoxCreate("You've finished creating " + programName + "!<br>" +
|
|
|
|
"The new program can be found on your home computer.");
|
|
|
|
|
|
|
|
Player.getHomeComputer().programs.push(programName);
|
|
|
|
}
|
2017-03-31 14:32:04 +02:00
|
|
|
|
2017-03-31 23:47:06 +02:00
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
|
|
|
|
|
|
|
Player.isWorking = false;
|
|
|
|
|
|
|
|
Engine.loadTerminalContent();
|
2017-03-31 14:32:04 +02:00
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Functions for saving and loading the Player data
|
|
|
|
PlayerObject.prototype.toJSON = function() {
|
|
|
|
return Generic_toJSON("PlayerObject", this);
|
2017-02-08 01:27:11 +01:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
PlayerObject.fromJSON = function(value) {
|
|
|
|
return Generic_fromJSON(PlayerObject, value.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
Reviver.constructors.PlayerObject = PlayerObject;
|
|
|
|
|
|
|
|
Player = new PlayerObject();
|
|
|
|
|
|
|
|
|
2016-11-01 06:30:59 +01:00
|
|
|
|