Hooks Overview
The RisingV.Core.Hooks namespace provides a collection of Harmony-based “hook” classes that intercept key game systems and events in V Rising. By injecting custom behavior at strategic points—such as when a player completes an achievement, when an entity spawns, or when a server message is processed—these hooks allow RisingV plugins to:
- Publish events through the shared
EventBridge
to trigger custom reactions (e.g., awarding rewards, updating UI, enforcing rules). - Modify or augment game logic before or after the original game method runs (e.g., adjusting loot drops, validating player actions, or enforcing server policies).
- Integrate with core RisingV systems (e.g., persistence, authentication, stat tracking) to ensure a unified, extensible modding framework.
Key Responsibilities
Event Publication
Most hook classes capture internal game calls—such asOnPlayerCompleteAchievement
orApplyBuff
—and publish corresponding events (PlayerCompleteAchievementEvent
,BuffAppliedEvent
, etc.) into the RisingV EventBridge. This decouples plugin logic from direct game APIs and ensures that multiple plugins can subscribe and respond to the same underlying game action.Server‐Side Enforcement
Several hooks reside under theRisingV.Core.Hooks.Server
subnamespace. They handle server‐side-only behavior, including:- Authentication/Authorization (
AdminAuthSystemHook
,KickBanSystemServerHook
, etc.) - Persistence and Save/Load (
SaveSystemHook
,LoadPersistenceSystemHook
) - Lifecycle of networked players (
OnUserConnectedHook
,OnUserDisconnectedHook
) - Spawn and destruction of server‐sided game objects (
ScriptSpawnServerHook
,ScriptDestroyServerHook
)
By running before or after authoritative game methods, these hooks ensure that RisingV’s server policies (e.g., whitelist/ban checks, custom data persistence) stay synchronized with the official game lifecycle.
- Authentication/Authorization (
Gameplay Extension
Hooks in the core “client” subnamespace—such asBuffHook
,DeathHook
,UnitSpawnerHook
, andStatChangeSystemHook
—allow RisingV plugins to:- Adjust buff durations, override death behavior, or modify equipment stats.
- Listen for in‐game triggers (e.g., “player died,” “blood consumed,” “armor leveled up”) so custom logic (like special drops, stat scaling, or UI notifications) can be executed.
- Integrate scripting systems by hooking into the gameplay input pipeline (
GameplayInputSystemHook
).
Chat and Communication
- ClientChatHook and ServerChatHook intercept chat packets to modify, filter, or broadcast custom messages.
- ClientBootstrapSystemHook and GameManagerHook (found under
Internal
) ensure that RisingV’s chat formatting and announcements initialize correctly when the game or client starts.
Cross‐Cutting Concerns
- The
AdminAuthSystemHook
ties into the server’s authentication pipeline so that administrator privileges (e.g., commands, teleports) follow RisingV’s permission model. - The
SaveSystemHook
ensures that any RisingV‐specific data (custom components, persistent plugin data) is written to disk and reloaded properly on server restarts or hot‐reloads. - Hooks like
ArmorLevelHook
,WeaponLevelHook
, andVBloodConsumedHook
capture progression milestones—allowing RisingV to implement custom leveling or resource‐consumption logic tied to third‐party plugins.
- The
How to Use Hooks
Reference the
RisingV.Core.Hooks
Namespace
In your RisingV plugin class, import the Hooks namespace to ensure that hooks are automatically applied when your plugin loads:using RisingV.Core.Hooks;
Subscribe to Bridge Events
Each hook publishes a dedicated event type. For example,AchievementHook
publishesPlayerCompleteAchievementEvent
. In your plugin’sOnEnable
orAwake
method, subscribe to the EventBridge:EventBridge.Subscribe<PlayerCompleteAchievementEvent>(OnAchievementCompleted); private void OnAchievementCompleted(PlayerCompleteAchievementEvent evt) { // Custom logic: grant a reward, send a notification, etc. }
Leverage Pre‐ and Post‐Processing
Some hooks support both “prefix” and “postfix” Harmony patches. For instance,BuffHook
may intercept buff application before it takes effect (to modify duration or cancel) and also after (to trigger downstream logic). Consult the individual hook’s API to determine which event or callback is raised.Server Hooks vs. Client Hooks
- Client/Gameplay Hooks run in both single‐player and server‐AM (client) contexts. They generally capture in‐game actions that all players can trigger (e.g., death, buffs, equipment changes).
- Server Hooks (in
RisingV.Core.Hooks.Server
) only execute on the authoritative server and should not be used for client‐only logic. For example,KickBanSystemServerHook
ensures that banned users cannot join, whereasClientChatHook
only modifies chat on the local client side.
Customizing Behavior
If you need to override or suppress default RisingV logic in a hook, you can implement a Harmony “prefix” patch in your own plugin that runs before a hook’s prefix/postfix triggers. Make sure to set the Harmony priority appropriately so that your patch executes in the correct order. Refer to Harmony’s documentation for advanced patch ordering.
Available Hook Classes
Below is a high‐level list of hooks provided by RisingV.Core, organized by category. Click each name to view its full API reference:
Achievement & Progression
– AchievementHook
– ArmorLevelHook
– WeaponLevelHook
– VBloodConsumedHookBuffs, Stats, and Debuffs
– BuffHook
– StatChangeSystemHookEntity Lifecycle
– DeathHook
– DownedHook
– UnitSpawnerHookChat & Communication
– ClientChatHook
– ServerChatHook
– GameplayInputSystemHookServer‐Side Systems
– AdminAuthSystemHook
– SaveSystemHook
– LoadPersistenceSystemHook
– OnUserConnectedHook
– OnUserDisconnectedHook
– ScriptSpawnServerHook
– ScriptDestroyServerHook
– KickBanSystemServerHook
– SettingsManagerHook
– GameBootstrapHook
– ServerBuffHookMiscellaneous / Internal
– ClientBootstrapSystemHook
– GameManagerHook
For complete details on each hook (method signatures, prefix/postfix behavior, and event payloads), refer to the official API documentation:
Summary
RisingV’s Hooks layer serves as the primary extension point for modders and plugin authors to:
- Intercept core game functions (achievements, buffs, chat, spawns).
- Publish high‐level events into the
EventBridge
for downstream consumer plugins. - Enforce server‐side rules (authentication, persistence, bans).
- Customize gameplay behavior (e.g., stat adjustments, loot modifications).
- Seamlessly integrate with RisingV’s plugin lifecycle (
Initialize → Load → Ready → Unload → Terminate
).