Merge pull request #3931 from Aerophia/dev

API: FIX #3860 destroyW0r1dD43m0n now properly gives achievements and FIX #3890 favor now properly syncs across pages and the Donate achievement is now given correctly
This commit is contained in:
hydroflame 2022-08-23 13:01:20 -03:00 committed by GitHub
commit d1c4f299ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

@ -25,6 +25,7 @@ import * as data from "./AchievementData.json";
import { FactionNames } from "../Faction/data/FactionNames";
import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames";
import { isClassWork } from "../Work/ClassWork";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
// Unable to correctly cast the JSON data into AchievementDataJson type otherwise...
const achievementData = (<AchievementDataJson>(<unknown>data)).achievements;
@ -383,7 +384,10 @@ export const achievements: IMap<Achievement> = {
DONATION: {
...achievementData["DONATION"],
Icon: "donation",
Condition: () => Object.values(Factions).some((f) => f.favor >= 150),
Condition: () =>
Object.values(Factions).some(
(f) => f.favor >= Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction),
),
},
TRAVEL: {
...achievementData["TRAVEL"],

@ -171,7 +171,7 @@ const FactionElement = (props: IFactionProps): React.ReactElement => {
{props.joined && (
<Box display="grid" sx={{ alignItems: "center", justifyItems: "left", gridAutoFlow: "row" }}>
<Typography sx={{ color: Settings.theme.rep }}>
{numeralWrapper.formatFavor(props.faction.favor)} favor
{numeralWrapper.formatFavor(Math.floor(props.faction.favor))} favor
</Typography>
<Typography sx={{ color: Settings.theme.rep }}>
{numeralWrapper.formatReputation(props.faction.playerReputation)} rep

@ -9,6 +9,7 @@ import { killWorkerScript } from "../Netscript/killWorkerScript";
import { CONSTANTS } from "../Constants";
import { isString } from "../utils/helpers/isString";
import { RunningScript } from "../Script/RunningScript";
import { calculateAchievements } from "../Achievements/Achievements";
import {
AugmentationStats,
@ -1275,12 +1276,11 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
helpers.checkSingularityAccess(ctx);
const nextBN = helpers.number(ctx, "nextBN", _nextBN);
const callbackScript = helpers.string(ctx, "callbackScript", _callbackScript);
helpers.checkSingularityAccess(ctx);
const wd = GetServer(SpecialServers.WorldDaemon);
if (!(wd instanceof Server))
throw new Error("WorldDaemon was not a normal server. This is a bug contact dev.");
const hackingRequirements = (): boolean => {
const wd = GetServer(SpecialServers.WorldDaemon);
if (!(wd instanceof Server))
throw new Error("WorldDaemon was not a normal server. This is a bug contact dev.");
if (player.skills.hacking < wd.requiredHackingSkill) return false;
if (!wd.hasAdminRights) return false;
return true;
@ -1296,6 +1296,8 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
return;
}
wd.backdoorInstalled = true;
calculateAchievements();
enterBitNode(Router, false, player.bitNodeN, nextBN);
if (callbackScript)
setTimeout(() => {