### postFastFillerConfig Function (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Handles configuration or setup that occurs after the fast filler system is initialized. It returns void and takes no parameters. ```typescript private postFastFillerConfig(): void; ``` -------------------------------- ### internationalPreTick Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/StatsManager.html Performs setup operations at the beginning of an international tick. ```APIDOC ## internationalPreTick ### Description Performs setup operations at the beginning of an international tick. ### Method N/A (Function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) Returns void. #### Response Example N/A ``` -------------------------------- ### Install Project Dependencies (Shell) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/README.md This command installs all the necessary Node.js dependencies required to run the Screeps bot. It should be executed from the root directory of the project after cloning or forking the repository. ```bash npm i ``` -------------------------------- ### Running a Private Server Instance Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/index.html This command starts a local private Screeps server for testing and development. It also provides access to a local Grafana instance for performance monitoring. The specific ports and access details are provided in the documentation. ```shell npm run server ``` -------------------------------- ### RemotesManager: preTickRun Method Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotesManager.html Executes setup logic before the main game tick begins. This method performs necessary preparations for the upcoming tick. ```typescript preTickRun(): void ``` -------------------------------- ### Performance Monitoring in TypeScript Source: https://context7.com/the-international-screeps-bot/the-international-open-source/llms.txt This snippet provides examples of performance monitoring within The International Screeps Bot using TypeScript. It shows how to check CPU usage, bucket level, and heap memory. Additionally, it demonstrates how to iterate through and display automatically tracked per-room and per-role CPU usage statistics. ```typescript // Check CPU usage console.log(`CPU used: ${Game.cpu.getUsed()}/${Game.cpu.limit}`) console.log(`Bucket: ${Game.cpu.bucket}`) // Heap usage const heapPercent = global.usedHeap() console.log(`Heap: ${heapPercent}`) // Per-room CPU (automatically tracked) for (const roomName in Memory.stats.rooms) { const roomStats = Memory.stats.rooms[roomName] console.log(`${roomName} CPU: ${roomStats.cpu}`) } // Per-role CPU (automatically tracked) for (const role in Memory.stats.roles) { const roleStats = Memory.stats.roles[role] console.log(`${role}: ${roleStats.count} creeps, ${roleStats.cpu} CPU`) } ``` -------------------------------- ### Basic Settings Configuration in TypeScript Source: https://context7.com/the-international-screeps-bot/the-international-open-source/llms.txt This TypeScript code defines the global settings object for the bot, allowing configuration of various aspects including player relationships, economic parameters, automation behavior, security settings, inter-bot communication, and debugging options. It serves as the primary configuration file, typically created from an example file. ```typescript // Create src/settings.ts from src/settings.example.ts global.settings = { // Breaking version for migration system breakingVersion: 129, // Player relationship management allies: ['MarvinTMB', 'FriendlyPlayer'], nonAggressionPlayers: ['NeutralPlayer'], tradeBlacklist: ['HostilePlayer'], // Economic settings pixelSelling: false, // Auto-sell pixels on market pixelGeneration: true, // Generate pixels from CPU marketUsage: true, // Use market for trading // Automation behavior autoClaim: true, // Auto-expand to nearby rooms autoAttack: false, // Auto-attack hostile rooms // Security publicRamparts: false, // Allow non-allies through ramparts // Inter-bot communication allyCommunication: true, // Share data via segments allySegmentID: 90, // Segment for ally data // Debugging logging: 1, // Log every N ticks (0 = off) debugLogging: false, // Verbose debug logs creepSay: true, // Creeps display speech bubbles creepChant: ['Workers', 'of', 'Screeps', 'unite!'], // Features errorExporting: true, // Export errors for analysis structureMigration: true, // Auto-migrate old bases season: false, // Season server optimizations roomVisuals: true, // Display room visuals } ``` -------------------------------- ### Check Node Version (Shell) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/README.md This command checks the currently installed Node.js version on your system. It's a prerequisite for installing project dependencies and ensuring compatibility, especially when using tools like NVM for version management. ```powershell node -v ``` -------------------------------- ### Method: choosePlan Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html This method is used to choose a plan for construction or expansion. ```APIDOC ## GET /choosePlan ### Description This method is used to choose a plan for construction or expansion. ### Method GET ### Endpoint /choosePlan ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **void** - This method does not return any value. ``` -------------------------------- ### BasePlans Class Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/BasePlans.html Documentation for the BasePlans class, including its constructor, properties, and methods. ```APIDOC ## BasePlans Class ### Description Represents base plans for Screeps. ### Constructor `constructor(map?: literal type)` **Parameters**: - **map** (literal type) - Optional - The map for the base plan. ### Properties - **map** (literal type) ### Methods #### `get(packedCoord: string)` Retrieves information based on a packed coordinate. **Parameters**: - **packedCoord** (string) - Required - The packed coordinate. **Returns**: - `{}` #### `getXY(x: number, y: number)` Retrieves information based on X and Y coordinates. **Parameters**: - **x** (number) - Required - The x-coordinate. - **y** (number) - Required - The y-coordinate. **Returns**: - `{}` #### `pack()` Packs the current base plan into a string. **Returns**: - `string` #### `unpack(packedMap: string)` Static method to unpack a packed base plan string. **Parameters**: - **packedMap** (string) - Required - The packed base plan string. **Returns**: - `BasePlans` ``` -------------------------------- ### findClosestRoomName API Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Finds the closest room name starting from a given room. ```APIDOC ## findClosestRoomName ### Description Finds the closest room name starting from a specified room. ### Method N/A (This appears to be a function call within the game's simulation, not a REST API endpoint) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript // Example usage within the Screeps game environment const startRoom = "W1N1"; const targetRooms = ["W2N1", "W1N2", "E1N1"]; const closestRoom = findClosestRoomName(startRoom, targetRooms); ``` ### Response #### Success Response (200) - **roomName** (string) - The name of the closest room. #### Response Example ```json { "roomName": "W2N1" } ``` ``` -------------------------------- ### Room Accessors API Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RoomManager.html This section details the GET endpoints for accessing various room-related data. ```APIDOC ## GET Room Data Endpoints ### Description These endpoints provide access to different types of data related to a room, such as its structures, creeps, energy sources, and planned constructions. ### Method GET ### Endpoints - `/anchor` - `/mineral` - `/nukeTargetCoords` - `/stampAnchors` - `/communeSources` - `/remoteSources` - `/sourceHarvestPositions` - `/communeSourceHarvestPositions` - `/remoteSourceHarvestPositions` - `/communeSourcePaths` - `/remoteSourcePaths` - `/centerUpgradePos` - `/upgradePositions` - `/mineralHarvestPositions` - `/generalRepairStructures` - `/remoteControllerPositions` - `/usedControllerCoords` - `/remoteControllerPath` - `/usedPositions` - `/cSiteTarget` - `/usedStationaryCoords` - `/structureUpdate` - `/structureCoords` - `/structures` - `/cSiteUpdate` - `/cSiteCoords` - `/cSites` - `/enemyCreepPositions` - `/enemySquadData` - `/events` - `/deadCreepNames` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **data** (any) - The requested room-specific data. #### Response Example (Response format varies depending on the specific endpoint called. For example, `/structures` might return an array of structure objects, while `/anchor` might return a position object.) ``` -------------------------------- ### Spawn Management Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/SpawningStructuresManager.html Methods for organizing and running spawns. ```APIDOC ## organizeSpawns ### Description Organizes spawns by assigning spawn IDs to creeps and managing active/inactive spawns. ### Method Public ### Endpoint N/A (Internal Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) Returns void. #### Response Example ```json {} ``` ``` ```APIDOC ## runSpawning ### Description Executes the spawning process. ### Method Private ### Endpoint N/A (Internal Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) Returns void. #### Response Example ```json {} ``` ``` ```APIDOC ## runSpawnRequest ### Description Runs a specific spawn request identified by its index. ### Method Private ### Endpoint N/A (Internal Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "index": 0 } ``` ### Response #### Success Response (200) Returns void or a specific value depending on implementation. #### Response Example ```json {} ``` ``` -------------------------------- ### Coordinate Range Functions Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Functions for iterating over coordinates within a specified range around a starting point. ```APIDOC ## forCoordsInRange ### Description Iterates over coordinates within a specified range around a starting coordinate. ### Method Not applicable (function) ### Endpoint Not applicable (function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (callback function is executed) #### Response Example None ``` ```APIDOC ## forRoomNamesAroundRangeXY ### Description Iterates over room names within a specified range around given XY coordinates. ### Method Not applicable (function) ### Endpoint Not applicable (function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (callback function is executed) #### Response Example None ``` ```APIDOC ## forRoomNamesInRangeXY ### Description Iterates over room names within a specified range around given XY coordinates. ### Method Not applicable (function) ### Endpoint Not applicable (function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None (callback function is executed) #### Response Example None ``` -------------------------------- ### run Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RoomVisualsManager.html Executes the main loop or primary operations of the RoomVisualsManager. This is a public method intended to be called repeatedly. ```APIDOC ## POST /run ### Description Executes the main loop or primary operations of the RoomVisualsManager. This is a public method intended to be called repeatedly. ### Method POST ### Endpoint /run ### Parameters #### Request Body None ### Request Example {} ### Response #### Success Response (200) - **void** - This method does not return any value. ``` -------------------------------- ### Iterate Adjacent Coordinates Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Executes a given function for each coordinate adjacent to a starting coordinate. This is useful for exploring immediate surroundings. ```javascript forAdjacentCoords(startCoord, f) ``` -------------------------------- ### onboardingRamparts Function (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Handles the placement or management of ramparts during the initial stages of a colony. It returns void and takes no arguments. ```typescript private onboardingRamparts(): void; ``` -------------------------------- ### AllyVanguard Class Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/AllyVanguard.html Documentation for the AllyVanguard class, including its constructor, methods, and their functionalities. ```APIDOC ## AllyVanguard Class ### Description Represents an advanced creep role for managing allied vanguard operations in Screeps. ### File `src/room/creeps/roleManagers/international/allyVanguard.ts` ### Extends `Creep` ### Constructor #### `constructor(creepID: Id)` Initializes a new instance of the `AllyVanguard` class. ##### Parameters - **creepID** (`Id`) - Required - The unique identifier for the creep. ### Methods #### `buildRoom()` Builds a spawn in the creep's commune work request. - **Type**: Optional - **Returns**: `void` #### `findRemote()` Finds a remote room or target. - **Type**: Optional - **Returns**: `boolean` #### `getEnergyFromRemote()` Retrieves energy from a remote source. - **Type**: Optional - **Returns**: `void` #### `getEnergyFromRoom()` Retrieves energy from the current room's sources. - **Type**: Optional - **Returns**: `boolean` #### `preTickManager()` Manages creep actions at the beginning of each tick. - **Type**: Required - **Returns**: `void` #### `roleManager(room: Room, creepsOfRole: string[])` Manages the behavior of all creeps with the 'allyVanguard' role within a given room. - **Type**: Static, Required - **Parameters**: - **room** (`Room`) - Required - The room to manage. - **creepsOfRole** (`string[]`) - Required - An array of creep names belonging to this role. - **Returns**: `void` #### `travelToSource(sourceIndex: number)` Navigates the creep to a specified energy source. - **Type**: Optional - **Parameters**: - **sourceIndex** (`number`) - Required - The index of the energy source to travel to. - **Returns**: `boolean` ``` -------------------------------- ### TypeScript: Visualize Plan by Index Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html Renders a specific construction plan identified by its index. This is useful for debugging and understanding the bot's planning capabilities. ```typescript visualizePlan(planIndex: number): void; ``` -------------------------------- ### Iterate Coordinates within Range Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Executes a given function for all coordinates within a specified range of a starting coordinate. This is useful for area-of-effect calculations or targeting. ```javascript forCoordsAroundRange(startCoord, range, f) ``` -------------------------------- ### Initialize Screeps Bot Run Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/AllyRequestManager.html The initRun method is called before any requests are made to configure required values for the Screeps bot. It returns void. ```typescript initRun(): void; ``` -------------------------------- ### Find Closest Room Name Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Determines the closest room name starting from a given room. This function is essential for navigation and strategic planning in Screeps. ```javascript function findClosestRoomName(start, targets) { // Implementation details would go here return "closestRoom"; } ``` -------------------------------- ### Power Tasks and Room Logistics Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/SpawningStructuresManager.html Methods for creating power tasks and managing room logistics. ```APIDOC ## createPowerTasks ### Description Creates power tasks for the game. ### Method Public ### Endpoint N/A (Internal Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) Returns void. #### Response Example ```json {} ``` ``` ```APIDOC ## createRoomLogisticsRequests ### Description Creates logistics requests for managing room resources. ### Method Public ### Endpoint N/A (Internal Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) Returns void. #### Response Example ```json {} ``` ``` -------------------------------- ### FastFiller Class Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/FastFiller.html Detailed documentation for the FastFiller class, including its constructor and methods. ```APIDOC ## FastFiller Class ### Description Represents a FastFiller creep, extending the base Creep class. This class manages the logic for creeps performing the fast filler role. ### File `src/room/creeps/roleManagers/commune/fastFiller.ts` ### Extends `Creep` ### Constructor `constructor(creepID: Id)` #### Parameters - **creepID** (`Id`) - No - The unique identifier for the creep. ### Methods #### Optional `fillFastFiller()` - **Description**: Attempts to fill a target with energy. - **Returns**: `boolean` - True if the action was successful, false otherwise. #### Optional `findFastFillerPos()` - **Description**: Finds a suitable position for the fast filler creep. - **Returns**: `any` - The position data. #### Static `roleManager(room: Room, creepsOfRole: string[])` - **Description**: Manages the behavior of all creeps with the fast filler role within a room. - **Parameters**: - **room** (`Room`) - No - The room object to manage. - **creepsOfRole** (`string[]`) - No - An array of creep IDs belonging to this role. - **Returns**: `void` #### Optional `travelToFastFiller()` - **Description**: Handles the movement logic for the fast filler creep. - **Returns**: `boolean` - True if the creep successfully moved, false otherwise. ``` -------------------------------- ### Interface: FindDynamicStampAnchorArgs Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/interfaces/FindDynamicStampAnchorArgs-1.html This interface defines the arguments for finding a dynamic stamp anchor. It includes optional properties for minimum avoidance, stamp details, and starting coordinates. ```APIDOC ## Interface FindDynamicStampAnchorArgs ### Description Defines the arguments for finding a dynamic stamp anchor. ### Properties #### minAvoid - **minAvoid** (number) - Optional - The minimum avoidance value. #### stamp - **stamp** (Stamp) - Required - The stamp object. #### startCoords - **startCoords** (Coord[]) - Required - An array of starting coordinates. ``` -------------------------------- ### Get Hits Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/Quad.html Retrieves the current hit points of a unit. This is a fundamental metric for survival and combat engagement. The function returns the current HP, likely as a number. ```typescript get hits() ``` -------------------------------- ### RoomVisual Utilities Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Contains utility functions for manipulating and calculating points for room visuals. ```APIDOC ## RoomVisual Utilities ### Description Provides geometric utility functions for use with RoomVisuals in Screeps. ### Functions - **calculateFactoryLevelGapsPoly()**: Calculates gaps for factory level polygons. - **relPoly(x, y, poly)**: Relocates a polygon by a given offset. - **Parameters:** - `x` (number) - The x-coordinate offset. - `y` (number) - The y-coordinate offset. - `poly` (Poly) - The polygon to relocate. - **rotate(x, y, s, c, px, py)**: Rotates a point around a pivot. - **Parameters:** - `x` (number) - The x-coordinate of the point. - `y` (number) - The y-coordinate of the point. - `s` (number) - The sine of the rotation angle. - `c` (number) - The cosine of the rotation angle. - `px` (number) - The x-coordinate of the pivot point. - `py` (number) - The y-coordinate of the pivot point. ``` -------------------------------- ### Find Coordinates In Range (XY) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Calculates and returns an array of coordinates within a specified range from a starting X and Y coordinate. This function employs the Half Manhattan distance. ```javascript function findCoordsInRangeXY(startX, startY, range) { // Implementation details would go here return [{ x: 0, y: 0 }]; } ``` -------------------------------- ### Get Defence Strength Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/Quad.html Retrieves the defense strength of a unit. This value is important for understanding a unit's resilience against incoming attacks. It likely returns a numerical value. ```typescript get defenceStrength() ``` -------------------------------- ### RoomVisual.test Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/interfaces/RoomVisual.html Executes a test action on the RoomVisual. The specific functionality is not detailed. ```APIDOC ## test ### Description Executes a test action on the RoomVisual. The exact purpose or output of this test is not specified. ### Method [Not specified, likely a method of RoomVisual] ### Endpoint [Not applicable] ### Parameters None ### Request Example ```json // No request body or parameters ``` ### Response #### Success Response (200) - **RoomVisual** - Returns the RoomVisual object itself, potentially after modification. #### Response Example ```json // Returns the RoomVisual instance ``` ``` -------------------------------- ### isCloseToExit Function (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Determines if a given coordinate is within a specified range of an exit, while avoiding walls. It uses a flooding algorithm. It takes a starting coordinate and a range (number) as input and returns a boolean. ```typescript private isCloseToExit(startCoord: Coord, range: number): boolean; ``` -------------------------------- ### DynamicSquad Class Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/DynamicSquad.html This section provides detailed documentation for the DynamicSquad class, including its constructor, properties, methods, and accessors. ```APIDOC ## DynamicSquad Class ### Description A squad of a semi-dynamic size. Accepts at most 1 of each: antifaRangedAttacker, antifaAttacker, antifaHealer, antifaDismantler. ### Constructor `constructor(memberNames: string[])` **Parameters :** | Name | Type | Optional | |-------------|----------|----------| | memberNames | `string[]` | No | ### Properties * **_combatStrength** (`CombatStrength`) * **leader** (`Antifa`) * **memberNames** (`string[]`) * Default value: `[]` * **members** (`Antifa[]`) * Description: All squad members, where index 0 is the leader. * Default value: `[]` * **membersByType** (`Partial`) * **moveType** (`SquadMoveTypes`) ### Methods * **advancedHeal**(): `void` * Description: Private method for advanced healing. * **combatAttackDuoGetInFormation**(attacker: `Creep`, healer: `Creep`): `any` * Description: Manages formation for combat attack duos. * **createMoveRequest**(opts: `MoveRequestOpts`, moveLeader?): `void` * Description: Creates a move request for the squad. * Default moveLeader: `this.leader` * **getInFormation**(): `any` * Description: Puts the squad into formation. * **holdFormation**(): `void` * Description: Holds the current formation. * **rangedAttackStructures**(creep: `Creep`): `boolean` * Description: Executes ranged attacks on structures. * **run**(): `void` * Description: Executes the main logic for the squad. * **runCombat**(): `void` * Description: Executes combat routines for the squad. * **runCombatAttackDuo**(): `void` * Description: Executes combat routines for attack duos. * **runCombatDismantler**(): `boolean` * Description: Executes combat routines for dismantlers. * **runCombatRangedAttacker**(): `boolean` * Description: Executes combat routines for ranged attackers. * **runCombatRoom**(): `boolean` * Description: Executes combat routines within the room. * **setMoveType**(type: `SquadMoveTypes`): `void` * Description: Sets the movement type for the squad. ### Accessors * **combatStrength** (get): Returns the combat strength of the squad. * **canMove** (get): Returns whether the squad can move. ``` -------------------------------- ### Get Combat Strength Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/Quad.html Retrieves the combat strength of a unit. This value is typically used to assess offensive capabilities. No specific dependencies are mentioned, and the function likely returns a numerical value representing strength. ```typescript get combatStrength() ``` -------------------------------- ### RoomManager Constructor Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html This section details the constructor for the RoomManager class, outlining the necessary parameters for initialization. ```APIDOC ## RoomManager Constructor ### Description Initializes a new instance of the RoomManager class. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript const roomManager = new RoomManager(yourRoomManagerInstance); ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ### Constructor Parameters - **roomManager** (RoomManager) - Required - An instance of the RoomManager class. ``` -------------------------------- ### Screeps Bot: Get Amount of Resource in Room (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/TerminalManager.html Retrieves the amount of a specific resource within a given room. It takes a resource type and a room name as input and returns any. ```typescript /** * Retrieves the amount of a specific resource within a given room. * @param resource The type of resource to check (e.g., RESOURCE_ENERGY). * @param roomName The name of the room to check. * @returns The amount of the specified resource in the room. */ amountInRoom(resource: ResourceConstant, roomName: string): any; ``` -------------------------------- ### Logging Utilities Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/functions.html Functions for custom logging with styling. ```APIDOC ## POST /utils/customLog ### Description Outputs console logs with custom HTML and CSS styling for better readability. ### Method POST ### Endpoint /utils/customLog ### Parameters #### Request Body - **title** (any) - Required - The title of the log entry. - **message** (any) - Optional - The main content of the log message. - **opts** (CustomLogOpts) - Optional - Additional options for customizing the log's appearance and behavior. ### Request Example ```json { "title": "Important Update", "message": "Creep count has reached a new high.", "opts": { "color": "green" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the logging operation. #### Response Example ```json { "status": "Logged successfully" } ``` ``` -------------------------------- ### HaulRequestManager: preTickRun Method Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/HaulRequestManager.html Executes pre-tick logic for the HaulRequestManager. This method is intended to be called at the beginning of each tick to perform necessary setup or checks before other operations. It returns void, indicating no specific value is returned. ```typescript preTickRun() ``` -------------------------------- ### Method: fastFiller Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html This method handles the fast filler logic for resource management. ```APIDOC ## GET /fastFiller ### Description This method handles the fast filler logic for resource management. ### Method GET ### Endpoint /fastFiller ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **any** - Returns any value, likely related to the fast filler's operation. ``` -------------------------------- ### MineralHarvester Pre-Tick Manager Method Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/MineralHarvester.html The preTickManager method is executed at the beginning of each tick. It handles any setup or management tasks required for the MineralHarvester before the main game logic for the tick is processed. It returns void. ```typescript preTickManager(): void ``` -------------------------------- ### Method: gridExtensionSourcePaths Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html Calculates paths for grid extension sources. ```APIDOC ## GET /gridExtensionSourcePaths ### Description Calculates paths for grid extension sources. ### Method GET ### Endpoint /gridExtensionSourcePaths ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **void** - This method does not return any value. ``` -------------------------------- ### Visualize Plan - visualizePlan() Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Visualizes a specific construction plan. This private function returns void and is likely used for displaying proposed or historical building layouts. ```typescript private visualizePlan(): void ``` -------------------------------- ### Get Actionable Walls Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html Returns a list of constructed walls that have hit points, indicating they are actionable for repair or other purposes. It filters the `constructedWall` structures based on their `hits` property. Dependencies include `roomManager.structures.constructedWall`. ```javascript get() { if (this._actionableWalls) return this._actionableWalls return (this._actionableWalls = this.roomManager.structures.constructedWall.filter( function (structure) { return structure.hits }, )) } ``` -------------------------------- ### MemHack Class for Memory Management (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/MemHack.html The MemHack class is designed to optimize memory usage in Screeps. It should be imported before the main game loop and its run() method called at the start of each tick. This implementation is adapted from the ZeSwarm project. ```typescript class MemHack { memory: Memory | undefined; constructor() { this.memory = undefined; } run(): void { // Implementation details for memory optimization would go here. // This is a placeholder. } } ``` -------------------------------- ### Method: generateGrid Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html Generates the game grid. ```APIDOC ## GET /generateGrid ### Description Generates the game grid. ### Method GET ### Endpoint /generateGrid ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **void** - This method does not return any value. ``` -------------------------------- ### Get Spawning Structures in Screeps Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html This getter retrieves a list of structures that can be used for spawning creeps, including spawns and extensions. It filters these structures to include only those that are actionable based on the room's current level. ```typescript spawningStructures: { get() { if (this._spawningStructures) return this._spawningStructures; const anchor = this.roomManager.anchor; if (!anchor) throw Error('No anchor for spawning structures ' + this.name); this._spawningStructures = [...this.roomManager.structures.spawn, ...this.roomManager.structures.extension, ].filter(structure => structure.RCLActionable); return this._spawningStructures; }, } ``` -------------------------------- ### Visualize Current Plan - visualizeCurrentPlan() Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Visualizes the currently active construction plan on the game map. This private utility function returns void and is useful for debugging and monitoring. ```typescript private visualizeCurrentPlan(): void ``` -------------------------------- ### PowerCreepRoleManager Class Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/PowerCreepRoleManager.html Documentation for the PowerCreepRoleManager class, including its constructor, properties, and methods. ```APIDOC ## Class: PowerCreepRoleManager ### Description Manages roles for Power Creeps within a room. ### Constructor `constructor(roomManager: RoomManager)` #### Parameters * **roomManager** (RoomManager) - Required - The RoomManager instance associated with this PowerCreepRoleManager. ### Properties * **roomManager** (RoomManager) - The RoomManager instance. ### Methods #### Public `run()` ##### Description Executes the main logic for the PowerCreepRoleManager. ##### Returns `void` #### Private `runManager(className: PowerClassConstant)` ##### Description Runs the manager for a specific Power Creep class. ##### Parameters * **className** (PowerClassConstant) - Required - The constant representing the Power Creep class to run. ##### Returns `void` ``` -------------------------------- ### Screeps Bot: Get Best Sell Price (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/TerminalManager.html Finds the best available price to sell a specific resource, considering the current energy price. It takes the resource type and energy price as input and returns any. ```typescript /** * Finds the best available price to sell a specific resource, considering the current energy price. * @param resource The type of resource to sell. * @param energyPrice The current price of energy. * @returns The best sell price found. */ getBestSell(resource: ResourceConstant, energyPrice: number): any; ``` -------------------------------- ### Run Min Cut - runMinCut() Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Executes the minimum cut algorithm, likely for pathfinding or resource allocation. This private function returns void. ```typescript private runMinCut(): void ``` -------------------------------- ### Screeps Bot: Get Best Buy Price (TypeScript) Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/TerminalManager.html Finds the best available price to buy a specific resource, considering the current energy price. It takes the resource type and energy price as input and returns any. ```typescript /** * Finds the best available price to buy a specific resource, considering the current energy price. * @param resource The type of resource to buy. * @param energyPrice The current price of energy. * @returns The best buy price found. */ getBestBuy(resource: ResourceConstant, energyPrice: number): any; ``` -------------------------------- ### Get All Dropped Resources Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html Fetches all dropped resources in the room, excluding those in enemy threat zones. This getter uses `FIND_DROPPED_RESOURCES` and applies a filter to exclude resources based on enemy threat coordinates. Dependencies include `packCoord`. ```javascript get() { if (this._droppedResources) return this._droppedResources return (this._droppedResources = this.find(FIND_DROPPED_RESOURCES, { filter: resource => !resource.room.enemyThreatCoords.has(packCoord(resource.pos)), })) } ``` -------------------------------- ### Private Methods Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/CommunePlanner.html Documentation for various private methods used within the Screeps bot, including functions for avoiding minerals and sources, planning, finding optimal positions, and manipulating structures. ```APIDOC ## Private Methods ### `avoidMineral()` #### Description Manages logic to avoid mineral sources. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `avoidSources()` #### Description Manages logic to avoid energy sources. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `choosePlan(planAttempts: BasePlanAttempt[])` #### Description Selects the best plan from a list of attempts. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **planAttempts** (BasePlanAttempt[]) - Required - An array of base plan attempts. ### `fastFiller()` #### Description Initializes or updates the fast filler logic. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `fastFillerPruneRoadCoord(coord: Coord)` #### Description Determines if a road at a given coordinate should be removed. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **coord** (Coord) - Required - The coordinate to check. #### Response ##### Success Response (200) - **action** (any) - Indicates if the road should be removed. ### `findBestPlanIndex(planAttempts: BasePlanAttempt[])` #### Description Finds the index of the plan with the lowest score from a list of attempts. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **planAttempts** (BasePlanAttempt[]) - Required - An array of base plan attempts. #### Response ##### Success Response (200) - **index** (number) - The index of the best plan. ### `findCenterUpgradePos()` #### Description Finds the optimal position for upgrading the center of the base. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findDynamicStampAnchor(args: FindDynamicStampAnchorArgs)` #### Description Finds an anchor point for a dynamic stamp with weighted considerations. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **args** (FindDynamicStampAnchorArgs) - Required - Arguments for finding the anchor. ### `findDynamicStampAnchorWeighted(args: FindDynamicStampAnchorWeightedArgs)` #### Description Finds a weighted anchor point for a dynamic stamp. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **args** (FindDynamicStampAnchorWeightedArgs) - Required - Arguments for finding the weighted anchor. ### `findFastFillerOrigin()` #### Description Determines the origin point for the fast filler creep. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findInsideMinCut()` #### Description Identifies internal minimum cut positions. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findOutsideMinCut()` #### Description Identifies external minimum cut positions. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findRoadQuota()` #### Description Calculates the quota for road construction. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findScore()` #### Description Calculates the score for a given plan or state. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findSourceHarvestPositions()` #### Description Determines the best positions for harvesting energy from sources. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `findStampAnchor(args: FindStampAnchorArgs)` #### Description Finds a suitable anchor point for placing a stamp. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **args** (FindStampAnchorArgs) - Required - Arguments for finding the stamp anchor. ### `findStorageCoord(structureCoords: Coord[])` #### Description Finds the optimal coordinate for the storage structure. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **structureCoords** (Coord[]) - Required - An array of existing structure coordinates. ### `findUnprotectedCoords()` #### Description Uses flood fill from exits to find and record unprotected coordinates. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `flipStructuresHorizontal(stamp: Stamp)` #### Description Flips the structures within a stamp horizontally. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **stamp** (Stamp) - Required - The stamp to flip. #### Response ##### Success Response (200) - **flippedStamp** (Partial<{ [x: string]: {}; }>) - The horizontally flipped stamp. ### `flipStructuresVertical(stamp: Stamp)` #### Description Flips the structures within a stamp vertically. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) #### Parameters ##### Request Body - **stamp** (Stamp) - Required - The stamp to flip. #### Response ##### Success Response (200) - **flippedStamp** (Partial<{ [x: string]: {}; }>) - The vertically flipped stamp. ### `generalShield()` #### Description Manages the creation or maintenance of a general shield. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `generateGrid()` #### Description Generates the game grid or a representation of it. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ### `gridExtensions()` #### Description Manages extensions to the game grid. #### Method (Not applicable - internal method) #### Endpoint (Not applicable - internal method) ``` -------------------------------- ### Duo Class Documentation Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/Duo.html Documentation for the Duo class, which represents a pair of creeps in Screeps. ```APIDOC ## Duo Class ### Description The Duo class represents a pair of creeps in Screeps, designed for coordinated actions. ### Constructor `constructor(memberNames: string[])` **Parameters :** * **memberNames** (`string[]`) - Required - The names of the creeps forming the duo. ### Properties * **_combatStrength** (`CombatStrength`) - Internal combat strength details. * **leader** (`Antifa`) - The leader creep of the duo. * **members** (`Antifa[]`) - All members of the duo, where index 0 is the leader. Defaults to `[]`. ### Methods * **advancedAttack()** * **Returns:** `boolean` - Indicates if the attack was successful. * **advancedDismantle()** * **Returns:** `boolean` - Indicates if the dismantle was successful. * **advancedHeal()** * **Returns:** `void` * **advancedRangedAttack()** * **Returns:** `boolean` - Indicates if the ranged attack was successful. * **attackStructures()** * **Returns:** `boolean` - Indicates if attacking structures was successful. * **createMoveRequest(opts: MoveRequestOpts, moveLeader = this.leader)** * **Parameters:** * **opts** (`MoveRequestOpts`) - Required - Options for the move request. * **moveLeader** (`Antifa`) - Optional - The creep to lead the movement. Defaults to `this.leader`. * **Returns:** `void` * **getInFormation()** * **Returns:** `any` * **holdFormation()** * **Returns:** `void` * **rangedAttackStructures()** * **Returns:** `boolean` - Indicates if ranged attacking structures was successful. * **run()** * **Returns:** `void` * **runCombat()** * **Returns:** `boolean` - Indicates if combat was run successfully. * **runCombatRoom()** * **Returns:** `boolean` - Indicates if combat in the room was run successfully. * **stompEnemyCSites()** * **Returns:** `boolean` - Indicates if enemy construction sites were stomped. ### Accessors * **combatStrength** (getter) * **Returns:** `CombatStrength` - The combat strength of the duo. * **canMove** (getter) * **Returns:** `boolean` - Indicates if the duo can move. ``` -------------------------------- ### Get Ranged Enemy Threat Data Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/Quad.html Retrieves data related to the threat posed by ranged enemies. Lower scores indicate a higher immediate threat. This function is crucial for threat assessment and avoidance strategies. It likely returns an object or numerical value. ```typescript get enemyThreatDataRanged() ``` -------------------------------- ### internationalConfig Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/StatsManager.html Initializes or retrieves the international configuration. ```APIDOC ## internationalConfig ### Description Initializes or retrieves the international configuration. ### Method N/A (Function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) Returns void. #### Response Example N/A ``` -------------------------------- ### Get Global Game Objects in Screeps Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html This getter provides access to global game objects within the Screeps environment. It ensures that a global object is initialized if it doesn't already exist, serving as a central registry for room-specific data. ```typescript global: { get() { if (global[this.name]) return global[this.name]; return (global[this.name] = {}); }, } ``` -------------------------------- ### Define All Available Resources - TypeScript Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html Creates a Set containing all possible resource types available in the game. Sets provide efficient lookups, useful for checking if a given resource is valid or present. ```typescript const allResources = new Set(RESOURCES_ALL); ``` -------------------------------- ### Get Dropped Energy Resources Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html Retrieves all dropped resources of type RESOURCE_ENERGY that are not located in areas with enemy threats. It uses the `find` method with `FIND_DROPPED_RESOURCES` and filters based on `resource.resourceType` and enemy threat coordinates. Dependencies include `packCoord` and `RESOURCE_ENERGY`. ```javascript get() { if (this._droppedEnergy) return this._droppedEnergy return (this._droppedEnergy = this.find(FIND_DROPPED_RESOURCES, { filter: resource => resource.resourceType === RESOURCE_ENERGY && !resource.room.enemyThreatCoords.has(packCoord(resource.pos)), })) } ``` -------------------------------- ### Method: generalShield Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/classes/RemotePlanner.html Applies a general shield strategy. ```APIDOC ## GET /generalShield ### Description Applies a general shield strategy. ### Method GET ### Endpoint /generalShield ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **void** - This method does not return any value. ``` -------------------------------- ### Creep Name Parsing and Role Identification - TypeScript Source: https://github.com/the-international-screeps-bot/the-international-open-source/blob/Main/docs/miscellaneous/variables.html Parses creep names to extract roles and provides functions to get the role name and the creep's role object. It assumes creep names are prefixed with a character representing their role. ```typescript expandName(creepName: string) { return creepName.split('_') }, roleName(creepName: string) { return creepRoles[parseInt(creepName[0])] }, roleCreep(creep: Creep) { if (creep._role) return creep._role return (creep._role = this.roleName(creep.name)) } ```