Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug / April Fools mode not sync correctly for clients #1311

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Modules/GameOptionsSender/GameOptionsSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,26 @@ public static void SendAllGameOptions()
public virtual void SendGameOptions()
{
var opt = BuildGameOptions();
var currentGameMode = opt.GameMode; // remember the current game mode for further changes if necessary

//April fools mode toggled on by host
if (AprilFoolsMode.IsAprilFoolsModeToggledOn)
{
//Change the game mode to april fools instead of normal
//Because it doesn't change automatically

if (currentGameMode == GameModes.Normal)
currentGameMode = GameModes.NormalFools;

else if (currentGameMode == GameModes.HideNSeek)
currentGameMode = GameModes.SeekFools;
}

// option => byte[]
MessageWriter writer = MessageWriter.Get(SendOption.None);
writer.Write(opt.Version);
writer.StartMessage(0);
writer.Write((byte)opt.GameMode);
writer.Write((byte)currentGameMode);
if (opt.TryCast<NormalGameOptionsV07>(out var normalOpt))
NormalGameOptionsV07.Serialize(writer, normalOpt);
else if (opt.TryCast<HideNSeekGameOptionsV07>(out var hnsOpt))
Expand Down Expand Up @@ -93,4 +107,4 @@ protected virtual void SendOptionsArray(Il2CppStructArray<byte> optionArray, byt

public virtual bool AmValid() => true;
}
}
}