Valheim.CustomRaids/RaidFrequencyOverhaul/RaidFrequencyOverhaul.cs
/// <summary>
/// Take control over raid checking.
/// </summary>
Take control over raid checking.
Take control over raid checking .
[HarmonyPatch("UpdateRandomEvent")]
        [HarmonyPrefix]
        private static bool UpdateIndividualRandomEvents(RandEventSystem __instance, float dt, ref float ___m_eventTimer, ref float ___m_sendTimer)
        {
            if ((ConfigurationManager.GeneralConfig?.UseIndividualRaidChecks?.Value ?? false) == false)
            {
                return true;
            }
            if(!ZNet.instance.IsServer())
            {
                return true;
            }
            ___m_eventTimer += dt;
            ___m_sendTimer += dt;
            if (___m_sendTimer > 2f)
            {
                Log.LogTrace("Checking for possible raids.");
                if (CheckAndStartRaids(__instance, ___m_eventTimer))
                {
                    ___m_eventTimer = 0;
                }
                if (___m_sendTimer > 2f)
                {
                    ___m_sendTimer = 0f;
                    SendCurrentRandomEvent(__instance);
                }
            }
            return false;
        }
[ HarmonyPatch ( " " ) ] [ HarmonyPrefix ] private static bool UpdateIndividualRandomEvents ( RandEventSystem __instance , float dt , ref float ___m_eventTimer , ref float ___m_sendTimer ) { if ( ( ConfigurationManager . GeneralConfig ? . UseIndividualRaidChecks ? . Value ?? false ) == false ) { return true ; } if ( ! ZNet . instance . IsServer ( ) ) { return true ; } ___m_eventTimer += dt ; ___m_sendTimer += dt ; if ( ___m_sendTimer > 2f ) { Log . LogTrace ( " " ) ; if ( CheckAndStartRaids ( __instance , ___m_eventTimer ) ) { ___m_eventTimer = 0 ; } if ( ___m_sendTimer > 2f ) { ___m_sendTimer = 0f ; SendCurrentRandomEvent ( __instance ) ; } } return false ; }
Take control over raid checking.
Take control over raid checking .
//Update current event timer.  //Just using the default solution here... It apparently sends out an update every 2 seconds with the current raid event.
__instance
RandEventSystem
dt
float
float
ref