From 33f835fb836d87ed174a7a5f8082fa0e42065ee6 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 23 Mar 2023 14:39:36 +0000 Subject: [PATCH] Update types for 3.5.4 --- .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../{BotLootCache.d.ts => IBotLootCache.d.ts} | 2 +- .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../{BotLootCache.d.ts => IBotLootCache.d.ts} | 2 +- .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../{BotLootCache.d.ts => IBotLootCache.d.ts} | 2 +- .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../13AddTrader/types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../{BotLootCache.d.ts => IBotLootCache.d.ts} | 2 +- .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 6 +-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 21 ++++++--- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../7OnLoadHook/types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 .../types/controllers/BotController.d.ts | 4 +- .../types/controllers/GameController.d.ts | 5 +++ .../types/controllers/InraidController.d.ts | 4 +- .../types/controllers/LauncherController.d.ts | 12 ++++- .../types/controllers/LocationController.d.ts | 23 +++++++++- .../types/controllers/QuestController.d.ts | 25 +++++++++-- .../generators/BotEquipmentModGenerator.d.ts | 2 +- .../types/generators/BotGenerator.d.ts | 15 ++++++- .../generators/BotInventoryGenerator.d.ts | 2 +- .../types/generators/BotLootGenerator.d.ts | 8 ++-- .../types/generators/LootGenerator.d.ts | 2 +- .../types/generators/PMCLootGenerator.d.ts | 2 +- .../types/helpers/ItemHelper.d.ts | 10 +++-- .../types/helpers/PaymentHelper.d.ts | 7 ++- .../types/helpers/QuestHelper.d.ts | 37 ++++++++++----- .../types/helpers/TraderHelper.d.ts | 17 ++++++- .../types/helpers/WeightedRandomHelper.d.ts | 4 ++ .../models/eft/common/tables/IBotBase.d.ts | 19 ++++---- .../models/eft/common/tables/IBotType.d.ts | 18 +++++--- .../models/eft/profile/IConnectResponse.d.ts | 6 +++ .../types/models/enums/AirdropType.d.ts | 6 +++ .../models/enums/WildSpawnTypeNumber.d.ts | 4 +- .../types/models/spt/bots/BotLootCache.d.ts | 23 ---------- .../types/models/spt/bots/IBotLootCache.d.ts | 23 ++++++++++ .../models/spt/config/IAirdropConfig.d.ts | 8 ++-- .../types/models/spt/config/IBotConfig.d.ts | 3 +- .../types/models/spt/config/ICoreConfig.d.ts | 1 + .../models/spt/config/IInventoryConfig.d.ts | 2 + .../models/spt/config/IRagfairConfig.d.ts | 45 +++++++++++++++++-- .../models/spt/services/LootRequest.d.ts | 2 +- .../services/BotEquipmentFilterService.d.ts | 5 +-- .../types/services/BotLootCacheService.d.ts | 18 ++++---- .../services/MatchBotDetailsCacheService.d.ts | 23 ++++++++++ .../services/PmcChatResponseService.d.ts | 38 +++++++++++----- .../utils/{AyncQueue.d.ts => AsyncQueue.d.ts} | 0 readme.md | 2 +- 609 files changed, 5277 insertions(+), 1863 deletions(-) create mode 100644 TypeScript/10ScopesAndTypes/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/10ScopesAndTypes/types/models/enums/AirdropType.d.ts rename TypeScript/10ScopesAndTypes/types/models/spt/bots/{BotLootCache.d.ts => IBotLootCache.d.ts} (94%) create mode 100644 TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/10ScopesAndTypes/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/11BundleLoadingSample/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/11BundleLoadingSample/types/models/enums/AirdropType.d.ts rename TypeScript/11BundleLoadingSample/types/models/spt/bots/{BotLootCache.d.ts => IBotLootCache.d.ts} (94%) create mode 100644 TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/11BundleLoadingSample/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/12ClassExtensionOverride/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/12ClassExtensionOverride/types/models/enums/AirdropType.d.ts rename TypeScript/12ClassExtensionOverride/types/models/spt/bots/{BotLootCache.d.ts => IBotLootCache.d.ts} (94%) create mode 100644 TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/12ClassExtensionOverride/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/13AddTrader/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/13AddTrader/types/models/enums/AirdropType.d.ts rename TypeScript/13AddTrader/types/models/spt/bots/{BotLootCache.d.ts => IBotLootCache.d.ts} (94%) create mode 100644 TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/13AddTrader/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/14AfterDBLoadHook/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/14AfterDBLoadHook/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/15HttpListenerExample/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/15HttpListenerExample/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/15HttpListenerExample/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/16ImporterUtil/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/16ImporterUtil/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/16ImporterUtil/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/17AsyncImporterWithDependency1/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/17AsyncImporterWithDependency2/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/1LogToConsole/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/1LogToConsole/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/2EditDatabase/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/2EditDatabase/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/3GetSptConfigFile/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/3GetSptConfigFile/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/4UseACustomConfigFile/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/4UseACustomConfigFile/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/5ReplaceMethod/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/5ReplaceMethod/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/6ReferenceAnotherClass/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/7OnLoadHook/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/7OnLoadHook/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/8OnUpdateHook/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/8OnUpdateHook/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) create mode 100644 TypeScript/9RouterHooks/types/models/eft/profile/IConnectResponse.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/enums/AirdropType.d.ts delete mode 100644 TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts create mode 100644 TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts rename TypeScript/9RouterHooks/types/utils/{AyncQueue.d.ts => AsyncQueue.d.ts} (100%) diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/10ScopesAndTypes/types/helpers/PaymentHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/AirdropType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts similarity index 94% rename from TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts rename to TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts index aedf7b0..bf0ef61 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/bots/IBotLootCache.d.ts @@ -1,5 +1,5 @@ import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { +export interface IBotLootCache { backpackLoot: ITemplateItem[]; pocketLoot: ITemplateItem[]; vestLoot: ITemplateItem[]; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/AyncQueue.d.ts b/TypeScript/10ScopesAndTypes/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/10ScopesAndTypes/types/utils/AyncQueue.d.ts rename to TypeScript/10ScopesAndTypes/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/11BundleLoadingSample/types/helpers/PaymentHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/AirdropType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts similarity index 94% rename from TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts rename to TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts index aedf7b0..bf0ef61 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/bots/IBotLootCache.d.ts @@ -1,5 +1,5 @@ import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { +export interface IBotLootCache { backpackLoot: ITemplateItem[]; pocketLoot: ITemplateItem[]; vestLoot: ITemplateItem[]; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/AyncQueue.d.ts b/TypeScript/11BundleLoadingSample/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/11BundleLoadingSample/types/utils/AyncQueue.d.ts rename to TypeScript/11BundleLoadingSample/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/PaymentHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/AirdropType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts similarity index 94% rename from TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts rename to TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts index aedf7b0..bf0ef61 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/bots/IBotLootCache.d.ts @@ -1,5 +1,5 @@ import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { +export interface IBotLootCache { backpackLoot: ITemplateItem[]; pocketLoot: ITemplateItem[]; vestLoot: ITemplateItem[]; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/AyncQueue.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/12ClassExtensionOverride/types/utils/AyncQueue.d.ts rename to TypeScript/12ClassExtensionOverride/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/13AddTrader/types/controllers/BotController.d.ts b/TypeScript/13AddTrader/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/13AddTrader/types/controllers/BotController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts b/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/13AddTrader/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/13AddTrader/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/13AddTrader/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/13AddTrader/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/13AddTrader/types/models/enums/AirdropType.d.ts b/TypeScript/13AddTrader/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts similarity index 94% rename from TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts rename to TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts index aedf7b0..bf0ef61 100644 --- a/TypeScript/13AddTrader/types/models/spt/bots/BotLootCache.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/bots/IBotLootCache.d.ts @@ -1,5 +1,5 @@ import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { +export interface IBotLootCache { backpackLoot: ITemplateItem[]; pocketLoot: ITemplateItem[]; vestLoot: ITemplateItem[]; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts b/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/13AddTrader/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/13AddTrader/types/utils/AyncQueue.d.ts b/TypeScript/13AddTrader/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/13AddTrader/types/utils/AyncQueue.d.ts rename to TypeScript/13AddTrader/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/PaymentHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/AirdropType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/AyncQueue.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/14AfterDBLoadHook/types/utils/AyncQueue.d.ts rename to TypeScript/14AfterDBLoadHook/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/15HttpListenerExample/types/helpers/PaymentHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts index 82a925b..1e01efc 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/AirdropType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/15HttpListenerExample/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts b/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/15HttpListenerExample/types/utils/AyncQueue.d.ts b/TypeScript/15HttpListenerExample/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/15HttpListenerExample/types/utils/AyncQueue.d.ts rename to TypeScript/15HttpListenerExample/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts b/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts b/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/16ImporterUtil/types/helpers/PaymentHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/16ImporterUtil/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/16ImporterUtil/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/16ImporterUtil/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts index 82a925b..1e01efc 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/16ImporterUtil/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/AirdropType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/16ImporterUtil/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/16ImporterUtil/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/16ImporterUtil/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts b/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts b/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/16ImporterUtil/types/utils/AyncQueue.d.ts b/TypeScript/16ImporterUtil/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/16ImporterUtil/types/utils/AyncQueue.d.ts rename to TypeScript/16ImporterUtil/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/PaymentHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts index 82a925b..1e01efc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/AirdropType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/utils/AyncQueue.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/17AsyncImporterWithDependency1/types/utils/AyncQueue.d.ts rename to TypeScript/17AsyncImporterWithDependency1/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/PaymentHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts index 82a925b..1e01efc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/AirdropType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/utils/AyncQueue.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/17AsyncImporterWithDependency2/types/utils/AyncQueue.d.ts rename to TypeScript/17AsyncImporterWithDependency2/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/1LogToConsole/types/controllers/BotController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts b/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/1LogToConsole/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/1LogToConsole/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/1LogToConsole/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/1LogToConsole/types/models/enums/AirdropType.d.ts b/TypeScript/1LogToConsole/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/1LogToConsole/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts b/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/1LogToConsole/types/utils/AyncQueue.d.ts b/TypeScript/1LogToConsole/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/1LogToConsole/types/utils/AyncQueue.d.ts rename to TypeScript/1LogToConsole/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts b/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/2EditDatabase/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/2EditDatabase/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/2EditDatabase/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/2EditDatabase/types/models/enums/AirdropType.d.ts b/TypeScript/2EditDatabase/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/2EditDatabase/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts b/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/2EditDatabase/types/utils/AyncQueue.d.ts b/TypeScript/2EditDatabase/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/2EditDatabase/types/utils/AyncQueue.d.ts rename to TypeScript/2EditDatabase/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/AirdropType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/3GetSptConfigFile/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/3GetSptConfigFile/types/utils/AyncQueue.d.ts b/TypeScript/3GetSptConfigFile/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/3GetSptConfigFile/types/utils/AyncQueue.d.ts rename to TypeScript/3GetSptConfigFile/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/AirdropType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/4UseACustomConfigFile/types/utils/AyncQueue.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/4UseACustomConfigFile/types/utils/AyncQueue.d.ts rename to TypeScript/4UseACustomConfigFile/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts index d41ca3b..48efeef 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts @@ -47,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and diff --git a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/AirdropType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/5ReplaceMethod/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts b/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts index 9b19440..7d946e6 100644 --- a/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player diff --git a/TypeScript/5ReplaceMethod/types/utils/AyncQueue.d.ts b/TypeScript/5ReplaceMethod/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/5ReplaceMethod/types/utils/AyncQueue.d.ts rename to TypeScript/5ReplaceMethod/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/PaymentHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/AirdropType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/AyncQueue.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/6ReferenceAnotherClass/types/utils/AyncQueue.d.ts rename to TypeScript/6ReferenceAnotherClass/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/7OnLoadHook/types/helpers/PaymentHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/7OnLoadHook/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/7OnLoadHook/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/7OnLoadHook/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/7OnLoadHook/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/AirdropType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/7OnLoadHook/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts b/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/7OnLoadHook/types/utils/AyncQueue.d.ts b/TypeScript/7OnLoadHook/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/7OnLoadHook/types/utils/AyncQueue.d.ts rename to TypeScript/7OnLoadHook/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/8OnUpdateHook/types/helpers/PaymentHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/AirdropType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/8OnUpdateHook/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts b/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/8OnUpdateHook/types/utils/AyncQueue.d.ts b/TypeScript/8OnUpdateHook/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/8OnUpdateHook/types/utils/AyncQueue.d.ts rename to TypeScript/8OnUpdateHook/types/utils/AsyncQueue.d.ts diff --git a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts index 1d7eb9d..eebe85f 100644 --- a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts @@ -13,6 +13,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { LocalisationService } from "../services/LocalisationService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; @@ -21,6 +22,7 @@ export declare class BotController { protected botHelper: BotHelper; protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected profileHelper: ProfileHelper; protected configServer: ConfigServer; @@ -28,7 +30,7 @@ export declare class BotController { protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; static readonly pmcTypeLabel = "PMC"; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index e47d5fa..53d046a 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -43,6 +43,11 @@ export declare class GameController { protected locationConfig: ILocationConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, applicationContext: ApplicationContext, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + * @param pmcProfile Player profile + */ + protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void; /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 3ae5004..23ca135 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -19,6 +19,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { LocaleService } from "../services/LocaleService"; +import { MatchBotDetailsCacheService } from "../services/MatchBotDetailsCacheService"; import { PmcChatResponseService } from "../services/PmcChatResponseService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -33,6 +34,7 @@ export declare class InraidController { protected databaseServer: DatabaseServer; protected localeService: LocaleService; protected pmcChatResponseService: PmcChatResponseService; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected questHelper: QuestHelper; protected itemHelper: ItemHelper; protected profileHelper: ProfileHelper; @@ -46,7 +48,7 @@ export declare class InraidController { protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; - constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, localeService: LocaleService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, notificationSendHelper: NotificationSendHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer); /** * Save locationId to active profiles inraid object AND app context * @param sessionID Session id diff --git a/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts b/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts index 1af1f56..e8d2311 100644 --- a/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LauncherController.d.ts @@ -3,20 +3,28 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData"; import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData"; import { IRegisterData } from "../models/eft/launcher/IRegisterData"; import { Info } from "../models/eft/profile/IAkiProfile"; +import { IConnectResponse } from "../models/eft/profile/IConnectResponse"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; export declare class LauncherController { protected hashUtil: HashUtil; protected saveServer: SaveServer; protected httpServerHelper: HttpServerHelper; protected databaseServer: DatabaseServer; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; - constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, configServer: ConfigServer); - connect(): any; + constructor(hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, configServer: ConfigServer); + connect(): IConnectResponse; + /** + * Get descriptive text for each of the profile edtions a player can choose + * @returns + */ + protected getProfileDescriptions(): Record; find(sessionIdKey: string): Info; login(info: ILoginRequestData): string; register(info: IRegisterData): string; diff --git a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts index b6feba8..bd9815c 100644 --- a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts @@ -1,9 +1,12 @@ import { LocationGenerator } from "../generators/LocationGenerator"; import { LootGenerator } from "../generators/LootGenerator"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; +import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { LootItem } from "../models/spt/services/LootItem"; +import { LootRequest } from "../models/spt/services/LootRequest"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; @@ -14,6 +17,7 @@ import { TimeUtil } from "../utils/TimeUtil"; export declare class LocationController { protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected weightedRandomHelper: WeightedRandomHelper; protected logger: ILogger; protected locationGenerator: LocationGenerator; protected localisationService: LocalisationService; @@ -22,14 +26,29 @@ export declare class LocationController { protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; + /** + * Get all maps base location properties without loot data + * @returns ILocationsGenerateAllResponse + */ generateAll(): ILocationsGenerateAllResponse; /** * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values - * @returns Array of LootItem + * @returns Array of LootItem objects */ getAirdropLoot(): LootItem[]; + /** + * Randomly pick a type of airdrop loot using weighted values from config + * @returns airdrop type value + */ + protected chooseAirdropType(): AirdropTypeEnum; + /** + * Get the configuration for a specific type of airdrop + * @param airdropType Type of airdrop to get settings for + * @returns LootRequest + */ + protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest; } diff --git a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts index 7e4bd69..48efeef 100644 --- a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts @@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestConditionHelper } from "../helpers/QuestConditionHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { IQuest, Reward } from "../models/eft/common/tables/IQuest"; +import { Item } from "../models/eft/common/tables/IItem"; +import { AvailableForConditions, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -46,10 +47,10 @@ export declare class QuestController { getClientQuests(sessionID: string): IQuest[]; /** * Is the quest for the opposite side the player is on - * @param side player side (usec/bear) - * @param questId questId to check + * @param playerSide Player side (usec/bear) + * @param questId QuestId to check */ - protected questIsForOtherSide(side: string, questId: string): boolean; + protected questIsForOtherSide(playerSide: string, questId: string): boolean; /** * Handle the client accepting a quest and starting it * Send starting rewards if any to player and @@ -124,6 +125,22 @@ export declare class QuestController { * @returns IItemEventRouterResponse */ handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Show warning to user and write to log that repeatable quest failed a condition check + * @param handoverQuestRequest Quest request + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse; + /** + * Show warning to user and write to log quest item handed over did not match what is required + * @param handoverQuestRequest Quest request + * @param itemHandedOver Non-matching item found + * @param handoverRequirements Quest handover requirements + * @param output Response to send to user + * @returns IItemEventRouterResponse + */ + protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Increment a backend counter stored value by an amount, * Create counter if it does not exist diff --git a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts index 4a8581c..ad44c17 100644 --- a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts @@ -96,7 +96,7 @@ export declare class BotEquipmentModGenerator { */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** - * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + * Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance * @param itemSlot slot the item sits in * @param modSlot slot the mod sits in diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index 8992e9e..2321a23 100644 --- a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts @@ -2,7 +2,7 @@ import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { Health as PmcHealth, IBotBase, Info, Skills } from "../models/eft/common/tables/IBotBase"; +import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -84,7 +84,18 @@ export declare class BotGenerator { * @returns PmcHealth object */ protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth; - protected generateSkills(skillsObj: Skills): Skills; + /** + * Get a bots skills with randomsied progress value between the min and max values + * @param botSkills Skills that should have their progress value randomised + * @returns + */ + protected generateSkills(botSkills: IBaseJsonSkills): botSkills; + /** + * Randomise the progress value of passed in skills based on the min/max value + * @param skills Skills to randomise + * @returns Skills with randomised progress values as an array + */ + protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]; /** * Generate a random Id for a bot and apply to bots _id and aid value * @param bot bot to update diff --git a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts index 83a548b..63935bb 100644 --- a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts @@ -34,7 +34,7 @@ export declare class BotInventoryGenerator { /** * Add equipment/weapons/loot to bot * @param sessionId Session id - * @param botJsonTemplate bot/x.json data from db + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param botRole Role bot has (assault/pmcBot) * @param isPmc Is bot being converted into a pmc * @param botLevel Level of bot being generated diff --git a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts index 044d407..c847d4d 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts @@ -3,7 +3,7 @@ import { BotWeaponGeneratorHelper } from "../helpers/BotWeaponGeneratorHelper"; import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase"; -import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType"; +import { IBotType, Inventory, ModsChances } from "../models/eft/common/tables/IBotType"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -33,15 +33,13 @@ export declare class BotLootGenerator { /** * Add loot to bots containers * @param sessionId Session id - * @param templateInventory x.json from database/bots - * @param itemCounts Liits on item types to be added as loot + * @param botJsonTemplate Base json db file for the bot having its loot generated * @param isPmc Will bot be a pmc * @param botRole Role of bot, e.g. asssult * @param botInventory Inventory to add loot to - * @param equipmentChances * @param botLevel Level of bot */ - generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances, botLevel: number): void; + generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** * Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached diff --git a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts index 0d2ef24..f298c13 100644 --- a/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LootGenerator.d.ts @@ -23,7 +23,7 @@ export declare class LootGenerator { * @param options parameters to adjust how loot is generated * @returns An array of loot items */ - createRandomloot(options: LootRequest): LootItem[]; + createRandomLoot(options: LootRequest): LootItem[]; /** * Construct item limit record to hold max and current item count * @param limits limits as defined in config diff --git a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts index 8dd47ef..7a258df 100644 --- a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts @@ -31,7 +31,7 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/hide that lets it fit into a 1x2 slot + * Check if item has a width/height that lets it fit into a 1x2/2x1 slot * 1x1 / 1x2 / 2x1 * @param item Item to check size of * @returns true if it fits diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index bd4893c..7cb563f 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -171,17 +171,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds StackMaxSize + * split item stack if it exceeds its StackMaxSize property + * @param itemToSplit item being split into smaller stacks + * @returns Array of split items */ - splitStack(item: Item): Item[]; + splitStack(itemToSplit: Item): Item[]; /** * Find Barter items in the inventory - * @param {string} by + * @param {string} by tpl or id * @param {Object} pmcData * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; /** * * @param pmcData diff --git a/TypeScript/9RouterHooks/types/helpers/PaymentHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/PaymentHelper.d.ts index 2d068a4..1534f4a 100644 --- a/TypeScript/9RouterHooks/types/helpers/PaymentHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/PaymentHelper.d.ts @@ -1,6 +1,11 @@ +import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { ConfigServer } from "../servers/ConfigServer"; export declare class PaymentHelper { + protected configServer: ConfigServer; + protected inventoryConfig: IInventoryConfig; + constructor(configServer: ConfigServer); /** - * Check whether tpl is Money + * Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) * @param {string} tpl * @returns void */ diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index 1ec9fe8..dcfc5ae 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -1,5 +1,6 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { Quest } from "../models/eft/common/tables/IBotBase"; +import { Item } from "../models/eft/common/tables/IItem"; import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData"; @@ -42,10 +43,10 @@ export declare class QuestHelper { /** * Get status of a quest in player profile by its id * @param pmcData Profile to search - * @param questID Quest id to look up + * @param questId Quest id to look up * @returns QuestStatus enum */ - getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus; + getQuestStatus(pmcData: IPmcData, questId: string): QuestStatus; /** * returns true is the level condition is satisfied * @param playerLevel Players level @@ -81,14 +82,19 @@ export declare class QuestHelper { * @returns true if loyalty is high enough to fulfill quest requirement */ traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + /** + * take reward item from quest and set FiR status + fix stack sizes + fix mod Ids + * @param reward Reward item to fix + * @returns Fixed rewards + */ protected processReward(reward: Reward): Reward[]; /** * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) * @param quest quest to get rewards for - * @param state Quest status that holds the items (Started, Success, Fail) + * @param status Quest status that holds the items (Started, Success, Fail) * @returns array of items with the correct maxStack */ - getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; + getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[]; /** * Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile * @param pmcData Player profile @@ -97,19 +103,19 @@ export declare class QuestHelper { */ getQuestReadyForProfile(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): Quest; /** - * TODO: what is going on here - * @param acceptedQuestId Quest to add to profile + * Get quests that can be shown to player after starting a quest + * @param startedQuestId Quest started by player * @param sessionID Session id - * @returns Array of quests in profile + quest passed in as param + * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; /** - * TODO: what is going on here - * @param failedQuestId - * @param sessionID Session id + * Get quests that can be shown to player after failing a quest + * @param failedQuestId Id of the quest failed by player + * @param sessionId Session id * @returns */ - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + failedUnlocked(failedQuestId: string, sessionId: string): IQuest[]; /** * Adjust quest money rewards by passed in multiplier * @param quest Quest to multiple money rewards @@ -127,6 +133,13 @@ export declare class QuestHelper { * @param output ItemEvent router response */ changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Add item stack change object into output route event response + * @param output Response to add item change event into + * @param sessionId Session id + * @param item Item that was adjusted + */ + protected addItemStackSizeChangeIntoEventResponse(output: IItemEventRouterResponse, sessionId: string, item: Item): void; /** * Get quests, strip all requirement conditions except level * @param quests quests to process diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index fddacba..66175fe 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -8,8 +8,10 @@ import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; +import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { HandbookHelper } from "./HandbookHelper"; +import { ItemHelper } from "./ItemHelper"; import { ProfileHelper } from "./ProfileHelper"; export declare class TraderHelper { protected logger: ILogger; @@ -17,15 +19,19 @@ export declare class TraderHelper { protected saveServer: SaveServer; protected profileHelper: ProfileHelper; protected handbookHelper: HandbookHelper; + protected itemHelper: ItemHelper; protected playerService: PlayerService; protected localisationService: LocalisationService; protected fenceService: FenceService; protected timeUtil: TimeUtil; + protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected traderConfig: ITraderConfig; - /** Dictionary of item tpl and the highest trader rouble price */ + /** Dictionary of item tpl and the highest trader sell rouble price */ protected highestTraderPriceItems: Record; - constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer); + /** Dictionary of item tpl and the highest trader buy back rouble price */ + protected highestTraderBuyPriceItems: Record; + constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; getTraderAssortsById(traderId: string): ITraderAssort; /** @@ -82,8 +88,15 @@ export declare class TraderHelper { }): void; /** * Get the highest rouble price for an item from traders + * UNUSED * @param tpl Item to look up highest pride for * @returns highest rouble cost for item */ getHighestTraderPriceRouble(tpl: string): number; + /** + * Get the highest price item can be sold to trader for (roubles) + * @param tpl Item to look up best trader sell-to price + * @returns Rouble price + */ + getHighestSellToTraderPrice(tpl: string): number; } diff --git a/TypeScript/9RouterHooks/types/helpers/WeightedRandomHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/WeightedRandomHelper.d.ts index 9aa0d29..a978f96 100644 --- a/TypeScript/9RouterHooks/types/helpers/WeightedRandomHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/WeightedRandomHelper.d.ts @@ -1,5 +1,6 @@ export declare class WeightedRandomHelper { /** + * USE getWeightedValue() WHERE POSSIBLE * Gets a tplId from a weighted dictionary * @param {tplId: weighting[]} itemArray * @returns tplId @@ -7,6 +8,9 @@ export declare class WeightedRandomHelper { getWeightedInventoryItem(itemArray: { [tplId: string]: unknown; } | ArrayLike): string; + getWeightedValue(itemArray: { + [key: string]: unknown; + } | ArrayLike): T; /** * Picks the random item based on its weight. * The items with higher weight will be picked more often (with a higher probability). 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 82a925b..1e01efc 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -122,24 +122,27 @@ export interface Inventory { questStashItems: string; fastPanel: Record; } +export interface IBaseJsonSkills { + Common: Record; + Mastering: Record; + Points: number; +} export interface Skills { Common: Common[]; Mastering: Mastering[]; Points: number; } -export interface Common { +export interface IBaseSkill { Id: string; Progress: number; - PointsEarnedDuringSession?: number; - LastAccess?: number; max?: number; min?: number; } -export interface Mastering { - Id: string; - Progress: number; - max?: number; - min?: number; +export interface Common extends IBaseSkill { + PointsEarnedDuringSession?: number; + LastAccess?: number; +} +export interface Mastering extends IBaseSkill { } export interface Stats { CarriedQuestItems: string[]; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts index e02d990..24b36a4 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts @@ -104,13 +104,17 @@ export interface Generation { items: ItemMinMax; } export interface ItemMinMax { - grenades: MinMax; - healing: MinMax; - drugs: MinMax; - stims: MinMax; - looseLoot: MinMax; - magazines: MinMax; - specialItems: MinMax; + grenades: MinMaxWithWhitelist; + healing: MinMaxWithWhitelist; + drugs: MinMaxWithWhitelist; + stims: MinMaxWithWhitelist; + looseLoot: MinMaxWithWhitelist; + magazines: MinMaxWithWhitelist; + specialItems: MinMaxWithWhitelist; +} +export interface MinMaxWithWhitelist extends MinMax { + /** Array of item tpls */ + whitelist: string[]; } export interface Health { BodyParts: BodyPart[]; diff --git a/TypeScript/9RouterHooks/types/models/eft/profile/IConnectResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/profile/IConnectResponse.d.ts new file mode 100644 index 0000000..8e809ef --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/profile/IConnectResponse.d.ts @@ -0,0 +1,6 @@ +export interface IConnectResponse { + backendUrl: string; + name: string; + editions: string[]; + profileDescriptions: Record; +} diff --git a/TypeScript/9RouterHooks/types/models/enums/AirdropType.d.ts b/TypeScript/9RouterHooks/types/models/enums/AirdropType.d.ts new file mode 100644 index 0000000..a6f6e3a --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/AirdropType.d.ts @@ -0,0 +1,6 @@ +export declare enum AirdropTypeEnum { + MIXED = "mixed", + WEAPONARMOR = "weaponarmor", + FOODMEDICAL = "foodmedical", + BARTER = "barter" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts index ff806fe..ef6d2bd 100644 --- a/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts @@ -28,6 +28,6 @@ export declare enum WildSpawnTypeNumber { BOSSKNIGHT = 67108864, FOLLOWERBIGPIPE = 134217728, FOLLOWERBIRDEYE = 268435456, - SPTUSEC = 536870912, - SPTBEAR = 1073741824 + BOSSZRYACHIY = 536870912, + FOLLOWERZRYACHIY = 1073741824 } diff --git a/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts deleted file mode 100644 index aedf7b0..0000000 --- a/TypeScript/9RouterHooks/types/models/spt/bots/BotLootCache.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; -export declare class BotLootCache { - backpackLoot: ITemplateItem[]; - pocketLoot: ITemplateItem[]; - vestLoot: ITemplateItem[]; - combinedPoolLoot: ITemplateItem[]; - specialItems: ITemplateItem[]; - healingItems: ITemplateItem[]; - drugItems: ITemplateItem[]; - stimItems: ITemplateItem[]; - grenadeItems: ITemplateItem[]; -} -export declare enum LootCacheType { - 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/bots/IBotLootCache.d.ts b/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts new file mode 100644 index 0000000..bf0ef61 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/bots/IBotLootCache.d.ts @@ -0,0 +1,23 @@ +import { ITemplateItem } from "../../eft/common/tables/ITemplateItem"; +export interface IBotLootCache { + backpackLoot: ITemplateItem[]; + pocketLoot: ITemplateItem[]; + vestLoot: ITemplateItem[]; + combinedPoolLoot: ITemplateItem[]; + specialItems: ITemplateItem[]; + healingItems: ITemplateItem[]; + drugItems: ITemplateItem[]; + stimItems: ITemplateItem[]; + grenadeItems: ITemplateItem[]; +} +export declare enum LootCacheType { + 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/IAirdropConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts index 627b603..cc3dd4e 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IAirdropConfig.d.ts @@ -1,8 +1,10 @@ +import { AirdropTypeEnum } from "../../../models/enums/AirdropType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IAirdropConfig extends IBaseConfig { kind: "aki-airdrop"; airdropChancePercent: AirdropChancePercent; + airdropTypeWeightings: Record; planeMinFlyHeight: number; planeMaxFlyHeight: number; planeVolume: number; @@ -10,7 +12,7 @@ export interface IAirdropConfig extends IBaseConfig { crateFallSpeed: number; airdropMinStartTimeSeconds: number; airdropMaxStartTimeSeconds: number; - loot: AirdropLoot; + loot: Record; } export interface AirdropChancePercent { bigmap: number; @@ -22,12 +24,12 @@ export interface AirdropChancePercent { tarkovStreets: number; } export interface AirdropLoot { - presetCount: MinMax; + presetCount?: MinMax; itemCount: MinMax; itemBlacklist: string[]; itemTypeWhitelist: string[]; /** key: item base type: value: max count */ itemLimits: Record; itemStackLimits: Record; - armorLevelWhitelist: number[]; + armorLevelWhitelist?: number[]; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts index fcbc179..a25a38c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts @@ -1,3 +1,4 @@ +import { MinMaxWithWhitelist } from "../../../models/eft/common/tables/IBotType"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; import { IBotDurability } from "./IBotDurability"; @@ -85,7 +86,7 @@ export interface ModLimits { } export interface RandomisationDetails { levelRange: MinMax; - generation?: Record; + generation?: Record; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; /** Equipment chances */ diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts index b2819a4..27903e6 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ICoreConfig.d.ts @@ -4,5 +4,6 @@ export interface ICoreConfig extends IBaseConfig { akiVersion: string; projectName: string; compatibleTarkovVersion: string; + serverName: string; commit: string; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts index 4642b9b..3ad0cce 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts @@ -3,6 +3,8 @@ export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; randomLootContainers: Record; + /** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */ + customMoneyTpls: string[]; } export interface RewardDetails { rewardCount: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index 75357d0..78e1cbe 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -2,16 +2,24 @@ import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IRagfairConfig extends IBaseConfig { kind: "aki-ragfair"; + /** How many seconds should pass before expired offers and procesed + player offers checked if sold */ runIntervalSeconds: number; + /** Player listing settings */ sell: Sell; + /** Trader ids + should their assorts be listed on flea*/ traders: Record; dynamic: Dynamic; } export interface Sell { + /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; + /** Settings to control chances of offer being sold */ chance: Chance; + /** Settings to control how long it takes for a player offer to sell */ time: Time; + /** Player offer reputation gain/loss settings */ reputation: Reputation; + /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number; } export interface Chance { @@ -32,48 +40,77 @@ export interface Dynamic { purchasesAreFoundInRaid: boolean; /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; + /** Barter offer specific settings */ barter: Barter; + /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; + /** How many offers should expire before an offer regeneration occurs */ expiredOfferThreshold: number; + /** How many offers should be listed */ offerItemCount: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ price: MinMax; + /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ presetPrice: MinMax; + /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; + /** Settings to control the durability range of item items listed on flea */ condition: Condition; + /** Size stackable items should be listed for in percent of max stack size */ stackablePercent: MinMax; + /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ nonStackableCount: MinMax; + /** Range of rating offers for items being listed */ rating: MinMax; + /** Percentages to sell offers in each currency */ currencies: Record; + /** Item tpls that should be forced to sell as a single item */ showAsSingleStack: string[]; + /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ removeSeasonalItemsWhenNotInEvent: boolean; + /** Flea blacklist settings */ blacklist: Blacklist; } export interface Barter { + /** Should barter offers be generated */ enable: boolean; + /** Percentage change an offer is listed as a barter */ chancePercent: number; + /** Min number of required items for a barter requirement */ itemCountMin: number; + /** Max number of required items for a barter requirement */ itemCountMax: number; + /** How much can the total price of requested items vary from the item offered */ priceRangeVariancePercent: number; + /** Min rouble price for an offer to be considered for turning into a barter */ minRoubleCostToBecomeBarter: number; + /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } export interface OfferAdjustment { + /** Shuld offer price be adjusted when below handbook price */ + adjustPriceWhenBelowHandbookPrice: boolean; + /** How big a percentage difference does price need to vary from handbook to be considered for adjustment */ maxPriceDifferenceBelowHandbookPercent: number; + /** How much to multiply the handbook price to get the new price */ handbookPriceMultipier: number; + /** What is the minimum rouble price to consider adjusting price of item */ priceThreshholdRub: number; } export interface Condition { + /** Percentage change durability is altered */ conditionChance: number; min: number; max: number; } export interface Blacklist { - /** - * show/hide trader items that are blacklisted by bsg - */ - traderItems: boolean; + /** Custom blacklist for item Tpls */ custom: string[]; + /** BSG blacklist a large number of items from flea, true = use blacklist */ enableBsgList: boolean; + /** Should quest items be blacklisted from flea */ enableQuestList: boolean; + /** Should trader items that are blacklisted by bsg */ + traderItems: boolean; } diff --git a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts index 8c197ee..996a4de 100644 --- a/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/services/LootRequest.d.ts @@ -1,5 +1,5 @@ import { MinMax } from "../../common/MinMax"; -export declare class LootRequest { +export interface LootRequest { presetCount: MinMax; itemCount: MinMax; itemBlacklist: string[]; diff --git a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts index 089cfb5..eb21fd8 100644 --- a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts @@ -1,6 +1,5 @@ import { BotHelper } from "../helpers/BotHelper"; -import { MinMax } from "../models/common/MinMax"; -import { EquipmentChances, Generation, IBotType, ModsChances } from "../models/eft/common/tables/IBotType"; +import { EquipmentChances, Generation, IBotType, MinMaxWithWhitelist, ModsChances } from "../models/eft/common/tables/IBotType"; import { BotGenerationDetails } from "../models/spt/bots/BotGenerationDetails"; import { AdjustmentDetails, EquipmentFilterDetails, EquipmentFilters, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -30,7 +29,7 @@ export declare class BotEquipmentFilterService { * @param generationChanges Changes to apply * @param baseBotGeneration dictionary to update */ - protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; + protected adjustGenerationChances(generationChanges: Record, baseBotGeneration: Generation): void; /** * Get equipment settings for bot * @param botEquipmentRole equipment role to return diff --git a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts index dab7c6d..6e0a1db 100644 --- a/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotLootCacheService.d.ts @@ -1,7 +1,8 @@ import { PMCLootGenerator } from "../generators/PMCLootGenerator"; -import { Items } from "../models/eft/common/tables/IBotType"; +import { ItemHelper } from "../helpers/ItemHelper"; +import { IBotType } from "../models/eft/common/tables/IBotType"; import { ITemplateItem, Props } from "../models/eft/common/tables/ITemplateItem"; -import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache"; +import { IBotLootCache, LootCacheType } from "../models/spt/bots/IBotLootCache"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { JsonUtil } from "../utils/JsonUtil"; @@ -10,12 +11,13 @@ import { RagfairPriceService } from "./RagfairPriceService"; export declare class BotLootCacheService { protected logger: ILogger; protected jsonUtil: JsonUtil; + protected itemHelper: ItemHelper; protected databaseServer: DatabaseServer; protected pmcLootGenerator: PMCLootGenerator; protected localisationService: LocalisationService; protected ragfairPriceService: RagfairPriceService; - protected lootCache: Record; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); + protected lootCache: Record; + constructor(logger: ILogger, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService); /** * Remove all cached bot loot data */ @@ -25,17 +27,17 @@ export declare class BotLootCacheService { * @param botRole bot to get loot for * @param isPmc is the bot a pmc * @param lootType what type of loot is needed (backpack/pocket/stim/vest etc) - * @param lootPool the full pool of loot (needed when cache is empty) + * @param botJsonTemplate Base json db file for the bot having its loot generated * @returns ITemplateItem array */ - getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[]; + getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, botJsonTemplate: IBotType): ITemplateItem[]; /** * Generate loot for a bot and store inside a private class property * @param botRole bots role (assault / pmcBot etc) - * @param lootPool the full pool of loot we use to create the various sub-categories with * @param isPmc Is the bot a PMC (alteres what loot is cached) + * @param botJsonTemplate db template for bot having its loot generated */ - protected addLootToCache(botRole: string, isPmc: boolean, lootPool: Items): void; + protected addLootToCache(botRole: string, isPmc: boolean, botJsonTemplate: IBotType): void; /** * Sort a pool of item objects by its flea price * @param poolToSort pool of items to sort diff --git a/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts new file mode 100644 index 0000000..757f61f --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts @@ -0,0 +1,23 @@ +import { IBotBase } from "../models/eft/common/tables/IBotBase"; +import { ILogger } from "../models/spt/utils/ILogger"; +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +export declare class MatchBotDetailsCacheService { + protected logger: ILogger; + protected botDetailsCache: Record; + constructor(logger: ILogger); + /** + * Store a bot in the cache, keyed by its name + * @param botToCache Bot details to cache + */ + cacheBot(botToCache: IBotBase): void; + /** + * Clean the cache of all bot details + */ + clearCache(): void; + /** + * Find a bot in the cache by its name + * @param botName Name of bot to find + * @returns Bot details + */ + getBotByName(botName: string): IBotBase; +} diff --git a/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts b/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts index d4acf50..7d946e6 100644 --- a/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PmcChatResponseService.d.ts @@ -1,38 +1,45 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { Victim } from "../models/eft/common/tables/IBotBase"; +import { Aggressor, Victim } from "../models/eft/common/tables/IBotBase"; import { IUserDialogInfo } from "../models/eft/profile/IAkiProfile"; import { IPmcChatResponse } from "../models/spt/config/IPmChatResponse"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { LocalisationService } from "./LocalisationService"; +import { MatchBotDetailsCacheService } from "./MatchBotDetailsCacheService"; export declare class PmcChatResponseService { + protected logger: ILogger; protected randomUtil: RandomUtil; protected notificationSendHelper: NotificationSendHelper; + protected matchBotDetailsCacheService: MatchBotDetailsCacheService; protected localisationService: LocalisationService; protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected pmcResponsesConfig: IPmcChatResponse; - constructor(randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, notificationSendHelper: NotificationSendHelper, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); /** - * Chooses a random victim from those provided and sends a message to the player, can be positive or negative + * For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative * @param sessionId Session id * @param pmcVictims Array of bots killed by player + * @param pmcData Player profile */ - sendVictimResponse(sessionId: string, pmcVictims: Victim[]): void; + sendVictimResponse(sessionId: string, pmcVictims: Victim[], pmcData: IPmcData): void; /** * Not fully implemented yet, needs method of acquiring killers details after raid * @param sessionId Session id * @param pmcData Players profile + * @param killer The bot who killed the player */ - sendKillerResponse(sessionId: string, pmcData: IPmcData): void; + sendKillerResponse(sessionId: string, pmcData: IPmcData, killer: Aggressor): void; /** * Choose a localised message to send the player (different if sender was killed or killed player) - * @param isVictim - * @returns + * @param isVictim Is the message coming from a bot killed by the player + * @param pmcData Player profile + * @returns Message from PMC to player */ - protected chooseMessage(isVictim: boolean): string; + protected chooseMessage(isVictim: boolean, pmcData: IPmcData): string; /** * Should capitalisation be stripped from the message response before sending * @param isVictim Was responder a victim of player @@ -46,11 +53,11 @@ export declare class PmcChatResponseService { */ protected allCaps(isVictim: boolean): boolean; /** - * Should the word 'bro' be appended to the message being sent to player + * Should a suffix be appended to the end of the message being sent to player * @param isVictim Was responder a victim of player * @returns true = should be stripped */ - appendBroToMessageEnd(isVictim: boolean): boolean; + appendSuffixToMessageEnd(isVictim: boolean): boolean; /** * Choose a type of response based on the weightings in pmc response config * @param isVictim Was responder killed by player @@ -64,10 +71,21 @@ export declare class PmcChatResponseService { * @returns */ protected getResponseLocaleKeys(keyType: string, isVictim?: boolean): string[]; + /** + * Get all locale keys that start with `pmcresponse-suffix` + * @returns array of keys + */ + protected getResponseSuffixLocaleKeys(): string[]; /** * Randomly draw a victim of the the array and return thier details * @param pmcVictims Possible victims to choose from * @returns IUserDialogInfo */ protected chooseRandomVictim(pmcVictims: Victim[]): IUserDialogInfo; + /** + * Convert a victim object into a IUserDialogInfo object + * @param pmcVictim victim to convert + * @returns IUserDialogInfo + */ + protected getVictimDetails(pmcVictim: Victim): IUserDialogInfo; } diff --git a/TypeScript/9RouterHooks/types/utils/AyncQueue.d.ts b/TypeScript/9RouterHooks/types/utils/AsyncQueue.d.ts similarity index 100% rename from TypeScript/9RouterHooks/types/utils/AyncQueue.d.ts rename to TypeScript/9RouterHooks/types/utils/AsyncQueue.d.ts diff --git a/readme.md b/readme.md index 930980a..8777835 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.5.3 +# Mod examples for 3.5.4 A collection of example mods that perform typical actions in SPT