### C# Authentication Example Source: https://wiki.project-fika.com/advanced-features/fika-api.md Example of how to set up authentication headers for C# clients. Ensure you have your API key and set the requestcompressed header to 0. ```csharp client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", config.APIKey); client.DefaultRequestHeaders.Add("requestcompressed", "0"); ``` -------------------------------- ### Example Response for Get Items Source: https://wiki.project-fika.com/advanced-features/fika-api.md This JSON shows the structure of a response when requesting all items from the SPT database. It includes item ID, name, description, and stackable amount. ```json { "items": { "5447a9cd4bdc2dbd208b4567": { "name": "Colt M4A1 5.56x45 assault rifle", "description": "The Colt M4A1 carbine is a fully automatic variant of the basic M4 Carbine and was primarily designed for special operations use.\nHowever, U.S. Special Operations Command (USSOCOM) was soon to adopt the M4A1 for almost all special operations units, followed later by general introduction of the M4A1 into service with the U.S. Army and Marine Corps.", "stackable": 10 } } } ``` -------------------------------- ### Example Player.log Path Source: https://wiki.project-fika.com/faqandguides/advanced-how-fika-establishes-raid-connections.md This is the typical file path to the Player.log file on Windows systems, which contains connection information for troubleshooting Fika raids. ```plaintext C:\Users\YOURUSERNAME\AppData\LocalLow\Battlestate Games\EscapeFromTarkov\ ``` -------------------------------- ### Fika Server Startup Output Source: https://wiki.project-fika.com/hosting-a-fika-server/host-using-port-forwarding.md This output indicates a successful Fika server startup. It shows the server version, loaded mods, and confirms that the webserver and websocket have started on the specified ports. ```text ModLoader: loading: 1 server mods... Mod: server version: 2.2.0 (targets SPT: >=4.0.11) by: Fika loaded Loading OnWebAppBuildMods... [Fika Server] Overriding SPT configuration Finished loading OnWebAppBuildMods... Loaded self-signed certificate (./user/certs/server.crt) Server: executing startup callbacks... ┌─────────────────────────────────────────┐ │ SPT 4.0.11 │ │ https://discord.sp-tarkov.com │ │ │ │ This work is free of charge │ │ If you paid money, you were scammed │ │ Commercial use is prohibited │ └─────────────────────────────────────────┘ Loading PreSptMods... Finished loading PreSptMods... Importing database... Database import finished Generating flea offers... Started webserver at https://0.0.0.0:6969 Started websocket at wss://0.0.0.0:6969 Server has started, happy playing ``` -------------------------------- ### POST fika/api/createheadlessprofile Source: https://wiki.project-fika.com/advanced-features/fika-api.md Creates one headless profile. This is primarily used by the installer and is not recommended for general use. ```APIDOC ## POST fika/api/createheadlessprofile ### Description Creates one headless profile. This is primarily used by the installer and is not recommended for general use. ### Method POST ### Endpoint fika/api/createheadlessprofile ``` -------------------------------- ### Ask a Question via Documentation API Source: https://wiki.project-fika.com/llms.txt Use this GET request to query the documentation index with a specific question and an optional broader goal. The response provides a direct answer and relevant excerpts. ```http GET https://wiki.project-fika.com/credits.md?ask=&goal= ``` -------------------------------- ### Get All Items Source: https://wiki.project-fika.com/advanced-features/fika-api.md Retrieves all items from the SPT database. Each item includes its MongoID, name, description, and stackable amount. ```APIDOC ## GET fika/api/items ### Description Returns all items from the SPT database, including their MongoID, name, description, and stackable amount. ### Method GET ### Endpoint /fika/api/items ### Response #### Success Response (200) - **items** (object) - An object containing item data, keyed by MongoID. - **name** (string) - The name of the item. - **description** (string) - The description of the item. - **stackable** (integer) - The maximum number of items that can stack together. ### Response Example ```json { "items": { "5447a9cd4bdc2dbd208b4567": { "name": "Colt M4A1 5.56x45 assault rifle", "description": "The Colt M4A1 carbine is a fully automatic variant of the basic M4 Carbine and was primarily designed for special operations use.\nHowever, U.S. Special Operations Command (USSOCOM) was soon to adopt the M4A1 for almost all special operations units, followed later by general introduction of the M4A1 into service with the U.S. Army and Marine Corps.", "stackable": 10 } } } ``` ``` -------------------------------- ### Configure Server IP in fika.jsonc Source: https://wiki.project-fika.com/faqandguides.md Ensure the server IP is correctly set in fika.jsonc, not http.json. The fika.jsonc file is generated after running SPT.Server.exe with fika-server installed. ```json fika.jsonc ``` -------------------------------- ### Extract Mod GUIDs from Player.log Source: https://wiki.project-fika.com/faqandguides/set-up-required-optional-mods.md This PowerShell script extracts GUIDs of installed mods from the Escape From Tarkov Player.log file. It's useful for populating the 'required' or 'optional' mod lists in fika.jsonc. Ensure all desired plugins are installed and the SPT client is launched before running. ```powershell $LocalLow = [System.Environment]::GetFolderPath("LocalApplicationData").Replace("Local", "LocalLow") $LogFile = Join-Path $LocalLow \"Battlestate Games\" \"EscapeFromTarkov\" | \"Player.log\" $ModGuids = @() Get-Content $LogFile | ForEach-Object { if ($_ -match '^\\[Info\s+:FikaModHandler\\]\.*?GUID \\\\[([^\\]+)\\]') { $ModGuids += '"' + $matches[1] + '"' } } $CSVOutput = $ModGuids -join ', ' Write-Host $CSVOutput ``` -------------------------------- ### Get Active Headless Clients Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Defines the schema for retrieving active headless clients. It includes a list of headless clients, each with a profile ID, nickname, state (Ready/NotReady), and the number of players. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "GetHeadlessResponse", "type": "object", "properties": { "headlessClients": { "type": "array", "items": { "$ref": "#/$defs/OnlineHeadless" } } }, "required": ["headlessClients"], "$defs": { "OnlineHeadless": { "type": "object", "properties": { "profileId": { "type": "string" }, "nickname": { "type": "string" }, "state": { "$ref": "#/$defs/EHeadlessState" }, "players": { "type": "integer" } }, "required": ["profileId", "nickname", "state", "players"] }, "EHeadlessState": { "type": "integer", "enum": [0, 1], "description": "0 = Ready, 1 = NotReady" } } } ``` -------------------------------- ### Get Active Raids Source: https://wiki.project-fika.com/advanced-features/fika-api.md Retrieves a list of all active raids. The response includes details for each raid, such as IP addresses, server GUID, port, host username, and player information. ```json { "64f92bdacb123456789abcde": { "ips": ["192.168.1.10"], "serverGuid": "2fbb7ba6-327e-4c58-8f87-75e43da5a5f5", "port": 7070, "hostUsername": "PlayerOne", "timestamp": 1730840102, "crc32": 123456789, "gameVersion": "1.0.0", "raidConfig": {}, "locationData": {}, "status": 1, "timeout": 300, "players": { "64f92bdae8123456789aaaaa": { "groupId": "group123", "isDead": false, "isSpectator": false } }, "side": 0, "time": 0, "raidCode": "ABCD1234", "natPunch": true, "isHeadless": false, "raids": 5 } } ``` -------------------------------- ### Schema for Get Items Response Source: https://wiki.project-fika.com/advanced-features/fika-api.md This JSON schema defines the expected structure for the response when retrieving items. It specifies the format for item data, including name, description, and stackable quantity. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "GetItemsResponse", "type": "object", "properties": { "items": { "type": "object", "additionalProperties": { "$ref": "#/$defs/ItemData" } } }, "required": ["items"], "$defs": { "ItemData": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "stackable": { "type": "integer", "description": "Number of items that can stack together (StackAmount)." } }, "required": ["name", "description", "stackable"] } } } ``` -------------------------------- ### Get Raw Profile Source: https://wiki.project-fika.com/advanced-features/fika-api.md Retrieves a player's raw profile data in JSON format using their profile ID. This endpoint is useful for accessing detailed, unprocessed player information. ```APIDOC ## GET /fika/api/rawprofile ### Description Returns a raw profile in JSON format. ### Method GET ### Endpoint /fika/api/rawprofile ### Parameters #### Query Parameters - **profileId** (string) - Required - The MongoID to return a raw profile of. ### Request Example ```json { "example": "/fika/api/rawprofile?profileId=68e8f63d941b8a1c94c1d8bf" } ``` ### Response #### Success Response (200) - **[Raw profile data]** (object) - The raw profile data for the specified player. #### Response Example ```json { "example": "[Raw profile data for the player]" } ``` ``` -------------------------------- ### Fika Match Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Defines the structure for a Fika match response, detailing properties like IP addresses, server GUID, port, host username, game version, player status, and raid-specific information. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "MatchesResponse", "type": "object", "description": "Dictionary", "additionalProperties": { "$ref": "#/$defs/FikaMatch" }, "$defs": { "FikaMatch": { "type": "object", "properties": { "ips": { "type": "array", "items": { "type": "string" } }, "serverGuid": { "type": "string", "format": "uuid" }, "port": { "type": "integer" }, "hostUsername": { "type": "string" }, "timestamp": { "type": "integer" }, "crc32": { "type": "integer", "minimum": 0 }, "gameVersion": { "type": "string" }, "raidConfig": { "description": "Ignored type placeholder.", "type": "object" }, "locationData": { "description": "Ignored type placeholder.`, "type": "object" }, "status": { "$ref": "#/$defs/EFikaMatchStatus" }, "timeout": { "type": "integer" }, "players": { "type": "object", "additionalProperties": { "$ref": "#/$defs/FikaPlayer" } }, "side": { "$ref": "#/$defs/EFikaSide" }, "time": { "$ref": "#/$defs/EFikaTime" }, "raidCode": { "type": "string" }, "natPunch": { "type": "boolean" }, "isHeadless": { "type": "boolean" }, "raids": { "type": "integer" } }, "required": [ "raidConfig", "locationData", "status", "side", "time" ] }, "FikaPlayer": { "type": "object", "properties": { "groupId": { "type": "string" }, "isDead": { "type": "boolean" }, "isSpectator": { "type": "boolean" } }, "required": ["groupId", "isDead", "isSpectator"] }, "EFikaMatchStatus": { "type": "integer", "enum": [0, 1, 2], "description": "0=LOADING, 1=IN_GAME, 2=COMPLETE" }, "EFikaSide": { "type": "integer", "enum": [0, 1], "description": "0=PMC, 1=Savage" }, "EFikaTime": { "type": "integer", "enum": [0, 1], "description": "0=CURR, 1=PAST" } } } ``` -------------------------------- ### Get Online Players Source: https://wiki.project-fika.com/advanced-features/fika-api.md Retrieves a list of all players currently online in the Fika system. The response includes player details such as their profile ID, nickname, level, and current location. ```APIDOC ## GET /fika/api/players ### Description Returns all online players. ### Method GET ### Endpoint /fika/api/players ### Response #### Success Response (200) - **players** (array) - An array of online player objects. - **profileId** (string) - The unique identifier for the player's profile. - **nickname** (string) - The player's in-game nickname. - **level** (integer) - The player's current level. - **location** (integer) - An enumeration representing the player's current location. #### Response Example ```json { "players": [ { "profileId": "68e8f63d941b8a1c94c1d8bf", "nickname": "PlayerOne", "level": 50, "location": 3 } ] } ``` ``` -------------------------------- ### Sample Snapshotter for Rendering Source: https://wiki.project-fika.com/modding-fika.md In the Update loop, use GetInterpolationIndices to determine the correct interpolation state and time 't'. Retrieve snapshots using GetSnapshot, applying LerpUnclamped for interpolation or extrapolating based on velocity. ```csharp private void Update() { double currentTime = NetworkTimeSync.NetworkTime; // 1. ask the snapshotter where we are in the timeline var state = _snapshotter.GetInterpolationIndices(currentTime, out int from, out int to, out float t); // 2. handle the "Stop" case first if (state == EBufferState.Stale) { // network timeout or buffer empty. stop moving. return; } // 3. retrieve the snapshots. // in 'Extrapolating', both 'to' and 'from' are the newest packet. // t will be the time (in seconds) elapsed since that packet. ref readonly var snapFrom = ref _snapshotter.GetSnapshot(from); if (state == EBufferState.Interpolating) { ref readonly var snapTo = ref _snapshotter.GetSnapshot(to); // standard blending between two real points transform.position = Vector3.LerpUnclamped(snapFrom.Position, snapTo.Position, t); transform.rotation = Quaternion.SlerpUnclamped(snapFrom.Rotation, snapTo.Rotation, t); } else if (state == EBufferState.Extrapolating) { // 't' here is the delta time since the last packet. // we use the last known velocity to guess the new position. Vector3 velocity = snapFrom.Velocity; transform.position = snapFrom.Position + (velocity * t); // keep rotation static during extrapolation to prevent spinning transform.rotation = snapFrom.Rotation; } } ``` -------------------------------- ### Configure SPT Launcher with Server IP Source: https://wiki.project-fika.com/advanced-features/nat-punching/self-hosted-nat-punch-server.md Set the server IP address in the SPT Launcher settings to enable it to connect to your public SPT server. Ensure 'Developer Mode' is checked and the URL is correctly formatted. ```text https://YOUR_SERVER_IP ``` -------------------------------- ### Manual Fika Uninstallation Steps Source: https://wiki.project-fika.com/faqandguides.md Steps for manually uninstalling Fika by deleting specific files and folders. Also includes instructions for updating the SPT launcher URL if necessary. ```plaintext BepInEx/plugins/Fika/Fika.Core.dll ``` ```plaintext SPT/user/mods/fika-server/ ``` ```plaintext https://127.0.0.1:6969 ``` -------------------------------- ### Fika Server Configuration Source: https://wiki.project-fika.com/fika-configuration/server.md This JSON configuration file defines various settings for the Fika server, including client-side options, server-side network and gameplay parameters, NAT punch settings, headless client behavior, and background customization. ```json5 { "client": { "useBtr": true, // if the BTR should spawn "friendlyFire": true, // if friendly fire is enabled "dynamicVExfils": false, // if vehicle exfils should dynamically scale with the amount of players "allowFreeCam": false, // if players can use the free cam while still alive "allowSpectateFreeCam": false, // whether players are forced to spectate other players or if they can move freely "blacklistedItems": [], // items that cannot be sent "forceSaveOnDeath": false, // if a player's inventory is force saved when they die, mitigating ALT+F4 cheating "mods": { "required": [], // required mods by the client "optional": [] // optional mods allowed to connect with }, "useInertia": true, // if inertia should be enabled, if disabled it will act as if you are not wearing anything "sharedQuestProgression": false, // if quest progression should be shared, affects shared XP options as well "canEditRaidSettings": true, // of clients can modify the raid settings before starting a raid "enableTransits": true, // if transits are enabled "anyoneCanStartRaid": false, // if anyone can click "START RAID" "allowNamePlates": true, // if player nameplates are allowed to be enabled by clients "randomLabyrinthSpawns": true, // if all players should have random spawns in Labyrinth "pmcFoundInRaid": true, // if all AI PMC gear should be found in raid "allowSpectateBots": true, // if players should be allowed to spectate bots in free cam "instantLoad": false, // if magazines should refill instantly in raid "fastLoad": true // if enabled magazines refill 5 bullets each tick rather than 5 in raid (disabled if instantLoad is enabled), "reviveConfig": { "enabled": false, // if the revive system should be enabled "headshotKills": false, // if headshots always kills "grenadesKills": false, // if grenades always kills "allowLooting": false, // if you can loot downed players "maxRevives": 3, // max revives per player, 0 = infinite, otherwise max 10 "bleedoutTime": 30, // time to bleed out while downed, min 10 seconds, max 600 "reviveTime": 3 // time it takes to revive a player, min 3 seconds, max 30 } }, "server": { "SPT": { "http": { "ip": "0.0.0.0", // the interface to listen on "port": 6969, // the port to host on "backendIp": "0.0.0.0", // the ip that is sent to clients to be used for requests "backendPort": 6969 // the port that is sent to clients to be used for requests }, "disableSPTChatBots": false // forces chat bots to be off }, "webhook": { "enabled": false, "name": "Fika Server", "avatarUrl": "https://github.com/project-fika/Fika-Server-CSharp/blob/main/FikaWebApp/wwwroot/images/FIKA_LOGO.png?raw=true", "url": "" }, "allowItemSending": true, // allows players to send items to each other "itemSendingStorageTime": 7, // how long before sent item mail expires "sentItemsLoseFIR": true, // if sent items lose their FIR status "launcherListAllProfiles": true, // if all accounts are listed in the launcher "sessionTimeout": 5, // how long in minutes it takes for a raid to be considered "lost" when not responding "showDevProfile": true, // if dev profiles are enabled "showNonStandardProfile": true, // if non-standard EFT profiles are enabled "adminIds": [], // list of profile ids allowed to interact with Mr Fika admin bot commands "apiKey": "" // apiKey for interacting with Fika API }, "natPunchServer": { "enable": false, // if the nat punching module is enabled "port": 6790 // the port to use }, "headless": { "profiles": { "amount": 0, // the amount of profiles to be generated / used "aliases": { "68eac997dc053e6fwhatever" : "NameOfHeadless" // headless profile uid : name you want to appear on raid host screen } // the aliases to be show when selecting a headless client }, "scripts": { "generate": true, // if the headless scripts should be generated "forceIp": "https://127.0.0.1:6969" // the URL the headless connects to }, "setLevelToAverageOfLobby": true, // use average level of all players when spawning bots on headless "restartAfterAmountOfRaids": 1 // if the headless should restart after X raids, 0 to disable }, "background": { "enable": true, // enables custom launcher background } } ``` -------------------------------- ### Restart Headless Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Schema for restarting a headless instance. Requires the profileId of the player. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Restart Headless Request", "description": "Schema for restarting the headless instance associated with a given player profile ID.", "type": "object", "properties": { "profileId": { "type": "string", "description": "The MongoDB ObjectID of the player whose headless instance should be restarted." } }, "required": ["profileId"], "additionalProperties": false } ``` -------------------------------- ### Docker Compose for Fika Web App Source: https://wiki.project-fika.com/advanced-features/web-app.md Use this docker-compose.yml to run the Fika web app standalone. Ensure you set the API_KEY and BASE_URL environment variables. ```yaml services: fikawebapp: image: lacyway/fikawebapp:latest container_name: fikawebapp restart: unless-stopped environment: - PORT=5000 # internal container port the app listens on - API_KEY= # API Key generated by the Fika server - BASE_URL=https://localhost:6969 # URL/IP to your Fika server ports: - "8080:5000" # Host port 8080 -> container port 5000, not needed when using reverse proxy command: #- "--reset-admin" # uncomment to reset admin password - "--quiet-logs" # comment out to receive verbose logs volumes: - ./webappdata:/app/data # data folder, use a volume to not lose data when updating ``` -------------------------------- ### Docker Compose with Traefik Reverse Proxy Source: https://wiki.project-fika.com/advanced-features/web-app.md This docker-compose.yml sets up Traefik as a reverse proxy for the Fika web app. It configures Traefik for HTTPS with Let's Encrypt and routes traffic to the web app. Remember to replace placeholders like your@email.net and your.address.net. ```yaml services: # ---------------------- # Traefik Reverse Proxy # ---------------------- traefik: image: traefik:v3 container_name: traefik restart: unless-stopped environment: - TZ=Etc/UTC ports: - 80:80 # HTTP - 443:443 # HTTPS command: # Basic settings - '--ping=true' - '--api=true' - '--api.dashboard=false' - '--api.insecure=false' - '--global.sendAnonymousUsage=false' - '--global.checkNewVersion=false' - '--log=true' - '--log.level=INFO' # Docker provider - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" # Entry points - "--entryPoints.web.address=:80" - "--entryPoints.websecure.address=:443" # TLS & Let's Encrypt - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true" - "--certificatesresolvers.letsencrypt.acme.email=your@email.net" - "--certificatesresolvers.letsencrypt.acme.storage=/config/acme.json" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" - "./traefik:/config" healthcheck: test: ["CMD", "traefik", "healthcheck", "--ping"] interval: 10s timeout: 5s retries: 3 # ---------------------- # Fika Web App # ---------------------- fikawebapp: image: lacyway/fikawebapp:latest container_name: fikawebapp restart: unless-stopped environment: - PORT=5000 # internal container port the app listens on - API_KEY= # API Key generated by the Fika server - BASE_URL=https://localhost:6969 # URL/IP to your Fika server command: #- "--reset-admin" # uncomment to reset admin password - "--quiet-logs" # comment out to receive verbose logs volumes: - ./webappdata:/app/data labels: - "traefik.enable=true" # Router - "traefik.http.routers.fikawebapp.rule=Host(`your.address.net`)" # can also be your external IP - "traefik.http.routers.fikawebapp.entrypoints=websecure" - "traefik.http.routers.fikawebapp.tls.certresolver=letsencrypt" # Service internal port - "traefik.http.services.fikawebapp.loadbalancer.server.port=5000" ``` -------------------------------- ### Disable Launcher Showing All Profiles Source: https://wiki.project-fika.com/faqandguides.md Change the 'launcherListAllProfiles' setting in fika.jsonc to false to prevent the launcher from displaying all profiles. This configuration is for the server host. ```json "launcherListAllProfiles": false ``` -------------------------------- ### Initialize Snapshotter Instance Source: https://wiki.project-fika.com/modding-fika.md Initialize a new instance of the Snapshotter generic class to manage snapshot data. Store this instance in your entity controller or state manager. ```csharp // store this in your entity controller or state manager private readonly Snapshotter _snapshotter = new(); ``` -------------------------------- ### Define Player Snapshot Data Structure Source: https://wiki.project-fika.com/modding-fika.md Define a struct that implements the ISnapshot interface for custom player data. Ensure it includes position, rotation, and time-related fields. ```csharp public struct PlayerSnapshot : ISnapshot { // ISnapshot implementation public double RemoteTime { get; set; } public double LocalTime { get; set; } // your custom data public Vector3 Position; public Quaternion Rotation; public PlayerSnapshot(Vector3 pos, Quaternion rot, double remote, double local) { Position = pos; Rotation = rot; RemoteTime = remote; LocalTime = local; } } ``` -------------------------------- ### Send Item to All Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Schema for sending items to multiple players. Requires item details and a list of profileIds. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Send Item To Multiple Players Request", "description": "Schema for sending items to multiple players using their MongoID profile IDs.", "type": "object", "properties": { "itemTpl": { "type": "string", "description": "Template ID of the item being sent." }, "amount": { "type": "integer", "minimum": 1, "description": "Number of items to send to each player." }, "message": { "type": "string", "maxLength": 255, "description": "Optional message sent with the item. Can be empty." }, "fir": { "type": "boolean", "description": "Whether the item is marked as Found In Raid (FIR)." }, "expirationDays": { "type": "integer", "minimum": 1, "description": "Number of days before the message expires." }, "profileIds": { "type": "array", "description": "List of MongoDB ObjectIDs representing the player profiles to send the items to.", "items": { "type": "string" }, "minItems": 1 } }, "required": [ "itemTpl", "amount", "message", "fir", "expirationDays", "profileIds" ], "additionalProperties": false } ``` -------------------------------- ### POST fika/api/restartheadless Source: https://wiki.project-fika.com/advanced-features/fika-api.md Restarts the headless instance associated with the given MongoID. ```APIDOC ## POST fika/api/restartheadless ### Description Restarts the headless instance associated with the given MongoID. ### Method POST ### Endpoint fika/api/restartheadless ### Parameters #### Request Body - **profileId** (string) - Required - The MongoDB ObjectID of the player whose headless instance should be restarted. ``` -------------------------------- ### Add Incoming Network Snapshot Source: https://wiki.project-fika.com/modding-fika.md Pass newly received network snapshots to the snapshotter using the AddSnapshot method. This method handles internal clock synchronization and jitter estimation. ```csharp public void OnPacketReceived(PlayerSnapshot newSnapshot) { // snapshot.LocalTime should be the exact time the packet hit the client // i highly recommend adding that through the constructor, and calling NetworkTimeSync.NetworkTime _snapshotter.AddSnapshot(in newSnapshot); } ``` -------------------------------- ### Register Packet with Handler Source: https://wiki.project-fika.com/modding-fika.md Use this method to register a packet type and specify an action to handle its reception. The packet type must implement INetSerializable and be instantiable. ```csharp /// /// Registers a packet to the . /// /// The packet type. /// The to run when receiving the packet. void RegisterPacket(Action handle) where T : INetSerializable, new(); ``` -------------------------------- ### Enable Quest Sharing in fika.jsonc Source: https://wiki.project-fika.com/faqandguides.md Modify the 'sharedQuestProgression' setting in fika.jsonc to enable quest sharing. This change requires the server host to restart the server. ```json "sharedQuestProgression": true ``` -------------------------------- ### Send General Packet Source: https://wiki.project-fika.com/modding-fika.md Use this method to send a packet to all connected peers or a single target. The 'broadcast' parameter determines if it's sent to all or a specific peer. Server instances always broadcast. ```csharp /// /// Sends a packet. /// /// The type of packet to send, which must implement . /// The packet instance to send, passed by reference. /// The delivery method (reliable, unreliable, etc.) to use for sending the packet. /// If , the packet will be sent to multiple recipients; otherwise, it will be sent to a single target (server is always broadcast). void SendData(ref T packet, DeliveryMethod deliveryMethod, bool broadcast = false) where T : INetSerializable; ``` -------------------------------- ### Register Packet with Handler and User Data Source: https://wiki.project-fika.com/modding-fika.md This method registers a packet type along with associated user data and a handler action. It is particularly useful on the FikaServer, as it provides access to the NetPeer. ```csharp /// <summary> /// Registers a packet to the <see cref="NetPacketProcessor"/> with user data. /// </summary> /// <typeparam name="T">The packet type.</typeparam> /// <typeparam name="TUserData">The user data type.</typeparam> /// <param name="handle">The <see cref="Action"/> to run when receiving the packet.</param> void RegisterPacket<T, TUserData>(Action<T, TUserData> handle) where T : INetSerializable, new(); ``` -------------------------------- ### fika/api/headless Source: https://wiki.project-fika.com/advanced-features/fika-api.md Retrieves a list of all active headless clients. This endpoint provides information about headless clients, including their profile ID, nickname, state, and the number of players associated with them. ```APIDOC ## GET fika/api/headless ### Description Returns all active headless clients. This endpoint lists the current headless clients connected to the server, detailing their status and player count. ### Method GET ### Endpoint /fika/api/headless ### Response #### Success Response (200) - **headlessClients** (array) - An array of objects, where each object represents an active headless client. - **profileId** (string) - The unique identifier for the headless client's profile. - **nickname** (string) - The display name or nickname of the headless client. - **state** (integer) - The current state of the headless client (0 = Ready, 1 = NotReady). - **players** (integer) - The number of players currently associated with this headless client. ### Response Example ```json { "headlessClients": [ { "profileId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "nickname": "HeadlessBot1", "state": 0, "players": 1 } ] } ``` ``` -------------------------------- ### Server.SendReusableToAll Source: https://wiki.project-fika.com/modding-fika.md Sends a reusable packet from the server to all connected peers, with an option to exclude a specific peer. ```APIDOC ## Server.SendReusableToAll ### Description Sends a reusable packet from the server to all connected peers, with an option to exclude a specific peer. ### Method void ### Parameters #### Type Parameters - **T**: The type of packet to send, which must implement `IReusable` and be a class with a parameterless constructor. #### Method Parameters - **packet** (T) - The packet instance to send. - **deliveryMethod** (DeliveryMethod) - The delivery method to use. - **peerToExlude** (NetPeer) - Optional. The peer to exclude from receiving the packet. Defaults to `null`. ``` -------------------------------- ### Server Send Reusable Packet to All Source: https://wiki.project-fika.com/modding-fika.md A server-specific method to send a reusable packet to all connected peers, with an option to exclude a specific peer. ```csharp public void SendReusableToAll(T packet, DeliveryMethod deliveryMethod, NetPeer peerToExlude = null) where T : class, IReusable, new() ``` -------------------------------- ### POST fika/api/logout Source: https://wiki.project-fika.com/advanced-features/fika-api.md Logs out the given MongoID from the game. ```APIDOC ## POST fika/api/logout ### Description Logs out the given MongoID from the game. ### Method POST ### Endpoint fika/api/logout ### Parameters #### Request Body - **profileId** (string) - Required - The MongoDB ObjectID of the player to log out. ``` -------------------------------- ### Logout Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Schema for logging out a player using their MongoID. Requires the profileId. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Logout Request", "description": "Schema for logging out a player from the game using their MongoID profile ID.", "type": "object", "properties": { "profileId": { "type": "string", "description": "The MongoDB ObjectID of the player to log out." } }, "required": ["profileId"], "additionalProperties": false } ``` -------------------------------- ### Send Item Schema Source: https://wiki.project-fika.com/advanced-features/fika-api.md Schema for sending a single item to a player. Includes item details, message, and FIR status. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Send Item Request", "description": "Schema for sending an item to a player with a given MongoID profile ID.", "type": "object", "properties": { "itemTpl": { "type": "string", "description": "Template ID of the item being sent." }, "amount": { "type": "integer", "minimum": 1, "description": "Number of items to send." }, "message": { "type": "string", "maxLength": 255, "description": "Optional message sent with the item. Can be empty." }, "fir": { "type": "boolean", "description": "Whether the item is marked as Found In Raid (FIR)." }, "expirationDays": { "type": "integer", "minimum": 1, "description": "Number of days before the message expires." }, "profileId": { "type": "string", "description": "The MongoDB ObjectID of the player to send the item to." } }, "required": [ "itemTpl", "amount", "message", "fir", "expirationDays", "profileId" ], "additionalProperties": false } ``` -------------------------------- ### Enable SPT Chatbots Source: https://wiki.project-fika.com/faqandguides.md Set 'disableSPTChatBots' to false in fika.jsonc to enable SPT chatbots. This configuration must be applied by the server host. ```json "disableSPTChatBots": false ``` -------------------------------- ### POST fika/api/senditem Source: https://wiki.project-fika.com/advanced-features/fika-api.md Sends a specified amount of an item to a given player's MongoID. Includes options for Found In Raid status, expiration, and an optional message. ```APIDOC ## POST fika/api/senditem ### Description Sends a specified amount of an item to a given player's MongoID. Includes options for Found In Raid status, expiration, and an optional message. ### Method POST ### Endpoint fika/api/senditem ### Parameters #### Request Body - **itemTpl** (string) - Required - Template ID of the item being sent. - **amount** (integer) - Required - Number of items to send. - **message** (string) - Required - Optional message sent with the item. Can be empty. - **fir** (boolean) - Required - Whether the item is marked as Found In Raid (FIR). - **expirationDays** (integer) - Required - Number of days before the message expires. - **profileId** (string) - Required - The MongoDB ObjectID of the player to send the item to. ``` -------------------------------- ### Subscribe to Fika Event Source: https://wiki.project-fika.com/modding-fika.md Use this method to register a callback function that will be executed when a specific Fika event occurs. Ensure the event type TEvent inherits from FikaEvent. ```csharp /// /// Subscribes a callback to a specific type of Fika event. /// /// The type of the event to subscribe to. /// The callback to invoke when the event is dispatched. public static void SubscribeEvent(Action callback) where TEvent : FikaEvent ``` -------------------------------- ### POST fika/api/fleaban Source: https://wiki.project-fika.com/advanced-features/fika-api.md Bans a player from the flea market for a specified number of days. A value of 0 for amountOfDays results in an infinite ban. ```APIDOC ## POST fika/api/fleaban ### Description Bans a player from the flea market for a specified number of days. A value of 0 for amountOfDays results in an infinite ban. ### Method POST ### Endpoint fika/api/fleaban ### Parameters #### Request Body - **profileId** (string) - Required - Unique identifier for the player's profile. - **amountOfDays** (integer) - Required - Number of days the player is banned. 0 means the ban is infinite. ``` -------------------------------- ### SubscribeEvent Source: https://wiki.project-fika.com/modding-fika.md Subscribes a callback function to a specific Fika event. This allows your mod to execute code when a particular event occurs during the raid. ```APIDOC ## SubscribeEvent ### Description Subscribes a callback to a specific type of Fika event. ### Method Signature `public static void SubscribeEvent(Action callback) where TEvent : FikaEvent` ### Parameters #### Type Parameters - **TEvent**: The type of the event to subscribe to. Must inherit from `FikaEvent`. #### Parameters - **callback**: The callback `Action` to invoke when the event is dispatched. ``` -------------------------------- ### Send Packet to Specific Peer Source: https://wiki.project-fika.com/modding-fika.md This method is used to send a packet directly to a specific NetPeer. It should primarily be used by the FikaServer, as a FikaClient only has a single NetPeer (the server). ```csharp /// /// Sends a packet of data directly to a specific peer. /// /// The type of packet to send, which must implement . /// The packet instance to send, passed by reference. /// The delivery method (reliable, unreliable, etc.) to use for sending the packet. /// The target that will receive the packet. /// /// Should only be used as a , since a only has one . /// void SendDataToPeer(ref T packet, DeliveryMethod deliveryMethod, NetPeer peer) where T : INetSerializable; ``` -------------------------------- ### Server Heartbeat Check Source: https://wiki.project-fika.com/advanced-features/fika-api.md Checks if the Fika server is running. This endpoint is primarily used by the WebApp for status monitoring. ```text ### fika/api/heartbeat Checks whether the server is running. Primarily used by the WebApp. ``` -------------------------------- ### POST fika/api/senditemtoall Source: https://wiki.project-fika.com/advanced-features/fika-api.md Sends a specified amount of an item to multiple players identified by their MongoID profile IDs. Supports Found In Raid status, expiration, and an optional message. ```APIDOC ## POST fika/api/senditemtoall ### Description Sends a specified amount of an item to multiple players identified by their MongoID profile IDs. Supports Found In Raid status, expiration, and an optional message. ### Method POST ### Endpoint fika/api/senditemtoall ### Parameters #### Request Body - **itemTpl** (string) - Required - Template ID of the item being sent. - **amount** (integer) - Required - Number of items to send to each player. - **message** (string) - Required - Optional message sent with the item. Can be empty. - **fir** (boolean) - Required - Whether the item is marked as Found In Raid (FIR). - **expirationDays** (integer) - Required - Number of days before the message expires. - **profileIds** (array of strings) - Required - List of MongoDB ObjectIDs representing the player profiles to send the items to. ``` -------------------------------- ### Enable NAT Punching in Fika Server Configuration Source: https://wiki.project-fika.com/advanced-features/nat-punching/self-hosted-nat-punch-server.md Modify the Fika server configuration to enable the NAT Punch Server. This involves editing the 'fika.jsonc' file and setting the 'enable' property within the 'natPunchServer' section to 'true'. ```json { "natPunchServer": { "enable": true } } ```