43 lines
1.9 KiB
C#
43 lines
1.9 KiB
C#
using BepInEx;
|
|
using BepInEx.Logging;
|
|
using BepInEx.Unity.IL2CPP;
|
|
using HarmonyLib;
|
|
using RecRoom.Activities.Quest;
|
|
using RecRoom.Core.AI;
|
|
using System.Runtime.InteropServices;
|
|
using UnityEngine;
|
|
|
|
namespace Sk0liosis
|
|
{
|
|
[BepInPlugin("com.splootybean.sk0liosis", "Sk0liosis", "1.0.2")]
|
|
public class Plugin : BasePlugin
|
|
{
|
|
internal static new ManualLogSource Log;
|
|
private readonly Harmony _harmony = new("Sk0liosis");
|
|
public static string[] videos = ["cnpuEwJZCJQ", "nwUfjW81GIE", "k32KJVBs_XE", "eQnZyEq8dKE", "oLjM6udnPoc", "7tFtyEsZSVs", "k7-rrqzw08U", "tjvCfojSEBk", "aymF58wwXDY", "Q6Wxm9Smf5c", "MpV62vSs12I", "s6ZZPA2DUnI", "xbGzExJ0F1Y", "a2zXsyDtNds", "MD-nhXyNFXg", "2zRJxT6Zfu0", "avfte4fbvJ4"];
|
|
|
|
public override void Load()
|
|
{
|
|
Log = base.Log;
|
|
Log.LogInfo("Did you know about THIS ureleased feature in Rec Room?");
|
|
_harmony.PatchAll();
|
|
}
|
|
|
|
[HarmonyPatch(typeof(QuestManager))]
|
|
internal class QuestManagerPatch
|
|
{
|
|
[HarmonyPatch("OnPlayerHealthChanged"), HarmonyPrefix]
|
|
private static void OnPlayerHealthChanged(QuestManager __instance, PhotonPlayer player, QuestManager.HealthChangeType healthChangeType, [Optional] Enemy enemyDeathAttacker, [Optional] PhotonPlayer friendlyFireDeathAttacker)
|
|
{
|
|
string randomVideo = videos[Random.Range(0, videos.Length)];
|
|
bool isDown = __instance.IsQuestRunning && player.IsLocal && (healthChangeType != QuestManager.HealthChangeType.Initialize || healthChangeType > QuestManager.HealthChangeType.Revive);
|
|
if (isDown)
|
|
{
|
|
{
|
|
Application.OpenURL($"https://youtube.com/watch/{randomVideo}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |