1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-03-01 14:43:02 +01:00

Fixed Challenge XP from being capped on the Player Profile menu

Fixed Freelancer to not have payout when the mission failed
Fixed score screen from crashing when the current location has no mastery drops
This commit is contained in:
Lennard Fonteijn 2023-03-19 04:25:52 +01:00 committed by Reece Dunham
parent 0eef121ac8
commit 84fbce175b
4 changed files with 21 additions and 23 deletions

@ -451,6 +451,7 @@ export class ChallengeService extends ChallengeRegistry {
session.evergreen = {
payout: 0,
scoringScreenEndState: undefined,
failed: false,
}
}
@ -1242,16 +1243,7 @@ export class ChallengeService extends ChallengeRegistry {
profileData.Sublocations.push(foundSubLocation)
}
if (masteryData) {
foundSubLocation.Xp = clampValue(
foundSubLocation.Xp + masteryXp,
0,
contract.Metadata.Type !== "evergreen"
? xpRequiredForLevel(maxLevel)
: xpRequiredForEvergreenLevel(maxLevel),
)
}
foundSubLocation.Xp += masteryXp
foundSubLocation.ActionXp += actionXp
//Update the EvergreenLevel with the latest Mastery Level

@ -562,11 +562,21 @@ function saveEvents(
session,
)
if (event.Name.startsWith("ScoringScreenEndState_")) {
session.evergreen.scoringScreenEndState = event.Name
processed.push(event.Name)
response.push(process.hrtime.bigint().toString())
return
}
// these events are important but may be fired after the timer is over
const canGetAfterTimerOver = [
"ContractEnd",
"ObjectiveCompleted",
"CpdSet",
"MissionFailed_Event",
]
if (
@ -586,15 +596,6 @@ function saveEvents(
return
}
if (event.Name.startsWith("ScoringScreenEndState_")) {
session.evergreen.scoringScreenEndState = event.Name
processed.push(event.Name)
response.push(process.hrtime.bigint().toString())
return
}
switch (event.Name) {
case "HeroSpawn_Location":
liveSplitManager.missionIntentResolved(
@ -796,6 +797,11 @@ function saveEvents(
event
)).Value.Total_Payout
break
case "MissionFailed_Event":
if (session.evergreen) {
session.evergreen.failed = true
}
break
// Sinkhole events we don't care about
case "ItemPickedUp":
log(

@ -51,7 +51,7 @@ import {
import { getUserData, writeUserData } from "./databaseHandler"
import axios from "axios"
import { getFlag } from "./flags"
import { log, logDebug, LogLevel } from "./loggingInterop"
import { log, LogLevel } from "./loggingInterop"
import {
generateCompletionData,
getSubLocationByName,
@ -815,6 +815,7 @@ export async function missionEnd(
}
if (
!sessionDetails.evergreen.failed &&
sessionDetails.objectiveStates.get(
secondaryObjective.Id,
) === "Success"
@ -827,8 +828,6 @@ export async function missionEnd(
}
})
logDebug("Payout", sessionDetails.evergreen.payout, totalPayout)
evergreenData.Payout = totalPayout
evergreenData.EndStateEventName =
sessionDetails.evergreen.scoringScreenEndState
@ -995,7 +994,7 @@ export async function missionEnd(
req.jwt.unique_name,
) as MasteryData[]
if (masteryData) {
if (masteryData.length > 0) {
drops = masteryData[0].Drops.filter(
(e) =>
e.Level > oldLocationLevel && e.Level <= newLocationLevel,

@ -273,6 +273,7 @@ export interface ContractSession {
evergreen?: {
payout: number
scoringScreenEndState: string
failed: boolean
}
}