The Core module provides the foundation for the Game Macro application, handling configuration management, application state, and core functionality.
| English Version | 中文版本 |
The Core system is responsible for:
Handles application-wide configuration management.
AppConfig_Init() - Initialize configuration systemAppConfig_Get(section, key, default) - Get configuration valueAppConfig_Set(section, key, value) - Set configuration valueAppConfig_GetLog(level, default) - Get logging configuration[General]
Language=zh-CN
Version=0.1.3
[Logging]
Level=DEBUG
RotateSizeMB=10
RotateKeep=5
Manages global application state and provides core functionality.
Core_Init() - Initialize core systemCore_DefaultProfileData() - Get default profile structureCore_LoadProfile(name) - Load profile dataCore_SaveProfile(name) - Save profile dataglobal App := Map(
"ProfilesDir", A_ScriptDir "\\Profiles",
"ExportDir", A_ScriptDir "\\Exports",
"ConfigExt", ".ini",
"CurrentProfile", "",
"Profiles", [],
"ProfileData", Core_DefaultProfileData(),
"IsRunning", false,
"BoundHotkeys", Map()
)
{
Name: "Default",
StartHotkey: "F9",
PollIntervalMs: 25,
SendCooldownMs: 250,
PickHoverEnabled: 1,
PickHoverOffsetY: -60,
PickHoverDwellMs: 120,
PickConfirmKey: "LButton",
Skills: [],
Points: [],
Rules: [],
Buffs: [],
Threads: [ { Id: 1, Name: "默认线程" } ],
DefaultSkill: {
Enabled: 0,
SkillIndex: 0,
CheckReady: 1,
ThreadId: 1,
CooldownMs: 600,
PreDelayMs: 0,
LastFire: 0
},
Rotation: {
Enabled: 0,
DefaultTrackId: 1,
SwapKey: "",
BusyWindowMs: 200,
ColorTolBlack: 16,
RespectCastLock: 1,
BlackGuard: {
Enabled: 1,
SampleCount: 5,
BlackRatioThresh: 0.7,
WindowMs: 120,
CooldownMs: 600,
MinAfterSendMs: 60,
MaxAfterSendMs: 800,
UniqueRequired: 1
},
Opener: {
Enabled: 0,
MaxDurationMs: 4000,
Watch: []
}
}
}
#Include "modules\\core\\Core.ahk"
#Include "modules\\core\\AppConfig.ahk"
; Initialize configuration
AppConfig_Init()
; Initialize core system
Core_Init()
; Load a profile
Core_LoadProfile("MyProfile")
; Get language setting
language := AppConfig_Get("General", "Language", "zh-CN")
; Set logging level
AppConfig_Set("Logging", "Level", "DEBUG")
; Check if application is running
if (App["IsRunning"]) {
; Application is active
}
; Access current profile data
profile := App["ProfileData"]
startHotkey := profile["StartHotkey"]
Initializes the configuration system and loads configuration files.
Parameters: None
Returns: Nothing
Retrieves a configuration value.
Parameters:
section (String): Configuration sectionkey (String): Configuration keydefault (Any): Default value if not foundReturns: Configuration value or default
Initializes the core application system.
Parameters: None
Returns: Nothing
Returns the default profile data structure.
Parameters: None
Returns: Map containing default profile data
The Core system includes error handling for:
AppConfig_Init() before accessing configurationCore_DefaultProfileData() as template for new profiles