Finished ironing out Gang ascension mechanic, including bugs. Refactored UI code to be part of the Gang class.

This commit is contained in:
danielyxie 2018-10-14 19:28:44 -05:00
parent fcab079b32
commit a43f8bf1e6
13 changed files with 557 additions and 388 deletions

@ -99,9 +99,10 @@ button {
background-color: #000; background-color: #000;
&:hover, &:hover,
&:focus { &:active {
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }
/* TODO focus selector? */
} }

@ -9,6 +9,10 @@
position: fixed; position: fixed;
padding: 6px; padding: 6px;
p, pre {
font-size: $defaultFontSize * 0.9375;
}
select { select {
background-color: black; background-color: black;
color: white; color: white;
@ -25,3 +29,20 @@
float: left; float: left;
width: 30%; width: 30%;
} }
/**
* Showing owned upgrades in the Equipment Box
*/
.gang-owned-upgrades-div {
display: inline-block;
margin-left: 6px;
width: 75%;
}
.gang-owned-upgrade {
border: 1px solid white;
font-size: 12px;
margin: 1px;
padding: 1px;
}

@ -114,6 +114,29 @@ a:visited {
position: absolute; position: absolute;
z-index: 99; z-index: 99;
} }
/* Positioned to left of element rather than right */
.tooltiptextleft {
visibility: hidden;
width: 300px;
background-color: var(--my-background-color);
border: 2px solid var(--my-highlight-color);
color: #fff;
text-align: center;
padding: 4px;
top: 50%;
left: 50%;
transform: translate(-100%, -100%);
/* Backwards compatibility */
-webkit-transform: translate(-100%, -100%);
-moz-transform: translate(-100%, -100%);
-o-transform: translate(-100%, -100%);
-ms-transform: translate(-100%, -100%);
position: absolute;
z-index: 99;
}
} }
/* Same thing as a normal tooltip except its a bit higher */ /* Same thing as a normal tooltip except its a bit higher */
@ -132,23 +155,6 @@ a:visited {
z-index: 99; z-index: 99;
} }
/* Similar to a normal tooltip except its positioned on the left of the element
rather than the right to avoid exceeding the elements normal width */
.tooltip .tooltiptextleft {
visibility: hidden;
width: 300px;
background-color: var(--my-background-color);
border: 2px solid var(--my-highlight-color);
color: #fff;
text-align: center;
padding: 4px;
left: 40%;
bottom: -10%;
position: absolute;
z-index: 99;
}
.tooltip:hover .tooltiptext, .tooltip:hover .tooltiptext,
.tooltip:hover .tooltiptexthigh, .tooltip:hover .tooltiptexthigh,
.tooltip:hover .tooltiptextleft { .tooltip:hover .tooltiptextleft {
@ -157,14 +163,14 @@ a:visited {
/* help tip. Question mark that opens popup with info/details */ /* help tip. Question mark that opens popup with info/details */
.help-tip { .help-tip {
content: '?'; background-color: black;
padding: 1px;
margin-top: 5px;
margin-left: 3px;
color: #fff;
border: 1px solid #fff; border: 1px solid #fff;
border-radius: 5px; border-radius: 5px;
color: #fff;
content: '?';
display: inline-block; display: inline-block;
margin-left: 3px;
padding: 1px;
} }
.help-tip-big { .help-tip-big {
@ -413,7 +419,7 @@ a:visited {
&:after { &:after {
content: '\02795'; /* "plus" sign (+) */ content: '\02795'; /* "plus" sign (+) */
font-size: $defaultFontSize * 0.8125; font-size: $defaultFontSize * 0.875;
float: right; float: right;
color: transparent; color: transparent;
text-shadow: 0 0 0 #fff; text-shadow: 0 0 0 #fff;
@ -480,3 +486,7 @@ a:visited {
.charisma-purple { .charisma-purple {
color: $my-stat-cha-color; color: $my-stat-cha-color;
} }
.smallfont {
font-size: $defaultFontSize * 0.8125;
}

@ -1768,7 +1768,8 @@ Bladeburner.prototype.createOverviewContent = function() {
}); });
DomElems.overviewStaminaHelpTip = createElement("div", { DomElems.overviewStaminaHelpTip = createElement("div", {
innerText:"?", class:"help-tip", class:"help-tip",
innerText:"?",
clickListener: ()=> { clickListener: ()=> {
dialogBoxCreate("Performing actions will use up your stamina.<br><br>" + dialogBoxCreate("Performing actions will use up your stamina.<br><br>" +
"Your max stamina is determined primarily by your agility stat.<br><br>" + "Your max stamina is determined primarily by your agility stat.<br><br>" +
@ -1781,7 +1782,7 @@ Bladeburner.prototype.createOverviewContent = function() {
"your success rate would be multipled by 85% (100 - 15).<br><br>" + "your success rate would be multipled by 85% (100 - 15).<br><br>" +
"Your max stamina and stamina gain rate can also be increased by " + "Your max stamina and stamina gain rate can also be increased by " +
"training, or through skills and Augmentation upgrades."); "training, or through skills and Augmentation upgrades.");
} },
}); });
DomElems.overviewGen1 = createElement("p", { DomElems.overviewGen1 = createElement("p", {

@ -500,6 +500,14 @@ let CONSTANTS = {
LatestUpdate: LatestUpdate:
` `
v0.41.0 v0.41.0
* Gang Mechanic Changes (BitNode-2):
*** Added new 'ascension' mechanic for Gang Members
*** The first three gang members are now 'free' (can be recruited instantly)
*** Maximum number of increased Gang Members increased from 20 to 50
*** Changed the formula for calculating respect needed to recruit the next gang member
*** Added a new category of upgrades for Gang Members: Augmentations
*** Non-Augmentation Gang member upgrades are now significantly weaker
*** Reputation for your Gang faction can no longer be gained through Infiltration
* b1t_flum3.exe now takes significantly less time to create * b1t_flum3.exe now takes significantly less time to create
* Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes * Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes
* Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts * Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts

File diff suppressed because it is too large Load Diff

@ -28,10 +28,6 @@ import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
yesNoTxtInpBoxClose} from "../utils/YesNoBox"; yesNoTxtInpBoxClose} from "../utils/YesNoBox";
function displayLocationContent() { function displayLocationContent() {
if (Engine.Debug) {
console.log("displayLocationContent() called with location " + Player.location)
}
var returnToWorld = document.getElementById("location-return-to-world-button"); var returnToWorld = document.getElementById("location-return-to-world-button");
var locationName = document.getElementById("location-name"); var locationName = document.getElementById("location-name");
@ -1811,7 +1807,7 @@ function initLocationButtons() {
yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel"; yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", ()=>{ yesBtn.addEventListener("click", ()=>{
if (Player.money.lt(cost)) { if (Player.money.lt(cost)) {
dialogBoxCreate("You do not have enough mone to purchase an additional CPU Core for your home computer!"); dialogBoxCreate("You do not have enough money to purchase an additional CPU Core for your home computer!");
} else { } else {
Player.loseMoney(cost); Player.loseMoney(cost);
Player.getHomeComputer().cpuCores++; Player.getHomeComputer().cpuCores++;

@ -1499,7 +1499,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
} else { } else {
dialogBoxCreate("Crime successful! <br><br>" + dialogBoxCreate("Crime successful! <br><br>" +
"You gained:<br>"+ "You gained:<br>"+
"$" + formatNumber(this.workMoneyGained, 2) + "<br>" + numeralWrapper.format(this.workMoneyGained, "$0.000a") + "<br>" +
formatNumber(this.workHackExpGained, 4) + " hacking experience <br>" + formatNumber(this.workHackExpGained, 4) + " hacking experience <br>" +
formatNumber(this.workStrExpGained, 4) + " strength experience<br>" + formatNumber(this.workStrExpGained, 4) + " strength experience<br>" +
formatNumber(this.workDefExpGained, 4) + " defense experience<br>" + formatNumber(this.workDefExpGained, 4) + " defense experience<br>" +

@ -314,8 +314,8 @@ function prestigeSourceFile() {
stockMarketList.removeChild(stockMarketList.firstChild); stockMarketList.removeChild(stockMarketList.firstChild);
} }
if (Player.inGang()) { Player.gang.clearUI(); }
Player.gang = null; Player.gang = null;
deleteGangDisplayContent();
Player.corporation = null; Player.corporation = null;
Player.bladeburner = null; Player.bladeburner = null;

@ -40,8 +40,6 @@ import {FconfSettings} from "./Fconf";
import {displayLocationContent, import {displayLocationContent,
initLocationButtons} from "./Location"; initLocationButtons} from "./Location";
import {Locations} from "./Locations"; import {Locations} from "./Locations";
import {displayGangContent, updateGangContent,
Gang} from "./Gang";
import {displayHacknetNodesContent, processAllHacknetNodeEarnings, import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
updateHacknetNodesContent} from "./HacknetNode"; updateHacknetNodesContent} from "./HacknetNode";
import {iTutorialStart} from "./InteractiveTutorial"; import {iTutorialStart} from "./InteractiveTutorial";
@ -457,7 +455,7 @@ const Engine = {
loadGangContent: function() { loadGangContent: function() {
Engine.hideAllContent(); Engine.hideAllContent();
if (document.getElementById("gang-container") || Player.inGang()) { if (document.getElementById("gang-container") || Player.inGang()) {
displayGangContent(); Player.gang.displayGangContent();
routing.navigateTo(Page.Gang); routing.navigateTo(Page.Gang);
} else { } else {
Engine.loadTerminalContent(); Engine.loadTerminalContent();
@ -520,6 +518,9 @@ const Engine = {
document.getElementById("gang-container").style.display = "none"; document.getElementById("gang-container").style.display = "none";
} }
if (Player.inGang()) {
Player.gang.clearUI();
}
if (Player.corporation instanceof Corporation) { if (Player.corporation instanceof Corporation) {
Player.corporation.clearUI(); Player.corporation.clearUI();
} }
@ -557,7 +558,6 @@ const Engine = {
displayCharacterOverviewInfo: function() { displayCharacterOverviewInfo: function() {
Engine.overview.update(); Engine.overview.update();
const save = document.getElementById("character-overview-save-button"); const save = document.getElementById("character-overview-save-button");
const flashClass = "flashing-button"; const flashClass = "flashing-button";
if(!Settings.AutosaveInterval) { if(!Settings.AutosaveInterval) {
@ -1076,8 +1076,8 @@ const Engine = {
} }
if (Engine.Counters.updateDisplaysLong <= 0) { if (Engine.Counters.updateDisplaysLong <= 0) {
if (routing.isOn(Page.Gang)) { if (routing.isOn(Page.Gang) && Player.inGang()) {
updateGangContent(); Player.gang.updateGangContent();
} else if (routing.isOn(Page.ScriptEditor)) { } else if (routing.isOn(Page.ScriptEditor)) {
updateScriptEditorContent(); updateScriptEditorContent();
} }

@ -66,6 +66,7 @@ function infiltrationBoxCreate(inst) {
selector.innerHTML = ""; selector.innerHTML = "";
for (let i = 0; i < Player.factions.length; ++i) { for (let i = 0; i < Player.factions.length; ++i) {
if (Player.factions[i] === "Bladeburners") { continue; } if (Player.factions[i] === "Bladeburners") { continue; }
if (Player.inGang() && Player.gang.facName === Player.factions[i]) { continue; }
selector.innerHTML += "<option value='" + Player.factions[i] + selector.innerHTML += "<option value='" + Player.factions[i] +
"'>" + Player.factions[i] + "</option>"; "'>" + Player.factions[i] + "</option>";
} }

@ -27,4 +27,6 @@ export const KEY: IMap<number> = {
U: 85, U: 85,
UPARROW: 38, UPARROW: 38,
W: 87, W: 87,
"1": 49,
"2": 50,
}; };

@ -66,6 +66,7 @@ interface ICreateElementStyleOptions {
interface ICreateElementTooltipOptions { interface ICreateElementTooltipOptions {
tooltip?: string; tooltip?: string;
tooltipleft?: string; tooltipleft?: string;
tooltipsmall?: string;
} }
/** /**
@ -216,6 +217,12 @@ function setElementTooltip(el: HTMLElement, params: ICreateElementTooltipOptions
class: "tooltiptextleft", class: "tooltiptextleft",
innerHTML: params.tooltipleft, innerHTML: params.tooltipleft,
})); }));
} else if (params.tooltipsmall !== undefined) {
el.className += " tooltip";
el.appendChild(createElement("span", {
class: "tooltiptext smallfont",
innerHTML: params.tooltipsmall,
}))
} }
} }