Skip to content

Commit

Permalink
5.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
iiDk committed Dec 4, 2024
1 parent f5bc375 commit 54ec688
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 155 deletions.
12 changes: 8 additions & 4 deletions Menu/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3310,10 +3310,14 @@ public static void RPCProtection()
hasRemovedThisFrame = true;
if (GetIndex("Experimental RPC Protection").enabled)
{
RaiseEventOptions options = new RaiseEventOptions();
options.CachingOption = EventCaching.RemoveFromRoomCache;
options.TargetActors = new int[1] { PhotonNetwork.LocalPlayer.ActorNumber };
PhotonNetwork.NetworkingClient.OpRaiseEvent(200, null, options, SendOptions.SendReliable);
PhotonNetwork.RaiseEvent(0, null, new RaiseEventOptions
{
CachingOption = EventCaching.DoNotCache,
TargetActors = new int[]
{
PhotonNetwork.LocalPlayer.ActorNumber
}
}, SendOptions.SendReliable);
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions Mods/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,8 @@ public class Buttons
new ButtonInfo { buttonText = "Attic Crash Gun", method =() => Overpowered.AtticCrashGun(), toolTip = "Crashes whoever your hand desires in the attic."},
new ButtonInfo { buttonText = "Attic Crash All <color=grey>[</color><color=green>T</color><color=grey>]</color>", method =() => Overpowered.AtticCrashAll(), toolTip = "Crashes everybody inside of the attic."},

new ButtonInfo { buttonText = "Guardian Blind Gun", method =() => Overpowered.GuardianBlindGun(), toolTip = "Blinds whoever your hand desires if you're guardian."},
new ButtonInfo { buttonText = "Guardian Blind All <color=grey>[</color><color=green>T</color><color=grey>]</color>", method =() => Overpowered.GuardianBlindAll(), toolTip = "Blinds everybody if you're guardian."},
//new ButtonInfo { buttonText = "Guardian Blind Gun", method =() => Overpowered.GuardianBlindGun(), toolTip = "Blinds whoever your hand desires if you're guardian."},
//new ButtonInfo { buttonText = "Guardian Blind All <color=grey>[</color><color=green>T</color><color=grey>]</color>", method =() => Overpowered.GuardianBlindAll(), toolTip = "Blinds everybody if you're guardian."},

new ButtonInfo { buttonText = "Destroy Gun", method =() => Overpowered.DestroyGun(), toolTip = "Block new players from seeing whoever your hand desires."},
new ButtonInfo { buttonText = "Destroy All", method =() => Overpowered.DestroyAll(), isTogglable = false, toolTip = "Block new players from seeing everyone."},
Expand Down Expand Up @@ -1093,9 +1093,9 @@ public class Buttons
},

new ButtonInfo[] { // Overpowered (in Settings) [31]
new ButtonInfo { buttonText = "Exit Overpowered Settings", method =() => Settings.EnableSettings(), isTogglable = false, toolTip = "Returns you back to the settings menu."},
new ButtonInfo { buttonText = "Exit Overpowered Settings", method =() => Settings.EnableSettings(), isTogglable = false, toolTip = "Returns you back to the settings menu."}

new ButtonInfo { buttonText = "Legacy Kick", toolTip = "Uses the old version of the kick mods."}
// What a lone category
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion Mods/Movement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public static void Dash()
{
if (rightPrimary && !lastaomfg)
{
GorillaLocomotion.Player.Instance.GetComponent<Rigidbody>().velocity += GorillaLocomotion.Player.Instance.headCollider.transform.forward * (flySpeed * 2);
GorillaLocomotion.Player.Instance.GetComponent<Rigidbody>().velocity += GorillaLocomotion.Player.Instance.headCollider.transform.forward * flySpeed;
}
lastaomfg = rightPrimary;
}
Expand Down
152 changes: 20 additions & 132 deletions Mods/Overpowered.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using iiMenu.Notifications;
using Photon.Pun;
using Photon.Realtime;
using Photon.Voice.PUN;
using System.Collections;
using UnityEngine;
using UnityEngine.InputSystem;
Expand Down Expand Up @@ -550,43 +551,6 @@ public static void AtticCrashAll()
}

private static float delaything = 0f;
public static void GuardianBlindGun()
{
if (GetGunInput(false))
{
var GunData = RenderGun();
RaycastHit Ray = GunData.Ray;
GameObject NewPointer = GunData.NewPointer;

if (GetGunInput(true) && Time.time > delaything)
{
VRRig possibly = Ray.collider.GetComponentInParent<VRRig>();
if (possibly && possibly != GorillaTagger.Instance.offlineVRRig)
{
delaything = Time.time + 0.1f;
RigManager.GetNetworkViewFromVRRig(possibly).SendRPC("GrabbedByPlayer", GetPlayerFromVRRig(possibly), new object[] { true, false, false });
RigManager.GetNetworkViewFromVRRig(possibly).SendRPC("DroppedByPlayer", GetPlayerFromVRRig(possibly), new object[] { new Vector3(0f, float.NaN, 0f) });
}
}
}
}

public static void GuardianBlindAll()
{
if (rightTrigger > 0.5f)
{
if (Time.time > delaything)
{
delaything = Time.time + 0.1f;
foreach (VRRig player in GorillaParent.instance.vrrigs)
{
RigManager.GetNetworkViewFromVRRig(player).SendRPC("GrabbedByPlayer", RpcTarget.Others, new object[] { true, false, false });
RigManager.GetNetworkViewFromVRRig(player).SendRPC("DroppedByPlayer", RpcTarget.Others, new object[] { new Vector3(0f, float.NaN, 0f) });
}
}
}
}

// Hi skids :3
// If you take this code you like giving sloppy wet kisses to cute boys >_<
// I gotta stop
Expand Down Expand Up @@ -675,11 +639,10 @@ public static void LagGun()
{
if (Time.time > delaything)
{
delaything = Time.time + 0.3f;
PhotonView photonView = GameObject.Find("WorldShareableCosmetic").GetComponent<WorldShareableItem>().guard.photonView;
for (int i = 0; i < 100; i++)
delaything = Time.time + 0.049f;
for (int i = 0; i < 25; i++)
{
photonView.RPC("OnMasterClientAssistedTakeoverRequest", NetPlayerToPlayer(GetPlayerFromVRRig(whoCopy)), new object[2]);
FriendshipGroupDetection.Instance.photonView.RPC("NotifyNoPartyToMerge", NetPlayerToPlayer(GetPlayerFromVRRig(whoCopy)), new object[] { null });
}
}
}
Expand Down Expand Up @@ -710,11 +673,11 @@ public static void LagAll()
{
if (Time.time > delaything)
{
delaything = Time.time + 0.3f;
delaything = Time.time + 0.049f;
PhotonView photonView = GameObject.Find("WorldShareableCosmetic").GetComponent<WorldShareableItem>().guard.photonView;
for (int i = 0; i < 100; i++)
for (int i = 0; i < 25; i++)
{
photonView.RPC("OnMasterClientAssistedTakeoverRequest", RpcTarget.Others, new object[2]);
FriendshipGroupDetection.Instance.photonView.RPC("NotifyNoPartyToMerge", RpcTarget.Others, new object[] { null });
}
}
}
Expand All @@ -732,9 +695,9 @@ public static IEnumerator KickRig(VRRig FUCKER)
{
{ 0, photonView.ViewID },
{ 2, (int)(PhotonNetwork.ServerTimestamp + -int.MaxValue) },
{ 3, "RPC_RequestCosmetics" },
{ 4, new object[] { /*NetPlayerToPlayer(GetPlayerFromVRRig(FUCKER))*/ } },
{ 5, (byte)PhotonNetwork.PhotonServerSettings.RpcList.IndexOf("RPC_RequestCosmetics") }
{ 3, "RPC_RequestMaterialColor" },
{ 4, new object[] { NetPlayerToPlayer(GetPlayerFromVRRig(FUCKER)) } },
{ 5, (byte)91 }
};
PhotonNetwork.NetworkingClient.LoadBalancingPeer.OpRaiseEvent(200, rpcHash, new RaiseEventOptions
{
Expand All @@ -747,36 +710,7 @@ public static IEnumerator KickRig(VRRig FUCKER)
Encrypt = false
});
}
}

public static IEnumerator KickRigCyrus(VRRig rig)
{
PhotonHandler handler = GameObject.Find("PhotonMono").GetComponent<PhotonHandler>();

PhotonView photonView = GetPhotonViewFromVRRig(rig);
Player kickingPlayer = NetPlayerToPlayer(GetPlayerFromVRRig(rig));

SetTick(9999f);

yield return new WaitForSeconds(0.5f);

Traverse.Create(handler)
.Field("SendAsap")
.SetValue(true);

Traverse.Create(handler)
.Field("MaxDatagrams")
.SetValue(255);

for (int i = 0; i < 3945; i += 100)
{
for (int j = i; j < System.Math.Min(i + 100, 3945); j++)
{
photonView.RPC("RPC_RequestMaterialColor", RpcTarget.Others, new object[] { kickingPlayer });
}
PhotonNetwork.SendAllOutgoingCommands();
}
PhotonNetwork.SendAllOutgoingCommands();
RPCProtection();
}

private static Coroutine KVCoroutine = null;
Expand All @@ -787,7 +721,7 @@ public static void KickGun()
{
SetTick(1000f);
}
if (rightGrab || Mouse.current.rightButton.isPressed || isCopying)
if (GetGunInput(false) || isCopying)
{
var GunData = RenderGun();
RaycastHit Ray = GunData.Ray;
Expand All @@ -814,7 +748,7 @@ public static void KickGun()
try { CoroutineManager.EndCoroutine(KVCoroutine); } catch { }
}
}
if ((rightTrigger > 0.5f || Mouse.current.leftButton.isPressed) && !isCopying)
if (GetGunInput(true) && !isCopying && PhotonVoiceNetwork.Instance.PrimaryRecorder.IsInitialized)
{
VRRig possibly = Ray.collider.GetComponentInParent<VRRig>();
if (possibly && possibly != GorillaTagger.Instance.offlineVRRig)
Expand All @@ -823,7 +757,7 @@ public static void KickGun()
whoCopy = possibly;
SetTick(9999f);
NotifiLib.SendNotification("<color=grey>[</color><color=purple>KICK</color><color=grey>]</color> <color=white>Player is being kicked...</color>");
KVCoroutine = CoroutineManager.RunCoroutine(GetIndex("Legacy Kick").enabled ? KickRig(whoCopy) : KickRigCyrus(whoCopy));
KVCoroutine = CoroutineManager.RunCoroutine(KickRig(whoCopy));
}
}
} else
Expand All @@ -836,60 +770,14 @@ public static void KickGun()
}
}
}
public static void KickGunCyrus()
{
if (!PhotonNetwork.InRoom)
{
SetTick(1000f);
}
if (rightGrab || Mouse.current.rightButton.isPressed || isCopying)
{
var GunData = RenderGun();
RaycastHit Ray = GunData.Ray;
GameObject NewPointer = GunData.NewPointer;

if (isCopying && whoCopy != null)
{
if (!PhotonNetwork.InRoom)
{
isCopying = false;
whoCopy = null;
SetTick(1000f);
NotifiLib.SendNotification("<color=grey>[</color><color=red>ERROR</color><color=grey>]</color> <color=white>You have been kicked for sending too many RPCs, you will reconnect shortly.</color>");
rejRoom = ihavediahrrea;
try { CoroutineManager.EndCoroutine(KVCoroutine); } catch { }
}
if (GetPlayerFromVRRig(whoCopy) == null)
{
isCopying = false;
whoCopy = null;
SetTick(1000f);
NotifiLib.SendNotification("<color=grey>[</color><color=green>SUCCESS</color><color=grey>]</color> <color=white>Player has been kicked!</color>");
rejRoom = ihavediahrrea;
try { CoroutineManager.EndCoroutine(KVCoroutine); } catch { }
}
}
if ((rightTrigger > 0.5f || Mouse.current.leftButton.isPressed) && !isCopying)
{
VRRig possibly = Ray.collider.GetComponentInParent<VRRig>();
if (possibly && possibly != GorillaTagger.Instance.offlineVRRig)
{
isCopying = true;
whoCopy = possibly;
SetTick(9999f);
NotifiLib.SendNotification("<color=grey>[</color><color=purple>KICK</color><color=grey>]</color> <color=white>Player is being kicked...</color>");
KVCoroutine = CoroutineManager.RunCoroutine(KickRigCyrus(whoCopy));
}
}
}
else
public static void DisableKickGun()
{
SetTick(1000f);
if (isCopying)
{
if (isCopying)
{
isCopying = false;
SetTick(1000f);
try { CoroutineManager.EndCoroutine(KVCoroutine); } catch { }
}
isCopying = false;
NotifiLib.SendNotification("<color=grey>[</color><color=red>ERROR</color><color=grey>]</color> <color=white>Player kick has been cancelled.</color>");
}
}

Expand Down
48 changes: 35 additions & 13 deletions Patches/Safety.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,30 +216,52 @@ public static bool Prefix(VRRig __instance, VRRig grabbedByRig, Vector3 throwVel
[HarmonyPatch(typeof(RequestableOwnershipGuard), "OwnershipRequested")]
public class AntiCrashPatch2
{
private static List<DateTime> callTimestamps = new List<DateTime>();
public static bool Prefix()
{
List<DateTime> callTimestamps = new List<DateTime>();

DateTime now = DateTime.Now;
callTimestamps.Add(now);
callTimestamps.RemoveAll(t => (now - t).TotalSeconds > 2);
if (AntiCrashToggle)
{
DateTime now = DateTime.Now;
callTimestamps.Add(now);
callTimestamps.RemoveAll(t => (now - t).TotalSeconds > 1);

return callTimestamps.Count > 10;
return callTimestamps.Count > 15;
}
return true;
}
}

[HarmonyPatch(typeof(RequestableOwnershipGuard), "OnMasterClientAssistedTakeoverRequest")]
[HarmonyPatch(typeof(VRRig), "RequestCosmetics")]
public class AntiCrashPatch3
{
public static bool Prefix()
private static List<float> callTimestamps = new List<float>();
public static bool Prefix(VRRig __instance)
{
List<DateTime> callTimestamps = new List<DateTime>();
if (AntiCrashToggle && __instance == GorillaTagger.Instance.offlineVRRig)
{
callTimestamps.Add(Time.time);
callTimestamps.RemoveAll(t => (Time.time - t) > 1);

return callTimestamps.Count > 15;
}
return true;
}
}

DateTime now = DateTime.Now;
callTimestamps.Add(now);
callTimestamps.RemoveAll(t => (now - t).TotalSeconds > 2);
[HarmonyPatch(typeof(VRRig), "RequestMaterialColor")]
public class AntiCrashPatch4
{
private static List<float> callTimestamps = new List<float>();
public static bool Prefix(VRRig __instance)
{
if (AntiCrashToggle && __instance == GorillaTagger.Instance.offlineVRRig)
{
callTimestamps.Add(Time.time);
callTimestamps.RemoveAll(t => (Time.time - t) > 1);

return callTimestamps.Count > 10;
return callTimestamps.Count > 15;
}
return true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion PluginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public class PluginInfo
public const string GUID = "org.iidk.gorillatag.iimenu";
public const string Name = "ii's Stupid Menu";
public const string Description = "Created by @goldentrophy with love <3";
public const string Version = "5.1.1";
public const string Version = "5.1.2";
}
}

0 comments on commit 54ec688

Please sign in to comment.