Skip to content

Commit

Permalink
v5.2.0 Source Code
Browse files Browse the repository at this point in the history
  • Loading branch information
eDonnes124 committed Jan 21, 2025
1 parent 51a788c commit e3e84fd
Show file tree
Hide file tree
Showing 108 changed files with 4,365 additions and 1,525 deletions.
Binary file modified Images/Roles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
248 changes: 179 additions & 69 deletions README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions source/Extensions/AmongUsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using TownOfUs.Roles.Modifiers;
using UnityEngine;
using System;
using Il2CppInterop.Runtime.InteropTypes;
using System.Linq.Expressions;

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

private static class CastExtension<T> where T : Il2CppObjectBase
{
public static Func<IntPtr, T> Cast;
static CastExtension()
{
var constructor = typeof(T).GetConstructor(new[] { typeof(IntPtr) });
var ptr = Expression.Parameter(typeof(IntPtr));
var create = Expression.New(constructor!, ptr);
var lambda = Expression.Lambda<Func<IntPtr, T>>(create, ptr);
Cast = lambda.Compile();
}
}

public static T Caster<T>(this Il2CppObjectBase obj) where T : Il2CppObjectBase
{
if (obj is T casted) return casted;
return obj.Pointer.Caster<T>();
}

public static T Caster<T>(this IntPtr ptr) where T : Il2CppObjectBase
{
return CastExtension<T>.Cast(ptr);
}

public static TMPro.TextMeshPro nameText(this PlayerControl p) => p?.cosmetics?.nameText;

public static TMPro.TextMeshPro NameText(this PoolablePlayer p) => p.cosmetics.nameText;
Expand Down
679 changes: 679 additions & 0 deletions source/Patches/ChatCommands.cs

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion source/Patches/Colors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Colors {
public readonly static Color Politician = new Color(0.4f, 0f, 0.6f, 1f);
public readonly static Color Warden = new Color(0.6f, 0f, 1f, 1f);
public readonly static Color Jailor = new Color(0.65f, 0.65f, 0.65f, 1f);
public readonly static Color Lookout = new Color(0.2f, 1f, 0.4f, 1f);
public readonly static Color Deputy = new Color(1f, 0.8f, 0f, 1f);

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

//Modifiers
public readonly static Color Bait = new Color(0f, 0.7f, 0.7f, 1f);
public readonly static Color Bait = new Color(0.2f, 0.7f, 0.7f, 1f);
public readonly static Color Aftermath = new Color(0.65f, 1f, 0.65f, 1f);
public readonly static Color Diseased = Color.grey;
public readonly static Color Torch = new Color(1f, 1f, 0.6f, 1f);
Expand All @@ -70,6 +72,7 @@ class Colors {
public readonly static Color Frosty = new Color(0.6f, 1f, 1f, 1f);
public readonly static Color SixthSense = new Color(0.85f, 1f, 0.55f, 1f);
public readonly static Color Shy = new Color(1f, 0.7f, 0.8f, 1f);
public readonly static Color Mini = new Color(0.8f, 1f, 0.9f, 1f);

}
}
9 changes: 9 additions & 0 deletions source/Patches/CrewmateRoles/AltruistMod/Coroutine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ public class Coroutine

public static IEnumerator AltruistRevive(DeadBody target, Altruist role)
{
if (PlayerControl.LocalPlayer.Is(RoleEnum.Lookout))
{
var lookout = Role.GetRole<Lookout>(PlayerControl.LocalPlayer);
if (lookout.Watching.ContainsKey(target.ParentId))
{
if (!lookout.Watching[target.ParentId].Contains(RoleEnum.Altruist)) lookout.Watching[target.ParentId].Add(RoleEnum.Altruist);
}
}

var parent = Utils.PlayerById(target.ParentId);
var position = target.TruePosition;
var altruist = role.Player;
Expand Down
Loading

0 comments on commit e3e84fd

Please sign in to comment.