This commit is contained in:
parent
42552d0ed1
commit
06156bacf0
@ -210,7 +210,7 @@ export const getKeyChainItems = ({ KeyChain, ChainStage }: IKeyChainRequest): st
|
|||||||
throw new Error(`KeyChain ${KeyChain} does not contain chain stages`);
|
throw new Error(`KeyChain ${KeyChain} does not contain chain stages`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyChainStage = chainStages[ChainStage];
|
const keyChainStage = chainStages[ChainStage - 1];
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
if (!keyChainStage) {
|
if (!keyChainStage) {
|
||||||
throw new Error(`KeyChainStage ${ChainStage} not found`);
|
throw new Error(`KeyChainStage ${ChainStage} not found`);
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export const completeQuest = async (inventory: TInventoryDatabaseDocument, quest
|
|||||||
existingQuestKey.Progress.push(...missingProgress);
|
existingQuestKey.Progress.push(...missingProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < chainStageTotal; i++) {
|
for (let i = 1; i < chainStageTotal; i++) {
|
||||||
const stage = existingQuestKey.Progress[i];
|
const stage = existingQuestKey.Progress[i];
|
||||||
if (stage.c <= run) {
|
if (stage.c <= run) {
|
||||||
stage.c = run;
|
stage.c = run;
|
||||||
@ -393,11 +393,11 @@ export const giveKeyChainStageTriggered = async (
|
|||||||
const questKey = inventory.QuestKeys.find(qk => qk.ItemType === keyChainInfo.KeyChain);
|
const questKey = inventory.QuestKeys.find(qk => qk.ItemType === keyChainInfo.KeyChain);
|
||||||
|
|
||||||
if (chainStages && questKey) {
|
if (chainStages && questKey) {
|
||||||
if (chainStages[keyChainInfo.ChainStage].itemsToGiveWhenTriggered.length > 0) {
|
if (chainStages[keyChainInfo.ChainStage - 1].itemsToGiveWhenTriggered.length > 0) {
|
||||||
await giveKeyChainItem(inventory, keyChainInfo, questKey);
|
await giveKeyChainItem(inventory, keyChainInfo, questKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chainStages[keyChainInfo.ChainStage].messageToSendWhenTriggered) {
|
if (chainStages[keyChainInfo.ChainStage - 1].messageToSendWhenTriggered) {
|
||||||
await giveKeyChainMessage(inventory, keyChainInfo, questKey);
|
await giveKeyChainMessage(inventory, keyChainInfo, questKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user