feat: library personal target progress #1083

Merged
Sainan merged 1 commits from library-personal-progress into main 2025-03-07 00:40:23 -08:00
4 changed files with 77 additions and 14 deletions

View File

@ -8,7 +8,7 @@ export const startLibraryPersonalTargetController: RequestHandler = async (req,
inventory.LibraryPersonalTarget = req.query.target as string; inventory.LibraryPersonalTarget = req.query.target as string;
await inventory.save(); await inventory.save();
res.json({ res.json({
IsQuest: false, IsQuest: req.query.target == "/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget",
Target: req.query.target Target: req.query.target
}); });
}; };

View File

@ -74,7 +74,8 @@ import {
IAlignment, IAlignment,
ICollectibleEntry, ICollectibleEntry,
IIncentiveState, IIncentiveState,
ISongChallenge ISongChallenge,
ILibraryPersonalProgress
} from "../../types/inventoryTypes/inventoryTypes"; } from "../../types/inventoryTypes/inventoryTypes";
import { IOid } from "../../types/commonTypes"; import { IOid } from "../../types/commonTypes";
import { import {
@ -1005,6 +1006,15 @@ pendingCouponSchema.set("toJSON", {
} }
}); });
const libraryPersonalProgressSchema = new Schema<ILibraryPersonalProgress>(
{
TargetType: String,
Scans: Number,
Completed: Boolean
},
{ _id: false }
);
const libraryDailyTaskInfoSchema = new Schema<ILibraryDailyTaskInfo>( const libraryDailyTaskInfoSchema = new Schema<ILibraryDailyTaskInfo>(
{ {
EnemyTypes: [String], EnemyTypes: [String],
@ -1271,7 +1281,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
LibraryPersonalTarget: String, LibraryPersonalTarget: String,
//Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false //Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false
LibraryPersonalProgress: [Schema.Types.Mixed], LibraryPersonalProgress: { type: [libraryPersonalProgressSchema], default: [] },
//Cephalon Simaris Daily Task //Cephalon Simaris Daily Task
LibraryAvailableDailyTaskInfo: libraryDailyTaskInfoSchema, LibraryAvailableDailyTaskInfo: libraryDailyTaskInfoSchema,
LibraryActiveDailyTaskInfo: libraryDailyTaskInfoSchema, LibraryActiveDailyTaskInfo: libraryDailyTaskInfoSchema,

View File

@ -191,17 +191,48 @@ export const addMissionInventoryUpdates = (
break; break;
case "LibraryScans": case "LibraryScans":
value.forEach(scan => { value.forEach(scan => {
if (inventory.LibraryActiveDailyTaskInfo) { let synthesisIgnored = true;
if (inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType)) { if (
inventory.LibraryActiveDailyTaskInfo.Scans ??= 0; inventory.LibraryPersonalTarget &&
inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count; libraryPersonalTargetToAvatar[inventory.LibraryPersonalTarget] == scan.EnemyType
} else { ) {
logger.warn( let progress = inventory.LibraryPersonalProgress.find(
`ignoring synthesis of ${scan.EnemyType} as it's not part of the active daily task` x => x.TargetType == inventory.LibraryPersonalTarget
); );
if (!progress) {
progress =
inventory.LibraryPersonalProgress[
inventory.LibraryPersonalProgress.push({
TargetType: inventory.LibraryPersonalTarget,
Scans: 0,
Completed: false
}) - 1
];
} }
} else { progress.Scans += scan.Count;
logger.warn(`no library daily task active, ignoring synthesis of ${scan.EnemyType}`); if (
progress.Scans >=
(inventory.LibraryPersonalTarget ==
"/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget"
? 3
: 10)
) {
progress.Completed = true;
}
logger.debug(`synthesis of ${scan.EnemyType} added to personal target progress`);
synthesisIgnored = false;
}
if (
inventory.LibraryActiveDailyTaskInfo &&
inventory.LibraryActiveDailyTaskInfo.EnemyTypes.find(x => x == scan.EnemyType)
) {
inventory.LibraryActiveDailyTaskInfo.Scans ??= 0;
inventory.LibraryActiveDailyTaskInfo.Scans += scan.Count;
logger.debug(`synthesis of ${scan.EnemyType} added to daily task progress`);
synthesisIgnored = false;
}
if (synthesisIgnored) {
logger.warn(`ignoring synthesis of ${scan.EnemyType} due to not knowing why you did that`);
} }
}); });
break; break;
@ -534,3 +565,25 @@ const corruptedMods = [
"/Lotus/StoreItems/Upgrades/Mods/Rifle/DualStat/CorruptedReloadSpeedMaxClipRifle", // Depleted Reload "/Lotus/StoreItems/Upgrades/Mods/Rifle/DualStat/CorruptedReloadSpeedMaxClipRifle", // Depleted Reload
"/Lotus/StoreItems/Upgrades/Mods/Warframe/DualStat/FixedShieldAndShieldGatingDuration" // Catalyzing Shields "/Lotus/StoreItems/Upgrades/Mods/Warframe/DualStat/FixedShieldAndShieldGatingDuration" // Catalyzing Shields
]; ];
const libraryPersonalTargetToAvatar: Record<string, string> = {
"/Lotus/Types/Game/Library/Targets/DragonframeQuestTarget":
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/RifleLancerAvatar",
"/Lotus/Types/Game/Library/Targets/Research1Target":
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/RifleLancerAvatar",
"/Lotus/Types/Game/Library/Targets/Research2Target":
"/Lotus/Types/Enemies/Corpus/BipedRobot/AIWeek/LaserDiscBipedAvatar",
"/Lotus/Types/Game/Library/Targets/Research3Target":
"/Lotus/Types/Enemies/Grineer/Desert/Avatars/EvisceratorLancerAvatar",
"/Lotus/Types/Game/Library/Targets/Research4Target": "/Lotus/Types/Enemies/Orokin/OrokinHealingAncientAvatar",
"/Lotus/Types/Game/Library/Targets/Research5Target":
"/Lotus/Types/Enemies/Corpus/Spaceman/AIWeek/ShotgunSpacemanAvatar",
"/Lotus/Types/Game/Library/Targets/Research6Target": "/Lotus/Types/Enemies/Infested/AiWeek/Runners/RunnerAvatar",
"/Lotus/Types/Game/Library/Targets/Research7Target":
"/Lotus/Types/Enemies/Grineer/AIWeek/Avatars/GrineerMeleeStaffAvatar",
"/Lotus/Types/Game/Library/Targets/Research8Target": "/Lotus/Types/Enemies/Orokin/OrokinHeavyFemaleAvatar",
"/Lotus/Types/Game/Library/Targets/Research9Target":
"/Lotus/Types/Enemies/Infested/AiWeek/Quadrupeds/QuadrupedAvatar",
"/Lotus/Types/Game/Library/Targets/Research10Target":
"/Lotus/Types/Enemies/Corpus/Spaceman/AIWeek/NullifySpacemanAvatar"
};

View File

@ -313,7 +313,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
Quests: any[]; Quests: any[];
Robotics: any[]; Robotics: any[];
UsedDailyDeals: any[]; UsedDailyDeals: any[];
LibraryPersonalTarget: string; LibraryPersonalTarget?: string;
LibraryPersonalProgress: ILibraryPersonalProgress[]; LibraryPersonalProgress: ILibraryPersonalProgress[];
CollectibleSeries?: ICollectibleEntry[]; CollectibleSeries?: ICollectibleEntry[];
LibraryAvailableDailyTaskInfo?: ILibraryDailyTaskInfo; LibraryAvailableDailyTaskInfo?: ILibraryDailyTaskInfo;