Decompiled source of HolidayHat v1.0.0
plugins/com.github.MiiMii1205.HolidayHat.dll
Decompiled 6 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using HarmonyLib; using HolidayHat.Behaviour; using HolidayHat.Compatibility; using HolidayHat.Extensions; using HolidayHat.Patchers; using HolidayHat.Utilities; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.Core.Extensions; using Peak; using Peak.Network; using Photon.Pun; using Photon.Realtime; using SkinColorSliders; using UnityEngine; using Zorro.Core; using pworld.Scripts.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.MiiMii1205.HolidayHat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b001e99d8c6e507314f8fdac33c213e0bf2aa7e0")] [assembly: AssemblyProduct("com.github.MiiMii1205.HolidayHat")] [assembly: AssemblyTitle("HolidayHat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace HolidayHat { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.MiiMii1205.HolidayHat", "HolidayHat", "1.0.0")] public class HolidayHatPlugin : BaseUnityPlugin { public static Texture2D HolidayHatIcon = null; public static Texture2D PartyHatIcon = null; public static Texture2D HeartArrowHeadHatIcon = null; public static Texture2D StPatrickHatIcon = null; public static Texture2D FishHatIcon = null; public static Texture2D BunnyEarsIcon = null; public static Texture2D HardHatIcon = null; public static Texture2D PilgrimHatIcon = null; public static Texture2D SantaHatIcon = null; public static Texture2D RibbonHatIcon = null; private static Dictionary<DateTime, int> holidayDictionary = new Dictionary<DateTime, int>(); public static int MaxHatIndex; public static int MinHatIndex; public static List<GameObject> customHolidayHats; private static Dictionary<Player, int> _defaultHatIndexes = new Dictionary<Player, int>(); private static Dictionary<string, int> _hatIndexLookup = new Dictionary<string, int>(); private static Dictionary<Player, DateTime> _playerBootDates = new Dictionary<Player, DateTime>(); public const string Id = "com.github.MiiMii1205.HolidayHat"; internal static ManualLogSource Log { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static int HolidayHatCosmeticIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } public static int HolidayHatIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static bool UseCustomHolidayHat { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static bool IsBunnyEars { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static ConfigEntry<int> DefaultPlayerHatIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject? YesterdayHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static GameObject? TodayHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static GameObject? TomorrowHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static GameObject? CurrentHolidayHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static int YesterdayHatIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static int TodayHatIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static int TomorrowHatIndex { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static DateTime ClientDate { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static DateTime? RoomDate { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static Material NoRenderMaterial { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static Material DefaultPilgrimHatMaterial { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static Material DefaultRibbonHatMaterial { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static Material DefaultPartyHatMaterial { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject PartyHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject HeartArrowHeadHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject StPatrickHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject FishHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject BunnyEarsPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject HardHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject PilgrimHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject SantaHatPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject RibbonPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static Dictionary<DateTime, int>.ValueCollection HolidayHatIndexes { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return holidayDictionary.Values; } } public static string Name => "HolidayHat"; public static string Version => "1.0.0"; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; customHolidayHats = new List<GameObject>(); Harmony val = new Harmony("com.github.MiiMii1205.HolidayHat"); val.PatchAll(typeof(HolidayHatPatcher)); DefaultPlayerHatIndex = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Default Hat Index", 0, "The index hat to use when no holidays are currently happening, as it appears in the Passport. (starts at 0)"); GregorianCalendar gregorianCalendar = new GregorianCalendar(); SetHatIndex(new DateTime(DateTime.Today.Year, 4, 22), 35); SetHatIndex(GetNbSundayAfter(new DateTime(DateTime.Today.Year, 5, 1, gregorianCalendar), 2, gregorianCalendar), 8); SetHatIndex(GetNbSundayAfter(new DateTime(DateTime.Today.Year, 6, 1, gregorianCalendar), 3, gregorianCalendar), 33); SetHatIndex(new DateTime(DateTime.Today.Year, 10, 31), 27); SetHatIndex(gregorianCalendar.AddDays(gregorianCalendar.AddDays(GetMondayOfMonth(DateTime.Today.Year, 11, 4, gregorianCalendar), 3), 1), 21); SetHatIndex(new DateTime(DateTime.Today.Year, 11, 11), 7); BundleLoader.LoadBundleAndContentsWithName((BaseUnityPlugin)(object)this, "holidayhat.peakbundle", (Action<PeakBundle>)LoadHolidayHatAssets); Log.LogInfo((object)("HolidayHatPlugin " + Name + " is loaded!")); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetHatIndex(DateTime date) { return holidayDictionary[new DateTime(2000, date.Date.Month, date.Date.Day)]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool HasHatIndex(DateTime date) { return holidayDictionary.ContainsKey(new DateTime(2000, date.Date.Month, date.Date.Day)); } private void LoadHolidayHatAssets(PeakBundle bundle) { NoRenderMaterial = bundle.LoadAsset<Material>("M_NoRender.mat"); DefaultPilgrimHatMaterial = bundle.LoadAsset<Material>("M_PilgrimHat.mat"); DefaultRibbonHatMaterial = bundle.LoadAsset<Material>("M_Ribbon.mat"); DefaultPartyHatMaterial = bundle.LoadAsset<Material>("M_PartyHat.mat"); Log.LogInfo((object)("Loaded material " + ((Object)NoRenderMaterial).name + "!")); Log.LogInfo((object)("Loaded material " + ((Object)DefaultPilgrimHatMaterial).name + "!")); Log.LogInfo((object)("Loaded material " + ((Object)DefaultRibbonHatMaterial).name + "!")); Log.LogInfo((object)("Loaded material " + ((Object)DefaultPartyHatMaterial).name + "!")); DefaultPilgrimHatMaterial.shader = Shader.Find(((Object)DefaultPilgrimHatMaterial.shader).name); DefaultRibbonHatMaterial.shader = Shader.Find(((Object)DefaultRibbonHatMaterial.shader).name); DefaultPartyHatMaterial.shader = Shader.Find(((Object)DefaultPartyHatMaterial.shader).name); PartyHatPrefab = LoadHolidayHat(bundle, "PartyHat.prefab"); HeartArrowHeadHatPrefab = LoadHolidayHat(bundle, "HeartArrowHeadHat.prefab"); StPatrickHatPrefab = LoadHolidayHat(bundle, "StPatrickHat.prefab"); FishHatPrefab = LoadHolidayHat(bundle, "FishHat.prefab"); BunnyEarsPrefab = LoadHolidayHat(bundle, "BunnyEars.prefab"); HardHatPrefab = LoadHolidayHat(bundle, "HardHat.prefab"); PilgrimHatPrefab = LoadHolidayHat(bundle, "PilgrimHat.prefab"); SantaHatPrefab = LoadHolidayHat(bundle, "SantaHat.prefab"); RibbonPrefab = LoadHolidayHat(bundle, "Ribbon.prefab"); customHolidayHats.Add(PartyHatPrefab); customHolidayHats.Add(HeartArrowHeadHatPrefab); customHolidayHats.Add(StPatrickHatPrefab); customHolidayHats.Add(FishHatPrefab); customHolidayHats.Add(BunnyEarsPrefab); customHolidayHats.Add(HardHatPrefab); customHolidayHats.Add(PilgrimHatPrefab); customHolidayHats.Add(SantaHatPrefab); customHolidayHats.Add(RibbonPrefab); DateTime today = DateTime.Today; ClientDate = today; HolidayHatIcon = bundle.LoadAsset<Texture2D>("HolidayHatOption.png"); PartyHatIcon = bundle.LoadAsset<Texture2D>("PartyHatIcon.png"); HeartArrowHeadHatIcon = bundle.LoadAsset<Texture2D>("HeartArrowHeadHatIcon.png"); StPatrickHatIcon = bundle.LoadAsset<Texture2D>("StPatrickHatIcon.png"); FishHatIcon = bundle.LoadAsset<Texture2D>("FishHatIcon.png"); BunnyEarsIcon = bundle.LoadAsset<Texture2D>("BunnyHatIcon.png"); HardHatIcon = bundle.LoadAsset<Texture2D>("HardHatIcon.png"); PilgrimHatIcon = bundle.LoadAsset<Texture2D>("PilgrimHatIcon.png"); SantaHatIcon = bundle.LoadAsset<Texture2D>("SantaHatIcon.png"); RibbonHatIcon = bundle.LoadAsset<Texture2D>("RibbonHatIcon.png"); } private GameObject LoadHolidayHat(PeakBundle bundle, string hatName) { GameObject val = bundle.LoadAsset<GameObject>(hatName); Log.LogInfo((object)("Loaded Hat " + hatName + "!")); ShaderExtensions.ReplaceShaders(val); Transform transform = val.transform; if (transform.childCount > 0) { int i = 0; for (int childCount = transform.childCount; i < childCount; i++) { ShaderExtensions.ReplaceShaders(((Component)transform.GetChild(i)).gameObject); } } return val; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static DateTime GetGregorianEaster(int year) { int num = year % 19; int num2 = year / 100; int num3 = year % 100; int num4 = num2 / 4; int num5 = num2 % 4; int num6 = (num2 + 8) / 25; int num7 = (num2 - num6 + 1) / 3; int num8 = (19 * num + num2 - num4 - num7 + 15) % 30; int num9 = num3 / 4; int num10 = num3 % 4; int num11 = (32 + 2 * num5 + 2 * num9 - num8 - num10) % 7; int num12 = (num + 11 * num8 + 22 * num11) / 451; int month = (num8 + num11 - 7 * num12 + 114) / 31; int day = (num8 + num11 - 7 * num12 + 114) % 31 + 1; return new DateTime(year, month, day); } private static DateTime GetNbSundayBefore(DateTime date, int nb, Calendar cal) { DateTime time = cal.AddDays(date, -1); DateTime time2 = cal.AddDays(time, 0 - time.DayOfWeek); return cal.AddDays(time2, -(7 * (nb - 1))); } private static DateTime GetNbSundayAfter(DateTime date, int nb, Calendar cal) { DateTime time = cal.AddDays(date, 1); DateTime time2 = cal.AddDays(time, (int)(7 - time.DayOfWeek)); return cal.AddDays(time2, 7 * (nb - 1)); } private static DateTime GetNbSaturdayAfter(DateTime date, int nb, Calendar cal) { DateTime nbSundayAfter = GetNbSundayAfter(date, nb, cal); return cal.AddDays(nbSundayAfter, -1); } private static DateTime GetJulianEaster(int year) { JulianCalendar calendar = new JulianCalendar(); int num = year % 4; int num2 = year % 7; int num3 = year % 19; int num4 = (19 * num3 + 15) % 30; int num5 = (2 * num + 4 * num2 - num4 + 34) % 7; int month = (num4 + num5 + 114) / 31; int day = (num4 + num5 + 114) % 31 + 1; return new DateTime(year, month, day, calendar); } public static DateTime GetMondayOfMonth(int year, int month, int nbMonday, Calendar c) { DateTime dateTime = new DateTime(year, month, 1, c); DateTime result = dateTime.AddDays((dateTime.DayOfWeek > DayOfWeek.Monday) ? ((int)(7 + (1 - dateTime.DayOfWeek))) : ((dateTime.DayOfWeek == DayOfWeek.Sunday) ? 1 : 0)); if (nbMonday == 1) { return result; } return result.AddDays(7 * (nbMonday - 1)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string CleanedName(string dirtyString) { return dirtyString.Replace("(Clone)", "").Replace("(Instanced)", "").Replace("(Instance)", "") .Trim(); } private static string? CheckSecularHolidays(DateTime td) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); DateTime dateTime = new DateTime(gregorianCalendar.GetYear(td), 1, 1, gregorianCalendar); if (td.Date == dateTime.Date) { return "PartyHat.prefab"; } DateTime dateTime2 = new DateTime(gregorianCalendar.GetYear(td), 2, 14, gregorianCalendar); if (td.Date == dateTime2.Date) { return "HeartArrowHeadHat.prefab"; } DateTime dateTime3 = new DateTime(gregorianCalendar.GetYear(td), 3, 17, gregorianCalendar); if (td.Date == dateTime3.Date) { return "StPatrickHat.prefab"; } DateTime dateTime4 = new DateTime(gregorianCalendar.GetYear(td), 4, 1, gregorianCalendar); if (td.Date == dateTime4.Date) { return "FishHat.prefab"; } DateTime gregorianEaster = GetGregorianEaster(gregorianCalendar.GetYear(td)); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Easter is {gregorianEaster}"); if (td.Date == gregorianEaster.Date) { return "BunnyEars.prefab"; } DateTime dateTime5 = new DateTime(gregorianCalendar.GetYear(td), 4, 22, gregorianCalendar); if (td.Date == dateTime5.Date) { return "35"; } DateTime mondayOfMonth = GetMondayOfMonth(gregorianCalendar.GetYear(td), 5, 1, gregorianCalendar); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, May Day is {mondayOfMonth}"); if (td.Date == mondayOfMonth.Date) { return "HardHat.prefab"; } DateTime nbSundayAfter = GetNbSundayAfter(new DateTime(gregorianCalendar.GetYear(td), 5, 1, gregorianCalendar), 2, gregorianCalendar); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Mother's day is {nbSundayAfter}"); if (td.Date == nbSundayAfter.Date) { return "8"; } DateTime nbSundayAfter2 = GetNbSundayAfter(new DateTime(gregorianCalendar.GetYear(td), 6, 1, gregorianCalendar), 3, gregorianCalendar); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Father's day is {nbSundayAfter2}"); if (td.Date == nbSundayAfter2.Date) { return "33"; } DateTime mondayOfMonth2 = GetMondayOfMonth(gregorianCalendar.GetYear(td), 9, 1, gregorianCalendar); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Labor Day (North America) is {mondayOfMonth2}"); if (td.Date == mondayOfMonth2.Date) { return "HardHat.prefab"; } DateTime dateTime6 = gregorianCalendar.AddDays(GetMondayOfMonth(gregorianCalendar.GetYear(td), 11, 4, gregorianCalendar), 3); DateTime mondayOfMonth3 = GetMondayOfMonth(gregorianCalendar.GetYear(td), 10, 2, gregorianCalendar); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Thanksgiving (US) is {dateTime6}"); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Thanksgiving (CA) is {mondayOfMonth3}"); if (td.Date == dateTime6.Date || td.Date == mondayOfMonth3.Date) { return "PilgrimHat.prefab"; } DateTime dateTime7 = new DateTime(gregorianCalendar.GetYear(td), 10, 31, gregorianCalendar); if (td.Date == dateTime7.Date) { return "27"; } DateTime dateTime8 = gregorianCalendar.AddDays(dateTime6, 1); Log.LogDebug((object)$"In {gregorianCalendar.GetYear(td)}, Black Friday is {dateTime8}"); if (td.Date == dateTime8.Date) { return "21"; } DateTime dateTime9 = new DateTime(gregorianCalendar.GetYear(td), 11, 11, gregorianCalendar); if (td.Date == dateTime9.Date) { return "7"; } DateTime time = new DateTime(gregorianCalendar.GetYear(td), 12, 25, gregorianCalendar); if (td.Date == time.Date) { return "SantaHat.prefab"; } DateTime dateTime10 = gregorianCalendar.AddDays(time, 1); if (td.Date == dateTime10.Date) { return "Ribbon.prefab"; } return null; } private string? CheckCatholicHolidays(DateTime td) { return null; } private string? CheckOrthodoxHolidays(DateTime td) { return null; } private string? CheckJewishHolidays(DateTime td) { return null; } private string? CheckChineseHolidays(DateTime td) { return null; } private string? CheckJapaneseHolidays(DateTime td) { return null; } private string? CheckIslamicHolidays(DateTime td) { return null; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private List<string?> FindPossibleHolidayHats(DateTime dayToUse) { return new List<string>(7) { CheckSecularHolidays(dayToUse), CheckCatholicHolidays(dayToUse), CheckOrthodoxHolidays(dayToUse), CheckJewishHolidays(dayToUse), CheckIslamicHolidays(dayToUse), CheckJapaneseHolidays(dayToUse), CheckChineseHolidays(dayToUse) }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ShouldUseDefaultHat(Player player) { return HolidayHatIndex < 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetDefaultPlayerHat(Player player) { int num = _defaultHatIndexes[player]; if (num != HolidayHatCosmeticIndex && num >= 0 && num < Singleton<Customization>.Instance.hats.Length) { return num; } return 0; } public static void ReceiveTimestamp(long timestamp) { RoomDate = new DateTime(timestamp).Date; if (HasHatIndex(new DateTime(timestamp).Date)) { HolidayHatIndex = GetHatIndex(RoomDate.Value); } else { HolidayHatIndex = -1; } } public static void UpdatePlayerDummies(Player player) { Character playerCharacter = PlayerHandler.GetPlayerCharacter(player); if ((Object)(object)playerCharacter != (Object)null) { CharacterCustomization customization = playerCharacter.refs.customization; if (customization != null) { PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(player); if (playerData == null) { return; } foreach (Character allBotCharacter in Character.AllBotCharacters) { CharacterCustomization customization2 = allBotCharacter.refs.customization; if (customization2 != null && customization2.overridePhotonPlayer != null && customization2.overridePhotonPlayer.UserId == player.UserId) { HolidayHatPatcher.UpdateHolidayHat(customization2, playerData, customization2.overridePhotonPlayer); Log.LogDebug((object)$"Updated Hat for {allBotCharacter} (copy of {playerCharacter})"); } } PetrifiedScout[] array = Object.FindObjectsByType<PetrifiedScout>((FindObjectsSortMode)0); foreach (PetrifiedScout val in array) { if ((Object)(object)val.spawnedFromCharacter == (Object)(object)playerCharacter) { val.customization.UpdateDummy(player); Log.LogDebug((object)$"Updated Hat for {val} (statue of {playerCharacter})"); } } return; } } if ((Object)(object)playerCharacter == (Object)null) { Log.LogDebug((object)(player.NickName + "'s character doesn't exist yet.")); } else { Log.LogError((object)("Can't update " + player.NickName + "'s hats!")); } } public static int GetHatOrDefault(Player player) { if (_playerBootDates.TryGetValue(player, out var value)) { if (value.Year == ClientDate.Year) { if (!ShouldUseDefaultHat(player)) { return GetHatIndex(value); } return GetDefaultPlayerHat(player); } Log.LogInfo((object)(player.NickName + "'s Boot Date Year is different from this client. Falling back to manual calculations...")); string text = CheckSecularHolidays(value); if (text == null) { return GetDefaultPlayerHat(player); } if (int.TryParse(text, out var result)) { return result; } return _hatIndexLookup[text.Replace(".prefab", "")]; } Log.LogDebug((object)$"Falling back to hat @ {HolidayHatIndex}"); return HolidayHatIndex; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpdatePlayerDefaultHatIndex(Player player, int defaultHatIndex) { if (_defaultHatIndexes.TryAdd(player, defaultHatIndex)) { Log.LogDebug((object)$"Initialized Default Hat IDX of {player.NickName} to [{defaultHatIndex}]"); return; } _defaultHatIndexes[player] = defaultHatIndex; Log.LogDebug((object)$"Updated Default Hat IDX of {player.NickName} to [{defaultHatIndex}]"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpdatePlayerBootDate(Player player, DateTime playerDate) { if (_playerBootDates.TryAdd(player, playerDate)) { Log.LogDebug((object)$"Initialized Boot Date of {player.NickName} to {playerDate:m}"); return; } _playerBootDates[player] = playerDate; Log.LogDebug((object)$"Updated Boot Date of {player.NickName} to {playerDate:m}"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void SetHatLookup(string name, int index) { if (_hatIndexLookup.TryAdd(name, index)) { Log.LogInfo((object)$"Initialized Hat IDX of {name} to [{index}]"); return; } _hatIndexLookup[name] = index; Log.LogInfo((object)$"Updated Hat IDX of {name} to [{index}]"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void SetHatIndex(DateTime date, int index) { DateTime key = new DateTime(2000, date.Date.Month, date.Date.Day); if (holidayDictionary.TryAdd(key, index)) { Log.LogInfo((object)$"Initialized Hat IDX of {date:m} to [{index}]"); return; } holidayDictionary[key] = index; Log.LogInfo((object)$"Updated Hat IDX of {date:m} to [{index}]"); } } } namespace HolidayHat.Utilities { public static class Oklab { public struct Lab { public float L; public float a; public float b; } public struct LCH { public float L; public float C; public float h; } public static Lab ToOklab(this Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) float num = 0.41222146f * color.r + 0.53633255f * color.g + 0.051445995f * color.b; float num2 = 0.2119035f * color.r + 0.6806995f * color.g + 0.10739696f * color.b; float num3 = 0.08830246f * color.r + 0.28171885f * color.g + 0.6299787f * color.b; float num4 = (float)Math.Cbrt(num); float num5 = (float)Math.Cbrt(num2); float num6 = (float)Math.Cbrt(num3); return new Lab { L = 0.21045426f * num4 + 0.7936178f * num5 - 0.004072047f * num6, a = 1.9779985f * num4 - 2.4285922f * num5 + 0.4505937f * num6, b = 0.025904037f * num4 + 0.78277177f * num5 - 0.80867577f * num6 }; } public static LCH ToOklch(this Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Lab lab = color.ToOklab(); float h = float.NaN; float num = Mathf.Sqrt(lab.a * lab.a + lab.b * lab.b); if (num * 100f > 0f) { h = 57.29578f * Mathf.Atan2(lab.b, lab.a); } return new LCH { L = lab.L, C = num, h = h }; } public static Lab ToOklab(this LCH oklch) { bool flag = oklch.C * 100f > 0f; return new Lab { L = oklch.L, a = (flag ? (oklch.C * Mathf.Cos(MathF.PI / 180f * oklch.h)) : 0f), b = (flag ? (oklch.C * Mathf.Sin(MathF.PI / 180f * oklch.h)) : 0f) }; } public static Color ToColor(this Lab c) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) float num = c.L + 0.39633778f * c.a + 0.21580376f * c.b; float num2 = c.L - 0.105561346f * c.a - 0.06385417f * c.b; float num3 = c.L - 0.08948418f * c.a - 1.2914855f * c.b; float num4 = num * num * num; float num5 = num2 * num2 * num2; float num6 = num3 * num3 * num3; return new Color(4.0767417f * num4 - 3.3077116f * num5 + 0.23096994f * num6, -1.268438f * num4 + 2.6097574f * num5 - 0.34131938f * num6, -0.0041960864f * num4 - 0.7034186f * num5 + 1.7076147f * num6); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Color ToColor(this LCH c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return c.ToOklab().ToColor(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Lab Lerp(Lab a, Lab b, float f) { return new Lab { L = Mathf.Lerp(a.L, b.L, f), a = Mathf.Lerp(a.a, b.a, f), b = Mathf.Lerp(a.b, b.b, f) }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector2 ToVec(this Lab a) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) return new Vector2 { x = a.a, y = a.b }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Color OklabLerp(Color a, Color b, float f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Lerp(a.ToOklab(), b.ToOklab(), f).ToColor(); } public static Color OklchLerp(Color a, Color b, float f) { //IL_0000: 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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) LCH lCH = a.ToOklch(); LCH lCH2 = b.ToOklch(); Lab a2 = b.ToOklab(); Lab a3 = b.ToOklab(); float num = Mathf.Abs(Vector2.Dot(a2.ToVec(), a3.ToVec())); Color color = OklabLerp(a, b, f); LCH c = color.ToOklch(); c.C = Mathf.Lerp(lCH.C, lCH2.C, f); c = Color.Lerp(c.ToColor(), Color.Lerp(a, b, f), 0.5f).ToOklch(); float hue; if (!float.IsNaN(lCH.h) || !float.IsNaN(lCH2.h)) { if (float.IsNaN(lCH.h)) { hue = lCH2.h; } else if (float.IsNaN(lCH2.h)) { hue = lCH.h; } else { float num2 = Mathf.Cos(MathF.PI / 180f * lCH.h); float num3 = Mathf.Sin(MathF.PI / 180f * lCH.h); float num4 = Mathf.Cos(MathF.PI / 180f * lCH2.h); float num5 = Mathf.Sin(MathF.PI / 180f * lCH2.h); float num6 = Mathf.Lerp(num2, num4, f); float num7 = Mathf.Lerp(num3, num5, f); hue = 57.29578f * Mathf.Atan2(num7, num6); } } else { hue = float.NaN; } Color color2 = Color.Lerp(a, b, f); Lab b2 = Lerp(new LCH { L = Mathf.Lerp(lCH.L, lCH.L, f), C = Mathf.Lerp(lCH.C, lCH.C, f), h = NormalizeHue(hue) }.ToOklab(), c.ToOklab(), float.IsNaN(num) ? 0.5f : num); b2 = Lerp(color2.ToOklab(), b2, 0.125f); return b2.ToColor(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float NormalizeHue(float hue) { if (float.IsNaN(hue)) { return hue; } if ((hue %= 360f) < 0f) { return hue + 360f; } return hue; } public static Color EvaluateOklab(this Gradient g, float time) { //IL_0096: 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_00af: 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_0048: 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_0176: Unknown result type (might be due to invalid IL or missing references) int i; for (i = 0; i < g.colorKeys.Length - 1 && time >= g.colorKeys[i + 1].time; i++) { } Color result; if (i >= g.colorKeys.Length - 1) { result = g.colorKeys[^1].color; } else { float f = (time - g.colorKeys[i].time) / (g.colorKeys[i + 1].time - g.colorKeys[i].time); result = OklabLerp(g.colorKeys[i].color, g.colorKeys[i + 1].color, f); } for (i = 0; i < g.alphaKeys.Length - 1 && time >= g.alphaKeys[i + 1].time; i++) { } if (i >= g.alphaKeys.Length - 1) { result.a = g.alphaKeys[^1].alpha; } else { float num = (time - g.alphaKeys[i].time) / (g.alphaKeys[i + 1].time - g.alphaKeys[i].time); result.a = Mathf.Lerp(g.alphaKeys[i].alpha, g.alphaKeys[i + 1].alpha, num); } return result; } } } namespace HolidayHat.Patchers { public static class HolidayHatPatcher { public static bool dummyPatched = false; private static PlayerCustomizationDummy lastModifiedDummy; private static readonly int UseSkinTone = Shader.PropertyToID("_UseSkinTone"); private static readonly int HueStr = Shader.PropertyToID("_HueStr"); private static readonly int HueShifts = Shader.PropertyToID("_HueShifts"); private static readonly int BaseColor = Shader.PropertyToID("_BaseColor"); [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Transform GetHatObject(Transform baseHat) { return baseHat.Find("Armature/Hip/Mid/AimJoint/Torso/Head/Hat") ?? baseHat.Find("Armature/Hip (RIGIDBODY)/Mid/AimJoint/Torso/Head/Hat"); } public static bool CreateHatOption(Customization customization, string name, Texture2D icon) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0075: Unknown result type (might be due to invalid IL or missing references) if (Array.Exists(customization.hats, (CustomizationOption hat) => ((Object)hat).name == name)) { HolidayHatPlugin.Log.LogWarning((object)("Trying to add " + name + " a second time.")); return false; } CustomizationOption val = ScriptableObject.CreateInstance<CustomizationOption>(); val.color = Color.white; ((Object)val).name = name; val.texture = (Texture)(object)icon; val.type = (Type)50; val.requiredAchievement = (ACHIEVEMENTTYPE)0; customization.hats = CollectionExtensions.AddToArray<CustomizationOption>(customization.hats, val); HolidayHatPlugin.Log.LogDebug((object)$"Added Hat Option {name} in PassportManager @ {customization.hats.Length - 1}!"); return true; } [HarmonyPatch(typeof(PassportManager), "Awake")] [HarmonyPostfix] [HarmonyBefore(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void PassportManagerAwakePostfix(PassportManager __instance) { HolidayHatPlugin.Log.LogInfo((object)"INIT PASPORT"); HolidayHatPlugin.Log.LogDebug((object)"Adding Holiday Hat option..."); GregorianCalendar gregorianCalendar = new GregorianCalendar(); Customization component = ((Component)__instance).GetComponent<Customization>(); CreateHatOption(component, "Holiday_Hat", HolidayHatPlugin.HolidayHatIcon); HolidayHatPlugin.HolidayHatCosmeticIndex = component.hats.Length - 1; CreateHatOption(component, "PartyHat", HolidayHatPlugin.PartyHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 1, 1), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("PartyHat", component.hats.Length - 1); HolidayHatPlugin.MinHatIndex = component.hats.Length - 1; CreateHatOption(component, "HeartArrowHeadHat", HolidayHatPlugin.HeartArrowHeadHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 2, 14), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("HeartArrowHeadHat", component.hats.Length - 1); CreateHatOption(component, "StPatrickHat", HolidayHatPlugin.StPatrickHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 3, 17), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("StPatrickHat", component.hats.Length - 1); CreateHatOption(component, "FishHat", HolidayHatPlugin.FishHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 4, 1), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("FishHat", component.hats.Length - 1); CreateHatOption(component, "BunnyEars", HolidayHatPlugin.BunnyEarsIcon); HolidayHatPlugin.SetHatIndex(HolidayHatPlugin.GetGregorianEaster(DateTime.Today.Year), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("BunnyEars", component.hats.Length - 1); CreateHatOption(component, "HardHat", HolidayHatPlugin.HardHatIcon); HolidayHatPlugin.SetHatIndex(HolidayHatPlugin.GetMondayOfMonth(DateTime.Today.Year, 5, 1, gregorianCalendar), component.hats.Length - 1); HolidayHatPlugin.SetHatIndex(HolidayHatPlugin.GetMondayOfMonth(DateTime.Today.Year, 9, 1, gregorianCalendar), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("HardHat", component.hats.Length - 1); CreateHatOption(component, "PilgrimHat", HolidayHatPlugin.PilgrimHatIcon); HolidayHatPlugin.SetHatIndex(gregorianCalendar.AddDays(HolidayHatPlugin.GetMondayOfMonth(DateTime.Today.Year, 11, 4, gregorianCalendar), 3), component.hats.Length - 1); HolidayHatPlugin.SetHatIndex(HolidayHatPlugin.GetMondayOfMonth(DateTime.Today.Year, 10, 2, gregorianCalendar), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("PilgrimHat", component.hats.Length - 1); CreateHatOption(component, "SantaHat", HolidayHatPlugin.SantaHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 12, 25), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("SantaHat", component.hats.Length - 1); CreateHatOption(component, "Ribbon", HolidayHatPlugin.RibbonHatIcon); HolidayHatPlugin.SetHatIndex(new DateTime(DateTime.Today.Year, 12, 26), component.hats.Length - 1); HolidayHatPlugin.SetHatLookup("Ribbon", component.hats.Length - 1); HolidayHatPlugin.MaxHatIndex = component.hats.Length - 1; CustomizationOption[] fits = component.fits; foreach (CustomizationOption val in fits) { if (val.overrideHat) { val.overrideHatIndex += HolidayHatPlugin.customHolidayHats.Count + 1; } } } private static bool syncHats(CustomizationRefs dst, CustomizationRefs src = null) { if ((Object)(object)src == (Object)null) { Character localCharacter = Character.localCharacter; CharacterCustomization val = default(CharacterCustomization); if (localCharacter == null || !((Component)localCharacter).TryGetComponent<CharacterCustomization>(ref val)) { HolidayHatPlugin.Log.LogError((object)"CharacterCustomization component is missing."); return false; } src = val.refs; } Renderer[] playerHats = src.playerHats; Renderer[] playerHats2 = dst.playerHats; if (playerHats.Length == playerHats2.Length) { return true; } Renderer val2 = playerHats2.FirstOrDefault(); if (!Object.op_Implicit((Object)(object)val2)) { HolidayHatPlugin.Log.LogError((object)"Cannot find renderer in dst"); return false; } int layer = ((Component)val2).gameObject.layer; Transform hatObject = GetHatObject(((Component)src).transform); Transform hatObject2 = GetHatObject(((Component)dst).transform); List<Renderer> list = new List<Renderer>(); Renderer[] subArray = playerHats[..^2]; Renderer[] subArray2 = playerHats2[..^2]; int i = subArray2.Length; for (int num = subArray.Length; i < num; i++) { Transform val3 = ((Component)subArray[i]).transform; while ((Object)(object)val3.parent != (Object)(object)hatObject) { val3 = val3.parent; } GameObject val4 = Object.Instantiate<GameObject>(((Component)val3).gameObject, hatObject2, false); ((Object)val4).name = ((Object)val3).name; Renderer componentInChildren = val4.GetComponentInChildren<Renderer>(true); ((Component)componentInChildren).gameObject.layer = layer; list.Add(componentInChildren); } Renderer[] subArray3 = dst.playerHats[^2..]; Renderer[] subArray4 = dst.playerHats[..^2]; dst.playerHats = CollectionExtensions.AddRangeToArray<Renderer>(CollectionExtensions.AddRangeToArray<Renderer>(subArray4, list.ToArray()), subArray3); return true; } [HarmonyPatch(typeof(PeakHandler), "SetCosmetics")] [HarmonyPrefix] public static void PeakHandlerSetCosmeticsPrefix(PeakHandler __instance, List<Character> characters) { if (!syncHats(__instance.firstCutsceneScout)) { HolidayHatPlugin.Log.LogError((object)"Something went wrong [firstCutsceneScout]..."); } int i = 0; for (int num = __instance.cutsceneScoutRefs.Count(); i < num; i++) { if (!syncHats(__instance.cutsceneScoutRefs[i])) { HolidayHatPlugin.Log.LogError((object)$"Something went wrong [cutsceneScoutRefs-{i}]..."); } } int j = 0; for (int num2 = __instance.finalCutsceneScoutRefs.Count(); j < num2; j++) { if (!syncHats(__instance.finalCutsceneScoutRefs[j])) { HolidayHatPlugin.Log.LogError((object)$"Something went wrong [finalCutsceneScoutRefs-{j}]..."); } } } [HarmonyPatch(typeof(CharacterCustomization), "PulseStatus")] [HarmonyPostfix] public static void PulseStatusPostfix(CharacterCustomization __instance, Color c, float intensity = 1f) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance._character)) { return; } Player val = __instance.overridePhotonPlayer ?? __instance._character.view.Owner; CharacterCustomizationData customizationData = CharacterCustomization.GetCustomizationData(val); int currentOutfit = customizationData.currentOutfit; int num = customizationData.currentHat; if (Singleton<Customization>.Instance.fits[currentOutfit].overrideHat) { num = Singleton<Customization>.Instance.fits[currentOutfit].overrideHatIndex; } if (num == HolidayHatPlugin.HolidayHatCosmeticIndex) { num = HolidayHatPlugin.GetHatOrDefault(val); } if (!IsWearingCustomHolidayHat(num) || (!((Object)__instance.refs.playerHats[num]).name.StartsWith("Bunny") && !((Object)__instance.refs.playerHats[num]).name.StartsWith("Fish"))) { return; } Renderer[] componentsInChildren = ((Component)__instance.refs.playerHats[num]).gameObject.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { int j = 0; for (int num2 = val2.materials.Length; j < num2; j++) { val2.materials[j].SetColor(CharacterCustomization.StatusColor, c); val2.materials[j].SetFloat(CharacterCustomization.StatusGlow, intensity); ShortcutExtensions.DOFloat(val2.materials[j], 0f, CharacterCustomization.StatusGlow, 0.5f); } } } [HarmonyPatch(typeof(CharacterCustomization), "OnPlayerDataChange")] [HarmonyPostfix] [HarmonyAfter(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void CharacterCustomizationPlayerDataChangedPostfix(CharacterCustomization __instance, PersistentPlayerData playerData) { if ((Object)(object)__instance.refs.PlayerRenderers[0] != (Object)null) { if (__instance._character.isBot && __instance.overridePhotonPlayer != null) { HolidayHatPlugin.Log.LogDebug((object)("Received character changes for Bot copy of " + __instance.overridePhotonPlayer.NickName)); UpdateHolidayHat(__instance, playerData, __instance.overridePhotonPlayer); } else if (!__instance._character.data.isScoutmaster && !__instance.ignorePlayerCosmetics) { HolidayHatPlugin.Log.LogDebug((object)("Received character changes for " + __instance.view.Owner.NickName)); UpdateHolidayHat(__instance, playerData, __instance.view.Owner); } else if (__instance._character.data.isScoutmaster) { HolidayHatPlugin.Log.LogDebug((object)"Bot is SCOUTMASTER. Skipping..."); } else if (__instance.ignorePlayerCosmetics) { HolidayHatPlugin.Log.LogDebug((object)"Ignoring player cosmetics. Skipping..."); } } else { HolidayHatPlugin.Log.LogWarning((object)("Can't receive changes for " + (__instance._character.isBot ? (((__instance.overridePhotonPlayer != null) ? ("Copy of " + __instance.overridePhotonPlayer.NickName) : __instance.view.Owner.NickName) + "(BOT)") : __instance.view.Owner.NickName) + ". No renderers are present.")); } } [HarmonyPatch(typeof(CharacterCustomization), "Awake")] [HarmonyPostfix] [HarmonyBefore(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void CharacterCustomizationAwakePostfix(CharacterCustomization __instance) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) Transform hatObject = GetHatObject(((Component)__instance.refs).transform); string text = ((__instance.overridePhotonPlayer != null) ? (__instance._character.characterName + " (copy of " + __instance.overridePhotonPlayer.NickName + ")") : __instance._character.characterName); Renderer[] subArray = __instance.refs.playerHats[^2..]; Renderer[] subArray2 = __instance.refs.playerHats[..^2]; GameObject val = Object.Instantiate<GameObject>(((Component)subArray2[0]).gameObject, ((Component)subArray2[0]).transform.parent, false); ((Object)val).name = "HolidayHatPlaceholder"; val.transform.SetLocalPositionAndRotation(((Component)subArray2[0]).transform.localPosition, ((Component)subArray2[0]).transform.localRotation); __instance.refs.playerHats = CollectionExtensions.AddRangeToArray<Renderer>(CollectionExtensions.AddToArray<Renderer>(subArray2, val.GetComponent<Renderer>()), subArray); HolidayHatPlugin.Log.LogInfo((object)$"Inserted Hat '{((Object)val).name}' @ [{subArray2.Length + 1}] for {text}!"); int i = 0; for (int count = HolidayHatPlugin.customHolidayHats.Count; i < count; i++) { GameObject val2 = HolidayHatPlugin.customHolidayHats[i]; GameObject val3 = Object.Instantiate<GameObject>(val2, hatObject, true); SetLayerRecursively(val3.transform, ((Component)hatObject).gameObject.layer); ((Object)val3).name = HolidayHatPlugin.CleanedName(((Object)val3).name); Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val4 in array) { Material[] materials = val4.materials; int k = 0; for (int num = materials.Length; k < num; k++) { materials[k].shader = Shader.Find(((Object)materials[k].shader).name); materials[k] = Object.Instantiate<Material>(materials[k]); } Renderer val5 = val4; Material[] array2 = materials; List<Material> list = new List<Material>(array2.Length); Material[] array3 = array2; foreach (Material item in array3) { list.Add(item); } val5.SetMaterials(list); } HolidayHatPlugin.Log.LogDebug((object)("Adding Hat '" + ((Object)val3).name + "' for " + text + "...")); Transform transform = val2.transform; val3.transform.localPosition = transform.position; val3.transform.localRotation = transform.rotation; val3.transform.localScale = transform.localScale; val3.SetActive(false); subArray = __instance.refs.playerHats[^2..]; subArray2 = __instance.refs.playerHats[..^2]; __instance.refs.playerHats = CollectionExtensions.AddRangeToArray<Renderer>(CollectionExtensions.AddToArray<Renderer>(subArray2, componentsInChildren[0]), subArray); HolidayHatPlugin.Log.LogInfo((object)$"Inserted Hat '{((Object)val3).name}' @ [{subArray2.Length + 1}] for {text}!"); } } private static void SetHatMaterial(Material[] ms, PersistentPlayerData playerData, GameObject hatP, bool isSkel = false, bool isLocal = false) { //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_1740: Unknown result type (might be due to invalid IL or missing references) //IL_174f: Unknown result type (might be due to invalid IL or missing references) //IL_1889: Unknown result type (might be due to invalid IL or missing references) //IL_1898: Unknown result type (might be due to invalid IL or missing references) //IL_17de: Unknown result type (might be due to invalid IL or missing references) //IL_17e3: Unknown result type (might be due to invalid IL or missing references) //IL_09ee: Unknown result type (might be due to invalid IL or missing references) if (((Object)hatP).name.StartsWith("Bunny")) { int accessoryIndex = CharacterCustomization.GetAccessoryIndex(playerData); if (accessoryIndex == 17 || isSkel) { HolidayHatPlugin.Log.LogDebug((object)"Hiding bunny nose!"); ms[0] = HolidayHatPlugin.NoRenderMaterial; } else { HolidayHatPlugin.Log.LogDebug((object)"Showing bunny nose!"); ms[0] = ms[2]; } if (isLocal) { ms[0].SetFloat("_VertexGhost", 100f); ms[1].SetFloat("_VertexGhost", 100f); ms[2].SetFloat("_VertexGhost", 100f); } } else if (((Object)hatP).name.StartsWith("Pilgrim")) { Material val = Singleton<Customization>.Instance.fits[playerData.customizationData.currentOutfit].fitMaterialShoes; Material fitHatMaterial = Singleton<Customization>.Instance.fits[playerData.customizationData.currentOutfit].fitHatMaterial; if (!Object.op_Implicit((Object)(object)val) || ((Object)val).name.EndsWith("Castaway")) { val = HolidayHatPlugin.DefaultPilgrimHatMaterial; } if (Object.op_Implicit((Object)(object)val)) { ms[1].SetTexture(CharacterCustomization.MainTex, val.GetTexture(CharacterCustomization.MainTex)); float num = 0.25f; bool flag; switch (((Object)val).name) { case "M_AviatorFur": case "M_Tarnished Gold Starboy Fit": case "M_Willow_Swamp_MassChara": flag = true; break; default: flag = false; break; } if (flag) { num = 1f; } ms[1].CopyPropsListFromMaterial(val, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); ms[1].SetColor("_Tint", val.GetColor("_Tint") * num); ms[1].SetTextureScale(CharacterCustomization.MainTex, (Vector2)((((Object)val).name == "M_Tarnished Gold Starboy Fit") ? new Vector2(0.75f, 1f) : Vector2.one)); } if (Object.op_Implicit((Object)(object)fitHatMaterial)) { string name = ((Object)fitHatMaterial).name; if ((name == "M_Scout_Starboy" || name == "M_Scout_Tropical") ? true : false) { ms[0].CopyPropsListFromMaterial(fitHatMaterial, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } else { ms[0].CopyPropsListFromMaterial(fitHatMaterial, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); ms[0].CopyPropsListFromMaterial(HolidayHatPlugin.DefaultPilgrimHatMaterial, new List<string>(8) { "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4" }, new List<string>(20) { "_Height1", "_Height2", "_Height3", "_Height4", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4" }, new List<string>(4) { "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } ms[0].SetTextureOffset(CharacterCustomization.MainTex, new Vector2(0f, ((Object)fitHatMaterial).name.EndsWith("Castaway") ? 0.09f : 0f)); } ms[2].SetTexture(CharacterCustomization.MainTex, ms[0].GetTexture(CharacterCustomization.MainTex)); ms[2].SetFloat("_SpecularPower", ms[0].GetFloat("_SpecularPower")); ms[2].SetFloat("_AddSpecular", ms[0].GetFloat("_AddSpecular") + 10f); ms[2].SetFloat("_NoShadowSpec", ms[0].GetFloat("_NoShadowSpec")); } else if (((Object)hatP).name.StartsWith("Party")) { Material fitHatMaterial2 = Singleton<Customization>.Instance.fits[playerData.customizationData.currentOutfit].fitHatMaterial; if (Object.op_Implicit((Object)(object)fitHatMaterial2)) { string name = ((Object)fitHatMaterial2).name; if ((name == "M_Scout_Starboy" || name == "M_Scout_Tropical") ? true : false) { ms[0].CopyPropsListFromMaterial(fitHatMaterial2, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } else { ms[0].CopyPropsListFromMaterial(fitHatMaterial2, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); ms[0].CopyPropsListFromMaterial(HolidayHatPlugin.DefaultPartyHatMaterial, new List<string>(8) { "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4" }, new List<string>(20) { "_Height1", "_Height2", "_Height3", "_Height4", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4" }, new List<string>(4) { "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } } } else { if (!((Object)hatP).name.StartsWith("Ribbon")) { return; } Material fitHatMaterial3 = Singleton<Customization>.Instance.fits[playerData.customizationData.currentOutfit].fitHatMaterial; if (!Object.op_Implicit((Object)(object)fitHatMaterial3)) { return; } string name = ((Object)fitHatMaterial3).name; if ((name == "M_Scout_Starboy" || name == "M_Scout_Tropical") ? true : false) { ms[0].CopyPropsListFromMaterial(fitHatMaterial3, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } else { ms[0].CopyPropsListFromMaterial(fitHatMaterial3, new List<string>(16) { "_BaseColor", "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4", "_MainTexMovement", "_Tex1Movement", "_Tex2Movement", "_Tex3Movement", "_Tex4Movement", "_Tint", "_HueShifts" }, new List<string>(25) { "_Height1", "_Height2", "_Height3", "_Height4", "_HueStr", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4", "_SpecularPower", "_AddSpecular", "_NoShadowSpec", "_Stepalphabyvertexcolor" }, new List<string>(5) { "_MainTex", "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); ms[0].CopyPropsListFromMaterial(HolidayHatPlugin.DefaultRibbonHatMaterial, new List<string>(8) { "_Color1", "_Color2", "_Color3", "_Color4", "_Remap1", "_Remap2", "_Remap3", "_Remap4" }, new List<string>(20) { "_Height1", "_Height2", "_Height3", "_Height4", "_Smooth1", "_Smooth2", "_Smooth3", "_Smooth4", "_Triplanar1On", "_Triplanar2On", "_Triplanar3On", "_Triplanar4On", "_UV1", "_UV2", "_UV3", "_UV4", "_UseHeightMask1", "_UseHeightMask2", "_UseHeightMask3", "_UseHeightMask4" }, new List<string>(4) { "_Texture1", "_Texture2", "_Texture3", "_Texture4" }); } CustomizationOption val2 = Singleton<Customization>.Instance.fits[playerData.customizationData.currentOutfit]; Vector2 zero = default(Vector2); ((Vector2)(ref zero))..ctor(0f, 0f); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 1f); if ((Object)(object)val2.fitMaterialOverrideHat == (Object)null || ((Object)val2.fitMaterialOverrideHat).name.EndsWith("CookieHat")) { if (((Object)fitHatMaterial3).name.EndsWith("Toga")) { zero.x = 0.6821f; zero.y = -0.4f; val3.x = 0f - val3.x; val3.y = 0f - val3.y; } else { zero.x = -0.64f; zero.y = 0.1355f; } } else if (((Object)val2.fitMaterialOverrideHat).name.EndsWith("ScoutHat") || ((Object)val2.fitMaterialOverrideHat).name.EndsWith("HatOverride") || ((Object)val2.fitMaterialOverrideHat).name.EndsWith("AviatorHat") || ((Object)val2.fitMaterialOverrideHat).name.EndsWith("CargoOverride")) { zero = Vector2.zero; bool flag; switch (((Object)val2.fitMaterialOverrideHat).name) { case "M_Scout_JesterHatOverride": case "M_Scout_SleepyGuyHatOverride": case "M_Scout_GreenTeeCargoOverride": case "M_Scout_AviatorHat": flag = true; break; default: flag = false; break; } if (flag) { val3.y = (val3.x = 1.003f); } } else if (((Object)val2.fitMaterialOverrideHat).name == "M_BigGallonHat") { zero.x = -0.3828f; zero.y = -0.4141f; } ms[0].SetTextureOffset(CharacterCustomization.MainTex, zero); ms[0].SetTextureScale(CharacterCustomization.MainTex, val3); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool IsWearingCustomHolidayHat(int currentHatIndex) { if (currentHatIndex >= HolidayHatPlugin.MinHatIndex) { return currentHatIndex <= HolidayHatPlugin.MaxHatIndex; } return false; } [HarmonyPatch(typeof(PlayerCustomizationDummy), "UpdateDummy")] [HarmonyPostfix] [HarmonyBefore(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void PlayerCustomizationDummyPrefix(PlayerCustomizationDummy __instance, Player player) { Player val = player ?? PhotonNetwork.LocalPlayer; PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(val); int fitIndex = CharacterCustomization.GetFitIndex(playerData); int num = playerData.customizationData.currentHat; if (Singleton<Customization>.Instance.fits[fitIndex].overrideHat) { num = Singleton<Customization>.Instance.fits[fitIndex].overrideHatIndex; } if (num == HolidayHatPlugin.HolidayHatCosmeticIndex) { num = HolidayHatPlugin.GetHatOrDefault(val); HolidayHatPlugin.Log.LogDebug((object)("Showing Hat '" + ((Object)((Component)__instance.refs.playerHats[num]).gameObject).name + "' on Dummy of " + val.NickName + "...")); __instance.SetPlayerHat(num); } if (!IsWearingCustomHolidayHat(num)) { return; } PetrifiedScout val2 = default(PetrifiedScout); if (((Component)__instance).TryGetComponent<PetrifiedScout>(ref val2)) { Material val3 = ((Component)((Component)val2).transform.GetChild(0).GetChild(4)).GetComponent<Renderer>().materials[0]; Material[] materials = __instance.refs.playerHats[num].materials; int i = 0; for (int num2 = materials.Length; i < num2; i++) { if (materials[i].GetFloat(UseSkinTone) >= 1f) { materials[i] = val3; } } Renderer val4 = __instance.refs.playerHats[num]; Material[] array = materials; List<Material> list = new List<Material>(array.Length); Material[] array2 = array; foreach (Material item in array2) { list.Add(item); } val4.SetMaterials(list); } int index = num - HolidayHatPlugin.MinHatIndex; Material[] materials2 = __instance.refs.playerHats[num].materials; int k = 0; for (int num3 = materials2.Length; k < num3; k++) { materials2[k] = Object.Instantiate<Material>(materials2[k]); } SetHatMaterial(materials2, playerData, HolidayHatPlugin.customHolidayHats[index]); if (((Object)HolidayHatPlugin.customHolidayHats[index]).name.StartsWith("Fish")) { __instance.refs.playerHats[num].enabled = true; ((Component)((Component)__instance.refs.playerHats[num]).transform.GetChild(0)).gameObject.SetActive(false); HolidayHatPlugin.Log.LogDebug((object)("Hiding Fish Bones on Dummy of " + val.NickName + "...")); } Renderer val5 = __instance.refs.playerHats[num]; Material[] array3 = materials2; List<Material> list2 = new List<Material>(array3.Length); Material[] array4 = array3; foreach (Material item in array4) { list2.Add(item); } val5.SetMaterials(list2); } [HarmonyPatch(typeof(PlayerCustomizationDummy), "SetPlayerColor")] [HarmonyPostfix] [HarmonyAfter(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void PlayerCustomizationDummyPColorPrefix(PlayerCustomizationDummy __instance, int index) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (SkinColorSlidersCompatibility.enabled) { SkinColorSlidersCompatibility.ApplySkinColorToHolidayHats(__instance, index); return; } Color color = Singleton<Customization>.Instance.skins[index].color; int i = HolidayHatPlugin.MinHatIndex; for (int num = __instance.refs.playerHats.Length; i < HolidayHatPlugin.MaxHatIndex && i < num; i++) { Material[] materials = __instance.refs.playerHats[i].materials; Material[] array = materials; foreach (Material val in array) { val.SetColor(CharacterCustomization.SkinColor, AdaptSkinColor(color, val)); } Renderer val2 = __instance.refs.playerHats[i]; Material[] array2 = materials; List<Material> list = new List<Material>(array2.Length); Material[] array3 = array2; foreach (Material item in array3) { list.Add(item); } val2.SetMaterials(list); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Color GetPlayerSkinColor(PersistentPlayerData data, Player player) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (SkinColorSlidersCompatibility.enabled) { return SkinColorSlidersCompatibility.GetPlayerSkinColor(data, player); } HolidayHatPlugin.Log.LogWarning((object)$"Using {player.NickName}'s skin color ([{data.customizationData.currentSkin}])!"); return Singleton<Customization>.Instance.skins[data.customizationData.currentSkin].color; } [HarmonyPatch(typeof(GameUtils), "Awake")] [HarmonyPostfix] public static void GameUtilsAwakePost(GameHandler __instance) { ExtGameObject.GetOrAddComponent<HolidayHatHandler>(((Component)__instance).gameObject); } [HarmonyPatch(typeof(CustomizationRefs), "SetSkeleton")] [HarmonyPostfix] public static void SetSkelPost(CustomizationRefs __instance, bool active, bool isLocal) { Player localPlayer = default(Player); if (isLocal) { localPlayer = PhotonNetwork.LocalPlayer; } else if (!PhotonNetwork.TryGetPlayer(NetworkingUtilities.GetActorNumber(__instance.customization._character.player), ref localPlayer)) { return; } PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(localPlayer); HolidayHatPlugin.Log.LogInfo((object)string.Format("Player {0} turned {1}. Updating their hat.", localPlayer, active ? "into a skeleton" : "human")); UpdateHolidayHat(__instance.customization, playerData, localPlayer); } public static Color AdaptSkinColor(Color skinColor, Material m) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); ((Color)(ref val))..ctor(skinColor.r, skinColor.g, skinColor.b, skinColor.a); Vector4 vector = m.GetVector(HueShifts); float num = 0f; if (!Mathf.Approximately(vector.x, 0f)) { num = vector.x; } else if (!Mathf.Approximately(vector.y, 0f)) { num = vector.y; } if (m.GetFloat(HueStr) > 0f && !Mathf.Approximately(num, 0f)) { float num2 = num * 360f; Oklab.LCH lCH = val.ToOklch(); if (!float.IsNaN(lCH.h)) { lCH.h += num2; Color val2 = lCH.ToColor(); float num3 = default(float); float num4 = default(float); float num5 = default(float); Color.RGBToHSV(val2, ref num3, ref num4, ref num5); float num6 = default(float); float num7 = default(float); float num8 = default(float); Color.RGBToHSV(val, ref num6, ref num7, ref num8); float num9 = num4 - num7; float num10 = num5 - num8; val = Color.HSVToRGB(num6, num7 + num9, num8 + num10); return val; } Color color = Singleton<Customization>.Instance.skins[0].color; Oklab.LCH oklch = color.ToOklch(); oklch.h += num2; Oklab.Lab c = Oklab.Lerp(oklch.ToOklab(), lCH.ToOklab(), 0.75f); float num11 = default(float); float num12 = default(float); float num13 = default(float); Color.RGBToHSV(c.ToColor(), ref num11, ref num12, ref num13); float num14 = default(float); float num15 = default(float); float num16 = default(float); Color.RGBToHSV(val, ref num14, ref num15, ref num16); float num17 = num12 - num15; float num18 = num13 - num16; val = Color.HSVToRGB(num11, num15 + num17, num16 + num18); return val; } return val; } public static void UpdateHolidayHat(CharacterCustomization c, PersistentPlayerData data, Player? player = null) { //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) if (player == null) { player = (c.view ?? ((MonoBehaviourPun)c._character).photonView).Owner; } int fitIndex = CharacterCustomization.GetFitIndex(data); int num = data.customizationData.currentHat; if (Singleton<Customization>.Instance.fits[fitIndex].overrideHat) { num = Singleton<Customization>.Instance.fits[fitIndex].overrideHatIndex; } MeshFilter val = null; if (num == HolidayHatPlugin.HolidayHatCosmeticIndex) { num = HolidayHatPlugin.GetHatOrDefault(player); int i = 0; for (int num2 = c.refs.playerHats.Length; i < num2; i++) { ((Component)c.refs.playerHats[i]).gameObject.SetActive(num == i); if (num == i) { val = ((Component)c.refs.playerHats[i]).GetComponent<MeshFilter>(); HolidayHatPlugin.Log.LogDebug((object)("Showing Hat '" + ((Object)c.refs.playerHats[i]).name + "' for " + player.NickName + "...")); } } if (!IsWearingCustomHolidayHat(num)) { UpdateHatShadow(val ?? ((Component)c.refs.playerHats[num]).GetComponent<MeshFilter>(), c); RefreshHolidayHatHide(((Component)c.refs.playerHats[num]).GetComponent<Renderer>(), c._character); } } if (!IsWearingCustomHolidayHat(num)) { return; } bool flag = false; if (Object.op_Implicit((Object)(object)c._character)) { flag = c._character.data.isSkeleton; } Material[] materials = c.refs.playerHats[num].materials; Color playerSkinColor = GetPlayerSkinColor(data, player); Material material = c.refs.skeletonRenderer.material; string text = HolidayHatPlugin.CleanedName(((Object)material).name); int index = num - HolidayHatPlugin.MinHatIndex; bool flag2 = false; if (((Object)HolidayHatPlugin.customHolidayHats[index]).name.StartsWith("Fish")) { GameObject gameObject = ((Component)((Component)c.refs.playerHats[num]).transform.GetChild(0)).gameObject; if (flag) { c.refs.playerHats[num].enabled = false; gameObject.gameObject.SetActive(true); materials = gameObject.GetComponent<Renderer>().materials; flag2 = true; HolidayHatPlugin.Log.LogDebug((object)("Showing Fish Bones on " + player.NickName + "...")); } else { c.refs.playerHats[num].enabled = true; gameObject.gameObject.SetActive(false); HolidayHatPlugin.Log.LogDebug((object)("Hiding Fish Bones on " + player.NickName + "...")); } } SetHatMaterial(materials, data, HolidayHatPlugin.customHolidayHats[index], flag, player.IsLocal); for (int j = 0; j < materials.Length; j++) { string text2 = HolidayHatPlugin.CleanedName(((Object)materials[j]).name); if (text2 == text) { if (flag) { if (!IsHueShifting(materials[j])) { continue; } Color color = materials[j].GetColor(BaseColor); if (!((Color)(ref color)).Equals(material.GetColor(BaseColor))) { Oklab.LCH c2 = material.GetColor(BaseColor).ToOklch(); Oklab.LCH lCH = playerSkinColor.ToOklch(); c2.C = Mathf.Lerp(c2.C, lCH.C, 0.125f); if (!float.IsNaN(lCH.h)) { c2.h = lCH.h; } materials[j].SetColor(BaseColor, c2.ToColor()); } } else { Material val2 = Object.Instantiate<Material>(((GameObject)(flag2 ? ((object)((Component)HolidayHatPlugin.customHolidayHats[index].transform.GetChild(0)).gameObject) : ((object)HolidayHatPlugin.customHolidayHats[index]))).GetComponent<Renderer>().materials[j]); val2.CopyPropsListFromMaterial(materials[j], new List<string>(1) { "_HeightMaskSmoothness" }, new List<string>(2) { "_VertexGhost", "_FlipHeightMask" }, new List<string>()); materials[j] = val2; materials[j].SetColor(CharacterCustomization.SkinColor, AdaptSkinColor(playerSkinColor, materials[j])); } } else { if (!(materials[j].GetFloat(UseSkinTone) >= 1f)) { continue; } if (flag) { Material val3 = Object.Instantiate<Material>(material); bool flag3 = IsHueShifting(materials[j]); bool flag4 = flag3; if (flag4) { string text3 = HolidayHatPlugin.CleanedName(((Object)materials[j]).name); bool flag5 = ((text3 == "M_Fish" || text3 == "M_BunnyEars") ? true : false); flag4 = !flag5; } if (flag4) { Oklab.LCH c3 = val3.GetColor(BaseColor).ToOklch(); Oklab.LCH lCH2 = playerSkinColor.ToOklch(); c3.C = Mathf.Lerp(c3.C, lCH2.C, 0.125f); if (!float.IsNaN(lCH2.h)) { c3.h = lCH2.h; } val3.SetColor(BaseColor, c3.ToColor()); } Material val4 = ((GameObject)(flag2 ? ((object)((Component)HolidayHatPlugin.customHolidayHats[index].transform.GetChild(0)).gameObject) : ((object)HolidayHatPlugin.customHolidayHats[index]))).GetComponent<Renderer>().materials[j]; val3.CopyPropsListFromMaterial(val4, new List<string>(1) { "_HueShifts" }, new List<string>(2) { "_VertexGhost", "_HueStr" }, new List<string>()); materials[j] = val3; } else { Material val5 = Object.Instantiate<Material>(((GameObject)(flag2 ? ((object)((Component)HolidayHatPlugin.customHolidayHats[index].transform.GetChild(0)).gameObject) : ((object)HolidayHatPlugin.customHolidayHats[index]))).GetComponent<Renderer>().materials[j]); val5.CopyPropsListFromMaterial(materials[j], new List<string>(1) { "_HeightMaskSmoothness" }, new List<string>(2) { "_VertexGhost", "_FlipHeightMask" }, new List<string>()); materials[j] = val5; materials[j].SetColor(CharacterCustomization.SkinColor, AdaptSkinColor(playerSkinColor, materials[j])); } } } if (flag2) { Renderer component = ((Component)((Component)c.refs.playerHats[num]).transform.GetChild(0)).GetComponent<Renderer>(); Material[] array = materials; List<Material> list = new List<Material>(array.Length); Material[] array2 = array; foreach (Material item in array2) { list.Add(item); } component.SetMaterials(list); RefreshHolidayHatHide(((Component)((Component)c.refs.playerHats[num]).transform.GetChild(0)).GetComponent<Renderer>(), c._character, 0f, 100f); UpdateHatShadow(((Component)((Component)c.refs.playerHats[num]).transform.GetChild(0)).GetComponent<MeshFilter>(), c, ((Component)c.refs.playerHats[num]).transform); } else { Renderer val6 = c.refs.playerHats[num]; Material[] array3 = materials; List<Material> list2 = new List<Material>(array3.Length); Material[] array4 = array3; foreach (Material item in array4) { list2.Add(item); } val6.SetMaterials(list2); RefreshHolidayHatHide(c.refs.playerHats[num], c._character, 0f, (((Object)HolidayHatPlugin.customHolidayHats[index]).name.StartsWith("Bunny") || ((Object)HolidayHatPlugin.customHolidayHats[index]).name.StartsWith("Fish")) ? 100f : 1f); UpdateHatShadow(((Component)c.refs.playerHats[num]).GetComponent<MeshFilter>(), c); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool IsHueShifting(Material material) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0024: 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) Vector4 vector = material.GetVector(HueShifts); float num = 0f; if (!Mathf.Approximately(vector.x, 0f)) { num = vector.x; } else if (!Mathf.Approximately(vector.y, 0f)) { num = vector.y; } if (material.GetFloat(HueStr) > 0f) { return !Mathf.Approximately(num, 0f); } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RefreshHolidayHatHide(Renderer r, Character? character, float showOn = 0f, float showOff = 1f) { if (Object.op_Implicit((Object)(object)character) && Object.op_Implicit((Object)(object)character.refs.hideTheBody)) { character.refs.hideTheBody.SetShowing(r, character.refs.hideTheBody.isShowing ? showOn : showOff); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void UpdateHatShadow(MeshFilter filter, CharacterCustomization? c, Transform? tToUse = null) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) if (Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)c.refs.hatShadowMeshFilter)) { Transform val = tToUse ?? ((Component)filter).transform; c.refs.hatShadowMeshFilter.sharedMesh = filter.sharedMesh; ((Component)c.refs.hatShadowMeshFilter).transform.SetPositionAndRotation(val.position, val.rotation); ((Component)c.refs.hatShadowMeshFilter).transform.localScale = val.localScale; Renderer component = ((Component)c.refs.hatShadowMeshFilter).GetComponent<Renderer>(); List<Material> list = new List<Material>(); int i = 0; for (int subMeshCount = filter.sharedMesh.subMeshCount; i < subMeshCount; i++) { list.Add(component.material); } component.SetMaterials(list); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void SetLayerRecursively(Transform transform, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown ((Component)transform).gameObject.layer = layer; foreach (Transform item in transform) { Transform transform2 = item; SetLayerRecursively(transform2, layer); } } [HarmonyPatch(typeof(PlayerCustomizationDummy), "UpdateDummy")] [HarmonyPrefix] [HarmonyBefore(new string[] { "radsi.hats", "figgies.smorehats", "unknown.flarebits-who_up_pea-ing_their_king-moremustommats", "joberggg.BigHamHats", "addzeey.crumphats", "my.pahsiv.MyMousyWig", "joberggg.JobergsHatEmporium", "BobaHats", "TeddyBRB.toomanyhats", "MoreCustomizations" })] public static void PlayerCustomizationDummyUpdateDummyPrefix(PlayerCustomizationDummy __instance, Player player) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)lastModifiedDummy)) { return; } lastModifiedDummy = __instance; Player val = player ?? PhotonNetwork.LocalPlayer; Transform hatObject = GetHatObject(((Component)__instance.refs).transform); Renderer[] subArray = __instance.refs.playerHats[^2..]; Renderer[] subArray2 = __instance.refs.playerHats[..^2]; GameObject val2 = Object.Instantiate<GameObject>(((Component)subArray2[0]).gameObject, ((Component)subArray2[0]).transform.parent, false); val2.transform.SetLocalPositionAndRotation(((Component)subArray2[0]).transform.localPosition, ((Component)subArray2[0]).transform.localRotation); ((Object)val2).name = "HolidayHatPlaceholder"; __instance.refs.playerHats = CollectionExtensions.AddRangeToArray<Renderer>(CollectionExtensions.AddToArray<Renderer>(subArray2, val2.GetComponent<Renderer>()), subArray); HolidayHatPlugin.Log.LogInfo((object)$"Inserted Hat '{((Object)val2).name}' @ [{subArray2.Length + 1}] for Dummy of {val.NickName}!"); int i = 0; for (int count = HolidayHatPlugin.customHolidayHats.Count; i < count; i++) { GameObject val3 = HolidayHatPlugin.customHolidayHats[i]; GameObject val4 = Object.Instantiate<GameObject>(val3, hatObject, true); ((Object)val4).name = HolidayHatPlugin.CleanedName(((Object)val4).name); SetLayerRecursively(val4.transform, ((Component)hatObject).gameObject.layer); MeshRenderer[] componentsInChildren = val4.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val5 in array) { Material[] materials = ((Renderer)val5).materials; int k = 0; for (int num = materials.Length; k < num; k++) { materials[k].shader = Shader.Find(((Object)materials[k].shader).name); materials[k] = Object.Instantiate<Material>(materials[k]); } MeshRenderer val6 = val5; Material[] array2 = materials; List<Material> list = new List<Material>(array2.Length); Material[] array3 = array2; foreach (Material item in array3) { list.Add(item); } ((Renderer)val6).SetMaterials(list); } HolidayHatPlugin.Log.LogDebug((object)("Adding Hat '" + ((Object)val4).name + "' for Dummy of " + val.NickName + "...")); Transform transform = val3.transform; val4.transform.localPosition = transform.position; val4.transform.localRotation = transform.rotation; val4.transform.localScale = transform.localScale; val4.SetActive(false); subArray = __instance.refs.playerHats[^2..]; subArray2 = __instance.refs.playerHats[..^2]; __instance.refs.playerHats = CollectionExtensions.AddRangeToArray<Renderer>(CollectionExtensions.AddToArray<Renderer>(subArray2, (Renderer)(object)componentsInChildren[0]), subArray); HolidayHatPlugin.Log.LogInfo((object)$"Inserted Hat '{((Object)val4).name}' @ [{subArray2.Length + 1}] for Dummy of {val.NickName}!"); } } } } namespace HolidayHat.Extensions { public static class MaterialExtensions { public static void CopyPropsListFromMaterial(this Material to, Material from, List<string> colorsProps, List<string> floatProps, List<string> textureProps) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) foreach (string colorsProp in colorsProps) { if (int.TryParse(colorsProp, out var result)) { to.SetColor(result, from.GetColor(result)); } else { to.SetColor(colorsProp, from.GetColor(colorsProp)); } } foreach (string floatProp in floatProps) { if (int.TryParse(floatProp, out var result2)) { to.SetFloat(result2, from.GetFloat(result2)); } else { to.SetFloat(floatProp, from.GetFloat(floatProp)); } } foreach (string textureProp in textureProps) { if (int.TryParse(textureProp, out var result3)) { to.SetTexture(result3, from.GetTexture(result3)); to.SetTextureOffset(result3, from.GetTextureOffset(result3)); to.SetTextureScale(result3, from.GetTextureScale(result3)); } else { to.SetTexture(textureProp, from.GetTexture(textureProp)); to.SetTextureOffset(textureProp, from.GetTextureOffset(textureProp)); to.SetTextureScale(textureProp, from.GetTextureScale(textureProp)); } } } } } namespace HolidayHat.Compatibility { public static class SkinColorSlidersCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.snosz.skincolorsliders"); HolidayHatPlugin.Log.LogInfo((object)("SkinColorSliders support is " + (_enabled.Value ? "enabled" : "disabled"))); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void ApplySkinColorToHolidayHats(PlayerCustomizationDummy pcd, int skinIndex) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) SkinPartColorSet dummyColors = SkinColorManager.dummyColors; Color skinColor = dummyColors.colors[(SkinPart)0]; int i = HolidayHatPlugin.MinHatIndex; for (int num = pcd.refs.playerHats.Length; i < HolidayHatPlugin.MaxHatIndex && i < num; i++) { Material[] materials = pcd.refs.playerHats[i].materials; Material[] array = materials; foreach (Material val in array) { val.SetColor(CharacterCustomization.SkinColor, HolidayHatPatcher.AdaptSkinColor(skinColor, val)); } Renderer val2 = pcd.refs.playerHats[i]; Material[] array2 = materials; List<Material> list = new List<Material>(array2.Length); Material[] array3 = array2; foreach (Material item in array3) { list.Add(item); } val2.SetMaterials(list); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static Color GetPlayerSkinColor(PersistentPlayerData data, Player player) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) HolidayHatPlugin.Log.LogDebug((object)("Fetching " + player.NickName + "'s face color..")); Color? color = SkinColorManager.GetColor(player.ActorNumber, (SkinPart)0); if (color.HasValue) { HolidayHatPlugin.Log.LogDebug((object)$"Found face color {color.Value} for {player.NickName}."); return color.Value; } HolidayHatPlugin.Log.LogWarning((object)$"No skin colors found for {player.NickName}. Using skin color [{data.customizationData.currentSkin}]!"); return Singleton<Customization>.Instance.skins[data.customizationData.currentSkin].color; } } } namespace HolidayHat.Behaviour { public class HolidayHatHandler : MonoBehaviourPunCallbacks { public static HolidayHatHandler instance; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } HolidayHatPlugin.DefaultPlayerHatIndex.SettingChanged += SyncDefaultHatIndex; } public override void OnCreatedRoom() { SendAll((RpcTarget)0); } private void OnDestroy() { HolidayHatPlugin.DefaultPlayerHatIndex.SettingChanged -= SyncDefaultHatIndex; } private void SyncDefaultHatIndex(object sender, EventArgs e) { HolidayHatPlugin.Log.LogInfo((object)$"Sending our Default Hat IDX ([{HolidayHatPlugin.DefaultPlayerHatIndex.Value}]) to everyone..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncDefaultHat", (RpcTarget)0, new object[2] { PhotonNetwork.LocalPlayer.ActorNumber, HolidayHatPlugin.DefaultPlayerHatIndex.Value }); } public override void OnPlayerEnteredRoom(Player newPlayer) { SendAll(newPlayer); } private void SendAll(RpcTarget target) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient) { HolidayHatPlugin.Log.LogInfo((object)$"Sending the room's startup time ({HolidayHatPlugin.RoomDate ?? HolidayHatPlugin.ClientDate:M}) to everyone..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncRoomStartupTimestamp", target, new object[1] { (HolidayHatPlugin.RoomDate ?? HolidayHatPlugin.ClientDate).Ticks }); } HolidayHatPlugin.Log.LogInfo((object)$"Sending our Default Hat IDX ([{HolidayHatPlugin.DefaultPlayerHatIndex.Value}]) to everyone..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncDefaultHat", target, new object[2] { PhotonNetwork.LocalPlayer.ActorNumber, HolidayHatPlugin.DefaultPlayerHatIndex.Value }); HolidayHatPlugin.Log.LogInfo((object)$"Sending our Boot Date ({HolidayHatPlugin.ClientDate:M}) to everyone..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncBootDate", target, new object[4] { PhotonNetwork.LocalPlayer.ActorNumber, HolidayHatPlugin.ClientDate.Year, HolidayHatPlugin.ClientDate.Month, HolidayHatPlugin.ClientDate.Day }); } private void SendAll(Player target) { if (PhotonNetwork.IsMasterClient) { HolidayHatPlugin.Log.LogInfo((object)$"Sending the room's startup time ({HolidayHatPlugin.RoomDate ?? HolidayHatPlugin.ClientDate:M}) to {target.NickName}..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncRoomStartupTimestamp", target, new object[1] { (HolidayHatPlugin.RoomDate ?? HolidayHatPlugin.ClientDate).Ticks }); } HolidayHatPlugin.Log.LogInfo((object)$"Sending our Default Hat IDX ([{HolidayHatPlugin.DefaultPlayerHatIndex.Value}]) to {target.NickName}..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncDefaultHat", target, new object[2] { PhotonNetwork.LocalPlayer.ActorNumber, HolidayHatPlugin.DefaultPlayerHatIndex.Value }); HolidayHatPlugin.Log.LogInfo((object)$"Sending our Boot Date ({HolidayHatPlugin.ClientDate:M}) to {target.NickName}..."); ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncBootDate", target, new object[4] { PhotonNetwork.LocalPlayer.ActorNumber, HolidayHatPlugin.ClientDate.Year, HolidayHatPlugin.ClientDate.Month, HolidayHatPlugin.ClientDate.Day }); } public override void OnJoinedRoom() { SendAll((RpcTarget)0); } [PunRPC] public void RPC_SyncRoomStartupTimestamp(long timestamp) { HolidayHatPlugin.Log.LogInfo((object)$"Received the room's startup timestamp ({timestamp})!"); HolidayHatPlugin.ReceiveTimestamp(timestamp); } [PunRPC] public void RPC_SyncDefaultHat(int actorNumber, int defaultHatIndex) { Player val = default(Player); if (PhotonNetwork.TryGetPlayer(actorNumber, ref val)) { HolidayHatPlugin.Log.LogInfo((object)$"Received new Default Hat IDX of {val.NickName}: [{defaultHatIndex}]!"); HolidayHatPlugin.UpdatePlayerDefaultHatIndex(val, defaultHatIndex); RefreshHolidayHats(val, $"because we received {val.NickName}'s new Default Hat IDX : [{defaultHatIndex}]"); } else { HolidayHatPlugin.Log.LogError((object)$"Can't receive Default Hat IDX of player {actorNumber}!"); } } private static void RefreshHolidayHats(Player p, string reason = "") { Character playerCharacter = PlayerHandler.GetPlayerCharacter(p); if ((Object)(object)playerCharacter != (Object)null) { CharacterCustomization customization = playerCharacter.refs.customization; if (customization != null) { PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(p); if (playerData != null && playerData.customizationData.currentHat == HolidayHatPlugin.HolidayHatCosmeticIndex) { HolidayHatPlugin.Log.LogDebug((object)("Updating character " + playerCharacter.characterName + "'s hats " + reason + "...")); HolidayHatPatcher.UpdateHolidayHat(customization, playerData, p); HolidayHatPlugin.U