using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Timers;
using BoneLib;
using BoneLib.BoneMenu.Elements;
using HideAndSeekGamemode;
using HideAndSeekGamemode.Data;
using HideAndSeekGamemode.Messages;
using LabFusion.Data;
using LabFusion.Extensions;
using LabFusion.Network;
using LabFusion.Representation;
using LabFusion.SDK.Gamemodes;
using LabFusion.SDK.Modules;
using LabFusion.SDK.Points;
using LabFusion.Senders;
using LabFusion.Utilities;
using MelonLoader;
using SLZ.Interaction;
using SLZ.Marrow.Pool;
using SwipezGamemodeLib.Spawning;
using SwipezGamemodeLib.Spectator;
using SwipezGamemodeLib.Utilities;
using UnhollowerBaseLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyProduct("HideAndSeek")]
[assembly: AssemblyCopyright("Created by KitchenBoy")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: ModuleInfo(typeof(HideAndSeek), "HideAndSeek", "1.0.0", "KitchenBoy", "H&S", true, ConsoleColor.DarkCyan)]
[assembly: MelonInfo(typeof(HideAndSeekMod), "HideAndSeek", "1.0.0", "KitchenBoy", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HideAndSeekGamemode
{
public static class BuildInfo
{
public const string Name = "HideAndSeek";
public const string Description = "A Hide and Seek gamemode for Fusion!";
public const string Author = "KitchenBoy";
public const string Company = "SilverWare";
public const string Version = "1.0.0";
public const string DownloadLink = null;
}
public class HideAndSeekMod : MelonMod
{
public override void OnInitializeMelon()
{
ModuleHandler.LoadModule(Assembly.GetExecutingAssembly());
GamemodeRegistration.LoadGamemodes(Assembly.GetExecutingAssembly());
}
}
public static class ModuleInfo
{
public const string Name = "HideAndSeek";
public const string Version = "1.0.0";
public const string Author = "KitchenBoy";
public const string Abbreviation = "H&S";
public const bool AutoRegister = true;
public const ConsoleColor Color = ConsoleColor.DarkCyan;
}
public class HideAndSeek : Gamemode
{
private static GamemodeTimer RoundTimer = new GamemodeTimer();
private static int seekTime = 5;
private static int hideTime = 30;
private static int activeSeekTime;
private static int activeHideTime;
public static List<Player> PlayerList = new List<Player>();
public Vector3 CurrentSpawn;
private Random rand = new Random();
public Player CurrentPlayer;
public byte CurrentSeekerId;
private bool wasFound;
public bool ForceOverrideAvatar = true;
internal AssetPoolee BatAssetPoole;
internal static int NumPlayersKilled = 0;
internal static bool seekOver = false;
internal static bool hideOver = false;
public static HideAndSeek Instance { get; private set; }
public override string GamemodeCategory => "SilverWare";
public override string GamemodeName => "Hide and Seek";
public override bool DisableDevTools => true;
public override bool DisableSpawnGun => true;
public override bool DisableManualUnragdoll => false;
public override bool PreventNewJoins => true;
public override void OnBoneMenuCreated(MenuCategory category)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
((Gamemode)this).OnBoneMenuCreated(category);
category.CreateIntElement("Seeking Time (Minutes)", Color.white, 5, 1, 3, 20, (Action<int>)delegate(int v)
{
seekTime = v;
});
category.CreateIntElement("Hiding Time (Seconds)", Color.white, 30, 1, 15, 60, (Action<int>)delegate(int v)
{
hideTime = v;
});
category.CreateBoolElement("Force Tall/Short Avatar", Color.white, true, (Action<bool>)delegate(bool v)
{
ForceOverrideAvatar = v;
});
}
public override void OnGamemodeRegistered()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
((Gamemode)this).OnGamemodeRegistered();
Instance = this;
MultiplayerHooking.OnPlayerAction += new PlayerAction(OnPlayerAction);
Hooking.OnLevelInitialized += OnLevelLoad;
MultiplayerHooking.OnPlayerLeave += new PlayerUpdate(OnPlayerLeave);
FusionOverrides.OnValidateNametag += (UserOverride)((PlayerId id) => OnValidateNametag(id));
Hooking.OnGripAttached += OnGripAttached;
}
private void OnGripAttached(Grip grip, Hand hand)
{
try
{
if (!Gamemode.IsGamemodeRunning)
{
return;
}
if (!ComponentExtensions.IsPartOfSelf((Component)(object)hand))
{
PlayerRep val = default(PlayerRep);
PlayerRepManager.TryGetPlayerRep(hand.manager, ref val);
if (CurrentSeekerId != val.PlayerId.SmallId)
{
hand.DetachObject();
}
}
else if (!CurrentPlayer.IsSeeker)
{
hand.DetachObject();
}
}
catch
{
}
}
protected bool OnValidateNametag(PlayerId id)
{
if (!((Gamemode)this).IsActive())
{
return true;
}
if (CurrentPlayer.IsSeeker)
{
return false;
}
return true;
}
private void OnPlayerLeave(PlayerId playerId)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
if (Gamemode.IsGamemodeRunning)
{
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Player Left"),
message = NotificationText.op_Implicit("Ending Hide and Seek since player left!"),
popupLength = 5f,
isMenuItem = false,
showTitleOnPopup = true
});
((Gamemode)this).StopGamemode();
}
}
private void OnLevelLoad(LevelInfo info)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if (NetworkInfo.IsServer)
{
CurrentSpawn = ((Component)Player.physicsRig).transform.position;
}
}
private void OnPlayerAction(PlayerId playerId, PlayerActionType type, PlayerId otherPlayer)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
if (Gamemode.IsGamemodeRunning && (int)type == 128 && NetworkInfo.IsServer && PlayerList.Find((Player x) => x.Id == otherPlayer.SmallId).IsSeeker)
{
RoundStatusSenders.NotifyDeath(playerId.SmallId);
}
}
protected override void OnStartGamemode()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
((Gamemode)this).OnStartGamemode();
FusionOverrides.ForceUpdateOverrides();
wasFound = false;
((Gamemode)this).SetPlaylist(0.4f, (AudioClip[])(object)new AudioClip[1] { FusionContentLoader.CombatPlaylist[3] });
hideOver = false;
seekOver = false;
NumPlayersKilled = 0;
PlayerList.Clear();
if (!NetworkInfo.IsServer)
{
return;
}
if (PlayerIdManager.PlayerCount < 2)
{
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Not Enough Players"),
message = NotificationText.op_Implicit("There are not enough players to start the game!"),
popupLength = 5f,
isMenuItem = false
});
((Gamemode)this).StopGamemode();
return;
}
string name = default(string);
foreach (PlayerId playerId in PlayerIdManager.PlayerIds)
{
Player player = new Player();
MetadataHelper.TryGetDisplayName(playerId, ref name);
player.Name = name;
player.Id = playerId.SmallId;
player.IsSeeker = false;
PlayerList.Add(player);
}
byte b = (byte)rand.Next(PlayerList.Count);
PlayerList[b].IsSeeker = true;
foreach (Player player2 in PlayerList)
{
RoundStatusSenders.SendRoundStart(CurrentSpawn, PlayerIdManager.GetPlayerId(player2.Id), player2.IsSeeker, ForceOverrideAvatar, b);
}
activeSeekTime = seekTime;
activeHideTime = hideTime;
RoundTimer.Start();
}
protected override void OnStopGamemode()
{
((Gamemode)this).OnStopGamemode();
FusionOverrides.ForceUpdateOverrides();
FusionPlayer.ResetMortality();
FusionPlayer.ClearAvatarOverride();
FusionPlayerExtended.ClearModifiedStats();
FusionPlayerExtended.SetCanDamageOthers(true);
FusionPlayerExtended.SetWorldInteractable(true);
FusionPlayerExtended.RefreshAvatar();
foreach (PlayerId playerId in PlayerIdManager.PlayerIds)
{
PlayerIdExtensions.Show(playerId);
}
try
{
AssetSpawner.Despawn(BatAssetPoole);
}
catch
{
}
}
protected override void OnUpdate()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (CurrentPlayer == null)
{
return;
}
if (Gamemode.IsGamemodeRunning && CurrentPlayer.IsSeeker && !hideOver)
{
Player.rigManager.Teleport(CurrentSpawn, true);
}
if (NetworkInfo.IsServer && Gamemode.IsGamemodeRunning && RoundTimer.isRunning)
{
if (RoundTimer.IsFinishedInSeconds(activeHideTime) && !hideOver)
{
hideOver = true;
RoundStatusSenders.SendRoundStatus(RoundStatusUpdateData.RoundStatus.HideEnd);
}
else if (RoundTimer.IsFinishedInMinutes(activeSeekTime) && !seekOver && RoundTimer.IsFinishedInMinutes(activeSeekTime) && !seekOver)
{
seekOver = true;
RoundStatusSenders.SendRoundEnd(seekersWin: false);
((Gamemode)this).StopGamemode();
}
}
}
}
}
namespace HideAndSeekGamemode.Data
{
public class Player
{
public string Name { get; set; }
public byte Id { get; set; }
public bool IsSeeker { get; set; }
}
}
namespace HideAndSeekGamemode.Messages
{
internal class RoundEndData : IFusionSerializable, IDisposable
{
public bool SeekersWin;
public void Dispose()
{
GC.SuppressFinalize(this);
}
public void Serialize(FusionWriter writer)
{
writer.Write(SeekersWin);
}
public void Deserialize(FusionReader reader)
{
SeekersWin = reader.ReadBoolean();
}
public static RoundEndData Create(bool seekersWin)
{
return new RoundEndData
{
SeekersWin = seekersWin
};
}
}
public class RoundEndMessage : ModuleMessageHandler
{
public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
FusionReader val = FusionReader.Create(bytes);
try
{
using RoundEndData roundEndData = val.ReadFusionSerializable<RoundEndData>();
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Round End"),
message = NotificationText.op_Implicit(roundEndData.SeekersWin ? "Seekers Win!" : "Hiders Win!"),
popupLength = 5f,
isMenuItem = false
});
if (HideAndSeek.Instance.CurrentPlayer.IsSeeker == roundEndData.SeekersWin)
{
PointItemManager.RewardBits(new Random().Next(80, 120), true);
FusionAudio.Play2D(FusionContentLoader.LavaGangVictory, 1f);
}
else
{
FusionAudio.Play2D(FusionContentLoader.LavaGangFailure, 1f);
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
public class RoundStatusUpdateData : IFusionSerializable, IDisposable
{
public enum RoundStatus
{
HideEnd = 1,
SeekEnd
}
public RoundStatus CurrentRoundStatus;
public void Dispose()
{
GC.SuppressFinalize(this);
}
public void Serialize(FusionWriter writer)
{
writer.Write((byte)CurrentRoundStatus);
}
public void Deserialize(FusionReader reader)
{
CurrentRoundStatus = (RoundStatus)reader.ReadByte();
}
public static RoundStatusUpdateData Create(RoundStatus status)
{
return new RoundStatusUpdateData
{
CurrentRoundStatus = status
};
}
}
public class RoundStatusUpdateMessage : ModuleMessageHandler
{
public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
FusionReader val = FusionReader.Create(bytes);
try
{
using RoundStatusUpdateData roundStatusUpdateData = val.ReadFusionSerializable<RoundStatusUpdateData>();
if (roundStatusUpdateData.CurrentRoundStatus != RoundStatusUpdateData.RoundStatus.HideEnd)
{
return;
}
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Hiding End"),
showTitleOnPopup = true,
message = NotificationText.op_Implicit(HideAndSeek.Instance.CurrentPlayer.IsSeeker ? "Let the hunt begin!" : "Seekers are coming!"),
popupLength = 3f,
isMenuItem = false
});
if (!HideAndSeek.Instance.CurrentPlayer.IsSeeker)
{
FusionPlayerExtended.ClearModifiedStats();
FusionPlayerExtended.SetCanDamageOthers(false);
FusionPlayerExtended.SetWorldInteractable(false);
}
HideAndSeek.hideOver = true;
foreach (PlayerId playerId in PlayerIdManager.PlayerIds)
{
PlayerIdExtensions.Show(playerId);
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
public class RoundStartData : IFusionSerializable, IDisposable
{
public bool isSeeker;
public Vector3 startPos;
public bool hasOverrides;
public byte currentSeekerId;
public void Dispose()
{
GC.SuppressFinalize(this);
}
public void Serialize(FusionWriter writer)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
writer.Write(isSeeker);
writer.Write(startPos);
writer.Write(hasOverrides);
writer.Write(currentSeekerId);
}
public void Deserialize(FusionReader reader)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
isSeeker = reader.ReadBoolean();
startPos = reader.ReadVector3();
hasOverrides = reader.ReadBoolean();
currentSeekerId = reader.ReadByte();
}
public static RoundStartData Create(Vector3 startPosition, bool isSeeker, bool hasOverrides, byte currentSeekerId)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return new RoundStartData
{
startPos = startPosition,
isSeeker = isSeeker,
hasOverrides = hasOverrides,
currentSeekerId = currentSeekerId
};
}
}
public class RoundStartMessage : ModuleMessageHandler
{
public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
FusionReader val = FusionReader.Create(bytes);
try
{
using RoundStartData roundStartData = val.ReadFusionSerializable<RoundStartData>();
if (!Gamemode.IsGamemodeRunning)
{
return;
}
HideAndSeek.Instance.CurrentSpawn = roundStartData.startPos;
HideAndSeek.Instance.CurrentSeekerId = roundStartData.currentSeekerId;
FusionPlayer.Teleport(HideAndSeek.Instance.CurrentSpawn, Vector3.forward, true);
if (Player.leftHand.HasAttachedObject())
{
Player.leftHand.DetachObject();
}
if (Player.rightHand.HasAttachedObject())
{
Player.rightHand.DetachObject();
}
if (roundStartData.isSeeker)
{
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Round Start"),
message = NotificationText.op_Implicit("You are the seeker! Check your inventory for a Baseball Bat!"),
popupLength = 4f,
type = (NotificationType)0,
isMenuItem = false
});
foreach (PlayerId playerId in PlayerIdManager.PlayerIds)
{
if (!playerId.IsSelf)
{
PlayerIdExtensions.Hide(playerId);
}
}
SpawnManager.SpawnSpawnable("c1534c5a-6441-40aa-a070-909542617365", HideAndSeek.Instance.CurrentSpawn, Quaternion.identity, (Action<GameObject>)delegate(GameObject bat)
{
InventorySlotReceiver inventorySlotReceiver = ((Il2CppArrayBase<SlotContainer>)(object)Player.rigManager.inventory.bodySlots)[3].inventorySlotReceiver;
InteractableHost component = bat.GetComponent<InteractableHost>();
if ((Object)(object)component != (Object)null)
{
inventorySlotReceiver.InsertInSlot(component);
}
HideAndSeek.Instance.BatAssetPoole = bat.GetComponent<AssetPoolee>();
});
FusionPlayer.SetMortality(false);
if (roundStartData.hasOverrides)
{
FusionPlayer.SetAvatarOverride("fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharTallv4");
}
}
else
{
FusionNotifier.Send(new FusionNotification
{
title = NotificationText.op_Implicit("Round Start"),
message = NotificationText.op_Implicit("You are a hider! Grips are disabled!"),
popupLength = 4f,
type = (NotificationType)0,
isMenuItem = false
});
FusionPlayer.SetMortality(true);
if (roundStartData.hasOverrides)
{
FusionPlayer.SetAvatarOverride("fa534c5a83ee4ec6bd641fec424c4142.Avatar.CharFurv4GB");
}
FusionPlayerExtended.SetCanDamageOthers(false);
FusionPlayerExtended.SetWorldInteractable(false);
}
Player player = new Player();
player.IsSeeker = roundStartData.isSeeker;
player.Id = PlayerIdManager.LocalId.SmallId;
string name = default(string);
MetadataHelper.TryGetDisplayName(PlayerIdManager.LocalId, ref name);
player.Name = name;
FusionPlayerExtended.RefreshAvatar();
HideAndSeek.Instance.CurrentPlayer = player;
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
public static class RoundStatusSenders
{
public static void SendRoundStatus(RoundStatusUpdateData.RoundStatus status)
{
if (!NetworkInfo.IsServer)
{
return;
}
FusionWriter val = FusionWriter.Create();
try
{
using RoundStatusUpdateData roundStatusUpdateData = RoundStatusUpdateData.Create(status);
val.Write<RoundStatusUpdateData>(roundStatusUpdateData);
FusionMessage val2 = FusionMessage.ModuleCreate<RoundStatusUpdateMessage>(val);
try
{
MessageSender.BroadcastMessage((NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public static void SendRoundStart(Vector3 startPosition, PlayerId player, bool isSeeker, bool hasOverrides, byte seekerId)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkInfo.IsServer)
{
return;
}
FusionWriter val = FusionWriter.Create();
try
{
using RoundStartData roundStartData = RoundStartData.Create(startPosition, isSeeker, hasOverrides, seekerId);
val.Write<RoundStartData>(roundStartData);
FusionMessage val2 = FusionMessage.ModuleCreate<RoundStartMessage>(val);
try
{
MessageSender.SendFromServer(player.SmallId, (NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public static void SendRoundEnd(bool seekersWin)
{
if (!NetworkInfo.IsServer)
{
return;
}
FusionWriter val = FusionWriter.Create();
try
{
using RoundEndData roundEndData = RoundEndData.Create(seekersWin);
val.Write<RoundEndData>(roundEndData);
FusionMessage val2 = FusionMessage.ModuleCreate<RoundEndMessage>(val);
try
{
MessageSender.BroadcastMessage((NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
public static void NotifyDeath(byte id)
{
FusionWriter val = FusionWriter.Create();
try
{
using PlayerDeathData playerDeathData = PlayerDeathData.Create(id);
val.Write<PlayerDeathData>(playerDeathData);
FusionMessage val2 = FusionMessage.ModuleCreate<PlayerDeathMessage>(val);
try
{
MessageSender.BroadcastMessage((NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
public class PlayerDeathData : IFusionSerializable, IDisposable
{
public byte id;
public void Dispose()
{
GC.SuppressFinalize(this);
}
public void Serialize(FusionWriter writer)
{
writer.Write(id);
}
public void Deserialize(FusionReader reader)
{
id = reader.ReadByte();
}
public static PlayerDeathData Create(byte id)
{
return new PlayerDeathData
{
id = id
};
}
}
public class PlayerDeathMessage : ModuleMessageHandler
{
public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
FusionReader val = FusionReader.Create(bytes);
try
{
using PlayerDeathData playerDeathData = val.ReadFusionSerializable<PlayerDeathData>();
if (Gamemode.IsGamemodeRunning)
{
MelonLogger.Msg("Player Died Message Received");
PlayerId playerId = PlayerIdManager.GetPlayerId(playerDeathData.id);
HideAndSeek.NumPlayersKilled++;
if (PlayerIdManager.PlayerCount - HideAndSeek.NumPlayersKilled <= 1 && NetworkInfo.IsServer)
{
RoundStatusSenders.SendRoundEnd(seekersWin: true);
((Gamemode)HideAndSeek.Instance).StopGamemode();
}
if (!playerId.IsSelf)
{
PlayerIdExtensions.Hide(playerId);
}
string text = default(string);
MetadataHelper.TryGetDisplayName(playerId, ref text);
FusionNotifier.Send(new FusionNotification
{
showTitleOnPopup = true,
title = NotificationText.op_Implicit("Player found!"),
message = NotificationText.op_Implicit(text + " has been found!"),
popupLength = 3f,
isMenuItem = false
});
if (playerId.IsSelf)
{
Player.rigManager.Teleport(HideAndSeek.Instance.CurrentSpawn, true);
}
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
}
namespace HideAndSeekGamemode.Hooking
{
internal class TimerEvents
{
internal static void OnRoundEnd(object sender, ElapsedEventArgs e)
{
throw new NotImplementedException();
}
}
}