### Gather Resources on Map with Map Module Source: https://context7.com/devreagi/snowbot-docs/llms.txt This section describes how to gather resources on the map using the `map` module. It shows how to define resources to gather and initiate the gathering process. An example `move()` function is provided to combine movement and gathering. ```lua -- Define resources to gather (in global script config) GATHER = {289, 400, 533} -- Wheat, Barley, Flax GIDs -- Gather all available resources map:gather() global:printMessage("Gathering complete!") -- Example move() function with gathering function move() return { {map = "0,0", gather = true, path = "right"}, {map = "1,0", gather = true, path = "top"}, {map = "1,1", gather = true, path = "left"}, {map = "0,1", gather = true, path = "bottom"}, } end ``` -------------------------------- ### Minimal Farm Script Structure Example (Lua) Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet provides a basic structure for a farming script in Lua. It defines configuration constants like `MIN_MONSTERS`, `MAX_MONSTERS`, and `GATHER` lists. It also includes functions for defining movement paths (`move`), banking logic (`bank`), and respawning after death (`phenix`), demonstrating how different game actions can be structured within a script. ```lua -- Configuration MIN_MONSTERS = 1 MAX_MONSTERS = 8 GATHER = {289, 400} -- Wheat and Barley -- Movement path with actions function move() return { {map = "0,0", gather = true, fight = true, path = "right"}, {map = "1,0", gather = true, fight = true, path = "top"}, {map = "1,1", gather = true, fight = true, path = "left"}, {map = "0,1", gather = true, fight = true, path = "bottom"}, } end -- Bank when inventory full function bank() if inventory:podsP() < 90 then return {} -- Not full, skip bank end return { {map = "5,7", npcBank = true}, -- Map with banker } end -- Return to start after death function phenix() return { {map = "0,0", path = "right"}, } end ``` -------------------------------- ### Start fights with monsters Source: https://context7.com/devreagi/snowbot-docs/llms.txt Configure and initiate fights with monsters on the map. Allows setting constraints like minimum/maximum monsters, and specifying forbidden or mandatory monster types. ```APIDOC ## Start fights with monsters ### Description Configure and initiate fights with monsters on the map. Allows setting constraints like minimum/maximum monsters, and specifying forbidden or mandatory monster types. ### Method `map:fight()` ### Endpoint N/A (Scripting function) ### Parameters None directly for `map:fight()`. Configuration is done via global variables: - `MIN_MONSTERS` (number) - Minimum number of monsters in a group to initiate a fight. - `MAX_MONSTERS` (number) - Maximum number of monsters in a group to initiate a fight. - `FORBIDDEN_MONSTERS` (table of numbers) - Monster IDs that should be avoided. - `MANDATORY_MONSTERS` (table of numbers) - Monster IDs that must be present in a group for a fight to be initiated. ### Request Example ```lua -- Configure fight constraints MIN_MONSTERS = 2 MAX_MONSTERS = 6 FORBIDDEN_MONSTERS = {123, 456} MANDATORY_MONSTERS = {} -- Launch fight map:fight() ``` ### Response #### Success Response (Void) This function initiates a fight. Success is determined by game events following the call. #### Response Example N/A ``` -------------------------------- ### Get Item Information and Manage Items with Inventory Module Source: https://context7.com/devreagi/snowbot-docs/llms.txt This section details how to retrieve item information such as name, level, type, weight, and average price using the `inventory` module. It also shows how to use consumable items and irreversibly delete items from the inventory after confirmation. ```lua -- Get item details local itemGid = 289 local itemName = inventory:itemNameId(itemGid) local itemLevel = inventory:getLevel(itemGid) local itemType = inventory:getTypeName(itemGid) local itemWeight = inventory:itemWeight(itemGid) local avgPrice = inventory:getAveragePrice(itemGid) global:printMessage("Item: " .. itemName) global:printMessage("Level " .. itemLevel .. " " .. itemType) global:printMessage("Weight: " .. itemWeight .. " pods | Price: " .. avgPrice .. " kamas") -- Use consumable items local potionId = 548 if inventory:itemCount(potionId) > 0 then inventory:useItem(potionId) global:printSuccess("Potion used!") end -- Delete items from inventory (IRREVERSIBLE!) local itemToDelete = 289 if global:askQuestion("Delete " .. inventory:itemCount(itemToDelete) .. " wheat?") then inventory:deleteItem(itemToDelete, inventory:itemCount(itemToDelete)) end ``` -------------------------------- ### Start Fights with Monsters Source: https://context7.com/devreagi/snowbot-docs/llms.txt Initiates combat encounters with monsters on the map. Allows configuration of fight constraints like minimum/maximum monsters, forbidden monster IDs, and mandatory monster types. It also provides functionality to inspect monster groups and detect archmonsters. ```lua -- Configure fight constraints MIN_MONSTERS = 2 MAX_MONSTERS = 6 FORBIDDEN_MONSTERS = {123, 456} -- Monster IDs to avoid MANDATORY_MONSTERS = {} -- Only fight groups containing these -- Launch fight map:fight() -- Check monster groups on map local groups = map:monsterGroups() for i, group in ipairs(groups) do global:printMessage("Group " .. i .. " on cell " .. group.cellId) for _, monster in ipairs(group.monsters) do global:printMessage(" Monster ID:" .. monster.id .. " Level:" .. monster.level) end end -- Check for archmonsters if map:containsArchi() then global:printSuccess("ARCHMONSTER DETECTED!") local archis = map:getArchiMonster() for _, archiId in ipairs(archis) do global:printMessage("Archmonster ID: " .. archiId) end end ``` -------------------------------- ### Get Current Position and Navigate Maps with Map Module Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet explains how to get the current map coordinates, ID, area, and sub-area using the `map` module. It also demonstrates how to check if the player is on a specific map and how to move to adjacent maps. ```lua -- Get current position local coords = map:currentMap() -- Format: "x,y" local mapId = map:currentMapId() local area = map:currentArea() local subArea = map:currentSubArea() global:printMessage("Position: [" .. coords .. "] - " .. subArea .. " (" .. area .. ")") -- Check if on specific map if map:onMap("3,-5") then global:printMessage("Arrived at target coordinates!") end -- Move to adjacent map map:changeMap("top") -- Move north map:changeMap("right") -- Move east map:changeMap("bottom") -- Move south map:changeMap("left") -- Move west -- Wait for map change map:listenChange() map:changeMap("top") while not map:hasChanged() do global:delay(100) end global:printSuccess("Map changed!") ``` -------------------------------- ### Get Character Name and Level Source: https://context7.com/devreagi/snowbot-docs/llms.txt Retrieves the character's name, level, and class name. Also demonstrates checking if the character's level is sufficient to equip a specific item and proceeding with equipping it if the condition is met. ```lua local name = character:name() local level = character:level() local className = character:breedName() global:printMessage("Character: " .. name .. " - Level " .. level .. " " .. className) -- Check if character can use an item local itemLevel = inventory:getLevel(12345) if level >= itemLevel then inventory:equipItem(12345, 1) -- Equip as weapon end ``` -------------------------------- ### Configuration Management: Monster Constraints and Gather Lists (Lua) Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet details how to manage game configurations using the `config` object. It shows how to get and set monster fight constraints like minimum/maximum monsters and forbidden/mandatory lists using `config:getMinMonsters`, `config:setMaxMonsters`, `config:getForbiddenMonsters`, `config:getMandatoryMonsters`, `config:setMinMonsters`, `config:setMaxMonsters`, `config:setForbiddenMonsters`, and `config:setMandatoryMonsters`. It also covers setting gather lists with `config:setGatherList` and specific monster amounts with `config:setAmountOfSpecificMonsters`. ```lua -- Get monster fight constraints local minMonsters = config:getMinMonsters() local maxMonsters = config:getMaxMonsters() local forbidden = config:getForbiddenMonsters() local mandatory = config:getMandatoryMonsters() -- Set monster constraints config:setMinMonsters(2) config:setMaxMonsters(8) config:setForbiddenMonsters({123, 456, 789}) config:setMandatoryMonsters({111, 222}) -- Set gather list config:setGatherList({289, 400, 533}) -- Wheat, Barley, Flax -- Set specific monster amounts config:setAmountOfSpecificMonsters({[123] = 2, [456] = 1}) ``` -------------------------------- ### Equip and Unequip Items with Inventory Module Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet demonstrates how to manage item equipment using the `inventory` module. It covers equipping all items, equipping specific items to slots, and unequipping all items. A delay can be specified for automatic equipping. ```lua -- Automatically equip all items in inventory inventory:stuff(500) -- 500ms delay between each item global:printSuccess("All equipment equipped!") -- Equip specific item by GID to specific slot inventory:equipItem(12345, 0) -- Equip amulet (slot 0) inventory:equipItem(67890, 1) -- Equip weapon (slot 1) inventory:equipItem(11111, 6) -- Equip hat (slot 6) -- Slots: 0=Amulet, 1=Weapon, 2/4=Rings, 3=Belt, 5=Boots, 6=Hat, 7=Cloak, -- 8=Pet, 9-14=Dofus/Trophies, 15=Shield, 63=Unequipped -- Remove all equipment inventory:destuff(500) global:printMessage("All equipment removed") ``` -------------------------------- ### Utility Functions: Delays, Memory, and User Input (Lua) Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet showcases utility functions for managing script execution and user interaction. It includes `global:delay` for pausing execution, `global:addInMemory`, `global:getInMemory`, and `global:editInMemory` for storing data per account, `global:AddInGlobalMemory`, `global:GetInGlobalMemory`, and `global:EditInGlobalMemory` for shared global data, and `global:askInput` and `global:askQuestion` for prompting user input. ```lua -- Wait for specified time global:delay(1000) -- Wait 1 second global:delay(500) -- Wait 0.5 seconds -- Store data in memory (per account) global:addInMemory("fightCount", 0) local fights = global:getInMemory("fightCount") fights = fights + 1 global:editInMemory("fightCount", fights) -- Store data in global memory (shared across all accounts) global:AddInGlobalMemory("totalKamas", 0) local total = global:GetInGlobalMemory("totalKamas") total = total + character:kamas() global:EditInGlobalMemory("totalKamas", total) -- Ask user for input local answer = global:askInput("How many fights?", "Configuration") if answer ~= "" then MAX_FIGHTS = tonumber(answer) end -- Ask yes/no question if global:askQuestion("Deposit items in bank?") then exchange:putAllItems() end ``` -------------------------------- ### Interact with Map Elements and NPCs with Map and NPC Modules Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet illustrates how to interact with the game world using the `map` and `npc` modules. It covers using doors and interactive elements, talking to NPCs, replying to dialog options, and directly opening the bank. ```lua -- Use door or interactive element map:door(256) -- Use door on cell 256 -- Use interactive element by ID local elementId = 12345 local cellId = map:interactiveIdToCell(elementId) if cellId > 0 then map:useById(elementId, 0) -- Use element with first skill end -- Talk to NPC and open dialog npc:npc(-20001, 3) -- Talk to banker (NPC ID -20001) npc:reply(-1) -- Choose first response npc:reply(-2) -- Choose second response npc:leaveDialog() -- Close dialog -- Open bank directly npc:npcBank(-1) -- Auto-find banker on map exchange:putAllItems() exchange:putKamas(0) exchange:leave() ``` -------------------------------- ### Inventory Management Source: https://context7.com/devreagi/snowbot-docs/llms.txt This section details functions for managing the character's inventory, including checking capacity, weight, and the quantity of specific items. It also covers managing Kamas. ```APIDOC ## Check inventory contents and capacity ### Description Monitors the character's inventory weight (pods), maximum capacity, and percentage used. Provides warnings for a nearly full inventory and allows checking the count of specific items and total Kamas. ### Method `inventory:pods()`, `inventory:podsMax()`, `inventory:podsP()`, `inventory:itemCount(gid)`, `character:kamas()` ### Parameters - `gid` (number) - The unique ID of the item to count. ### Request Example ```lua -- Check inventory weight local currentPods = inventory:pods() local maxPods = inventory:podsMax() local podsPercent = inventory:podsP() global:printMessage("Inventory: " .. currentPods .. "/" .. maxPods .. " pods (" .. podsPercent .. "%)") -- Check if inventory is getting full if podsPercent > 90 then global:printError("Inventory almost full!") return "bank" -- Go to bank end -- Count specific items local wheatCount = inventory:itemCount(289) -- Wheat GID local kamasAmount = character:kamas() global:printMessage("Wheat: " .. wheatCount .. " | Kamas: " .. kamasAmount) ``` ### Response - `currentPods` (number) - Current weight of items in inventory. - `maxPods` (number) - Maximum weight capacity of the inventory. - `podsPercent` (number) - Percentage of inventory capacity used. - `itemCount` (number) - The quantity of the specified item. - `kamasAmount` (number) - The total amount of Kamas the character possesses. ### Response Example ``` Inventory: 4500/5000 pods (90%) Inventory almost full! Wheat: 150 | Kamas: 125000 ``` ``` -------------------------------- ### Use Pathfinding for Long Distance Travel with Map Module Source: https://context7.com/devreagi/snowbot-docs/llms.txt This section covers long-distance travel using the `map` module's pathfinding capabilities. It demonstrates how to travel to specific coordinates or map IDs, use zaaps for fast travel, and check known zaaps. ```lua -- Travel to coordinates using pathfinding local success = map:loadMove(3, -5) -- Load path to [3,-5] if success then while map:moveNext() do global:delay(500) -- Wait between each map transition end global:printSuccess("Destination reached!") else global:printError("No path found to destination") end -- Travel to specific map by ID if map:loadMoveToMapId(123456789) then while map:moveNext() do global:delay(500) end end -- Use zaap for fast travel local targetMap = 123456789 local nearestZaap = map:getNearestZaap(targetMap) if nearestZaap > 0 then map:ToZaap(nearestZaap) global:printSuccess("Teleported to zaap!") end -- Check known zaaps local zaaps = map:knownZaap() global:printMessage("Known zaaps: " .. #zaaps) ``` -------------------------------- ### Check Inventory Contents and Capacity Source: https://context7.com/devreagi/snowbot-docs/llms.txt Displays the current inventory weight (pods), maximum capacity, and percentage used. If the inventory is over 90% full, it prints an error and suggests returning to the bank. It also shows how to count specific items (e.g., Wheat) and the character's current amount of Kamas. ```lua -- Check inventory weight local currentPods = inventory:pods() local maxPods = inventory:podsMax() local podsPercent = inventory:podsP() global:printMessage("Inventory: " .. currentPods .. "/" .. maxPods .. " pods (" .. podsPercent .. "%)") -- Check if inventory is getting full if podsPercent > 90 then global:printError("Inventory almost full!") return "bank" -- Go to bank end -- Count specific items local wheatCount = inventory:itemCount(289) -- Wheat GID local kamasAmount = character:kamas() global:printMessage("Wheat: " .. wheatCount .. " | Kamas: " .. kamasAmount) ``` -------------------------------- ### Check Account Status and Subscription Source: https://context7.com/devreagi/snowbot-docs/llms.txt Determines if the account is free-to-play and warns if P2P zones are inaccessible. If subscribed, it calculates and displays the remaining subscription days. It also retrieves the account ID and nickname and checks if a proxy is enabled, logging its IP and port if so. ```lua -- Check if account is free-to-play if character:freeMode() then global:printWarning("Free account - P2P zones inaccessible") else local seconds = character:getSecondsBeforeFreeMode() local days = math.floor(seconds / 86400) global:printSuccess("Subscribed - " .. days .. " days remaining") end -- Get account information local accountId = character:accountId() local accountTag = character:nickname() -- Format: "username#1234" global:printMessage("Account: " .. accountTag .. " (ID: " .. accountId .. ")") -- Check proxy configuration if account:isProxyEnabled() then local proxyIP = account:getProxyIP() local proxyPort = account:getProxyPort() global:printMessage("Using proxy: " .. proxyIP .. ":" .. proxyPort) end ``` -------------------------------- ### Analyze Combat Situation and Positioning Source: https://context7.com/devreagi/snowbot-docs/llms.txt Provides tools for analyzing the combat situation and optimizing fighter positioning. It can retrieve a list of all entities involved in the fight, count the number of living allies and enemies, and determine reachable cells. It also includes logic to find a position with a clear line of sight to the nearest enemy. ```lua -- Get all fighters in combat local entities = fightAction:getAllEntities() local enemiesAlive = 0 local alliesAlive = 0 for _, entity in ipairs(entities) do if entity.LifePoints > 0 then if entity.Team then -- Enemy enemiesAlive = enemiesAlive + 1 else -- Ally alliesAlive = alliesAlive + 1 end end end global:printMessage("Alive - Allies: " .. alliesAlive .. " Enemies: " .. enemiesAlive) -- Get reachable cells local reachableCells = fightAction:getReachableCells() global:printMessage("Can move to " .. #reachableCells .. " cells") -- Find best position with line of sight local enemyCell = fightAction:getNearestEnemy() for _, cell in ipairs(reachableCells) do if fightAction:inLineOfSight(cell, enemyCell, false) then fightAction:moveTowardCell(cell) global:printSuccess("Moved to cell with LOS!") break end end ``` -------------------------------- ### Utility Functions: Message Display and Script Control (Lua) Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet covers functions for displaying colored messages to the user and controlling script flow. It includes `global:printMessage`, `global:printSuccess`, `global:printError`, and `global:printWarning` for different message types. It also demonstrates `global:afterFight` to check if combat has ended, `global:stopScript`, `global:startScript` for script control, and `global:disconnect` to log out the character. ```lua -- Print colored messages global:printMessage("Normal message") global:printSuccess("Success message in green") global:printError("Error message in red") global:printWarning("Warning message in orange") -- Check if combat just ended if global:afterFight() then global:printMessage("Combat ended!") local podsPercent = inventory:podsP() if podsPercent > 90 then return "bank" end end -- Stop and restart script global:stopScript() global:delay(5000) global:startScript() -- Disconnect character global:disconnect() ``` -------------------------------- ### Bank and Exchange Operations Source: https://context7.com/devreagi/snowbot-docs/llms.txt Manage items and currency within the game's bank and exchange systems. Includes depositing, withdrawing, and checking storage contents. ```APIDOC ## Bank and Exchange Operations ### Description Manage items and currency within the game's bank and exchange systems. Includes depositing, withdrawing, and checking storage contents. ### Method Scripting functions for `exchange` and `npc` objects. ### Endpoint N/A (Scripting functions) ### Parameters Various parameters are used depending on the function, including item IDs, quantities, and arrays of item IDs. ### Request Example ```lua -- Open bank and deposit all items pc:npcBank(-1) exchange:putAllItems() global:printSuccess("All items deposited!") -- Deposit specific items exchange:putItem(289, 50) -- Deposit 50 wheat exchange:putItem(400, 100) -- Deposit 100 barley -- Deposit all kamas (0 = all) exchange:putKamas(0) -- Withdraw items exchange:getItem(289, 10) -- Withdraw 10 wheat exchange:getAllItems() -- Withdraw everything -- Deposit all except specific items local keepInInventory = {548, 289} -- Keep potions and wheat exchange:putAllItemsExcept(keepInInventory) -- Withdraw all except specific items local keepInBank = {12345, 67890} -- Keep rare items in bank exchange:getAllItemsExcept(keepInBank) -- Close exchange exchange:leave() ``` ### Response #### Success Response (Void) These functions perform actions within the game's UI. Success is typically indicated by messages or changes in inventory/bank state. ``` -------------------------------- ### Character Information and Stats Source: https://context7.com/devreagi/snowbot-docs/llms.txt This section covers functions related to retrieving and managing character information, including name, level, class, health, energy, stats, and account status. ```APIDOC ## Get character name and level ### Description Retrieves the character's name, level, and class name. Also demonstrates checking item level requirements and equipping items. ### Method `character:name()`, `character:level()`, `character:breedName()` ### Parameters None ### Request Example ```lua local name = character:name() local level = character:level() local className = character:breedName() global:printMessage("Character: " .. name .. " - Level " .. level .. " " .. className) -- Check if character can use an item local itemLevel = inventory:getLevel(12345) if level >= itemLevel then inventory:equipItem(12345, 1) -- Equip as weapon end ``` ### Response - `name` (string) - The character's name. - `level` (number) - The character's current level. - `className` (string) - The character's class name. ### Response Example ``` Character: Snowbot - Level 200 Iop ``` ``` ```APIDOC ## Check character health and energy ### Description Checks the character's current health points (HP), maximum HP, and percentage of HP remaining. Also checks energy points and provides warnings for low energy. ### Method `character:lifePoints()`, `character:maxLifePoints()`, `character:lifePointsP()`, `character:energyPoints()`, `character:maxEnergyPoints()` ### Parameters None ### Request Example ```lua local hp = character:lifePoints() local maxHp = character:maxLifePoints() local hpPercent = character:lifePointsP() if hpPercent < 50 then global:printError("Low health! " .. hp .. "/" .. maxHp .. " (" .. hpPercent .. "%)") -- Use healing item or return to phenix end -- Check energy (becomes ghost at 0) local energy = character:energyPoints() local maxEnergy = character:maxEnergyPoints() if energy < maxEnergy * 0.2 then global:printWarning("Critical energy: " .. energy .. "/" .. maxEnergy) end ``` ### Response - `hp` (number) - Current health points. - `maxHp` (number) - Maximum health points. - `hpPercent` (number) - Percentage of health remaining. - `energy` (number) - Current energy points. - `maxEnergy` (number) - Maximum energy points. ### Response Example ``` Low health! 1500/3000 (50%) ``` ``` ```APIDOC ## Manage character stats and upgrade ### Description Checks available stat points and the cost to upgrade various stats (Vitality, Strength, Agility). Allows upgrading stats and retrieving base stat values. ### Method `character:statsPoint()`, `character:getCostVitality()`, `character:getCostStrenght()`, `character:getCostAgility()`, `character:UpgradeVitality(points)`, `character:getVitalityBase()`, `character:getStrenghtBase()`, `character:getAgilityBase()` ### Parameters - `points` (number) - The number of stat points to invest. ### Request Example ```lua -- Check available stat points local points = character:statsPoint() if points > 0 then global:printMessage("Available stat points: " .. points) -- Check cost to upgrade stats local costVita = character:getCostVitality() -- Usually 1 local costStr = character:getCostStrenght() local costAgi = character:getCostAgility() -- Invest all points in vitality character:UpgradeVitality(points) global:printSuccess("Invested " .. points .. " points in vitality") end -- Get base stats (without equipment bonuses) local vitaBase = character:getVitalityBase() local strBase = character:getStrenghtBase() local agiBase = character:getAgilityBase() global:printMessage("Base stats - Vita:" .. vitaBase .. " Str:" .. strBase .. " Agi:" .. agiBase) ``` ### Response - `points` (number) - Number of available stat points. - `costVita` (number) - Cost to upgrade Vitality. - `costStr` (number) - Cost to upgrade Strength. - `costAgi` (number) - Cost to upgrade Agility. - `vitaBase` (number) - Base Vitality stat. - `strBase` (number) - Base Strength stat. - `agiBase` (number) - Base Agility stat. ### Response Example ``` Available stat points: 5 Invested 5 points in vitality Base stats - Vita:100 Str:50 Agi:75 ``` ``` ```APIDOC ## Check account status and subscription ### Description Determines if the account is free-to-play or subscribed, calculates remaining subscription days, and retrieves account identification details. Also checks proxy configuration if enabled. ### Method `character:freeMode()`, `character:getSecondsBeforeFreeMode()`, `character:accountId()`, `character:nickname()`, `account:isProxyEnabled()`, `account:getProxyIP()`, `account:getProxyPort()` ### Parameters None ### Request Example ```lua -- Check if account is free-to-play if character:freeMode() then global:printWarning("Free account - P2P zones inaccessible") else local seconds = character:getSecondsBeforeFreeMode() local days = math.floor(seconds / 86400) global:printSuccess("Subscribed - " .. days .. " days remaining") end -- Get account information local accountId = character:accountId() local accountTag = character:nickname() -- Format: "username#1234" global:printMessage("Account: " .. accountTag .. " (ID: " .. accountId .. ")") -- Check proxy configuration if account:isProxyEnabled() then local proxyIP = account:getProxyIP() local proxyPort = account:getProxyPort() global:printMessage("Using proxy: " .. proxyIP .. ":" .. proxyPort) end ``` ### Response - `freeMode` (boolean) - True if the account is free-to-play, false otherwise. - `seconds` (number) - Remaining subscription time in seconds. - `days` (number) - Remaining subscription time in days. - `accountId` (number) - The unique account ID. - `accountTag` (string) - The account nickname (username#1234). - `isProxyEnabled` (boolean) - True if a proxy is enabled, false otherwise. - `proxyIP` (string) - The IP address of the proxy server. - `proxyPort` (number) - The port of the proxy server. ### Response Example ``` Subscribed - 30 days remaining Account: SnowbotPlayer#5678 (ID: 12345678) ``` ``` -------------------------------- ### Check bank contents Source: https://context7.com/devreagi/snowbot-docs/llms.txt Query the contents of the bank storage. Allows checking the quantity of specific items or listing all items currently stored. ```APIDOC ## Check bank contents ### Description Query the contents of the bank storage. Allows checking the quantity of specific items or listing all items currently stored. ### Method Scripting functions for `exchange` object. ### Endpoint N/A (Scripting functions) ### Parameters - `exchange:storageItemQuantity(itemId)`: Requires `itemId` (number) of the item to check. - `exchange:storageContent()`: Takes no parameters. ### Request Example ```lua -- Check quantity of item in bank local wheatInBank = exchange:storageItemQuantity(289) global:printMessage("Wheat in bank: " .. wheatInBank) -- List all items in bank storage local storageItems = exchange:storageContent() for _, item in ipairs(storageItems) do local name = inventory:itemNameId(item.objectGID) global:printMessage(name .. " x" .. item.quantity) end ``` ### Response #### Success Response (Data) - `exchange:storageItemQuantity(itemId)` returns a number representing the quantity of the item. - `exchange:storageContent()` returns a table of item objects, where each object has: - `objectGID` (number) - The unique ID of the item. - `quantity` (number) - The quantity of the item in storage. ``` -------------------------------- ### Lua Advanced Combat and Gathering Script for Snowbot Source: https://context7.com/devreagi/snowbot-docs/llms.txt This Lua script demonstrates an advanced Snowbot configuration for automated Dofus gameplay. It includes functions for movement, custom combat management, banking, and respawning. The script utilizes global variables to track statistics and manage bot behavior, such as inventory limits and monster encounters. ```lua MIN_MONSTERS = 2 MAX_MONSTERS = 6 GATHER = {289} -- Track statistics global:addInMemory("totalFights", 0) global:addInMemory("totalKamasEarned", 0) function move() -- Check if inventory is full if global:afterFight() then local podsPercent = inventory:podsP() if podsPercent > 90 then global:printWarning("Inventory full, going to bank") return "bank" end -- Update statistics local fights = global:getInMemory("totalFights") + 1 global:editInMemory("totalFights", fights) global:printSuccess("Fights completed: " .. fights) end return { {map = "0,0", gather = true, fight = true, path = "right"}, {map = "1,0", fight = true, path = "top"}, {map = "1,1", fight = true, path = "left"}, {map = "0,1", gather = true, path = "bottom"}, } end function fightManagement() local ap = fightCharacter:getAP() local mp = fightCharacter:getMP() -- Find and target enemy local enemyCell = fightAction:getNearestEnemy() if enemyCell == -1 then fightAction:passTurn() return end -- Move closer if needed local distance = fightAction:getDistance(fightCharacter:getCellId(), enemyCell) if distance > 5 and mp >= 3 then fightAction:moveTowardCell(enemyCell) end -- Cast spells local spells = {12345, 67890} -- Spell IDs for _, spellId in ipairs(spells) do while fightCharacter:getAP() >= 3 do if fightAction:castSpellOnCell(spellId, enemyCell) then global:delay(200) else break end end end fightAction:passTurn() end function bank() return { {map = "5,7", npcBank = true}, } end function phenix() return { {map = "0,0", path = "right"}, } end ``` -------------------------------- ### Analyze combat situation and positioning Source: https://context7.com/devreagi/snowbot-docs/llms.txt Advanced combat analysis functions. These allow for inspecting the state of all entities in combat, determining reachable cells, and finding optimal positions with line of sight. ```APIDOC ## Combat Advanced Functions ### Description Advanced combat analysis functions. These allow for inspecting the state of all entities in combat, determining reachable cells, and finding optimal positions with line of sight. ### Method Scripting functions for `fightAction` object. ### Endpoint N/A (Scripting functions) ### Parameters - `fightAction:getAllEntities()`: Takes no parameters. - `fightAction:getReachableCells()`: Takes no parameters. - `fightAction:inLineOfSight(startCell, targetCell, checkObstacles)`: Requires `startCell` (number), `targetCell` (number), and `checkObstacles` (boolean). - `fightAction:moveTowardCell(cell)`: Requires `cell` (number). - `fightAction:getNearestEnemy()`: Takes no parameters. ### Request Example ```lua -- Get all fighters in combat local entities = fightAction:getAllEntities() local enemiesAlive = 0 local alliesAlive = 0 for _, entity in ipairs(entities) do if entity.LifePoints > 0 then if entity.Team then -- Enemy enemiesAlive = enemiesAlive + 1 else -- Ally alliesAlive = alliesAlive + 1 end end end global:printMessage("Alive - Allies: " .. alliesAlive .. " Enemies: " .. enemiesAlive) -- Get reachable cells local reachableCells = fightAction:getReachableCells() global:printMessage("Can move to " .. #reachableCells .. " cells") -- Find best position with line of sight local enemyCell = fightAction:getNearestEnemy() for _, cell in ipairs(reachableCells) do if fightAction:inLineOfSight(cell, enemyCell, false) then fightAction:moveTowardCell(cell) global:printSuccess("Moved to cell with LOS!") break end end ``` ### Response #### Success Response - `fightAction:getAllEntities()` returns a table of entity objects, each with properties like `LifePoints` and `Team`. - `fightAction:getReachableCells()` returns a table of cell IDs (numbers). - `fightAction:inLineOfSight()` returns a boolean indicating if line of sight is present. - `fightAction:moveTowardCell()` performs a move action. ``` -------------------------------- ### Manage Character Stats and Upgrade Source: https://context7.com/devreagi/snowbot-docs/llms.txt Checks for available stat points and upgrades vitality if points are available. It also retrieves the cost to upgrade specific stats like Vitality, Strength, and Agility, and then fetches the base values for Vitality, Strength, and Agility. ```lua -- Check available stat points local points = character:statsPoint() if points > 0 then global:printMessage("Available stat points: " .. points) -- Check cost to upgrade stats local costVita = character:getCostVitality() -- Usually 1 local costStr = character:getCostStrenght() local costAgi = character:getCostAgility() -- Invest all points in vitality character:UpgradeVitality(points) global:printSuccess("Invested " .. points .. " points in vitality") end -- Get base stats (without equipment bonuses) local vitaBase = character:getVitalityBase() local strBase = character:getStrenghtBase() local agiBase = character:getAgilityBase() global:printMessage("Base stats - Vita:" .. vitaBase .. " Str:" .. strBase .. " Agi:" .. agiBase) ``` -------------------------------- ### Custom combat AI Source: https://context7.com/devreagi/snowbot-docs/llms.txt Implement custom Artificial Intelligence for combat. This allows for dynamic decision-making during fights, including spellcasting, movement, and turn management. ```APIDOC ## Custom combat AI ### Description Implement custom Artificial Intelligence for combat. This allows for dynamic decision-making during fights, including spellcasting, movement, and turn management. ### Method Custom function `fightManagement()` ### Endpoint N/A (Scripting function) ### Parameters This function relies on global fight context and character stats. - `fightCharacter` (object) - Provides access to the player's current combat stats (AP, MP, HP, cell ID). - `fightAction` (object) - Provides actions that can be performed during combat (moving, casting spells, passing turn). ### Request Example ```lua function fightManagement() -- Get current stats local ap = fightCharacter:getAP() local mp = fightCharacter:getMP() local myCell = fightCharacter:getCellId() local myHpPercent = fightCharacter:getLifePointsP() -- Find nearest enemy local enemyCell = fightAction:getNearestEnemy() if enemyCell == -1 then fightAction:passTurn() return end -- Calculate distance local distance = fightAction:getDistance(myCell, enemyCell) global:printMessage("Enemy at distance: " .. distance) -- Move closer if too far if distance > 3 and mp > 0 then fightAction:moveTowardCell(enemyCell) end -- Cast spells while AP available local spellId = 12345 while ap >= 3 do local canCast = fightAction:canCastSpellOnCell(myCell, spellId, enemyCell, true, true) if canCast == 0 then fightAction:castSpellOnCell(spellId, enemyCell) ap = fightCharacter:getAP() -- Update AP else break end end -- End turn fightAction:passTurn() end ``` ### Response #### Success Response (Void) This function executes combat actions. Success is determined by game events and state changes. ``` -------------------------------- ### Bank and Exchange Operations Source: https://context7.com/devreagi/snowbot-docs/llms.txt Manages bank and exchange operations, including depositing and withdrawing items and kamas. It supports depositing all items, specific quantities, and all kamas. It also allows for selective withdrawal and deposit, excluding certain items. ```lua -- Open bank and deposit all items pc:npcBank(-1)exchange:putAllItems() global:printSuccess("All items deposited!") -- Deposit specific itemsexchange:putItem(289, 50) -- Deposit 50 wheatexchange:putItem(400, 100) -- Deposit 100 barley -- Deposit all kamas (0 = all)exchange:putKamas(0) -- Withdraw itemsexchange:getItem(289, 10) -- Withdraw 10 wheatexchange:getAllItems() -- Withdraw everything -- Deposit all except specific items local keepInInventory = {548, 289} -- Keep potions and wheatexchange:putAllItemsExcept(keepInInventory) -- Withdraw all except specific items local keepInBank = {12345, 67890} -- Keep rare items in bankexchange:getAllItemsExcept(keepInBank) -- Close exchangeexchange:leave() ``` -------------------------------- ### Check Bank Contents Source: https://context7.com/devreagi/snowbot-docs/llms.txt Allows checking the contents of the bank. It can retrieve the quantity of a specific item stored in the bank and list all items currently in the bank storage along with their quantities. ```lua -- Check quantity of item in bank local wheatInBank = exchange:storageItemQuantity(289) global:printMessage("Wheat in bank: " .. wheatInBank) -- List all items in bank storage local storageItems = exchange:storageContent() for _, item in ipairs(storageItems) do local name = inventory:itemNameId(item.objectGID) global:printMessage(name .. " x" .. item.quantity) end ``` -------------------------------- ### Custom Combat AI Source: https://context7.com/devreagi/snowbot-docs/llms.txt Implements a custom combat AI for managing fight actions. This function retrieves character stats, identifies the nearest enemy, calculates distances, moves towards the enemy if necessary, and casts spells while AP is available. It concludes by passing the turn. ```lua function fightManagement() -- Get current stats local ap = fightCharacter:getAP() local mp = fightCharacter:getMP() local myCell = fightCharacter:getCellId() local myHpPercent = fightCharacter:getLifePointsP() -- Find nearest enemy local enemyCell = fightAction:getNearestEnemy() if enemyCell == -1 then fightAction:passTurn() return end -- Calculate distance local distance = fightAction:getDistance(myCell, enemyCell) global:printMessage("Enemy at distance: " .. distance) -- Move closer if too far if distance > 3 and mp > 0 then fightAction:moveTowardCell(enemyCell) end -- Cast spells while AP available local spellId = 12345 while ap >= 3 do local canCast = fightAction:canCastSpellOnCell(myCell, spellId, enemyCell, true, true) if canCast == 0 then fightAction:castSpellOnCell(spellId, enemyCell) ap = fightCharacter:getAP() -- Update AP else break end end -- End turn fightAction:passTurn() end ``` -------------------------------- ### Check Spell Casting and Zone of Effect (Lua) Source: https://context7.com/devreagi/snowbot-docs/llms.txt This snippet demonstrates how to check if a spell can be cast on a target cell and determine the spell's area of effect. It utilizes `fightAction:canCastSpellOnCell` and `fightAction:getSpellZone` functions. The output indicates casting success, reasons for failure (AP, range, line of sight), and the number of enemies within the spell's zone. ```lua -- Check if spell can be cast local myCell = fightCharacter:getCellId() local spellId = 12345 local targetCell = 300 local canCast = fightAction:canCastSpellOnCell(myCell, spellId, targetCell, true, true) if canCast == 0 then global:printSuccess("Can cast spell!") elseif canCast == 1 then global:printWarning("Not enough AP") elseif canCast == 2 then global:printWarning("Out of range") elseif canCast == 3 then global:printWarning("Line of sight blocked") end -- Get spell zone of effect local zone = fightAction:getSpellZone(spellId, targetCell) if zone then local enemiesInZone = 0 for _, cell in ipairs(zone) do if fightAction:getFighter(cell) ~= -1 then enemiesInZone = enemiesInZone + 1 end end global:printMessage("Spell would hit " .. enemiesInZone .. " enemies") end ``` -------------------------------- ### Check Character Health and Energy Source: https://context7.com/devreagi/snowbot-docs/llms.txt Checks the character's current health points (HP), maximum HP, and HP percentage. If HP percentage drops below 50%, it prints an error message. It also checks energy points and warns if energy is critically low (below 20% of maximum). ```lua local hp = character:lifePoints() local maxHp = character:maxLifePoints() local hpPercent = character:lifePointsP() if hpPercent < 50 then global:printError("Low health! " .. hp .. "/" .. maxHp .. " (" .. hpPercent .. "%)") -- Use healing item or return to phenix end -- Check energy (becomes ghost at 0) local energy = character:energyPoints() local maxEnergy = character:maxEnergyPoints() if energy < maxEnergy * 0.2 then global:printWarning("Critical energy: " .. energy .. "/" .. maxEnergy) end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.