XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

feat: send hex quest email when The Lotus Eaters and The Duviri Paradox are complete (#1761)

Close #1759 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1761 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

72b28f1d
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +42 -6
Modified src/services/questService.ts +42 -6
@@ -191,6 +191,25 @@ const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined =>
191 191 return items;
192 192 };
193 193
194 // Checks that `questKey` is in `requirements`, and if so, that all other quests in `requirements` are also already completed.
195 const doesQuestCompletionFinishSet = (
196 inventory: TInventoryDatabaseDocument,
197 questKey: string,
198 requirements: string[]
199 ): boolean => {
200 let holds = false;
201 for (const requirement of requirements) {
202 if (questKey == requirement) {
203 holds = true;
204 } else {
205 if (!inventory.QuestKeys.find(x => x.ItemType == requirement)?.Completed) {
206 return false;
207 }
208 }
209 }
210 return holds;
211 };
212
194 213 const handleQuestCompletion = async (
195 214 inventory: TInventoryDatabaseDocument,
196 215 questKey: string,
@@ -218,12 +237,10 @@ const handleQuestCompletion = async (
218 237
219 238 // Whispers in the Walls is unlocked once The New + Heart of Deimos are completed.
220 239 if (
221 (questKey == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain" &&
222 inventory.QuestKeys.find(
223 x => x.ItemType == "/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain"
224 )?.Completed) ||
225 (questKey == "/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain" &&
226 inventory.QuestKeys.find(x => x.ItemType == "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain")?.Completed)
240 doesQuestCompletionFinishSet(inventory, questKey, [
241 "/Lotus/Types/Keys/NewWarQuest/NewWarQuestKeyChain",
242 "/Lotus/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain"
243 ])
227 244 ) {
228 245 await createMessage(inventory.accountOwnerId, [
229 246 {
@@ -237,6 +254,25 @@ const handleQuestCompletion = async (
237 254 ]);
238 255 }
239 256
257 // The Hex (Quest) is unlocked once The Lotus Eaters + The Duviri Paradox are completed.
258 if (
259 doesQuestCompletionFinishSet(inventory, questKey, [
260 "/Lotus/Types/Keys/1999PrologueQuest/1999PrologueQuestKeyChain",
261 "/Lotus/Types/Keys/DuviriQuest/DuviriQuestKeyChain"
262 ])
263 ) {
264 await createMessage(inventory.accountOwnerId, [
265 {
266 sndr: "/Lotus/Language/NewWar/P3M1ChooseMara",
267 msg: "/Lotus/Language/1999Quest/1999QuestInboxBody",
268 att: ["/Lotus/Types/Keys/1999Quest/1999QuestKeyChain"],
269 sub: "/Lotus/Language/1999Quest/1999QuestInboxSubject",
270 icon: "/Lotus/Interface/Icons/Npcs/Operator.png",
271 highPriority: true
272 }
273 ]);
274 }
275
240 276 const questCompletionItems = getQuestCompletionItems(questKey);
241 277 logger.debug(`quest completion items`, questCompletionItems);
242 278 if (questCompletionItems) {