mirror of
https://github.com/thepeacockproject/Peacock
synced 2025-02-23 03:35:25 +01:00
Fix completion data generation function (#85)
Added override for HideProgression Added hidden mastery levels for FACILITY Fixed Mastery-tab from showing when there aren't any drops Co-authored-by: Lennard Fonteijn <lennard@lennardf1989.com>
This commit is contained in:
parent
85a55d4b48
commit
d6cae91a0f
components
contractdata/FACILITY
@ -66,6 +66,7 @@ export class MasteryService {
|
||||
|
||||
getCompletionData(
|
||||
locationParentId: string,
|
||||
subLocationId: string,
|
||||
gameVersion: GameVersion,
|
||||
userId: string,
|
||||
): CompletionData {
|
||||
@ -110,8 +111,8 @@ export class MasteryService {
|
||||
Completion: locationData.Xp / nextLevelXp,
|
||||
XpLeft: nextLevelXp - locationData.Xp,
|
||||
Id: masteryData.Id,
|
||||
SubLocationId: masteryData.Id,
|
||||
HideProgression: false,
|
||||
SubLocationId: subLocationId,
|
||||
HideProgression: masteryData.HideProgression || false,
|
||||
IsLocationProgression: true,
|
||||
Name: undefined,
|
||||
}
|
||||
@ -130,6 +131,10 @@ export class MasteryService {
|
||||
const masteryData: MasteryPackage =
|
||||
this.masteryData.get(locationParentId)
|
||||
|
||||
if (masteryData.Drops.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
//Put all Ids into a set for quick lookup
|
||||
const dropIdSet = new Set(masteryData.Drops.map((drop) => drop.Id))
|
||||
|
||||
@ -147,6 +152,7 @@ export class MasteryService {
|
||||
|
||||
//Map all the data into a new structure
|
||||
const completionData = this.getCompletionData(
|
||||
locationParentId,
|
||||
locationParentId,
|
||||
gameVersion,
|
||||
userId,
|
||||
|
@ -95,7 +95,8 @@ export function generateCompletionData(
|
||||
subLocationId: string,
|
||||
userId: string,
|
||||
gameVersion: GameVersion,
|
||||
isParentLocation = false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_isParentLocation = false,
|
||||
): CompletionData {
|
||||
const subLocation = getSubLocationByName(subLocationId, gameVersion)
|
||||
|
||||
@ -105,6 +106,7 @@ export function generateCompletionData(
|
||||
|
||||
const completionData = controller.masteryService.getCompletionData(
|
||||
locationId,
|
||||
subLocation?.Id,
|
||||
gameVersion,
|
||||
userId,
|
||||
)
|
||||
@ -116,14 +118,14 @@ export function generateCompletionData(
|
||||
)
|
||||
|
||||
return {
|
||||
Level: 20,
|
||||
MaxLevel: 20,
|
||||
Level: 1,
|
||||
MaxLevel: 1,
|
||||
XP: 0,
|
||||
Completion: 1,
|
||||
Completion: 1.0,
|
||||
XpLeft: 0,
|
||||
Id: locationId,
|
||||
SubLocationId: subLocation?.Id,
|
||||
HideProgression: false,
|
||||
HideProgression: true,
|
||||
IsLocationProgression: true,
|
||||
Name: null,
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ export interface MasteryDataTemplate {
|
||||
export interface MasteryPackage {
|
||||
Id: string
|
||||
MaxLevel?: number
|
||||
HideProgression?: boolean
|
||||
Drops: {
|
||||
Id: string
|
||||
Level: number
|
||||
|
6
contractdata/FACILITY/_FACILITY_MASTERY.json
Normal file
6
contractdata/FACILITY/_FACILITY_MASTERY.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Id": "LOCATION_PARENT_ICA_FACILITY",
|
||||
"MaxLevel": 4,
|
||||
"HideProgression": true,
|
||||
"Drops": []
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user