You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arcana is a magic mod for Garry's Mod, it comes with spells, enchantments and rituals that can be extended or integrated with various gamemodes.
Integrating with Arcana
Arcana ships with a built-in coin and item inventory system. To integrate with an existing economy (DarkRP, PointShop2, a custom database, etc.), override any of the following functions:
Fired after every cast attempt regardless of outcome
Arcana_SpellCastSucceeded
Server
ply, spellId, castPos, context
Fired only on a successful cast; castPos is the world position of the magic circle
Arcana_CastSpellFailure
Server
ply, spellId
Fired when a cast fails or is interrupted
Casting Visuals (Client)
Hook
Realm
Parameters
Notes
Arcana_TrackCast
Client
caster, spellId, castTime
Fired when the client receives a cast start network message
Arcana_BeginCastingVisuals
Client
caster, spellId, castTime, forwardLike
Return true to suppress the default magic circle VFX
Arcana_TrackCastFailure
Client
caster, spellId, castTime
Fired when the client receives a cast failure network message
Arcana_CastSpellFailure
Client
caster, spellId
Fired client-side after VFX teardown on failure
Progression
Hook
Realm
Parameters
Notes
Arcana_PlayerGainedXP
Shared
ply, amount, reason
Fired on server when XP is awarded; fired on client when the XP update is received
Arcana_PlayerLevelUp
Server
ply, oldLevel, newLevel, knowledgePoints
Fired after level and knowledge point values are updated
Arcana_ClientLevelUp
Client
prevLevel, newLevel, knowledgeDelta
Fired after the client receives and applies a level-up packet
Arcana_CanUnlockSpell
Server
ply, spellId
Return false, reason to block unlocking
Arcana_SpellUnlocked
Shared
ply, spellId, spellName
Fired after a spell is successfully added to the player's known spells
Enchantments
Hook
Realm
Parameters
Notes
Arcana_CanApplyEnchantment
Server
ply, wep, enchId
Return false, reason to block the enchantment
Arcana_AppliedEnchantment
Server
ply, wep, enchId
Fired after the enchantment is stored and synced
Arcana_RemovedEnchantment
Server
ply, wep, enchId
Fired after the enchantment is removed and synced
Persistence
Hook
Realm
Parameters
Notes
Arcana_SavePlayerDataToSQL
Server
ply, data
Return true to suppress the default SQLite save
Arcana_LoadPlayerDataFromSQL
Server
ply, callback
Return true to suppress the default SQLite load; must call callback(data) yourself
Arcana_SavedPlayerData
Server
ply, data
Fired after player data is saved (any backend)
Arcana_LoadedPlayerData
Server
ply, data
Fired after player data is loaded and ready
Arcana_SyncPlayerData
Client
ply, data
Fired after the client receives a full data sync from the server
Arcana_ReadAstralVault
Server
ply, callback
Return true to suppress the default vault read; must call callback(items) yourself
Arcana_WriteAstralVault
Server
ply, items
Return true to suppress the default vault write
Economy & Inventory
Hook
Realm
Parameters
Notes
Arcana_ItemRegistered
Shared
itemClass, itemData
Fired when a new item type is registered via RegisterItem
Arcana_CoinsGiven
Server
ply, amount, reason
Fired after coins are added to a player
Arcana_CoinsTaken
Server
ply, amount, reason
Fired after coins are deducted from a player
Arcana_ItemGiven
Server
ply, itemClass, amount, reason
Fired after items are added to a player's inventory
Arcana_ItemTaken
Server
ply, itemClass, amount, reason
Fired after items are removed from a player's inventory
Arcana_ShouldDrawInventory
Client
(none)
Return false to hide the Arcana inventory UI
Configuration
Core constants are defined in lua/arcana/system/core.lua under Arcana.Config:
Key
Default
Description
KNOWLEDGE_POINTS_PER_LEVEL
1
Knowledge Points awarded per level
MAX_LEVEL
100
Maximum player level
XP_BASE_CAST_TIME
1.0
Reference cast time for XP scaling
XP_PER_ENCHANT_SUCCESS
20
Flat XP for a successful enchantment
DEFAULT_SPELL_COOLDOWN
1.0
Fallback cooldown if none is specified
RITUAL_CASTING_TIME
10.0
Default ritual casting time in seconds
Astral Vault costs are configured in lua/arcana/astral_vault/config.lua. Mana crystal growth, hotspot decay, and corruption escalation parameters are in lua/arcana/system/mana_crystals.lua.