From 9cf85fa2b17fcf369ed7618e6888110227079904 Mon Sep 17 00:00:00 2001 From: Deez Date: Wed, 25 Nov 2026 22:49:40 -0500 Subject: [PATCH] Upload files to "/" --- Constants.cs | 10 ++ Directory.Build.props | 9 ++ Directory.Build.targets | 7 + Plugin.cs | 292 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 318 insertions(+) create mode 100644 Constants.cs create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 Plugin.cs diff --git a/Constants.cs b/Constants.cs new file mode 100644 index 0000000..1234bcd --- /dev/null +++ b/Constants.cs @@ -0,0 +1,10 @@ +namespace FortniteEmoteWheel +{ + internal class Constants + { + public const string Guid = "com.deez.fortniteemotewheel"; + public const string Name = "FortniteEmoteWheel"; + public const string Version = "1.5.8"; + public const string Hashkey = "github.com/DeezVrOfficial/FortniteEmoteWheel"; + } +} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..11c2622 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag + $(GamePath)\Gorilla Tag_Data\Managed + $(GamePath)\BepInEx\core + $(GamePath)\BepInEx\plugins + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..bbddfe7 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs new file mode 100644 index 0000000..9249a5b --- /dev/null +++ b/Plugin.cs @@ -0,0 +1,292 @@ +using BepInEx; +using FortniteEmoteWheel.Classes; +using FortniteEmoteWheel.Classes.Admin; +using FortniteEmoteWheel.Classes.EzVersionChecking; +using FortniteEmoteWheel.Patches; +using Photon.Pun; +using Photon.Voice.Unity; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using TMPro; +using UnityEngine; +using UnityEngine.UI; +using Debug = UnityEngine.Debug; +using Hashtable = ExitGames.Client.Photon.Hashtable; + +namespace FortniteEmoteWheel +{ + [BepInIncompatibility("org.hamburbur.menu")] // ZlothY told me himself it don't work. + [BepInPlugin(Constants.Guid, Constants.Name, Constants.Version)] + public class Plugin : BaseUnityPlugin + { + public static Plugin Instance; + + public static Transform firstPersonCameraTransform; + public static Transform thirdPersonCameraTransform; + + public void Awake() => + Instance = this; + + private void Start() + { + HarmonyPatches.ApplyHarmonyPatches(); + GorillaTagger.OnPlayerSpawned(OnGameInitialized); + } + + private void OnGameInitialized() + { + gameObject.AddComponent(); + gameObject.AddComponent(); + + GameObject hamburburDataContainer = new("FEWHamburburData"); + hamburburDataContainer.AddComponent(); + + firstPersonCameraTransform = GorillaTagger.Instance.mainCamera.transform; + thirdPersonCameraTransform = GorillaTagger.Instance.thirdPersonCamera.transform.GetChild(0); + + VersionCheckingInitializer.StartVersionChecking(); + + VersionCheckingInitializer.VersionOutdatedDetected += () => + { + if (PromotionManager.Instance != null && PromotionManager.Instance.TextObj != null) + PromotionManager.Instance.TextObj.text = VersionCheckingInitializer.OutdatedMessage; + + emoteTime = -9999f; + + if (audiomgr != null) + { + if (audiomgr.GetComponent() != null) + audiomgr.GetComponent().Stop(); + } + + if (Wheel.instance != null) + { + Wheel.instance.SetVisible(false); + Wheel.instance.enabled = false; + } + }; + + Hashtable properties = new() + { + { + $"{Constants.Hashkey}", + $"Made by Deez! Version - {Constants.Version}" + }, + }; + + PhotonNetwork.LocalPlayer.SetCustomProperties(properties); + } + + private static AssetBundle assetBundle; + public static GameObject LoadAsset(string assetName) + { + GameObject gameObject = null; + + Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FortniteEmoteWheel.Resources.fn"); + if (stream != null) + { + if (assetBundle == null) + assetBundle = AssetBundle.LoadFromStream(stream); + gameObject = Instantiate(assetBundle.LoadAsset(assetName)); + } + else + Debug.LogError("Failed to load asset from resource: " + assetName); + + return gameObject; + } + + public static GameObject audiomgr = null; + public static void Play2DAudio(AudioClip sound, float volume, bool looping = false) + { + if (audiomgr == null) + { + audiomgr = new GameObject("2DAudioMgr"); + AudioSource temp = audiomgr.AddComponent(); + temp.spatialBlend = 0f; + } + AudioSource ausrc = audiomgr.GetComponent(); + ausrc.volume = volume; + ausrc.loop = looping; + if (!looping) + ausrc.PlayOneShot(sound); + else + { + ausrc.clip = sound; + ausrc.Play(); + } + } + + public static Dictionary audioPool = new Dictionary { }; + public static AudioClip LoadSoundFromResource(string resourcePath) + { + AudioClip sound = null; + + if (!audioPool.ContainsKey(resourcePath)) + { + Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FortniteEmoteWheel.Resources.fn"); + if (stream != null) + { + if (assetBundle == null) + assetBundle = AssetBundle.LoadFromStream(stream); + + sound = assetBundle.LoadAsset(resourcePath) as AudioClip; + audioPool.Add(resourcePath, sound); + } + else + { + Debug.LogError("Failed to load sound from resource: " + resourcePath); + } + } + else + sound = audioPool[resourcePath]; + + return sound; + } + + private static readonly List portedCosmetics = new List { }; + public static void DisableCosmetics() + { + try + { + VRRig.LocalRig.transform.Find("rig/head/gorillaface").gameObject.layer = LayerMask.NameToLayer("Default"); + foreach (GameObject Cosmetic in VRRig.LocalRig.cosmetics) + { + if (Cosmetic.activeSelf && Cosmetic.transform.parent == VRRig.LocalRig.mainCamera.transform.Find("HeadCosmetics")) + { + portedCosmetics.Add(Cosmetic); + Cosmetic.transform.SetParent(VRRig.LocalRig.headMesh.transform, false); + Cosmetic.transform.localPosition += new Vector3(0f, 0.1333f, 0.1f); + } + } + } + catch { } + } + + public static void EnableCosmetics() + { + VRRig.LocalRig.transform.Find("rig/head/gorillaface").gameObject.layer = LayerMask.NameToLayer("MirrorOnly"); + foreach (GameObject Cosmetic in portedCosmetics) + { + Cosmetic.transform.SetParent(VRRig.LocalRig.mainCamera.transform.Find("HeadCosmetics"), false); + Cosmetic.transform.localPosition -= new Vector3(0f, 0.1333f, 0.1f); + } + portedCosmetics.Clear(); + } + + public static GameObject Kyle; + public static float emoteTime; + + public static Vector3 archivePosition; + + public static void Emote(string emoteName, string emoteSound, float animationTime = -1f, bool looping = false) + { + if (Kyle != null) + Destroy(Kyle); + + VRRig.LocalRig.enabled = false; + DisableCosmetics(); + + Play2DAudio(LoadSoundFromResource("play"), 0.5f); + + archivePosition = GorillaTagger.Instance.transform.position; + GorillaLocomotion.GTPlayer.Instance.GetControllerTransform(false).parent.rotation *= Quaternion.Euler(0f, 180f, 0f); + + Kyle = LoadAsset("Rig"); + Kyle.transform.position = VRRig.LocalRig.transform.Find("rig/body_pivot").position - new Vector3(0f, 1.15f, 0f); + Kyle.transform.rotation = VRRig.LocalRig.transform.Find("rig/body_pivot").rotation; + + Kyle.transform.Find("KyleRobot/RobotKile").gameObject.GetComponent().renderingLayerMask = 0; + + Animator KyleRobot = Kyle.transform.Find("KyleRobot").GetComponent(); + KyleRobot.enabled = true; + + AnimationClip Animation = null; + foreach (AnimationClip Clip in KyleRobot.runtimeAnimatorController.animationClips) + { + if (Clip.name == emoteName) + { + Animation = Clip; + break; + } + } + + Animation.wrapMode = looping ? WrapMode.Loop : WrapMode.Default; + KyleRobot.Play(Animation.name); + + AudioClip Sound = LoadSoundFromResource(emoteSound); + Play2DAudio(Sound, 0.5f, looping); + + if (GorillaTagger.Instance.myRecorder != null) + { + GorillaTagger.Instance.myRecorder.SourceType = Recorder.InputSourceType.AudioClip; + GorillaTagger.Instance.myRecorder.AudioClip = Sound; + GorillaTagger.Instance.myRecorder.RestartRecording(true); + } + + emoteTime = Time.time + (animationTime > 0f ? animationTime : Animation.length) + (looping ? 999999999999999f : 0); + } + + public static Vector3 World2Player(Vector3 world) => world - GorillaTagger.Instance.bodyCollider.transform.position + GorillaTagger.Instance.transform.position; + + public void Update() + { + if (GorillaLocomotion.GTPlayer.Instance == null) + return; + + if (Wheel.instance == null && VRRig.LocalRig != null) + { + GameObject Wheel = Plugin.LoadAsset("Wheel"); + Wheel.transform.SetParent(VRRig.LocalRig.transform.Find("rig/hand.R"), false); + Wheel.AddComponent(); + } + + if (Time.time < emoteTime) + { + if (Kyle != null) + { + VRRig.LocalRig.enabled = false; + + GorillaTagger.Instance.transform.position = World2Player(Kyle.transform.position + (Kyle.transform.forward * 1.5f) + new Vector3(0f, 1.15f, 0f)) + new Vector3(0f, 0.5f, 0f); + GorillaTagger.Instance.leftHandTransform.position = GorillaTagger.Instance.bodyCollider.transform.position; + GorillaTagger.Instance.rightHandTransform.position = GorillaTagger.Instance.bodyCollider.transform.position; + + GorillaTagger.Instance.rigidbody.linearVelocity = Vector3.zero; + + VRRig.LocalRig.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.position - (Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.right / 2.5f); + VRRig.LocalRig.transform.rotation = Quaternion.Euler(new Vector3(0f, Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2").transform.rotation.eulerAngles.y, 0f)); + + VRRig.LocalRig.leftHand.rigTarget.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/LeftShoulder/LeftUpperArm/LeftArm/LeftHand").transform.position; + VRRig.LocalRig.rightHand.rigTarget.transform.position = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/RightShoulder/RightUpperArm/RightArm/RightHand").transform.position; + + VRRig.LocalRig.leftHand.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/LeftShoulder/LeftUpperArm/LeftArm/LeftHand").transform.rotation * Quaternion.Euler(0, 0, 75); + VRRig.LocalRig.rightHand.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/RightShoulder/RightUpperArm/RightArm/RightHand").transform.rotation * Quaternion.Euler(180, 0, -75); + + VRRig.LocalRig.head.rigTarget.transform.rotation = Kyle.transform.Find("KyleRobot/ROOT/Hips/Spine1/Spine2/Neck/Head").transform.rotation * Quaternion.Euler(0f, 0f, 90f); + } + } + else + { + if (Kyle != null) + { + VRRig.LocalRig.enabled = true; + EnableCosmetics(); + + Destroy(Kyle); + + if (GorillaTagger.Instance.myRecorder != null) + { + GorillaTagger.Instance.myRecorder.SourceType = Recorder.InputSourceType.Microphone; + GorillaTagger.Instance.myRecorder.AudioClip = null; + GorillaTagger.Instance.myRecorder.RestartRecording(true); + } + + GorillaTagger.Instance.transform.position = archivePosition; + GorillaLocomotion.GTPlayer.Instance.GetControllerTransform(false).parent.rotation *= Quaternion.Euler(0f, 180f, 0f); + } + } + } + } +} \ No newline at end of file