This repository was archived by the owner on Jul 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMorePlayersMod.cs
More file actions
143 lines (129 loc) · 4.61 KB
/
Copy pathMorePlayersMod.cs
File metadata and controls
143 lines (129 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using BepInEx;
using HarmonyLib;
using UnityEngine;
namespace MorePlayers
{
[BepInPlugin("notfood.MorePlayers", "MorePlayers", "1.0.0.0")]
public class MorePlayersMod : BaseUnityPlugin
{
void Awake()
{
new Harmony("notfood.UltimateBuilder").PatchAll();
Debug.Log("[MorePlayersMod] started.");
}
}
[HarmonyPatch]
static class Switch4For8Patch
{
static IEnumerable<MethodBase> TargetMethods()
{
yield return AccessTools.Method(typeof(ChallengeScoreboard), nameof(ChallengeScoreboard.CollectPlayerIds));
yield return AccessTools.Method(typeof(UnityMatchmaker), nameof(UnityMatchmaker.CreateUnityMatch));
yield return AccessTools.Method(typeof(Controller), nameof(Controller.AssociateCharacter));
yield return AccessTools.Method(typeof(TurnIndicator), nameof(TurnIndicator.SetPlayerCount));
yield return AccessTools.Method(typeof(SwitchController), nameof(SwitchController.Reset));
yield return AccessTools.Constructor(typeof(KickTracker));
yield return AccessTools.Method(typeof(KickTracker), nameof(KickTracker.ClearPlayer));
yield return AccessTools.Method(typeof(KickTracker), nameof(KickTracker.CountVotes));
yield return AccessTools.Method(typeof(KickTracker), nameof(KickTracker.VotesFromNetworkNumber));
yield return AccessTools.Method(typeof(KeyboardInput), nameof(KeyboardInput.Reset));
}
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
{
foreach(var inst in e)
{
if (inst.opcode == OpCodes.Ldc_I4_4)
{
inst.opcode = OpCodes.Ldc_I4_8;
}
yield return inst;
}
}
}
[HarmonyPatch(typeof(ChallengeScoreboard), MethodType.Constructor)]
static class ChallengeScoreboardCtorPatch
{
static void Postfix(ChallengeScoreboard __instance)
{
__instance.players = new ChallengeScoreboard.ChallengePlayer[8];
}
}
[HarmonyPatch(typeof(Tablet), MethodType.Constructor)]
static class TabletCtorPatch
{
static void Postfix(Tablet __instance)
{
__instance.untrackedCursors = new List<PickCursor>(8);
}
}
[HarmonyPatch(typeof(Controller), MethodType.Constructor)]
static class ControllerCtorPatch
{
static void Postfix(Controller __instance)
{
__instance.associatedChars = new Character.Animals[8];
}
}
[HarmonyPatch(typeof(Controller), nameof(Controller.ClearPlayers))]
static class ControllerClearPlayersPatch
{
static void Postfix(Controller __instance)
{
__instance.associatedChars = new Character.Animals[8];
}
}
[HarmonyPatch(typeof(GameState), MethodType.Constructor)]
static class GameStateCtorPatch
{
static void Postfix(GameState __instance)
{
__instance.PlayerScores = new int[8];
}
}
[HarmonyPatch(typeof(GraphScoreBoard), MethodType.Constructor)]
static class GraphScoreBoardCtorPatch
{
static void Postfix(GraphScoreBoard __instance)
{
__instance.ScorePositions = new RectTransform[8];
}
}
[HarmonyPatch(typeof(LevelSelectController), MethodType.Constructor)]
static class LevelSelectControllerCtorPatch
{
static void Postfix(LevelSelectController __instance)
{
__instance.JoinedPlayers = new LobbyPlayer[8];
}
}
[HarmonyPatch(typeof(LobbyPointCounter), MethodType.Constructor)]
static class LobbyPointCounterCtorPatch
{
static void Postfix(LobbyPointCounter __instance)
{
__instance.playerJoinedGame = new bool[8];
__instance.playerPlayedGame = new bool[8];
__instance.playerAFK = new bool[8];
}
}
[HarmonyPatch(typeof(LobbySkillTracker), MethodType.Constructor)]
static class LobbySkillTrackerCtorPatch
{
static void Postfix(LobbySkillTracker __instance)
{
__instance.ratings = new Moserware.Skills.Rating[8];
}
}
[HarmonyPatch(typeof(VersusControl), MethodType.Constructor)]
static class VersusControlCtorPatch
{
static void Postfix(VersusControl __instance)
{
__instance.winOrder = new GamePlayer[8];
__instance.RemainingPlacements = new int[8];
}
}
}