Иконка ресурса

[aCis] AutoFarm OFFLINE System 2026-07-10

Нет прав для скачивания
Хроники
  1. Interlude
I am sharing a complete Offline Farm system with database persistence and support for IP/VIP-based limits.
🙂️ IMPORTANT NOTICE: This code was successfully implemented and tested in my personal project using an aCis Interlude revision. It was originally based on the L2Radical source (credits to @Sr Eli), but I made numerous modifications, SQL query fixes, and performance optimizations for my server.
If you use a different base (Frozen, Lucera, Sunrise, etc.), you will need to adapt the packages, connection method names, and network packets. Please read the code carefully before applying it or criticizing the post unnecessarily!

📝 What Does the System Do? (Features)

The system allows players to configure the server's native Auto Farm system, activate the command, and close the game. The character will remain in the world, intelligently hunting monsters.
Full Database Persistence: Saves the character's current state to the `offline_autofarm` table with no risk of data loss.
Critical DB Bug Fix (UPDATE vs. REPLACE): Fixed the classic issue where saving Soulshot data would wipe out other player data (such as start time, VIP status, or invulnerability).
Zero MP Consumption in Offline Mode: To prevent the bot from stalling due to a lack of mana (caused by potion shortages or core regeneration delays), MP consumption (both initial and continuous) for physical/magic skills and bow attacks is ignored while the character is offline.
Centralized IP-Based Manager: Limits the number of characters offline farming per machine.
FREE vs. VIP Differentiation: * Standard players must pay a configurable fee in a specific currency (e.g., Offline Farm Coin).
VIP players have free access and a higher limit on concurrent instances per IP.
Automatic Security (Anti-Griefing): Characters can be set to invulnerable (`is_invul`) while farming to prevent being killed by other players (configurable). Time Limit and Resource Protection: OfflineFarmManager runs a task every 30 seconds that disconnects the character if:
The character's buffs expire.
The maximum time limit configured in the properties file is reached.
Integrated Auto Gold Bar: Automatically converts the player's Adena into Gold Bars upon reaching the limit to prevent the inventory from locking up.

⚙️ Configuration via .properties
# ==================================================================
# SISTEMA DE OFFLINE AUTO FARM
# ==================================================================
# Enables or disables the Offline Auto Farm system globally on the server.
# True -> Players can use the .offline / .offlinefarm commands.
# False -> The system is completely disabled.
OfflineFarmEnabled = True

# ID of the item that will be charged to the player to activate offline mode.
# (Example: 9503 corresponding to your server's custom currency).
OfflineFarmItemId = 9503

# Quantity of the item configured above that will be removed from the player's inventory upon each activation.
OfflineFarmItemCount = 1

# Does it require the standard AutoFarm (Retail/On) to be active on-screen before logging out?
# True -> The player must activate the bot mod on-screen first; otherwise, the .offlinefarm command is rejected.
# False -> The player can activate it directly, and the system starts farming automatically upon disconnection.
RequireAutoFarm = True

# Restricts command usage to players with active VIP status.
# True -> Only VIPs can use Offline Farm.
# False -> Any player (Free or VIP) can use the system.
OfflineFarmOnlyVip = false

# Determines whether the character becomes immortal (invulnerable) while hunting in offline mode.
# True -> The player becomes immortal. Prevents death by monsters or being PKed by other players.
# False -> The player can die normally if HP drops to zero due to monsters or PK/PvP.
OfflineFarmIsInvul = True

# Maximum duration of the Offline Farm session (in minutes) per character.
# Example: 5 = The character will farm for a maximum of 5 minutes and then be disconnected by the Manager.
# Note: The manager also logs the character out before this time if their buffs expire.
OfflineFarmMaxTime = 5

# Maximum number of characters in Offline Farm mode that a standard (FREE) player can have running per IP.
OfflineFarmFreeMaxAccountsPerIp = 1

# Maximum number of characters in Offline Farm mode that a VIP player can keep connected from the same IP.
OfflineFarmVipMaxAccountsPerIp = 4

📂
Visual Interface (HTML)​


The file should be created at `game\data\html\mods\offlinefarm\offline.htm`. It comes pre-configured with support for dynamic tags (e.g., `%item_info%`) and includes text explaining the usage rules to the player.

If this code helped guide your project, please leave a "Thank you" in the thread.
Constructive criticism to improve the code logic is always welcome; however, aggressive comments or questions from those who haven't even read the notices will be summarily ignored.

Best regards and happy coding to everyone!

Назад
Сверху Снизу