Compare commits
3 Commits
ba349a11f1
...
ca13c3fc81
| Author | SHA1 | Date | |
|---|---|---|---|
| ca13c3fc81 | |||
| d2aff211c6 | |||
| 791ae389d8 |
@ -8,8 +8,8 @@ export const giveKeyChainTriggeredMessageController: RequestHandler = async (req
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const keyChainInfo = JSON.parse((req.body as Buffer).toString()) as IKeyChainRequest;
|
||||
|
||||
const inventory = await getInventory(accountId, "QuestKeys");
|
||||
await giveKeyChainMessage(inventory, accountId, keyChainInfo);
|
||||
const inventory = await getInventory(accountId, "QuestKeys accountOwnerId");
|
||||
await giveKeyChainMessage(inventory, keyChainInfo);
|
||||
await inventory.save();
|
||||
|
||||
res.send(1);
|
||||
|
||||
@ -2,7 +2,11 @@ import type { RequestHandler } from "express";
|
||||
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
|
||||
import { getAccountForRequest } from "../../services/loginService.ts";
|
||||
import type { IMissionInventoryUpdateRequest } from "../../types/requestTypes.ts";
|
||||
import { addMissionInventoryUpdates, addMissionRewards } from "../../services/missionInventoryUpdateService.ts";
|
||||
import {
|
||||
addMissionInventoryUpdates,
|
||||
addMissionRewards,
|
||||
handleConservation
|
||||
} from "../../services/missionInventoryUpdateService.ts";
|
||||
import { getInventory } from "../../services/inventoryService.ts";
|
||||
import { getInventoryResponse } from "./inventoryController.ts";
|
||||
import { logger } from "../../utils/logger.ts";
|
||||
@ -94,6 +98,7 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
||||
SyndicateXPItemReward,
|
||||
ConquestCompletedMissionsCount
|
||||
} = await addMissionRewards(account, inventory, missionReport, firstCompletion);
|
||||
handleConservation(inventory, missionReport, AffiliationMods); // Conservation reports have GS_SUCCESS
|
||||
|
||||
if (missionReport.EndOfMatchUpload) {
|
||||
inventory.RewardSeed = generateRewardSeed();
|
||||
@ -111,8 +116,16 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
||||
AffiliationMods,
|
||||
ConquestCompletedMissionsCount
|
||||
};
|
||||
if (missionReport.RJ) {
|
||||
logger.debug(`railjack interstitial request, sending only deltas`, deltas);
|
||||
if (
|
||||
missionReport.BMI ||
|
||||
missionReport.TNT ||
|
||||
missionReport.SSC ||
|
||||
missionReport.RJ ||
|
||||
missionReport.SS ||
|
||||
missionReport.CMI ||
|
||||
missionReport.EJC
|
||||
) {
|
||||
logger.debug(`interstitial request, sending only deltas`, deltas);
|
||||
res.json(deltas);
|
||||
} else if (missionReport.RewardInfo) {
|
||||
logger.debug(`classic mission completion, sending everything`);
|
||||
|
||||
@ -102,8 +102,16 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
||||
questKey.Completed = false;
|
||||
questKey.CompletionDate = undefined;
|
||||
}
|
||||
questKey.Progress.pop();
|
||||
const stage = questKey.Progress.length - 1;
|
||||
|
||||
const run = questKey.Progress[0]?.c ?? 0;
|
||||
const stage = questKey.Progress.map(p => p.c).lastIndexOf(run);
|
||||
|
||||
if (run > 0) {
|
||||
questKey.Progress[stage].c = run - 1;
|
||||
} else {
|
||||
questKey.Progress.pop();
|
||||
}
|
||||
|
||||
if (stage > 0) {
|
||||
await giveKeyChainStageTriggered(inventory, {
|
||||
KeyChain: questKey.ItemType,
|
||||
@ -123,28 +131,28 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
if (!questKey.Progress) break;
|
||||
|
||||
const currentStage = questKey.Progress.length;
|
||||
const run = questKey.Progress[0]?.c ?? 0;
|
||||
const currentStage = questKey.Progress.map(p => p.c).lastIndexOf(run);
|
||||
|
||||
if (currentStage + 1 == questManifest.chainStages?.length) {
|
||||
logger.debug(`Trying to complete last stage with nextStage, calling completeQuest instead`);
|
||||
await completeQuest(inventory, questKey.ItemType);
|
||||
} else {
|
||||
const progress = {
|
||||
c: 0,
|
||||
i: false,
|
||||
m: false,
|
||||
b: []
|
||||
};
|
||||
questKey.Progress.push(progress);
|
||||
if (run > 0) {
|
||||
questKey.Progress[currentStage + 1].c = run;
|
||||
} else {
|
||||
questKey.Progress.push({ c: run, i: false, m: false, b: [] });
|
||||
}
|
||||
|
||||
await giveKeyChainStageTriggered(inventory, {
|
||||
KeyChain: questKey.ItemType,
|
||||
ChainStage: currentStage
|
||||
ChainStage: currentStage + 1
|
||||
});
|
||||
|
||||
if (currentStage > 0) {
|
||||
await giveKeyChainMissionReward(inventory, {
|
||||
KeyChain: questKey.ItemType,
|
||||
ChainStage: currentStage - 1
|
||||
ChainStage: currentStage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,46 +517,6 @@ export const addMissionInventoryUpdates = async (
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "CapturedAnimals": {
|
||||
for (const capturedAnimal of value) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const meta = ExportAnimals[capturedAnimal.AnimalType]?.conservation;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (meta) {
|
||||
if (capturedAnimal.NumTags) {
|
||||
addMiscItems(inventory, [
|
||||
{
|
||||
ItemType: meta.itemReward,
|
||||
ItemCount: capturedAnimal.NumTags
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (capturedAnimal.NumExtraRewards) {
|
||||
if (meta.woundedAnimalReward) {
|
||||
addMiscItems(inventory, [
|
||||
{
|
||||
ItemType: meta.woundedAnimalReward,
|
||||
ItemCount: capturedAnimal.NumExtraRewards
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
logger.warn(
|
||||
`client attempted to claim unknown extra rewards for conservation of ${capturedAnimal.AnimalType}`
|
||||
);
|
||||
}
|
||||
}
|
||||
if (meta.standingReward) {
|
||||
const syndicateTag =
|
||||
inventoryUpdates.Missions!.Tag == "SolNode129" ? "SolarisSyndicate" : "CetusSyndicate";
|
||||
logger.debug(`adding ${meta.standingReward} standing to ${syndicateTag} for conservation`);
|
||||
addStanding(inventory, syndicateTag, meta.standingReward);
|
||||
}
|
||||
} else {
|
||||
logger.warn(`ignoring conservation of unknown AnimalType: ${capturedAnimal.AnimalType}`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "KubrowPetEggs": {
|
||||
for (const egg of value) {
|
||||
inventory.KubrowPetEggs.push({
|
||||
@ -961,7 +921,7 @@ interface AddMissionRewardsReturnType {
|
||||
MissionRewards: IMissionReward[];
|
||||
inventoryChanges?: IInventoryChanges;
|
||||
credits?: IMissionCredits;
|
||||
AffiliationMods?: IAffiliationMods[];
|
||||
AffiliationMods: IAffiliationMods[];
|
||||
SyndicateXPItemReward?: number;
|
||||
ConquestCompletedMissionsCount?: number;
|
||||
}
|
||||
@ -1137,10 +1097,12 @@ export const addMissionRewards = async (
|
||||
}: IMissionInventoryUpdateRequest,
|
||||
firstCompletion: boolean
|
||||
): Promise<AddMissionRewardsReturnType> => {
|
||||
AffiliationMods ??= [];
|
||||
|
||||
if (!rewardInfo) {
|
||||
//TODO: if there is a case where you can have credits collected during a mission but no rewardInfo, add credits needs to be handled earlier
|
||||
logger.debug(`Mission ${missions!.Tag} did not have Reward Info `);
|
||||
return { MissionRewards: [] };
|
||||
return { MissionRewards: [], AffiliationMods };
|
||||
}
|
||||
|
||||
//TODO: check double reward merging
|
||||
@ -1450,8 +1412,6 @@ export const addMissionRewards = async (
|
||||
}
|
||||
}
|
||||
|
||||
AffiliationMods ??= [];
|
||||
|
||||
if (rewardInfo.JobStage != undefined && rewardInfo.jobId) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const [jobType, unkIndex, hubNode, syndicateMissionId] = rewardInfo.jobId.split("_");
|
||||
@ -2252,6 +2212,54 @@ function getRandomMissionDrops(
|
||||
return drops;
|
||||
}
|
||||
|
||||
export const handleConservation = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
missionReport: IMissionInventoryUpdateRequest,
|
||||
AffiliationMods: IAffiliationMods[]
|
||||
): void => {
|
||||
if (missionReport.CapturedAnimals) {
|
||||
for (const capturedAnimal of missionReport.CapturedAnimals) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const meta = ExportAnimals[capturedAnimal.AnimalType]?.conservation;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (meta) {
|
||||
if (capturedAnimal.NumTags) {
|
||||
addMiscItems(inventory, [
|
||||
{
|
||||
ItemType: meta.itemReward,
|
||||
ItemCount: capturedAnimal.NumTags * capturedAnimal.Count
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (capturedAnimal.NumExtraRewards) {
|
||||
if (meta.woundedAnimalReward) {
|
||||
addMiscItems(inventory, [
|
||||
{
|
||||
ItemType: meta.woundedAnimalReward,
|
||||
ItemCount: capturedAnimal.NumExtraRewards * capturedAnimal.Count
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
logger.warn(
|
||||
`client attempted to claim unknown extra rewards for conservation of ${capturedAnimal.AnimalType}`
|
||||
);
|
||||
}
|
||||
}
|
||||
if (meta.standingReward) {
|
||||
addStanding(
|
||||
inventory,
|
||||
missionReport.Missions!.Tag == "SolNode129" ? "SolarisSyndicate" : "CetusSyndicate",
|
||||
[2, 1.5, 1][capturedAnimal.CaptureRating] * meta.standingReward * capturedAnimal.Count,
|
||||
AffiliationMods
|
||||
);
|
||||
}
|
||||
} else {
|
||||
logger.warn(`ignoring conservation of unknown AnimalType: ${capturedAnimal.AnimalType}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const corruptedMods = [
|
||||
"/Lotus/StoreItems/Upgrades/Mods/Melee/DualStat/CorruptedHeavyDamageChargeSpeedMod", // Corrupt Charge
|
||||
"/Lotus/StoreItems/Upgrades/Mods/Pistol/DualStat/CorruptedCritDamagePistol", // Hollow Point
|
||||
|
||||
@ -6,7 +6,6 @@ import { addItem, addItems, addKeyChainItems, setupKahlSyndicate } from "./inven
|
||||
import { fromStoreItem, getKeyChainMessage, getLevelKeyRewards } from "./itemDataService.ts";
|
||||
import type { IQuestKeyClient, IQuestKeyDatabase, IQuestStage } from "../types/inventoryTypes/inventoryTypes.ts";
|
||||
import { logger } from "../utils/logger.ts";
|
||||
import type { Types } from "mongoose";
|
||||
import { ExportKeys } from "warframe-public-export-plus";
|
||||
import { addFixedLevelRewards } from "./missionInventoryUpdateService.ts";
|
||||
import type { IInventoryChanges } from "../types/purchaseTypes.ts";
|
||||
@ -44,7 +43,12 @@ export const updateQuestKey = async (
|
||||
inventory.QuestKeys[questKeyIndex].CompletionDate = new Date();
|
||||
|
||||
const questKey = questKeyUpdate[0].ItemType;
|
||||
await handleQuestCompletion(inventory, questKey, inventoryChanges);
|
||||
await handleQuestCompletion(
|
||||
inventory,
|
||||
questKey,
|
||||
inventoryChanges,
|
||||
(questKeyUpdate[0].Progress?.[0]?.c ?? 0) > 0
|
||||
);
|
||||
}
|
||||
return inventoryChanges;
|
||||
};
|
||||
@ -52,7 +56,7 @@ export const updateQuestKey = async (
|
||||
export const updateQuestStage = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
{ KeyChain, ChainStage }: IKeyChainRequest,
|
||||
questStageUpdate: IQuestStage
|
||||
questStageUpdate: Partial<IQuestStage>
|
||||
): void => {
|
||||
const quest = inventory.QuestKeys.find(quest => quest.ItemType === KeyChain);
|
||||
|
||||
@ -68,14 +72,22 @@ export const updateQuestStage = (
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!questStage) {
|
||||
const questStageIndex = quest.Progress.push(questStageUpdate) - 1;
|
||||
const questStageIndex =
|
||||
quest.Progress.push({
|
||||
c: questStageUpdate.c ?? 0,
|
||||
i: questStageUpdate.i ?? false,
|
||||
m: questStageUpdate.m ?? false,
|
||||
b: questStageUpdate.b ?? []
|
||||
}) - 1;
|
||||
if (questStageIndex !== ChainStage) {
|
||||
throw new Error(`Quest stage index mismatch: ${questStageIndex} !== ${ChainStage}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Object.assign(questStage, questStageUpdate);
|
||||
for (const [key, value] of Object.entries(questStageUpdate) as [keyof IQuestStage, number | boolean | any[]][]) {
|
||||
(questStage[key] as any) = value;
|
||||
}
|
||||
};
|
||||
|
||||
export const addQuestKey = (
|
||||
@ -112,58 +124,53 @@ export const completeQuest = async (inventory: TInventoryDatabaseDocument, quest
|
||||
}
|
||||
|
||||
const chainStageTotal = chainStages.length;
|
||||
let existingQuestKey = inventory.QuestKeys.find(qk => qk.ItemType === questKey);
|
||||
|
||||
const existingQuestKey = inventory.QuestKeys.find(qk => qk.ItemType === questKey);
|
||||
|
||||
const startingStage = Math.max((existingQuestKey?.Progress?.length ?? 0) - 1, 0);
|
||||
|
||||
if (existingQuestKey?.Completed) {
|
||||
return;
|
||||
}
|
||||
if (existingQuestKey) {
|
||||
existingQuestKey.Progress = existingQuestKey.Progress ?? [];
|
||||
|
||||
const existingProgressLength = existingQuestKey.Progress.length;
|
||||
|
||||
if (existingProgressLength < chainStageTotal) {
|
||||
const missingProgress: IQuestStage[] = Array.from(
|
||||
{ length: chainStageTotal - existingProgressLength },
|
||||
() =>
|
||||
({
|
||||
c: 0,
|
||||
i: false,
|
||||
m: false,
|
||||
b: []
|
||||
}) as IQuestStage
|
||||
);
|
||||
|
||||
existingQuestKey.Progress.push(...missingProgress);
|
||||
existingQuestKey.CompletionDate = new Date();
|
||||
existingQuestKey.Completed = true;
|
||||
}
|
||||
} else {
|
||||
if (!existingQuestKey) {
|
||||
const completedQuestKey: IQuestKeyDatabase = {
|
||||
ItemType: questKey,
|
||||
Completed: true,
|
||||
Completed: false,
|
||||
unlock: true,
|
||||
Progress: Array(chainStageTotal).fill({
|
||||
Progress: Array.from({ length: chainStageTotal }, () => ({
|
||||
c: 0,
|
||||
i: false,
|
||||
m: false,
|
||||
b: []
|
||||
} satisfies IQuestStage),
|
||||
CompletionDate: new Date()
|
||||
}))
|
||||
};
|
||||
addQuestKey(inventory, completedQuestKey);
|
||||
existingQuestKey = inventory.QuestKeys.find(qk => qk.ItemType === questKey)!;
|
||||
} else if (existingQuestKey.Completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = startingStage; i < chainStageTotal; i++) {
|
||||
await giveKeyChainStageTriggered(inventory, { KeyChain: questKey, ChainStage: i });
|
||||
existingQuestKey.Progress = existingQuestKey.Progress ?? [];
|
||||
|
||||
await giveKeyChainMissionReward(inventory, { KeyChain: questKey, ChainStage: i });
|
||||
const run = existingQuestKey.Progress[0]?.c ?? 0;
|
||||
|
||||
const existingProgressLength = existingQuestKey.Progress.length;
|
||||
if (existingProgressLength < chainStageTotal) {
|
||||
const missingProgress: IQuestStage[] = Array.from(
|
||||
{ length: chainStageTotal - existingProgressLength },
|
||||
() => ({ c: run, i: false, m: false, b: [] }) as IQuestStage
|
||||
);
|
||||
existingQuestKey.Progress.push(...missingProgress);
|
||||
}
|
||||
|
||||
await handleQuestCompletion(inventory, questKey);
|
||||
for (let i = 0; i < chainStageTotal; i++) {
|
||||
const stage = existingQuestKey.Progress[i];
|
||||
if (stage.c < run) {
|
||||
stage.c = run;
|
||||
await giveKeyChainStageTriggered(inventory, { KeyChain: questKey, ChainStage: i });
|
||||
await giveKeyChainMissionReward(inventory, { KeyChain: questKey, ChainStage: i });
|
||||
}
|
||||
}
|
||||
|
||||
if (existingQuestKey.Progress.every(p => p.c == run)) {
|
||||
existingQuestKey.Completed = true;
|
||||
existingQuestKey.CompletionDate = new Date();
|
||||
await handleQuestCompletion(inventory, questKey, undefined, run > 0);
|
||||
}
|
||||
};
|
||||
|
||||
const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
|
||||
@ -214,28 +221,35 @@ const doesQuestCompletionFinishSet = (
|
||||
const handleQuestCompletion = async (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
questKey: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
isRerun: boolean = false
|
||||
): Promise<void> => {
|
||||
logger.debug(`completed quest ${questKey}`);
|
||||
|
||||
if (inventory.ActiveQuest == questKey) inventory.ActiveQuest = "";
|
||||
if (questKey == "/Lotus/Types/Keys/OrokinMoonQuest/OrokinMoonQuestKeyChain") {
|
||||
const att = isRerun
|
||||
? []
|
||||
: [
|
||||
"/Lotus/Weapons/Tenno/Melee/Swords/StalkerTwo/StalkerTwoSmallSword",
|
||||
"/Lotus/Upgrades/Skins/Sigils/ScarSigil"
|
||||
];
|
||||
await createMessage(inventory.accountOwnerId, [
|
||||
{
|
||||
sndr: "/Lotus/Language/Bosses/Ordis",
|
||||
msg: "/Lotus/Language/G1Quests/SecondDreamFinishInboxMessage",
|
||||
att: [
|
||||
"/Lotus/Weapons/Tenno/Melee/Swords/StalkerTwo/StalkerTwoSmallSword",
|
||||
"/Lotus/Upgrades/Skins/Sigils/ScarSigil"
|
||||
],
|
||||
att,
|
||||
sub: "/Lotus/Language/G1Quests/SecondDreamFinishInboxTitle",
|
||||
icon: "/Lotus/Interface/Icons/Npcs/Ordis.png",
|
||||
highPriority: true
|
||||
}
|
||||
]);
|
||||
} else if (questKey == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain") {
|
||||
} else if (questKey == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain" && !isRerun) {
|
||||
setupKahlSyndicate(inventory);
|
||||
}
|
||||
|
||||
if (isRerun) return;
|
||||
|
||||
// Whispers in the Walls is unlocked once The New War + Heart of Deimos are completed.
|
||||
if (
|
||||
doesQuestCompletionFinishSet(inventory, questKey, [
|
||||
@ -279,21 +293,24 @@ const handleQuestCompletion = async (
|
||||
if (questCompletionItems) {
|
||||
await addItems(inventory, questCompletionItems, inventoryChanges);
|
||||
}
|
||||
|
||||
if (inventory.ActiveQuest == questKey) inventory.ActiveQuest = "";
|
||||
};
|
||||
|
||||
export const giveKeyChainItem = async (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
keyChainInfo: IKeyChainRequest
|
||||
keyChainInfo: IKeyChainRequest,
|
||||
isRerun: boolean = false
|
||||
): Promise<IInventoryChanges> => {
|
||||
const inventoryChanges = await addKeyChainItems(inventory, keyChainInfo);
|
||||
let inventoryChanges: IInventoryChanges = {};
|
||||
|
||||
if (isEmptyObject(inventoryChanges)) {
|
||||
logger.warn("inventory changes was empty after getting keychain items: should not happen");
|
||||
if (!isRerun) {
|
||||
inventoryChanges = await addKeyChainItems(inventory, keyChainInfo);
|
||||
|
||||
if (isEmptyObject(inventoryChanges)) {
|
||||
logger.warn("inventory changes was empty after getting keychain items: should not happen");
|
||||
}
|
||||
// items were added: update quest stage's i (item was given)
|
||||
updateQuestStage(inventory, keyChainInfo, { i: true });
|
||||
}
|
||||
// items were added: update quest stage's i (item was given)
|
||||
updateQuestStage(inventory, keyChainInfo, { i: true });
|
||||
|
||||
return inventoryChanges;
|
||||
|
||||
@ -309,12 +326,17 @@ export const giveKeyChainItem = async (
|
||||
|
||||
export const giveKeyChainMessage = async (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
accountId: string | Types.ObjectId,
|
||||
keyChainInfo: IKeyChainRequest
|
||||
keyChainInfo: IKeyChainRequest,
|
||||
isRerun: boolean = false
|
||||
): Promise<void> => {
|
||||
const keyChainMessage = getKeyChainMessage(keyChainInfo);
|
||||
|
||||
await createMessage(accountId, [keyChainMessage]);
|
||||
if (!isRerun) {
|
||||
keyChainMessage.att = [];
|
||||
keyChainMessage.countedAtt = [];
|
||||
}
|
||||
|
||||
await createMessage(inventory.accountOwnerId, [keyChainMessage]);
|
||||
|
||||
updateQuestStage(inventory, keyChainInfo, { m: true });
|
||||
};
|
||||
@ -328,8 +350,10 @@ export const giveKeyChainMissionReward = async (
|
||||
|
||||
if (chainStages) {
|
||||
const missionName = chainStages[keyChainInfo.ChainStage].key;
|
||||
if (missionName) {
|
||||
const questKey = inventory.QuestKeys.find(q => q.ItemType === keyChainInfo.KeyChain);
|
||||
if (missionName && questKey) {
|
||||
const fixedLevelRewards = getLevelKeyRewards(missionName);
|
||||
const run = questKey.Progress?.[0]?.c ?? 0;
|
||||
if (fixedLevelRewards.levelKeyRewards) {
|
||||
const missionRewards: { StoreItem: string; ItemCount: number }[] = [];
|
||||
inventory.RegularCredits += addFixedLevelRewards(fixedLevelRewards.levelKeyRewards, missionRewards);
|
||||
@ -338,7 +362,7 @@ export const giveKeyChainMissionReward = async (
|
||||
await addItem(inventory, fromStoreItem(reward.StoreItem), reward.ItemCount);
|
||||
}
|
||||
|
||||
updateQuestStage(inventory, keyChainInfo, { c: 0 });
|
||||
updateQuestStage(inventory, keyChainInfo, { c: run });
|
||||
} else if (fixedLevelRewards.levelKeyRewards2) {
|
||||
for (const reward of fixedLevelRewards.levelKeyRewards2) {
|
||||
if (reward.rewardType == "RT_CREDITS") {
|
||||
@ -352,7 +376,7 @@ export const giveKeyChainMissionReward = async (
|
||||
}
|
||||
}
|
||||
|
||||
updateQuestStage(inventory, keyChainInfo, { c: 0 });
|
||||
updateQuestStage(inventory, keyChainInfo, { c: run });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,14 +388,17 @@ export const giveKeyChainStageTriggered = async (
|
||||
): Promise<void> => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const chainStages = ExportKeys[keyChainInfo.KeyChain]?.chainStages;
|
||||
const questKey = inventory.QuestKeys.find(qk => qk.ItemType === keyChainInfo.KeyChain);
|
||||
|
||||
if (chainStages && questKey) {
|
||||
const run = questKey.Progress?.[0]?.c ?? 0;
|
||||
|
||||
if (chainStages) {
|
||||
if (chainStages[keyChainInfo.ChainStage].itemsToGiveWhenTriggered.length > 0) {
|
||||
await giveKeyChainItem(inventory, keyChainInfo);
|
||||
await giveKeyChainItem(inventory, keyChainInfo, run > 0);
|
||||
}
|
||||
|
||||
if (chainStages[keyChainInfo.ChainStage].messageToSendWhenTriggered) {
|
||||
await giveKeyChainMessage(inventory, inventory.accountOwnerId, keyChainInfo);
|
||||
await giveKeyChainMessage(inventory, keyChainInfo, run > 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -2803,7 +2803,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
|
||||
|
||||
const activeStartDay = day - ghoulsCycleDay + 17;
|
||||
const activeEndDay = activeStartDay + 5;
|
||||
const dayWithFraction = (timeMs - EPOCH) / 86400000;
|
||||
const dayWithFraction = (timeMs - EPOCH) / unixTimesInMs.day;
|
||||
|
||||
const progress = (dayWithFraction - activeStartDay) / (activeEndDay - activeStartDay);
|
||||
const healthPct = 1 - Math.min(Math.max(progress, 0), 1);
|
||||
@ -2814,22 +2814,14 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
|
||||
$date: {
|
||||
$numberLong: config.worldState?.ghoulEmergenceOverride
|
||||
? "1753204900185"
|
||||
: Date.UTC(
|
||||
date.getUTCFullYear(),
|
||||
date.getUTCMonth(),
|
||||
date.getUTCDate() + activeStartDay
|
||||
).toString()
|
||||
: (EPOCH + activeStartDay * unixTimesInMs.day).toString()
|
||||
}
|
||||
},
|
||||
Expiry: {
|
||||
$date: {
|
||||
$numberLong: config.worldState?.ghoulEmergenceOverride
|
||||
? "2000000000000"
|
||||
: Date.UTC(
|
||||
date.getUTCFullYear(),
|
||||
date.getUTCMonth(),
|
||||
date.getUTCDate() + activeEndDay
|
||||
).toString()
|
||||
: (EPOCH + activeEndDay * unixTimesInMs.day).toString()
|
||||
}
|
||||
},
|
||||
HealthPct: config.worldState?.ghoulEmergenceOverride ? 1 : healthPct,
|
||||
|
||||
@ -977,10 +977,10 @@ export interface IQuestKeyClient extends Omit<IQuestKeyDatabase, "CompletionDate
|
||||
}
|
||||
|
||||
export interface IQuestStage {
|
||||
c?: number;
|
||||
i?: boolean;
|
||||
m?: boolean;
|
||||
b?: any[];
|
||||
c: number;
|
||||
i: boolean;
|
||||
m: boolean;
|
||||
b: any[];
|
||||
}
|
||||
|
||||
export interface IRawUpgrade {
|
||||
|
||||
@ -45,6 +45,15 @@ export type IMissionInventoryUpdateRequest = {
|
||||
EmailItems?: ITypeCount[];
|
||||
ShipDecorations?: ITypeCount[];
|
||||
|
||||
// flags for interstitial requests
|
||||
BMI?: boolean;
|
||||
TNT?: boolean; // Conservation; definitely need to include AffiliationMods in this case, so a normal 'inventory sync' would not work here.
|
||||
SSC?: boolean; // K-Drive race?
|
||||
RJ?: boolean; // Railjack. InventoryJson should only be returned when going back to dojo.
|
||||
SS?: boolean;
|
||||
CMI?: boolean;
|
||||
EJC?: boolean;
|
||||
|
||||
SyndicateId?: string;
|
||||
SortieId?: string;
|
||||
CalendarProgress?: { challenge: string }[];
|
||||
@ -149,7 +158,6 @@ export type IMissionInventoryUpdateRequest = {
|
||||
MultiProgress: unknown[];
|
||||
}[];
|
||||
InvasionProgress?: IInvasionProgressClient[];
|
||||
RJ?: boolean;
|
||||
ConquestMissionsCompleted?: number;
|
||||
duviriSuitSelection?: string;
|
||||
duviriPistolSelection?: string;
|
||||
|
||||
@ -989,7 +989,8 @@ function updateInventory() {
|
||||
data.QuestKeys.forEach(item => {
|
||||
const tr = document.createElement("tr");
|
||||
tr.setAttribute("data-item-type", item.ItemType);
|
||||
const stage = item.Progress?.length ?? 0;
|
||||
const run = item.Progress[0]?.c ?? 0;
|
||||
const stage = run == 0 ? item.Progress.length : item.Progress.map(p => p.c ?? 0).lastIndexOf(run);
|
||||
|
||||
const datalist = document.getElementById("datalist-QuestKeys");
|
||||
const optionToRemove = datalist.querySelector(`option[data-key="${item.ItemType}"]`);
|
||||
@ -1007,6 +1008,10 @@ function updateInventory() {
|
||||
td.textContent += " | " + loc("code_completed");
|
||||
}
|
||||
|
||||
if (run > 0) {
|
||||
td.textContent += " | " + loc("code_replays") + ": " + (run + 1);
|
||||
}
|
||||
|
||||
if (data.ActiveQuest == item.ItemType) td.textContent += " | " + loc("code_active");
|
||||
tr.appendChild(td);
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `Genetisches Altern zurücksetzen`,
|
||||
code_fund: `[UNTRANSLATED] Fund`,
|
||||
code_funded: `[UNTRANSLATED] Funded`,
|
||||
code_replays: `[UNTRANSLATED] Replays`,
|
||||
code_succChange: `Erfolgreich geändert.`,
|
||||
code_requiredInvigorationUpgrade: `Du musst sowohl ein offensives & defensives Upgrade auswählen.`,
|
||||
login_description: `Melde dich mit deinem OpenWF-Account an (denselben Angaben wie im Spiel, wenn du dich mit diesem Server verbindest).`,
|
||||
|
||||
@ -67,6 +67,7 @@ dict = {
|
||||
code_unmature: `Regress genetic aging`,
|
||||
code_fund: `Fund`,
|
||||
code_funded: `Funded`,
|
||||
code_replays: `Replays`,
|
||||
code_succChange: `Successfully changed.`,
|
||||
code_requiredInvigorationUpgrade: `You must select both an offensive & defensive upgrade.`,
|
||||
login_description: `Login using your OpenWF account credentials (same as in-game when connecting to this server).`,
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `Regresar el envejecimiento genético`,
|
||||
code_fund: `[UNTRANSLATED] Fund`,
|
||||
code_funded: `[UNTRANSLATED] Funded`,
|
||||
code_replays: `[UNTRANSLATED] Replays`,
|
||||
code_succChange: `Cambiado correctamente`,
|
||||
code_requiredInvigorationUpgrade: `Debes seleccionar una mejora ofensiva y una defensiva.`,
|
||||
login_description: `Inicia sesión con las credenciales de tu cuenta OpenWF (las mismas que usas en el juego al conectarte a este servidor).`,
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `Régrésser l'âge génétique`,
|
||||
code_fund: `Financer`,
|
||||
code_funded: `Complété`,
|
||||
code_replays: `[UNTRANSLATED] Replays`,
|
||||
code_succChange: `Changement effectué.`,
|
||||
code_requiredInvigorationUpgrade: `Augmentation offensive et défensive requises.`,
|
||||
login_description: `Connexion avec les informations de connexion OpenWF.`,
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `Регрессия генетического старения`,
|
||||
code_fund: `Профинансировать`,
|
||||
code_funded: `Профинансировано`,
|
||||
code_replays: `Повторов`,
|
||||
code_succChange: `Успешно изменено.`,
|
||||
code_requiredInvigorationUpgrade: `Вы должны выбрать как атакующее, так и вспомогательное улучшение.`,
|
||||
login_description: `Войдите, используя учетные данные OpenWF (те же, что и в игре при подключении к этому серверу).`,
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `Обернути старіння`,
|
||||
code_fund: `[UNTRANSLATED] Fund`,
|
||||
code_funded: `[UNTRANSLATED] Funded`,
|
||||
code_replays: `[UNTRANSLATED] Replays`,
|
||||
code_succChange: `Успішно змінено.`,
|
||||
code_requiredInvigorationUpgrade: `Ви повинні вибрати як атакуюче, так і допоміжне вдосконалення.`,
|
||||
login_description: `Увійдіть, використовуючи облікові дані OpenWF (ті ж, що й у грі при підключенні до цього серверу).`,
|
||||
|
||||
@ -68,6 +68,7 @@ dict = {
|
||||
code_unmature: `逆转衰老基因`,
|
||||
code_fund: `[UNTRANSLATED] Fund`,
|
||||
code_funded: `[UNTRANSLATED] Funded`,
|
||||
code_replays: `[UNTRANSLATED] Replays`,
|
||||
code_succChange: `更改成功`,
|
||||
code_requiredInvigorationUpgrade: `您必须同时选择一个进攻型和一个功能型活化属性.`,
|
||||
login_description: `使用您的 OpenWF 账户凭证登录(与游戏内连接本服务器时使用的昵称相同)`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user