Table of Contents

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

  1. Event Publication
    Most hook classes capture internal game calls—such as OnPlayerCompleteAchievement or ApplyBuff—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.

  2. Server‐Side Enforcement
    Several hooks reside under the RisingV.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.

  3. Gameplay Extension
    Hooks in the core “client” subnamespace—such as BuffHook, DeathHook, UnitSpawnerHook, and StatChangeSystemHook—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).
  4. 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.
  5. 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, and VBloodConsumedHook capture progression milestones—allowing RisingV to implement custom leveling or resource‐consumption logic tied to third‐party plugins.

How to Use Hooks

  1. 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;
    
  2. Subscribe to Bridge Events
    Each hook publishes a dedicated event type. For example, AchievementHook publishes PlayerCompleteAchievementEvent. In your plugin’s OnEnable or Awake method, subscribe to the EventBridge:

    EventBridge.Subscribe<PlayerCompleteAchievementEvent>(OnAchievementCompleted);
    
    private void OnAchievementCompleted(PlayerCompleteAchievementEvent evt)
    {
        // Custom logic: grant a reward, send a notification, etc.
    }
    
  3. 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.

  4. 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, whereas ClientChatHook only modifies chat on the local client side.
  5. 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:

For complete details on each hook (method signatures, prefix/postfix behavior, and event payloads), refer to the official API documentation:

🔗 RisingV.Core.Hooks API Reference


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).