From cdba0e1eccd5f7dff182783b66b641e0b6516dde Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 15 Aug 2022 22:07:06 +0100 Subject: [PATCH] 3.2.1 update --- TypeScript/10ScopesAndTypes/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/11BundleLoadingSample/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ .../12ClassExtensionOverride/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/13AddTrader/package.json | 2 +- TypeScript/13AddTrader/src/mod.ts | 1 + .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../13AddTrader/types/utils/TimeUtil.d.ts | 4 +++ TypeScript/14AfterDBLoadHook/package.json | 2 +- TypeScript/14AfterDBLoadHook/src/mod.ts | 8 ++--- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/1LogToConsole/package.json | 2 +- TypeScript/1LogToConsole/src/mod.ts | 5 +-- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../1LogToConsole/types/utils/TimeUtil.d.ts | 4 +++ TypeScript/2EditDatabase/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../2EditDatabase/types/utils/TimeUtil.d.ts | 4 +++ TypeScript/3GetSptConfigFile/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/4UseACustomConfigFile/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/5ReplaceMethod/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../5ReplaceMethod/types/utils/TimeUtil.d.ts | 4 +++ .../6ReferenceAnotherClass/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../types/utils/TimeUtil.d.ts | 4 +++ TypeScript/7OnLoadHook/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../7OnLoadHook/types/utils/TimeUtil.d.ts | 4 +++ TypeScript/8OnUpdateHook/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../8OnUpdateHook/types/utils/TimeUtil.d.ts | 4 +++ TypeScript/9RouterHooks/package.json | 2 +- .../types/callbacks/InsuranceCallbacks.d.ts | 5 ++- .../types/callbacks/TraderCallbacks.d.ts | 2 +- .../types/controllers/GameController.d.ts | 1 + .../types/controllers/HideoutController.d.ts | 4 ++- .../types/controllers/InraidController.d.ts | 11 +++--- .../types/controllers/MatchController.d.ts | 6 +++- .../types/controllers/TraderController.d.ts | 21 ++++++++++-- .../generators/RagfairOfferGenerator.d.ts | 34 +++++++++++++++++-- .../types/helpers/InRaidHelper.d.ts | 4 ++- .../types/helpers/InventoryHelper.d.ts | 1 + .../types/helpers/ProfileHelper.d.ts | 6 +++- .../types/helpers/QuestHelper.d.ts | 10 +++++- .../types/helpers/TraderAssortHelper.d.ts | 31 ++++++++++++++--- .../types/helpers/TraderHelper.d.ts | 15 +++++++- .../types/loaders/PreAkiModLoader.d.ts | 11 ++++++ .../models/eft/common/ILocationBase.d.ts | 8 +++-- .../models/eft/common/tables/IBotBase.d.ts | 24 ++++++------- .../models/eft/common/tables/ITrader.d.ts | 4 +-- .../types/models/eft/health/Effect.d.ts | 6 ++-- .../eft/health/IOffraidHealRequestData.d.ts | 16 ++++----- .../types/models/eft/notifier/INotifier.d.ts | 10 +++--- .../types/models/enums/BotAmount.d.ts | 10 +++--- .../types/models/enums/BotDifficulty.d.ts | 12 +++---- .../types/models/enums/MemberCategory.d.ts | 22 ++++++------ .../types/models/enums/QuestRewardType.d.ts | 12 +++---- .../types/models/enums/RaidMode.d.ts | 6 ++-- .../types/models/spt/bots/BotLootCache.d.ts | 18 +++++----- .../models/spt/config/IHideoutConfig.d.ts | 6 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 ++++ .../spt/logging/LogBackgroundColor.d.ts | 18 +++++----- .../models/spt/logging/LogTextColor.d.ts | 18 +++++----- .../types/models/spt/server/ILocaleBase.d.ts | 20 +++-------- .../types/servers/RagfairServer.d.ts | 11 +++++- .../types/services/FenceService.d.ts | 19 +++++++++-- .../services/ProfileSnapshotService.d.ts | 30 ++++++++++++++++ .../types/services/RagfairOfferService.d.ts | 12 +++---- .../types/services/RagfairPriceService.d.ts | 14 ++++++++ .../types/services/TraderAssortService.d.ts | 5 +++ .../9RouterHooks/types/utils/TimeUtil.d.ts | 4 +++ readme.md | 2 +- 564 files changed, 4699 insertions(+), 1967 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/13AddTrader/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/ProfileSnapshotService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/ProfileSnapshotService.d.ts diff --git a/TypeScript/10ScopesAndTypes/package.json b/TypeScript/10ScopesAndTypes/package.json index 7b24547..d7fb3f6 100644 --- a/TypeScript/10ScopesAndTypes/package.json +++ b/TypeScript/10ScopesAndTypes/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/health/Effect.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/health/Effect.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BotAmount.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BotAmount.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BotDifficulty.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/MemberCategory.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/QuestRewardType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/RaidMode.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/RaidMode.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/10ScopesAndTypes/types/services/ProfileSnapshotService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/10ScopesAndTypes/types/services/TraderAssortService.d.ts b/TypeScript/10ScopesAndTypes/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/10ScopesAndTypes/types/services/TraderAssortService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/11BundleLoadingSample/package.json b/TypeScript/11BundleLoadingSample/package.json index e74e62a..bdad540 100644 --- a/TypeScript/11BundleLoadingSample/package.json +++ b/TypeScript/11BundleLoadingSample/package.json @@ -4,7 +4,7 @@ "author": "Chomp", "license": "MIT", "main": "src/mod.js", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "isBundleMod": true, "scripts": { "setup:environment": "npm i", diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/health/Effect.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/health/Effect.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BotAmount.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BotAmount.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BotDifficulty.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/MemberCategory.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/QuestRewardType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/RaidMode.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/RaidMode.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/11BundleLoadingSample/types/services/ProfileSnapshotService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/11BundleLoadingSample/types/services/TraderAssortService.d.ts b/TypeScript/11BundleLoadingSample/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/11BundleLoadingSample/types/services/TraderAssortService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/12ClassExtensionOverride/package.json b/TypeScript/12ClassExtensionOverride/package.json index cea1a71..b72c696 100644 --- a/TypeScript/12ClassExtensionOverride/package.json +++ b/TypeScript/12ClassExtensionOverride/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/health/Effect.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/health/Effect.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BotAmount.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BotAmount.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BotDifficulty.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/MemberCategory.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/QuestRewardType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/RaidMode.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/RaidMode.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/12ClassExtensionOverride/types/services/ProfileSnapshotService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/12ClassExtensionOverride/types/services/TraderAssortService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/TraderAssortService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/13AddTrader/package.json b/TypeScript/13AddTrader/package.json index ae6c352..70cb9df 100644 --- a/TypeScript/13AddTrader/package.json +++ b/TypeScript/13AddTrader/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Shirito", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/TypeScript/13AddTrader/src/mod.ts b/TypeScript/13AddTrader/src/mod.ts index 93bb825..a136ff6 100644 --- a/TypeScript/13AddTrader/src/mod.ts +++ b/TypeScript/13AddTrader/src/mod.ts @@ -88,6 +88,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod { private createAssortTable(): ITraderAssort { // Assort table const assortTable: ITraderAssort = { + nextResupply: 0, items: [], barter_scheme: {}, loyal_level_items: {} diff --git a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/13AddTrader/types/controllers/TraderController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/13AddTrader/types/models/eft/health/Effect.d.ts b/TypeScript/13AddTrader/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/13AddTrader/types/models/eft/health/Effect.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/13AddTrader/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/13AddTrader/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts b/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/13AddTrader/types/models/enums/BotAmount.d.ts b/TypeScript/13AddTrader/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/13AddTrader/types/models/enums/BotAmount.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/13AddTrader/types/models/enums/BotDifficulty.d.ts b/TypeScript/13AddTrader/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/13AddTrader/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/13AddTrader/types/models/enums/MemberCategory.d.ts b/TypeScript/13AddTrader/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/13AddTrader/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/13AddTrader/types/models/enums/QuestRewardType.d.ts b/TypeScript/13AddTrader/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/13AddTrader/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/13AddTrader/types/models/enums/RaidMode.d.ts b/TypeScript/13AddTrader/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/13AddTrader/types/models/enums/RaidMode.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts b/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/13AddTrader/types/services/ProfileSnapshotService.d.ts b/TypeScript/13AddTrader/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/13AddTrader/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/13AddTrader/types/services/TraderAssortService.d.ts b/TypeScript/13AddTrader/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/13AddTrader/types/services/TraderAssortService.d.ts +++ b/TypeScript/13AddTrader/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts b/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/14AfterDBLoadHook/package.json b/TypeScript/14AfterDBLoadHook/package.json index 6781cc0..838008f 100644 --- a/TypeScript/14AfterDBLoadHook/package.json +++ b/TypeScript/14AfterDBLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/14AfterDBLoadHook/src/mod.ts b/TypeScript/14AfterDBLoadHook/src/mod.ts index b0fe320..3427014 100644 --- a/TypeScript/14AfterDBLoadHook/src/mod.ts +++ b/TypeScript/14AfterDBLoadHook/src/mod.ts @@ -15,7 +15,7 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod, IPostDBLoadMod // Database will be empty in here const databaseServer = container.resolve("DatabaseServer"); const logger = container.resolve("WinstonLogger"); - logger.logWithColor(`Database item table state: ${databaseServer.getTables().templates} (<<< should be undefined)`, LogTextColor.red, LogBackgroundColor.yellow); + logger.logWithColor(`Database item table state: ${databaseServer.getTables().templates} (<<< should be undefined)`, LogTextColor.RED, LogBackgroundColor.YELLOW); } public postDBLoad(container: DependencyContainer): void { @@ -23,13 +23,13 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod, IPostDBLoadMod // logic has modified anything yet. This is the DB loaded straight from the JSON files const databaseServer = container.resolve("DatabaseServer"); const logger = container.resolve("WinstonLogger"); - logger.logWithColor(`Database item size: ${Object.entries(databaseServer.getTables().templates.items).length}`, LogTextColor.red, LogBackgroundColor.yellow); + logger.logWithColor(`Database item size: ${Object.entries(databaseServer.getTables().templates.items).length}`, LogTextColor.RED, LogBackgroundColor.YELLOW); // lets do a quick modification and see how this reflect later on, on the postAkiLoad() // find the nvgs item by its Id const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"]; // Lets log the state before the modification: - logger.logWithColor(`NVGs default CanSellOnRagfair: ${nvgs._props.CanSellOnRagfair}`, LogTextColor.red, LogBackgroundColor.yellow); + logger.logWithColor(`NVGs default CanSellOnRagfair: ${nvgs._props.CanSellOnRagfair}`, LogTextColor.RED, LogBackgroundColor.YELLOW); // update one of its properties to be true nvgs._props.CanSellOnRagfair = true; } @@ -43,7 +43,7 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod, IPostDBLoadMod // find the nvgs item again by its Id const nvgs = databaseServer.getTables().templates.items["5c0558060db834001b735271"]; // Lets log the state, this value should be true: - logger.logWithColor(`NVGs modified CanSellOnRagfair: ${nvgs._props.CanSellOnRagfair}`, LogTextColor.red, LogBackgroundColor.yellow); + logger.logWithColor(`NVGs modified CanSellOnRagfair: ${nvgs._props.CanSellOnRagfair}`, LogTextColor.RED, LogBackgroundColor.YELLOW); } } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/health/Effect.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/health/Effect.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BotAmount.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BotAmount.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BotDifficulty.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/MemberCategory.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/QuestRewardType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/RaidMode.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/RaidMode.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/14AfterDBLoadHook/types/services/ProfileSnapshotService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/14AfterDBLoadHook/types/services/TraderAssortService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/TraderAssortService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/1LogToConsole/package.json b/TypeScript/1LogToConsole/package.json index 523624c..03a2214 100644 --- a/TypeScript/1LogToConsole/package.json +++ b/TypeScript/1LogToConsole/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/1LogToConsole/src/mod.ts b/TypeScript/1LogToConsole/src/mod.ts index 25cbaa2..43ffdd0 100644 --- a/TypeScript/1LogToConsole/src/mod.ts +++ b/TypeScript/1LogToConsole/src/mod.ts @@ -7,14 +7,15 @@ import { LogBackgroundColor } from "@spt-aki/models/spt/logging/LogBackgroundCol class Mod implements IPreAkiLoadMod { // Code added here will load BEFORE the server has started loading - preAkiLoad(container: DependencyContainer): void { + preAkiLoad(container: DependencyContainer): void + { // get the logger from the server container const logger = container.resolve("WinstonLogger"); logger.info("I am logging info!"); logger.warning("I am logging a warning!"); logger.error("I am logging an error!"); - logger.logWithColor("I am logging with color!", LogTextColor.yellow, LogBackgroundColor.red); + logger.logWithColor("I am logging with color!", LogTextColor.YELLOW, LogBackgroundColor.RED); } } diff --git a/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/1LogToConsole/types/models/eft/health/Effect.d.ts b/TypeScript/1LogToConsole/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/1LogToConsole/types/models/eft/health/Effect.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/1LogToConsole/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/1LogToConsole/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts b/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/1LogToConsole/types/models/enums/BotAmount.d.ts b/TypeScript/1LogToConsole/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BotAmount.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/1LogToConsole/types/models/enums/BotDifficulty.d.ts b/TypeScript/1LogToConsole/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/1LogToConsole/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/1LogToConsole/types/models/enums/MemberCategory.d.ts b/TypeScript/1LogToConsole/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/1LogToConsole/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/1LogToConsole/types/models/enums/QuestRewardType.d.ts b/TypeScript/1LogToConsole/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/1LogToConsole/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/1LogToConsole/types/models/enums/RaidMode.d.ts b/TypeScript/1LogToConsole/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/1LogToConsole/types/models/enums/RaidMode.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts b/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts +++ b/TypeScript/1LogToConsole/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/1LogToConsole/types/services/ProfileSnapshotService.d.ts b/TypeScript/1LogToConsole/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/1LogToConsole/types/services/TraderAssortService.d.ts b/TypeScript/1LogToConsole/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/1LogToConsole/types/services/TraderAssortService.d.ts +++ b/TypeScript/1LogToConsole/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts +++ b/TypeScript/1LogToConsole/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/2EditDatabase/package.json b/TypeScript/2EditDatabase/package.json index acb5b04..0e62610 100644 --- a/TypeScript/2EditDatabase/package.json +++ b/TypeScript/2EditDatabase/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/2EditDatabase/types/models/eft/health/Effect.d.ts b/TypeScript/2EditDatabase/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/2EditDatabase/types/models/eft/health/Effect.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/2EditDatabase/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/2EditDatabase/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts b/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/2EditDatabase/types/models/enums/BotAmount.d.ts b/TypeScript/2EditDatabase/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BotAmount.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/2EditDatabase/types/models/enums/BotDifficulty.d.ts b/TypeScript/2EditDatabase/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/2EditDatabase/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/2EditDatabase/types/models/enums/MemberCategory.d.ts b/TypeScript/2EditDatabase/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/2EditDatabase/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/2EditDatabase/types/models/enums/QuestRewardType.d.ts b/TypeScript/2EditDatabase/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/2EditDatabase/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/2EditDatabase/types/models/enums/RaidMode.d.ts b/TypeScript/2EditDatabase/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/2EditDatabase/types/models/enums/RaidMode.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts b/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/2EditDatabase/types/services/ProfileSnapshotService.d.ts b/TypeScript/2EditDatabase/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/2EditDatabase/types/services/TraderAssortService.d.ts b/TypeScript/2EditDatabase/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/2EditDatabase/types/services/TraderAssortService.d.ts +++ b/TypeScript/2EditDatabase/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts b/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/3GetSptConfigFile/package.json b/TypeScript/3GetSptConfigFile/package.json index 6b1af59..47712ce 100644 --- a/TypeScript/3GetSptConfigFile/package.json +++ b/TypeScript/3GetSptConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/health/Effect.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/health/Effect.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BotAmount.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BotAmount.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BotDifficulty.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/MemberCategory.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/QuestRewardType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/RaidMode.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/RaidMode.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/3GetSptConfigFile/types/services/ProfileSnapshotService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/3GetSptConfigFile/types/services/TraderAssortService.d.ts b/TypeScript/3GetSptConfigFile/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/3GetSptConfigFile/types/services/TraderAssortService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/4UseACustomConfigFile/package.json b/TypeScript/4UseACustomConfigFile/package.json index 5fe51be..8aa8f2b 100644 --- a/TypeScript/4UseACustomConfigFile/package.json +++ b/TypeScript/4UseACustomConfigFile/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/health/Effect.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/health/Effect.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BotAmount.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BotAmount.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BotDifficulty.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/MemberCategory.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/QuestRewardType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/RaidMode.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/RaidMode.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/4UseACustomConfigFile/types/services/ProfileSnapshotService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/4UseACustomConfigFile/types/services/TraderAssortService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/TraderAssortService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/5ReplaceMethod/package.json b/TypeScript/5ReplaceMethod/package.json index d2e5737..045fde4 100644 --- a/TypeScript/5ReplaceMethod/package.json +++ b/TypeScript/5ReplaceMethod/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/health/Effect.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/health/Effect.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BotAmount.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BotAmount.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BotDifficulty.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/MemberCategory.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/QuestRewardType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/RaidMode.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/RaidMode.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/5ReplaceMethod/types/services/ProfileSnapshotService.d.ts b/TypeScript/5ReplaceMethod/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/5ReplaceMethod/types/services/TraderAssortService.d.ts b/TypeScript/5ReplaceMethod/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/5ReplaceMethod/types/services/TraderAssortService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/6ReferenceAnotherClass/package.json b/TypeScript/6ReferenceAnotherClass/package.json index c9b48aa..d8ca54d 100644 --- a/TypeScript/6ReferenceAnotherClass/package.json +++ b/TypeScript/6ReferenceAnotherClass/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"\"./**/*.*\"\" ./dist", diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/Effect.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/Effect.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BotAmount.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BotAmount.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BotDifficulty.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/MemberCategory.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/QuestRewardType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/RaidMode.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/RaidMode.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ProfileSnapshotService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/TraderAssortService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/TraderAssortService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/7OnLoadHook/package.json b/TypeScript/7OnLoadHook/package.json index 22c7084..5ff1578 100644 --- a/TypeScript/7OnLoadHook/package.json +++ b/TypeScript/7OnLoadHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/7OnLoadHook/types/models/eft/health/Effect.d.ts b/TypeScript/7OnLoadHook/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/health/Effect.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/7OnLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/7OnLoadHook/types/models/enums/BotAmount.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BotAmount.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/BotDifficulty.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/MemberCategory.d.ts b/TypeScript/7OnLoadHook/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/7OnLoadHook/types/models/enums/QuestRewardType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/7OnLoadHook/types/models/enums/RaidMode.d.ts b/TypeScript/7OnLoadHook/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/RaidMode.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts b/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/7OnLoadHook/types/services/ProfileSnapshotService.d.ts b/TypeScript/7OnLoadHook/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/7OnLoadHook/types/services/TraderAssortService.d.ts b/TypeScript/7OnLoadHook/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/7OnLoadHook/types/services/TraderAssortService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/8OnUpdateHook/package.json b/TypeScript/8OnUpdateHook/package.json index a4fbd7f..2f62626 100644 --- a/TypeScript/8OnUpdateHook/package.json +++ b/TypeScript/8OnUpdateHook/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/health/Effect.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/health/Effect.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BotAmount.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BotAmount.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BotDifficulty.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/MemberCategory.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/QuestRewardType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/RaidMode.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/RaidMode.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/8OnUpdateHook/types/services/ProfileSnapshotService.d.ts b/TypeScript/8OnUpdateHook/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/8OnUpdateHook/types/services/TraderAssortService.d.ts b/TypeScript/8OnUpdateHook/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/8OnUpdateHook/types/services/TraderAssortService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/TypeScript/9RouterHooks/package.json b/TypeScript/9RouterHooks/package.json index 5279ac9..2b43e2d 100644 --- a/TypeScript/9RouterHooks/package.json +++ b/TypeScript/9RouterHooks/package.json @@ -4,7 +4,7 @@ "main": "src/mod.js", "license": "MIT", "author": "Chomp", - "akiVersion": "3.1.1", + "akiVersion": "3.2.1", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", diff --git a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts index 6819960..8835ba2 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts @@ -1,5 +1,5 @@ import { InsuranceController } from "../controllers/InsuranceController"; -import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; +import { OnUpdate } from "../di/OnUpdate"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; @@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { InsuranceService } from "../services/InsuranceService"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -export declare class InsuranceCallbacks extends OnLoadOnUpdate { +export declare class InsuranceCallbacks extends OnUpdate { protected insuranceController: InsuranceController; protected insuranceService: InsuranceService; protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); - onLoad(): void; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; diff --git a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts index 128d9b2..e4fd099 100644 --- a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts @@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { protected traderController: TraderController; constructor(httpResponse: HttpResponseUtil, traderController: TraderController); onLoad(): void; + onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - onUpdate(): boolean; } diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index 85ec418..d374453 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -25,4 +25,5 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): any[]; + getValidGameVersion(): any; } diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index 3eefe1a..dcd8894 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,9 +46,10 @@ export declare class HideoutController { protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected configServer: ConfigServer; + protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index b899e7d..82bb64d 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; @@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class InraidController { + protected logger: ILogger; protected saveServer: SaveServer; protected jsonUtil: JsonUtil; protected timeUtil: TimeUtil; @@ -29,7 +32,7 @@ export declare class InraidController { protected inRaidHelper: InRaidHelper; protected configServer: ConfigServer; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; /** @@ -38,7 +41,7 @@ export declare class InraidController { * @param pmcData player profile * @param isPlayerScav Was the player a pScav */ - private markOrRemoveFoundInRaidItems; - private handlePostRaidPlayerScavProcess; - private handlePostRaidPlayerScavKarmaChanges; + protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index 71cb7d3..e8585d9 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { + protected logger: ILogger; protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected matchLocationService: MatchLocationService; protected traderHelper: TraderHelper; protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; + protected profileSnapshotService: ProfileSnapshotService; protected applicationContext: ApplicationContext; protected matchConfig: IMatchConfig; protected inraidConfig: IInRaidConfig; - constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts index 7bab158..0162064 100644 --- a/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/TraderController.d.ts @@ -17,10 +17,25 @@ export declare class TraderController { protected traderAssortService: TraderAssortService; protected jsonUtil: JsonUtil; constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); + /** + * Runs when onLoad event is fired + * Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService + * Store timestamp of next assort refresh in nextResupply property of traders .base object + */ load(): void; - getTrader(traderID: string, sessionID: string): ITraderBase; + /** + * Runs when onUpdate is fired + * If current time is > nextResupply(expire) time of trader, refresh traders assorts and + * @returns has run + */ + update(): boolean; + /** + * Return an array of all traders + * @param sessionID Session id + * @returns array if ITraderBase objects + */ getAllTraders(sessionID: string): ITraderBase[]; - updateTraders(): boolean; + getTrader(sessionID: string, traderID: string): ITraderBase; getAssort(sessionId: string, traderId: string): ITraderAssort; - getPurchasesData(traderID: string, sessionID: string): Record; + getPurchasesData(sessionID: string, traderID: string): Record; } diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index 3e7f4cc..317cd6b 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator { createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; protected getTraderId(userID: string): string; protected getRating(userID: string): number; + /** + * Is the offers user rating growing + * @param userID user to check rating of + * @returns true if its growing + */ protected getRatingGrowing(userID: string): boolean; + /** + * Get number of section until offer should expire + * @param userID Id of the offer owner + * @param time Time the offer is posted + * @returns number of seconds until offer expires + */ protected getOfferEndTime(userID: string, time: number): number; /** * Create multiple offers for items by using a unique list of items we've generated previously - * @param expiredOffers + * @param expiredOffers optional, expired offers to regenerate */ generateDynamicOffers(expiredOffers?: Item[]): void; - generateTraderOffers(traderID: string): void; + /** + * Generate trader offers on flea using the traders assort data + * @param traderID Trader to generate offers for + */ + generateFleaOffersForTrader(traderID: string): void; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; + /** + * Add missing conditions to an item if needed + * Durabiltiy for repairable items + * HpResource for medical items + * @param item item to add conditions to + * @returns Item with conditions added + */ protected addMissingCondition(item: Item): Item; protected getOfferRequirements(items: Item[]): { count: number; @@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator { }[]; /** * Create a flea offer and store it in the Ragfair server offers array + * @param userID owner of the offer + * @param time time offer is put up + * @param items items in the offer + * @param barterScheme + * @param loyalLevel + * @param price price of offer + * @param sellInOnePiece + * @returns */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index c3cbfbb..b382e30 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; import { InventoryHelper } from "./InventoryHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -15,7 +16,8 @@ export declare class InRaidHelper { protected databaseServer: DatabaseServer; protected inventoryHelper: InventoryHelper; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + protected profileFixerService: ProfileFixerService; + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService); /** * Reset the SPT inraid property stored in a profile to 'none' * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts index dc7cbca..b8e5c9d 100644 --- a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts @@ -43,6 +43,7 @@ export declare class InventoryHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; + removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; diff --git a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts index 6c150c8..9d4ff98 100644 --- a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts @@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Stats } from "../models/eft/common/tables/IBotBase"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; +import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { ItemHelper } from "./ItemHelper"; export declare class ProfileHelper { + protected logger: ILogger; protected jsonUtil: JsonUtil; protected watermark: Watermark; protected timeUtil: TimeUtil; protected saveServer: SaveServer; protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; + protected profileSnapshotService: ProfileSnapshotService; protected fenceService: FenceService; - constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); + constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index 0f68cd5..32e55ec 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -42,7 +42,15 @@ export declare class QuestHelper { */ evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; - rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; + /** + * Increase skill points of a skill on player profile + * @param sessionID Session id + * @param pmcData Player profile + * @param output output object to send back to client + * @param skillName Name of skill to increase skill points of + * @param progressAmount Amount of skill points to add to skill + */ + rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void; getQuestLocale(questId: string): any; /** * Debug Routine for showing some information on the diff --git a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts index 91ba6b9..677dd66 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderAssortHelper.d.ts @@ -1,7 +1,8 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; -import { ITraderAssort } from "../models/eft/common/tables/ITrader"; +import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService"; import { TraderAssortService } from "../services/TraderAssortService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; +import { TimeUtil } from "../utils/TimeUtil"; import { AssortHelper } from "./AssortHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { TraderHelper } from "./TraderHelper"; export declare class TraderAssortHelper { protected logger: ILogger; protected jsonUtil: JsonUtil; protected mathUtil: MathUtil; + protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected assortHelper: AssortHelper; @@ -24,18 +28,37 @@ export declare class TraderAssortHelper { protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator; protected traderAssortService: TraderAssortService; + protected traderHelper: TraderHelper; protected fenceService: FenceService; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer); /** * Get a traders assorts * Can be used for returning ragfair / fence assorts + * Filter out assorts not unlocked due to level OR quest completion * @param sessionId session id - * @param traderId trader id - * @returns a traders assorts + * @param traderId traders id + * @returns a traders' assorts */ getAssort(sessionId: string, traderId: string): ITraderAssort; + /** + * if the fence assorts have expired, re-generate them + * @param pmcProfile Players profile + */ + refreshFenceAssortIfExpired(pmcProfile: IPmcData): void; + /** + * Reset a traders assorts and move nextResupply value to future + * Flag trader as needing a flea offer reset to be picked up by flea update() function + * @param trader trader details to alter + */ + resetExpiredTrader(trader: ITrader): void; + /** + * Does the supplied trader need its assorts refreshed + * @param traderID Trader to check + * @returns true they need refreshing + */ + traderAssortsHaveExpired(traderID: string): boolean; /** * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * @param traderAssort Assorts to multiple price of diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index b2e9d38..6bda5cd 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { PlayerService } from "../services/PlayerService"; +import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; @@ -23,9 +24,10 @@ export declare class TraderHelper { protected handbookHelper: HandbookHelper; protected playerService: PlayerService; protected fenceService: FenceService; + protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -97,6 +99,17 @@ export declare class TraderHelper { * @param sessionID session id */ lvlUp(traderID: string, sessionID: string): void; + /** + * Get the next update timestamp for a trader + * @param traderID Trader to look up update value for + * @returns future timestamp + */ + getNextUpdateTimestamp(traderID: string): number; + /** + * Get the reset time between trader assort refreshes in seconds + * @param traderId Trader to look up + * @returns Time in seconds + */ getTraderUpdateSeconds(traderId: string): number; /** * check if an item is allowed to be sold to a trader diff --git a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts index 6ded3c6..d310ae2 100644 --- a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts @@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader { getModPath(mod: string): string; protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importMods(): Promise; + /** + * Check for duplciate mods loaded, show error if duplicate mod found + * @param modPackageData dictionary of mod package.json data + */ + protected checkForDuplicateMods(modPackageData: Record): void; + /** + * Check for and return duplicate strings inside an array + * @param stringArray Array to check for duplicates + * @returns string array of duplicates, empty if none found + */ + protected getDuplicates(stringArray: string[]): string[]; /** * * @param mods Get an array of broken/invalid mods by name diff --git a/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts index b1dd448..78ade9a 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/ILocationBase.d.ts @@ -137,7 +137,7 @@ export interface BotLocationModifier { VisibleDistance: number; } export interface MinMaxBot { - WildSpawnType: string; + WildSpawnType: WildSpawnType; max: number; min: number; } @@ -195,7 +195,7 @@ export interface Wave { BotPreset: string; BotSide: string; SpawnPoints: string; - WildSpawnType: string; + WildSpawnType: WildSpawnType; isPlayers: boolean; number: number; slots_max: number; @@ -203,3 +203,7 @@ export interface Wave { time_max: number; time_min: number; } +export declare enum WildSpawnType { + ASSAULT = "assault", + MARKSMAN = "marksman" +} diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts index 0ee468e..64166f4 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -66,13 +66,13 @@ export interface IBan { dateTime: number; } export declare enum BanType { - Chat = 0, - RagFair = 1, - Voip = 2, - Trading = 3, - Online = 4, - Friends = 5, - ChangeNickname = 6 + CHAT = 0, + RAGFAIR = 1, + VOIP = 2, + TRADING = 3, + ONLINE = 4, + FRIENDS = 5, + CHANGE_NICKNAME = 6 } export interface Customization { Head: string; @@ -312,11 +312,11 @@ export interface Notes { export interface CarExtractCounts { } export declare enum SurvivorClass { - Unknown = 0, - Neutralizer = 1, - Marauder = 2, - Paramedic = 3, - Survivor = 4 + UNKNOWN = 0, + NEUTRALIZER = 1, + MARAUDER = 2, + PARAMEDIC = 3, + SURVIVOR = 4 } export interface Quest { qid: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts index f0fe2b5..a84f5af 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITrader.d.ts @@ -7,7 +7,7 @@ export interface ITrader { suits?: ISuit[]; } export interface ITraderBase { - refreshAssort: boolean; + refreshTraderRagfairOffers: boolean; _id: string; avatar: string; balance_dol: number; @@ -58,7 +58,7 @@ export interface Repair { quality: string; } export interface ITraderAssort { - nextResupply?: number; + nextResupply: number; items: Item[]; barter_scheme: Record; loyal_level_items: Record; diff --git a/TypeScript/9RouterHooks/types/models/eft/health/Effect.d.ts b/TypeScript/9RouterHooks/types/models/eft/health/Effect.d.ts index 2f0adac..7eb3ffc 100644 --- a/TypeScript/9RouterHooks/types/models/eft/health/Effect.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/health/Effect.d.ts @@ -1,5 +1,5 @@ export declare enum Effect { - Fracture = "Fracture", - LightBleeding = "LightBleeding", - HeavyBleeding = "HeavyBleeding" + FRACTURE = "Fracture", + LIGHT_BLEEDING = "LightBleeding", + HEAVY_BLEEDING = "HeavyBleeding" } diff --git a/TypeScript/9RouterHooks/types/models/eft/health/IOffraidHealRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/health/IOffraidHealRequestData.d.ts index c242300..26b02bd 100644 --- a/TypeScript/9RouterHooks/types/models/eft/health/IOffraidHealRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/health/IOffraidHealRequestData.d.ts @@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData { time: number; } export declare enum BodyPart { - Head = 0, - Chest = 1, - Stomach = 2, - LeftArm = 3, - RightArm = 4, - LeftLeg = 5, - RightLeg = 6, - Common = 7 + HEAD = "Head", + CHEST = "Chest", + STOMACH = "Stomach", + LEFT_ARM = "LeftArm", + RIGHT_ARM = "RightArm", + LEFT_LEG = "LeftLeg", + RIGHT_LEG = "RightLeg", + COMMON = "Common" } diff --git a/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts b/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts index 8c48260..b248636 100644 --- a/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts @@ -1,9 +1,9 @@ export interface INotifierChannel { - "server": string; - "channel_id": string; - "url": string; - "notifierServer": string; - "ws": string; + server: string; + channel_id: string; + url: string; + notifierServer: string; + ws: string; } import { Message } from "../profile/IAkiProfile"; export interface INotification { diff --git a/TypeScript/9RouterHooks/types/models/enums/BotAmount.d.ts b/TypeScript/9RouterHooks/types/models/enums/BotAmount.d.ts index d0e1df1..9ef9cab 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BotAmount.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BotAmount.d.ts @@ -1,7 +1,7 @@ export declare enum BotAmount { - AsOnline = "AsOnline", - Low = "Low", - Medium = "Medium", - High = "High", - Horde = "Horde" + AS_ONLINE = "AsOnline", + LOW = "Low", + MEDIUM = "Medium", + HIGH = "High", + HORDE = "Horde" } diff --git a/TypeScript/9RouterHooks/types/models/enums/BotDifficulty.d.ts b/TypeScript/9RouterHooks/types/models/enums/BotDifficulty.d.ts index c901bcf..80e45ad 100644 --- a/TypeScript/9RouterHooks/types/models/enums/BotDifficulty.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/BotDifficulty.d.ts @@ -1,8 +1,8 @@ export declare enum BotDifficulty { - AsOnline = "AsOnline", - Easy = "Easy", - Medium = "Medium", - Hard = "Hard", - Impossible = "Impossible", - Random = "Random" + AS_ONLINE = "AsOnline", + EASY = "Easy", + MEDIUM = "Medium", + HARD = "Hard", + IMPOSSIBLE = "Impossible", + RANDOM = "Random" } diff --git a/TypeScript/9RouterHooks/types/models/enums/MemberCategory.d.ts b/TypeScript/9RouterHooks/types/models/enums/MemberCategory.d.ts index 3bd9a21..a81380e 100644 --- a/TypeScript/9RouterHooks/types/models/enums/MemberCategory.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/MemberCategory.d.ts @@ -1,13 +1,13 @@ export declare enum MemberCategory { - Default = 0, - Developer = 1, - UniqueId = 2, - Trader = 4, - Group = 8, - System = 16, - ChatModerator = 32, - ChatModeratorWithPermanentBan = 64, - UnitTest = 128, - Sherpa = 256, - Emissary = 512 + DEFAULT = 0, + DEVELOPER = 1, + UNIQUE_ID = 2, + TRADER = 4, + GROUP = 8, + SYSTEM = 16, + CHAT_MODERATOR = 32, + CHAT_MODERATOR_WITH_PERMANENT_BAN = 64, + UNIT_TEST = 128, + SHERPA = 256, + EMISSARY = 512 } diff --git a/TypeScript/9RouterHooks/types/models/enums/QuestRewardType.d.ts b/TypeScript/9RouterHooks/types/models/enums/QuestRewardType.d.ts index 1d3db86..16f7e39 100644 --- a/TypeScript/9RouterHooks/types/models/enums/QuestRewardType.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/QuestRewardType.d.ts @@ -1,8 +1,8 @@ export declare enum QuestRewardType { - Skill = "Skill", - Experience = "Experience", - TraderStanding = "TraderStanding", - TraderUnlock = "TraderUnlock", - Item = "Item", - AssortmentUnlock = "AssortmentUnlock" + SKILL = "Skill", + EXPERIENCE = "Experience", + TRADER_STANDING = "TraderStanding", + TRADER_UNLOCK = "TraderUnlock", + ITEM = "Item", + ASSORTMENT_UNLOCK = "AssortmentUnlock" } diff --git a/TypeScript/9RouterHooks/types/models/enums/RaidMode.d.ts b/TypeScript/9RouterHooks/types/models/enums/RaidMode.d.ts index c5a8cff..e20cf3f 100644 --- a/TypeScript/9RouterHooks/types/models/enums/RaidMode.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/RaidMode.d.ts @@ -1,5 +1,5 @@ export declare enum RaidMode { - Online = "Online", - Local = "Local", - Coop = "Coop" + ONLINE = "Online", + LOCAL = "Local", + COOP = "Coop" } diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts index e185315..aedf7b0 100644 --- a/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts @@ -11,13 +11,13 @@ export declare class BotLootCache { grenadeItems: ITemplateItem[]; } export declare enum LootCacheType { - Special = "Special", - Backpack = "Backpack", - Pocket = "Pocket", - Vest = "Vest", - Combined = "Combined", - HealingItems = "HealingItems", - DrugItems = "DrugItems", - StimItems = "StimItems", - GrenadeItems = "GrenadeItems" + SPECIAL = "Special", + BACKPACK = "Backpack", + POCKET = "Pocket", + VEST = "Vest", + COMBINED = "Combined", + HEALING_ITEMS = "HealingItems", + DRUG_ITEMS = "DrugItems", + STIM_ITEMS = "StimItems", + GRENADE_ITEMS = "GrenadeItems" } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts index 36d6246..f232052 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IHideoutConfig.d.ts @@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHideoutConfig extends IBaseConfig { kind: "aki-hideout"; runIntervalSeconds: number; - fuelDrainRateMultipler: number; hoursForSkillCrafting: number; + generatorSpeedWithoutFuel: number; + generatorFuelFlowRate: number; + airFilterUnitFlowRate: number; + /** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */ + gpuBoostRate: number; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index c24e617..6369eda 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -27,7 +27,13 @@ export interface Reputation { gain: number; loss: number; } +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Dynamic { + offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; price: MinMax; diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts index 87e08a9..1dd369b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogBackgroundColor { - default = "", - black = "blackBG", - red = "redBG", - green = "greenBG", - yellow = "yellowBG", - blue = "blueBG", - magenta = "magentaBG", - cyan = "cyanBG", - white = "whiteBG" + DEFAULT = "", + BLACK = "blackBG", + RED = "redBG", + GREEN = "greenBG", + YELLOW = "yellowBG", + BLUE = "blueBG", + MAGENTA = "magentaBG", + CYAN = "cyanBG", + WHITE = "whiteBG" } diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts index 7147ae3..6c7abf3 100644 --- a/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts @@ -1,11 +1,11 @@ export declare enum LogTextColor { - black = "black", - red = "red", - green = "green", - yellow = "yellow", - blue = "blue", - magenta = "magenta", - cyan = "cyan", - white = "white", - gray = "" + BLACK = "black", + RED = "red", + GREEN = "green", + YELLOW = "yellow", + BLUE = "blue", + MAGENTA = "magenta", + CYAN = "cyan", + WHITE = "white", + GRAY = "" } diff --git a/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts b/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts index 8887c06..6e20b89 100644 --- a/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/server/ILocaleBase.d.ts @@ -13,10 +13,10 @@ export interface ILocaleGlobalBase { season: Record; customization: Record; repeatableQuest: Record; - templates: ILocaleTemplateBase; - locations: ILocaleLocationsBase; - banners: ILocaleBannersBase; - trading: ILocaleTradingBase; + templates: Record; + locations: Record; + banners: Record; + trading: Record; } export interface ILocaleQuest { name: string; @@ -31,23 +31,11 @@ export interface ILocaleQuest { export interface ILocalePreset { Name: string; } -export interface ILocaleTemplateBase { - templates: Record; -} -export interface ILocaleLocationsBase { - locations: Record; -} -export interface ILocaleBannersBase { - locations: Record; -} export interface ILocaleProps { Name: string; ShortName: string; Description: string; } -export interface ILocaleTradingBase { - locations: Record; -} export interface ILocaleTradingProps { FullName: string; FirstName: string; diff --git a/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts b/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts index bc86cdb..c93864b 100644 --- a/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/RagfairServer.d.ts @@ -1,4 +1,6 @@ import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; +import { TraderAssortHelper } from "../helpers/TraderAssortHelper"; +import { TraderHelper } from "../helpers/TraderHelper"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -12,11 +14,18 @@ export declare class RagfairServer { protected ragfairOfferService: RagfairOfferService; protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; + protected traderHelper: TraderHelper; + protected traderAssortHelper: TraderAssortHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); + constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer); load(): void; update(): void; + /** + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ + protected getUpdateableTraders(): string[]; getAllCategories(): Record; getBespokeCategories(offers: IRagfairOffer[]): Record; /** diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index 79058c6..c9e325e 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class FenceService { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected timeUtil: TimeUtil; protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected handbookHelper: HandbookHelper; @@ -23,11 +25,24 @@ export declare class FenceService { protected configServer: ConfigServer; protected fenceAssort: ITraderAssort; protected traderConfig: ITraderConfig; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); protected setFenceAssort(fenceAssort: ITraderAssort): void; getFenceAssorts(): ITraderAssort; - hasExpiredCache(refreshAssort: boolean): boolean; + /** + * Get the count of items fence offers + * @returns number + */ + getOfferCount(): number; generateFenceAssortCache(pmcData: IPmcData): void; + /** + * Get the next update timestamp for fence + * @returns future timestamp + */ + getNextFenceUpdateTimestamp(): number; + /** + * Get fence refresh time in seconds + */ + protected getFenceRefreshTime(): number; /** * Get the fence level the passed in profile has * @param pmcData Player profile diff --git a/TypeScript/9RouterHooks/types/services/ProfileSnapshotService.d.ts b/TypeScript/9RouterHooks/types/services/ProfileSnapshotService.d.ts new file mode 100644 index 0000000..445ffd0 --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/ProfileSnapshotService.d.ts @@ -0,0 +1,30 @@ +import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { JsonUtil } from "../utils/JsonUtil"; +export declare class ProfileSnapshotService { + protected jsonUtil: JsonUtil; + protected storedProfileSnapshots: Record; + constructor(jsonUtil: JsonUtil); + /** + * Store a profile into an in-memory object + * @param sessionID session id - acts as the key + * @param profile - profile to save + */ + storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void; + /** + * Retreve a stored profile + * @param sessionID key + * @returns A player profile object + */ + getProfileSnapshot(sessionID: string): IAkiProfile; + /** + * Does a profile exists against the provided key + * @param sessionID key + * @returns true if exists + */ + hasProfileSnapshot(sessionID: string): boolean; + /** + * Remove a stored profile by key + * @param sessionID key + */ + clearProfileSnapshot(sessionID: string): void; +} diff --git a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts index 7398a8f..f9e3a34 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts @@ -24,7 +24,6 @@ export declare class RagfairOfferService { protected httpResponse: HttpResponseUtil; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; - protected toUpdate: Record; protected expiredOffers: Item[]; protected offers: IRagfairOffer[]; protected ragfairConfig: IRagfairConfig; @@ -38,8 +37,6 @@ export declare class RagfairOfferService { getOffersOfType(templateId: string): IRagfairOffer[]; addOffer(offer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void; - setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void; - shouldTraderBeUpdated(traderID: string): boolean; getExpiredOfferCount(): number; /** * Get an array of expired items not yet processed into new offers @@ -53,12 +50,15 @@ export declare class RagfairOfferService { * @returns offer exists - true */ doesOfferExist(offerId: string): boolean; - getTraders(): Record; - flagTraderForUpdate(expiredOfferUserId: string): void; removeOfferById(offerId: string): void; removeOfferStack(offerID: string, amount: number): void; removeAllOffersByTrader(traderId: string): void; - addTradersToUpdateList(): void; + /** + * Do the trader offers on flea need to be refreshed + * @param traderID Trader to check + * @returns true if they do + */ + traderOffersNeedRefreshing(traderID: string): boolean; addPlayerOffers(): void; expireStaleOffers(): void; /** diff --git a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts index 679fe1d..466c9e3 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts @@ -27,6 +27,20 @@ export declare class RagfairPriceService { getDynamicPrice(itemTpl: string): number; getAllFleaPrices(): Record; getFleaPriceForItem(tplId: string): number; + /** + * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json + * @param itemPrice price of item + * @param itemTpl item template Id being checked + * @returns adjusted price value in roubles + */ + protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number; + /** + * Get the percentage difference between two values + * @param a numerical value a + * @param b numerical value b + * @returns different in percent + */ + protected getPriceDifference(a: number, b: number): number; getStaticPriceForItem(tplId: string): number; getBarterPrice(barterScheme: IBarterScheme[]): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; diff --git a/TypeScript/9RouterHooks/types/services/TraderAssortService.d.ts b/TypeScript/9RouterHooks/types/services/TraderAssortService.d.ts index 5ba2d05..03b4e12 100644 --- a/TypeScript/9RouterHooks/types/services/TraderAssortService.d.ts +++ b/TypeScript/9RouterHooks/types/services/TraderAssortService.d.ts @@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader"; export declare class TraderAssortService { protected pristineTraderAssorts: Record; getPristineTraderAssort(traderId: string): ITraderAssort; + /** + * Store trader assorts inside a class property + * @param traderId Traderid to store assorts against + * @param assort Assorts to store + */ setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; } diff --git a/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts b/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts index eed4e6d..f437f8a 100644 --- a/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/TimeUtil.d.ts @@ -4,6 +4,10 @@ export declare class TimeUtil { formatDate(date: Date): string; getDate(): string; getTime(): string; + /** + * Get timestamp in seconds + * @returns + */ getTimestamp(): number; /** * mail in eft requires time be in a specific format diff --git a/readme.md b/readme.md index 6d698aa..1f66ae6 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.2.0 +# Mod examples for 3.2.1 A collection of example mods that perform typical actions in SPT