From 469fe00902714b0b0dc3559e8a9709caa9a4bc21 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 12 Oct 2023 15:18:14 +0100 Subject: [PATCH] Update types --- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../13AddTrader/types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../7OnLoadHook/types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- .../types/controllers/InraidController.d.ts | 12 +- .../controllers/InsuranceController.d.ts | 20 +- .../RepeatableQuestController.d.ts | 198 +----------------- .../generators/RepeatableQuestGenerator.d.ts | 183 ++++++++++++++++ .../types/helpers/InRaidHelper.d.ts | 4 +- .../types/helpers/ItemHelper.d.ts | 1 + .../types/helpers/RepeatableQuestHelper.d.ts | 20 ++ .../eft/common/tables/IRepeatableQuests.d.ts | 4 + .../models/spt/config/IAirdropConfig.d.ts | 2 + .../models/spt/config/IInventoryConfig.d.ts | 1 + .../types/models/spt/config/IItemConfig.d.ts | 3 + .../types/models/spt/config/IQuestConfig.d.ts | 9 + .../models/spt/config/IScavCaseConfig.d.ts | 1 + .../models/spt/repeatable/IQuestTypePool.d.ts | 31 +++ .../models/spt/services/LootRequest.d.ts | 1 + .../types/services/ItemFilterService.d.ts | 12 +- 336 files changed, 6300 insertions(+), 4242 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/13AddTrader/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/13AddTrader/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/16ImporterUtil/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/18CustomItemService/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/18CustomItemService/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/19UseExternalLibraries/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/1LogToConsole/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/2EditDatabase/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/7OnLoadHook/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/repeatable/IQuestTypePool.d.ts create mode 100644 TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts create mode 100644 TypeScript/9RouterHooks/types/helpers/RepeatableQuestHelper.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/repeatable/IQuestTypePool.d.ts diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/13AddTrader/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/13AddTrader/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/13AddTrader/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/13AddTrader/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/13AddTrader/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts b/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/15HttpListenerExample/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/16ImporterUtil/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/16ImporterUtil/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/16ImporterUtil/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/16ImporterUtil/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/16ImporterUtil/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts b/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts b/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts b/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/18CustomItemService/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/18CustomItemService/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/18CustomItemService/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/18CustomItemService/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/18CustomItemService/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/18CustomItemService/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts b/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/19UseExternalLibraries/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/19UseExternalLibraries/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts b/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts b/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/1LogToConsole/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/1LogToConsole/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/1LogToConsole/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/1LogToConsole/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/1LogToConsole/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/2EditDatabase/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/2EditDatabase/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/2EditDatabase/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/2EditDatabase/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts b/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/5ReplaceMethod/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/7OnLoadHook/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/7OnLoadHook/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/7OnLoadHook/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/7OnLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/8OnUpdateHook/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; } diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 6e86c63..e4a8d64 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -62,10 +62,10 @@ export declare class InraidController { savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** * Handle updating player profile post-pmc raid - * @param sessionID session id - * @param offraidData post-raid data + * @param sessionID Session id + * @param postRaidRequest Post-raid data */ - protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Make changes to pmc profile after they've died in raid, * Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items @@ -91,10 +91,10 @@ export declare class InraidController { protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void; /** * Handle updating the profile post-pscav raid - * @param sessionID session id - * @param offraidData post-raid data of raid + * @param sessionID Session id + * @param postRaidRequest Post-raid data of raid */ - protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void; /** * Is the player dead after a raid - dead is anything other than "survived" / "runner" * @param statusOnExit exit value from offraidData object diff --git a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts index 061d0c9..fb41610 100644 --- a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts @@ -9,7 +9,7 @@ import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsura import { IGetInsuranceCostResponseData } from "../models/eft/insurance/IGetInsuranceCostResponseData"; import { IInsureRequestData } from "../models/eft/insurance/IInsureRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { Insurance } from "../models/eft/profile/IAkiProfile"; +import { Insurance, ISystemData } from "../models/eft/profile/IAkiProfile"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -66,6 +66,14 @@ export declare class InsuranceController { * @returns void */ protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void; + /** + * Remove an insurance package from a profile using the package's system data information. + * + * @param sessionID The session ID of the profile to remove the package from. + * @param index The array index of the insurance package to remove. + * @returns void + */ + protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void; /** * Build an array of items to delete from the insured items. * @@ -78,7 +86,7 @@ export declare class InsuranceController { * @param insured - The insured items to build a removal array from. * @returns An array of IDs representing items that should be deleted. */ - protected findItemsToDelete(insured: Insurance): string[]; + protected findItemsToDelete(insured: Insurance): Set; /** * Filters an item based on its existence in the database, raid moddability, and slot requirements. * @@ -108,7 +116,7 @@ export declare class InsuranceController { * @param toDelete The array accumulating the IDs of items to be deleted. * @returns true if the item is marked for deletion, otherwise false. */ - protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: string[]): boolean; + protected makeRollAndMarkForDeletion(item: Item, traderId: string, toDelete: Set): boolean; /** * Groups child items by their parent IDs in a Map data structure. * @@ -127,7 +135,7 @@ export declare class InsuranceController { * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: string[]): void; + protected sortAndFilterChildren(children: Item[], traderId: string, toDelete: Set): void; /** * Remove items from the insured items that should not be returned to the player. * @@ -135,7 +143,7 @@ export declare class InsuranceController { * @param toDelete The items that should be deleted. * @returns void */ - protected removeItemsFromInsurance(insured: Insurance, toDelete: string[]): void; + protected removeItemsFromInsurance(insured: Insurance, toDelete: Set): void; /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. * @@ -154,7 +162,7 @@ export declare class InsuranceController { * @param itemsBeingDeleted List of items that are already slated for removal. * @returns true if the insured item should be removed from inventory, false otherwise. */ - protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean; + protected rollForItemDelete(insuredItem: Item, traderId: string, itemsBeingDeleted: Set): boolean; /** * Handle Insure event * Add insurance to an item diff --git a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts index e9d2e56..024d85d 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts @@ -1,81 +1,41 @@ -import { HandbookHelper } from "../helpers/HandbookHelper"; -import { ItemHelper } from "../helpers/ItemHelper"; -import { PresetHelper } from "../helpers/PresetHelper"; +import { RepeatableQuestGenerator } from "../generators/RepeatableQuestGenerator"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; -import { Exit } from "../models/eft/common/ILocationBase"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { TraderInfo } from "../models/eft/common/tables/IBotBase"; -import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; -import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IPmcDataRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest"; -import { ELocationName } from "../models/enums/ELocationName"; -import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; -import { DatabaseServer } from "../servers/DatabaseServer"; -import { ItemFilterService } from "../services/ItemFilterService"; -import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; -import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { ProbabilityObject, ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -export interface IQuestTypePool { - types: string[]; - pool: IQuestPool; -} -export interface IQuestPool { - Exploration: IExplorationPool; - Elimination: IEliminationPool; -} -export interface IExplorationPool { - locations: Partial>; -} -export interface IEliminationPool { - targets: IEliminationTargetPool; -} -export interface IEliminationTargetPool { - Savage?: ITargetLocation; - AnyPmc?: ITargetLocation; - bossBully?: ITargetLocation; - bossGluhar?: ITargetLocation; - bossKilla?: ITargetLocation; - bossSanitar?: ITargetLocation; - bossTagilla?: ITargetLocation; - bossKojaniy?: ITargetLocation; -} -export interface ITargetLocation { - locations: string[]; -} export declare class RepeatableQuestController { protected timeUtil: TimeUtil; protected logger: ILogger; protected randomUtil: RandomUtil; protected httpResponse: HttpResponseUtil; - protected mathUtil: MathUtil; protected jsonUtil: JsonUtil; - protected databaseServer: DatabaseServer; - protected itemHelper: ItemHelper; - protected presetHelper: PresetHelper; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; - protected handbookHelper: HandbookHelper; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; - protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; - protected itemFilterService: ItemFilterService; + protected repeatableQuestGenerator: RepeatableQuestGenerator; + protected repeatableQuestHelper: RepeatableQuestHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); /** * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. @@ -109,103 +69,10 @@ export declare class RepeatableQuestController { * @returns IPmcDataRepeatableQuest */ protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest; - /** - * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). - * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest - */ - protected generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; /** * Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps */ generateDebugDailies(dailiesPool: any, factory: any, number: number): any; - /** - * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json - * The templates include Elimination, Completion and Extraction quest types - * - * @param {string} type quest type: "Elimination", "Completion" or "Extraction" - * @param {string} traderId trader from which the quest will be provided - * @param {string} side scav daily or pmc daily/weekly quest - * @returns {object} a object which contains the base elements for repeatable quests of the requests type - * (needs to be filled with reward and conditions by called to make a valid quest) - */ - protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; - /** - * Generates a valid Exploration quest - * - * @param {integer} pmcLevel player's level for reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) - */ - protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; - /** - * Generates a valid Completion quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) - */ - protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; - /** - * Generates a valid Elimination quest - * - * @param {integer} pmcLevel player's level for requested items and reward generation - * @param {string} traderId trader from which the quest will be provided - * @param {object} questTypePool Pools for quests (used to avoid redundant quests) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) - */ - protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; - /** - * Get the relevant elimination config based on the current players PMC level - * @param pmcLevel Level of PMC character - * @param repeatableConfig Main repeatable config - * @returns IEliminationConfig - */ - protected getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; - /** - * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) - * @param locationKey e.g factory4_day - * @returns guid - */ - protected getQuestLocationByMapId(locationKey: string): string; - /** - * Exploration repeatable quests can specify a required extraction point. - * This method creates the according object which will be appended to the conditions array - * - * @param {string} exit The exit name to generate the condition for - * @returns {object} Exit condition - */ - protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) - * - * @param {string} targetItemId id of the item to request - * @param {integer} value amount of items of this specific type to request - * @returns {object} object of "Completion"-condition - */ - protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a location condition. - * - * @param {string} location the location on which to fulfill the elimination quest - * @returns {object} object of "Elimination"-location-subcondition - */ - protected generateEliminationLocation(location: string[]): IEliminationCondition; - /** - * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) - * This is a helper method for GenerateEliminationQuest to create a kill condition. - * - * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" - * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] - * @param {number} distance distance from which to kill (currently only >= supported) - * @returns {object} object of "Elimination"-kill-subcondition - */ - protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition; /** * Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently * narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests @@ -215,53 +82,10 @@ export declare class RepeatableQuestController { * @returns IQuestTypePool */ protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool; - /** - * Generate the reward for a mission. A reward can consist of - * - Experience - * - Money - * - Items - * - Trader Reputation - * - * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to - * experience / money / items / trader reputation can be defined in QuestConfig.js - * - * There's also a random variation of the reward the spread of which can be also defined in the config. - * - * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used - * - * @param {integer} pmcLevel player's level - * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 - * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) - * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest - * @returns {object} object of "Reward"-type that can be given for a repeatable mission - */ - protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; - /** - * Helper to create a reward item structured as required by the client - * - * @param {string} tpl itemId of the rewarded item - * @param {integer} value amount of items to give - * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index - * @returns {object} object of "Reward"-item-type - */ - protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool; debugLogRepeatableQuestIds(pmcData: IPmcData): void; - protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; /** * Handle RepeatableQuestChange event */ - changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; - /** - * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) - * @param repeatableQuestConfig config file - * @returns a list of rewardable items [[_tpl, itemTemplate],...] - */ - protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; - /** - * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. - * @param {string} tpl template id of item to check - * @returns boolean: true if item is valid reward - */ - protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts new file mode 100644 index 0000000..7fa39ba --- /dev/null +++ b/TypeScript/9RouterHooks/types/generators/RepeatableQuestGenerator.d.ts @@ -0,0 +1,183 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { PresetHelper } from "../helpers/PresetHelper"; +import { ProfileHelper } from "../helpers/ProfileHelper"; +import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; +import { RepeatableQuestHelper } from "../helpers/RepeatableQuestHelper"; +import { Exit } from "../models/eft/common/ILocationBase"; +import { TraderInfo } from "../models/eft/common/tables/IBotBase"; +import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests"; +import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { IQuestTypePool } from "../models/spt/repeatable/IQuestTypePool"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; +import { PaymentService } from "../services/PaymentService"; +import { ProfileFixerService } from "../services/ProfileFixerService"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ObjectId } from "../utils/ObjectId"; +import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; +export declare class RepeatableQuestGenerator { + protected timeUtil: TimeUtil; + protected logger: ILogger; + protected randomUtil: RandomUtil; + protected httpResponse: HttpResponseUtil; + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected itemHelper: ItemHelper; + protected presetHelper: PresetHelper; + protected profileHelper: ProfileHelper; + protected profileFixerService: ProfileFixerService; + protected handbookHelper: HandbookHelper; + protected ragfairServerHelper: RagfairServerHelper; + protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; + protected paymentService: PaymentService; + protected objectId: ObjectId; + protected itemFilterService: ItemFilterService; + protected repeatableQuestHelper: RepeatableQuestHelper; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer); + /** + * This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). + * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest + * @param pmcLevel Player's level for requested items and reward generation + * @param pmcTraderInfo Players traper standing/rep levels + * @param questTypePool Possible quest types pool + * @param repeatableConfig Repeatable quest config + * @returns IRepeatableQuest + */ + generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest; + /** + * Generate a randomised Elimination quest + * @param pmcLevel Player's level for requested items and reward generation + * @param traderId Trader from which the quest will be provided + * @param questTypePool Pools for quests (used to avoid redundant quests) + * @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) + */ + protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a location condition. + * + * @param {string} location the location on which to fulfill the elimination quest + * @returns {object} object of "Elimination"-location-subcondition + */ + protected generateEliminationLocation(location: string[], allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateEliminationQuest to create a kill condition. + * + * @param {string} target array of target npcs e.g. "AnyPmc", "Savage" + * @param {array} bodyParts array of body parts with which to kill e.g. ["stomach", "thorax"] + * @param {number} distance distance from which to kill (currently only >= supported) + * @returns {object} object of "Elimination"-kill-subcondition + */ + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition; + /** + * Generates a valid Completion quest + * + * @param {integer} pmcLevel player's level for requested items and reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) + */ + protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion; + /** + * A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json) + * This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many) + * + * @param {string} targetItemId id of the item to request + * @param {integer} value amount of items of this specific type to request + * @returns {object} object of "Completion"-condition + */ + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor; + /** + * Generates a valid Exploration quest + * + * @param {integer} pmcLevel player's level for reward generation + * @param {string} traderId trader from which the quest will be provided + * @param {object} questTypePool Pools for quests (used to avoid redundant quests) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) + */ + protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration; + /** + * Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567) + * @param locationKey e.g factory4_day + * @returns guid + */ + protected getQuestLocationByMapId(locationKey: string): string; + /** + * Exploration repeatable quests can specify a required extraction point. + * This method creates the according object which will be appended to the conditions array + * + * @param {string} exit The exit name to generate the condition for + * @returns {object} Exit condition + */ + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition; + /** + * Generate the reward for a mission. A reward can consist of + * - Experience + * - Money + * - Items + * - Trader Reputation + * + * The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to + * experience / money / items / trader reputation can be defined in QuestConfig.js + * + * There's also a random variation of the reward the spread of which can be also defined in the config. + * + * Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + * + * @param {integer} pmcLevel player's level + * @param {number} difficulty a reward scaling factor goint from 0.2 to 1 + * @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader) + * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest + * @returns {object} object of "Reward"-type that can be given for a repeatable mission + */ + protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRewards; + /** + * Helper to create a reward item structured as required by the client + * + * @param {string} tpl itemId of the rewarded item + * @param {integer} value amount of items to give + * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index + * @returns {object} object of "Reward"-item-type + */ + protected generateRewardItem(tpl: string, value: number, index: number, preset?: any): IReward; + /** + * Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable) + * @param repeatableQuestConfig config file + * @returns a list of rewardable items [[_tpl, itemTemplate],...] + */ + protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig): [string, ITemplateItem][]; + /** + * Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + * or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + * @param {string} tpl template id of item to check + * @returns boolean: true if item is valid reward + */ + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean; + /** + * Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json + * The templates include Elimination, Completion and Extraction quest types + * + * @param {string} type quest type: "Elimination", "Completion" or "Extraction" + * @param {string} traderId trader from which the quest will be provided + * @param {string} side scav daily or pmc daily/weekly quest + * @returns {object} a object which contains the base elements for repeatable quests of the requests type + * (needs to be filled with reward and conditions by called to make a valid quest) + */ + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest; +} diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index b4c0c1c..3550489 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -111,11 +111,11 @@ export declare class InRaidHelper { * Add new items found in raid to profile * Store insurance items in profile * @param sessionID Session id - * @param pmcData Profile to update + * @param serverProfile Profile to update * @param postRaidProfile Profile returned by client after a raid * @returns Updated profile */ - setInventory(sessionID: string, pmcData: IPmcData, postRaidProfile: IPmcData): IPmcData; + setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData; /** * Clear pmc inventory of all items except those that are exempt * Used post-raid to remove items after death diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index f58ca4d..6f1511c 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -303,6 +303,7 @@ declare class ItemHelper { * @returns Name of item */ getItemName(itemTpl: string): string; + getItemTplsOfBaseType(desiredBaseType: string): string[]; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/9RouterHooks/types/helpers/RepeatableQuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RepeatableQuestHelper.d.ts new file mode 100644 index 0000000..08ae8aa --- /dev/null +++ b/TypeScript/9RouterHooks/types/helpers/RepeatableQuestHelper.d.ts @@ -0,0 +1,20 @@ +import { IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "../models/spt/config/IQuestConfig"; +import { ConfigServer } from "../servers/ConfigServer"; +import { JsonUtil } from "../utils/JsonUtil"; +import { MathUtil } from "../utils/MathUtil"; +import { ProbabilityObject, ProbabilityObjectArray } from "../utils/RandomUtil"; +export declare class RepeatableQuestHelper { + protected mathUtil: MathUtil; + protected jsonUtil: JsonUtil; + protected configServer: ConfigServer; + protected questConfig: IQuestConfig; + constructor(mathUtil: MathUtil, jsonUtil: JsonUtil, configServer: ConfigServer); + /** + * Get the relevant elimination config based on the current players PMC level + * @param pmcLevel Level of PMC character + * @param repeatableConfig Main repeatable config + * @returns IEliminationConfig + */ + getEliminationConfigByPmcLevel(pmcLevel: number, repeatableConfig: IRepeatableQuestConfig): IEliminationConfig; + probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts index 3a33f2e..a65f025 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IRepeatableQuests.d.ts @@ -161,6 +161,8 @@ export interface ICompletionAvailableForProps extends IAvailableForProps { } export interface ILocationConditionProps extends IConditionProps { target: string[]; + weapon?: string[]; + weaponCategories?: string[]; } export interface IKillConditionProps extends IConditionProps { target: string; @@ -168,6 +170,8 @@ export interface IKillConditionProps extends IConditionProps { savageRole?: string[]; bodyPart?: string[]; distance?: IDistanceCheck; + weapon?: string[]; + weaponCategories?: string[]; } export interface IDistanceCheck { compareMethod: string; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts index 21bb32e..8c23ed8 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts @@ -52,4 +52,6 @@ export interface AirdropLoot { itemStackLimits: Record; /** Armor levels to allow inside crate e.g. [4,5,6] */ armorLevelWhitelist?: number[]; + /** Should boss items be added to airdrop crate */ + allowBossItems: boolean; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts index 6657a1a..e026923 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts @@ -23,4 +23,5 @@ export interface ISealedAirdropContainerSettings { weaponModRewardLimits: Record; rewardTypeLimits: Record; ammoBoxWhitelist: string[]; + allowBossItems: boolean; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts index 5ecccc2..e08108d 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IItemConfig.d.ts @@ -1,5 +1,8 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IItemConfig extends IBaseConfig { kind: "aki-item"; + /** Items that should be globally blacklisted */ blacklist: string[]; + /** Items that can only be found on bosses */ + bossItems: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts index 8ce461b..0e793ad 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IQuestConfig.d.ts @@ -92,6 +92,12 @@ export interface IEliminationConfig { minDist: number; maxKills: number; minKills: number; + minBossKills: number; + maxBossKills: number; + weaponCategoryRequirementProb: number; + weaponCategoryRequirements: IWeaponRequirement[]; + weaponRequirementProb: number; + weaponRequirements: IWeaponRequirement[]; } export interface ITarget extends IProbabilityObject { data: IBossInfo; @@ -102,6 +108,9 @@ export interface IBossInfo { export interface IBodyPart extends IProbabilityObject { data: string[]; } +export interface IWeaponRequirement extends IProbabilityObject { + data: string[]; +} export interface IProbabilityObject { key: string; relativeProbability: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IScavCaseConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IScavCaseConfig.d.ts index 86a8df3..84403d6 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IScavCaseConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IScavCaseConfig.d.ts @@ -9,6 +9,7 @@ export interface IScavCaseConfig extends IBaseConfig { rewardItemBlacklist: string[]; allowMultipleMoneyRewardsPerRarity: boolean; allowMultipleAmmoRewardsPerRarity: boolean; + allowBossItemsAsRewards: boolean; } export interface MoneyRewards { moneyRewardChancePercent: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/repeatable/IQuestTypePool.d.ts b/TypeScript/9RouterHooks/types/models/spt/repeatable/IQuestTypePool.d.ts new file mode 100644 index 0000000..24cf08b --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/repeatable/IQuestTypePool.d.ts @@ -0,0 +1,31 @@ +import { ELocationName } from "../../../models/enums/ELocationName"; +export interface IQuestTypePool { + types: string[]; + pool: IQuestPool; +} +export interface IQuestPool { + Exploration: IExplorationPool; + Elimination: IEliminationPool; +} +export interface IExplorationPool { + locations: Partial>; +} +export interface IEliminationPool { + targets: IEliminationTargetPool; +} +export interface IEliminationTargetPool { + Savage?: ITargetLocation; + AnyPmc?: ITargetLocation; + bossBully?: ITargetLocation; + bossGluhar?: ITargetLocation; + bossKilla?: ITargetLocation; + bossSanitar?: ITargetLocation; + bossTagilla?: ITargetLocation; + bossKnight?: ITargetLocation; + bossZryachiy?: ITargetLocation; + bossBoar?: ITargetLocation; + bossBoarSniper?: ITargetLocation; +} +export interface ITargetLocation { + locations: string[]; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts index 044935d..4dc3111 100644 --- a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts @@ -9,4 +9,5 @@ export interface LootRequest { itemLimits: Record; itemStackLimits: Record; armorLevelWhitelist: number[]; + allowBossItems: boolean; } diff --git a/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts b/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts index b830d74..62f4f61 100644 --- a/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ItemFilterService.d.ts @@ -7,7 +7,6 @@ export declare class ItemFilterService { protected logger: ILogger; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; - protected blacklist: string[]; protected itemConfig: IItemConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** @@ -21,4 +20,15 @@ export declare class ItemFilterService { * @returns string array of blacklisted tempalte ids */ getBlacklistedItems(): string[]; + /** + * Check if the provided template id is boss item in config/item.json + * @param tpl template id + * @returns true if boss item + */ + isBossItem(tpl: string): boolean; + /** + * Return boss items in config/item.json + * @returns string array of boss item tempalte ids + */ + getBossItems(): string[]; }