Decompiled source of DBs Content API v1.1.0
DbsContentApi.dll
Decompiled 2 weeks 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.IO; 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.Logging; using DbsContentApi.Modules; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using Zorro.Core; [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("DbsContentApi")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyInformationalVersion("0.0.0+aaf8ea6641d2cc9e82417146e0e0d6f4d9a292fe")] [assembly: AssemblyProduct("DbsContentApi")] [assembly: AssemblyTitle("DbsContentApi")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 DbsContentApi { [ContentWarningPlugin("db.contentapi", "1.1.0", false)] [BepInPlugin("db.contentapi", "DB's Content API", "1.1.0")] public class DbsContentApiPlugin : BaseUnityPlugin { public static List<GameObject> customMonsters = new List<GameObject>(); public static List<Action> customItemsRegistrationCallbacks = new List<Action>(); public static List<ContentEvent> customContentEvents = new List<ContentEvent>(); public static bool moddedMobsOnly = false; public static bool allItemsFree = false; internal static Harmony? Harmony { get; set; } public static DbsContentApiPlugin Instance { get; private set; } = null; private void Awake() { Logger.Init(((BaseUnityPlugin)this).Logger); Logger.Log("DbsContentApi API Initializing..."); Instance = this; Patch(); ImpactSoundScanner.InitImpactSounds(); Logger.Log("DbsContentApi API Loaded successfully!"); } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("db.contentapi"); } Logger.Log("Patching..."); Harmony.PatchAll(); Logger.Log("Finished patching!"); } internal static void Unpatch() { Logger.Log("Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.Log("Finished unpatching!"); } public static void SetModdedMobsOnly(bool value) { moddedMobsOnly = value; } public static void SetAllItemsFree(bool value) { allItemsFree = value; } } public class MyPluginInfo { public const string PLUGIN_GUID = "db.contentapi"; public const string PLUGIN_NAME = "DB's Content API"; public const string PLUGIN_VERSION = "1.1.0"; public const bool VANILLA_COMPATIBLE = false; } } namespace DbsContentApi.Patches { [HarmonyPatch(typeof(ShopViewScreen))] public static class ItemCategoriesPatch { [HarmonyPatch("DrawCategories")] [HarmonyPrefix] private static bool DrawCategoriesPatch(ShopViewScreen __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) __instance.ResetScreenIndex(); __instance.DestroyCategoryGrid(); ShopItemCategory[] first = (ShopItemCategory[])Enum.GetValues(typeof(ShopItemCategory)); first = first.Concat(Items.customCategories.Select((CustomShopItemCategory c) => (ShopItemCategory)c.index)).ToArray(); ShopItemCategory[] array = first; foreach (ShopItemCategory val in array) { if ((int)val != 0 && !__instance.excludeCategories.Contains(val)) { __instance.SpawnCategoryCell(val); } } return false; } [HarmonyPatch("UpdateViewScreen")] [HarmonyPostfix] private static void UpdateViewScreenPostfix(ShopViewScreen __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 foreach (CustomShopItemCategory customCategory in Items.customCategories) { if ((int)__instance.CurrentCategoryIndex == customCategory.index) { ((TMP_Text)__instance.m_CurrentCategoryNameText).text = customCategory.name; } } } } [HarmonyPatch(typeof(ShopInteractibleCategory))] public static class ShopInteractibleCategoryPatch { [HarmonyPatch("Setup")] [HarmonyPrefix] private static bool SetupPrefix(ShopInteractibleCategory __instance, ShopHandler handler, ShopItemCategory category) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) foreach (CustomShopItemCategory customCategory in Items.customCategories) { if ((int)category == customCategory.index) { ShopInteractibleCategory.m_ShopHandler = handler; __instance.m_Category = category; ((Interactable)__instance).hoverText = customCategory.name; ((TMP_Text)__instance.m_CategoryText).text = customCategory.name; return false; } } return true; } } [HarmonyPatch(typeof(ShopViewScreen))] public static class ShopViewScreenPatch { public static bool isRegistered; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ShopViewScreen __instance) { if (!isRegistered) { isRegistered = true; GameMaterials.InitMaterials(); Logger.Log("RegisterItemsPatch: Registering custom items."); DbsContentApiPlugin.customItemsRegistrationCallbacks.ForEach(delegate(Action callback) { callback(); }); if (DbsContentApiPlugin.allItemsFree) { Logger.Log("RegisterItemsPatch: Setting all items free."); Items.SetAllItemsFree(); } } } } [HarmonyPatch(typeof(RoundSpawner))] public static class RoundSpawnerPatch { [HarmonyPatch("Start")] [HarmonyPrefix] public static void StartPrefix(RoundSpawner __instance) { Logger.Log("RoundSpawnerPatch: Registering custom monsters in Photon pool."); Logger.Log("RoundSpawnerPatch: Modded mobs only: " + DbsContentApiPlugin.moddedMobsOnly); Logger.Log("RoundSpawnerPatch: Custom monsters: " + DbsContentApiPlugin.customMonsters.Count); foreach (GameObject customMonster in DbsContentApiPlugin.customMonsters) { Logger.Log("RoundSpawnerPatch: Registering custom monster: " + ((Object)customMonster).name); ContentLoader.RegisterPrefabInPhotonPool(customMonster); } if (!PhotonNetwork.IsMasterClient) { return; } Traverse val = Traverse.Create((object)__instance); Traverse<GameObject[]> val2 = val.Field<GameObject[]>("possibleSpawns"); if (DbsContentApiPlugin.moddedMobsOnly) { List<GameObject> customMonsters = DbsContentApiPlugin.customMonsters; for (int i = 0; i < 2; i++) { customMonsters.AddRange(customMonsters); } val2.Value = DbsContentApiPlugin.customMonsters.ToArray(); Logger.Log("RoundSpawnerPatch: Modded mobs only: " + val2.Value.Length); } else { val2.Value = val2.Value.Concat(DbsContentApiPlugin.customMonsters).ToArray(); } } } } namespace DbsContentApi.Modules { public class ContentEvents { public static void RegisterEvent(ContentEvent contentEvent) { Logger.Log("Registering content event for " + contentEvent.GetName()); DbsContentApiPlugin.customContentEvents.Add(contentEvent); } public static ushort GetEventID(string contentEventName) { string contentEventName2 = contentEventName; List<ContentEvent> customContentEvents = DbsContentApiPlugin.customContentEvents; Logger.Log(customContentEvents.Count.ToString()); int num = customContentEvents.FindIndex((ContentEvent match) => ((object)match).GetType().Name == contentEventName2); if (num == -1) { for (int i = 0; i < customContentEvents.Count; i++) { Logger.Log($"{((object)customContentEvents[i]).GetType().Name}, {contentEventName2}, {((object)customContentEvents[i]).GetType().Name == contentEventName2}"); } Logger.Log("GetEventID for " + contentEventName2 + " returned -1"); } return (ushort)(2000 + num); } } [HarmonyPatch(typeof(ContentEventIDMapper))] internal class ContentEventIDMapperPatches { [HarmonyPrefix] [HarmonyPatch("GetContentEvent")] public static bool GetContentEventPrefix(ref ushort id, ref ContentEvent __result) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown List<ContentEvent> customContentEvents = DbsContentApiPlugin.customContentEvents; Logger.Log($"GetContentEvent was called: {id} Normalized: {id - 2000} EventList count: {customContentEvents.Count}"); if (id - 2000 < 0) { return true; } ContentEvent val = customContentEvents[id - 2000]; if (val == null) { return true; } __result = (ContentEvent)Activator.CreateInstance(((object)val).GetType()); return false; } } public static class ContentLoader { public static AssetBundle LoadAssetBundle(PluginInfo pluginInfo, string bundleName) { string text = Path.Combine(Path.GetDirectoryName(pluginInfo.Location), bundleName); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load AssetBundle: " + bundleName + " at path: " + text); } return val; } public static GameObject LoadPrefabFromBundle(AssetBundle bundle, string prefabName) { GameObject val = bundle.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Prefab: " + prefabName + " from bundle: " + ((Object)bundle).name); } return val; } public static void RegisterPrefabInPhotonPool(GameObject prefab) { IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null && !val.ResourceCache.ContainsKey(((Object)prefab).name)) { val.ResourceCache.Add(((Object)prefab).name, prefab); } } } public enum GameMaterial { M_Debug, M_Projector_1, M_BoomMic_2, M_Projector_4, M_Projector_3, M_GreenScreen_3, M_GreenScreen_1, M_GreenScreen_2, M_Projector_2, M_Projector_5, M_Container_2, M_Player, M_Winch_4, M_Winch_6, M_Winch_2, M_Winch_3, M_Winch_1, M_Winch_5, M_Shroom_1, M_ReporterMic_1, M_ReporterMic_3, M_ReporterMic_2, M_Monster_BlackLocal, M_HatShop_4, M_Book_2, M_BoomMic_3, M_Monster, M_World, M_Pool_6, M_Jester_1, M_Flashlight_2_2, M_Flashlight_1_1, M_Pool_4, M_Radio_4, M_Metal, M_Hotdog_1, M_Goo_3, M_Flare_1, M_Shroom_2, M_FredGull_2, M_World_AlphaClip, M_Hotdog_3, M_Rugby_3, M_Rug_6, M_Hug, M_Radio_1, M_Borkin_2, M_DarkBlack, M_Flashlight_Bright, M_SoundPlayer_4, M_Laser_Weak, M_BatteryLight_Off, M_BatteryLight_Green, M_BatteryLight_Yellow, M_BatteryLight_Red, M_Flashlight_1_2, M_Flashlight_Off, M_Player_1, M_PlayerVisor, M_OxygenDisplay, M_FlashBeam, M_World_Local, M_FlatUI, M_Hamburger_3, M_Norf_1, M_Norf_2, M_Jester_3, M_Splash, M_VideoCamera_Recording, M_Cinema_2, M_Hand, M_Cutbox_1, M_LongFlashlight_2_1, M_Cutbox_2, M_CD_Plastic, M_CD, M_VFX_ShockStick, M_Light_Bright, M_ShockStick_1, M_ShockStick_2, M_Pool_7, M_Defib_3, M_Flashlight_3_2, M_Pool_8, M_Chef_1, M_Helmet, M_Pirate_3, M_Pirate_1, M_PlayerHatColor, M_Pirate_2, M_Rug_3, M_VideoCamera_3, M_World_ShelfGrate_3, M_HatShop_6, M_Horn, M_VideoCamera_5, M_VideoCamera_1, M_VideoCamera_2, M_Eye, M_CameraScreen, M_Flare_2, M_FlareEYe, M_FlareBeam, M_Ushanka_2, M_Ushanka_1, M_Container_1, M_Container_3, M_Cutbox_3, M_Halo, M_Beanie_1, M_Monster_Dark, M_News2, M_World_BarbedWire, M_World_ShelfGrate_1, M_World_ShelfGrate_2, M_DivingBell_1, M_DivingBell_2, M_DivingBell_3, M_DivingBell_3_Local, M_DivingBell_3_Local_Actually, M_DivingBell_4, M_DivingBell_4_Local, M_DivingBell_4_Local_Actually, M_DivingBell_Lever_Local, M_Popper_2, M_Popper_1, M_Popper_4, M_Popper_3, M_BigSlapPainting_1, ParticlesUnlit, M_RescueHook_1, M_FredGull_1, M_Walkie_Talkie_2, M_Walkie_Talkie_1, M_Walkie_Talkie_3, M_Explosion, M_Milk1, M_Floppy_1, M_Hamburger_1, M_Hamburger_2, M_Hamburger_4, M_Jester_4, M_VideoDisplayScreen, M_Hair_1, M_Clown_2, M_Cowboy, M_Portrait_3, M_RescueHook_2, M_HookLight, M_Apple_3, M_Child_5, M_Ears_1, M_Radio_2, M_Radio_3, M_Book_1, M_Crane, M_Cinema_1, M_Screen, M_Cursor, M_Defib_4, M_Defib_2, M_LongFlashlight_2_2, M_Laser, M_SoundPlayer_3, M_Goo_1, M_TitleCardRender, M_TitleCard_1, M_TitleCard, M_TitleCard_2, M_GooBright, M_FredGull_4, M_FredGull_3, M_Flashlight_3_1, M_Crown, M_Copyright_1, M_Rugby_2, M_Interior_7, M_Clown_1, M_Hotdog_4, M_Top, M_Rug_5, M_Borkin_1, M_House_Glas, M_Portrait_1, M_Copyright, M_HatShop_3, M_BoomMic_1, M_Foodora, M_Jester_2, M_Child_4, M_Balaclava, M_Child_2, M_ShopGlass, M_Podcast_4, M_Podcast_2, M_Portrait_2, M_SoundPlayer_2, M_Goop, M_SoundPlayer_1, M_HatShop_8, M_News1, M_Defib_1, M_Apple_2, M_HatShop_5, M_Rug_1, M_FrontScreen, M_SoundPlayer_5, M_Portrait_4, M_Child_3, M_TaserBeam, M_VFX_BombFuze, M_Rug_4, M_Flashlight_2_1, M_Apple_1, M_DefaultParticle, M_Knifo, M_Bucket_1, M_Bomb, M_Ears_2, M_Child_1, M_Ears_3, M_Cap_1, M_Goo_2, M_Party_2, M_Party_1, M_Milk2, M_HatShop_7, M_Brain_1, M_HatShop_2, M_Rugby_1, M_Witch, M_Hotdog_2, M_HatShop_1, M_Bowler, M_Brain_2, Jello_PostShader, M_DivingScreen_Nice, M_Light_Warm, M_Asphalt, M_Barrel_1, M_Barrel_2, M_Bed_1, M_Bed_2, M_Bed_3, M_Bed_4, M_Bed_5, M_Bed_6, M_Bed_7, M_Bed_Default_1, M_House_1, M_House_10, M_House_11, M_House_12, M_House_2, M_House_3, M_House_4, M_House_5, M_House_6, M_House_8, M_House_9, M_Interior_1, M_Interior_2, M_Interior_3, M_Interior_4, M_Interior_5, M_Interior_6, M_Interior_8, M_Rock, M_Rug_2, M_Rug_7, M_Rug_8, M_Rug_9, M_Solar_1, M_Solar_2, M_Sunflower_1, M_Sunflower_2, M_Sunflower_3, M_ThePlan_1, M_ThePlan_2, M_Trunk, M_Surf_Bush, M_Surf_Ground, M_Surf_GroundGrass, M_DivingBell1Nice, M_DivingBell2Nice, M_DivingBell3Nice, M_DivingBell4Nice, M_DivingBell5Nice, M_DivingBell6Nice, M_CloudSphere_2, M_CloudSphere, M_CloudSphere_Evening_2, M_CloudSphere_Evening, M_Sky, M_Sky_Evening, M_Intro, M_House_7, M_Scraper, M_Invis, M_Mirror, M_ArrowIcon, M_CamConverter_1, M_CamConverter_2, M_CamConverter_3, M_CamConverter_4, M_CamConverter_5, M_CameraIcon, M_Charge_1, M_Charge_2, M_Charge_3, M_Charge_4, M_Charge_5, M_Drone_1, M_Drone_2, M_Drone_3, M_Drone_4, M_Drone_5, M_FaceMachine, M_House_13, M_House_Door, M_Landing, M_Laptop, M_Machine, M_NetworkDeal_1, M_NetworkDeal_2, M_NetworkDeal_3, M_NetworkDeal_4, M_Podcast_1, M_Podcast_10, M_Podcast_11, M_Podcast_3, M_Podcast_5, M_Podcast_6, M_Podcast_7, M_Podcast_8, M_Podcast_9, M_Pool_1, M_Pool_11, M_Pool_2, M_Pool_3, M_Pool_5, M_Shop_1, M_Shop_2, M_Shop_3, M_TV_1, M_TV_2, M_TV, M_Teleport_1, M_Teleport_2, M_Trampoline_1, M_Trampoline_2, M_Trampoline_3, M_Trampoline_4, M_UpgradeSign, M_Water, M_Wood, M_Surf_Bush_NoWind, M_Surf_Ground_Dirt, M_Surf_Ground_Side, M_Surf_Ground_Side_Dirt, M_Charge, M_Dust, M_Heal } public enum DescriptiveMaterial { TRANSPARENT, LIGHT_GREY_1, WHITE_1, GREY_1, MOON, GREY_2, GREEN_1, LIGHT_FLAT_GREY_1, GLOWING_WHITE_1, DARK_GREY_1, DARK_GREY_BLACK, DARK_BLUE_CYAN, VERY_LIGHT_GREY, DARK_GREY_2, GREY_WHITE_SPOTS, DARKISH_RED_1, DARKISH_RED_2, WHITE_SPOTS_1, DARK_FLAT_GREY_1, LIGHT_FLAT_GREY_2, DARK_BLUE_GREY, FULL_BLACK, LIGHT_BROWN, WHITE_PAPER, GREY_3, ORANGE_1, YELLOW_1, GREY_SPOTS_1, BROWN_1, BROWN_2, ORANGE_2, NEUTRAL_GREY, VERY_LIGHT_BEIGE, DARK_GREY_DARK_SPOTS, RED_DARK_SPOTS, WHITE_SPOTS_2, BLUE_1, WEIRD_TRANSPARENT_BLACK_SPOTS, RED_1, BEIGE_1, ORANGE_3, YELLOW_2, GLOWING_WHITE_2, WHITE_DARK_SPOTS, TRANSPARENT_SLIGHTLY_RED, FLAT_GREY, LIME_1, GLOWING_YELLOW, GLOWING_RED, BROWN_DARK_SPOTS, BLACK_BLUE, GREY_SMALL_DARK_SPOTS, ICE_BLUE, GREY_DARK_OUTLINES, DARK_BLACK_DARK_SPOTS, WHITE_2, YELLOW_3, INTENSE_BLUE_ICE, ORANGE_WHITE_SPOTS, GREEN_2, GLOWING_RED_1, WHITE_3, DARK_GREY_3, WHITE_BEIGE, FLAT_DARK_GREY, ORANGE_4, BLUE_CYAN_1, GREY_DARK_SPOTS_1, YELLOW_4, WHITE_DARKER_SPOTS, YELLOW_5, BLUE_CYAN_2, ORANGE_5, RED_BEIGE_1, GLOWING_WHITE_3, BLACK_GRILLAGE, ORANGE_BEIGE_PARALAX, GLOWING_WHITE_4, GLOWING_RED_2, DARK_YELLOW, DARK_BROWN, GREEN_3, DARK_GREY_BROWN, RED_BEIGE_LIGHT, BROWN_3, GLOWING_WHITE_RED, GREEN_LEAVES, CYAN_BLUE, WHITE_4, RED_2, FLAT_RED, VIOLET_1, GREEN_4, TRANSPARENT_GLASS, TRANSPARENT_DARK_WEIRD_LIGHTING, BROWN_LARGE_LIGHT_SPOTS, GREY_BLUE, TRANSPARENT_DARK, YELLOW_6, RED_MERCURY, PINK_1, LIME_2, DARK_VIOLET, RED_3, PINK_2, ICE_1, TURQUOISE, RED_4 } public static class GameMaterials { public static readonly Dictionary<GameMaterial, Material> _materials; public static readonly Dictionary<string, GameMaterial> _nameToEnum; public static readonly Dictionary<DescriptiveMaterial, GameMaterial> _descriptiveToOriginal; public static event Action? OnMaterialsLoaded; static GameMaterials() { _materials = new Dictionary<GameMaterial, Material>(); _nameToEnum = new Dictionary<string, GameMaterial>(); _descriptiveToOriginal = new Dictionary<DescriptiveMaterial, GameMaterial> { { DescriptiveMaterial.TRANSPARENT, GameMaterial.M_Debug }, { DescriptiveMaterial.LIGHT_GREY_1, GameMaterial.M_Projector_1 }, { DescriptiveMaterial.WHITE_1, GameMaterial.M_Projector_4 }, { DescriptiveMaterial.GREY_1, GameMaterial.M_Projector_3 }, { DescriptiveMaterial.MOON, GameMaterial.M_GreenScreen_3 }, { DescriptiveMaterial.GREY_2, GameMaterial.M_GreenScreen_1 }, { DescriptiveMaterial.GREEN_1, GameMaterial.M_GreenScreen_2 }, { DescriptiveMaterial.LIGHT_FLAT_GREY_1, GameMaterial.M_Projector_2 }, { DescriptiveMaterial.GLOWING_WHITE_1, GameMaterial.M_Projector_5 }, { DescriptiveMaterial.DARK_GREY_1, GameMaterial.M_Container_2 }, { DescriptiveMaterial.DARK_GREY_BLACK, GameMaterial.M_Player }, { DescriptiveMaterial.DARK_BLUE_CYAN, GameMaterial.M_Winch_4 }, { DescriptiveMaterial.VERY_LIGHT_GREY, GameMaterial.M_Winch_6 }, { DescriptiveMaterial.DARK_GREY_2, GameMaterial.M_Winch_2 }, { DescriptiveMaterial.GREY_WHITE_SPOTS, GameMaterial.M_Winch_3 }, { DescriptiveMaterial.DARKISH_RED_1, GameMaterial.M_Winch_1 }, { DescriptiveMaterial.DARKISH_RED_2, GameMaterial.M_Winch_5 }, { DescriptiveMaterial.WHITE_SPOTS_1, GameMaterial.M_Shroom_1 }, { DescriptiveMaterial.DARK_FLAT_GREY_1, GameMaterial.M_ReporterMic_1 }, { DescriptiveMaterial.LIGHT_FLAT_GREY_2, GameMaterial.M_ReporterMic_3 }, { DescriptiveMaterial.DARK_BLUE_GREY, GameMaterial.M_ReporterMic_2 }, { DescriptiveMaterial.FULL_BLACK, GameMaterial.M_Monster_BlackLocal }, { DescriptiveMaterial.LIGHT_BROWN, GameMaterial.M_HatShop_4 }, { DescriptiveMaterial.WHITE_PAPER, GameMaterial.M_Book_2 }, { DescriptiveMaterial.GREY_3, GameMaterial.M_BoomMic_3 }, { DescriptiveMaterial.ORANGE_1, GameMaterial.M_Pool_6 }, { DescriptiveMaterial.YELLOW_1, GameMaterial.M_Jester_1 }, { DescriptiveMaterial.GREY_SPOTS_1, GameMaterial.M_Flashlight_2_2 }, { DescriptiveMaterial.BROWN_1, GameMaterial.M_Flashlight_1_1 }, { DescriptiveMaterial.BROWN_2, GameMaterial.M_Pool_4 }, { DescriptiveMaterial.ORANGE_2, GameMaterial.M_Radio_4 }, { DescriptiveMaterial.NEUTRAL_GREY, GameMaterial.M_Metal }, { DescriptiveMaterial.VERY_LIGHT_BEIGE, GameMaterial.M_Hotdog_1 }, { DescriptiveMaterial.DARK_GREY_DARK_SPOTS, GameMaterial.M_Goo_3 }, { DescriptiveMaterial.RED_DARK_SPOTS, GameMaterial.M_Flare_1 }, { DescriptiveMaterial.WHITE_SPOTS_2, GameMaterial.M_Shroom_2 }, { DescriptiveMaterial.BLUE_1, GameMaterial.M_FredGull_2 }, { DescriptiveMaterial.WEIRD_TRANSPARENT_BLACK_SPOTS, GameMaterial.M_World_AlphaClip }, { DescriptiveMaterial.RED_1, GameMaterial.M_Hotdog_3 }, { DescriptiveMaterial.BEIGE_1, GameMaterial.M_Rugby_3 }, { DescriptiveMaterial.ORANGE_3, GameMaterial.M_Rug_6 }, { DescriptiveMaterial.YELLOW_2, GameMaterial.M_Borkin_2 }, { DescriptiveMaterial.GLOWING_WHITE_2, GameMaterial.M_Flashlight_Bright }, { DescriptiveMaterial.WHITE_DARK_SPOTS, GameMaterial.M_SoundPlayer_4 }, { DescriptiveMaterial.TRANSPARENT_SLIGHTLY_RED, GameMaterial.M_Laser_Weak }, { DescriptiveMaterial.FLAT_GREY, GameMaterial.M_BatteryLight_Off }, { DescriptiveMaterial.LIME_1, GameMaterial.M_BatteryLight_Green }, { DescriptiveMaterial.GLOWING_YELLOW, GameMaterial.M_BatteryLight_Yellow }, { DescriptiveMaterial.GLOWING_RED, GameMaterial.M_BatteryLight_Red }, { DescriptiveMaterial.BROWN_DARK_SPOTS, GameMaterial.M_Flashlight_1_2 }, { DescriptiveMaterial.BLACK_BLUE, GameMaterial.M_Flashlight_Off }, { DescriptiveMaterial.GREY_SMALL_DARK_SPOTS, GameMaterial.M_Player_1 }, { DescriptiveMaterial.ICE_BLUE, GameMaterial.M_PlayerVisor }, { DescriptiveMaterial.GREY_DARK_OUTLINES, GameMaterial.M_OxygenDisplay }, { DescriptiveMaterial.DARK_BLACK_DARK_SPOTS, GameMaterial.M_World_Local }, { DescriptiveMaterial.WHITE_2, GameMaterial.M_FlatUI }, { DescriptiveMaterial.YELLOW_3, GameMaterial.M_Hamburger_3 }, { DescriptiveMaterial.INTENSE_BLUE_ICE, GameMaterial.M_Norf_1 }, { DescriptiveMaterial.ORANGE_WHITE_SPOTS, GameMaterial.M_Norf_2 }, { DescriptiveMaterial.GREEN_2, GameMaterial.M_Jester_3 }, { DescriptiveMaterial.GLOWING_RED_1, GameMaterial.M_VideoCamera_Recording }, { DescriptiveMaterial.WHITE_3, GameMaterial.M_Cinema_2 }, { DescriptiveMaterial.DARK_GREY_3, GameMaterial.M_Cutbox_1 }, { DescriptiveMaterial.WHITE_BEIGE, GameMaterial.M_CD_Plastic }, { DescriptiveMaterial.FLAT_DARK_GREY, GameMaterial.M_ShockStick_1 }, { DescriptiveMaterial.ORANGE_4, GameMaterial.M_ShockStick_2 }, { DescriptiveMaterial.BLUE_CYAN_1, GameMaterial.M_Pool_7 }, { DescriptiveMaterial.GREY_DARK_SPOTS_1, GameMaterial.M_Flashlight_3_2 }, { DescriptiveMaterial.YELLOW_4, GameMaterial.M_Pool_8 }, { DescriptiveMaterial.WHITE_DARKER_SPOTS, GameMaterial.M_Chef_1 }, { DescriptiveMaterial.YELLOW_5, GameMaterial.M_Helmet }, { DescriptiveMaterial.BLUE_CYAN_2, GameMaterial.M_PlayerHatColor }, { DescriptiveMaterial.ORANGE_5, GameMaterial.M_Pirate_2 }, { DescriptiveMaterial.RED_BEIGE_1, GameMaterial.M_Rug_3 }, { DescriptiveMaterial.GLOWING_WHITE_3, GameMaterial.M_VideoCamera_3 }, { DescriptiveMaterial.BLACK_GRILLAGE, GameMaterial.M_World_ShelfGrate_3 }, { DescriptiveMaterial.ORANGE_BEIGE_PARALAX, GameMaterial.M_HatShop_6 }, { DescriptiveMaterial.GLOWING_WHITE_4, GameMaterial.M_Eye }, { DescriptiveMaterial.GLOWING_RED_2, GameMaterial.M_FlareEYe }, { DescriptiveMaterial.DARK_YELLOW, GameMaterial.M_RescueHook_1 }, { DescriptiveMaterial.DARK_BROWN, GameMaterial.M_Walkie_Talkie_1 }, { DescriptiveMaterial.GREEN_3, GameMaterial.M_Hamburger_4 }, { DescriptiveMaterial.DARK_GREY_BROWN, GameMaterial.M_Hair_1 }, { DescriptiveMaterial.RED_BEIGE_LIGHT, GameMaterial.M_Clown_2 }, { DescriptiveMaterial.BROWN_3, GameMaterial.M_Portrait_3 }, { DescriptiveMaterial.GLOWING_WHITE_RED, GameMaterial.M_HookLight }, { DescriptiveMaterial.GREEN_LEAVES, GameMaterial.M_Apple_3 }, { DescriptiveMaterial.CYAN_BLUE, GameMaterial.M_Child_1 }, { DescriptiveMaterial.WHITE_4, GameMaterial.M_Cap_1 }, { DescriptiveMaterial.RED_2, GameMaterial.M_Apple_1 }, { DescriptiveMaterial.FLAT_RED, GameMaterial.M_TitleCard_2 }, { DescriptiveMaterial.VIOLET_1, GameMaterial.M_Jester_2 }, { DescriptiveMaterial.GREEN_4, GameMaterial.M_Child_2 }, { DescriptiveMaterial.TRANSPARENT_GLASS, GameMaterial.M_ShopGlass }, { DescriptiveMaterial.TRANSPARENT_DARK_WEIRD_LIGHTING, GameMaterial.M_Goop }, { DescriptiveMaterial.BROWN_LARGE_LIGHT_SPOTS, GameMaterial.M_Apple_2 }, { DescriptiveMaterial.GREY_BLUE, GameMaterial.M_Rug_1 }, { DescriptiveMaterial.TRANSPARENT_DARK, GameMaterial.M_FrontScreen }, { DescriptiveMaterial.YELLOW_6, GameMaterial.M_Child_3 }, { DescriptiveMaterial.RED_MERCURY, GameMaterial.M_Apple_1 }, { DescriptiveMaterial.PINK_1, GameMaterial.M_Ears_2 }, { DescriptiveMaterial.LIME_2, GameMaterial.M_HatShop_2 }, { DescriptiveMaterial.DARK_VIOLET, GameMaterial.M_Bowler }, { DescriptiveMaterial.RED_3, GameMaterial.M_Bed_2 }, { DescriptiveMaterial.PINK_2, GameMaterial.M_Bed_4 }, { DescriptiveMaterial.ICE_1, GameMaterial.M_Bed_5 }, { DescriptiveMaterial.TURQUOISE, GameMaterial.M_Bed_6 }, { DescriptiveMaterial.RED_4, GameMaterial.M_House_2 } }; _nameToEnum["M_Debug"] = GameMaterial.M_Debug; _nameToEnum["M_Projector 1"] = GameMaterial.M_Projector_1; _nameToEnum["M_BoomMic 2"] = GameMaterial.M_BoomMic_2; _nameToEnum["M_Projector 4"] = GameMaterial.M_Projector_4; _nameToEnum["M_Projector 3"] = GameMaterial.M_Projector_3; _nameToEnum["M_GreenScreen 3"] = GameMaterial.M_GreenScreen_3; _nameToEnum["M_GreenScreen 1"] = GameMaterial.M_GreenScreen_1; _nameToEnum["M_GreenScreen 2"] = GameMaterial.M_GreenScreen_2; _nameToEnum["M_Projector 2"] = GameMaterial.M_Projector_2; _nameToEnum["M_Projector 5"] = GameMaterial.M_Projector_5; _nameToEnum["M_Container 2"] = GameMaterial.M_Container_2; _nameToEnum["M_Player"] = GameMaterial.M_Player; _nameToEnum["M_Winch 4"] = GameMaterial.M_Winch_4; _nameToEnum["M_Winch 6"] = GameMaterial.M_Winch_6; _nameToEnum["M_Winch 2"] = GameMaterial.M_Winch_2; _nameToEnum["M_Winch 3"] = GameMaterial.M_Winch_3; _nameToEnum["M_Winch 1"] = GameMaterial.M_Winch_1; _nameToEnum["M_Winch 5"] = GameMaterial.M_Winch_5; _nameToEnum["M_Shroom 1"] = GameMaterial.M_Shroom_1; _nameToEnum["M_ReporterMic 1"] = GameMaterial.M_ReporterMic_1; _nameToEnum["M_ReporterMic 3"] = GameMaterial.M_ReporterMic_3; _nameToEnum["M_ReporterMic 2"] = GameMaterial.M_ReporterMic_2; _nameToEnum["M_Monster_BlackLocal"] = GameMaterial.M_Monster_BlackLocal; _nameToEnum["M_HatShop 4"] = GameMaterial.M_HatShop_4; _nameToEnum["M_Book 2"] = GameMaterial.M_Book_2; _nameToEnum["M_BoomMic 3"] = GameMaterial.M_BoomMic_3; _nameToEnum["M_Monster"] = GameMaterial.M_Monster; _nameToEnum["M_World"] = GameMaterial.M_World; _nameToEnum["M_Pool 6"] = GameMaterial.M_Pool_6; _nameToEnum["M_Jester 1"] = GameMaterial.M_Jester_1; _nameToEnum["M_Flashlight 2 2"] = GameMaterial.M_Flashlight_2_2; _nameToEnum["M_Flashlight 1 1"] = GameMaterial.M_Flashlight_1_1; _nameToEnum["M_Pool 4"] = GameMaterial.M_Pool_4; _nameToEnum["M_Radio 4"] = GameMaterial.M_Radio_4; _nameToEnum["M_Metal"] = GameMaterial.M_Metal; _nameToEnum["M_Hotdog 1"] = GameMaterial.M_Hotdog_1; _nameToEnum["M_Goo 3"] = GameMaterial.M_Goo_3; _nameToEnum["M_Flare 1"] = GameMaterial.M_Flare_1; _nameToEnum["M_Shroom 2"] = GameMaterial.M_Shroom_2; _nameToEnum["M_FredGull 2"] = GameMaterial.M_FredGull_2; _nameToEnum["M_Hotdog 3"] = GameMaterial.M_Hotdog_3; _nameToEnum["M_Rugby 3"] = GameMaterial.M_Rugby_3; _nameToEnum["M_Rug 6"] = GameMaterial.M_Rug_6; _nameToEnum["M_Hug"] = GameMaterial.M_Hug; _nameToEnum["M_Radio 1"] = GameMaterial.M_Radio_1; _nameToEnum["M_Borkin 2"] = GameMaterial.M_Borkin_2; _nameToEnum["M_World_AlphaClip"] = GameMaterial.M_World_AlphaClip; _nameToEnum["M_DarkBlack"] = GameMaterial.M_DarkBlack; _nameToEnum["M_Flashlight Bright"] = GameMaterial.M_Flashlight_Bright; _nameToEnum["M_SoundPlayer 4"] = GameMaterial.M_SoundPlayer_4; _nameToEnum["M_Laser Weak"] = GameMaterial.M_Laser_Weak; _nameToEnum["M_BatteryLight_Off"] = GameMaterial.M_BatteryLight_Off; _nameToEnum["M_BatteryLight_Green"] = GameMaterial.M_BatteryLight_Green; _nameToEnum["M_BatteryLight_Yellow"] = GameMaterial.M_BatteryLight_Yellow; _nameToEnum["M_BatteryLight_Red"] = GameMaterial.M_BatteryLight_Red; _nameToEnum["M_Flashlight 1 2"] = GameMaterial.M_Flashlight_1_2; _nameToEnum["M_Flashlight Off"] = GameMaterial.M_Flashlight_Off; _nameToEnum["M_Player 1"] = GameMaterial.M_Player_1; _nameToEnum["M_PlayerVisor"] = GameMaterial.M_PlayerVisor; _nameToEnum["M_OxygenDisplay"] = GameMaterial.M_OxygenDisplay; _nameToEnum["M_FlashBeam"] = GameMaterial.M_FlashBeam; _nameToEnum["M_World_Local"] = GameMaterial.M_World_Local; _nameToEnum["M_FlatUI"] = GameMaterial.M_FlatUI; _nameToEnum["M_Hamburger 3"] = GameMaterial.M_Hamburger_3; _nameToEnum["M_Norf 1"] = GameMaterial.M_Norf_1; _nameToEnum["M_Norf 2"] = GameMaterial.M_Norf_2; _nameToEnum["M_Jester 3"] = GameMaterial.M_Jester_3; _nameToEnum["M_Splash"] = GameMaterial.M_Splash; _nameToEnum["M_VideoCamera_Recording"] = GameMaterial.M_VideoCamera_Recording; _nameToEnum["M_Cinema 2"] = GameMaterial.M_Cinema_2; _nameToEnum["M_Hand"] = GameMaterial.M_Hand; _nameToEnum["M_Cutbox 1"] = GameMaterial.M_Cutbox_1; _nameToEnum["M_LongFlashlight 2 1"] = GameMaterial.M_LongFlashlight_2_1; _nameToEnum["M_Cutbox 2"] = GameMaterial.M_Cutbox_2; _nameToEnum["M_CD_Plastic"] = GameMaterial.M_CD_Plastic; _nameToEnum["M_CD"] = GameMaterial.M_CD; _nameToEnum["M_VFX_ShockStick"] = GameMaterial.M_VFX_ShockStick; _nameToEnum["M_Light_Bright"] = GameMaterial.M_Light_Bright; _nameToEnum["M_ShockStick 1"] = GameMaterial.M_ShockStick_1; _nameToEnum["M_ShockStick 2"] = GameMaterial.M_ShockStick_2; _nameToEnum["M_Pool 7"] = GameMaterial.M_Pool_7; _nameToEnum["M_Defib 3"] = GameMaterial.M_Defib_3; _nameToEnum["M_Flashlight 3 2"] = GameMaterial.M_Flashlight_3_2; _nameToEnum["M_Pool 8"] = GameMaterial.M_Pool_8; _nameToEnum["M_Chef 1"] = GameMaterial.M_Chef_1; _nameToEnum["M_Helmet"] = GameMaterial.M_Helmet; _nameToEnum["M_Pirate 3"] = GameMaterial.M_Pirate_3; _nameToEnum["M_Pirate 1"] = GameMaterial.M_Pirate_1; _nameToEnum["M_PlayerHatColor"] = GameMaterial.M_PlayerHatColor; _nameToEnum["M_Pirate 2"] = GameMaterial.M_Pirate_2; _nameToEnum["M_Rug 3"] = GameMaterial.M_Rug_3; _nameToEnum["M_VideoCamera 3"] = GameMaterial.M_VideoCamera_3; _nameToEnum["M_World_ShelfGrate 3"] = GameMaterial.M_World_ShelfGrate_3; _nameToEnum["M_HatShop 6"] = GameMaterial.M_HatShop_6; _nameToEnum["M_Horn"] = GameMaterial.M_Horn; _nameToEnum["M_VideoCamera 5"] = GameMaterial.M_VideoCamera_5; _nameToEnum["M_VideoCamera 1"] = GameMaterial.M_VideoCamera_1; _nameToEnum["M_VideoCamera 2"] = GameMaterial.M_VideoCamera_2; _nameToEnum["M_Eye"] = GameMaterial.M_Eye; _nameToEnum["M_CameraScreen"] = GameMaterial.M_CameraScreen; _nameToEnum["M_Flare 2"] = GameMaterial.M_Flare_2; _nameToEnum["M_FlareEYe"] = GameMaterial.M_FlareEYe; _nameToEnum["M_FlareBeam"] = GameMaterial.M_FlareBeam; _nameToEnum["M_Ushanka 2"] = GameMaterial.M_Ushanka_2; _nameToEnum["M_Ushanka 1"] = GameMaterial.M_Ushanka_1; _nameToEnum["M_Container 1"] = GameMaterial.M_Container_1; _nameToEnum["M_Container 3"] = GameMaterial.M_Container_3; _nameToEnum["M_Cutbox 3"] = GameMaterial.M_Cutbox_3; _nameToEnum["M_Halo"] = GameMaterial.M_Halo; _nameToEnum["M_Beanie 1"] = GameMaterial.M_Beanie_1; _nameToEnum["M_Monster_Dark"] = GameMaterial.M_Monster_Dark; _nameToEnum["M_News2"] = GameMaterial.M_News2; _nameToEnum["M_World_BarbedWire"] = GameMaterial.M_World_BarbedWire; _nameToEnum["M_World_ShelfGrate 1"] = GameMaterial.M_World_ShelfGrate_1; _nameToEnum["M_World_ShelfGrate 2"] = GameMaterial.M_World_ShelfGrate_2; _nameToEnum["M_DivingBell 1"] = GameMaterial.M_DivingBell_1; _nameToEnum["M_DivingBell 2"] = GameMaterial.M_DivingBell_2; _nameToEnum["M_DivingBell 3"] = GameMaterial.M_DivingBell_3; _nameToEnum["M_DivingBell 3_Local"] = GameMaterial.M_DivingBell_3_Local; _nameToEnum["M_DivingBell 3_Local Actually"] = GameMaterial.M_DivingBell_3_Local_Actually; _nameToEnum["M_DivingBell 4"] = GameMaterial.M_DivingBell_4; _nameToEnum["M_DivingBell 4_Local"] = GameMaterial.M_DivingBell_4_Local; _nameToEnum["M_DivingBell 4_Local Actually"] = GameMaterial.M_DivingBell_4_Local_Actually; _nameToEnum["M_DivingBell Lever_Local"] = GameMaterial.M_DivingBell_Lever_Local; _nameToEnum["M_Popper 2"] = GameMaterial.M_Popper_2; _nameToEnum["M_Popper 1"] = GameMaterial.M_Popper_1; _nameToEnum["M_Popper 4"] = GameMaterial.M_Popper_4; _nameToEnum["M_Popper 3"] = GameMaterial.M_Popper_3; _nameToEnum["M_BigSlapPainting 1"] = GameMaterial.M_BigSlapPainting_1; _nameToEnum["ParticlesUnlit"] = GameMaterial.ParticlesUnlit; _nameToEnum["M_RescueHook 1"] = GameMaterial.M_RescueHook_1; _nameToEnum["M_FredGull 1"] = GameMaterial.M_FredGull_1; _nameToEnum["M_Walkie Talkie 2"] = GameMaterial.M_Walkie_Talkie_2; _nameToEnum["M_Walkie Talkie 1"] = GameMaterial.M_Walkie_Talkie_1; _nameToEnum["M_Walkie Talkie 3"] = GameMaterial.M_Walkie_Talkie_3; _nameToEnum["M_Explosion"] = GameMaterial.M_Explosion; _nameToEnum["M_Milk1"] = GameMaterial.M_Milk1; _nameToEnum["M_Floppy 1"] = GameMaterial.M_Floppy_1; _nameToEnum["M_Hamburger 1"] = GameMaterial.M_Hamburger_1; _nameToEnum["M_Hamburger 2"] = GameMaterial.M_Hamburger_2; _nameToEnum["M_Hamburger 4"] = GameMaterial.M_Hamburger_4; _nameToEnum["M_Jester 4"] = GameMaterial.M_Jester_4; _nameToEnum["M_VideoDisplayScreen"] = GameMaterial.M_VideoDisplayScreen; _nameToEnum["M_Hair 1"] = GameMaterial.M_Hair_1; _nameToEnum["M_Clown 2"] = GameMaterial.M_Clown_2; _nameToEnum["M_Cowboy"] = GameMaterial.M_Cowboy; _nameToEnum["M_Portrait 3"] = GameMaterial.M_Portrait_3; _nameToEnum["M_RescueHook 2"] = GameMaterial.M_RescueHook_2; _nameToEnum["M_HookLight"] = GameMaterial.M_HookLight; _nameToEnum["M_Apple 3"] = GameMaterial.M_Apple_3; _nameToEnum["M_Child 5"] = GameMaterial.M_Child_5; _nameToEnum["M_Ears 1"] = GameMaterial.M_Ears_1; _nameToEnum["M_Radio 2"] = GameMaterial.M_Radio_2; _nameToEnum["M_Radio 3"] = GameMaterial.M_Radio_3; _nameToEnum["M_Book 1"] = GameMaterial.M_Book_1; _nameToEnum["M_Crane"] = GameMaterial.M_Crane; _nameToEnum["M_Cinema 1"] = GameMaterial.M_Cinema_1; _nameToEnum["M_Screen"] = GameMaterial.M_Screen; _nameToEnum["M_Cursor"] = GameMaterial.M_Cursor; _nameToEnum["M_Defib 4"] = GameMaterial.M_Defib_4; _nameToEnum["M_Defib 2"] = GameMaterial.M_Defib_2; _nameToEnum["M_LongFlashlight 2 2"] = GameMaterial.M_LongFlashlight_2_2; _nameToEnum["M_Laser"] = GameMaterial.M_Laser; _nameToEnum["M_SoundPlayer 3"] = GameMaterial.M_SoundPlayer_3; _nameToEnum["M_Goo 1"] = GameMaterial.M_Goo_1; _nameToEnum["M_TitleCardRender"] = GameMaterial.M_TitleCardRender; _nameToEnum["M_TitleCard 1"] = GameMaterial.M_TitleCard_1; _nameToEnum["M_TitleCard"] = GameMaterial.M_TitleCard; _nameToEnum["M_TitleCard 2"] = GameMaterial.M_TitleCard_2; _nameToEnum["M_GooBright"] = GameMaterial.M_GooBright; _nameToEnum["M_FredGull 4"] = GameMaterial.M_FredGull_4; _nameToEnum["M_FredGull 3"] = GameMaterial.M_FredGull_3; _nameToEnum["M_Flashlight 3 1"] = GameMaterial.M_Flashlight_3_1; _nameToEnum["M_Crown"] = GameMaterial.M_Crown; _nameToEnum["M_Copyright 1"] = GameMaterial.M_Copyright_1; _nameToEnum["M_Rugby 2"] = GameMaterial.M_Rugby_2; _nameToEnum["M_Interior 7"] = GameMaterial.M_Interior_7; _nameToEnum["M_Clown 1"] = GameMaterial.M_Clown_1; _nameToEnum["M_Hotdog 4"] = GameMaterial.M_Hotdog_4; _nameToEnum["M_Top"] = GameMaterial.M_Top; _nameToEnum["M_Rug 5"] = GameMaterial.M_Rug_5; _nameToEnum["M_Borkin 1"] = GameMaterial.M_Borkin_1; _nameToEnum["M_House Glas"] = GameMaterial.M_House_Glas; _nameToEnum["M_Portrait 1"] = GameMaterial.M_Portrait_1; _nameToEnum["M_Copyright"] = GameMaterial.M_Copyright; _nameToEnum["M_HatShop 3"] = GameMaterial.M_HatShop_3; _nameToEnum["M_BoomMic 1"] = GameMaterial.M_BoomMic_1; _nameToEnum["M_Foodora"] = GameMaterial.M_Foodora; _nameToEnum["M_Jester 2"] = GameMaterial.M_Jester_2; _nameToEnum["M_Child 4"] = GameMaterial.M_Child_4; _nameToEnum["M_Balaclava"] = GameMaterial.M_Balaclava; _nameToEnum["M_Child 2"] = GameMaterial.M_Child_2; _nameToEnum["M_ShopGlass"] = GameMaterial.M_ShopGlass; _nameToEnum["M_Podcast 4"] = GameMaterial.M_Podcast_4; _nameToEnum["M_Podcast 2"] = GameMaterial.M_Podcast_2; _nameToEnum["M_Portrait 2"] = GameMaterial.M_Portrait_2; _nameToEnum["M_SoundPlayer 2"] = GameMaterial.M_SoundPlayer_2; _nameToEnum["M_Goop"] = GameMaterial.M_Goop; _nameToEnum["M_SoundPlayer 1"] = GameMaterial.M_SoundPlayer_1; _nameToEnum["M_HatShop 8"] = GameMaterial.M_HatShop_8; _nameToEnum["M_News1"] = GameMaterial.M_News1; _nameToEnum["M_Defib 1"] = GameMaterial.M_Defib_1; _nameToEnum["M_Apple 2"] = GameMaterial.M_Apple_2; _nameToEnum["M_HatShop 5"] = GameMaterial.M_HatShop_5; _nameToEnum["M_Rug 1"] = GameMaterial.M_Rug_1; _nameToEnum["M_FrontScreen"] = GameMaterial.M_FrontScreen; _nameToEnum["M_SoundPlayer 5"] = GameMaterial.M_SoundPlayer_5; _nameToEnum["M_Portrait 4"] = GameMaterial.M_Portrait_4; _nameToEnum["M_Child 3"] = GameMaterial.M_Child_3; _nameToEnum["M_TaserBeam"] = GameMaterial.M_TaserBeam; _nameToEnum["M_VFX_BombFuze"] = GameMaterial.M_VFX_BombFuze; _nameToEnum["M_Rug 4"] = GameMaterial.M_Rug_4; _nameToEnum["M_Flashlight 2 1"] = GameMaterial.M_Flashlight_2_1; _nameToEnum["M_Apple 1"] = GameMaterial.M_Apple_1; _nameToEnum["M_DefaultParticle"] = GameMaterial.M_DefaultParticle; _nameToEnum["M_Knifo"] = GameMaterial.M_Knifo; _nameToEnum["M_Bucket 1"] = GameMaterial.M_Bucket_1; _nameToEnum["M_Bomb"] = GameMaterial.M_Bomb; _nameToEnum["M_Ears 2"] = GameMaterial.M_Ears_2; _nameToEnum["M_Child 1"] = GameMaterial.M_Child_1; _nameToEnum["M_Ears 3"] = GameMaterial.M_Ears_3; _nameToEnum["M_Cap 1"] = GameMaterial.M_Cap_1; _nameToEnum["M_Goo 2"] = GameMaterial.M_Goo_2; _nameToEnum["M_Party 2"] = GameMaterial.M_Party_2; _nameToEnum["M_Party 1"] = GameMaterial.M_Party_1; _nameToEnum["M_Milk2"] = GameMaterial.M_Milk2; _nameToEnum["M_HatShop 7"] = GameMaterial.M_HatShop_7; _nameToEnum["M_Brain 1"] = GameMaterial.M_Brain_1; _nameToEnum["M_HatShop 2"] = GameMaterial.M_HatShop_2; _nameToEnum["M_Rugby 1"] = GameMaterial.M_Rugby_1; _nameToEnum["M_Witch"] = GameMaterial.M_Witch; _nameToEnum["M_Hotdog 2"] = GameMaterial.M_Hotdog_2; _nameToEnum["M_HatShop 1"] = GameMaterial.M_HatShop_1; _nameToEnum["M_Bowler"] = GameMaterial.M_Bowler; _nameToEnum["M_Brain 2"] = GameMaterial.M_Brain_2; _nameToEnum["Jello_PostShader"] = GameMaterial.Jello_PostShader; _nameToEnum["M_DivingScreen_Nice"] = GameMaterial.M_DivingScreen_Nice; _nameToEnum["M_Light_Warm"] = GameMaterial.M_Light_Warm; _nameToEnum["M_Asphalt"] = GameMaterial.M_Asphalt; _nameToEnum["M_Barrel 1"] = GameMaterial.M_Barrel_1; _nameToEnum["M_Barrel 2"] = GameMaterial.M_Barrel_2; _nameToEnum["M_Bed 1"] = GameMaterial.M_Bed_1; _nameToEnum["M_Bed 2"] = GameMaterial.M_Bed_2; _nameToEnum["M_Bed 3"] = GameMaterial.M_Bed_3; _nameToEnum["M_Bed 4"] = GameMaterial.M_Bed_4; _nameToEnum["M_Bed 5"] = GameMaterial.M_Bed_5; _nameToEnum["M_Bed 6"] = GameMaterial.M_Bed_6; _nameToEnum["M_Bed 7"] = GameMaterial.M_Bed_7; _nameToEnum["M_Bed Default 1"] = GameMaterial.M_Bed_Default_1; _nameToEnum["M_House 1"] = GameMaterial.M_House_1; _nameToEnum["M_House 10"] = GameMaterial.M_House_10; _nameToEnum["M_House 11"] = GameMaterial.M_House_11; _nameToEnum["M_House 12"] = GameMaterial.M_House_12; _nameToEnum["M_House 2"] = GameMaterial.M_House_2; _nameToEnum["M_House 3"] = GameMaterial.M_House_3; _nameToEnum["M_House 4"] = GameMaterial.M_House_4; _nameToEnum["M_House 5"] = GameMaterial.M_House_5; _nameToEnum["M_House 6"] = GameMaterial.M_House_6; _nameToEnum["M_House 8"] = GameMaterial.M_House_8; _nameToEnum["M_House 9"] = GameMaterial.M_House_9; _nameToEnum["M_Interior 1"] = GameMaterial.M_Interior_1; _nameToEnum["M_Interior 2"] = GameMaterial.M_Interior_2; _nameToEnum["M_Interior 3"] = GameMaterial.M_Interior_3; _nameToEnum["M_Interior 4"] = GameMaterial.M_Interior_4; _nameToEnum["M_Interior 5"] = GameMaterial.M_Interior_5; _nameToEnum["M_Interior 6"] = GameMaterial.M_Interior_6; _nameToEnum["M_Interior 8"] = GameMaterial.M_Interior_8; _nameToEnum["M_Rock"] = GameMaterial.M_Rock; _nameToEnum["M_Rug 2"] = GameMaterial.M_Rug_2; _nameToEnum["M_Rug 7"] = GameMaterial.M_Rug_7; _nameToEnum["M_Rug 8"] = GameMaterial.M_Rug_8; _nameToEnum["M_Rug 9"] = GameMaterial.M_Rug_9; _nameToEnum["M_Solar 1"] = GameMaterial.M_Solar_1; _nameToEnum["M_Solar 2"] = GameMaterial.M_Solar_2; _nameToEnum["M_Sunflower 1"] = GameMaterial.M_Sunflower_1; _nameToEnum["M_Sunflower 2"] = GameMaterial.M_Sunflower_2; _nameToEnum["M_Sunflower 3"] = GameMaterial.M_Sunflower_3; _nameToEnum["M_ThePlan 1"] = GameMaterial.M_ThePlan_1; _nameToEnum["M_ThePlan 2"] = GameMaterial.M_ThePlan_2; _nameToEnum["M_Trunk"] = GameMaterial.M_Trunk; _nameToEnum["M_Surf_Bush"] = GameMaterial.M_Surf_Bush; _nameToEnum["M_Surf_Ground"] = GameMaterial.M_Surf_Ground; _nameToEnum["M_Surf_GroundGrass"] = GameMaterial.M_Surf_GroundGrass; _nameToEnum["M_DivingBell1Nice"] = GameMaterial.M_DivingBell1Nice; _nameToEnum["M_DivingBell2Nice"] = GameMaterial.M_DivingBell2Nice; _nameToEnum["M_DivingBell3Nice"] = GameMaterial.M_DivingBell3Nice; _nameToEnum["M_DivingBell4Nice"] = GameMaterial.M_DivingBell4Nice; _nameToEnum["M_DivingBell5Nice"] = GameMaterial.M_DivingBell5Nice; _nameToEnum["M_DivingBell6Nice"] = GameMaterial.M_DivingBell6Nice; _nameToEnum["M_CloudSphere 2"] = GameMaterial.M_CloudSphere_2; _nameToEnum["M_CloudSphere"] = GameMaterial.M_CloudSphere; _nameToEnum["M_CloudSphere_Evening 2"] = GameMaterial.M_CloudSphere_Evening_2; _nameToEnum["M_CloudSphere_Evening"] = GameMaterial.M_CloudSphere_Evening; _nameToEnum["M_Sky"] = GameMaterial.M_Sky; _nameToEnum["M_Sky_Evening"] = GameMaterial.M_Sky_Evening; _nameToEnum["M_Intro"] = GameMaterial.M_Intro; _nameToEnum["M_House 7"] = GameMaterial.M_House_7; _nameToEnum["M_Scraper"] = GameMaterial.M_Scraper; _nameToEnum["M_Invis"] = GameMaterial.M_Invis; _nameToEnum["M_Mirror"] = GameMaterial.M_Mirror; _nameToEnum["M_ArrowIcon"] = GameMaterial.M_ArrowIcon; _nameToEnum["M_CamConverter 1"] = GameMaterial.M_CamConverter_1; _nameToEnum["M_CamConverter 2"] = GameMaterial.M_CamConverter_2; _nameToEnum["M_CamConverter 3"] = GameMaterial.M_CamConverter_3; _nameToEnum["M_CamConverter 4"] = GameMaterial.M_CamConverter_4; _nameToEnum["M_CamConverter 5"] = GameMaterial.M_CamConverter_5; _nameToEnum["M_CameraIcon"] = GameMaterial.M_CameraIcon; _nameToEnum["M_Charge 1"] = GameMaterial.M_Charge_1; _nameToEnum["M_Charge 2"] = GameMaterial.M_Charge_2; _nameToEnum["M_Charge 3"] = GameMaterial.M_Charge_3; _nameToEnum["M_Charge 4"] = GameMaterial.M_Charge_4; _nameToEnum["M_Charge 5"] = GameMaterial.M_Charge_5; _nameToEnum["M_Drone 1"] = GameMaterial.M_Drone_1; _nameToEnum["M_Drone 2"] = GameMaterial.M_Drone_2; _nameToEnum["M_Drone 3"] = GameMaterial.M_Drone_3; _nameToEnum["M_Drone 4"] = GameMaterial.M_Drone_4; _nameToEnum["M_Drone 5"] = GameMaterial.M_Drone_5; _nameToEnum["M_FaceMachine"] = GameMaterial.M_FaceMachine; _nameToEnum["M_House 13"] = GameMaterial.M_House_13; _nameToEnum["M_House Door"] = GameMaterial.M_House_Door; _nameToEnum["M_Landing"] = GameMaterial.M_Landing; _nameToEnum["M_Laptop"] = GameMaterial.M_Laptop; _nameToEnum["M_Machine"] = GameMaterial.M_Machine; _nameToEnum["M_NetworkDeal 1"] = GameMaterial.M_NetworkDeal_1; _nameToEnum["M_NetworkDeal 2"] = GameMaterial.M_NetworkDeal_2; _nameToEnum["M_NetworkDeal 3"] = GameMaterial.M_NetworkDeal_3; _nameToEnum["M_NetworkDeal 4"] = GameMaterial.M_NetworkDeal_4; _nameToEnum["M_Podcast 1"] = GameMaterial.M_Podcast_1; _nameToEnum["M_Podcast 10"] = GameMaterial.M_Podcast_10; _nameToEnum["M_Podcast 11"] = GameMaterial.M_Podcast_11; _nameToEnum["M_Podcast 3"] = GameMaterial.M_Podcast_3; _nameToEnum["M_Podcast 5"] = GameMaterial.M_Podcast_5; _nameToEnum["M_Podcast 6"] = GameMaterial.M_Podcast_6; _nameToEnum["M_Podcast 7"] = GameMaterial.M_Podcast_7; _nameToEnum["M_Podcast 8"] = GameMaterial.M_Podcast_8; _nameToEnum["M_Podcast 9"] = GameMaterial.M_Podcast_9; _nameToEnum["M_Pool 1"] = GameMaterial.M_Pool_1; _nameToEnum["M_Pool 11"] = GameMaterial.M_Pool_11; _nameToEnum["M_Pool 2"] = GameMaterial.M_Pool_2; _nameToEnum["M_Pool 3"] = GameMaterial.M_Pool_3; _nameToEnum["M_Pool 5"] = GameMaterial.M_Pool_5; _nameToEnum["M_Shop 1"] = GameMaterial.M_Shop_1; _nameToEnum["M_Shop 2"] = GameMaterial.M_Shop_2; _nameToEnum["M_Shop 3"] = GameMaterial.M_Shop_3; _nameToEnum["M_TV 1"] = GameMaterial.M_TV_1; _nameToEnum["M_TV 2"] = GameMaterial.M_TV_2; _nameToEnum["M_TV"] = GameMaterial.M_TV; _nameToEnum["M_Teleport 1"] = GameMaterial.M_Teleport_1; _nameToEnum["M_Teleport 2"] = GameMaterial.M_Teleport_2; _nameToEnum["M_Trampoline 1"] = GameMaterial.M_Trampoline_1; _nameToEnum["M_Trampoline 2"] = GameMaterial.M_Trampoline_2; _nameToEnum["M_Trampoline 3"] = GameMaterial.M_Trampoline_3; _nameToEnum["M_Trampoline 4"] = GameMaterial.M_Trampoline_4; _nameToEnum["M_UpgradeSign"] = GameMaterial.M_UpgradeSign; _nameToEnum["M_Water"] = GameMaterial.M_Water; _nameToEnum["M_Wood"] = GameMaterial.M_Wood; _nameToEnum["M_Surf_Bush_NoWind"] = GameMaterial.M_Surf_Bush_NoWind; _nameToEnum["M_Surf_Ground_Dirt"] = GameMaterial.M_Surf_Ground_Dirt; _nameToEnum["M_Surf_Ground_Side"] = GameMaterial.M_Surf_Ground_Side; _nameToEnum["M_Surf_Ground_Side_Dirt"] = GameMaterial.M_Surf_Ground_Side_Dirt; _nameToEnum["M_Charge"] = GameMaterial.M_Charge; _nameToEnum["M_Dust"] = GameMaterial.M_Dust; _nameToEnum["M_Heal"] = GameMaterial.M_Heal; } public static void InitMaterials() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); HashSet<string> hashSet = new HashSet<string>(); List<Material> list = new List<Material>(); Material[] array2 = array; foreach (Material val in array2) { if (hashSet.Add(((Object)val).name)) { list.Add(val); } } Logger.Log($"Found {list.Count} unique materials in game resources"); Logger.Log("Unique material names: " + string.Join(", ", hashSet.ToList())); foreach (Material item in list) { if (_nameToEnum.TryGetValue(((Object)item).name, out var value)) { if (!_materials.ContainsKey(value)) { _materials[value] = item; } } else { Logger.LogError("Could not find material: " + ((Object)item).name + " in _nameToEnum, skipping"); } } Logger.Log($"Loaded {_materials.Count} materials"); GameMaterials.OnMaterialsLoaded?.Invoke(); } public static Material GetMaterial(GameMaterial type) { if (!_materials.TryGetValue(type, out Material value)) { return null; } return value; } public static Material GetMaterial(DescriptiveMaterial type) { if (_descriptiveToOriginal.TryGetValue(type, out var value)) { return GetMaterial(value); } return null; } public static void ApplyMaterial(GameObject target, GameMaterial type, bool deepApply = true) { Material material = GetMaterial(type); if ((Object)(object)material != (Object)null) { ApplyToTarget(target, material, deepApply); } } public static void ApplyMaterial(GameObject target, DescriptiveMaterial type, bool deepApply = true) { Material material = GetMaterial(type); if ((Object)(object)material != (Object)null) { ApplyToTarget(target, material, deepApply); } } private static void ApplyToTarget(GameObject target, Material mat, bool deepApply) { if (deepApply) { Renderer[] componentsInChildren = target.GetComponentsInChildren<Renderer>(true); foreach (Renderer r in componentsInChildren) { ApplyToRenderer(r, mat); } } else { Renderer component = target.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { ApplyToRenderer(component, mat); } } } private static void ApplyToRenderer(Renderer r, Material mat) { Material[] materials = r.materials; for (int i = 0; i < materials.Length; i++) { materials[i] = mat; } r.materials = materials; } } public enum ImpactSoundType { None, PlasticBounce1, PlasticBounce2, PlasticBounce3, PlasticBounce4, PlasticBounce5, PlasticBounce6, BombBounce1, BombBounce2, CDBounce1, CDBounce2, ContainerBounce1, ContainerBounce2, ShroomBounce1, CanBounce, CanBounce1, Burger1, Burger2 } public class ImpactSoundScanner { public static Dictionary<string, SFX_Instance> FoundImpactSounds = new Dictionary<string, SFX_Instance>(); public static Dictionary<ImpactSoundType, SFX_Instance> ImpactSounds = new Dictionary<ImpactSoundType, SFX_Instance>(); private static readonly Dictionary<string, Dictionary<string, ImpactSoundType>> ItemExtractionMap = new Dictionary<string, Dictionary<string, ImpactSoundType>> { { "Boom Mic", new Dictionary<string, ImpactSoundType> { { "SFX Plastic Bounce 3", ImpactSoundType.PlasticBounce3 }, { "SFX Plastic Bounce 4", ImpactSoundType.PlasticBounce4 } } }, { "Camera", new Dictionary<string, ImpactSoundType> { { "SFX Plastic Bounce 5", ImpactSoundType.PlasticBounce5 } } }, { "Defibrilator", new Dictionary<string, ImpactSoundType> { { "SFX Bomb Bounce 1", ImpactSoundType.BombBounce1 }, { "SFX Bomb Bounce 2", ImpactSoundType.BombBounce2 } } }, { "Disc", new Dictionary<string, ImpactSoundType> { { "SFX CD Bounce 1", ImpactSoundType.CDBounce1 }, { "SFX CD Bounce 2", ImpactSoundType.CDBounce2 } } }, { "Goo Ball", new Dictionary<string, ImpactSoundType> { { "SFX Plastic Bounce 6", ImpactSoundType.PlasticBounce6 } } }, { "FredGull", new Dictionary<string, ImpactSoundType> { { "SFX Can Bounce", ImpactSoundType.CanBounce }, { "SFX Can Bounce 1", ImpactSoundType.CanBounce1 } } }, { "SirMonsterBurger", new Dictionary<string, ImpactSoundType> { { "SFX Burger 1", ImpactSoundType.Burger1 }, { "SFX Burger 2", ImpactSoundType.Burger2 } } }, { "", new Dictionary<string, ImpactSoundType> { { "SFX Plastic Bounce 1", ImpactSoundType.PlasticBounce1 }, { "SFX Plastic Bounce 2", ImpactSoundType.PlasticBounce2 }, { "SFX Container Bounce 1", ImpactSoundType.ContainerBounce1 }, { "SFX Container Bounce 2", ImpactSoundType.ContainerBounce2 }, { "SFX Shroom Bounce 1", ImpactSoundType.ShroomBounce1 } } } }; public static void ScanImpactSounds() { Debug.Log((object)"[ImpactSoundScanner] Starting scan via ItemDatabase..."); ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"[ImpactSoundScanner] ItemDatabase instance not found!"); return; } FieldInfo objectsField = Items.GetObjectsField(instance); List<Item> itemsFromField = Items.GetItemsFromField(objectsField, instance); if (itemsFromField == null || itemsFromField.Count == 0) { Debug.LogWarning((object)"[ImpactSoundScanner] No items found in ItemDatabase."); return; } foreach (Item item in itemsFromField) { if ((Object)(object)item == (Object)null) { continue; } string text = item.displayName ?? ((Object)item).name ?? "Unknown Item"; if ((Object)(object)item.itemObject == (Object)null) { Debug.Log((object)("[ImpactSoundScanner] Skipping item '" + text + "': No itemObject (prefab) assigned.")); continue; } PhysicsSound[] componentsInChildren = item.itemObject.GetComponentsInChildren<PhysicsSound>(true); if (componentsInChildren.Length == 0) { continue; } Debug.Log((object)$"[ImpactSoundScanner] Checking item '{text}' ({componentsInChildren.Length} PhysicsSound components)..."); PhysicsSound[] array = componentsInChildren; foreach (PhysicsSound val in array) { if (val.impactSounds == null) { continue; } SFX_Instance[] impactSounds = val.impactSounds; foreach (SFX_Instance val2 in impactSounds) { if (!((Object)(object)val2 == (Object)null)) { string name = ((Object)val2).name; if (!FoundImpactSounds.ContainsKey(name)) { FoundImpactSounds.Add(name, val2); Debug.Log((object)("[ImpactSoundScanner] >>> NEW SOUND FOUND: '" + name + "' (Source: " + text + ")")); } } } } } Debug.Log((object)$"[ImpactSoundScanner] Scan complete: {FoundImpactSounds.Count} unique impact sounds cached."); } public static void InitImpactSounds() { Debug.Log((object)"[ImpactSoundScanner] Initializing Impact Sounds association..."); ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"[ImpactSoundScanner] Failed to initialize: ItemDatabase is null!"); return; } FieldInfo objectsField = Items.GetObjectsField(instance); List<Item> itemsFromField = Items.GetItemsFromField(objectsField, instance); int num = 0; int num2 = 0; foreach (Item item in itemsFromField) { if ((Object)(object)item == (Object)null || (Object)(object)item.itemObject == (Object)null) { continue; } string text = item.displayName ?? ""; if (!ItemExtractionMap.TryGetValue(text, out Dictionary<string, ImpactSoundType> value)) { continue; } num++; PhysicsSound[] componentsInChildren = item.itemObject.GetComponentsInChildren<PhysicsSound>(true); PhysicsSound[] array = componentsInChildren; foreach (PhysicsSound val in array) { if (val.impactSounds == null) { continue; } SFX_Instance[] impactSounds = val.impactSounds; foreach (SFX_Instance val2 in impactSounds) { if (!((Object)(object)val2 == (Object)null) && value.TryGetValue(((Object)val2).name, out var value2) && !ImpactSounds.ContainsKey(value2)) { ImpactSounds.Add(value2, val2); num2++; Debug.Log((object)$"[ImpactSoundScanner] Associated '{((Object)val2).name}' with ImpactSoundType.{value2} (from item '{text}')"); } } } } Debug.Log((object)$"[ImpactSoundScanner] Association phase complete. Processed {num} mapped items, associated {num2} unique sounds."); ValidateExtraction(); } private static void ValidateExtraction() { Debug.Log((object)"[ImpactSoundScanner] Starting extraction validation..."); int num = 0; int num2 = 0; foreach (ImpactSoundType value in Enum.GetValues(typeof(ImpactSoundType))) { if (value != 0) { num2++; if (!ImpactSounds.ContainsKey(value)) { Debug.LogWarning((object)$"[ImpactSoundScanner] VALIDATION FAILURE: Missing sound for type '{value}'"); num++; } } } if (num == 0) { Debug.Log((object)$"[ImpactSoundScanner] VALIDATION SUCCESS: All {num2} impact sound types are correctly associated."); } else { Debug.LogError((object)$"[ImpactSoundScanner] VALIDATION FAILED: {num} / {num2} sounds were not found. Check ItemExtractionMap and logs above."); } } public static SFX_Instance GetImpactSound(ImpactSoundType type) { if (!ImpactSounds.TryGetValue(type, out SFX_Instance value) || (Object)(object)value == (Object)null) { return null; } return Object.Instantiate<SFX_Instance>(value); } public static SFX_Instance[] GetImpactSounds(params ImpactSoundType[] types) { List<SFX_Instance> list = new List<SFX_Instance>(); foreach (ImpactSoundType type in types) { SFX_Instance impactSound = GetImpactSound(type); if ((Object)(object)impactSound != (Object)null) { list.Add(impactSound); } } return list.ToArray(); } } public class CustomShopItemCategory { public byte index; public string name; } public static class Items { public static List<CustomShopItemCategory> customCategories = new List<CustomShopItemCategory>(); public static byte RegisterCustomCategory(string categoryName) { byte b = (byte)(customCategories.Count + 20); customCategories.Add(new CustomShopItemCategory { index = b, name = categoryName }); return b; } public static void SetupPrefab(GameObject prefab) { EnsureComponents(prefab); } private static void EnsureComponents(GameObject prefab) { if ((Object)(object)prefab.GetComponent<ItemInstance>() == (Object)null) { prefab.AddComponent<ItemInstance>(); Debug.Log((object)"Added ItemInstance component"); } EnsureHandGizmo(prefab); } public static void EnsureHandGizmo(GameObject prefab) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab.GetComponentInChildren<HandGizmo>(true) != (Object)null)) { GameObject val = new GameObject("HandGizmo"); val.transform.SetParent(prefab.transform); val.AddComponent<HandGizmo>(); GameObject val2 = new GameObject("GizmoVisual"); val2.transform.SetParent(val.transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; Debug.Log((object)"Added HandGizmo with dummy child"); } } public static void RegisterPrefabInPool(GameObject prefab) { IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null && !val.ResourceCache.ContainsKey(((Object)prefab).name)) { val.ResourceCache.Add(((Object)prefab).name, prefab); } } public static Item CreateItem(AssetBundle bundle, GameObject prefab, int price, ShopItemCategory category, string iconName, SFX_Instance[] impactSounds, Vector3 holdPos, Vector3 holdRot, string displayName, bool useAlternativeHoldPos, bool useAlternativeHoldRot, Vector3 alternativeHoldingPos, Vector3 alternativeHoldingRot) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); SetupPhysicsSound(prefab, impactSounds); SetupIcon(bundle, prefab, val, iconName); SetupItemBasics(val, prefab, price, category, holdPos, holdRot, displayName, useAlternativeHoldPos, useAlternativeHoldRot, alternativeHoldingPos, alternativeHoldingRot); return val; } public static void SetupIcon(AssetBundle bundle, GameObject prefab, Item item, string iconName) { Sprite val = bundle.LoadAsset<Sprite>(iconName); if ((Object)(object)val != (Object)null) { item.icon = val; } } public static void SetupPhysicsSound(GameObject prefab, SFX_Instance[] impactSounds) { PhysicsSound val = prefab.AddComponent<PhysicsSound>(); val.impactSounds = impactSounds; } public static SFX_Instance[] GetFallbackPhysicsSound(ItemDatabase db) { FieldInfo objectsField = GetObjectsField(db); List<Item> itemsFromField = GetItemsFromField(objectsField, db); return itemsFromField[0].itemObject.GetComponent<PhysicsSound>().impactSounds; } public static SFX_Instance[] CreateSFXInstanceFromClip(AudioClip customSound) { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); PhysicsSound component = itemsFromField[0].itemObject.GetComponent<PhysicsSound>(); object obj; if (component == null) { obj = null; } else { SFX_Instance[] impactSounds = component.impactSounds; obj = ((impactSounds != null) ? impactSounds[0] : null); } SFX_Instance val = (SFX_Instance)obj; if ((Object)(object)val == (Object)null) { Debug.LogError((object)"Could not find template SFX_Instance"); return GetFallbackPhysicsSound(instance); } SFX_Instance val2 = Object.Instantiate<SFX_Instance>(val); val2.clips = (AudioClip[])(object)new AudioClip[1] { customSound }; val2.settings.pitch = 1f; val2.settings.volume = 1f; return (SFX_Instance[])(object)new SFX_Instance[1] { val2 }; } public static SFX_Instance[] CreateImpactSoundFromClips(params AudioClip[] customSounds) { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); PhysicsSound component = itemsFromField[0].itemObject.GetComponent<PhysicsSound>(); object obj; if (component == null) { obj = null; } else { SFX_Instance[] impactSounds = component.impactSounds; obj = ((impactSounds != null) ? impactSounds[0] : null); } SFX_Instance val = (SFX_Instance)obj; if ((Object)(object)val == (Object)null) { Debug.LogError((object)"Could not find template SFX_Instance"); return GetFallbackPhysicsSound(instance); } SFX_Instance val2 = Object.Instantiate<SFX_Instance>(val); val2.clips = customSounds; val2.settings.pitch = 1f; val2.settings.volume = 1f; return (SFX_Instance[])(object)new SFX_Instance[1] { val2 }; } public static void SetupItemBasics(Item item, GameObject prefab, int price, ShopItemCategory category, Vector3 holdPos, Vector3 holdRot, string displayName, bool useAlternativeHoldPos, bool useAlternativeHoldRot, Vector3 alternativeHoldingPos, Vector3 alternativeHoldingRot) { //IL_0047: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) item.displayName = displayName; item.itemObject = prefab; item.persistentID = "unlistedentities." + item.displayName.ToLower(); ((Object)item).name = "unlistedentities." + item.displayName.ToLower(); item.itemType = (ItemType)1; item.Category = category; item.mass = 0.5f; item.holdPos = holdPos; item.holdRotation = holdRot; item.useAlternativeHoldingPos = useAlternativeHoldPos; item.useAlternativeHoldingRot = useAlternativeHoldRot; item.alternativeHoldPos = alternativeHoldingPos; item.alternativeHoldRot = alternativeHoldingRot; item.groundSizeMultiplier = 1f; item.groundMassMultiplier = 1f; item.purchasable = true; item.price = price; item.quantity = 1; item.spawnable = true; item.toolSpawnRarity = (RARITY)100; item.toolBudgetCost = 1; item.budgetCost = 0; item.rarity = 1f; item.content = null; item.Tooltips = new List<ItemKeyTooltip>(); } public static FieldInfo GetObjectsField(ItemDatabase db) { FieldInfo field = ((object)db).GetType().GetField("Objects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { field = ((object)db).GetType().GetField("objects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (field == null) { throw new Exception("Could not find Objects field in ItemDatabase"); } return field; } public static List<Item> GetItemsFromField(FieldInfo objectsField, ItemDatabase db) { object value = objectsField.GetValue(db); if (value is List<Item> result) { return result; } if (value is Item[] collection) { return new List<Item>(collection); } throw new Exception("Objects field is type " + (value?.GetType()?.Name ?? "null") + ", expected List<Item> or Item[]"); } public static Item? GetItemByPrefabComponent<T>() where T : Component { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); foreach (Item item in itemsFromField) { if ((Object)(object)item?.itemObject != (Object)null && (Object)(object)item.itemObject.GetComponent<T>() != (Object)null) { return item; } } return null; } public static Item CopyIconFromTemplate(List<Item> currentItems) { foreach (Item currentItem in currentItems) { if ((Object)(object)currentItem.icon != (Object)null && currentItem.purchasable) { Debug.Log((object)("Found template item with icon: " + currentItem.displayName)); return currentItem; } } Debug.LogWarning((object)"No template item found with icon!"); return null; } public static void AddItemToDatabase(Item item) { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); Item val = CopyIconFromTemplate(itemsFromField); item.id = (byte)((itemsFromField.Count > 0) ? ((byte)(itemsFromField.Max((Item i) => i.id) + 1)) : 0); itemsFromField.Add(item); objectsField.SetValue(instance, itemsFromField); Debug.Log((object)$"Item '{item.displayName}' registered with ID: {item.id}"); } public static void SetAllItemsFree() { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); foreach (Item item in itemsFromField) { if ((Object)(object)item != (Object)null) { item.price = 0; } } objectsField.SetValue(instance, itemsFromField); } public static bool CheckDuplicateItem(Item item) { ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance; FieldInfo objectsField = GetObjectsField(instance); List<Item> itemsFromField = GetItemsFromField(objectsField, instance); if (itemsFromField.Count == 0) { return false; } for (int i = 0; i < itemsFromField.Count; i++) { if (itemsFromField[i].displayName == item.displayName) { return true; } } return false; } public static Item RegisterItem(AssetBundle bundle, GameObject prefab, string displayName, int price, ShopItemCategory category, string iconName, SFX_Instance[] impactSounds, Vector3? holdPos = null, Vector3? holdRot = null, Vector3? alternativeHoldingPos = null, Vector3? alternativeHoldingRot = null, bool useAlternativeHoldPos = false, bool useAlternativeHoldRot = false) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0059: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Registering item: " + ((Object)prefab).name)); SetupPrefab(prefab); RegisterPrefabInPool(prefab); Vector3 holdPos2 = (Vector3)(((??)holdPos) ?? new Vector3(0.3f, -0.3f, 0.7f)); Vector3 holdRot2 = (Vector3)(((??)holdRot) ?? Vector3.zero); Vector3 alternativeHoldingPos2 = (Vector3)(((??)alternativeHoldingPos) ?? new Vector3(0.3f, -0.3f, 0.7f)); Vector3 alternativeHoldingRot2 = (Vector3)(((??)alternativeHoldingRot) ?? Vector3.zero); Item val = CreateItem(bundle, prefab, price, category, iconName, impactSounds, holdPos2, holdRot2, displayName, useAlternativeHoldPos, useAlternativeHoldRot, alternativeHoldingPos2, alternativeHoldingRot2); if (!CheckDuplicateItem(val)) { AddItemToDatabase(val); } return val; } } public static class Logger { private static ManualLogSource? _source; public static void Init(ManualLogSource source) { _source = source; } public static void Log(string message) { ManualLogSource? source = _source; if (source != null) { source.LogInfo((object)("[DbsContentApi] " + message)); } } public static void LogError(string message) { ManualLogSource? source = _source; if (source != null) { source.LogError((object)("[DbsContentApi] " + message)); } } public static void LogWarning(string message) { ManualLogSource? source = _source; if (source != null) { source.LogWarning((object)("[DbsContentApi] " + message)); } } } public class BudgetConfig { public int budgetCost = 1; public float rarity = 0.01f; } public class ControllerConfig { public float movementForce = 9f; public float standForce = 25f; public float gravity = 80f; public float maxStamina = 100f; public float staminaRegRate = 100f; public float staminaReActivationThreshold = 100f; public float jumpImpulse = 7f; public float jumpForceOverTime = 0.6f; public float constantGravity = 1f; } public class PlayerConfig { public float targetHeight = 3f; } public class RigCreatorConfig { public List<RigCreatorBodypart>? bodyparts; public bool useGravity; public float massMultiplier = 1f; public bool useTargetRotation = true; public float targetRotationSpring = 300f; public float targetRotationDragFactor = 0.05f; public int smartFillLegs; public int setDefaultLayer; } public class RagdollConfig { public bool addOpposingForce; public float force = 60f; public float torque = 0.1f; public float drag = 0.92f; public float angularDrag = 0.9f; } public class MonsterAnimationValuesConfig { public bool rightPunch; public bool leftPunch; public float movementMultiplier = 1f; } public class PhotonViewConfig { public ViewSynchronization synchronization = (ViewSynchronization)3; public bool observeMonsterSyncer = true; } public class BotConfig { public string monsterName = ""; public List<PatrolGroup> patrolGroups = new List<PatrolGroup> { (PatrolGroup)4, (PatrolGroup)0 }; public int attackType; public float turnVel; public float animMoveSpeedFactor = 1f; public bool alertable = true; } public class NavMeshAgentConfig { public float speed = 3.5f; public float acceleration; public float angularSpeed = 120f; public float stoppingDistance; public float radius = 1f; public float height = 2f; public int obstacleAvoidanceType = 4; } public class MobSetupConfig { public RigCreatorConfig? visualRig; public BudgetConfig? budget; public ControllerConfig? controller; public bool addAnimRefHandler; public PlayerConfig? player; public RagdollConfig? ragdoll; public PhotonViewConfig? photonView; public BotConfig? bot; public NavMeshAgentConfig? navMesh; public MonsterAnimationValuesConfig? monsterAnimationValues; public bool addMonsterAnimationHandler; public bool addMonsterSyncer; public bool addHeadFollower; public bool addGroundPos; } public class Mobs { public static void SetupCustomMonster(GameObject monster, string monsterName, MobSetupConfig config) { Logger.Log("Starting setup for custom monster: " + monsterName); if (config.budget != null) { Logger.Log(" Setting up Budget component for " + monsterName); SetupBudget(monster, config.budget); } if (config.player != null) { Logger.Log(" Setting up Player component for " + monsterName); SetupPlayer(monster, config.player); } if (config.ragdoll != null) { Logger.Log(" Setting up Ragdoll component for " + monsterName); SetupRagdoll(monster, config.ragdoll); } if (config.addMonsterSyncer) { Logger.Log(" Setting up MonsterSyncer component for " + monsterName); SetupMonsterSyncer(monster); } if (config.controller != null) { Logger.Log(" Setting up Controller component for " + monsterName); SetupController(monster, config.controller); } if (config.addAnimRefHandler) { Logger.Log(" Setting up AnimRefHandler component for " + monsterName); SetupAnimRefHandler(monster); } if (config.photonView != null) { Logger.Log(" Setting up PhotonView component for " + monsterName); SetupPhotonView(monster, config.photonView); } if (config.bot != null) { Logger.Log(" Setting up Bot component for " + monsterName); SetupBot(monster, config.bot, config.navMesh); } if (config.visualRig != null) { Logger.Log(" Setting up Visual and RigCreator for " + monsterName); SetupVisualAndRigCreator(monster, monsterName, config.visualRig); } if (config.addHeadFollower) { Logger.Log(" Setting up HeadFollower component for " + monsterName); SetupHeadFollower(monster); } if (config.addGroundPos) { Logger.Log(" Setting up GroundPositionTransform component for " + monsterName); SetupGroundPositionTransform(monster); } if (config.addMonsterAnimationHandler) { Logger.Log(" Setting up MonsterAnimationHandler component for " + monsterName); SetupMonsterAnimationHandler(monster); } if (config.monsterAnimationValues != null) { Logger.Log(" Setting up MonsterAnimationValues component for " + monsterName); SetupMonsterAnimationValues(monster, config.monsterAnimationValues); } Logger.Log("Completed setup for custom monster: " + monsterName); } private static void SetupMonsterAnimationValues(GameObject monster, MonsterAnimationValuesConfig config) { Transform val = monster.transform.Find("RigCreator"); if ((Object)(object)val == (Object)null) { throw new Exception("RigCreator not found for " + ((Object)monster).name); } MonsterAnimationValues val2 = ((Component)val).gameObject.AddComponent<MonsterAnimationValues>(); val2.rightPunch = config.rightPunch; val2.leftPunch = config.leftPunch; val2.movementMultiplier = config.movementMultiplier; } public static GameObject GetBotChildObject(GameObject customMonsterPrefab) { GameObject gameObject = ((Component)customMonsterPrefab.transform.Find("Bot_" + ((Object)customMonsterPrefab).name)).gameObject; Logger.Log(" Retrieved Bot child object '" + ((Object)gameObject).name + "' for " + ((Object)customMonsterPrefab).name); return gameObject; } public static void RestoreShaders(GameObject prefab) { Logger.Log(" Restoring shaders for " + ((Object)prefab).name); Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(); GameObject val = Resources.Load<GameObject>("Zombe"); if ((Object)(object)val == (Object)null) { Logger.LogWarning(" Zombe prefab not found, skipping shader restoration for " + ((Object)prefab).name); return; } Shader shader = val.GetComponentInChildren<Renderer>().sharedMaterial.shader; int num = 0; Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val3 in sharedMaterials) { if (((Object)val3.shader).name == "World Optimized") { val3.shader = shader; num++; } } } Logger.Log($" Restored {num} shader(s) for {((Object)prefab).name}"); } private static void SetupBudget(GameObject monster, BudgetConfig config) { BudgetCost val = monster.AddComponent<BudgetCost>(); val.budgetCost = config.budgetCost; val.rarity = config.rarity; Logger.Log($"Budget configured: cost={config.budgetCost}, rarity={config.rarity}"); } private static void SetupController(GameObject monster, ControllerConfig config) { PlayerController val = monster.AddComponent<PlayerController>(); val.movementForce = config.movementForce; val.standForce = config.standForce; val.gravity = config.gravity; val.maxStamina = config.maxStamina; val.staminaRegRate = config.staminaRegRate; val.staminaReActivationThreshold = config.staminaReActivationThreshold; val.jumpImpulse = config.jumpImpulse; val.jumpForceOverTime = config.jumpForceOverTime; val.constantGravity = config.constantGravity; Logger.Log($"Controller configured: movementForce={config.movementForce}, maxStamina={config.maxStamina}"); } private static void SetupAnimRefHandler(GameObject monster) { monster.AddComponent<PlayerAnimRefHandler>(); Logger.Log("AnimRefHandler component added"); } private static void SetupPlayer(GameObject monster, PlayerConfig config) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown Player val = monster.AddComponent<Player>(); val.ai = true; val.input = new PlayerInput(); val.data = new PlayerData(); val.data.targetHeight = config.targetHeight; val.refs = new PlayerRefs(); Logger.Log($"Player configured: targetHeight={config.targetHeight}, ai={val.ai}"); } private static void SetupRagdoll(GameObject monster, RagdollConfig config) { PlayerRagdoll val = monster.AddComponent<PlayerRagdoll>(); val.addOpposingForce = config.addOpposingForce; val.force = config.force; val.torque = config.torque; val.drag = config.drag; val.angularDrag = config.angularDrag; Logger.Log($"Ragdoll configured: force={config.force}, torque={config.torque}, drag={config.drag}"); } private static void SetupMonsterSyncer(GameObject monster) { MonsterSyncer val = monster.AddComponent<MonsterSyncer>(); val.applyData = true; Logger.Log($"MonsterSyncer component added (applyData={val.applyData})"); } private static void SetupVisualAndRigCreator(GameObject monster, string monsterName, RigCreatorConfig config) { //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Expected O, but got Unknown //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) GameObject monster2 = monster; Transform val = monster2.transform.Find("Visual"); if ((Object)(object)val == (Object)null) { throw new Exception("Visual GameObject not found for " + monsterName + ". A 'Visual' child is required."); } PlayerVisual component = ((Component)val).GetComponent<PlayerVisual>(); Transform val2 = monster2.transform.Find("RigCreator"); RigCreator val3 = ((val2 != null) ? ((Component)val2).GetComponent<RigCreator>() : null); bool flag = (Object)(object)((val2 != null) ? val2.Find("Rig") : null) != (Object)null; Logger.Log("Visual/Rig status: PlayerVisual=" + (((Object)(object)component != (Object)null) ? "exists" : "missing") + ", RigCreator=" + (((Object)(object)val3 != (Object)null) ? "exists" : "missing") + ", Rig=" + (flag ? "created" : "not created")); if ((Object)(object)component != (Object)null && (Object)(object)val3 != (Object)null && flag) { Logger.Log("Scenario 1: Both PlayerVisual and RigCreator are fully configured, nothing to do"); return; } if ((Object)(object)val3 != (Object)null && (Object)(object)component == (Object)null) { Logger.Log("Scenario 2: RigCreator exists but PlayerVisual missing, adding PlayerVisual"); PlayerVisual val4 = ((Component)val).gameObject.AddComponent<PlayerVisual>(); if (flag) { Logger.Log("Rig already created, calling SetTargets on PlayerVisual"); val4.SetTargets(); return; } Logger.Log("Rig not created yet, will call SetTargets after rig creation"); val3.createRigEvent = (UnityEvent)(((object)val3.createRigEvent) ?? ((object)new UnityEvent())); val3.createRigEvent.AddListener((UnityAction)delegate { VisualSetTargets(monster2); }); Logger.Log("Creating rig for existing RigCreator"); CustomCreateRig(val3); return; } if ((Object)(object)component == (Object)null) { Logger.Log("Scenario 4: Neither PlayerVisual nor RigCreator exist, creating both"); ((Component)val).gameObject.AddComponent<PlayerVisual>(); } else { Logger.Log("Scenario 3: PlayerVisual exists but RigCreator missing, creating RigCreator"); } if (config.bodyparts == null) { throw new Exception("bodyparts configuration is required when RigCreator doesn't exist on the prefab for " + monsterName); } Logger.Log($"Creating RigCreator GameObject with {config.bodyparts.Count} bodyparts"); GameObject val5 = new GameObject("RigCreator"); val5.transform.SetParent(monster2.transform); val5.transform.localPosition = Vector3.zero; val5.transform.localRotation = Quaternion.identity; RigCreator val6 = val5.AddComponent<RigCreator>(); val6.source = ((Component)val).gameObject; Logger.Log("RigCreator source set to Visual GameObject"); Logger.Log("Setting up RigCreator resources"); SetupRigCreatorResources(val6); Logger.Log("Applying RigCreator configuration"); val6.useGravity = config.useGravity; val6.massMultiplier = config.massMultiplier; val6.useTargetRotation = config.useTargetRotation; val6.targetRotationSpring = config.targetRotationSpring; val6.targetRotationDragFactor = config.targetRotationDragFactor; val6.smartFillLegs = config.smartFillLegs; val6.setDefaultLayer = config.setDefaultLayer; val6.bodyparts = config.bodyparts; val6.createRigEvent = new UnityEvent(); val6.createRigEvent.AddListener((UnityAction)delegate { VisualSetTargets(monster2); }); Logger.Log("Creating rig for " + monsterName); CustomCreateRig(val6); Logger.Log("Rig creation completed for " + monsterName); } private static void VisualSetTargets(GameObject monster) { Transform obj = monster.transform.Find("Visual"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val != (Object)null) { PlayerVisual component = val.GetComponent<PlayerVisual>(); if ((Object)(object)component != (Object)null) { component.SetTargets(); Logger.Log("Visual targets set successfully"); } else { Logger.LogWarning("PlayerVisual component not found on Visual for " + ((Object)monster).name); } } else { Logger.LogWarning("Visual GameObject not found for " + ((Object)monster).name); } } private static void SetupPhotonView(GameObject monster, PhotonViewConfig config) { //IL_0009: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) PhotonView val = monster.AddComponent<PhotonView>(); val.Synchronization = config.synchronization; if (config.observeMonsterSyncer) { MonsterSyncer component = monster.GetComponent<MonsterSyncer>(); if ((Object)(object)component != (Object)null) { val.ObservedComponents = new List<Component> { (Component)(object)component }; Logger.Log($"PhotonView configured: synchronization={config.synchronization}, observing MonsterSyncer"); } else { Logger.LogWarning("MonsterSyncer not found for PhotonView observation on " + ((Object)monster).name); } } else { Logger.Log($"PhotonView configured: synchronization={config.synchronization}"); } val.observableSearch = (ObservableSearch)2; } private static void SetupHeadFollower(GameObject monster) { Transform obj = monster.transform.Find("HeadPosition"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val != (Object)null) { val.AddComponent<HeadFollower>(); Logger.Log("HeadFollower component added to HeadPosition"); } else { Logger.LogWarning("HeadPosition not found for " + ((Object)monster).name); } } private static void SetupGroundPositionTransform(GameObject monster) { Transform obj = monster.transform.Find("PlayerGroundPos"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val != (Object)null) { val.AddComponent<PlayerGroundPositionTransform>(); Logger.Log("PlayerGroundPositionTransform component added to PlayerGroundPos"); } else { Logger.LogWarning("PlayerGroundPos not found for " + ((Object)monster).name); } } private static void SetupMonsterAnimationHandler(GameObject monster) { monster.AddComponent<MonsterAnimationHandler>(); Logger.Log("MonsterAnimationHandler component added"); } private static void SetupBot(GameObject monster, BotConfig botConfig, NavMeshAgentConfig? navConfig) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004d: 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) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown Logger.Log("Creating Bot GameObject 'Bot_" + botConfig.monsterName + "' for " + botConfig.monsterName); GameObject val = new GameObject("Bot_" + botConfig.monsterName); val.transform.SetParent(monster.transform); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; Logger.Log("Adding PhotonView to Bot for " + botConfig.monsterName); PhotonView val2 = val.AddComponent<PhotonView>(); val2.Synchronization = (ViewSynchronization)3; val2.observableSearch = (ObservableSearch)2; Logger.Log($"Configuring Bot component: patrolGroups={botConfig.patrolGroups.Count}, attackType={botConfig.attackType}, alertable={botConfig.alertable}"); Bot val3 = val.AddComponent<Bot>(); val3.patrolGroups = botConfig.patrolGroups; val3.attackType = botConfig.attackType; val3.turnVel = botConfig.turnVel; val3.animMoveSpeedFactor = botConfig.animMoveSpeedFactor; val3.alertable = botConfig.alertable; Transform obj = monster.transform.Find("Visual"); object centerTransform; if (obj == null) { centerTransform = null; } else { Transform obj2 = obj.Find(botConfig.monsterName); if (obj2 == null) { centerTransform = null; } else { Transform obj3 = obj2.Find("Armature"); centerTransform = ((obj3 != null) ? obj3.Find("Hip") : null); } } Transform val4 = (val3.centerTransform = (Transform)centerTransform); val3.groundTransform = monster.transform.Find("PlayerGroundPos"); val3.syncData = new SyncData { targetPlayerId = -1 }; if ((Object)(object)val4 != (Object)null) { Logger.Log("Bot centerTransform set to Hip"); } else { Logger.LogWarning("Hip transform not found for Bot centerTransform on " + botConfig.monsterName); } if (navConfig != null) { Logger.Log($"Configuring NavMeshAgent: speed={navConfig.speed}, angularSpeed={navConfig.angularSpeed}, radius={navConfig.radius}, height={navConfig.height}"); NavMeshAgent val5 = val.AddComponent<NavMeshAgent>(); val5.speed = navConfig.speed; val5.acceleration = navConfig.acceleration; val5.angularSpeed = navConfig.angularSpeed; val5.stoppingDistance = navConfig.stoppingDistance; val5.radius = navConfig.radius; val5.height = navConfig.height; val5.obstacleAvoidanceType = (ObstacleAvoidanceType)navConfig.obstacleAvoidanceType; } else { Logger.Log("No NavMeshConfig provided, skipping NavMeshAgent setup"); } Logger.Log("Adding Bot_Nav_Navmesh and Bot_RagdollCharacter components"); val.AddComponent<Bot_Nav_Navmesh>(); val.AddComponent<Bot_RagdollCharacter>(); Logger.Log("Bot setup completed for " + botConfig.monsterName); } public static void AddBotZombieComponent(GameObject botObject) { botObject.AddComponent<Bot_Zombie>(); Logger.Log(" Added Bot_Zombie component to " + ((Object)botObject).name); } public static void AddBotToolkitBoyComponent(GameObject botObject, float targetDistance = 2f) { Bot_ToolkitBoy val = botObject.AddComponent<Bot_ToolkitBoy>(); val.targetDistance = targetDistance; Logger.Log($" Added Bot_ToolkitBoy component to {((Object)botObject).name} (targetDistance={targetDistance})"); } public static void AddBotKnifoComponent(GameObject botObject, BodypartType mainRigBodyPart) { //IL_0013: 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_0078: Unknown result type (might be due to invalid IL or missing references) Bot_Knifo val = botObject.AddComponent<Bot_Knifo>(); val.targetDistance = 1f; val.mainRig = mainRigBodyPart; val.jumpForceForward = 15f; val.jumpForceUp = 15f; GameObject obj = Resources.Load<GameObject>("Knifo"); object jumpCurve; if (obj == null) { jumpCurve = null; } else { Transform obj2 = obj.transform.Find("Bot_Knifo"); jumpCurve = ((obj2 == null) ? null : ((Component)obj2).GetComponent<Bot_Knifo>()?.jumpCurve); } val.jumpCurve = (AnimationCurve)jumpCurve; Logger.Log($" Added Bot_Knifo component to {((Object)botObject).name} (mainRig={mainRigBodyPart})"); } public static void AddBotChaserComponent(GameObject botObject) { Bot_Chaser val = botObject.AddComponent<Bot_Chaser>(); val.exhastionTime = 20f; val.fleeForSeconds = 20f; val.hidingExhastionMultiplier = 1f; val.timeToLoseTarget = 2f; val.targetDistance = 3f; val.backUpIfTooClose = true; val.useWorldMoveInChase = true; val.canRotateWhenStandingStill = true; val.chaseTurnRate = 6f; val.fleeTurnRate = 6f; val.investigateTurnRate = 3f; val.patrolTurnRate = 3f; val.maxRange = 70f; val.maxAngle = 110f; val.timeToSeeTarget = 1f; Logger.Log($" Added Bot_Chaser component to {((Object)botObject).name} (maxRange={val.maxRange}, targetDistance={val.targetDistance})"); } public static void AddBotDragComponent(GameObject botObject) { Bot_Drag val = botObject.AddComponent<Bot_Drag>(); val.dragForce = 150f; val.handForce = 150f; val.range = 2f; Logger.Log($" Added Bot_Drag component to {((Object)botObject).name} (dragForce={val.dragForce}, range={val.range})"); } private static void SetupRigCreatorResources(RigCreator rigCreator) { RigCreator val = null; RigCreator[] array = Resources.FindObjectsOfTypeAll<RigCreator>(); foreach (RigCreator val2 in array) { if ((Object)(object)val2.boxColldier != (Object)null && (Object)(object)val2.capsuleCol != (Object)null && (Object)(object)val2.slipperyMat != (Object)null) { val = val2; Logger.Log(" Found RigCreator template from existing instance"); break; } } if ((Object)(object)val == (Object)null) { Logger.Log(" Searching for Zombe prefab as RigCreator template"); GameObject val3 = Resources.Load<GameObject>("Zombe"); if ((Object)(object)val3 != (Object)null) { val = val3.GetComponentInChildren<RigCreator>(true); if ((Object)(object)val != (Object)null) { Logger.Log(" Found RigCreator template from Zombe prefab"); } } } if ((Object)(object)val != (Object)null) { rigCreator.boxColldier = val.boxColldier; rigCreator.capsuleCol = val.capsuleCol; rigCreator.sphereCol = val.sphereCol; rigCreator.slipperyMat = val.slipperyMat; Logger.Log(" RigCreator resources copied from template"); } else if ((Object)(object)rigCreator.slipperyMat == (Object)null) { Logger.Log(" Searching for slippery PhysicMaterial"); PhysicsMaterial[] array2 = Resources.FindObjectsOfTypeAll<PhysicsMaterial>(); foreach (PhysicsMaterial val4 in array2) { if (((Object)val4).name.ToLower().Contains("slippery")) { rigCreator.slipperyMat = val4; Logger.Log(" Found slippery PhysicMaterial: " + ((Object)val4).name); break; } } } else { Logger.LogWarning(" No RigCreator template found and no slippery material available"); } } private static void CustomCreateRig(RigCreator rigCreator) { //IL_005e: 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) Logger.Log(" SmartFillLegs()"); rigCreator.SmartFillLegs(); Transform val = ((Component)rigCreator).gameObject.transform.Find("Rig"); if (Object.op_Implicit((Object)(object)val)) { Logger.Log(" Destroying existing Rig GameObject"); Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } Logger.Log(" Instantiating rig source"); GameObject val2 = Object.Instantiate<GameObject>(rigCreator.source, ((Component)rigCreator).gameObject.transform.position, ((Component)rigCreator).gameObject.transform.rotation, ((Component)rigCreator).gameObject.transform); val2.SetActive(true); ((Object)val2).name = "Rig"; Logger.Log(" Clearing mesh and registering parts"); rigCreator.ClearMesh(val2); rigCreator.RegisterParts(); Logger.Log(" Configuring rotations"); rigCreator.ConfigRotations(); Logger.Log(" Adding rigs"); rigCreator.AddRigs(); int num = 0; for (int i = 0; i < rigCreator.bodyparts.Count; i++) { if (Object.op_Implicit((Object)(object)rigCreator.bodyparts[i].rigObject) && rigCreator.bodyparts[i].joint.hasJoint) { rigCreator.bodyparts[i].rigObject.AddComponent<RigCreatorJoint>().Init(rigCreator, rigCreator.bodyparts[i]); rigCreator.bodyparts[i].joint.SpawnJoint(rigCreator.bodyparts[i].rig, ((Component)rigCreator.bodyparts[i].rigObject.transform.parent).GetComponentInParent<Rigidbody>(t