Skip to content

Commit e3e84fd

Browse files
committed
v5.2.0 Source Code
1 parent 51a788c commit e3e84fd

File tree

108 files changed

+4365
-1525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+4365
-1525
lines changed

Images/Roles.png

245 KB
Loading

README.md

Lines changed: 179 additions & 69 deletions
Large diffs are not rendered by default.

source/Extensions/AmongUsExtensions.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using TownOfUs.Roles.Modifiers;
44
using UnityEngine;
55
using System;
6+
using Il2CppInterop.Runtime.InteropTypes;
7+
using System.Linq.Expressions;
68

79
namespace TownOfUs.Extensions
810
{
@@ -103,6 +105,30 @@ public static Texture2D CreateEmptyTexture(int width = 0, int height = 0)
103105
return new Texture2D(width, height, TextureFormat.RGBA32, Texture.GenerateAllMips, false, IntPtr.Zero);
104106
}
105107

108+
private static class CastExtension<T> where T : Il2CppObjectBase
109+
{
110+
public static Func<IntPtr, T> Cast;
111+
static CastExtension()
112+
{
113+
var constructor = typeof(T).GetConstructor(new[] { typeof(IntPtr) });
114+
var ptr = Expression.Parameter(typeof(IntPtr));
115+
var create = Expression.New(constructor!, ptr);
116+
var lambda = Expression.Lambda<Func<IntPtr, T>>(create, ptr);
117+
Cast = lambda.Compile();
118+
}
119+
}
120+
121+
public static T Caster<T>(this Il2CppObjectBase obj) where T : Il2CppObjectBase
122+
{
123+
if (obj is T casted) return casted;
124+
return obj.Pointer.Caster<T>();
125+
}
126+
127+
public static T Caster<T>(this IntPtr ptr) where T : Il2CppObjectBase
128+
{
129+
return CastExtension<T>.Cast(ptr);
130+
}
131+
106132
public static TMPro.TextMeshPro nameText(this PlayerControl p) => p?.cosmetics?.nameText;
107133

108134
public static TMPro.TextMeshPro NameText(this PoolablePlayer p) => p.cosmetics.nameText;

source/Patches/ChatCommands.cs

Lines changed: 679 additions & 0 deletions
Large diffs are not rendered by default.

source/Patches/Colors.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class Colors {
3333
public readonly static Color Politician = new Color(0.4f, 0f, 0.6f, 1f);
3434
public readonly static Color Warden = new Color(0.6f, 0f, 1f, 1f);
3535
public readonly static Color Jailor = new Color(0.65f, 0.65f, 0.65f, 1f);
36+
public readonly static Color Lookout = new Color(0.2f, 1f, 0.4f, 1f);
37+
public readonly static Color Deputy = new Color(1f, 0.8f, 0f, 1f);
3638

3739
// Neutral Colors
3840
public readonly static Color Jester = new Color(1f, 0.75f, 0.8f, 1f);
@@ -55,7 +57,7 @@ class Colors {
5557
public readonly static Color Impostor = Palette.ImpostorRed;
5658

5759
//Modifiers
58-
public readonly static Color Bait = new Color(0f, 0.7f, 0.7f, 1f);
60+
public readonly static Color Bait = new Color(0.2f, 0.7f, 0.7f, 1f);
5961
public readonly static Color Aftermath = new Color(0.65f, 1f, 0.65f, 1f);
6062
public readonly static Color Diseased = Color.grey;
6163
public readonly static Color Torch = new Color(1f, 1f, 0.6f, 1f);
@@ -70,6 +72,7 @@ class Colors {
7072
public readonly static Color Frosty = new Color(0.6f, 1f, 1f, 1f);
7173
public readonly static Color SixthSense = new Color(0.85f, 1f, 0.55f, 1f);
7274
public readonly static Color Shy = new Color(1f, 0.7f, 0.8f, 1f);
75+
public readonly static Color Mini = new Color(0.8f, 1f, 0.9f, 1f);
7376

7477
}
7578
}

source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ public class Coroutine
2121

2222
public static IEnumerator AltruistRevive(DeadBody target, Altruist role)
2323
{
24+
if (PlayerControl.LocalPlayer.Is(RoleEnum.Lookout))
25+
{
26+
var lookout = Role.GetRole<Lookout>(PlayerControl.LocalPlayer);
27+
if (lookout.Watching.ContainsKey(target.ParentId))
28+
{
29+
if (!lookout.Watching[target.ParentId].Contains(RoleEnum.Altruist)) lookout.Watching[target.ParentId].Add(RoleEnum.Altruist);
30+
}
31+
}
32+
2433
var parent = Utils.PlayerById(target.ParentId);
2534
var position = target.TruePosition;
2635
var altruist = role.Player;

0 commit comments

Comments
 (0)