### Event Settings Options Example Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Provides an example of the detailed settings that can be configured for a specific seasonal event. This includes hostility overrides and appearance modifications. ```json { "hostilitySettingsForEvent": { "Bear": "Friend", "Usec": "Friend" }, "botAppearanceChanges": { "Christmas": { "Bear": { "weight": 0.8, "outfitId": "5d1b730f86f77443f110399a" } } }, "christmasContainerIds": [ "57347bce24597ed611439014", "590c668786f7742f947b5f7b" ] } ``` -------------------------------- ### Example Event Gear Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Provides a concrete example of the `eventGear` configuration for the CHRISTMAS event, specifying an item for the 'assault' bot type's 'Headwear' slot. ```json "eventGear": { "CHRISTMAS": { "assault": { "Headwear": { "5df8a58286f77412631087ed": 50 } } } } ``` -------------------------------- ### Example Route Definition Source: https://deepwiki.com/sp-tarkov/server-csharp/4-server-infrastructure Defines a static route for '/singleplayer/settings/raid/menu' that handles requests by calling the GetRaidMenuSettings method. ```csharp new RouteAction( "/singleplayer/settings/raid/menu", async (url, info, sessionID, output) => await inRaidCallbacks.GetRaidMenuSettings() ) ``` -------------------------------- ### Bot Durability Configuration Example Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Example JSON configuration for bot durability settings, including parameters for weapons and armor for PMC and other bot types. ```json // BotConfig.json { "Durability": { "Pmc": { "Weapon": { "LowestMax": 45, "HighestMax": 75, "MinDelta": 0, "MaxDelta": 10, "MinLimitPercent": 70 }, "Armor": { "LowestMaxPercent": 70, "HighestMaxPercent": 100, "MinDelta": 0, "MaxDelta": 15, "MinLimitPercent": 50 } }, "BotDurabilities": { "assault": { "Weapon": { "LowestMax": 30, "HighestMax": 60, ... }, "Armor": { ... } } } } } ``` -------------------------------- ### Create a New Utility Class Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Example structure for creating a new stateless utility class. Ensure the class is marked with [Injectable(InjectionType.Singleton)] and implements reusable logic. ```csharp using SPTarkov.DI.Annotations;   namespace SPTarkov.Server.Core.Utils;   [Injectable(InjectionType.Singleton)] public class NewUtil { /// /// Description of utility method /// public ReturnType MethodName(ParameterType param) { // Stateless, pure function implementation } } ``` -------------------------------- ### Repeatable Quest Configuration Example Source: https://deepwiki.com/sp-tarkov/server-csharp/7-quest-system Configuration for daily, weekly, and scav repeatable quests, specifying types, number of quests, reset time, and type-specific settings. ```json { "repeatableQuests": [ { "name": "Daily", "side": "Pmc", "types": ["Elimination", "Completion", "Exploration"], "numQuests": 3, "resetTime": 86400, "questConfig": { "Elimination": { /* difficulty, rewards */ }, "Completion": { /* item pools, counts */ }, "Exploration": { /* locations, extracts */ } } } ] } ``` -------------------------------- ### Accessing Configuration in Services Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Shows how services can retrieve specific configuration settings using a generic method from the central ConfigServer. This example retrieves the 'LocationConfig'. ```csharp protected readonly LocationConfig LocationConfig = configServer.GetConfig(); ``` -------------------------------- ### Event Gear Configuration Example Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system This configuration snippet shows how to add specific items, like Santa and Elf hats, to bot equipment pools for the CHRISTMAS season. Weights determine the probability of each item appearing. ```json seasonalevents.json: EventGear: { CHRISTMAS: { assault: { Headwear: { "ItemTpl.HEADWEAR_SANTA_HAT": 50, "ItemTpl.HEADWEAR_ELF_HAT": 30 } } } } ``` -------------------------------- ### Verify SPTarkov Server Installation Directory Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Ensure you are in the correct project directory by checking for the presence of logger configuration files. These files are essential for the server to initialize correctly. ```text Required Files: ├── sptLogger.json (Release) ├── sptLogger.Development.json (Debug) └── SPT_Data/ (Assets directory) ``` -------------------------------- ### Start and Complete Area Upgrades Source: https://deepwiki.com/sp-tarkov/server-csharp/5.5-hideout-system Initiates an area upgrade by consuming items and setting a timer, and finalizes the upgrade to apply bonuses. Specific methods are used for starting and completing the process. ```csharp StartUpgrade() UpgradeComplete() ApplyPlayerUpgradesBonus() ``` -------------------------------- ### Consumer Service with Constructor Injection Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers This example shows how a consumer service, RepeatableQuestGenerator, receives a utility class, MathUtil, through its constructor. This pattern facilitates loose coupling and testability. ```csharp public class RepeatableQuestGenerator { private readonly MathUtil _mathUtil; public RepeatableQuestGenerator(MathUtil mathUtil) { _mathUtil = mathUtil; } // Use interpolation for reward scaling var reward = _mathUtil.Interp1(pmcLevel, levels, rewards); } ``` -------------------------------- ### Hideout Production Registration Flow Source: https://deepwiki.com/sp-tarkov/server-csharp/5-core-gameplay-systems Illustrates the sequence of calls and validations involved when a player requests to start a craft in the hideout. ```csharp HideoutController.RegisterProduction() HideoutHelper.RegisterProduction() GetAdjustedCraftTimeWithSkills() InitProduction() SptRequiredTools pmcData.Hideout.Production[recipeId] ``` -------------------------------- ### Start Production Craft Source: https://deepwiki.com/sp-tarkov/server-csharp/5.5-hideout-system Initiates a production craft within the hideout. Craft time can be reduced by skills or modifiers, and required tools are managed and returned upon completion. ```csharp GetSkillProductionTimeReduction() Production.SptRequiredTools Production.Products ``` -------------------------------- ### Get Message Preview Source: https://deepwiki.com/sp-tarkov/server-csharp/8.5-dialogue-mail-and-communication Generates a preview text for displaying messages in a dialogue list. ```csharp GetMessagePreview() ``` -------------------------------- ### Dynamic Flea Market Pricing Calculation Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Shows how dynamic item prices are randomized on server start using a multiplier based on handbook prices. ```csharp dynamicPrice = handbookPrice * randomMultiplier where randomMultiplier ∈ [priceMultiplier.min, priceMultiplier.max] ``` -------------------------------- ### Experience Table Calculation Example Source: https://deepwiki.com/sp-tarkov/server-csharp/7.3-quest-rewards-and-progression Shows the cumulative experience required for each player level. Experience is summed from a predefined table to determine the total XP needed for a specific level. ```plaintext Level 1: 1000 XP total Level 2: 1000 + 4017 = 5017 XP total Level 3: 5017 + 5860 = 10877 XP total ... Level 79: Sum of all previous levels (max) ``` -------------------------------- ### Payment Processing Flow Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Outlines the general flow for payment processing within the server. No specific setup or imports are shown. ```markdown **Payment Flow:** ``` ``` ``` -------------------------------- ### Quest Reward Budget Example Source: https://deepwiki.com/sp-tarkov/server-csharp/7.3-quest-rewards-and-progression Illustrates the minimum and maximum Roubles awarded for daily and weekly quests based on player level. These values are configurable per quest type. ```json Daily Elimination (Level 20): minRoubles = 9000 maxRoubles = 22000 Weekly Exploration (Level 35): minRoubles = 135000 maxRoubles = 290000 ``` -------------------------------- ### Fence Dynamic Inventory Generation Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Details the process for generating Fence's dynamic inventory, including main and discount assortments. No specific setup or imports are shown. ```markdown **Generation Process:** ``` ``` ``` -------------------------------- ### Event Definition Model Example Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Illustrates the structure of an individual event definition within the seasonal event configuration. It includes enablement, name, type, date range, and specific settings. ```json { "enabled": true, "name": "Halloween", "type": "Halloween", "startMonth": 10, "startDay": 15, "endMonth": 11, "endDay": 5, "settings": { "hostilitySettingsForEvent": { "Bear": "Enemy", "Usec": "Enemy" }, "botAppearanceChanges": { "Halloween": { "Shturman": { "weight": 1.0, "outfitId": "5d1b730f86f77443f110399a" } } } } } ``` -------------------------------- ### Trader Purchase Flow Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Illustrates the process flow for a player purchasing items from an NPC trader. No specific setup or imports are shown. ```markdown **Purchase Flow:** ``` ``` ``` -------------------------------- ### Weight Reduction Algorithm Example Source: https://deepwiki.com/sp-tarkov/server-csharp/10-development-and-extension Optimizes loot tables by finding the greatest common divisor (GCD) of all weights and dividing by it. This reduces memory usage and improves readability without changing probability distribution. ```json {"itemA": 10000, "itemB": 20000, "itemC": 30000} → {"itemA": 1, "itemB": 2, "itemC": 3} ``` -------------------------------- ### Enable SPT-AKI Server Features Source: https://deepwiki.com/sp-tarkov/server-csharp/4-server-infrastructure Configure optional server functionalities by modifying the 'features' section in core.json. This example shows how to enable SPT friend gifts and the 'give' command. ```json { "features": { "compressProfile": false, "chatbotFeatures": { "sptFriendGiftsEnabled": true, "commandoFeatures": { "giveCommandEnabled": true } }, "createNewProfileTypesBlacklist": [], "achievementProfileIdBlacklist": [] } } ``` -------------------------------- ### Bot Difficulty Settings Retrieval Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Illustrates the retrieval and management of bot difficulty settings, mapping bot roles to their configurations. Includes methods for getting settings and converting UI values. ```csharp // BotDifficultyHelper.cs // ... methods like GetBotDifficultySettings(), ConvertBotDifficultyDropdownToBotDifficulty(), ChooseRandomDifficulty() ... ``` -------------------------------- ### Server Startup and Request Processing Flow Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Illustrates the multi-phase pipeline for server initialization and how incoming requests are processed through various middleware components. ```csharp ``` -------------------------------- ### Run Release Build (Windows) Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Execute the compiled server executable on Windows. ```bash ./SPT.Server.exe ``` -------------------------------- ### Get Dialogs for Profile Source: https://deepwiki.com/sp-tarkov/server-csharp/8.5-dialogue-mail-and-communication Retrieves all dialogues associated with a specific player profile. ```csharp GetDialogsForProfile() ``` -------------------------------- ### Run Release Build (Linux) Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Execute the compiled server executable on Linux. ```bash ./SPT.Server.Linux ``` -------------------------------- ### Trader Loyalty and Standing Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Shows the management of trader progression and standing. No specific setup or imports are shown. ```markdown **Sources** : 1-500 ### Trader Loyalty and Standing The `TraderHelper` manages trader progression: ``` ``` ``` -------------------------------- ### Accessing Bot Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Demonstrates how to access specific configuration settings, such as BotConfig, after the configuration server has loaded. ```csharp protected readonly BotConfig BotConfig = configServer.GetConfig(); ``` -------------------------------- ### Seasonal Event Bot Appearance Modifications Source: https://deepwiki.com/sp-tarkov/server-csharp/6-bot-system Example of how to configure appearance modifications for bots during seasonal events, such as Christmas. ```json { "botAppearanceChanges": { "CHRISTMAS": { "bear": { "body": { "itemId": newWeight }, "feet": { "itemId": newWeight } } } } } ``` -------------------------------- ### Run Release Build (macOS) Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Execute the compiled server executable on macOS. ```bash ./SPT.Server.Mac ``` -------------------------------- ### Get SPT Version and Commit Hash Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Retrieves the semantic version and git commit hash of the SPTarkov server using ProgramStatics.SPT_VERSION() and ProgramStatics.COMMIT(). ```csharp // Get version for watermark display var version = ProgramStatics.SPT_VERSION(); // e.g., 4.0.13 var commit = ProgramStatics.COMMIT(); // e.g., "a12b34" ``` -------------------------------- ### BotLootCacheService Implementation Source: https://deepwiki.com/sp-tarkov/server-csharp/10-development-and-extension Demonstrates lazy cache initialization with fine-grained locking for bot loot retrieval. ```csharp public class BotLootCacheService : CacheService { public BotLootCacheService(IConfiguration configuration, ILogger logger) : base(configuration, logger, new CacheOptions { CacheType = CacheType.Distributed, KeyLifetime = TimeSpan.FromMinutes(30) }) { } protected override async Task HydrateCache(string key) { var loot = await GetLootFromCache(key); return FilterLoot(loot); } private async Task GetLootFromCache(string key) { // Simulate fetching loot from a database or external source await Task.Delay(100); return new BotLootCache { // Populate with dummy loot data Weapons = new List { "AK-74N", "M4A1" }, Meds = new List { "Ai-2", "Salewa" }, Food = new List { "Tushonka", "Condensed Milk" } }; } private BotLootCache FilterLoot(BotLootCache loot) { // Simulate filtering loot based on container type (key) var filteredLoot = new BotLootCache(); if (key.Contains("Backpack") || key.Contains("Vest")) { filteredLoot.Weapons = loot.Weapons.Where(w => !IsMagazine(w) && !IsGrenade(w)).ToList(); filteredLoot.Meds = loot.Meds.Where(m => !IsMedicalItem(m)).ToList(); } // Add more filtering logic as needed return filteredLoot; } private bool IsMagazine(string item) => item.Contains("Magazine"); private bool IsGrenade(string item) => item.Contains("Grenade"); private bool IsMedicalItem(string item) => item.Contains("Med"); } ``` -------------------------------- ### Complete Event Definition Example Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system This JSON defines a complete seasonal event, including its name, type, duration, and specific settings for the Christmas 2024 event. ```json { "enabled": true, "name": "Christmas 2024", "type": "CHRISTMAS", "startMonth": 12, "startDay": 20, "endMonth": 1, "endDay": 7, "settings": { "enableChristmasHideout": true, "enableSanta": true, "adjustBotAppearances": true, "addEventGearToBots": true, "addEventLootToBots": true, "enableRundansEvent": true, "christmasLootBoostAmount": 0.03 } } ``` -------------------------------- ### Build SPT Server for Windows Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Builds the SPT server targeting the Windows x64 platform. ```bash dotnet build -r win-x64 ``` -------------------------------- ### Check if Date is Between Two Dates Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Compares the current date against start and end month/day values to determine if an event is active. Events with 'Enabled = false' are skipped. ```csharp if (currentDate.DateIsBetweenTwoDates(events.StartMonth, events.StartDay, events.EndMonth, events.EndDay)) { _currentlyActiveEvents.Add(events); } ``` -------------------------------- ### Injectable Singleton Service Registration Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Demonstrates how to register a service as a singleton using the [Injectable] attribute with a specified injection type. This service has multiple dependencies injected via its constructor. ```csharp [Injectable(InjectionType.Singleton)] public class LocationLifecycleService( ISptLogger logger, ConfigServer configServer, DatabaseService databaseService, SaveServer saveServer // ... more dependencies ) ``` -------------------------------- ### Clone the SPTarkov Server Repository Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Use Git to clone the official server-csharp repository and navigate into the project directory. This is the first step for setting up your development environment. ```bash git clone https://github.com/sp-tarkov/server-csharp.git cd server-csharp ``` -------------------------------- ### Run Debug Build Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Execute the server in debug mode using the dotnet CLI. ```bash dotnet run --project SPTarkov.Server ``` -------------------------------- ### Build SPTarkov Server in Release Mode Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Compile the project for production or distribution using the Release configuration. This optimizes the build for performance and reduces size. ```bash dotnet build -c Release ``` -------------------------------- ### Build SPT Server for Linux Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Builds the SPT server targeting the Linux x64 platform. ```bash dotnet build -r linux-x64 ``` -------------------------------- ### RagfairOfferService Core Methods Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Methods for performing Create, Read, Update, and Delete operations on Flea Market offers. ```csharp RagfairOfferService `GetOffers()`, `AddOffer()`, `RemoveOffer()` ``` -------------------------------- ### Watermark Construction Logic Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Demonstrates how the watermark text is constructed, including version labels, descriptions, warnings for debug builds, and modding information. ```csharp // Build version label versionLabel = $"{ProjectName} {SptVersion}[-BLEEDINGEDGE]" // Add description (always) text.AddRange(watermarkLocale.Description) // Add warning if debug build if (ProgramStatics.DEBUG()) { text.AddRange(watermarkLocale.Warning) } // Add modding info if mods disabled if (!ProgramStatics.MODS()) { text.AddRange(watermarkLocale.Modding) } // Add custom messages from config foreach (var key in customWatermarkLocaleKeys) { text.AddRange(["", GetText(key)]) } ``` -------------------------------- ### SptHttpListener Request Processing Source: https://deepwiki.com/sp-tarkov/server-csharp/4-server-infrastructure Handles incoming HTTP requests by decompressing the body, getting a response from the HttpRouter, and sending the response back. It supports compression based on response headers. ```csharp public async Task Handle(string sessionId, HttpContext context) { if (context.Request.Headers.TryGetValue("responsecompressed", out var responsecompressed) && responsecompressed == "0") { await GetResponse(sessionId, context, ResponseStreamFactory.Default); } else { await GetResponse(sessionId, context, new ZlibResponseStreamFactory()); } } ``` -------------------------------- ### Price Filter Application Source: https://deepwiki.com/sp-tarkov/server-csharp/6.4-bot-loot-and-caching Illustrates how to apply price filtering, using -1 as a sentinel value for no maximum limit. ```csharp public MinMax PriceFilter { get; } ``` -------------------------------- ### NoGCRegionMiddleware Implementation Source: https://deepwiki.com/sp-tarkov/server-csharp/4-server-infrastructure Implements middleware to prevent garbage collection during request processing when only one request is active. It uses interlocked operations to track active requests and conditionally starts a NoGC region. ```csharp public async Task InvokeAsync(HttpContext context) { Interlocked.Increment(ref _activeRequests); try { if (_activeRequests == 1) { GC.TryStartNoGCRegion(CoreConfig.NoGCRegionMaxMemoryGB, CoreConfig.NoGCRegionMaxLOHMemoryGB); } await _next(context); } finally { if (_activeRequests == 1) { GC.EndNoGCRegion(); } Interlocked.Decrement(ref _activeRequests); } } ``` -------------------------------- ### Event Bot Role Mapping Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Maps custom event bot role names to their base bot types for specialized event handling. Includes examples for different event bot functionalities. ```csharp Event Bot Role| Base Bot Type| Purpose ---|---|--- `peacefullZryachiyEvent`| `bosszryachiy`| Non-hostile Zryachiy for summoning event `ravangeZryachiyEvent`| `bosszryachiy`| Hostile Zryachiy spawned after summoning `sectactPriestEvent`| Custom priest bot| Cultist priest for summoning ritual `gifter`| Special Santa bot| Friendly bot that drops gifts ``` -------------------------------- ### RagfairOfferHolder Core Methods Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Key methods for managing the multi-index cache of Flea Market offers, enabling fast retrieval. ```csharp RagfairOfferHolder `GetOfferById()`, `GetOffersByTemplate()`, `AddOffer()` ``` -------------------------------- ### Service Dependency Injection Pattern Source: https://deepwiki.com/sp-tarkov/server-csharp/10-development-and-extension Demonstrates the use of the [Injectable] attribute for automatic dependency injection registration in services. ```csharp [Injectable(InjectionType.Singleton)] public class BotLootCacheService( ISptLogger logger, ItemHelper itemHelper, PMCLootGenerator pmcLootGenerator, ServerLocalisationService serverLocalisationService, ICloner cloner ) { protected readonly ConcurrentDictionary _lootCache = new(); private readonly Lock _drugLock = new(); public Dictionary GetLootFromCache(...) { } protected void AddLootToCache(...) { } protected bool IsBulletOrGrenade(...) { } } ``` -------------------------------- ### Gifter Bot System Implementation Flow Source: https://deepwiki.com/sp-tarkov/server-csharp/9.1-seasonal-events-system Illustrates the implementation flow for the Gifter Bot system, including loot generation and faction settings. ```json { "eventBotMapping": { "botEvent": "607010323723a90017212711" } } ``` -------------------------------- ### Build SPT Server for macOS Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Builds the SPT server targeting the macOS ARM64 platform. ```bash dotnet build -r osx-arm64 ``` -------------------------------- ### RagfairPriceService Core Methods Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Methods for retrieving both dynamic and static prices for items in the Flea Market. ```csharp RagfairPriceService `GetDynamicPrice()`, `GetStaticPrice()` ``` -------------------------------- ### HTTP Server Binding Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Configures the IP address and port the server will listen on, and whether to log incoming requests. ```json { "ip": "127.0.0.1", "port": 6969, "logRequests": true } ``` -------------------------------- ### Build SPTarkov Server in Debug Mode Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Compile the project for development purposes using the default debug configuration. This command is used for local development and testing. ```bash dotnet build ``` -------------------------------- ### Core Server Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/2-getting-started Defines fundamental server settings including project name, Tarkov version compatibility, server name, profile save interval, and profile wipe allowance. ```json { "projectName": "SPT", "compatibleTarkovVersion": "0.16.9.40087", "serverName": "SPT Server", "profileSaveIntervalSeconds": 60, "allowProfileWipe": true, "enableNoGCRegions": false, "noGCRegionMaxMemoryGB": 4, "noGCRegionMaxLOHMemoryGB": 3 } ``` -------------------------------- ### DialogueHelper Methods Summary Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Provides a summary of key methods within the DialogueHelper class for managing dialogue and messages. ```markdown **Key Methods:** Method| Purpose| Returns ---|---|--- `GetMessagePreview()`| Extract preview of last message in dialogue| `MessagePreview` (text, type, timestamp, userId) `GetMessageItemContents()`| Get items attached to a specific message| `List` `GetDialogsForProfile()`| Get dialogue dictionary for profile, create if missing| `Dictionary` `GetDialogueFromProfile()`| Find specific dialogue by ID| `Dialogue` or null ``` -------------------------------- ### DialogueController Methods and Routes Source: https://deepwiki.com/sp-tarkov/server-csharp/8.5-dialogue-mail-and-communication Lists the key methods of the DialogueController, their corresponding API routes, and their purposes. This is useful for understanding how to interact with the dialogue and mail system from the client. ```markdown Method| Route| Purpose ---|---|--- `GetFriendList()`| `client/friend/list`| Returns chatbots + player friends `GenerateDialogueList()`| `client/mail/dialog/list`| Lists all dialogues with previews `GenerateDialogueView()`| `client/mail/dialog/view`| Shows all messages in a dialogue `GetAllAttachments()`| `client/mail/dialog/getAllAttachments`| Retrieves items from messages `RemoveDialogue()`| `client/mail/dialog/remove`| Deletes a dialogue `SetDialoguePin()`| `client/mail/dialog/pin`| Pins/unpins dialogue `SetRead()`| `client/mail/dialog/read`| Marks messages as read ``` -------------------------------- ### RagfairController Core Methods Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Key methods for handling client requests related to the Flea Market, including fetching offers and managing player listings. ```csharp RagfairController `GetOffers()`, `AddPlayerOffer()`, `GetItemMinAvgMaxFleaPriceValues()` ``` -------------------------------- ### Insurance Processing Workflow Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Outlines the steps involved in insuring items, handling loss events during raids, and the asynchronous processing of insurance returns. ```csharp **Insurance Processing:** 1. **Insure Items** - Player pays insurance via `InsuranceService.Insure()` 2. **Loss Event** - `LocationLifecycleService.EndLocalRaid()` calls `InsuranceController.HandleInsuredItemLostEvent()` 3. **Async Processing** - `InsuranceController.ProcessReturn()` runs on timer, simulates item "looting" via `FindItemsToDelete()` 4. **Return** - Items sent to player via `MailSendService` ``` -------------------------------- ### PMCLootGenerator Pattern Source: https://deepwiki.com/sp-tarkov/server-csharp/10-development-and-extension Illustrates the PMCLootGenerator for creating dynamically-weighted loot pools for PMCs using inverse price weighting. ```csharp public class PMCLootGenerator : LootGenerator { private readonly PriceData _priceData; private readonly LootTable _lootTable; public PMCLootGenerator(PriceData priceData, LootTable lootTable) { _priceData = priceData; _lootTable = lootTable; } public override List GenerateLoot(string role) { var pool = _lootTable.GetBasePool(role); var weightedPool = pool.Select(item => { var price = _priceData.GetItemPrice(item.TemplateId) ?? 10000; // Default price var highestPrice = _priceData.GetHighestPrice() ?? 50000; // Default highest price var weight = (1.0 / price) * highestPrice; return new { Item = item, Weight = weight }; }).ToList(); // Apply GCD reduction for readability (implementation omitted for brevity) // ... // Select items based on weights (implementation omitted for brevity) // ... return new List(); // Placeholder } } ``` -------------------------------- ### Hideout Configuration Settings Source: https://deepwiki.com/sp-tarkov/server-csharp/5.5-hideout-system Defines parameters for hideout updates and skill-based crafting bonuses. Ensure 'hoursForSkillCrafting' and 'craftingExpAmount' are set appropriately for desired skill progression. ```C# runIntervalSeconds: 10, runIntervalValues.inRaid: 60, runIntervalValues.outOfRaid: 10, hoursForSkillCrafting: 28800, craftingExpAmount: 12.5, craftingExpForHoursOfCrafting: 3.75, overrideCraftTimeSeconds: -1, overrideBuildTimeSeconds: -1, updateProfileHideoutWhenActiveWithinMinutes: 90 ``` -------------------------------- ### Flea Market Dynamic Pricing Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Configuration for the dynamic pricing system of the flea market, specifying the minimum and maximum multipliers for price randomization. ```json { "dynamic": { "priceRanges": { "default": { "min": 0.8, "max": 1.2 } } } } ``` -------------------------------- ### Typed Logging with ISptLogger Source: https://deepwiki.com/sp-tarkov/server-csharp/3-architecture-overview Demonstrates the usage of typed ISptLogger for logging within a service. Ensure ISptLogger is injected as a singleton. ```csharp using SPT.Common.Core.DependencyInjection; using SPT.Common.Core.Logging; [Injectable(InjectionType.Singleton)] public class LocationLifecycleService( ISptLogger logger, // ... other dependencies ) { public void SomeMethod() { logger.Debug("Debug message"); logger.Success("Success message"); logger.Warning("Warning message"); logger.Error("Error message"); } } ``` -------------------------------- ### Flea Market Search and Filtering Logic Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Illustrates the multi-layered filtering process applied when a client searches the Flea Market. ```csharp Client searches the flea market, the system applies multiple filter layers: ``` -------------------------------- ### Create Dialogue Source: https://deepwiki.com/sp-tarkov/server-csharp/8.5-dialogue-mail-and-communication Creates a new dialogue, either with a trader or another player. ```csharp CreateDialogue() ``` -------------------------------- ### RagfairOfferGenerator Core Methods Source: https://deepwiki.com/sp-tarkov/server-csharp/8-economy-and-trading Methods responsible for the creation and addition of new offers to the Flea Market. ```csharp RagfairOfferGenerator `CreateAndAddFleaOffer()`, `CreateOffer()` ``` -------------------------------- ### Insurance Returns Message Handling Source: https://deepwiki.com/sp-tarkov/server-csharp/10.4-utilities-and-helpers Demonstrates how to add insured items to a dialogue message for insurance returns. ```csharp // InsuranceController returns items via mail var dialogue = dialogueHelper.GetDialogueFromProfile(sessionId, insurerTraderId); var message = new Message { Items = new MessageItems { Data = insuredItems }, HasRewards = true, RewardCollected = false }; dialogue.Messages.Add(message); ``` -------------------------------- ### Seasonal Event Gear and Loot Configuration Source: https://deepwiki.com/sp-tarkov/server-csharp/6-bot-system Shows the structure for configuring event-specific gear and loot in seasonalevents.json. ```json EventGear[eventType][botType][equipmentSlot][itemId] = weight EventLoot[eventType][botType][containerType][itemId] = weight ```