RustTip

OnAdventGiftAward

OxideCarbonSeasonal

Called when advent gift award occurs.

object OnAdventGiftAward(AdventCalendar adventCalendar, BasePlayer player)
Works — the game method in this build is the one the hook was written for.

Parameters

adventCalendar
AdventCalendar
player
BasePlayer

Return value

objectReturn non-null to cancel the game action.

Example

object — you can affect the game: return a value to change or cancel the action.

private object OnAdventGiftAward(AdventCalendar adventCalendar, BasePlayer player)
{
    Puts("OnAdventGiftAward");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return false; // non-null cancels the game action
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
void AdventCalendar.AwardGift(BasePlayer)

Passes: AdventCalendar adventCalendar, BasePlayer player

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: AllAssembly-CSharp.dll

Where it is called (this branch's game code)

public void AwardGift(BasePlayer player)
{
	if (Interface.CallHook("OnAdventGiftAward", this, player) != null)
	{
		return;
	}
	DateTime now = DateTime.Now;
	int num = ((overrideAdventCalendarDay > 0) ? overrideAdventCalendarDay : now.Day) - startDay;
	if (((overrideAdventCalendarMonth > 0) ? overrideAdventCalendarMonth : now.Month) != startMonth || num < 0 || num >= days.Length)
	{
		return;
// …

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.